Package org.meshcms.core

Examples of org.meshcms.core.ModuleDescriptor


  public void writeTag() throws IOException, JspException {
    if (date == null) {
      date = DATE_NONE;
    }

    ModuleDescriptor md = getModuleDescriptor(location, name);
    boolean showAlt = true;

    if (md != null) {
      if (parameters != null) {
        md.parseParameters(parameters);
      }

      Path modulePath = webSite.getModulePath(md.getTemplate());

      if (modulePath != null) {
        md.setPagePath(pagePath);
        md.setModulePath(modulePath);
        md.setDateFormat(date);
        md.setStyle(style);

        String moduleCode = "meshcmsmodule_" + location;
        request.setAttribute(moduleCode, md);

        Path jspPath = modulePath.add(SiteMap.MODULE_INCLUDE_FILE);
View Full Code Here


    String template = null;
    String argPath = null;
    String advParms = null;

    ModuleDescriptor md = getModuleDescriptor(location, name);

    if (md != null) {
      template = md.getTemplate();
      argPath  = md.getArgument();
      advParms = Utils.listProperties(md.getAdvancedParams(), ", ");
    }

    Locale locale = WebUtils.getPageLocale(pageContext);
    ResourceBundle bundle = ResourceBundle.getBundle("org/meshcms/webui/Locales", locale);
    MessageFormat formatter = new MessageFormat("", locale);

    Writer w = getOut();

    Object[] args = {
      location,
      template != null ? Utils.beautify(template,true) : bundle.getString("editorNoTemplate"),
      Utils.limitedLength(argPath, 80),
      Utils.limitedLength(advParms, 80)
    };

    if (isEditorModulesCollapsed) {
      w.write("<div id=\"" + idCont + "\" class='meshcmsfieldlabel' " +
          " style=\"cursor:pointer;position:relative;\" onclick=\"javascript:editor_moduleShow('" +
          idCont + "','" + idElem + "','" + idIcon + "');\">" +
          "<img alt=\"\" src=\"" + adminRelPath.add("filemanager/images/bullet_toggle_plus.png") + "\" id=\"" + idIcon + "\" />\n");
      formatter.applyPattern(bundle.getString("editorModuleLocExt"));
      w.write("<label for=\"" + idElem + "\">" + formatter.format(args) + "</label>");
      w.write("</div>");
    }

    w.write("<fieldset "+ (isEditorModulesCollapsed ? "style=\"display:none;\"" : "") +
        " id=\""+ idElem +"\" class='meshcmseditor' >\n");
    formatter.applyPattern(bundle.getString("editorModuleLoc"));
    w.write(" <legend>" + formatter.format(args) + "</legend>\n");

    if (name != null) {
      w.write(bundle.getString("editorFixedModule"));

      if (argPath != null) {
        w.write("<img alt=\"\" src='" + adminRelPath.add("filemanager/images/application_view_detail.png") + "' title='" +
            bundle.getString("editorBrowseModule") +
            "' onclick=\"javascript:window.open('" +
            adminRelPath.add("filemanager/index.jsp") + "?folder=" +
            Utils.escapeSingleQuotes(argPath) +
            "', '_blank').focus();\" style='vertical-align:middle;' />\n");
      }
    } else {
      w.write(" <div class='meshcmsfieldlabel'><label for='" +
          ModuleDescriptor.TITLE_ID + location + "'>" +
          bundle.getString("editorModuleTitle") + "</label></div>\n");
      w.write(" <div class='meshcmsfield'><input type='text' id='" +
          ModuleDescriptor.TITLE_ID + location + "' name='" +
          ModuleDescriptor.TITLE_ID + location + "' value=\"" +
          (md == null ? "" : Utils.noNull(md.getTitle())) +
          "\" style='width: 80%;' /></div>\n");

      w.write(" <div class='meshcmsfieldlabel'><label for='" +
          ModuleDescriptor.TEMPLATE_ID + location + "'>" +
          bundle.getString("editorModuleTemplate") + "</label></div>\n");
      w.write(" <div class='meshcmsfield'>\n  <select name='" +
          ModuleDescriptor.TEMPLATE_ID + location + "' id='" +
          ModuleDescriptor.TEMPLATE_ID + location + "'>\n");
      w.write("   <option value='" + PageAssembler.EMPTY + "'>" +
          bundle.getString("editorNoTemplate") + "</option>\n");

      String[] mtNames = webSite.getSiteMap().getModuleNames();

      for (int i = 0; i < mtNames.length; i++) {
        w.write("   <option value='" + mtNames[i] + "'");

        if (md != null && mtNames[i].equals(template)) {
          w.write(" selected='selected'");
        }

        w.write(">" + Utils.beautify(Utils.removeExtension(mtNames[i]), true) + "</option>\n");
      }

      w.write("  </select>&nbsp;");
      w.write(Help.icon(webSite, pagePath, Help.MODULES, userInfo,
          "module_'+document.getElementById('" + ModuleDescriptor.TEMPLATE_ID +
          location + "').value+'", true));
      w.write("\n </div>\n");
      w.write(" <div class='meshcmsfieldlabel'><label for='" +
          ModuleDescriptor.ARGUMENT_ID + location + "'>" +
          bundle.getString("editorModuleArgument") + "</label></div>\n");
      w.write(" <div class='meshcmsfield'><input type='text' id='" +
          ModuleDescriptor.ARGUMENT_ID + location + "' name='" +
          ModuleDescriptor.ARGUMENT_ID + location + "' value=\"" +
          (md == null || argPath == null ? "" : argPath) +
          "\" style='width: 80%;' /><img alt=\"\" src='" +
          adminRelPath.add("/filemanager/images/application_view_detail.png") + "' title='" + bundle.getString("genericBrowse") +
          "' onclick=\"javascript:editor_openFileManager('" +
          ModuleDescriptor.ARGUMENT_ID + location + "');\" style='vertical-align:middle;' /></div>\n");

      w.write(" <div class='meshcmsfieldlabel'><label for='" +
          ModuleDescriptor.PARAMETERS_ID + location + "'>" +
          bundle.getString("editorModuleParameters") + "</label></div>\n");
      w.write(" <div class='meshcmsfield'><input type='text' id='" +
          ModuleDescriptor.PARAMETERS_ID + location + "' name='" +
          ModuleDescriptor.PARAMETERS_ID + location + "' value=\"" +
          (md == null || md.getAdvancedParams() == null ? "" :
            Utils.listProperties(md.getAdvancedParams(), ", ")) +
          "\" style='width: 80%;' /></div>\n");
    }

    w.write("</fieldset>");
  }
View Full Code Here

  protected Writer getOut() {
    return OutputConverter.getWriter(pageContext.getOut());
  }
 
  ModuleDescriptor getModuleDescriptor(String location, String name) {
    ModuleDescriptor md;
   
    if (name == null) {
      Map pageModules = (Map) pageContext.getAttribute(PAGE_MODULES);
     
      if (pageModules == null) {
        pageModules = new HashMap();
        String[] modules = Utils.tokenize
            (getPage().getProperty(PageAssembler.MODULES_PARAM), ";");
       
        if (modules != null) {
          for (int i = 0; i < modules.length; i++) {
            ModuleDescriptor md0 = new ModuleDescriptor(modules[i]);
            pageModules.put(md0.getLocation(), md0);
          }
        }
       
        String head = getHead();
        Matcher m = PageHead.META_REGEX.matcher(head);
       
        while (m.find()) {
          String value = m.group(3);
         
          if (Utils.isNullOrEmpty(value)) {
            value = m.group(5);
          }
         
          if (!Utils.isNullOrEmpty(value)) {
            Matcher sm = PARAM_REGEX.matcher(value);
           
            if (sm.matches()) {
              String loc = Utils.noNull(sm.group(1)).trim();
              String prm = Utils.noNull(sm.group(2)).trim();
              String val = sm.group(3);
             
              ModuleDescriptor md0 = (ModuleDescriptor) pageModules.get(loc);
             
              if (md0 == null) {
                md0 = new ModuleDescriptor();
                md0.setLocation(loc);
                pageModules.put(loc, md0);
              }
             
              if (prm.equals(ModuleDescriptor.TEMPLATE_ID)) {
                md0.setTemplate(val);
              } else if (prm.equals(ModuleDescriptor.ARGUMENT_ID)) {
                md0.setArgument(val);
              } else if (prm.equals(ModuleDescriptor.TITLE_ID)) {
                md0.setTitle(val);
              } else {
                md0.setAdvancedParam(prm, val);
              }
            }
          }
        }
       
        Iterator iter = pageModules.keySet().iterator();
       
        while (iter.hasNext()) {
          Object key = iter.next();
          ModuleDescriptor md0 = (ModuleDescriptor) pageModules.get(key);
         
          if (!md0.isValid()) {
            pageModules.remove(key);
          }
        }
       
        pageContext.setAttribute(PAGE_MODULES, pageModules, PageContext.PAGE_SCOPE);
      }
     
      md = (ModuleDescriptor) pageModules.get(location);
    } else {
      md = new ModuleDescriptor(name);
      md.setLocation(location);
    }
   
    return md;
  }
View Full Code Here

   
    if (Utils.checkAddress(email)) {
      try {
        Path mailModulePath = webSite.getAdminModulesPath().add("mail");
        String location = "meshcmsmailformtag";
        ModuleDescriptor md = new ModuleDescriptor();
        md.setLocation(location);
        md.setArgument(email);
        md.setModulePath(mailModulePath);
        md.setPagePath(pagePath);
        String moduleCode = "meshcmsmodule_" + location;
        request.setAttribute(moduleCode, md);
        pageContext.include("/" + webSite.getServedPath(mailModulePath) + "/" +
            SiteMap.MODULE_INCLUDE_FILE + "?modulecode=" + moduleCode);
      } catch (ServletException ex) {
View Full Code Here

    return location;
  }
 
  public void writeTag() throws IOException {
    String title = null;
    ModuleDescriptor md = getModuleDescriptor(location, null);
   
    if (md != null) {
      title = md.getTitle();
    }
   
    if (title != null) {
      Writer w = getOut();
     
View Full Code Here

TOP

Related Classes of org.meshcms.core.ModuleDescriptor

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.