⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editor.jsp

📁 OpenCms 是一个J2EE的产品
💻 JSP
📖 第 1 页 / 共 2 页
字号:
	initContent();
	
	// create the edior
	var __editor = new HTMLArea("edit1");
	
	// register the TableOperations plugin with the editor	
	<%
	if (showTableOptions) {
	    // show options
		%>__editor.registerPlugin(TableOperations);<%
	}
	%>
	__editor.registerPlugin(ContextMenu);
	// __editor.registerPlugin(CSS);


var config = __editor.config;

config.registerButton("oc-exit", "<%= wp.key(org.opencms.workplace.editors.Messages.GUI_BUTTON_CLOSE_0) %>", __editor.imgURL("images/opencms/exit.gif"), true, function(e) { confirmExit(); });
config.registerButton("oc-save-exit", "<%= wp.key(org.opencms.workplace.editors.Messages.GUI_BUTTON_SAVECLOSE_0)%>", __editor.imgURL("images/opencms/save_exit.gif"), true, function(e) { buttonAction(7); });
config.registerButton("oc-save", "<%=  wp.key(org.opencms.workplace.editors.Messages.GUI_BUTTON_SAVE_0) %>", __editor.imgURL("images/opencms/save.gif"), true, function(e) { buttonAction(8); });

config.registerButton("oc-chars", "<%= wp.key(org.opencms.workplace.editors.Messages.GUI_BUTTON_SPECIALCHARS_0) %>", __editor.imgURL("../../buttons/specialchar.png"), false, function(e) { buttonAction(10); });
config.registerButton("oc-anchor", "<%= wp.key(org.opencms.workplace.editors.Messages.GUI_BUTTON_ANCHOR_0)%>", __editor.imgURL("../../buttons/anchor.png"), false, function(e) { buttonAction(11); });
config.registerButton("oc-link", "<%= wp.key(org.opencms.workplace.editors.Messages.GUI_BUTTON_LINKTO_0)%>", __editor.imgURL("../../buttons/link.png"), false, function(e) { buttonAction(12); });

<%= wp.buildGalleryButtons(options, buttonStyle, displayOptions) %>

<%

// determine if customized button should be shown
String ocDirectPublish = ""; 

if (options.showElement("button.customized", displayOptions)) {
	I_CmsEditorActionHandler actionClass = OpenCms.getWorkplaceManager().getEditorActionHandler();
	ocDirectPublish = "\"oc-direct-publish\", ";
	if (actionClass.isButtonActive(wp.getJsp(), wp.getParamResource())) {
		%>config.registerButton("oc-direct-publish", "<%=  wp.key(org.opencms.workplace.editors.Messages.GUI_EXPLORER_CONTEXT_PUBLISH_0) %>", __editor.imgURL("images/opencms/publish.gif"), true, function(e) { buttonAction(9); });<%
	} else {
		%>config.registerButton("oc-direct-publish", "<%= wp.key(org.opencms.workplace.editors.Messages.GUI_EXPLORER_CONTEXT_PUBLISH_0) %>", __editor.imgURL("images/opencms/publish_in.gif"), true, function(e) { });<%
	
	}
}

// determine if the toggle source code button should be shown
String sourceBt = "";
if (options.showElement("option.sourcecode", displayOptions)) {
	sourceBt = ", \"separator\", \"htmlmode\"";
}

StringBuffer insertButtons = new StringBuffer(128);

// determine if the insert table button should be shown
if (showTableOptions) {
	insertButtons.append(", \"separator\", \"inserttable\"");
}
// determine if the insert link buttons should be shown
if (options.showElement("option.links", displayOptions)) {
	insertButtons.append(", \"separator\", \"oc-link\", \"oc-anchor\"");
}
// determine if the insert image button should be shown
if (options.showElement("option.images", displayOptions)) {
	insertButtons.append(", \"separator\", \"insertimage\"");
}
// determine if the image gallery button should be shown

insertButtons.append(wp.buildGalleryButtonRow(options, displayOptions));

// determine if the insert special characters button should be shown
if (options.showElement("option.specialchars", displayOptions)) {
	insertButtons.append(", \"separator\", \"oc-chars\"");
}

StringBuffer fontButtons = new StringBuffer(128);

// determine if the font face selector should be shown
if (options.showElement("font.face", displayOptions)) {
	fontButtons.append(" \"fontname\", \"space\",");
}
// determine if the font size selector should be shown
if (options.showElement("font.size", displayOptions)) {
	fontButtons.append(" \"fontsize\", \"space\",");
}

// determine if the font decoration buttons should be shown
if (options.showElement("font.decoration", displayOptions)) {
	fontButtons.append(" \"bold\", \"italic\", \"underline\", \"strikethrough\", \"separator\", \"subscript\", \"superscript\",");
}

// determine if the text alignment buttons should be shown
if (options.showElement("text.align", displayOptions)) {
	fontButtons.append(" \"separator\", \"justifyleft\", \"justifycenter\", \"justifyright\", \"justifyfull\",");
}

// determine if the text list buttons should be shown
if (options.showElement("text.lists", displayOptions)) {
	fontButtons.append(" \"separator\", \"insertunorderedlist\", \"insertorderedlist\",");
}

// determine if the text indentation buttons should be shown
String textDirection = "";
if (options.showElement("text.indent", displayOptions)) {
	fontButtons.append(" \"separator\", \"indent\", \"outdent\",");
	textDirection = ", \"separator\", \"lefttoright\", \"righttoleft\"";
}

// determine if the font color selector should be shown
String color = "";
boolean fontColor = options.showElement("font.color", displayOptions);
boolean bgColor = options.showElement("bg.color", displayOptions);
if (fontColor) {
	color = " \"forecolor\",";
}
// determine if the background color selector should be shown
if (bgColor) {
	color += " \"hilitecolor\",";
}
if (fontColor || bgColor) {
	color = " \"separator\"," + color;
}

fontButtons.append(color);
String outFontButtons = fontButtons.toString();
if (outFontButtons.endsWith(",")) {
	outFontButtons = outFontButtons.substring(0, outFontButtons.length() - 1);
}

if (showTableOptions) { 
// show table options
%>
var tablebar = new Array();
tablebar[0] = "starttab";
for (i=0; i<config.toolbar[2].length; i++) {
	var b = config.toolbar[2][i];
	if (b != "linebreak") {
		tablebar[i+1] = b;
	}
}
<%
}

// determine help button display
String onlineHelp = "";
if (wp.isHelpEnabled()) { %>
	config.registerButton("oc-onlinehelp", "<%= wp.key(org.opencms.workplace.editors.Messages.GUI_BUTTON_HELP_0) %>", __editor.imgURL("../../buttons/help.png"), true, function(e) { buttonAction(30); });<%
	onlineHelp = " \"separator\", \"oc-onlinehelp\", ";

}
%>

config.toolbar = [
	[ "starttab", <%= ocDirectPublish %> "oc-save-exit", "oc-save"<%= sourceBt %>, "separator", "undo", "redo", "separator", "cut", "copy", "paste"
	  <%= insertButtons %><%= textDirection %>, "separator", "inserthorizontalrule",<%= onlineHelp %>
	  "separator", "oc-exit" ],

	[ "starttab", "formatblock", "space",<%= outFontButtons %> ]<%
	if (showTableOptions) {
		// table plugin will already have been added at position 2 
		%>,

	tablebar<%
	}
	%>
];

	config.pageStyle = "@import url(<%= cms.link(wp.getUriStyleSheet()) %>);";
	
	__editor.generate();
	<%
	if ("edit".equals(wp.getParamEditormode())) {
		// if necessary, switch to text mode	    
		%>setTimeout("__editor.execCommand('htmlmode');", 500);<%
	}
	%>
	setActiveEditor(__editor);
	return false;
}

<%	if (wp.isHelpEnabled()) {
		out.println(CmsHelpTemplateBean.buildOnlineHelpJavaScript(wp.getLocale())); 
	}
%>

</script>

</head>

<body class="buttons-head" unselectable="on" onload="initEditor();" onunload="closeDialog();">

<form style="width:100%; height:100%; margin:0px; padding:0px; " name="EDITOR" id="EDITOR" method="post" action="<%= wp.getDialogRealUri() %>">
<input type="hidden" name="<%= CmsEditor.PARAM_CONTENT %>">
<input type="hidden" name="<%= CmsDialog.PARAM_ACTION %>" value="<%= wp.getParamAction() %>">
<input type="hidden" name="<%= CmsDialog.PARAM_RESOURCE %>" value="<%= wp.getParamResource() %>">
<input type="hidden" name="<%= CmsEditor.PARAM_TEMPFILE %>" value="<%= wp.getParamTempfile() %>">
<input type="hidden" name="<%= CmsEditor.PARAM_EDITASTEXT %>" value="<%= wp.getParamEditastext() %>">
<input type="hidden" name="<%= CmsEditor.PARAM_DIRECTEDIT %>" value="<%= wp.getParamDirectedit() %>">
<input type="hidden" name="<%= CmsDefaultPageEditor.PARAM_OLDELEMENTNAME %>" value="<%= wp.getParamElementname() %>">
<input type="hidden" name="<%= CmsEditor.PARAM_OLDELEMENTLANGUAGE %>" value="<%= wp.getParamElementlanguage() %>">
<input type="hidden" name="<%= CmsEditor.PARAM_BACKLINK %>" value="<%= wp.getParamBacklink() %>">
<input type="hidden" name="<%= CmsEditor.PARAM_EDITORMODE %>" value="<%= wp.getParamEditormode() %>">
<input type="hidden" name="<%= CmsEditor.PARAM_MODIFIED %>" value="<%= wp.getParamModified() %>">

<table cellspacing="0" cellpadding="0" border="0" style="width:100%; height:100%;">

<tr><td>
<table cellspacing="0" cellpadding="0" border="0" style="width:100%;"><tr>
<%= wp.buttonBarStartTab(0, 0) %>
<%
boolean elementSelection = options.showElement("option.element.selection", displayOptions);
boolean elementLanguage = options.showElement("option.element.language", displayOptions);
if (elementSelection || elementLanguage) {
	out.println(wp.buttonBarLabel( org.opencms.workplace.editors.Messages.GUI_INPUT_ELEMENT_0));
	if (elementLanguage) {
		out.println("<td>" + wp.buildSelectElementLanguage("name=\"" + CmsEditor.PARAM_ELEMENTLANGUAGE + "\" width=\"150\" onchange=\"buttonAction(3);\"") + "</td>");
		out.println(wp.buttonBarSpacer(2));
	} else {
		%><input type="hidden" name="<%= CmsEditor.PARAM_ELEMENTLANGUAGE %>" value="<%= wp.getParamElementlanguage() %>"><%
	}
	if (elementSelection) {
		out.println("<td>" + wp.buildSelectElementName("name=\"" + CmsDefaultPageEditor.PARAM_ELEMENTNAME + "\" width=\"150\" onchange=\"buttonAction(3);\"") + "</td>");
		out.println(wp.buttonBarSeparator(5, 5));
		out.println(wp.button("javascript:buttonAction(4);", null, "elements", org.opencms.workplace.editors.Messages.GUI_EDITOR_DIALOG_ELEMENTS_BUTTON_0, buttonStyle));
	} else {
		%><input type="hidden" name="<%= CmsDefaultPageEditor.PARAM_ELEMENTNAME %>" value="<%= wp.getParamElementname() %>"><%
	}
} else {
	// build hidden input fields that editor works correctly
	%><input type="hidden" name="<%= CmsEditor.PARAM_ELEMENTLANGUAGE %>" value="<%= wp.getParamElementlanguage() %>"><input type="hidden" name="<%= CmsDefaultPageEditor.PARAM_ELEMENTNAME %>" value="<%= wp.getParamElementname() %>"><%
}
if (options.showElement("option.properties", displayOptions)) {
	if (elementLanguage && !elementSelection) {
		out.println(wp.buttonBarSeparator(5, 5));
	}
	out.println(wp.button("javascript:buttonAction(5);", null, "properties", org.opencms.workplace.editors.Messages.GUI_EDITOR_DIALOG_PROPERTIES_BUTTON_0 , buttonStyle));
}
out.println(wp.button("javascript:buttonAction(13);", null, "cleanup", org.opencms.workplace.editors.Messages.GUI_EDITOR_DIALOG_CLEANUP_BUTTON_0, buttonStyle));
%>             
<td class="maxwidth">&nbsp;</td>
<%= wp.button("javascript:buttonAction(2);", null, "preview", org.opencms.workplace.editors.Messages.GUI_BUTTON_PREVIEW_0, buttonStyle) %>
<%= wp.buttonBarSpacer(5) %>
</tr></table>
</td></tr>

<tr>
<td style="width:100%; height:100%;">
<div style="width:100%; height:100%;">
<textarea class="texteditor" name="edit1" id="edit1" style="width:100%; height:100%;"></textarea>
</div>
</td>	
</tr>

</table>

</form>

<form style="display: none;" name="ELEMENTS" action="dialogs/elements.jsp" target="DIALOGELEMENT" method="post">
<input type="hidden" name="<%= CmsEditor.PARAM_TEMPFILE %>" value="<%= wp.getParamTempfile() %>">
<input type="hidden" name="<%= CmsEditor.PARAM_ELEMENTLANGUAGE %>" value="<%= wp.getParamElementlanguage() %>">
<input type="hidden" name="<%= CmsDefaultPageEditor.PARAM_ELEMENTNAME %>" value="<%= wp.getParamElementname() %>">
<input type="hidden" name="<%= CmsDialog.PARAM_RESOURCE %>" value="<%= wp.getParamResource() %>">
<input type="hidden" name="ispopup" value="true">
</form>

<form style="display: none;" name="PROPERTIES" action="../commons/property.jsp" target="DIALOGPROPERTY" method="post">
<input type="hidden" name="<%= CmsDialog.PARAM_RESOURCE %>" value="<%= wp.getParamTempfile() %>">
<input type="hidden" name="usetempfileproject" value="true">
<input type="hidden" name="<%= CmsDialog.PARAM_ISPOPUP %>" value="true">
</form>

</body>
</html>

<%
}
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -