publish.jsp
6.05 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
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.io.File"%>
<%@page import="weaver.general.GCONST"%>
<%@page import="java.io.FileInputStream"%>
<%@page import="java.io.IOException"%>
<%@ include file="/mobilemode/init.jsp"%>
<%
String id = Util.null2String(request.getParameter("id"));
String ispublish = Util.null2String(request.getParameter("ispublish"));
%>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
*{
font-family: 'Microsoft YaHei', Arial;
}
.tipContainer{padding: 15px 10px 15px 10px;}
.tipContainer div:first-child{
font-size: 12px;
color: red;
padding-bottom: 10px;
line-height: 20px;
}
.tipContainer div:nth-child(2){position: relative;}
#emobileAddress{width: 100%;border: 1px solid #ccc;height: 30px;padding: 0px 0px 0px 5px;border-radius: 5px;box-sizing: border-box;outline:none;}
.btnClass{background-color: #007aff;color: #fff;height: 30px;padding: 0 18px;margin: 0;border: none;cursor: pointer;overflow: visible;outline: none;
position: absolute;
top: 0px;
right: 0px;
border-bottom-right-radius: 5px;
border-top-right-radius: 5px;
}
.btnDisable{background-color: #ccc !important;}
.e8_zDialog_bottom {
position: absolute;
left: 0px;
bottom: 0px;
padding: 0px 10px;
width: 100%;
box-sizing: border-box;
margin-bottom: 15px;
}
.e8_zDialog_bottom .e8_btn_submit {
width: 100%;
border-radius: 5px;
box-sizing: border-box;
height: 32px;
}
#msg {
margin: 10px 0px;
padding: 5px;
border-radius: 3px;
display: none;
}
#msg.error{
display: inline-block;
color: red;
}
#msg.success{
display: inline-block;
color: #16a122;
}
</style>
<script type="text/javascript">
$(function(){
var $emobileAddress = $("#emobileAddress");
$emobileAddress.bind("input", function(){
var v = $(this).val();
if(v == ""){
$("#checkStatusBtn").addClass("btnDisable");
}else{
$("#checkStatusBtn").removeClass("btnDisable");
}
});
var emobileAddressKey = localStorage.getItem("emobileAddressKey");
if(emobileAddressKey != null && emobileAddressKey != ""){
$emobileAddress.val("").focus().val(emobileAddressKey).trigger("input");
}else{
$emobileAddress.focus();
}
});
function publish(btnobj){
$("#msg")[0].className = "";
var emobileAddress = $("#emobileAddress").val();
var Expression=/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?/;
var objExp = new RegExp(Expression);
if(emobileAddress != "" && !objExp.test(emobileAddress)){
showMsg("<%=SystemEnv.getHtmlLabelName(129407,user.getLanguage())%>!","error",function(){ //地址格式不正确!
$("#emobileAddress").focus();
});
return
}
if(emobileAddress != ""){
localStorage.setItem("emobileAddressKey",emobileAddress);
}
$(btnobj).addClass("btnDisable").attr("disabled",true);
var url = jionActionUrl("com.weaver.formmodel.mobile.servlet.MobileAppBaseAction", "action=publish");
FormmodeUtil.doAjaxDataSave(url, {"id":<%=id%>,"ispublish":<%=ispublish%>,"requestURL":emobileAddress}, function(res){
top.closeTopDialog(res);
});
}
function onClose(){
top.closeTopDialog();
}
function checkUrlStatus(){
$("#msg")[0].className = "";
var $checkStatusBtn = $("#checkStatusBtn");
if($checkStatusBtn.hasClass("btnDisable")){
return;
}
var emobileAddress = $("#emobileAddress").val();
var Expression=/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
var objExp = new RegExp(Expression);
if(emobileAddress != "" && !objExp.test(emobileAddress)){
showMsg("<%=SystemEnv.getHtmlLabelName(129407,user.getLanguage())%>!","error",function(){ //地址格式不正确!
$("#emobileAddress").focus();
});
return
}
$("#checkStatusBtn").addClass("btnDisable");
var url = jionActionUrl("com.weaver.formmodel.mobile.servlet.MobileAppBaseAction", "action=checkUrlStatus");
FormmodeUtil.doAjaxDataSave(url, {"urlStr":emobileAddress}, function(res){
$(".btnClass").removeClass("btnDisable").attr("disabled",false);
if(res == "1"){
showMsg("<%=SystemEnv.getHtmlLabelName(32359,user.getLanguage())%>","success",function(){}); //测试连接通过,连接配置正确!
}else{
showMsg("<%=SystemEnv.getHtmlLabelName(32296,user.getLanguage())%>","error",function(){$("#emobileAddress").focus();}); //测试不通过,请检查设置
}
});
}
function showMsg(msg, cls, fn){
$("#msg")[0].className = "";
$("#msg").addClass(cls).html(msg);
if(typeof(fn) == "function"){
fn.call(window);
}
}
</script>
</head>
<body>
<div class="tipContainer">
<div>可以在下方的文本框中输入Emobile的服务端地址,<%if("1".equals(ispublish)){%>如果填写了该地址,我们会在发布应用的同时通知Emobile更新该发布的应用<%}else{%>如果填写了该地址,我们会在下架应用的同时通知Emobile更新删除该应用<%}%></div>
<div>
<input id="emobileAddress" name="emobileAddress" type="text" placeholder="Emobile服务端地址,如http://192.168.0.245:89" value=""/>
<button id="checkStatusBtn" type="button" class="btnClass btnDisable" onclick="checkUrlStatus()"><%=SystemEnv.getHtmlLabelName(25496,user.getLanguage())%><%=SystemEnv.getHtmlLabelName(130730,user.getLanguage())%><!-- 测试连接 --></button>
</div>
<span id="msg"></span>
</div>
<div class="e8_zDialog_bottom">
<button type="button" class="e8_btn_submit" onclick="publish(this)">
<%if("1".equals(ispublish)){%>
<%=SystemEnv.getHtmlLabelName(114,user.getLanguage())%><!-- 发布 -->
<%}else{%>
<%=SystemEnv.getHtmlLabelName(127383,user.getLanguage())%><!-- 下架 -->
<%}%>
</button>
</div>
</body>
</html>