<%@ page import="java.text.DateFormat" %> <%@ page import="java.text.SimpleDateFormat" %> <%@ page import="java.util.Date" %> <%@ page import="java.util.Calendar" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Collections" %> <%@ page import="java.util.Comparator" %> <%@page import="com.insightguru.giraffe.common.constant.UserProfileBitFlags"%> <%@page import="com.insightguru.giraffe.server.Configuration"%> <%@page import="com.insightguru.giraffe.server.htmlserviceimpl.HtmlServiceImpl"%> <%@page import="com.insightguru.giraffe.server.domain.DailyQuiz"%> <%@page import="com.insightguru.giraffe.server.domain.Company"%> <%@page import="com.insightguru.giraffe.server.domain.ModelId"%> <%@page import="com.insightguru.giraffe.server.domain.User"%> <%@page import="com.insightguru.giraffe.server.dao.DailyQuizDAO"%> <%@page import="com.insightguru.giraffe.server.dao.CompanyDAO"%> <%@page import="com.insightguru.giraffe.server.dao.UserDAO"%> <%@page import="com.insightguru.giraffe.server.utils.ShareUtil"%> <%@page import="com.insightguru.giraffe.server.controller.LoginController"%> <%@page import="com.insightguru.giraffe.server.utils.LinkUtil"%> <%@ page import="org.json.JSONArray" %> <%@ page import="org.owasp.esapi.ESAPI" %> <%@ page import="org.owasp.esapi.Encoder" %> <%! DateFormat dateFormat = SimpleDateFormat.getDateInstance(DateFormat.SHORT); %> <%@page import="org.json.JSONObject"%> <%@page import="com.insightguru.giraffe.server.domain.DailyQuizAnswer"%> <%@page import="java.util.ArrayList"%> <%@page import="com.insightguru.giraffe.server.utils.TextUtil"%> <%@page import="com.insightguru.giraffe.server.utils.DailyQuizUtil"%> <%@page import="com.insightguru.giraffe.server.dao.CategorizedFeedDAO"%> <%@page import="com.insightguru.giraffe.server.domain.CategorizedFeed"%> <%@page import="com.insightguru.giraffe.server.domain.CategorizedFeed.CategorizedFeedContent"%> Add or Edit a Feed <%@ include file="components/commonHead.jsp" %>
<% User loggedInUser = UserDAO.getCurrentUser(); if(loggedInUser == null || !UserProfileBitFlags.isAdmin(loggedInUser)) { %>

Admin Access Only

Logout and try again <% } else { %>

Trefis Feeds

<% if("submit".equals(request.getParameter("do"))) { boolean editing = request.getParameter("id") != null; // first parse params boolean valid = true; CategorizedFeed.CategorizedFeedContent contentType = CategorizedFeed.CategorizedFeedContent.values()[ServletUtil.getIntegerParameter(request, "contentType")]; CategorizedFeed.CategorizedFeedStrip contentStrip = CategorizedFeed.CategorizedFeedStrip.values()[ServletUtil.getIntegerParameter(request, "contentStrip")]; Integer maxItems = ServletUtil.getIntegerParameter(request, "maxItems"); Integer maxWords = ServletUtil.getIntegerParameter(request, "maxWords"); Boolean enabled = ServletUtil.getBooleanParameter(request, "enabled"); Boolean excludeMemberForecasts = ServletUtil.getBooleanParameter(request, "excludeMemberForecasts"); Integer embargoMinutes = ServletUtil.getIntegerParameter(request, "embargoMinutes"); String feedurl = request.getParameter("feedurl"); boolean adjustDateForEmbargo = ServletUtil.getBooleanParameter(request, "adjustDateForEmbargo"); boolean useRic = ServletUtil.getBooleanParameter(request, "useRic"); boolean manuallyManaged = ServletUtil.getBooleanParameter(request, "manuallyManaged"); boolean extraSnippet = ServletUtil.getBooleanParameter(request, "extraSnippet"); boolean etradeWidgets = ServletUtil.getBooleanParameter(request, "etradeWidgets"); boolean removeNonTrefisLinks = ServletUtil.getBooleanParameter(request, "removeNonTrefisLinks"); boolean useShortGuid = ServletUtil.getBooleanParameter(request, "useShortGuid"); boolean excludeAggregate = ServletUtil.getBooleanParameter(request, "excludeAggregate"); boolean excludeModelDiff = ServletUtil.getBooleanParameter(request, "excludeModelDiff"); boolean excludeSlideshow = ServletUtil.getBooleanParameter(request, "excludeSlideshow"); Integer maxImageWidth = ServletUtil.getIntegerParameter(request, "maxImageWidth"); boolean useNarrowSymbols = ServletUtil.getBooleanParameter(request, "useNarrowSymbols"); boolean excludeNonEmail = ServletUtil.getBooleanParameter(request, "excludeNonEmail"); CategorizedFeed feed; if(editing) feed = CategorizedFeedDAO.get(Integer.parseInt(request.getParameter("id"))); else feed = new CategorizedFeed(); feed.setFeedurl(feedurl); feed.setEnabled(enabled); feed.setMaxItems(maxItems); feed.setContentType(contentType); feed.setStripType(contentStrip); feed.setMaxWords(maxWords); feed.setEmbargoMinutes(embargoMinutes); feed.setExcludeMemberForecasts(excludeMemberForecasts); feed.setAdjustDateForEmbargo(adjustDateForEmbargo); feed.setUseRic(useRic); feed.setManuallyManaged(manuallyManaged); feed.setExtraSnippet(extraSnippet); feed.setEtradeWidgets(etradeWidgets); feed.setRemoveNonTrefisLinks(removeNonTrefisLinks); feed.setUseShortGuid(useShortGuid); feed.setExcludeAggregate(excludeAggregate); feed.setExcludeModelDiff(excludeModelDiff); feed.setExcludeSlideshow(excludeSlideshow); feed.setMaxImageWidth(maxImageWidth); feed.setUseNarrowSymbols(useNarrowSymbols); feed.setExcludeNonEmail(excludeNonEmail); if(!editing) CategorizedFeedDAO.addCategorizedFeed(feed); %>

Feed <%= editing ? "edited" : "added" %>!

<% } %> <% if("delete".equals(request.getParameter("do"))) { CategorizedFeedDAO.deleteCategorizedFeed(Integer.parseInt(request.getParameter("id"))); %>

Feed deleted!

<% } %> <% if("add".equals(request.getParameter("do")) || "edit".equals(request.getParameter("do"))) { CategorizedFeed feedToEdit = null; if("edit".equals(request.getParameter("do"))) feedToEdit = CategorizedFeedDAO.get(Integer.parseInt(request.getParameter("id"))); %>
Feed URL Suffix (i.e. "zecco.xml"): ">
Enabled: />
Max Items (i.e. 200): ">
Feed Content:
Tag Stripping:
Max Words (blank for unlimited): ">
Embargo Minutes (blank for 20 minutes): ">
Exclude Member Forecast Articles: />
Adjust Dates for Embargo: />
Use Reuters Instrument Code (RIC) for Symbols: />
Manually managed? />
Extra <trefis:abstract> snippet? />
ETRADE params in widgets? />
Remove non-Trefis links? />
Use short guid? />
Exclude aggregate? />
Exclude model diff? />
Exclude slideshow? />
Max Image Width ">
Use narrow symbols? />
Exclude non-email? />
Cancel
<% if(feedToEdit != null) { %> <% } %>
<% } else { // end adding or editing quiz form %> Add a new feed <% final List feeds; feeds = CategorizedFeedDAO.getAllFeeds(); for (CategorizedFeed feed : feeds) { %> <% } %>
ID Feed Url Enabled Max Items Feed Content Tag Stripping Max Words Embargo Minutes Exclude Member Forecasts Adjust Date For Embargo Use RIC Manual Extra Snippet ETRADE widgets Remove non-Trefis links Use short guid Exclude aggregate Exclude Model Diff Exclude Slideshow Max Image Width Narrow Symbols Exclude Non-Email Actions
<%= feed.getId() %> <%= feed.getFeedurl() %> <%= feed.getEnabled() %> <%= feed.getMaxItems() %> <%= feed.getContentType().name() %> <%= feed.getStripType().name() %> <%= feed.getMaxWords() %> <%= feed.getEmbargoMinutes() %> <%= feed.getExcludeMemberForecasts() %> <%= feed.isAdjustDateForEmbargo() %> <%= feed.isUseRic() %> <%= feed.isManuallyManaged() %> <%= feed.isExtraSnippet() %> <%= feed.isEtradeWidgets() %> <%= feed.isRemoveNonTrefisLinks() %> <%= feed.isUseShortGuid() %> <%= feed.isExcludeAggregate() %> <%= feed.isExcludeModelDiff() %> <%= feed.isExcludeSlideshow() %> <%= feed.getMaxImageWidth() %> <%= feed.isUseNarrowSymbols() %> <%= feed.isExcludeNonEmail() %> ">View || Edit || Delete
<% } %> <% } %>