Package com.agiletec.aps.system.services.page

Examples of com.agiletec.aps.system.services.page.Widget


          } else {
            Widget[] showlets = targetPage.getWidgets();
            if (showlets.length <= frame) {
              this.addActionError(this.getText("error.invalidWidgetType"));
            } else {
              Widget showlet = showlets[frame];
              if (showlet != null && this.getInvalidShowletTypes().contains(showlet.getType().getCode())) {
                this.addActionError(this.getText("error.invalidWidgetType"));
              } else {
                checked = true;
              }
            }
View Full Code Here


    } else {
      IPage targetPage = this.getPage(selectedNode);
      if (targetPage == null) {
        this.addActionError(this.getText("error.noPageSelected"));
      } else {
        Widget targetFrame = targetPage.getWidgets()[this.getFrameIdParam().intValue()];
        if (targetFrame == null || this.getInvalidShowletTypes().contains(targetFrame.getType().getCode())) {
          this.addActionError(this.getText("error.invalidWidgetType"));
        } else {
          checked = true;
        }
      }
View Full Code Here

  }
 
  @Override
  protected String extractInitConfig() {
    if (null != this.getWidget()) return SUCCESS;
    Widget showlet = this.getCurrentPage().getWidgets()[this.getFrame()];
    Logger log = ApsSystemUtils.getLogger();
    if (null == showlet) {
      try {
        showlet = this.createNewShowlet();
        //for ContentFeedbackWidgetAction
        IContentFeedbackConfig systemConfig = this.getContentFeedbackManager().getConfig();
        String value = systemConfig.getComment();
        if (null != value && value.equalsIgnoreCase("true")) showlet.getConfig().setProperty(WIDGET_PARAM_COMMENT_ACTIVE, value);

        value = systemConfig.getAnonymousComment();
        if (null != value && value.equalsIgnoreCase("true")) showlet.getConfig().setProperty(WIDGET_PARAM_COMMENT_ANONYMOUS, value);

        value = systemConfig.getModeratedComment();
        if (null != value && value.equalsIgnoreCase("true")) showlet.getConfig().setProperty(WIDGET_PARAM_COMMENT_MODERATED, value);

        value = systemConfig.getRateContent();
        if (null != value && value.equalsIgnoreCase("true")) showlet.getConfig().setProperty(WIDGET_PARAM_RATE_CONTENT, value);

        value = systemConfig.getRateComment();
        if (null != value && value.equalsIgnoreCase("true")) showlet.getConfig().setProperty(WIDGET_PARAM_RATE_COMMENT, value);
        //---

      } catch (Throwable t) {
        ApsSystemUtils.logThrowable(t, this, NONE);
        //TODO METTI MESSAGGIO DI ERRORE NON PREVISO... Vai in pageTree con messaggio di errore Azione non prevista o cosa del genere
        this.addActionError(this.getText("Message.userNotAllowed"));
        return "pageTree";
      }
      log.info("Configurating new Widget " + this.getShowletTypeCode() + " - Page " + this.getPageCode() + " - Frame " + this.getFrame());
    } else {
      log.info("Edit widget config " + showlet.getType().getCode() + " - Page " + this.getPageCode() + " - Frame " + this.getFrame());
      showlet = this.createCloneFrom(showlet);
    }
    this.setShowlet(showlet);
    return SUCCESS;
  }
View Full Code Here

  }

  private Boolean extractShowletParam(HttpServletRequest request) {
    Boolean hasParam = false;
    RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
    Widget showlet = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
    ApsProperties config = showlet.getConfig();

    String param = this.getParam();
    if (param.equalsIgnoreCase("allowComment")) param = ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_ACTIVE;
    if (param.equalsIgnoreCase("allowAnonymousComment")) param = ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_ANONYMOUS;
    if (param.equalsIgnoreCase("allowRateContent")) param = ContentFeedbackWidgetAction.WIDGET_PARAM_RATE_CONTENT;
View Full Code Here

    return params;
  }

  public String getShowletParam(String param) {
    RequestContext reqCtx = (RequestContext) this.getRequest().getAttribute(RequestContext.REQCTX);
    Widget currentShowlet = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
    return currentShowlet.getConfig().getProperty(param);
  }
View Full Code Here

  public String extractContentId() {
    String contentId = null;
    if (null == contentId || contentId.trim().length() == 0) {
      RequestContext reqCtx = (RequestContext) this.getRequest().getAttribute(RequestContext.REQCTX);
      Widget currentShowlet = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
      if (null != currentShowlet.getConfig() && currentShowlet.getConfig().getProperty("contentId") != null && currentShowlet.getConfig().getProperty("contentId").length() > 0) {
        contentId = currentShowlet.getConfig().getProperty("contentId");
      } else {
        contentId = (String) this.getRequest().getAttribute("currentContentId");
      }
    }
    return contentId;
View Full Code Here

    String value = null;
    try {
      HttpServletRequest request = (null != this.getRequest()) ? this.getRequest() : ServletActionContext.getRequest();
      RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
      if (null != reqCtx) {
        Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
        if (null != widget) {
          ApsProperties config = widget.getConfig();
          if (null != config) {
            String widgetParam = config.getProperty(paramName);
            if (widgetParam != null && widgetParam.trim().length() > 0) {
              value = widgetParam.trim();
            }
View Full Code Here

   */
  protected String extractTypeCode() {
    String typeCode = null;
    RequestContext reqCtx = (RequestContext) this.getRequest().getAttribute(RequestContext.REQCTX);
    if (reqCtx!=null) {
      Widget showlet = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
      if (showlet!=null) {
        ApsProperties config = showlet.getConfig();
        if (null!=config) {
          String showletTypeCode = config.getProperty(JpwebdynamicformSystemConstants.TYPECODE_SHOWLET_PARAM);
          if (showletTypeCode!=null && showletTypeCode.trim().length()>0) {
            typeCode = showletTypeCode.trim();
          }
View Full Code Here

      Content content = this._contentManager.loadContent(contentId, true);
      ICacheManager cacheManager = (ICacheManager) ApsWebApplicationUtils.getBean(SystemConstants.CACHE_MANAGER, this.getRequest());
      PublicContentAuthorizationInfo authInfo = new PublicContentAuthorizationInfo(content);
      cacheManager.putInCache(JacmsSystemConstants.CONTENT_AUTH_INFO_CACHE_PREFIX + contentId, authInfo);
      this.setUserOnSession("admin");
      Widget widget = new Widget();
            IWidgetTypeManager widgetTypeMan =
              (IWidgetTypeManager) this.getService(SystemConstants.WIDGET_TYPE_MANAGER);
            WidgetType WidgetType = widgetTypeMan.getWidgetType("content_feedback_viewer");
            widget.setType(WidgetType);
            ApsProperties prop = new ApsProperties();
            prop.put("contentId", contentId);
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_ACTIVE, "true");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_MODERATED, "false");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_ANONYMOUS, "false");
            widget.setConfig(prop);
            widget.setPublishedContent(contentId);

            List<String> listaIds = this._commentManager.searchCommentIds(null);
      assertEquals(0, listaIds.size());

            RequestContext e = new RequestContext();
View Full Code Here

      Content content = this._contentManager.loadContent(contentId, true);
      ICacheManager cacheManager = (ICacheManager) ApsWebApplicationUtils.getBean(SystemConstants.CACHE_MANAGER, this.getRequest());
      PublicContentAuthorizationInfo authInfo = new PublicContentAuthorizationInfo(content);
      cacheManager.putInCache(JacmsSystemConstants.CONTENT_AUTH_INFO_CACHE_PREFIX + contentId, authInfo);
      this.setUserOnSession("admin");
      Widget showlet = new Widget();
            IWidgetTypeManager showletTypeMan =
              (IWidgetTypeManager) this.getService(SystemConstants.WIDGET_TYPE_MANAGER);
            WidgetType WidgetType = showletTypeMan.getWidgetType("content_feedback_viewer");
            showlet.setType(WidgetType);
            ApsProperties prop = new ApsProperties();
            prop.put("contentId", contentId);
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_ACTIVE, "true");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_MODERATED, "false");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_ANONYMOUS, "false");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_RATE_COMMENT, "true");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_RATE_CONTENT, "true");
            showlet.setConfig(prop);
            showlet.setPublishedContent(contentId);

            RequestContext e = new RequestContext();
            e.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET, showlet);
            Lang lang = new Lang();
        lang.setCode("en");
View Full Code Here

TOP

Related Classes of com.agiletec.aps.system.services.page.Widget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.