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

📄 editor.jsp

📁 IBM RSA下的JSF开发示例
💻 JSP
📖 第 1 页 / 共 3 页
字号:
	this.height = height;	this.left = left;	this.top = top;	this.accesswindow = null;}var <%= editorName %>theWinControls = new Array();function IBM_RTE_<%= editorName %>getWinControls() {	var i = 0;	<!-- Big for loop to get all window controls information -->	<% Vector theWinControls = aEditor.getOrderedWindowControls();             	 for (int t = 0; t < theWinControls.size(); t++) { 		   WindowControl theWinControl = (WindowControl)theWinControls.elementAt(t); 		   String winControlName = (String)theWinControl.getName(); 		   String winControlDefinition = (String)theWinControl.getDefinition(); 		   String winControlEditor = (String)theWinControl.getAttribute("editor"); 		   String winControlWidth = (String)theWinControl.getAttribute("width"); 		   String winControlHeight = (String)theWinControl.getAttribute("height");		   String winControlLeft = (String)theWinControl.getAttribute("left"); 		   String winControlTop = (String)theWinControl.getAttribute("top"); %>		  <!-- Position the window control at the center of the screen as default -->		  var winLeft;		  <% if (winControlLeft.equals("")) { %>				 winLeft = (screen.width - <%= winControlWidth %>) / 2;		  <% } else { %>				 winLeft = "<%= winControlLeft %>";		  <% } %>		  var winTop;		  <% if (winControlTop.equals("")) { %>				 winTop = (screen.height - <%= winControlHeight %>) / 2;		  <% } else { %>				 winTop = "<%= winControlTop %>";		  <% } 		   String winControlKeyName = (String)theWinControl.getKeyName();		   String winControlKeySequence = (String)theWinControl.getAttribute("keySequence");		   String winControlKeyFile = (String)theWinControl.getAttribute("keyFile"); 		   Vector winControlParams = (Vector)theWinControl.getAttribute("params"); 		   Vector winControlParamValues = (Vector)theWinControl.getAttribute("value"); %>  <!-- Construct window loading URL, JSP plus basic query strings, including locale, image dir, editor name, and Bidi flag. -->		  <% String basicQueryStr = "?locale=" + locale + "&images=" + images + "&editorName=" + editorName + "&isBidi=" + isBidi; %>		  var winUrl = "<%= winControlDefinition %>";		  winUrl += "<%= basicQueryStr %>" + "&isAccessible=true";    		  <!-- All the parameters added by <addWindowControlParams> are passed to the popup window via query strings in request -->		  <% String extraQueryStr = "";			if ((winControlParams.size() > 0)&&(winControlParamValues.size() > 0)) { 			for (int m = 0; m < winControlParams.size(); m++) {			   extraQueryStr += "&" + winControlParams.elementAt(m) + "=" + winControlParamValues.elementAt(m);			}%>	   winUrl += "<%= extraQueryStr %>";    		  <% } %><!-- Get the default toolbar name list per toolbar name flag in <addWindowControl> --><% 			 String addToolbarNames = (String)theWinControl.getAttribute("addToolbarNames"); 			 if (addToolbarNames.equalsIgnoreCase("yes")) {				 theToolbars = aEditor.getOrderedToolbars(); 				 String toolbarNameList = "toolbarNameList=";				 String toolbarCtrlNameList = "toolbarCtrlNameList=";				 for (int m = 0; m < theToolbars.size(); m++) {					 Toolbar aToolbar = (Toolbar)theToolbars.elementAt(m);					 String toolbarName = aToolbar.getName();					 toolbarNameList += editorName + toolbarName +"; ";					 Vector controls = aToolbar.getOrderedControls();					 int ctrlNum = controls.size();					 if (!withSource)						  ctrlNum = controls.size() - 1;					 for (int n = 0; n < ctrlNum; n++) {						 Control aControl = (Control)controls.elementAt(n); 						 String controlName = aControl.getName(); 						 toolbarCtrlNameList += editorName + toolbarName + controlName +"; ";					 }				 }           				 int lind1 = toolbarNameList.lastIndexOf(";");				 if (lind1 != -1)					 toolbarNameList = toolbarNameList.substring(0, lind1);				 int lind2 = toolbarCtrlNameList.lastIndexOf(";");				 if (lind2 != -1)					 toolbarCtrlNameList = toolbarCtrlNameList.substring(0, lind2);		  %>winUrl += "&" + "<%= toolbarNameList %>" + "&" + "<%= toolbarCtrlNameList %>";		  <% } %> <!-- Retrieve keystroke sequence, key modifier and alphanumeric key, from key sequence or key properties file --> <%  		int j = 0;			String winControlKeyModi = null;			String winControlKeyCode = null;// Ignore any key sequence properties file if keystroke sequence is set at tag lib call;			int ind = winControlKeySequence.indexOf(":");			if (ind != -1) { 				 winControlKeyModi = winControlKeySequence.substring(0, ind).trim();				 winControlKeyCode = winControlKeySequence.substring(ind+1).trim();			}                    // Look up the properties file for keystroke sequence			else {				 String theKeyFile = null; // Ignore default key sequence properties file if key file is set at tag lib call;				 if ((ind = winControlKeyFile.indexOf(".")) != -1) 					theKeyFile = winControlKeyFile.substring(0, ind).trim();				 else 					theKeyFile = "KeySequence";				 ResourceBundle keyBundle = null;				 try { 					 keyBundle = ResourceBundle.getBundle("com.ibm.wps.odc.editors." + theKeyFile, LocaleHelper.getLocale(locale)); 				 } 				 catch (MissingResourceException e1) { 					 try {						 keyBundle = ResourceBundle.getBundle("com.ibm.pvc.wps.docEditor.keysequence." + theKeyFile, LocaleHelper.getLocale(locale)); 					 }					 catch (MissingResourceException e2) { 						 keyBundle = null; 					 }				 }				 if (keyBundle == null) {					 j = -1;				 }else {					 String keySeq = null;//Support user-agent, keyName should be in the format "name.ie, or name.mozilla, or name";					if (winControlKeyName.indexOf(".") == -1) { 						// keyName without user-agent extension;						 if (isMozilla) {							 try{								 keySeq = keyBundle.getString(winControlKeyName + ".mozilla");							 }catch(Exception e) {								 keySeq = null;							 }						 }else {							 try{								 keySeq = keyBundle.getString(winControlKeyName + ".ie");							 }catch(Exception e) {								 keySeq = null;							 }						 }						 if (keySeq == null) { // fall back to name without extension							 try{								 keySeq = keyBundle.getString(winControlKeyName);							 }catch(Exception e) {								 keySeq = null;							 }						 }                 					}else { //keyName with user-agent extension;						 try{							 keySeq = keyBundle.getString(winControlKeyName);						 }catch(Exception e) {							 keySeq = null;						 }					} // End of key name extension checking					if (keySeq == null) // Can't find winControlKeyName in properties file						 j = -1;					else {						  // key sequence must be in formate "keymodifier:keyalphanumeric"						  ind = keySeq.indexOf(":");						  if (ind != -1) { 							  winControlKeyModi = keySeq.substring(0, ind).trim();							  winControlKeyCode = keySeq.substring(ind+1).trim();						  }                    					} // End of keySeq != null				 } // End of keyBundle != null			} // End of lookup properties file			if ((winControlKeyModi == null) || (winControlKeyCode == null)){				j = -1; // key sequence syntax is incorrect.			}			if ( j == -1) {				winControlKeyModi  = null;				winControlKeyCode  = null;			}%>                  		  <!-- Save data to the JS object -->  <%= editorName %>theWinControls[i] = new winControls("<%= winControlName %>", "<%= winControlDefinition %>", "<%= winControlEditor %>", winUrl, "<%= winControlKeyModi %>", "<%= winControlKeyCode %>", "<%= winControlKeyFile %>", "<%= winControlKeySequence %>", "<%= winControlKeyName %>", "<%= winControlWidth %>", "<%= winControlHeight %>", winLeft, winTop);		  i++;	<% } //End of for loop %>}function IBM_RTE_<%= editorName %>enablekeypress(editorName) {//      IBM_RTE_getDocument(editorName).editorName = editorName;	if (IBM_RTE_isMozilla()) {		IBM_RTE_getDocument(editorName).addEventListener("keypress", IBM_RTE_<%= editorName %>keypress, false);		IBM_RTE_getDocument(editorName).addEventListener("keyup", IBM_RTE_<%= editorName %>keyup, false);		IBM_RTE_getDocument(editorName).addEventListener("mouseup", IBM_RTE_<%= editorName %>mouseup, false);	}else {	IBM_RTE_getDocument(editorName).attachEvent("onkeypress",IBM_RTE_<%= editorName %>keypress);	IBM_RTE_getDocument(editorName).attachEvent("onkeyup",IBM_RTE_<%= editorName %>keyup);	IBM_RTE_getDocument(editorName).attachEvent("onmouseup", IBM_RTE_<%= editorName %>mouseup);			// _for_manual_undo_redo_	IBM_RTE_getDocument(editorName).attachEvent("onkeydown",IBM_RTE_handler);	// _for_manual_undo_redo_	} }function IBM_RTE_<%= editorName %>mouseup(eventObj) {	IBM_RTE_modFormatList(false);	IBM_RTE_modFontSizeList(false);	IBM_RTE_modFontFaceList(false);}// To open a regular window as the toolbar window, // need to set the restriction to allow one RTE at a time for now;function IBM_RTE_<%= editorName %>keypress(eventObj) {	var editorName;	var evt;	var charCode;	var wcp_optionsWin;	//PMR fix	if(!IBM_RTE_isMozilla()){		var rownat=IBM_RTE_getCell('<%= editorName %>');		if(rownat==null){		}else{			var rowvalue=rownat.firstChild.data;			if(rowvalue.charCodeAt(0)==160){				rownat.firstChild.data="";			}		}	}	//PMR fix	// Attach key press event 	if( IBM_RTE_isMozilla()) {		editorName = eventObj.target.ownerDocument.editorName;		evt = eventObj;		charCode = evt.charCode;		if(evt.keyCode==13){ 		//for paragraph support in Mozilla on Key enter press			IBM_RTE_Mozilla_addPTags("<%= editorName %>");			}	}else {		var len = window.frames.length;		for (var i=0; i<len; i++) {			if (window.frames[i].event) {				evt = window.frames[i].event;				var doc = evt.srcElement;				//  editorName = doc.ownerDocument.editorName;				charCode = evt.keyCode; 				break;			} 		} 		if(evt.keyCode == 13){			IBM_RTE_IE_addPTags("<%= editorName%>");		}	} 	if(!IBM_RTE_isMozilla())		if(IBM_RTE_getCell("<%= editorName %>") != null) IBM_RTE_backup("<%= editorName %>");	// Check keystroke sequences and launch popup windows	for (var i = 0; i < <%= editorName %>theWinControls.length; i++) {		if (charCode != <%= editorName %>theWinControls[i].keyAlphaNum) continue;		switch (<%= editorName %>theWinControls[i].keyModifier){			case "17":				if (evt.ctrlKey == true) {					if (!IBM_RTE_isMozilla()) {						evt.cancelBubble;						evt.returnValue = false;					}								if (charCode == <%= editorName %>theWinControls[i].keyAlphaNum) {						var jrl = <%= editorName %>theWinControls[i].loadUrl;						var wcp_win = window.open(jrl, <%= editorName %>theWinControls[i].name, 'scrollbars=0, toolbar=0, statusbar=0, , width=' + <%= editorName %>theWinControls[i].width + ', height=' + <%= editorName %>theWinControls[i].height + ', left=' + <%= editorName %>theWinControls[i].left + ', top=' + <%= editorName %>theWinControls[i].top);						wcp_win.focus();                       					}				}	// Most of alt+key sequences are reserved; developers would have to find out valid key combinations;	// put it here for future extension;			case "18":				if (evt.altKey == true) {					if (IBM_RTE_isMozilla())					evt.preventDefault();					else {						evt.cancelBubble;						evt.returnValue = false;					}								if (charCode == <%= editorName %>theWinControls[i].keyAlphaNum) {						var jrl = <%= editorName %>theWinControls[i].loadUrl;						var wcp_win = window.open(jrl, <%= editorName %>theWinControls[i].name, 'scrollbars=0, toolbar=0, statusbar=0, width=' + <%= editorName %>theWinControls[i].width + ', height=' + <%= editorName %>theWinControls[i].height + ', left=' + <%= editorName %>theWinControls[i].left + ', top=' + <%= editorName %>theWinControls[i].top);						wcp_win.focus();                       					}				}	// Most of key modifier sequences are reserved; to facilitate future extension, 	// key modifier 19 is set to the combination of shift+ctrl, this will give 	// developers a lot more choices. 			case "19":				if (evt.shiftKey && evt.ctrlKey) {					if (IBM_RTE_isMozilla())						evt.preventDefault();					else {						evt.cancelBubble;						evt.returnValue = false;					}								if (charCode == <%= editorName %>theWinControls[i].keyAlphaNum) {						var jrl = <%= editorName %>theWinControls[i].loadUrl;						var wcp_win;						try{							if(<%= editorName %>theWinControls[i].accesswindow != null){								<%= editorName %>theWinControls[i].accesswindow.focus();								if(!IBM_RTE_isMozilla()){									break;								}							}						}catch(e){}						wcp_win= window.open(jrl, <%= editorName %>theWinControls[i].name, 'scrollbars=0, toolbar=0, statusbar=0, width=' + <%= editorName %>theWinControls[i].width + ', height=' + <%= editorName %>theWinControls[i].height + ', left=' + <%= editorName %>theWinControls[i].left + ', top=' + <%= editorName %>theWinControls[i].top);						<%= editorName %>theWinControls[i].accesswindow = wcp_win;						wcp_win.focus(); 					}				}		} // End of switch.	} // End of for loop.// gecko only: backspace table delete	if(IBM_RTE_isMozilla()){		if(eventObj.keyCode == 8){			if (document.getElementById("<%= editorName %>ToolbarFormatButtonSourceCodeImg").title != "Design Mode"){ 				geckoTableDelete("<%= editorName %>");				}     		}     	}	// gecko only: backspace table delete}function IBM_RTE_<%= editorName %>keyup(eventObj) {	if(eventObj.charCode != 13 && eventObj.keyCode != 13){	 IBM_RTE_modFormatList(false);	 IBM_RTE_modFontSizeList(false);	 IBM_RTE_modFontFaceList(false);	}	 if(!IBM_RTE_isMozilla()){		var rownat=IBM_RTE_getCell('<%= editorName %>');		if(rownat==null){		}else{			var rowvalue=rownat.firstChild.data;			if(rowvalue==""){			  rownat.innerHTML="&nbsp;";			}		}	}}function IBM_RTE_<%= editorName %>init(editorName) {<% if (editMode) { %>   if (IBM_RTE_isMozilla()) {     setTimeout("IBM_RTE_<%= editorName %>enablekeypress('" +editorName + "')", 1500);     setTimeout("IBM_RTE_setDesignMode('" + editorName + "')", 2500);     <% if (!evtHandler.equals("")) { %>		setTimeout("<%= evtHandler %>", 1500);      <% } %>   }else {  //When using body.contentEditable to replace designMode=on, IE needs timeout as well.  //Modified in 5.1 release to support Annotation feature for PDM version RTE.      setTimeout("IBM_RTE_<%= editorName %>enablekeypress('" +editorName + "')", 1500);       setTimeout("IBM_RTE_setDesignMode('" + editorName + "')", 1500);     <% if (!evtHandler.equals("")) { %>        <%= evtHandler %>;                     <% } %>    }<% } if (enableWindowControl.equalsIgnoreCase("yes")) { %> // These functions are to enable accessibility.   IBM_RTE_<%= editorName %>getWinControls();   <% } %>    if (IBM_RTE_isMozilla()) {     IBM_RTE_getWindow("<%= editorName %>").focus();                }}IBM_RTE_<%= editorName %>init("<%= editorName %>");//init'ed the control character rendervar renderedCtrlChars = new Array(<% for(int i = 0; i < controlChars.length; i++){ %><% if(i+1 != controlChars.length){%>"<%= controlChars[i] %>", <%}else{%>"<%= controlChars[i] %>"<%}%><% } %>);function IBM_RTE_Mozilla_addPTags(editorName){	var rng = IBM_RTE_getSelectionRange(editorName);

⌨️ 快捷键说明

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