tabStyleChoose.jsp
9.86 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
<!DOCTYPE html>
<%@ 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"%>
<%
String tabstyle = Util.null2String(request.getParameter("tabstyle"), "-1");
%>
<html>
<head>
<link type="text/css" rel="stylesheet" href="/formmode/exceldesign/css/contextmenu_wev8.css"/>
<script type="text/javascript" src="/formmode/exceldesign/js/excelRightClick_wev8.js"></script>
<script type="text/javascript" src="/formmode/exceldesign/js/tabpage_wev8.js"></script>
<link type="text/css" rel="stylesheet" href="/formmode/exceldesign/css/tabPage_wev8.css"/>
<script>
$(document).unbind("contextmenu").bind("contextmenu", function (e) {
return false;
});
var dialog;
jQuery(document).ready(function(){
jQuery("#topTitle").topMenuTitle({searchFn:searchStyle});
dialog = window.top.getDialog(window);
var tab_style_temp = $(".show #styletemplate");
//加载系统样式
var sysStyle = tabPage.sysStyleFace();
var sysDefault = tabPage.sysDefaultFace();
for(var key in sysStyle){
var stylejson = {};
jQuery.extend(true, stylejson, sysDefault, sysStyle[key]);
var styleDiv = tab_style_temp.clone();
styleDiv.removeAttr("id").attr("target", stylejson.styleid).css("display", "");
$(".show").append(styleDiv);
styleDiv.find("span[name='stylename']").text(stylejson.stylename);
var divStyle = tabPage.getDivStyle_ByStyleFace(stylejson);
tabPage.applyDivStyleFace(styleDiv, divStyle);
}
//加载自定义样式
jQuery.ajax({
type: "post",
url: "/formmode/exceldesign/tabStyleOperation.jsp",
data: {method:"selectall"},
dataType: "JSON",
success: function(msg){
//生成自定义标签页样式
var resjson = JSON.parse(msg);
for(var key in resjson){
var stylejson = resjson[key];
var styleDiv = tab_style_temp.clone();
styleDiv.removeAttr("id").attr("target", stylejson.styleid).css("display", "");
$(".show").append(styleDiv);
styleDiv.find("span[name='stylename']").text(stylejson.stylename);
var divStyle = tabPage.getDivStyle_ByStyleFace(stylejson);
tabPage.applyDivStyleFace(styleDiv, divStyle);
}
var styleObj = jQuery(".show").children("div[id!=styletemplate]");
bindStyleDivEvent(styleObj);
//默认选中
var tabstyle = "<%=tabstyle %>";
jQuery(".show").children("div[target='"+tabstyle+"']")
.find("[name='stylecheck']").attr("checked", true).next().addClass("jNiceChecked");
}
});
});
function bindStyleDivEvent(styleObj){
//checkbox美化、绑定单击事件
styleObj.each(function(){
bindClickEvent(jQuery(this));
});
styleObj.find("[name='stylecheck']").removeAttr("notBeauty");
jQuery("body").jNice();
}
function bindClickEvent(stylediv){
stylediv.find("input[name='stylecheck'],div.style_outside").click(function(){
var style_outside = stylediv.find(".style_outside");
if(style_outside.is(".selected"))
return;
$(".show").find(".style_outside").removeClass("selected");
$(".show").find("input[type=checkbox]").attr("checked",false).next().removeClass("jNiceChecked");
style_outside.addClass("selected");
stylediv.find("input[type=checkbox]").attr("checked", true).next().addClass("jNiceChecked");
});
var styleid = stylediv.attr("target");
if(parseInt(styleid) <= 0) //系统样式不能修改
return;
stylediv.find("div.style_outside").contextMenu({
menu : 'tabStyleMenu',
button: 3,
onPopup : function(el,e) {
try{
e.stopPropagation();
e.preventDefault();
}catch(er){
window.event.cancelBubble = true;
return false;
}
$("#tabStyleMenu").html("");
var menuJson = "{";
menuJson += "\"children\": [{";
menuJson += "\"title\" : \"<%=SystemEnv.getHtmlLabelName(26473,user.getLanguage())%>\",";
menuJson += "\"icon\": \"rmenuedit2\",";
menuJson += "\"action\": \"editstyle\"";
menuJson += "},{";
menuJson += "\"title\" : \"<%=SystemEnv.getHtmlLabelName(91,user.getLanguage())%>\",";
menuJson += "\"icon\": \"rmenudel\",";
menuJson += "\"action\": \"delstyle\"";
menuJson += "}";
menuJson += "]}";
menuJson = JSON.parse(menuJson);
$('#tabStyleMenu').mac('menu', menuJson);
},
offset: { x: 0, y: 0 }
}, function(action, el, pos) {
if(action === "editstyle"){ //编辑
openStyleDesign("<%=SystemEnv.getHtmlLabelName(128087,user.getLanguage())%>", "edit", styleid);
}else if(action === "delstyle"){ //删除
window.top.Dialog.confirm("<%=SystemEnv.getHtmlLabelName(389676,user.getLanguage())%><br><%=SystemEnv.getHtmlLabelName(389677,user.getLanguage())%>",function(){
$.ajax({
type : "post",
url : "/formmode/exceldesign/tabStyleOperation.jsp",
data : {method:"deleteone", styleid:styleid},
dataType:"JSON",
success : function(msg){
var result = JSON.parse(msg);
if(result.state == "true"){
el.closest(".stylediv").remove();
}
}
});
});
}
});
}
function openStyleDesign(title, opertype, styleid){
var dlg = new window.top.Dialog();
dlg.currentWindow = window;
var url = "/formmode/exceldesign/tabStyleDesign.jsp?opertype="+opertype;
if(opertype === "edit")
url += "&styleid="+styleid;
dlg.Title = title;
dlg.Width = 900;
dlg.Height = 720;
dlg.Drag = true;
dlg.URL = url;
dlg.callbackfun = function(paramobj, datas){
var stylejson = JSON.parse(datas);
var styleDiv;
if(opertype === "add"){
var styleDiv = $(".show #styletemplate").clone();
styleDiv.removeAttr("id").attr("target", stylejson.styleid).css("display", "");
$(".show").append(styleDiv);
bindStyleDivEvent(styleDiv);
}else if(opertype === "edit"){
styleDiv = $(".show").children("div[target='"+stylejson.styleid+"']");
}
styleDiv.find("span[name='stylename']").text(stylejson.stylename);
var divStyle = tabPage.getDivStyle_ByStyleFace(stylejson);
tabPage.applyDivStyleFace(styleDiv, divStyle);
}
dlg.show();
}
function confirmStyle(){
var selectedStyle = jQuery(".show").find("[name='stylecheck']:checked");
if(selectedStyle.size() == 0){
window.top.Dialog.alert("<%=SystemEnv.getHtmlLabelName(128089,user.getLanguage())%>");
}else{
var styledivObj = selectedStyle.closest(".stylediv");
var divstyle = {};
divstyle.t_area = "";
divstyle.t_sep = "";
divstyle.t_sel_left = "";
divstyle.t_sel_middle = "";
divstyle.t_sel_right = "";
divstyle.t_unsel_left = "";
divstyle.t_unsel_middle = "";
divstyle.t_unsel_right = "";
for(var key in divstyle){
divstyle[key] = styledivObj.find("div."+key).attr("style");
}
var retjson = {"styleid" : styledivObj.attr("target"), "divstyle" : divstyle};
dialog.close(retjson);
}
}
function searchStyle(){
var searchval=$("input[name='searchval']").val();
var styleObj = jQuery(".show").children("[target]");
if(searchval === ""){
styleObj.css("display", "");
}else{
styleObj.each(function(){
if($(this).attr("target") < 0)
return true;
var stylename = $(this).find("span[name='stylename']").text();
if(stylename.indexOf(searchval) > -1){
$(this).css("display", "");
}else{
$(this).css("display", "none");
}
});
}
}
</script>
<style>
body{
height:100%; width:100%; overflow:hidden;
margin:0px; padding:0px; font-size:12px;
}
.show .stylediv{
height:80px; float:left; text-align:center;
margin-left:40px; margin-top:30px; width:290px;
}
.show .style_outside{
border: 1px solid white; padding:4px; cursor:pointer;
}
.show .selected{
border-color:#38b2ec;
}
</style>
</head>
<body>
<jsp:include page="/systeminfo/commonTabHead.jsp">
<jsp:param name="mouldID" value="workflow"/>
<jsp:param name="navName" value="<%=SystemEnv.getHtmlLabelName(128090,user.getLanguage())%>"/>
</jsp:include>
<table id="topTitle" cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td class="rightSearchSpan" style="text-align:right; width:500px!important">
<input type="text" class="searchInput" name="searchval" />
<span id="advancedSearch" class="advancedSearch" style="display:none"><%=SystemEnv.getHtmlLabelName(347,user.getLanguage())%></span>
<input type="button" value="<%=SystemEnv.getHtmlLabelName(129031,user.getLanguage())%>" onclick="openStyleDesign('<%=SystemEnv.getHtmlLabelName(129032,user.getLanguage())%>', 'add');" class="e8_btn_top" style="margin-right:5px">
</td>
</tr>
</table>
<ul id="tabStyleMenu" class="contextMenu"></ul>
<div class="show" style="overflow-y:auto; height:496px;">
<div id="styletemplate" class="stylediv" style="display:none">
<input type="checkbox" notBeauty=true name="stylecheck"/>
<span name="stylename"></span>
<div class="style_outside">
<div class="t_area xrepeat">
<div class="t_sel">
<div class="t_sel_left norepeat"></div>
<div class="t_sel_middle xrepeat lineheight30"><%=SystemEnv.getHtmlLabelName(128091,user.getLanguage())%>1</div>
<div class="t_sel_right norepeat"></div>
</div>
<div class="t_sep norepeat"></div>
<div class="t_unsel">
<div class="t_unsel_left norepeat"></div>
<div class="t_unsel_middle xrepeat lineheight30"><%=SystemEnv.getHtmlLabelName(128091,user.getLanguage())%>2</div>
<div class="t_unsel_right norepeat"></div>
</div>
<div class="t_sep norepeat"></div>
<div class="t_unsel">
<div class="t_unsel_left norepeat"></div>
<div class="t_unsel_middle xrepeat lineheight30"><%=SystemEnv.getHtmlLabelName(128091,user.getLanguage())%>3</div>
<div class="t_unsel_right norepeat"></div>
</div>
</div>
</div>
</div>
</div>
<div id="zDialog_div_bottom" class="zDialog_div_bottom">
<wea:layout needImportDefaultJsAndCss="false">
<wea:group context="" attributes="{groupDisplay:none}">
<wea:item type="toolbar">
<input type="button" value="<%=SystemEnv.getHtmlLabelName(826,user.getLanguage())%>" class="zd_btn_cancle" onclick="confirmStyle()">
<input type="button" value="<%=SystemEnv.getHtmlLabelName(201,user.getLanguage())%>" class="zd_btn_cancle" onclick="dialog.close()">
</wea:item>
</wea:group>
</wea:layout>
</div>
</body>
</html>