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

📄 content.jsp

📁 OBPM是一个开源
💻 JSP
字号:
<%@ page language="java" contentType="text/html; charset=GBK"%>
<%@ page import="java.util.*"%>
<%@include file="/common/taglibs.jsp"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ page import="cn.myapps.core.dynaform.activity.ejb.Activity"%>
<%@ page import="cn.myapps.core.dynaform.document.ejb.Document"%>
<%@ page import="cn.myapps.core.dynaform.form.ejb.Form"%>
<%@ page import="cn.myapps.core.dynaform.form.action.FormHelper"%>
<%@ page import="cn.myapps.base.action.ParamsTable"%>
<%@ page import="cn.myapps.core.user.action.WebUser"%>
<%@ page import="cn.myapps.core.user.ejb.UserVO"%>
<%@ page import="cn.myapps.constans.Web"%>
<%@ page import="cn.myapps.core.style.repository.ejb.StyleRepositoryVO"%>
<%@ page import="cn.myapps.core.workflow.engine.StateMachineHelper"%>
<%@ page import="cn.myapps.core.dynaform.view.ejb.View"%>
<%@ page import="cn.myapps.core.macro.runner.JavaScriptRunner"%>
<%@ page import="cn.myapps.core.workflow.storage.definition.action.BillDefiHelper" %>
<%@ page import="cn.myapps.core.workflow.storage.definition.ejb.BillDefiVO" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%String contextPath = request.getContextPath(); 
			String currURL = request.getRequestURL().toString();
			boolean isDocSaveUser = false; 
			boolean isEdit = true;
			//System.out.println("currURL->" + currURL);
			WebUser webUser = (WebUser) session
					.getAttribute(Web.SESSION_ATTRIBUTE_USER);
			
			if (currURL.indexOf("new.action") > 0
					|| currURL.indexOf("edit.action") > 0
					|| currURL.indexOf("save.action") > 0) {
				isEdit = true;
			}

			Document doc = (Document) request.getAttribute("content");
			ParamsTable params = ParamsTable.convertHTTP(request);
			String formid = request.getParameter("formid");

			Form form = FormHelper.get_FormById(formid);
			if (form == null) {
				throw new Exception("Form {*[does not exist or deleted]*}!");
			}

			Collection activities = form.getActivitys();

			JavaScriptRunner runner = JavaScriptRunner.getInstance();
			runner.initBSFManager(doc,  params,	webUser, new ArrayList(),webUser.getApplicationid());
			

			String docid = request.getParameter("_docid");
			if (docid == null) {
				docid = "";
			}
			String flowid = "";
			%>
<html>
<head>
<script>

function ev_action(type, actid, backURL) {
		var url = '<ww:url action="action" namespace="/core/dynaform/activity" />' ;
		var newUrl;
		
		var elements = document.forms[0].elements;
			for (var i=0; i<elements.length; i++) {
				var element = elements[i];
				if(element.disabled == true) {
					//alert("****type->" + element.type);
					element.disabled = false;
				}
			}
		
		if (type == '<%= Activity.ACTIVITY_TYPE_DOCUMENT_UPDATE%>' ) {
			newUrl = url + '?_activityid=' + actid ;
		} 
		else if (type == '<%= Activity.ACTIVITY_TYPE_DOCUMENT_BACK%>' ) {
			newUrl = url + '?_activityid=' + actid + '&_backURL=' + backURL;
		}
		else {
			newUrl = url + '?_activityid=' + actid;
		}

		var button_acts =document.all("button_act") ;
		for(var i=0; i< button_acts.length; i++){	
				button_acts[i].disabled = true;
		}
		
		document.forms[0].action = newUrl;
		document.forms[0].submit();
}

function ev_print(withFlowHis) {
    var id = document.all("content.id").value;
  	var formid = document.all("formid").value;
	var flowid = document.all("_flowid").value;
	if (!id) {
		alert("{*[Pls save]*}");
	} else {	
    var url = '<ww:url action="print" namespace="/core/dynaform/document" />' 
  			+ '?_docid=' + id;
  		url += '&formid=' + formid;
  	if (withFlowHis && flowid) { // 是否显示流程历史
  		url += '&_flowid=' + flowid;
  	}
  	
  	if (parent != top) {
  		parent.open(url);
  	} else {
  		window.open(url);
  	}
  }
}

</script>
<script language="JavaScript">
function setEnter(){
  if(event.keyCode==13)
    event.keyCode=9;
}
</script>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet"
	href="<ww:url value='/resource/css/style.jsp'/><%=form!=null&&form.getStyle()!=null? "?styleid="+form.getStyle().getId():"" %>" />

<script src='<ww:url value="/dwr/engine.js"/>'></script>
<script src='<ww:url value="/dwr/util.js"/>'></script>
<script src='<ww:url value="/dwr/interface/FormHelper.js"/>'></script>
<script src='<ww:url value="/dwr/interface/ViewHelper.js"/>'></script>
<script src="<%= contextPath %>/script/util.js"></script>
<script src="<%= contextPath %>/script/upload.js"></script>
<script>
var contextPath = '<%= request.getContextPath() %>';


function ev_onload(){
<%
String divid=request.getParameter("divid");
if(divid!=null&&!divid.equals("")&&!divid.equals("null")){
%>
 	 parent.document.getElementById('<%=request.getParameter("divid")%>').style.width=20+document.all('doc_divid').offsetWidth;;
 	 parent.document.getElementById('<%=request.getParameter("divid")%>').style.height=20+document.all('doc_divid').offsetHeight;;
	
<%}%>	

	if (document.all('oLayer')){
		if (document.all('myDiv')) {
			document.all('myDiv').style.height = (document.body.clientHeight - document.all.oLayer.clientHeight-35) + 'px';
		}
	}

	if ($('historyDiv')) {
		$('historyDiv').style.width = $('myDiv').clientWidth + 'px';
	}
}
</script>
</head>
<style>
<!--
.div{
 position: absolute;
 border: 2px solid red;
 background-color: #EFEFEF;
 line-height:90px;
 font-size:12px;
 z-index:1000;
}
-->
</style>
<body onload="ev_onload()" onunload="on_unload()" scroll=no>
<div id="doc_divid">
<ww:form action="save" method="post" theme="simple" >
	<%@include file="/common/page.jsp"%>
	<ww:hidden name="_formname" />
	<ww:hidden name="_new" />
	<ww:hidden name="_channelsname" />
	<ww:hidden name="_docid" />
	<ww:hidden name="lastmodified" />
	<ww:hidden name="formid" />
	<ww:hidden name='content.version'></ww:hidden>
	<ww:hidden name="parentid" value="%{#parameters.parentid}"/>
 	<ww:hidden name="_backURL" value="%{#parameters._backURL}" />
 	<ww:if test="#parameters.parentid[0] != null && #parameters.parentid[0] != ''">
 	<ww:hidden name="isedit" value="%{#parameters.isedit}" />
 	</ww:if>
 	<ww:hidden name="_viewid" value="%{#parameters._viewid}" />
 	<input type="hidden" name="divid" value="<%=request.getParameter("divid")%>" />
 	<%
 	Iterator aiter1 = activities.iterator();
 	if(aiter1.hasNext())
 	{
 	%>
	<div   style="background:#FFFFFF;bordercolor:#CCCCCC;" align="center">
	<ww:if test="hasFieldErrors()">
		<span class="errorMessage"> <b>Errors:</b><br>
		<ww:iterator value="fieldErrors">
			*<ww:property value="value[0]" />;
		</ww:iterator> 
		</span>
	</ww:if>
	<table width="100%" border="1" cellspacing="0" cellpadding="0" id="oLayer"  >
		<tr>
			<td>
			<table width="98%" border="0">
				<tr valign='top'>
					<td>
		<table border='0'>
		<%
		//显示Process Activity
		int flow=1;
		for (Iterator aiter = activities.iterator(); aiter.hasNext();) {
			Activity act = (Activity) aiter.next();
			if (act.getType() == Activity.ACTIVITY_TYPE_WORKFLOW_PROCESS) {
				flow++;
				if (doc != null && doc.getFlowid() != null 
						&& doc.getFlowid().trim().length() > 0) {
					flowid = doc.getFlowid();
				} else {
					if (act.getOnActionFlow() != null) {
						flowid = act.getOnActionFlow().getId();
					}
				}
				if (form.getType() == Form.FORM_TYPE_NORMAL) {
		%>
		<tr>
			<td><%@include file="/core/workflow/runtime/flowprcss.jsp"%></td>
		</tr>
		<%		}
			}
		}
		
		if (request.getParameter("isedit") != null &&
			!request.getParameter("isedit").equals("")) {
			if ((request.getParameter("isedit")).equals("true")) {
				isEdit = true;
			} else {
				isEdit = false;
			}
		} else {
			isEdit = StateMachineHelper.isDocEditUser(docid, flowid, webUser);
		}
			
		%>
		</table>
		<input type="hidden" name="_flowid" value="<%=flowid%>">			
					</td>
					<td id="actTd">
					<table width="100%" border=0 cellpadding="0" cellspacing="5" >
						<tr align="right">
							<td class="line-position" width="100%">&nbsp;</td>

							<%//显示非Process Activity

				
				boolean flag = true;  //用于标志act的hiddenscript是否能过
				//out.println(docid);

				if (activities != null) {
					for (Iterator aiter = activities.iterator(); aiter.hasNext();) {
						Activity act = (Activity) aiter.next();
						if ((act.getHiddenScript()) != null&& (act.getHiddenScript()).trim().length() > 0) {
							Object result = runner.run(act.getHiddenScript());//运行脚本
							if (result != null && result instanceof Boolean) {
								flag = ((Boolean)result).booleanValue();
							}
						}   
				               
						if(flag) {
							if (act.getType() == Activity.ACTIVITY_TYPE_PRINT) {
				%>			
							<!-- ********************** 普通打印按钮 **********************-->
							<td>
							<input type="button" class="button-document" id="button_act"
								alt="<%=act.getName() %>" value="<%=act.getName() %>" 
								onclick="ev_print(false)" />
							</td>
				<%		
							} else if (act.getType() == Activity.ACTIVITY_TYPE_PRINT_WITHFLOWHIS){
				%>
							<!-- ********************* 带流程历史打印按钮 **********************-->
							<td>
							<input type="button" class="button-document" id="button_act"
								alt="<%=act.getName() %>" value="<%=act.getName() %>" 
								onclick="ev_print(true)" />
							</td>
				<%			
							} else if (act.getType() != Activity.ACTIVITY_TYPE_WORKFLOW_PROCESS) {
				
				%>
							<td>
							<input type="button" class="button-document" id="button_act"
								alt="<%=act.getName() %>" value="<%=act.getName() %>"
							<% 
								if (act.getType() == Activity.ACTIVITY_TYPE_DOCUMENT_BACK) {
							%>	
								onclick="this.disabled=true;ev_action('<%= act.getType()%>', '<%=act.getId()%>', '<%=request.getParameter("_backURL") %>')" />
							<% 
								} else {
							%>
								onclick="this.disabled=true;ev_action('<%= act.getType()%>', '<%=act.getId()%>')" />
							<%
								}
							}
						}
						flag=true;
					}
				}
				%>	
						 </td>
						</tr>
					</table>
					</td>
				</tr>
			</table>
			</td>
		</tr>
	</table>
	</br>
	</div>

  <%} %>
 <div id="myDiv" style='overflow:auto'>
	<table width="100%" border="0" cellSpacing=0 cellPadding=0 id="toAll" style="z-index:1;">
		<tr>
			<td width="100%" valign="top"><%//	UserVO vo = new UserVO();
				//	WebUser user = new WebUser(vo);
				WebUser user = (WebUser) session
						.getAttribute(Web.SESSION_ATTRIBUTE_USER);
				Collection errors = new HashSet();

				BillDefiVO flowVO = BillDefiHelper.getBillDefiVOById(flowid);
				
				if(form.getBeforopenscript()!=null&&form.getBeforopenscript().trim().length()>0)
				{
					Object result = runner.run(form.getBeforopenscript());//运行脚本
					if (result != null && result instanceof Boolean) {
					  boolean	isEdit_bs=(((Boolean)result).booleanValue());
					  if(isEdit_bs!=isEdit)
						  isEdit=false;
					}
					
				}


				if (form != null) {
					//System.out.println("*****isEdit->" + request.getParameter("isEdit"));
					form.setEditmodal(isEdit);
					
					String html = form.toHtml(doc, params, user, errors, flowVO);
					out.print(html);
				}
			%></td>
		</tr>
	</table>
</div>
</ww:form>
<script> 
window.onresize = ev_onload;



document.ondblclick=handleDbClick; 


function on_unload()
{
 var typeflage = typeof(dialogArguments);
     if(typeflage != 'undefined' )
     {    
     }
    else if(window.opener)
    {
    }
     else
     {
        window.parent.lunload();
     } 
 
}
function handleDbClick()
{
if(event.srcElement.onclick){
}else if(event.srcElement.type!=null&&(event.srcElement.type.toUpperCase()=='SUBMIT'
||event.srcElement.type.toUpperCase()=='BUTTON'
||event.srcElement.type.toUpperCase()=='CHECKBOX'
||event.srcElement.type.toUpperCase()=='REDIO'
||event.srcElement.type.toUpperCase()=='SELECT'
||event.srcElement.type.toUpperCase()=='IMG'))
{
  
}
else{
	
	zoompage();
}
}
function zoompage()
{
 
     var typeflage = typeof(dialogArguments);
     if(typeflage != 'undefined' )
     {    
     }
    else if(window.opener)
    {
    }
     else
     {
        window.parent.Mytest();
     } 
     ev_onload();
}
</script> 

</div>
<!--选择窗口-->
<DIV ID="overDiv" STYLE="position:absolute; visibility:hiden; z-index:1;"></DIV>
<DIV ID="loadingDiv" STYLE="position:absolute;z-index:200;width:2000px; height:5000px;left:10px;top:0px;display:none"><table><tr><td><img src="<ww:url value="/resource/images/wait.gif"/>"></td><td><b><font size='3'>Loading...</font> </b></td></tr></table></DIV>
<SCRIPT LANGUAGE="JavaScript" SRC="overlib.js"></SCRIPT>
</body>
<html>

⌨️ 快捷键说明

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