buttonEntry.jsp
9.42 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
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@page import="com.weaver.formmodel.util.StringHelper"%>
<%@page import="java.net.URLDecoder"%>
<%@page import="net.sf.json.JSONObject"%>
<%@ include file="/mobilemode/init.jsp"%>
<%
response.setHeader("cache-control", "no-cache");
response.setHeader("pragma", "no-cache");
response.setHeader("expires", "Mon 1 Jan 1990 00:00:00 GMT");
String button_data = Util.null2String(request.getParameter("buttonEntry"));
JSONObject buttonJsonObject = new JSONObject();
if(!"".equals(button_data)){
buttonJsonObject = JSONObject.fromObject(button_data);
}
String mecStyle = Util.null2String(request.getParameter("mecStyle"));
String buttonName = "";
String className = "";
String script = "";
String style = "";
String borderColor = "";
String fontColor = "";
String bgColor = "";
if(!buttonJsonObject.isEmpty()){
buttonName = StringHelper.null2String(buttonJsonObject.get("buttonName")).trim();
className = StringHelper.null2String(buttonJsonObject.get("className"));
script = StringHelper.null2String(buttonJsonObject.get("script"));
style = StringHelper.null2String(buttonJsonObject.get("style"));
borderColor = StringHelper.null2String(buttonJsonObject.get("borderColor"));
fontColor = StringHelper.null2String(buttonJsonObject.get("fontColor"));
bgColor = StringHelper.null2String(buttonJsonObject.get("bgColor"));
}
%>
<html>
<head>
<title></title>
<link type="text/css" rel="stylesheet" href="/mobilemode/js/colorpick/css/colpick_wev8.css"/>
<script type="text/javascript" src="/mobilemode/js/colorpick/colpick_wev8.js"></script>
<style>
*{
font-family: 'Microsoft YaHei', Arial;
}
html,body{
height: 100%;
margin: 0px;
padding: 0px;
overflow: hidden;
}
.e8_tblForm{
width: 100%;
margin: 0 0;
border-collapse: collapse;
}
.e8_tblForm .e8_tblForm_label{
vertical-align: middle;
border-bottom: 1px solid #e6e6e6;
padding: 5px 5px 5px 10px;
}
.e8_tblForm_field2{position:relative;}
.e8_tblForm .e8_tblForm_field, .e8_tblForm .e8_tblForm_field2{
border-bottom: 1px solid #e6e6e6;
padding: 5px 7px;
background-color: #f8f8f8;
}
.e8_tblForm_field input{
padding-left: 2px;
width:94%;
height:23px;
box-sizing:border-box;
}
.e8_tblForm_field2 input{
margin-right:12px;
padding-left: 2px;
width:14%;
}
.e8_label_desc{
color: #aaa;
}
textarea{
width:94%;
height:100px;
}
#buttonNameTip{
color:red;
font-size: 12px;
font-family: 'Microsoft YaHei', Arial;
display: none;
}
#preview{
margin: 0px auto;
width: 60px;
}
/*引入button样式*/
.button{
font-size: 15px;
font-weight: 400;
font-family: 'Microsoft Yahei',Arial, Helvetica, sans-serif;
cursor: pointer !important;
border: 1px solid #017afd;
border-radius: 3px;
color: #017afd;
filter:alpha(opacity=100);/*ie8及以前版本*/
opacity: 1;
padding: 5px 10px 5px 10px;
}
.link_active:active{
box-shadow: 0 0 3px #017afd;
}
.colorBox{
position: absolute;
display: inline-block;
background-color: #544cba;
width: 12px;
height: 21px;
border: 1px solid white;
}
#borderColorBox{left: 123px;}
#fontColorBox{right: 142px;}
#bgColorBox{right: 11px;}
.cbboxLabel{vertical-align: middle;}
.style_language_8 #borderColorBox{left:114px;}
.style_language_8 #fontColorBox{right:174px;}
.style_language_8 #bgColorBox{right:21px;}
.style_language_8 #preview{width:109px;}
</style>
<script type="text/javascript">
$(function() {
$("#buttonName").change(function(){
checkInput("buttonName");
});
$("#borderColor").keyup(function(){
$("#preview").css("border-color", $(this).val());
$("#borderColorBox").css("background-color", $(this).val());
});
$("#fontColor").keyup(function(){
$("#preview").css("color", $(this).val());
$("#fontColorBox").css("background-color", $(this).val());
});
$("#bgColor").keyup(function(){
$("#preview").css("background-color", $(this).val());
$("#bgColorBox").css("background-color", $(this).val());
});
$("#className").blur(function(){
$("#preview").removeClass("<%=className%>");
$("#preview").addClass($(this).val());
});
$(".colorBox").colpick({
colorScheme:'dark',
layout:'rgbhex',
color:'007aff',
onSubmit:function(hsb,hex,rgb,el) {
var eleId = $(el).attr("id");
var colorValue = "#" + hex;
if(eleId == "borderColorBox"){
$("#borderColor").val(colorValue);
$("#preview").css("border-color", colorValue);
}
if(eleId == "fontColorBox"){
$("#fontColor").val(colorValue);
$("#preview").css("color", colorValue);
}
if(eleId == "bgColorBox"){
$("#bgColor").val(colorValue);
$("#preview").css("background-color", colorValue);
}
$(el).css('background-color', colorValue);
$(el).colpickHide();
}
});
});
function onClose(){
top.closeTopDialog();
}
function returnResult(flag){
if(top && top.callTopDlgHookFn){
var result = {
"buttonName" : $("#buttonName").val(),
"className" : $("#className").val(),
"script" : $("#script").val(),
"style" : getStyle(),
"borderColor": $("#borderColor").val().trim(),
"fontColor" : $("#fontColor").val().trim(),
"bgColor" : $("#bgColor").val().trim()
};
top.callTopDlgHookFn(result);
}
if(flag){
onClose();
}else{
$("input[type='text']", ".e8_tblForm").val("");
$("textarea", ".e8_tblForm").val("");
}
}
function getStyle(){
var result = "";
var borderColor = $("#borderColor").val().trim();
var fontColor = $("#fontColor").val().trim();
var bgColor = $("#bgColor").val().trim();
if(borderColor.length > 0){
result += "border-color:" + borderColor + ";";
}
if(fontColor.length > 0){
result += "color:" + fontColor + ";";
}
if(bgColor.length > 0){
result += "background-color:" + bgColor + ";";
}
return result;
}
function onOK(flag){
var buttonNameObj = document.getElementById("buttonName");
var buttonNameV = buttonNameObj.value;
if($.trim(buttonNameV) == ""){
$("#buttonNameTip").show();
buttonNameObj.focus();
return;
}
returnResult(flag);
}
function checkInput(eleId){
var v = $("#" + eleId).val();
if($.trim(v) != ""){
$("#" + eleId + "Span").html("");
$("#" + eleId + "Tip").hide();
}else{
$("#" + eleId + "Span").html("<img align='absMiddle' src='/images/BacoError_wev8.gif'/>");
}
}
</script>
</head>
<body class="style_language_<%=user.getLanguage() %>">
<div id="actionhtml" style="display:none;"></div>
<table class="e8_tblForm">
<colgroup>
<col width="20%"/>
<col width="80%"/>
</colgroup>
<tr>
<td class="e8_tblForm_label" style="vertical-align: top;"><%=SystemEnv.getHtmlLabelName(21557,user.getLanguage())%><!-- 按钮名称 --></td>
<td class="e8_tblForm_field">
<input type="text" id="buttonName" name="buttonName" value="<%=buttonName%>"/>
<span id="buttonNameSpan">
<% if("".equals(buttonName)){ %>
<img align="absMiddle" src="/images/BacoError_wev8.gif" />
<% } %>
</span>
<span id="buttonNameTip"><%=SystemEnv.getHtmlLabelName(125393,user.getLanguage())%><!-- 请填写名称 --></span>
</td>
</tr>
<tr id="buttonActionScriptTr">
<td class="e8_tblForm_label"><%=SystemEnv.getHtmlLabelName(127662,user.getLanguage())%><!-- 单击脚本 --></td>
<td class="e8_tblForm_field">
<textarea id="script" placeholder="<%=SystemEnv.getHtmlLabelName(127663,user.getLanguage())%>"><%=script %></textarea> <!-- 输入单击按钮可执行脚本 -->
</td>
</tr>
<tr id="buttonClassNameTr">
<td class="e8_tblForm_label"><%=SystemEnv.getHtmlLabelName(83734,user.getLanguage())%><!-- 样式名称 --></td>
<td class="e8_tblForm_field">
<input type="text" id="className" value="<%=className %>" placeholder="<%=SystemEnv.getHtmlLabelName(127687,user.getLanguage())%>"/><!-- 样式名称:如saveBtn, 多个样式用空格隔开 -->
</td>
</tr>
<tr id="buttonStyleTr">
<td class="e8_tblForm_label"><%=SystemEnv.getHtmlLabelName(128221,user.getLanguage())%><!-- 自定义样式 --></td>
<td class="e8_tblForm_field2">
<span><%=SystemEnv.getHtmlLabelName(128222,user.getLanguage())%><!-- 边框颜色: --></span>
<input type="text" id="borderColor" value="<%=borderColor %>" maxlength="16"/><div id="borderColorBox" class="colorBox" style="background-color:<%=borderColor%>;"></div>
<span><%=SystemEnv.getHtmlLabelName(128223,user.getLanguage())%><!-- 字体颜色: --></span>
<input type="text" id="fontColor" value="<%=fontColor%>" maxlength="16"/><div id="fontColorBox" class="colorBox" style="background-color:<%=fontColor%>;"></div>
<span><%=SystemEnv.getHtmlLabelName(128224,user.getLanguage())%><!-- 背景颜色: --></span>
<input type="text" id="bgColor" value="<%=bgColor%>" maxlength="16"/><div id="bgColorBox" class="colorBox" style="background-color:<%=bgColor%>;"></div>
</td>
</tr>
<tr>
<td class="e8_tblForm_label"><%=SystemEnv.getHtmlLabelName(81814,user.getLanguage())%><!-- 预览效果 --></td>
<td class="e8_tblForm_field">
<style><%=mecStyle%></style>
<div id="preview" class="button fixedButton link_active <%=className %>" style="<%=style%>"><%=SystemEnv.getHtmlLabelName(127671,user.getLanguage())%><!-- 预览按钮 --></div>
</td>
</tr>
</table>
<div class="e8_zDialog_bottom">
<button type="button" class="e8_btn_submit" onclick="onOK(true)"><%=SystemEnv.getHtmlLabelName(82036,user.getLanguage())%><!-- 保存并关闭 --></button>
<button type="button" class="e8_btn_cancle" onclick="onClose()"><%=SystemEnv.getHtmlLabelName(32694,user.getLanguage())%><!-- 取消 --></button>
<button type="button" class="e8_btn_submit" onclick="onOK(false)"><%=SystemEnv.getHtmlLabelName(32720,user.getLanguage())%><!-- 保存并新建 --></button>
</div>
</body>
</html>