📄 smalltext_field.jsp
字号:
<%@ page language="java" %><%@ page import="org.jahia.utils.*" %><%@ page import="org.jahia.data.*" %><%@ page import="org.jahia.data.fields.*" %><%@ page import="org.jahia.params.*" %><%@ page import="org.jahia.services.*" %><%@ page import="org.jahia.services.pages.*" %><%@ page import="org.jahia.registries.*" %><%@ page import="java.util.*" %><%! // Used with multiple field edit ! private String contextID (int id) { return JahiaTools.replacePattern(String.valueOf(id),"-","_"); }%><% Boolean isIE = (Boolean) request.getAttribute( "isIE" ); HashMap engineMap = (HashMap) request.getAttribute( "org.jahia.engines.EngineHashMap" ); JahiaField theField = (JahiaField) engineMap.get( "theField" ); String engineUrl = (String) engineMap.get( "engineUrl" ); String dataSourceConnectUrl= (String) engineMap.get( "dataSourceConnectUrl" ); String dataSourceIDUrl = (String) engineMap.get( "dataSourceIDUrl" ); String localSwitchUrl = (String) engineMap.get( "localSwitchUrl" ); ParamBean jParams = (ParamBean) engineMap.get( "jParams" ); String theURL = (String) jParams.settings().getJahiaEnginesHttpPath(); int pageID = theField.getPageID(); JahiaPage thePage = ServicesRegistry.getInstance().getJahiaPageService().lookupPage( pageID ); String defValue = theField.getDefinition().getDefaultValue(thePage.getPageTemplateID()); String contextID = contextID(theField.getID()); Boolean isSelectedField = (Boolean) engineMap.get( "isSelectedField" );%><% if (theField.getValue().indexOf("#") != -1 && theField.getValue().length() > 6 && theField.getValue().length() < 10) { %><SCRIPT type="text/javascript" src="<%=theURL%>/jahiatools/javascript/dynapi.js"></SCRIPT><SCRIPT type="text/javascript"><!--//DynAPI.setLibraryPath('<%=theURL%>/jahiatools/javascript/lib/');//DynAPI.include('dynapi.api.*');//--></SCRIPT><SCRIPT type="text/javascript"><!--DynAPI_<%=contextID%> = new DynAPIObject();DynAPI_<%=contextID%>.hookLoad=window.onload;DynAPI_<%=contextID%>.hookUnload=window.onunload;onload = function() { DynAPI_<%=contextID%>.loadHandler(); }onunload = function() { DynAPI_<%=contextID%>.unloadHandler(); }onresize = function() { DynAPI_<%=contextID%>.resizeHandler(); }onerror = function(msg, url, lno) { DynAPI_<%=contextID%>.errorHandler(msg, url, lno); }DynAPI_<%=contextID%>.addPackage('dynapi');DynAPI_<%=contextID%>.addLibrary('dynapi.api' ,["browser","dynlayer","dyndocument"]);DynAPI_<%=contextID%>.addLibrary('dynapi.event',["listeners","mouse","dragevent","keyboard"]);DynAPI_<%=contextID%>.addLibrary('dynapi.ext' ,["inline","layer","dragdrop","functions"]);DynAPI_<%=contextID%>.addLibrary('dynapi.gui' ,["viewport","dynimage","button","buttonimage","label","list","loadpanel","pushpanel","scrollbar","scrollpane","sprite"]);DynAPI_<%=contextID%>.addLibrary('dynapi.util' ,["circleanim","cookies","debug","thread","hoveranim","imganim","pathanim","console"]);DynAPI_<%=contextID%>.setLibraryPath('<%=theURL%>/jahiatools/javascript/lib/');DynAPI_<%=contextID%>.include('dynapi.api.*');var ViewColorBG_<%=contextID%>;var ViewColorPick_<%=contextID%>;DynAPI_<%=contextID%>.onLoad = function() { if (document.layers) { ViewColorBG_<%=contextID%> = new DynLayer(null,474,152,67,67,'#000000'); ViewColorPick_<%=contextID%> = new DynLayer(null,475,153,65,65,'#000000'); } else if (parseInt(navigator.appVersion) == 5) { ViewColorBG_<%=contextID%> = new DynLayer(null,469,159,67,67,'#000000'); ViewColorPick_<%=contextID%> = new DynLayer(null,470,160,65,65,'#000000'); } else { ViewColorBG_<%=contextID%> = new DynLayer(null,469,159,67,67,'#000000'); ViewColorPick_<%=contextID%> = new DynLayer(null,470,160,65,65,'#000000'); } DynAPI_<%=contextID%>.document.addChild(ViewColorBG); DynAPI_<%=contextID%>.document.addChild(ViewColorPick); setTextColor_<%=contextID%>('<%=theField.getValue()%>'); document.mainForm.elements["_<%=theField.getID()%>"].focus();}function setTextColor_<%=contextID%>(color) { document.mainForm.elements["_<%=theField.getID()%>"].value= color; ViewColorPick_<%=contextID%>.setBgColor(color);}//--></SCRIPT><TABLE width="377" border="1" cellpadding="5" cellspacing="0" bgcolor="#4D4E6D" bordercolor="#B3D9FF"><TR> <TD><map name="colmap_<%=contextID%>"><% String hexNb[] = {"00", "33", "66", "99", "CC", "FF"}; byte R = 0; byte G = 5; byte B = 0; String color; for (int j = 1; j <= 56; j += 11) { for (int i = 1; i <= 281; i += 8) { color = "#" + hexNb[R] + hexNb[G] + hexNb[B]; %> <area shape="rect" coords="<%=Integer.toString(i)%>, <%=Integer.toString(j)%>, <%=Integer.toString(i + 6)%>, <%=Integer.toString(j + 9)%>" href="javascript:setTextColor_<%=contextID%>('<%=color%>')" alt="<%=color%>"> <% if (B < 5) { B++; } else { B = 0; if (R < 5) { R++; } else { R = 0; G--; } } } }%></map><img usemap="#colmap_<%=contextID%>" src="<%=theURL%>/jahiatools/images/colortable.gif" border="0" width="289" height="67"><img src="<%=theURL%>/jahiatools/images/pix.gif" border="0" width="73" height="1"><br><img src="<%=theURL%>/jahiatools/images/pix.gif" border="0" width="1" height="4"><br><input class="input" name="_<%=theField.getID()%>" type="text" size="12" value="<%=theField.getValue()%>" onChange="setTextColor_<%=contextID%>(document.mainForm.elements['_<%=theField.getID()%>'].value)"></TD></TR></TABLE><% } else if (defValue != null && !defValue.equals("") && defValue.toUpperCase().indexOf("JAHIA_MULTIVALUE") != -1 ) { %><% String theSelectedField = theField.getValue(); String theNewField = ""; String strToRemove[] = {"<JAHIA", "_MULTIVALUE"}; for (int i = 0; i < strToRemove.length; i++) { String upperCaseField = theSelectedField.toUpperCase(); int index = upperCaseField.indexOf(strToRemove[i]); if (index != -1) { theNewField = theSelectedField.substring(0, index) + theSelectedField.substring(index + strToRemove[i].length(), theSelectedField.length()); theSelectedField = theNewField; } } if (theSelectedField.indexOf("[") != -1) { int startStr = theSelectedField.indexOf("["); int endStr = theSelectedField.indexOf("]>") + 2; theSelectedField = JahiaTools.html2text(theSelectedField.substring(0,startStr) + theSelectedField.substring(endStr,theSelectedField.length())); }%><% if (defValue.indexOf("[") != -1) { int startStr = defValue.indexOf("[") + 1; int endStr = defValue.indexOf("]"); String theList = defValue.substring(startStr,endStr); %> <select class="input" name="listSelection_<%=contextID%>" onChange="document.mainForm.elements['_<%=theField.getID()%>'].value = document.mainForm.listSelection_<%=contextID%>.options[document.mainForm.listSelection_<%=contextID%>.selectedIndex].value;"> <% while (true) { String theSelection = ""; if (theList.indexOf(":") != -1) { endStr = theList.indexOf(":"); theSelection = JahiaTools.html2text(theList.substring(0,endStr)); theList = theList.substring(endStr + 1,theList.length()); if (theSelection.equals(JahiaTools.html2text(theSelectedField))) { %> <option value="<%=theSelection%>" selected><%=theSelection%></option> <% } else { %> <option value="<%=theSelection%>"><%=theSelection%></option> <% } } else { theSelection = JahiaTools.html2text(theList.substring(0,theList.length())); if (theSelection.equals(theSelectedField)) { %> <option value="<%=theSelection%>" selected><%=theSelection%></option> </select> <% } else { %> <option value="<%=theSelection%>"><%=theSelection%></option> </select> <% } break; } } }%><input name="_<%=theField.getID()%>" type="hidden" value="<%=theField.getValue()%>"><SCRIPT type="text/javascript"><!-- document.mainForm.elements['_<%=theField.getID()%>'].value = document.mainForm.listSelection_<%=contextID%>.options[document.mainForm.listSelection_<%=contextID%>.selectedIndex].value;// --></SCRIPT><% if ( isSelectedField.booleanValue() && isIE.booleanValue() ){ %><SCRIPT type="text/javascript"> <!-- function setfocus() { document.mainForm.listSelection_<%=contextID%>.focus(); } setfocus(); // --></SCRIPT><% }} else { %><input class="input" type="text" name="_<%=theField.getID()%>" size="80" maxlength="250" value="<%=theField.getValue()%>"><br><% if ( isSelectedField.booleanValue() ){ %><SCRIPT type="text/javascript"> <!-- function setfocus() { document.mainForm.elements["_<%=theField.getID()%>"].focus(); document.mainForm.elements["_<%=theField.getID()%>"].select(); } setfocus(); // --></SCRIPT> <% }}%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -