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> ");
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>");
}