apzl_leasing/WebContent/Common/ScriptEditor/ScriptEditorForASScript.jsp
2018-06-03 22:26:41 +08:00

167 lines
6.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page contentType="text/html; charset=GBK"%><%@ include file="/IncludeBeginMD.jsp"%><%
String sScriptText = CurPage.getParameter("ScriptText");
if (sScriptText==null) sScriptText="";
sScriptText = StringFunction.replace(sScriptText,"$[wave]","~");
//¶¨ÒåTreeview
OHTMLTreeView tviTemp = new OHTMLTreeView(CurPage, "δÃüÃû","right");
int i=0;
int j=0;
String sFolder = "";
String sSql="select ClassName from O ";
String sSql2 = "select distinct MethodName,ReturnType,MethodArgs,"+
"MethodDescribe,MethodCode from O where ClassName=:ClassName order by MethodName";
List<BizObject> l1 = JBOFactory.createBizObjectQuery("jbo.sys.CLASS_CATALOG", sSql).getResultList(false);
for(BizObject cc : l1){
j=0;
String className = cc.getAttribute("ClassName").getString();
sFolder = tviTemp.insertFolder("root",className,"",i++);
List<BizObject> l2 = JBOFactory.createBizObjectQuery("jbo.sys.CLASS_METHOD", sSql2).setParameter("ClassName",className).getResultList(false);
for(BizObject cm : l2){
String methodName = cm.getAttribute("MethodName").getString();
String method = "<font color=red>"+cm.getAttribute("ReturnType").getString()+"</font>&nbsp;&nbsp;!'"+className+"."+methodName+"("+ cm.getAttribute("MethodArgs").getString()+")";
String methodArgs=cm.getAttribute("MethodArgs").getString();
String[] args=methodArgs.split(",");
String arg="";
for(int y=0;y<args.length;y++){
String[] a=args[y].trim().split(" ");
arg+="#"+a[a.length-1]+",";
}
if(arg.length()>0){
arg=arg.substring(0,arg.length()-1);
}
String methodDescribe = cm.getAttribute("MethodDescribe").getString();
String methodCode = cm.getAttribute("MethodCode").getString();
tviTemp.insertPage(sFolder,methodName,"javascript:parent.mySelection(\""+className+"\",\""+methodName+"\",\""+method+"\",\""+methodDescribe+"\",\""+methodCode+"\",\""+arg+"\")",j++);
}
}
%>
<html>
<body leftmargin="0" topmargin="0" class="windowbackground" onload="">
<table style="width: 100%;height: 100%;border: 0;" cellspacing="0" cellpadding="0">
<tr height=1>
<td>
<table>
<tr>
<td><%=new Button("È·¶¨", "È·¶¨", "translateScriptText()", "", "").getHtmlText()%></td>
<td><%=new Button("È¡Ïû", "È¡Ïû", "cancel()", "", "").getHtmlText()%></td>
<td id="showTreeButtonTD">
<%=new Button("ÏÔʾ·½·¨Ê÷", "ÏÔʾ·½·¨Ê÷", "showTree()", "", "").getHtmlText()%>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table cellspacing="0" cellpadding="0" style="width: 100%;height: 100%;border: 0;" class="content_table" id="content_table">
<tr>
<td id="myleft_leftMargin" class="myleft_leftMargin"></td>
<td id="myleft" width=20%>
<iframe name="left" src="" width=100% height=100% frameborder=0 scrolling=no ></iframe>
</td>
<td id="myleft_rightMargin" class="myleft_rightMargin"> </td>
<td id="mycenter" class="mycenter">
<div id=divDrag title='¿ÉÍÏ×§¸Ä±ä´°¿Ú´óС Drag to resize' style="z-index:0; cursor: w-resize;" ondrag="if(event.x>16 && event.x<400) {myleft_top.style.display='block';myleft.style.display='block';myleft_bottom.style.display='block';myleft.width=event.x-6;}if(event.x<=16 && event.y>=4) {myleft_top.style.display='none';myleft.style.display='none';myleft_bottom.style.display='none';}if(event.x<4) window.event.returnValue = false;">
<span class="imgDrag" style="display:inline-block;">&nbsp;</span>
</div>
</td>
<td id="myright_leftMargin" class="myright_leftMargin"></td>
<td id="myright" class="myright">
<div class="RightContentDiv" id="RightContentDiv">
<table style="width: 100%;height: 100%;border: 0;" cellspacing="0" cellpadding="0">
<tr>
<td colspan=2 id="myHelpText" height=10 class='Help_TextArea'> Script ÕýÎÄ
</td>
</tr>
<tr>
<td colspan=2 >
<div class="groupboxmaxcontent" style="width: 100%;height:100%" id="window1">
<iframe name="right" style="display:none"></iframe>
<textarea name="myTextArea" id="myTextArea" onselect="storeCaret(this);" onclick="storeCaret(this);" style="width:100%;height:100%" onkeyup="storeCaret(this);" wrap=soft class="Script_TextArea"></textarea>
</div>
</td>
</tr>
</table>
</div>
</td>
<td id="myright_rightMargin" class="myright_rightMargin"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<script type="text/javascript">
function startMenu(){
<%=tviTemp.generateHTMLTreeView()%>
}
function translateScriptText(){
parent.AsDialog.ClosePage(amarsoft2Real(document.getElementById("myTextArea").value));
}
function cancel(){
parent.AsDialog.ClosePage();
}
//Ñ¡Ôñ¡°×óÀ¸¡±ºÍ¡°ÓÒÀ¸¡±
function clickMyColOption(sPara1,sPara2){
sCurOptValue=sPara1;
sCurOptName=sPara2;
}
function mySelection(sClassName,sMethodName,sMethod,sMethodDescribe,sMethodCode,sMethodArgs){
var sReturnValue="!"+sClassName+"."+sMethodName+"("+sMethodArgs+")";
var sHelpText=sMethod+"<br>"+sMethodDescribe+"<br>"+sMethodCode;
sHelpText = sHelpText+"<br><br><a href=\"javascript:insertHelp('"+sReturnValue+"')\"><font color=red>²åÈë¸Ã·½·¨</font></a>";
document.all("myHelpText").innerHTML=sHelpText;
}
function insertHelp(tmp){
insertAtCaret(document.getElementById("myTextArea"),tmp);
}
//È·¶¨Ñ¡ÔñµÄλÖÃ
function storeCaret (textEl) {
if (textEl.createTextRange)
textEl.caretPos = document.selection.createRange().duplicate();
}
//²åÈëÊý¾Ý
function insertAtCaret (textEl, text) {
if (textEl.createTextRange && textEl.caretPos) {
var caretPos = textEl.caretPos;
caretPos.text =text;
}else {
if(textEl.value.length>0){
textEl.value = textEl.value+"+"+text;
}else{
textEl.value=text;
}
}
}
//ÀûÓÃString.replaceº¯Êý£¬½«×Ö·û´®×óÓÒÁ½±ßµÄ¿Õ¸ñÌæ»»³É¿Õ×Ö·û´®
function Trim (sTmp){
return sTmp.replace(/^(\s+)/,"").replace(/(\s+)$/,"");
}
function showTree(){
myleft.width=200;
startMenu();
expandNode('root');
showTreeButtonTD.style.display="none";
}
myleft.width=1;
//ÔØÈëʱȥ³ýÖµÁ½±ßµÄ¿Õ¸ñ
document.getElementById("myTextArea").value = amarsoft2Real("<%=sScriptText.trim()%>");
</script>
<%@ include file="/IncludeEnd.jsp"%>