showModule.jsp
15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ include file="/formmode/checkright4setting.jsp" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ page import="weaver.general.Util"%>
<%@ page import="weaver.conn.RecordSet"%>
<%@ page import="weaver.formmode.exceldesign.HtmlLayoutOperate"%>
<%@ page import="weaver.formmode.service.CommonConstant" %>
<%
HtmlLayoutOperate htmlLayoutOperate = new HtmlLayoutOperate();
RecordSet rs = new RecordSet();
int modeid = Util.getIntValue(request.getParameter("modeid"));
int formid = Util.getIntValue(request.getParameter("formid"), 0);
int layouttype = Util.getIntValue(request.getParameter("layouttype"), 0);
int isdefault = Util.getIntValue(request.getParameter("isdefault"), 0);
String layoutname = Util.null2String(request.getParameter("searchVal"));
int isecme = Util.getIntValue(request.getParameter("isecme"), 0);
int feaid = Util.getIntValue(request.getParameter("feaid"), 0);
int categoryid = Util.getIntValue(request.getParameter("categoryid"), -1);
String sql = "select id from modehtmllayout where modeid = "+modeid+" and type = "+layouttype+" and version = 2";
if(isecme == 1){
rs.executeSql("select * from ecme_feainfo where id = "+feaid);
if(rs.next()){
modeid = Util.getIntValue(rs.getString("cubeid"));
}
sql = "select layoutid as id from ecme_layoutlink where feaid = "+feaid+" and layoutType = "+layouttype+" and categoryid = "+categoryid;
}
rs.executeSql(sql);
int mhlnum = rs.getCounts();
String backfields=" id,layoutname,type,isdefault";
String nullStr = CommonConstant.DB_ISNULL_FUN;
String sqlform=" (select id,layoutname,type,modeid,version ,"+nullStr+"(isdefault,0) isdefault from modehtmllayout) mhl";
String sqlwhere=" modeid="+modeid+" and type="+layouttype + " and version = 2";
if(!layoutname.equals("")) sqlwhere += " and lower(layoutname) like '%"+layoutname.toLowerCase()+"%'";
String sqlorder=" isdefault desc,id desc ";
if(isecme ==1 ){
backfields=" el.layoutid as id,mhl.layoutname,el.layoutType as type,el.isdefault ";
nullStr = CommonConstant.DB_ISNULL_FUN;
sqlform=" ecme_layoutlink el LEFT JOIN (select id as layoutid,layoutname,type,modeid,version ,"+nullStr+"(isdefault,0) isdefault from modehtmllayout) mhl on el.layoutid = mhl.layoutid " ;
sqlwhere=" el.feaid = "+feaid+" and el.categoryid = "+categoryid+" and el.layoutType = "+layouttype ;
if(!layoutname.equals("")) sqlwhere += " and lower(layoutname) like '%"+layoutname.toLowerCase()+"%'";
sqlorder=" el.isdefault desc,id desc ";
}
String tableString=""+
"<table instanceid=\"module\" tabletype=\"none\" pagesize=\""+PageIdConst.getPageSize(PageIdConst.WF_WORKFLOW_SHOWMODULE,user.getUID())+"\" >"+
"<sql backfields=\""+backfields+"\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlwhere)+"\" sqlform=\""+Util.toHtmlForSplitPage(sqlform)+"\" sqlorderby=\""+sqlorder+"\" sqlprimarykey=\"id\" sqlsortway=\"desc\" sqlisdistinct=\"false\" />"+
"<head>"
+ "<col width=\"130px\" text=\""+SystemEnv.getHtmlLabelName(128078,user.getLanguage())+"\" column=\"type\" "
+ " transmethod=\"weaver.formmode.exceldesign.HtmlLayoutOperate.transLayoutImgInfo\" otherpara=\"column:layoutname\" />"
+ "<col width=\"*\" text=\""+SystemEnv.getHtmlLabelName(19853,user.getLanguage())+"\" column=\"id\" "
+ " transmethod=\"weaver.formmode.exceldesign.HtmlLayoutOperate.transLayoutInfo\" otherpara=\""+layouttype+"+"+user.getLanguage()+"\" />"
+ "<col width=\"510px\" text=\""+SystemEnv.getHtmlLabelName(30585,user.getLanguage())+"\" column=\"id\" "
+ " transmethod=\"weaver.formmode.exceldesign.HtmlLayoutOperate.transOperBtn\" />"+
"</head>"+
"</table>";
%>
<html>
<head>
<link type="text/css" rel="stylesheet" href="/formmode/exceldesign/css/showModule_wev8.css?<%=System.currentTimeMillis() %>" />
<script type="text/javascript">
var sourceLayouttype = <%=layouttype%>;
$(document).unbind("contextmenu").bind("contextmenu", function (e) {
return false;
});
$(document).ready(function(){
<%
if(mhlnum==0){
%>
controlOperArea()
<%
}
%>
})
function afterDoWhenLoaded(){ //分页控件加载完成回调方法
$("table.ListStyle").find(".HeaderForXtalbe").remove();
$("table.ListStyle").find("td").attr("title", "");
var winheight = $(window).height();
$(".layoutContent").css("height",(winheight-25-14)+"px");
//编辑节点展开历史模板
var editing_layoutid = window.parent.wfinfo.layoutid;
jQuery("[name='layoutid'][value='"+editing_layoutid+"']").closest("tr").find("div.nodeimg").trigger("click");
controlOperArea();
}
//展开对应节点历史模板
function extendHistoryLayout(vthis){
var tablelist = jQuery(vthis).closest("table");
var spacingObj = tablelist.find("tr.Spacing").first();
var curTrObj = jQuery(vthis).closest("tr");
var nodeid = curTrObj.find("[name='nodeid']").val();
var extendRow = tablelist.find("tr[extendRow='y'][extendNodeid='"+nodeid+"']");
if(extendRow.size() > 0){
extendRow.remove();
return;
}
setEditingMark();
controlOperArea();
}
//编辑中模板加标示
function setEditingMark(){
if(jQuery(".layoutediting").size() > 0)
return;
var editing_layoutid = window.parent.wfinfo.layoutid;
var layoutinput = jQuery("[name='layoutid'][value='"+editing_layoutid+"']");
var editing='<div class="layoutediting"><img src="/formmode/exceldesign/image/shortBtn/module/editing_wev8.png"/><span><%=SystemEnv.getHtmlLabelName(128079,user.getLanguage())%></span></div>';
layoutinput.closest("td").find("div.layoutname").append(editing);
layoutinput.closest("tr").find("div.oper_delete").attr("onclick", "")
.find("div").removeClass("operbtn_delete").addClass("operbtn_deletedisabled");
}
//控制按钮区
function controlOperArea(){
jQuery("div.operarea[hasBind!='y']").each(function(){
var vthis = jQuery(this);
var version = parseInt(vthis.closest("tr").find("[name='version']").val());
var layoutid = parseInt(vthis.closest("tr").find("[name='layoutid']").val());
var isdefault = parseInt(vthis.closest("tr").find("[name='isdefault']").val());
var isused = parseInt(vthis.closest("tr").find("[name='isused']").val());
if(version != 2){
vthis.find("div.oper_edit").attr("onclick", "")
.find("div").removeClass("operbtn_edit").addClass("operbtn_editdisabled");
vthis.find("div.oper_sync").attr("onclick", "")
.find("div").removeClass("operbtn_sync").addClass("operbtn_syncdisabled");
}
if(sourceLayouttype == 3 || sourceLayouttype ==4){
vthis.find("div.oper_sync").attr("onclick", "")
.find("div").removeClass("operbtn_sync").addClass("operbtn_syncdisabled");
}
if(layoutid <= 0 || isdefault == 1 ){
vthis.find("div.oper_delete").attr("onclick", "")
.find("div").removeClass("operbtn_delete").addClass("operbtn_deletedisabled");
vthis.find("div.operbtn_setactive").attr("onclick", "").removeClass("operbtn_setactive");
}
//如果布局被引用,则删除按钮置灰
if(isused == 1 ){
vthis.find("div.oper_delete").attr("onclick", "")
.find("div").removeClass("operbtn_delete").addClass("operbtn_deletedisabled");
}
vthis.closest("tr").mouseover(function(){
vthis.show();
}).mouseout(function(){
vthis.hide();
});
vthis.attr("hasBind", "y");
});
}
//新建
function createBtnClick(vthis){
switchEditLayout("0");
}
//编辑模板
function editBtnClick(vthis){
var layoutid = parseInt(jQuery(vthis).closest("tr").find("[name='layoutid']").val());
var version = parseInt(jQuery(vthis).closest("tr").find("[name='version']").val());
if(layoutid<=0 || version!=2)
return;
var editing_layoutid = window.parent.wfinfo.layoutid;
if(layoutid == editing_layoutid){
//只是切换tab页
parent.changeTab4SameModeid();
}else{
switchEditLayout(layoutid);
}
}
//模板切换
function switchEditLayout(layoutid){
if(parent.judgeDesignHasModify()){
window.top.Dialog.confirm("<%=SystemEnv.getHtmlLabelName(128080,user.getLanguage())%>",function(){
//重新加载
parent.reloadExcelMain("<%=layouttype%>", layoutid);
});
}else{
parent.reloadExcelMain("<%=layouttype%>", layoutid);
}
}
//选择
function chooseBtnClick(vthis){
var layoutid = jQuery(vthis).closest("tr").find("input[name='layoutid']").val();
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
var url = "/formmode/exceldesign/chooseHtmlTemplateTab.jsp?modeid=<%=modeid %>&formid=<%=formid %>&choosetype=<%=layouttype %>&curlayoutid="+layoutid+"&fromwhere=showModule";
dialog.Title = "<%=SystemEnv.getHtmlLabelName(18214,user.getLanguage()) %>";
dialog.Width = 750;
dialog.Height = 650;
dialog.maxiumnable = false;
dialog.URL = url;
dialog.callback = function(datas){
if(datas.id){
jQuery.ajax({
type: "post",
url: "/formmode/exceldesign/excelAjaxData.jsp",
data: {src:"saveChooseLayout", modeid:"<%=modeid %>", formid:"<%=formid %>", layoutid:layoutid, layouttype:"<%=layouttype %>", choose_layoutid:datas.id, operuser:"<%=user.getUID() %>", languageid:"<%=user.getLanguage() %>"},
dataType: "JSON",
success: function(result){
if(result.trim() == "success"){
dialog.close();
switchEditLayout(layoutid);
}
}
});
}
}
dialog.show();
}
//删除
function deleteBtnClick(vthis){
window.top.Dialog.confirm("<%=SystemEnv.getHtmlLabelName(128081,user.getLanguage())%>",function(){
var layoutid = jQuery(vthis).closest("tr").find("[name='layoutid']").val();
jQuery.ajax({
type: "post",
url: "/formmode/exceldesign/excelAjaxData.jsp",
data: {src:"deleteLayout", layoutid:layoutid,isecme:"<%=isecme %>" },
dataType: "JSON",
success: function(result){
if(result.trim() == "success");
window.location.reload();
}
});
});
}
//Excel导入
function excelimpBtnClick(vthis){
var layoutid = jQuery(vthis).closest("tr").find("input[name='layoutid']").val();
var url = "/formmode/exceldesign/importExcelTemplate.jsp?modeid=<%=modeid%>&formid=<%=formid%>&layouttype=<%=layouttype%>&layoutid="+layoutid+"&isdefault=<%=isdefault%>";
var dlg=new window.top.Dialog();
dlg.currentWindow=window;
dlg.Model=true;
dlg.Width=550;
dlg.Height=400;
dlg.URL=url;
dlg.Title="<%=SystemEnv.getHtmlLabelName(128060,user.getLanguage())%>";
dlg.show();
}
//初始化模板
function initBtnClick(vthis){
var layoutid=jQuery(vthis).closest("tr").find("[name='layoutid']").val();
var dialog = new window.top.Dialog();
dialog.currentWindow = window;
var url = "/formmode/exceldesign/excelInitModule.jsp?modeid=<%=modeid%>&formid=<%=formid%>&layouttype=<%=layouttype%>&layoutid="+layoutid+"&isdefault=<%=isdefault%>"+"&feaid=<%=feaid%>"+"&categoryid=<%=categoryid%>"+"&isecme=<%=isecme%>";
dialog.Title = "<%=SystemEnv.getHtmlLabelName(129435,user.getLanguage())%>";
dialog.Width = 810;
dialog.Height = 570;
dialog.maxiumnable=true;
dialog.hideDraghandle = true;
dialog.URL = url;
dialog.show();
}
//同步布局
function syncBtnClick(vthis){
var version=jQuery(vthis).closest("tr").find("[name='version']").val();
if(version != "2"){
window.top.Dialog.alert("<%=SystemEnv.getHtmlLabelName(128082,user.getLanguage())%>");
return;
}
var layoutid=jQuery(vthis).closest("tr").find("[name='layoutid']").val();
var dlg=new window.top.Dialog();
dlg.currentWindow=window;
dlg.Model=true;
dlg.Width=450;
dlg.Height=550;
dlg.URL="/formmode/exceldesign/syncLayoutsBrowser.jsp?modeid=<%=modeid%>&layouttype=<%=layouttype%>&from_layoutid="+layoutid+"&isdefault=<%=isdefault%>"+"&feaid=<%=feaid%>"+"&categoryid=<%=categoryid%>"+"&isecme=<%=isecme%>";
dlg.Title="<%=SystemEnv.getHtmlLabelName(128083,user.getLanguage())%>";
dlg.show();
}
//设为活动模板
function setLayoutToActive(vthis){
var layoutid = jQuery(vthis).closest("tr").find("[name='layoutid']").val();
jQuery.ajax({
type: "post",
url: "/formmode/exceldesign/excelAjaxData.jsp",
data: {src:"setLayoutToActive", modeid:"<%=modeid %>", layouttype:"<%=layouttype %>", layoutid:layoutid, isecme:"<%=isecme %>" , feaid:"<%=feaid %>", categoryid:"<%=categoryid %>"},
dataType: "JSON",
success: function(result){
if(result.trim() == "success"){
window.top.Dialog.confirm("<%=SystemEnv.getHtmlLabelName(128084,user.getLanguage())%>",function(){
//重新加载
parent.reloadExcelMain("<%=layouttype%>", layoutid);
},function(){
window.location.reload();
});
}
}
});
}
//初始化模板 dialog[excelInitModule.jsp] 中的回调方法
function setInitModule(styleid, layoutid){
var isInit = 1; //如果 isInit = 1,那么 模板将被覆盖
parent.reloadExcelMain("<%=layouttype%>", layoutid);
}
function searchTable(){
weaverform.submit();
}
</script>
</head>
<body>
<form id="weaverform" name="weaverform" style="height:100%;" method="post" action="/formmode/exceldesign/showModule.jsp">
<input type="hidden" name="modeid" value="<%=modeid %>" />
<input type="hidden" name="formid" value="<%=formid %>" />
<input type="hidden" name="layouttype" value="<%=layouttype %>" />
<input type="hidden" name="isecme" value="<%=isecme %>" />
<input type="hidden" name="feaid" value="<%=feaid %>" />
<input type="hidden" name="categoryid" value="<%=categoryid %>" />
<div class="topsearch"><%=SystemEnv.getHtmlLabelName(23731,user.getLanguage())%>:
<span class="searchInputSpan" style="background: #fff; margin-top: 2px;">
<input type="text" class="searchInput" name="searchVal" value="<%=layoutname %>"
onkeypress="if(event.keyCode==13) {searchTable();}" />
</input>
<span>
<img src="/images/ecology8/request/search-input_wev8.png" onclick="searchTable()"></img>
</span>
</span>
</div>
<div class="layoutContent">
<%
if(mhlnum==0){
%>
<table style="table-layout: fixed;" class="ListStyle" cellspacing="0">
<colgroup>
<col style="width: 130px;" width="1%" _itemid="1" _systemid="80269" />
<col />
<col style="width: 510px;" width="1%" _itemid="3" _systemid="80271" />
</colgroup>
<tr style="vertical-align: middle;">
<td style="height: 30px; vertical-align: middle; word-break: break-all; word-wrap: break-word;"
title="" align="left">
<%=htmlLayoutOperate.transLayoutImgInfo(layouttype+"","")%>
</td>
<td
style="height: 30px; vertical-align: middle; word-break: break-all; word-wrap: break-word;"
title="" align="left">
<%=htmlLayoutOperate.transLayoutInfo(0+"",layouttype+"+"+user.getLanguage())%>
</td>
<td
style="height: 30px; vertical-align: middle; word-break: break-all; word-wrap: break-word;"
title="" align="left">
<%=htmlLayoutOperate.transOperBtn(0+"")%>
</td>
</tr>
<tr style="height: 1px !important;" class="Spacing">
<td class="paddingLeft0Table" title="" colspan="3">
<div class="intervalDivClass"></div>
</td>
</tr>
</tbody>
</table>
<%
}else{
%>
<wea:SplitPageTag isShowTopInfo="false" tableString="<%=tableString%>" mode="run" />
<%
}
%>
</div>
</form>
</body>
</html>