@Override
  public String render(RenderRequest renderRequest, RenderResponse renderResponse)
      throws PortletException {

    try {
      WikiNode node = ActionUtil.getNode(renderRequest);

      renderRequest.setAttribute(WikiWebKeys.WIKI_NODE, node);

      WikiPage page = ActionUtil.getPage(renderRequest);

      renderRequest.setAttribute(WikiWebKeys.WIKI_PAGE, page);
    } catch (Exception e) {
      if (e instanceof NoSuchNodeException
          || e instanceof NoSuchPageException
          || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass());

        return "/wiki/error.jsp";
      } else {
        throw new PortletException(e);
      }
    }

    return "/wiki/edit_page_attachment.jsp";
  }
Пример #2
0
  @Override
  public void render(RenderRequest renderRequest, RenderResponse renderResponse)
      throws PortletException, IOException {

    try {
      int status = getStatus(renderRequest);

      renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_STATUS, status);

      KBArticle kbArticle = null;

      long resourcePrimKey = getResourcePrimKey(renderRequest);

      if (resourcePrimKey > 0) {
        kbArticle = KBArticleServiceUtil.getLatestKBArticle(resourcePrimKey, status);
      }

      renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_KB_ARTICLE, kbArticle);
    } catch (Exception e) {
      if (e instanceof NoSuchArticleException || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass().getName());

        PortletConfig portletConfig = getPortletConfig();

        SessionMessages.add(
            renderRequest,
            portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
      } else {
        throw new PortletException(e);
      }
    }

    super.render(renderRequest, renderResponse);
  }
Пример #3
0
  @Override
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    long actionId = ParamUtil.getLong(renderRequest, "actionId");

    MDRAction action = MDRActionServiceUtil.fetchAction(actionId);

    renderRequest.setAttribute(WebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_ACTION, action);

    String type = BeanPropertiesUtil.getString(action, "type");

    renderRequest.setAttribute(WebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_ACTION_TYPE, type);

    String editorJSP = getEditorJSP(type);

    renderRequest.setAttribute(WebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_ACTION_EDITOR_JSP, editorJSP);

    long ruleGroupInstanceId = BeanParamUtil.getLong(action, renderRequest, "ruleGroupInstanceId");

    MDRRuleGroupInstance ruleGroupInstance =
        MDRRuleGroupInstanceLocalServiceUtil.getMDRRuleGroupInstance(ruleGroupInstanceId);

    renderRequest.setAttribute(WebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_INSTANCE, ruleGroupInstance);

    return mapping.findForward("portlet.mobile_device_rules.edit_action");
  }
  protected void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {

    _log.debug("VIEW");

    // Portlet preferences
    PortletPreferences prefs = request.getPreferences();
    String users = prefs.getValue("users", "root");

    // Business Invocation
    BlogAPI blogService = blogService();

    ArrayList<Blog> blogs = blogService.getBlogs();

    // Checking Admin rights
    if (request.getUserPrincipal() != null && request.getUserPrincipal().getName() != null) {
      for (String user : users.split(","))
        if (user.equals(request.getUserPrincipal().getName())) {
          request.setAttribute("admin", request.getUserPrincipal().getName());
          break;
        }
    } else {
      request.setAttribute("admin", null);
    }

    request.setAttribute("blogs", blogs);

    // Controlling the view
    String view = "/jsp/management.jsp";

    PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(view);
    prd.include(request, response);
  }
  @Override
  public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {
    PortletSession session = request.getPortletSession();
    MainSessionController mainSessionController =
        (MainSessionController)
            session.getAttribute(
                MainSessionController.MAIN_SESSION_CONTROLLER_ATT,
                PortletSession.APPLICATION_SCOPE);

    String spaceId =
        (String)
            session.getAttribute("Silverpeas_Portlet_SpaceId", PortletSession.APPLICATION_SCOPE);

    PortletPreferences pref = request.getPreferences();
    int nbPublis = 5;
    if (StringUtil.isInteger(pref.getValue("nbPublis", "5"))) {
      nbPublis = Integer.parseInt(pref.getValue("nbPublis", "5"));
    }
    int maxAge = 0;
    if (StringUtil.isInteger(pref.getValue("maxAge", "0"))) {
      maxAge = Integer.parseInt(pref.getValue("maxAge", "0"));
    }
    KmeliaTransversal kmeliaTransversal = new KmeliaTransversal(mainSessionController);
    List<PublicationDetail> publications =
        kmeliaTransversal.getUpdatedPublications(spaceId, maxAge, nbPublis);
    if (StringUtil.isDefined(spaceId)) {
      String rssUrl = getRSSUrl(mainSessionController, spaceId);
      request.setAttribute("rssUrl", rssUrl);
    }
    request.setAttribute("Publications", publications);
    include(request, response, "portlet.jsp");
  }
Пример #6
0
  @Override
  public void render(RenderRequest renderRequest, RenderResponse renderResponse)
      throws PortletException, IOException {

    try {
      int status = getStatus(renderRequest);

      renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_STATUS, status);

      KBArticle kbArticle = null;

      long resourcePrimKey = ParamUtil.getLong(renderRequest, "resourcePrimKey");

      if (resourcePrimKey > 0) {
        kbArticle = KBArticleServiceUtil.getLatestKBArticle(resourcePrimKey, status);
      }

      renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_KB_ARTICLE, kbArticle);
    } catch (Exception e) {
      if (e instanceof NoSuchArticleException || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass().getName());
      } else {
        throw new PortletException(e);
      }
    }

    super.render(renderRequest, renderResponse);
  }
Пример #7
0
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig config,
      RenderRequest req,
      RenderResponse res)
      throws Exception {
    if (getForward(req) != null && !getForward(req).equals("")) {
      return mapping.findForward(getForward(req)); // Use forward set in processAction if available
    } else {
      List<LinhVucThuTucHanhChinh> linhVucThuTucHanhChinhList =
          new ArrayList<LinhVucThuTucHanhChinh>();
      linhVucThuTucHanhChinhList = LinhVucThuTucHanhChinhLocalServiceUtil.findByActive(1);

      List<DonViThuTuc> capThanhPhoList = DonViThuTucLocalServiceUtil.findByCapDonVi_Active(1, 1);
      List<DonViThuTuc> capQuanHuyenList = DonViThuTucLocalServiceUtil.findByCapDonVi_Active(2, 1);
      List<DonViThuTuc> capPhuongXaList = DonViThuTucLocalServiceUtil.findByCapDonVi_Active(3, 1);

      req.setAttribute("linhVucThuTucHanhChinhList", linhVucThuTucHanhChinhList);
      req.setAttribute("capThanhPhoList", capThanhPhoList);
      req.setAttribute("capQuanHuyenList", capQuanHuyenList);
      req.setAttribute("capPhuongXaList", capPhuongXaList);
      return mapping.findForward("portlet.nss.thu_tuc_hanh_chinh_display.view");
    }
  }
  // Read access token from DB and display error message if it's not available
  protected AccessToken loadAccessTokenOrRedirectToObtainIt(
      String username, OAuthProvider oauthProvider, RenderRequest request, RenderResponse response)
      throws IOException, PortletException {
    // Try requestContext first. Otherwise obtain OAuthProvider via API
    AccessToken accessToken = requestContext.getAccessToken(oauthProviderKey);
    if (accessToken == null) {
      accessToken = oauthProvider.loadAccessToken(username);
    }

    if (accessToken == null) {
      // Will be processed by method AbstractSocialPortlet.actionRedirectToOAuthFlow
      PortletURL actionURL = response.createActionURL();
      actionURL.setParameter(
          ActionRequest.ACTION_NAME, AbstractSocialPortlet.ACTION_OAUTH_REDIRECT);

      request.setAttribute(
          ATTRIBUTE_ERROR_MESSAGE,
          oauthProvider.getFriendlyName() + " access token not available for you.");
      request.setAttribute(ATTRIBUTE_OAUTH_PROVIDER, oauthProvider);
      PortletRequestDispatcher prd =
          filterConfig.getPortletContext().getRequestDispatcher("/jsp/error/token.jsp");
      prd.include(request, response);
    }

    return accessToken;
  }
Пример #9
0
  @Override
  public void render(RenderRequest req, RenderResponse res) throws PortletException, IOException {
    // TODO Auto-generated method stub

    PortletPreferences prefs = req.getPreferences();
    try {
      List listCategory = ClipTypeServiceUtil.findAll();
      List listTopClip = ClipServiceUtil.getAll(0, 5);
      req.setAttribute(WebKeysVClip.CLIP_TYPE_RESULT_SEARCH, listCategory);

      String obj = ParamUtil.getString(req, WebKeysVClip.OBJECT);

      if (obj.equals(ClipType.class.getName())) {
        String clipTypeId = ParamUtil.getString(req, WebKeysVClip.CLIP_TYPE_ID);
        ClipType tfCategory = new ClipTypeImpl();
        if (Validator.isNotNull(Long.valueOf(clipTypeId))) {
          tfCategory = ClipTypeServiceUtil.findById(clipTypeId);
        }
        req.setAttribute("tfCategory", tfCategory);

        Clip clipFirst = ClipServiceUtil.getByClipTypeId(clipTypeId);
        req.setAttribute(WebKeysVClip.CLIP, clipFirst);

      } else {
        Clip clipSecond = ClipServiceUtil.getFirst();
        req.setAttribute(WebKeysVClip.CLIP, clipSecond);
        req.setAttribute(WebKeysVClip.LIST_TOP_CLIP, listTopClip);
      }
    } catch (Exception e) {
      // TODO: handle exception
    }

    super.render(req, res);
  }
Пример #10
0
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig config,
      RenderRequest req,
      RenderResponse res)
      throws Exception {

    String cityId = ParamUtil.getString(req, "cityId");
    String districtId = ParamUtil.getString(req, "districtId");
    req.setAttribute("cityId", cityId);
    req.setAttribute("districtId", districtId);
    //		City city = null;
    //		District district = null;
    //		try {
    //			city = CityLocalServiceUtil.getCity(cityId);
    //			district = DistrictLocalServiceUtil.getDistrict(districtId);
    //			req.setAttribute("city", city);
    //			req.setAttribute("district", district);
    //		} catch (Exception e) {
    //		}

    getDistrictList(req);
    return mapping.findForward("portlet.sgs.citymanagement.wardmanagement");
  }
  @Override
  protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    renderRequest.setAttribute(ApplicationListWebKeys.GROUP_PROVIDER, _groupProvider);
    renderRequest.setAttribute(ApplicationListWebKeys.PANEL_APP_REGISTRY, _panelAppRegistry);
    renderRequest.setAttribute(
        ApplicationListWebKeys.PANEL_CATEGORY_REGISTRY, _panelCategoryRegistry);

    super.doDispatch(renderRequest, renderResponse);
  }
  @Override
  public void render(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {

    PortletPreferences preferences = request.getPreferences();
    String defaultArticle = preferences.getValue(DEFAULT_ARTICLE, LR_EMPTY_VALUE);
    String[] addedArticleIds =
        preferences.getValue(ARTICLE_ID, LR_EMPTY_VALUE).split(ARTICLE_SELECTION_DELIMITER);
    request.setAttribute(DEFAULT_ARTICLE, defaultArticle);
    request.setAttribute(ADDED_ARTICLE_IDS, addedArticleIds);
    super.render(request, response);
  }
  protected void compareVersions(RenderRequest renderRequest) throws Exception {

    long fileEntryId = ParamUtil.getLong(renderRequest, "fileEntryId");

    String sourceVersion = ParamUtil.getString(renderRequest, "sourceVersion");
    String targetVersion = ParamUtil.getString(renderRequest, "targetVersion");

    FileEntry fileEntry = DLAppServiceUtil.getFileEntry(fileEntryId);

    String extension = fileEntry.getExtension();

    FileVersion sourceFileVersion = fileEntry.getFileVersion(sourceVersion);

    String sourceTitle = sourceFileVersion.getTitle();

    FileVersion targetFileVersion = fileEntry.getFileVersion(targetVersion);

    String targetTitle = targetFileVersion.getTitle();

    InputStream sourceIs = fileEntry.getContentStream(sourceVersion);
    InputStream targetIs = fileEntry.getContentStream(targetVersion);

    if (extension.equals("htm") || extension.equals("html") || extension.equals("xml")) {

      String escapedSource = HtmlUtil.escape(StringUtil.read(sourceIs));
      String escapedTarget = HtmlUtil.escape(StringUtil.read(targetIs));

      sourceIs = new UnsyncByteArrayInputStream(escapedSource.getBytes(StringPool.UTF8));
      targetIs = new UnsyncByteArrayInputStream(escapedTarget.getBytes(StringPool.UTF8));
    }

    if (DocumentConversionUtil.isEnabled()
        && DocumentConversionUtil.isConvertBeforeCompare(extension)) {

      String sourceTempFileId = DLUtil.getTempFileId(fileEntryId, sourceVersion);
      String targetTempFileId = DLUtil.getTempFileId(fileEntryId, targetVersion);

      sourceIs =
          new FileInputStream(
              DocumentConversionUtil.convert(sourceTempFileId, sourceIs, extension, "txt"));
      targetIs =
          new FileInputStream(
              DocumentConversionUtil.convert(targetTempFileId, targetIs, extension, "txt"));
    }

    List<DiffResult>[] diffResults =
        DiffUtil.diff(new InputStreamReader(sourceIs), new InputStreamReader(targetIs));

    renderRequest.setAttribute(WebKeys.SOURCE_NAME, sourceTitle + StringPool.SPACE + sourceVersion);
    renderRequest.setAttribute(WebKeys.TARGET_NAME, targetTitle + StringPool.SPACE + targetVersion);
    renderRequest.setAttribute(WebKeys.DIFF_RESULTS, diffResults);
  }
Пример #14
0
  private void getDistrictList(RenderRequest req) throws Exception {
    String districtId = ParamUtil.getString(req, "districtId", "");
    District district = DistrictLocalServiceUtil.getDistrict(districtId);

    String cityId = district.getCityID();
    City city = CityLocalServiceUtil.getCity(cityId);

    List<Wards> wardsList = WardsUtil.findByDistrictId(districtId);

    req.setAttribute("wardsList", wardsList);
    req.setAttribute("district", district);
    req.setAttribute("city", city);
  }
 @Override
 public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
     throws IOException, PortletException {
   ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
   renderRequest.setAttribute(
       "portletList",
       LocationTrackerUtil.getPortletList(themeDisplay.getCompanyId(), themeDisplay.getLocale()));
   renderRequest.setAttribute(
       "searchContainer", LocationTrackerUtil.getSearchContainer(renderRequest, renderResponse));
   String portletId = ParamUtil.getString(renderRequest, "portletId");
   renderRequest.setAttribute("selectedPortletId", portletId);
   // renderRequest.setAttribute("portletDetailList",
   // LocationTrackerUtil.findPortlet(renderRequest));
   include(viewJSP, renderRequest, renderResponse);
 }
  public String doView(RenderRequest request, RenderResponse response) throws Exception {
    // The JSP to show upon success
    String defaultView = VIEW_PAGE;

    String ctx = request.getContextPath();

    // Determine the project container to use
    Project project = findProject(request);

    // Check the user's permissions
    User user = getUser(request);
    if (!ProjectUtils.hasAccess(project.getId(), user, "project-discussion-topics-view")) {
      throw new PortletException("Unauthorized to view in this project");
    }

    // Retrieve parameters
    int forumId = PortalUtils.getPageViewAsInt(request);
    String resetList = request.getParameter("resetList");

    // Build a list of records
    Connection db = useConnection(request);

    // Paging will be used for remembering several list view settings
    if ("true".equals(resetList)) {
      // deletePagedListInfo(request, "projectIssuesInfo");
    }
    PagedListInfo pagedListInfo = getPagedListInfo(request, PAGED_LIST_INFO);
    pagedListInfo.setLink(ctx + "/show/" + project.getUniqueId() + "/forum/" + forumId);
    if (pagedListInfo.getInitializationLevel() == PagedListInfo.LEVEL_INITIALIZED) {
      pagedListInfo.setColumnToSortBy("i.last_reply_date");
      pagedListInfo.setSortOrder("desc");
    }

    // Load the category info
    Forum forum = new Forum(db, forumId, project.getId());
    request.setAttribute(FORUM, forum);
    PortalUtils.setGeneratedData(request, FORUM, forum);
    // Load the records
    TopicList topicList = new TopicList();
    topicList.setProjectId(project.getId());
    topicList.setCategoryId(forum.getId());
    topicList.setPagedListInfo(pagedListInfo);
    topicList.buildList(db);
    request.setAttribute(TOPIC_LIST, topicList);

    // JSP view
    return defaultView;
  }
  public DDLFormDisplayContext(
      RenderRequest renderRequest,
      RenderResponse renderResponse,
      DDLRecordSetService ddlRecordSetService,
      DDMFormRenderer ddmFormRenderer,
      DDMFormValuesFactory ddmFormValuesFactory,
      WorkflowDefinitionLinkLocalService workflowDefinitionLinkLocalService)
      throws PortalException {

    _renderRequest = renderRequest;
    _renderResponse = renderResponse;
    _ddlRecordSetService = ddlRecordSetService;
    _ddmFormRenderer = ddmFormRenderer;
    _ddmFormValuesFactory = ddmFormValuesFactory;
    _workflowDefinitionLinkLocalService = workflowDefinitionLinkLocalService;

    if (Validator.isNotNull(getPortletResource())) {
      return;
    }

    DDLRecordSet recordSet = getRecordSet();

    if ((recordSet == null) || !hasViewPermission()) {
      renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE);
    }
  }
Пример #18
0
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig config,
      RenderRequest req,
      RenderResponse res)
      throws Exception {
    String delete = ParamUtil.getString(req, "delete");
    req.setAttribute("flag", ParamUtil.getString(req, "flag"));
    if (getForward(req) != null && !getForward(req).equals("")) {
      return mapping.findForward(getForward(req)); // Use forward set in processAction if available
    } else if (delete.equalsIgnoreCase("delete")) {
      long companyId = ParamUtil.getLong(req, "companyId", 0);
      long documentReceiptId = ParamUtil.getLong(req, "documentReceiptId");
      List<PmlEdmAttachedFile> attachedFiles =
          PmlEdmAttachedFileUtil.findByObjectContentId_ObjectType(
              documentReceiptId, new PmlEdmDocumentReceiptImpl().getClass().getName());

      try {
        for (PmlEdmAttachedFile p : attachedFiles) {
          PmlEdmAttachedFileLocalServiceUtil.deletePmlEdmAttachedFile(p);
        }
        PmlEdmDocumentReceiptLocalServiceUtil.deletePmlEdmDocumentReceipt(
            companyId, documentReceiptId);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return mapping.findForward("portlet.sgs.doccumentprivate.view");
  }
  @Override
  protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    try {
      getGroup(renderRequest);
    } catch (Exception e) {
      if (e instanceof NoSuchGroupException || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass());
      } else {
        throw new PortletException(e);
      }
    }

    if (SessionErrors.contains(renderRequest, NoSuchGroupException.class.getName())
        || SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses())) {

      include("/error.jsp", renderRequest, renderResponse);
    } else {
      try {
        ServiceContext serviceContext = ServiceContextFactory.getInstance(renderRequest);

        ServiceContextThreadLocal.pushServiceContext(serviceContext);
      } catch (Exception e) {
        if (_log.isWarnEnabled()) {
          _log.warn(e, e);
        }
      }

      renderRequest.setAttribute(ApplicationListWebKeys.GROUP_PROVIDER, groupProvider);

      super.doDispatch(renderRequest, renderResponse);
    }
  }
Пример #20
0
  @Override
  public ActionForward render(
      ActionMapping actionMapping,
      ActionForm actionForm,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

    try {
      renderRequest.setAttribute(
          WebKeys.SOCIAL_ACTIVITY_SETTINGS_MAP, getActivitySettingsMap(themeDisplay));
    } catch (Exception e) {
      if (e instanceof PrincipalException) {
        SessionErrors.add(renderRequest, e.getClass());

        return actionMapping.findForward("portlet.social_activity.error");
      } else {
        throw e;
      }
    }

    return actionMapping.findForward("portlet.social_activity.view");
  }
  public String doView(RenderRequest request, RenderResponse response) throws Exception {
    // The JSP to show upon success
    String defaultView = VIEW_PAGE;

    // Determine the project container to use
    Project project = findProject(request);

    // Check the user's permissions
    User user = PortalUtils.getUser(request);
    if (!ProjectUtils.hasAccess(project.getId(), user, "project-wiki-view")) {
      throw new PortletException("Unauthorized to view in this project");
    }

    // Load the records
    Connection db = useConnection(request);
    WikiList wikiList = new WikiList();
    wikiList.setProjectId(project.getId());
    PagedListInfo pagedList = new PagedListInfo();
    pagedList.setColumnToSortBy(DatabaseUtils.toLowerCase(db, "w.subject"));
    pagedList.setItemsPerPage(-1);
    wikiList.setPagedListInfo(pagedList);
    wikiList.buildList(db);
    request.setAttribute(WIKI_LIST, wikiList);

    // JSP view
    return defaultView;
  }
Пример #22
0
 public void doView(RenderRequest request, RenderResponse response)
     throws PortletException, IOException {
   String siteName = request.getPreferences().getValue("SRC", null);
   SSOSite site = null;
   if (siteName != null) {
     site = sso.getSiteByUrl(siteName);
   }
   if (site == null) {
     response.getWriter().print(NO_CREDENTIALS);
     return;
   } else {
     PasswordCredential pwc = SSOPortletUtil.getCredentialsForSite(sso, siteName, request);
     if (pwc != null) {
       request.setAttribute(SSO_REQUEST_ATTRIBUTE_USERNAME, pwc.getUserName());
       request.setAttribute(SSO_REQUEST_ATTRIBUTE_PASSWORD, pwc.getPassword());
     } else {
       response.getWriter().print(NO_CREDENTIALS);
       return;
     }
   }
   StatusMessage msg =
       (StatusMessage) PortletMessaging.consume(request, "SSOWebContent", "status");
   if (msg != null) {
     this.getContext(request).put("statusMsg", msg);
   }
   super.doView(request, response);
 }
  @Override
  public void render(RenderRequest portletReq, RenderResponse portletResp)
      throws PortletException, IOException {
    LOGGER.entering(LOG_CLASS, "main portlet render entry");

    long tid = Thread.currentThread().getId();
    portletReq.setAttribute(THREADID_ATTR, tid);

    PrintWriter writer = portletResp.getWriter();

    writer.write(
        "<div id=\"DispatcherTests_SPEC2_19_ForwardServletResource\">no resource output.</div>\n");
    ResourceURL resurl = portletResp.createResourceURL();
    resurl.setCacheability(PAGE);
    writer.write("<script>\n");
    writer.write("(function () {\n");
    writer.write("   var xhr = new XMLHttpRequest();\n");
    writer.write("   xhr.onreadystatechange=function() {\n");
    writer.write("      if (xhr.readyState==4 && xhr.status==200) {\n");
    writer.write(
        "         document.getElementById(\"DispatcherTests_SPEC2_19_ForwardServletResource\").innerHTML=xhr.responseText;\n");
    writer.write("      }\n");
    writer.write("   };\n");
    writer.write("   xhr.open(\"GET\",\"" + resurl.toString() + "\",true);\n");
    writer.write("   xhr.send();\n");
    writer.write("})();\n");
    writer.write("</script>\n");
  }
  public DDLDisplayContext(
      HttpServletRequest request,
      DDL ddl,
      DDLRecordSetLocalService ddlRecordSetLocalService,
      DDLWebConfiguration ddlWebConfiguration,
      DDMDisplayRegistry ddmDisplayRegistry,
      DDMTemplateLocalService ddmTemplateLocalService,
      StorageEngine storageEngine) {

    _ddl = ddl;
    _ddlRecordSetLocalService = ddlRecordSetLocalService;
    _ddlWebConfiguration = ddlWebConfiguration;
    _ddmDisplayRegistry = ddmDisplayRegistry;
    _ddmTemplateLocalService = ddmTemplateLocalService;
    _storageEngine = storageEngine;

    _ddlRequestHelper = new DDLRequestHelper(request);

    if (Validator.isNotNull(getPortletResource())) {
      return;
    }

    DDLRecordSet recordSet = getRecordSet();

    if ((recordSet == null) || !hasViewPermission()) {
      RenderRequest renderRequest = _ddlRequestHelper.getRenderRequest();

      renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE);
    }
  }
 @RenderMode(name = "print")
 public void showPrint(RenderRequest request, RenderResponse response)
     throws IOException, PortletException {
   request.setAttribute("myaction", "print");
   logger.info("Generating printable version of catalog");
   showPrintableCatalog(request, response);
 }
  @Override
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Map<String, List<SocialEquityActionMapping>> equityActionMappingsMap =
        new LinkedHashMap<String, List<SocialEquityActionMapping>>();

    String[] classNames = ResourceActionsUtil.getSocialEquityClassNames();

    Comparator<String> comparator = new ModelResourceComparator(themeDisplay.getLocale());

    Arrays.sort(classNames, comparator);

    for (String className : classNames) {
      List<SocialEquityActionMapping> mergedEquityActionMappings =
          getMergedEquityActionMappings(themeDisplay.getScopeGroupIdOrLiveGroupId(), className);

      equityActionMappingsMap.put(className, mergedEquityActionMappings);
    }

    renderRequest.setAttribute(WebKeys.SOCIAL_EQUITY_ACTION_MAPPINGS_MAP, equityActionMappingsMap);

    return mapping.findForward("portlet.social_equity_admin.view");
  }
  @Override
  public void doEdit(RenderRequest request, RenderResponse response)
      throws IOException, PortletException {

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
    long groupId = themeDisplay.getScopeGroupId();
    request.setAttribute(GROUP_ID, groupId);

    PortletPreferences preferences = request.getPreferences();
    String[] ids =
        preferences.getValue(ARTICLE_ID, LR_EMPTY_VALUE).split(ARTICLE_SELECTION_DELIMITER);
    String defaultArticle = preferences.getValue(DEFAULT_ARTICLE, LR_EMPTY_VALUE);
    request.setAttribute(DEFAULT_ARTICLE, defaultArticle);
    request.setAttribute(IDS, ids);

    super.doEdit(request, response);
  }
  @Override
  public void render(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    renderRequest.setAttribute(JournalWebKeys.JOURNAL_CONTENT, _journalContent);

    super.render(renderRequest, renderResponse);
  }
  @Override
  public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    renderRequest.setAttribute("now", new Date());

    super.doView(renderRequest, renderResponse);
  }
Пример #30
0
  @Override
  public void doHelp(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    renderRequest.setAttribute(WebKeys.PORTLET_STRUTS_ACTION, helpAction);

    include(renderRequest, renderResponse);
  }