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

📄 display_view.jsp

📁 OBPM是一个开源
💻 JSP
字号:
<%@ page contentType="text/html; charset=GBK"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="ww" uri="webwork"%>
<%@ page import="cn.myapps.core.dynaform.view.ejb.View"%>
<%@ page import="cn.myapps.core.dynaform.activity.ejb.Activity"%>
<%@ page import="cn.myapps.core.dynaform.document.ejb.Document"%>
<%@ page import="cn.myapps.base.action.ParamsTable"%>
<%@ page import="java.util.*"%>
<%@ page import="cn.myapps.core.image.repository.ejb.ImageRepositoryVO"%>
<%@ page
	import="cn.myapps.core.image.repository.action.ImageRepositoryAction"%>
<%@ page import="cn.myapps.core.user.action.WebUser"%>
<%@ page import="cn.myapps.core.user.ejb.UserVO"%>
<%@ page import="cn.myapps.core.macro.runner.JavaScriptRunner"%>
<%@ page import="cn.myapps.core.dynaform.view.ejb.Column"%>
<%@ page import="cn.myapps.core.dynaform.form.ejb.Form"%>
<%@ page import="cn.myapps.constans.Web"%>
<%@ page import="cn.myapps.core.dynaform.view.action.ViewHelper"%>
<%@include file="/common/taglibs.jsp"%>
<%@ page import="cn.myapps.core.workflow.engine.StateMachineHelper"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%View view = ((View) request.getAttribute("content"));
			JavaScriptRunner jsrun = JavaScriptRunner.getInstance();
			WebUser user =(WebUser)session.getAttribute(Web.SESSION_ATTRIBUTE_USER);
			Collection errors = new HashSet();
			ParamsTable params = ParamsTable.convertHTTP(request);
			Collection columns=view.getColumns();
			
	String viewid=request.getParameter("_viewid");
	String styleid=ViewHelper.get_Styleid(viewid);
	String imageid="";
	boolean isHeddienPage= true;
								 
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link rel="stylesheet"
	href="<ww:url value='/resource/css/style.jsp'/><%=styleid!=null?"?styleid="+styleid:""%>" />
<script src="<ww:url value='/script/util.js'/>"></script>
<script src="<ww:url value='/script/list.js'/>"></script>
<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>

<title>list column by view</title>
<script>
   function disabledButton()
   {
     var button_acts =document.all("button_view_act") ;
	for(var i=0; i< button_acts.length; i++){	
			button_acts[i].disabled = true;
	}
   }
</script>
<script>

<%   String excelWebPath=(String)request.getAttribute("excelWebPath");
     if(excelWebPath!=null&&excelWebPath.trim().length()>0){   
%>
     window.open ('<%=excelWebPath%>');
<% }%>
</script>
<script>
var isedit = '';
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('dspview_divid').offsetWidth;
		parent.document.getElementById('<%=request.getParameter("divid")%>').style.height =20+document.all('dspview_divid').offsetHeight;
	<%}%>		
	
	/*子文档为编辑模式时才显示activity*/
	isedit = '<%= (String)request.getParameter("isedit") %>';
	if (isedit != 'null' && isedit != '') {
		if (isedit == 'true') {
			act.style.display = '';
		}else
		{
		   act.style.display ='none';
		}
	} else {
		act.style.display = '';
	} 
	
}
</script>
</head>
<body onload="ev_onload()">
<div id="dspview_divid" style="overflow:auto"><ww:form name="formList"
	action="displayView" method="post" theme="simple">

	<input type="hidden" name="_currpage"
		value='<ww:property value="datas.pageNo"/>' />
	<input type="hidden" name="_pagelines"
		value='<ww:property value="content.pagelines"/>' />
	<input type="hidden" name="_rowcount"
		value='<ww:property value="datas.rowCount"/>' />

	<ww:url id="backURL" action="displayView" encode="true">
	</ww:url>
	<ww:hidden name="_backURL" value="%{backURL}" />
	<ww:hidden name="isedit" value="%{#parameters.isedit}" />

	<input type="hidden" name="divid"
		value="<%=request.getParameter("divid")%>" />
	<%	String parentid = request.getParameter("parentid");
         	if (parentid != null){ %>
	<ww:hidden name="parentid" value="<%=parentid%>" />
	<% }%>

	<table class="display_view-table" border="0" cellpadding="2"
		cellspacing="0" width="100%" Wrap="False">
		<!-- style="display: none" -->
		<tr id="act">
			<td align="right" colspan="2"><%
			
			Document tdoc = new Document();
			boolean flag = true;
			JavaScriptRunner runner = JavaScriptRunner.getInstance();
			runner.initBSFManager(tdoc, params, user, new ArrayList(), user.getApplicationid());	
			
			Collection activities = view.getActivitys();
			if (activities == null) {
				activities = new ArrayList();
			}
			
			Iterator aiter = activities.iterator();
			ImageRepositoryVO imageByAct = null;
			while(aiter.hasNext()) {
				Activity act = (Activity)aiter.next();
				View parentView = act.getParentView();
				imageid = act.getIconurl();
				  ImageRepositoryAction imgact = new ImageRepositoryAction();
				  imageByAct = imgact.doListByImageid(imageid);
				  
					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.getIconurl()!=null && imageByAct!=null) { %> &nbsp;
			<button class="button-image" id="button_view_act"<%}else{ %>
				&nbsp;<button class="button-dis" id="button_view_act" 
				<%} %>
			<% 	 
				if (parentView.getOpenType() != View.OPEN_TYPE_NORMAL && 
						act.getType() == Activity.ACTIVITY_TYPE_DOCUMENT_CREATE) {
			%>
				onclick="javaScript:this.disabled=true;disabledButton();createDoc('<ww:url action="action" namespace="/core/dynaform/activity" />',
											'<ww:property value="#parameters.parentid" />',
											'<%= act.getId()%>',
											'<ww:property value="%{backURL}" />', 
											'<%= parentView.getOpenType()%>')">
			<%  } else { %>	
				onclick="this.disabled=true;disabledButton();forms[0].action='<ww:url action="action" namespace="/core/dynaform/activity" />?_activityid=<%= act.getId()%>';forms[0].submit()">
			<%  } if (act.getIconurl()!=null && imageByAct!=null) { %>
				<img src="<ww:url value="<%=imageByAct.getContent()%>"/>" alt="<%=act.getName() %>" >
			<% 	
				}
			%>
				<%=act.getName() %></button>	
			<%
			}
			   flag = true;         
			}
			%>
			
			
			
			
			
			
			</td>
		</tr>

		<ww:hidden name="_viewid" />

		<tr>
			<td><%Form searchForm = view.getSearchForm();
				if (searchForm != null) {
					Document searchDoc = searchForm	.createDocument(params, user);
					searchForm.setEditmodal(true);
					String ehtml = searchForm.toHtml(searchDoc, params, user,new ArrayList(), null);
					out.print(ehtml);
				%></td>

			<td><input type="submit" class="button-cmd" value="{*[Query]*}" /> <input
				type="button" class="button-cmd" value="{*[Reset]*}"
				onclick="resetAll()" /></td>
			<%}%>
		</tr>
	</table>

	<table class="display_view-table" border="0" cellpadding="2"
		cellspacing="0" width="100%" wrap="false">
		<tr wrap="false">
			<td class="column-head2" scope="col"
				style="white-space:nowrap;align:left"><input type="checkbox"
				onclick="selectAll(this.checked)"></td>

			<ww:iterator value="content.columns" status="colstatus">
				<ww:if test="width != null && width != '' && !#colstatus.last">
					<td class="column-head" width='<ww:property value="width"/>'
						style="white-space:nowrap;align:left;"><ww:property value="name" /></td>
				</ww:if>
				<ww:else>
					<td class="column-head" style="white-space:nowrap;"><ww:property
						value="name" /></td>
				</ww:else>
			</ww:iterator>
		</tr>

		<tr wrap="false">
			<ww:iterator value="datas.datas">
				<tr>
					<ww:set name="doc" id="doc" scope="page" />
					<td class="table-td" style="white-space:nowrap"><input
						type="checkbox" name="_selects" value='<ww:property value="id"/>' /></td>
					<%Document doc = (Document) pageContext.getAttribute("doc");
					jsrun.initBSFManager(doc, params, user, errors,user.getApplicationid());
					Iterator iter = columns.iterator();
					while (iter.hasNext()) {
						Column col = (Column) iter.next();
						
						Object result = null;
						if(col.getType()!=null && col.getType().equals(Column.COLUMN_TYPE_SCRIPT)) {
							result = jsrun.run(col.getValueScript());
						}
						else if(col.getType()!=null && col.getType().equals(Column.COLUMN_TYPE_FIELD)) {
							result = doc.getItemValueAsString(col.getFieldName());
						} 
                       	
						if (result == null) { //不显示null
							result = "";
						}
						%>
					<td style="white-space:nowrap"><% 
							if (false) {
								isHeddienPage = false; 
						%> <a
						href='<ww:url value="/core/dynaform/document/view.action">
									 	<ww:param name="_docid" value="id"/>
										<ww:param name="formid" value="formid"/>
									 	<ww:param name="_backURL" value="backURL"/>
									 	<ww:param name="divid" value="#parameters.divid"/>
										<ww:param name="isedit" value="#parameters.isedit" />
										<ww:param name="_currpage" value="datas.pageNo" />
										<ww:param name="_pagelines" value="datas.linesPerPage" />
										<ww:param name="_rowcount" value="datas.rowCount" />
									 </ww:url>'><%=result%></a>
					<%} else {
						isHeddienPage = false;%> <a
						href="javaScript:viewDoc('<ww:property value="id" />', 
													'<ww:property value="formid" />',
													'<ww:property value="%{backURL}" />',
													'<ww:property value="#parameters.parentid" />',
													'<ww:property value="#parameters.isedit" />',
													'<%= view.getOpenType()%>')">
					<%=result%></a> <%} 
					}
				%></td>
				</tr>
			</ww:iterator>
	</table>
	<%
	  if (view.getOpenType()==view.OPEN_TYPE_PARENT)
	  {
		  isHeddienPage = true ;
	  }
	%>

	<table align="right" width="60%" border="0" cellspacing="0"
		cellpadding="0">

		<tr>

			<ww:if test="_isPagination == 'true'">
				<%if(!isHeddienPage){ %>
				<td align="right" class="pagenav" width="83%"><o:PageNavigation
					dpName="datas" css="linktag" /></td>
				<%} %>
			</ww:if>
			<ww:if test="_isShowTotalRow == 'true'">
				<td align="right" class="pagenav">TotalRows:(<ww:property
					value="totalRowText" />)</td>
			</ww:if>
		</tr>

	</table>


</ww:form></div>
</body>

<script lanaguage="javaScript">
	var contextPath = '<%= request.getContextPath()%>' ;
	function resetAll() {
		var elements = document.forms[0].elements;
		
		for (var i = 0; i < elements.length; i++) {
			//alert(elements[i].type);
			if (elements[i].type == 'text') {
				elements[i].value="";
			}
		}
	}

	function createDoc(url, parentid, activityid, backURL, opentype) {
		wx = '800px';
	    wy = '600px';
		url += "?parentid=" + parentid;
		url += "&_activityid=" + activityid;
		url += "&_backURL=" + backURL;
		
		//alert("createDocURL->" + url);
		if (isedit != 'null' && isedit != '') {
			url += "&isedit=" + isedit;
		}
		if (opentype == '<%= View.OPEN_TYPE_POP%>') {
			//alert(parent.frames[0].location);
			var rtn = showframe('{*[Select]*}', url);
			document.forms[0].submit();
		} else if (opentype == '<%= View.OPEN_TYPE_PARENT%>') {
			//alert("***url->" + url);
			parent.location = url;
		}
	}
	
	function viewDoc(docid, formid, backURL, parentid, isedit, opentype) {
		wx = '800px';
	    wy = '600px';  
		var url = '<ww:url value="/core/dynaform/document/view.action" />' ;
		url += '?_docid=' + docid;
	
		if (formid != null && formid != "") {
			url += '&formid=' +  formid;
		}
		
		if (opentype == '<%= View.OPEN_TYPE_NORMAL%>') {
			formList.action = url;
			formList.submit();
		} else {
			if (parentid != null && parentid != "") {
				url += '&parentid=' +  parentid;
			}
			if (isedit != null && isedit!= "") {
				url += '&isedit=' +  isedit;
			}
			if (backURL != null && backURL!="") {
				if (parent) {
					//alert("***pathname->" + parent.location.pathname);
					url += '&_backURL=' +  parent.location.pathname;
				} else {
					url += '&_backURL=' + backURL;
				}
			}
			
			if (opentype == '<%= View.OPEN_TYPE_POP%>') {
				var rtn = showframe('{*[Select]*}', url);
				document.forms[0].submit();
			} else if (opentype == '<%= View.OPEN_TYPE_PARENT%>') {
				parent.location = url;
			}
		}
	}
</script>
<DIV ID="loadingDiv"
	STYLE="position:absolute;z-index:20;width:2000px; height:5000px;left:10px;top:5px;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>
</html>

⌨️ 快捷键说明

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