📄 print.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" %>
<%@ page import="cn.myapps.constans.Environment"%>
<!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 = request.getParameter("_flowid");
String historyHtml = "";
if (flowid != null && flowid.trim().length() > 0) { // 流程历史记录
Environment evt = (Environment)application
.getAttribute(Environment.class.getName());
StateMachineHelper helper = new StateMachineHelper(docid, flowid, evt);
historyHtml = helper.toHistoryHtml(flowid, docid, 4);
}
%>
<html>
<head>
<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():"" %>" />
<style type="text/css" media="print">
#oLayer {
display: none;
}
</style>
<script>
var contextPath = '<%= request.getContextPath() %>';
function ev_print() {
window.print();
}
</script>
</head>
<style>
<!--
.div{
position: absolute;
border: 2px solid red;
background-color: #EFEFEF;
line-height:90px;
font-size:12px;
z-index:1000;
}
-->
</style>
<body>
<div id="doc_divid">
<ww:form action="save" method="post" theme="simple" >
<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")%>" />
<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>
</div>
<table width="100%" border="1" cellspacing="0" cellpadding="0" id="oLayer" >
<tr valign='top'>
<td>
<table width="100%" border=0 cellpadding="0" cellspacing="5">
<tr>
<td class="line-position" width="100%"> </td>
<!-- ********************** 打印按钮 **********************-->
<td align="right">
<input id="button_act" type="button" class="button-document"
alt="print" value="print" onclick="ev_print()" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<div id="myDiv">
<!-- *********************** WorkFlow History ***************************** -->
<ww:if test="#parameters._flowid[0] != null && #parameters._flowid[0] != ''">
<FIELDSET >
<LEGEND><font size="2" color="gray">{*[Workflow history]*}</font></LEGEND>
<%=historyHtml%>
</FIELDSET>
</ww:if>
<table width="100%" border="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.toPrintHtmlTxt(doc, params, user, errors);
out.print(html);
}
%></td>
</tr>
</table>
</div>
</ww:form>
</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 + -