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

📄 inputfield.jsp

📁 OBPM是一个开源
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GBK"
	pageEncoding="GBK"%>
<%@ taglib prefix="ww" uri="webwork"%>
<%@ page import="java.util.*"%>
<%@ page import="cn.myapps.core.validate.repository.action.ValidateRepositoryHelper" %>
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<ww:bean name="cn.myapps.core.dynaform.view.action.ViewHelper" id="viewHelper">
<ww:param name="moduleid" value="#parameters.moduleid"/>
</ww:bean>

<STYLE type=text/css>
body, a, table, div, span, td, th, input, select{font:9pt;font-family: "{*[SongTi]*}", Verdana, Arial, Helvetica, sans-serif;}
body {padding:5px}
.card {cursor:hand;background-color:#3A6EA5;text-align:center;}
table{
	border-color: #FFFFFF;
	border-collapse: collapse;
	background-image: none;
		border-top: 0px solid #FFFFFF;
}
table.content td {border-color:#000000;vertical-align:middle;cursor:hand;}
table.content {border-color:#000000;width:100%;}
</STYLE>


<script language=JavaScript src="dialog.js"></script>
<script language=JavaScript src="script.js"></script>
<SCRIPT language=JavaScript>
// 替换特殊字符
function HTMLEncode(text){
	text = text.replace(/&/g, "@amp;") ;
	text = text.replace(/"/g, "@quot;") ;
	text = text.replace(/</g, "@lt;") ;
	text = text.replace(/>/g, "@gt;") ;
	text = text.replace(/'/g, "@#146;") ;
	text = text.replace(/\ /g,"@nbsp;");
	return text;
}

// 替换特殊字符
function HTMLDencode(text){
	var textold;
	do {
		textold = text;
		text = text.replace("@amp;","&") ;
		text = text.replace('@quot;','"') ;
		text = text.replace("@lt;","<") ;
		text = text.replace("@gt;",">") ;
		text = text.replace("@#146;","'") ;
		text = text.replace("@nbsp;"," ");
        }
        while(textold != text);
	return text;
}

function test()
{
 if(document.all('fieldtype').value=='VALUE_TYPE_DATE')
 {
  document.all('isDisplayDate').style.display='';
 }else{
 document.all('isDisplayDate').style.display='none';
 }
}
// 选项卡点击事件
function cardClick(cardID){
	var obj;
	for (var i=1;i<7;i++){
		obj=document.all("card"+i);
		obj.style.backgroundColor="#3A6EA5";
		obj.style.color="#FFFFFF";
	}
	obj=document.all("card"+cardID);
	obj.style.backgroundColor="#FFFFFF";
	obj.style.color="#3A6EA5";
	
	for (var i=1;i<7;i++){
		obj=document.all("content"+i);
		obj.style.display="none";
	}
	obj=document.all("content"+cardID);
	obj.style.display="";
}

function getInnerHTML() {

	var s = '<input className="cn.myapps.core.dynaform.form.ejb.InputField"';
	s += ' type="text" ';
	s += ' name="'+HTMLEncode(temp.name.value)+'"';
	s += ' refreshOnChanged="'+HTMLEncode(temp.refreshOnChanged.checked+"")+'"';
	s += ' calculateOnRefresh="'+HTMLEncode(temp.calculateOnRefresh.checked+"")+'"';
	s += ' popToChoice="'+HTMLEncode(temp.popToChoice.checked+"")+'"';
	s += ' discript="'+HTMLEncode(temp.discript.value)+'"';
	s += ' valueScript="'+HTMLEncode(temp.valueScript.value)+'"';
	s += ' validateRule="'+HTMLEncode(temp.validateRule.value)+'"';
	s += ' hiddenScript="'+HTMLEncode(temp.hiddenScript.value)+'"';
	s += ' hiddenPrintScript="'+HTMLEncode(temp.hiddenPrintScript.value)+'"';
	s += ' readonlyScript="'+HTMLEncode(temp.readonlyScript.value)+'"';
	s += ' textType="'+HTMLEncode(temp.textType.options[temp.textType.selectedIndex].value)+'"';
	s += ' fieldkeyevent="'+HTMLEncode(temp.fieldkeyevent.options[temp.fieldkeyevent.selectedIndex].value)+'"';
	s += ' selectDate ="'+HTMLEncode(document.all('selectDate').checked+"")+'"';
	s += ' fieldtype="'+HTMLEncode(temp.fieldtype.options[temp.fieldtype.selectedIndex].value)+'"';
	s += ' dialogView="'+HTMLEncode(temp.dialogView.options[temp.dialogView.selectedIndex].value)+'"';
	        
	       var validateLibs=document.getElementsByName('validateLibs');
	       var libs='';
	       for(var i=0; i< validateLibs.length; i++){
   			if(validateLibs[i].checked){
   				libs+=validateLibs[i].value+";";
   			}
   			}
   		  libs=libs.substring(0,libs.length-1);
	s+=' validateLibs="'+HTMLEncode(libs)+'"';   

	s += '>';

  return s;
}

var sAction = URLParams['action'] ;
var sTitle = "{*[Insert]*}";

var oControl;
var oSeletion;
var sRangeType;

oSelection = dialogArguments.eWebEditor.document.selection.createRange();
sRangeType = dialogArguments.eWebEditor.document.selection.type;

if (sAction == "modify"){
	if (sRangeType == "Control"){
		if (oSelection.item(0).tagName == "INPUT"){
			oControl = oSelection.item(0);
		}
	}else{
		oControl = getParentObject(oSelection.parentElement(), "INPUT");
	}
	if (oControl) {
		sTitle = "{*[Modify]*}";		
	}
}
document.write("<title>{*[InputFiled property]*}(" + sTitle + ")</title>");

// 初始值
function InitDocument(){
	// 修改状态时取值
	try{
	if (sAction == "modify"){
	   	temp.name.value = HTMLDencode(oControl.name);
		temp.refreshOnChanged.checked = oControl.refreshOnChanged == "true";
		temp.calculateOnRefresh.checked = oControl.calculateOnRefresh == "true";
		temp.popToChoice.checked = oControl.popToChoice == "true";
		temp.discript.value = HTMLDencode(oControl.discript);
		temp.valueScript.value = HTMLDencode(oControl.valueScript);
		temp.validateRule.value = HTMLDencode(oControl.validateRule);
		temp.hiddenScript.value = HTMLDencode(oControl.hiddenScript);
		temp.hiddenPrintScript.value = HTMLDencode(oControl.hiddenPrintScript);
		temp.readonlyScript.value = HTMLDencode(oControl.readonlyScript);
		
		for(i=0;i<temp.textType.options.length;i++)
		  if(temp.textType.options[i].value==HTMLDencode(oControl.textType)){
		    temp.textType.selectedIndex = i;
			break;
		  }
		
		for(i=0;i<temp.fieldkeyevent.options.length;i++)
		  if(temp.fieldkeyevent.options[i].value==HTMLDencode(oControl.fieldkeyevent)){
		    temp.fieldkeyevent.selectedIndex = i;
			break;
		  }
		  
		 
		for(i=0;i<temp.fieldtype.options.length;i++) 
		  if(temp.fieldtype.options[i].value==HTMLDencode(oControl.fieldtype)){
		    temp.fieldtype.selectedIndex = i;
			if (temp.fieldtype.options[i].value == 'VALUE_TYPE_DATE') {
				document.all('isDisplayDate').style.display='';
		    	document.all('selectDate').checked = oControl.selectDate == "true"
			}
			break;
		  }
		
		for(i=0;i<temp.dialogView.options.length;i++)
		  if(temp.dialogView.options[i].value==HTMLDencode(oControl.dialogView)){
		    temp.dialogView.selectedIndex = i;
			break;
		  }
		  
		  var libstr=HTMLDencode(oControl.validateLibs);
		  var lib=libstr.split(';');
		  var validateLibs=document.getElementsByName('validateLibs');
	       for(var i=0; i< lib.length; i++){
	       for(var j=0; j< validateLibs.length; j++){
   			if(validateLibs[j].value==lib[i]){
   				validateLibs[j].checked=true;
   					}
   				}
   			}
	}
	}catch(ex){
		
	}
}

//点击取消
function ev_cancel() {
  window.close();
}

// 点击返回
function ev_ok(){
	//检查内容是否完成正确
	if(!ev_check())
		return;
	
	if(sAction == "modify"){
		oControl.name = temp.name.value;
		oControl.refreshOnChanged = temp.refreshOnChanged.checked+"";
		oControl.calculateOnRefresh = temp.calculateOnRefresh.checked+"";
		oControl.popToChoice = temp.popToChoice.checked+"";
		oControl.discript = temp.discript.value;
		oControl.valueScript = HTMLEncode(temp.valueScript.value);
		oControl.validateRule = HTMLEncode(temp.validateRule.value);
		oControl.hiddenScript = HTMLEncode(temp.hiddenScript.value);
		oControl.hiddenPrintScript = HTMLEncode(temp.hiddenPrintScript.value);
		oControl.readonlyScript = HTMLEncode(temp.readonlyScript.value);
		oControl.fieldtype = temp.fieldtype.options[temp.fieldtype.selectedIndex].value;
		oControl.dialogView = temp.dialogView.options[temp.dialogView.selectedIndex].value;
		oControl.textType = temp.textType.options[temp.textType.selectedIndex].value;
		oControl.fieldkeyevent = temp.fieldkeyevent.options[temp.fieldkeyevent.selectedIndex].value;
		oControl.selectDate = document.all('selectDate').checked+""; 
		
		  var validateLibs=document.getElementsByName('validateLibs');
	       var libs='';
	       for(var i=0; i< validateLibs.length; i++){
   			if(validateLibs[i].checked){
   				libs+=validateLibs[i].value+';';
   			}
   			}
   		   libs=libs.substring(0,libs.length-1);
	   	   oControl.validateLibs=libs;

	}
	else if(dialogArguments != null) {
  		dialogArguments.insertHTML(getInnerHTML());
	}
	
	window.returnValue = null;
	window.close();
}
//检查内容是否完成正确
function ev_check(){
   if(temp.name.value==''){
 	  alert('{*[Please input name]*}');
	  return false;
   }
   return true;
}

</script>

</HEAD>

<BODY bgcolor=menu onload="InitDocument()">

<form name="temp">
<table border=0 cellpadding=0 cellspacing=0 width="100%"><tr valign=top><td>


<table border=0 cellpadding=3 cellspacing=0>
<tr align=center>
	<td class="card" onclick="cardClick(1)" id="card1">{*[Basic]*}</td>
	<td width=2></td>
	<td class="card" onclick="cardClick(2)" id="card2">{*[Value script]*}</td>
	<td width=2></td>
	<td class="card" onclick="cardClick(3)" id="card3">{*[Validate Script]*}</td>
	<td width=2></td>
	<td class="card" onclick="cardClick(4)" id="card4">{*[Script for Hide]*}</td>
	<td width=2></td>
	<td class="card" onclick="cardClick(5)" id="card5">{*[Print script for Hide]*}</td>
	<td width=2></td>
	<td class="card" onclick="cardClick(6)" id="card6">{*[ReadOnly script]*}</td>
    <td width=2></td>
</tr>
<tr>
	<td  valign=middle colspan=12 >
	<table border=1 cellpadding=3 cellspacing=1 class="content" id="content1" width="100%">
	<tr>
		<td width="10%" align="right" >{*[Name]*}</td>
		<td  colspan="2"><input type=text name="name" size="16"></td>
		<td  align="right" >{*[TextBox Type]*}</td>
		<td >
			<select name="textType">
				<option value="text">{*[Common]*}</option>
				<option value="password">{*[Password]*}</option>
				<option value="readonly">{*[Readonly]*}</option>
				<option value="hidden">{*[Hidden]*}</option>
			</select>
		</td>
		
		
	</tr>
	<tr >
		<td  align="right">{*[Type]*}</td>
		<td colspan="2">
		   <select onchange="test()" name="fieldtype">
		     <option value="VALUE_TYPE_VARCHAR">{*[Text]*}</option>
		     <option value="VALUE_TYPE_NUMBER">{*[Number]*}</option>
		     <option value="VALUE_TYPE_DATE">{*[Date]*}</option>
		   </select>
		</td><td id="isDisplayDate" style="display:none">SelectDate<input type="checkbox" name="selectDate" value="true"/></td>
		<td  align="right">{*[Refresh]*}<input type=checkbox name="refreshOnChanged" value="true">&nbsp;{*[Recalculate]*}<input type=checkbox name="calculateOnRefresh" value="true"></td>
	</tr>
	<tr>
		<td align="right">{*[Choose]*}</td>
		<td  colspan="4">
		<ww:select name="dialogView" list="#viewHelper.get_viewList(#session.APPLICATION)" listKey="id"
			listValue="name" emptyOption="true" theme="simple" />&nbsp;{*[IsPop]*}:<input type=checkbox name="popToChoice" value="true">
			&nbsp;{*[Change focus on]*}:
			<select  name="fieldkeyevent">
				<option value="Enterkey">{*[EnterKey]*}</option>
			    <option value="Tabkey">{*[TabKey]*}</option>
		    </select>
		</td>
	</tr>
	<tr>
		<td align="right">{*[Description]*}</td>
		<td  colspan="4"><textarea name="discript" cols="50"  rows="4"></textarea></td>
	</tr>
	</table>
	<table border=1 cellpadding=3 cellspacing=1 class="content" id="content2">
	<tr>
		<td width="18px">{*[Value script]*}</td>
		<td width="15%"><textarea name="valueScript" cols="55"  rows="10"></textarea></td>
	</tr>
	</table>
	<table border=1 cellpadding=3 cellspacing=1 class="content" id="content3">
	<tr>
	    <td width="15%">
	    <table>
	    <% ValidateRepositoryHelper vrhpler=new ValidateRepositoryHelper();
	       String moduleid=request.getParameter("moduleid");
	       vrhpler.set_moduleid(moduleid);
	       Map map=vrhpler.get_validate();
			for (Iterator iter = map.keySet().iterator(); iter.hasNext();) {
				Object  id = (Object) iter.next();
				String name=(String)map.get(id);
	     %><tr><td>
	      <input type="checkbox" name="validateLibs" value="<%=(String)id %>" /><%=name%>
	     </td></tr>
	     <%}%>
	    </table>
	    </td>
		<td width="15%">{*[Validate Script]*}</td>
		<td width="70%"><textarea name="validateRule" cols="40"  rows="8"></textarea></td>
	</tr>
	<tr>
		<td colspan="3" align="center"><input type="button" style="align:center" value="{*[create scripte muse be inputed]*}" onclick="validateRule.value=createNotNullScript(temp.name.value);">
	</tr>
	</table>
	<table border=1 cellpadding=3 cellspacing=1 class="content" id="content4">
	<tr>
		<td width="18px">{*[script for Hide]*}</td>
		<td><textarea name="hiddenScript" cols="55"  rows="10"></textarea></td>
	</tr>
	</table>
	<table border=1 cellpadding=3 cellspacing=1 class="content" id="content5">
	<tr>
		<td width="18px">{*[Print script for Hide]*}</td>
		<td><textarea name="hiddenPrintScript" cols="55"  rows="10"></textarea></td>
	</tr>
	</table>
		<table border=1 cellpadding=3 cellspacing=1 class="content" id="content6">
	<tr>
		<td width="18px">{*[ReadOnly script]*}</td>
		<td><textarea name="readonlyScript" cols="50"  rows="10"></textarea></td>
	</tr>
	</table>
	</td>
</tr>
<tr align="center"><td colspan="12">
	<input type=button value="{*[OK]*}" onclick="ev_ok()">
	<input type=button value="{*[Cancle]*}" onclick="ev_cancel()">
</td></tr>
</table>


</td><td width=10></td><td>

</td></tr></table>
</form>

<script language=javascript>
cardClick(1);
</script>

</BODY>
</HTML>

⌨️ 快捷键说明

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