rewrite submitBehaviors function and fix the interface

This commit is contained in:
zhengyingying 2014-03-27 11:41:20 +08:00
parent 6400a18ec4
commit 5cbb9f7f2d
6 changed files with 315 additions and 314 deletions

View File

@ -119,7 +119,7 @@ plugin_jsp_plugins=Plug-ins
plugin_jsp_behavior=Behavior plugin_jsp_behavior=Behavior
plugin_jsp_addScriptName=Please add ScriptName plugin_jsp_addScriptName=Please add ScriptName
plugin_jsp_scriptName=Script Name: plugin_jsp_scriptName=Script Name:
script_jsp_makeScript=MakeScript script_jsp_makeScript=ScriptEdit
script_jsp_recordScript=RecordScript script_jsp_recordScript=RecordScript
script_jsp_refresh=RefreshPage script_jsp_refresh=RefreshPage
test_jsp_makeNewScript=NewScript test_jsp_makeNewScript=NewScript
@ -143,4 +143,7 @@ login_jsp_passwordWarnning=The password cannot be empty!
login_jsp_admin=Admin login_jsp_admin=Admin
script_edit_jsp_save=Save script_edit_jsp_save=Save
script_edit_jsp_cancel=Cancel script_edit_jsp_cancel=Cancel
script_edit_jsp_validate=Validate script_edit_jsp_validate=Validate
register_jsp_username=Username
register_jsp_password=Password
register_jsp_retype=Retype Password

View File

@ -120,7 +120,7 @@ plugin_jsp_plugins=\u63D2\u4EF6
plugin_jsp_behavior=\u52A8\u4F5C plugin_jsp_behavior=\u52A8\u4F5C
plugin_jsp_addScriptName=\u8BF7\u8F93\u5165\u811A\u672C\u540D plugin_jsp_addScriptName=\u8BF7\u8F93\u5165\u811A\u672C\u540D
plugin_jsp_scriptName=\u811A\u672C\u540D\uFF1A plugin_jsp_scriptName=\u811A\u672C\u540D\uFF1A
script_jsp_makeScript=\u81EA\u5236\u811A\u672C script_jsp_makeScript=\u811A\u672C\u7F16\u8F91
script_jsp_recordScript=\u5F55\u5236\u811A\u672C script_jsp_recordScript=\u5F55\u5236\u811A\u672C
script_jsp_refresh=\u5237\u65B0\u9875\u9762 script_jsp_refresh=\u5237\u65B0\u9875\u9762
test_jsp_makeNewScript=\u65B0\u5EFA\u811A\u672C test_jsp_makeNewScript=\u65B0\u5EFA\u811A\u672C
@ -134,7 +134,7 @@ index_jsp_registerAndSign=\u6CE8\u518C\u5E76\u8BA4\u8BC1
index_jsp_weAreFree=\u6211\u4EEC\u662F\u514D\u8D39\u7684\u54DF\uFF01 index_jsp_weAreFree=\u6211\u4EEC\u662F\u514D\u8D39\u7684\u54DF\uFF01
login_jsp_home=\u4E3B\u9875 login_jsp_home=\u4E3B\u9875
login_jsp_register=\u6CE8\u518C login_jsp_register=\u6CE8\u518C
login_jsp_Title=Bench4Q\u662FQOS\u57FA\u51C6\u6D4B\u8BD5\u7684\u65B0\u65B9\u6CD5 login_jsp_Title=Bench4Q\u2014\u2014QOS\u57FA\u51C6\u6D4B\u8BD5\u7684\u65B0\u65B9\u6CD5
login_jsp_welcome=\u6B22\u8FCE\u4F7F\u7528Bench4Q\uFF01 login_jsp_welcome=\u6B22\u8FCE\u4F7F\u7528Bench4Q\uFF01
login_jsp_signIn=\u767B\u5F55 login_jsp_signIn=\u767B\u5F55
login_jsp_username=\u7528\u6237\u540D login_jsp_username=\u7528\u6237\u540D
@ -144,4 +144,7 @@ login_jsp_passwordWarnning=\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A\uFF01
login_jsp_admin=\u7BA1\u7406\u5458 login_jsp_admin=\u7BA1\u7406\u5458
script_edit_jsp_save=\u4FDD\u5B58 script_edit_jsp_save=\u4FDD\u5B58
script_edit_jsp_cancel=\u53D6\u6D88 script_edit_jsp_cancel=\u53D6\u6D88
script_edit_jsp_validate=\u786E\u8BA4 script_edit_jsp_validate=\u786E\u8BA4
register_jsp_username=\u7528\u6237\u540D
register_jsp_password=\u5BC6 \u7801
register_jsp_retype=\u91CD \u8F93

View File

@ -203,9 +203,7 @@ body {
onClick="pluginCancel();" id="pluginCancel"> onClick="pluginCancel();" id="pluginCancel">
<fmt:message key="plugin_jsp_cancel" /> <fmt:message key="plugin_jsp_cancel" />
</button> </button>
</div> </div>
</div> </div>
<div class="modal hide fade " id="myModal_Behavior"> <div class="modal hide fade " id="myModal_Behavior">
@ -239,30 +237,6 @@ body {
</button> </button>
</div> </div>
</div>
<div class="modal hide fade " id="myModal_ScriptName">
<div class="modal-header">
<button type="button" id="myModal-close" class="close"
data-dismiss="modal">×</button>
<h3>
<fmt:message key="plugin_jsp_addScriptName" />
</h3>
</div>
<div class="modal-body" style="height: 130px;">
<p>
<fmt:message key="plugin_jsp_scriptName"></fmt:message>
<input id="writeAScriptName" type="text" name="scriptName" size=20></input>
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary btn-width"
onClick="addScriptName()">
<fmt:message key="plugin_jsp_submit" />
</button>
</div>
</div> </div>
<jsp:include page="publiccontrol/footer.jsp"></jsp:include> <jsp:include page="publiccontrol/footer.jsp"></jsp:include>
</div> </div>

View File

@ -1,264 +1,292 @@
<%@page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%> <%@page language="java" contentType="text/html; charset=GBK"
pageEncoding="GBK"%>
<html> <html>
<head> <head>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache"> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Bench4Q</title> <title>Bench4Q</title>
<link rel="search" type="application/opensearchdescription+xml" href="https://github.com/opensearch.xml" title="GitHub"> <link rel="search" type="application/opensearchdescription+xml"
<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> href="https://github.com/opensearch.xml" title="GitHub">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <link rel="fluid-icon" href="https://github.com/fluidicon.png"
title="GitHub">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<meta content="authenticity_token" name="csrf-param">
<meta content="wedm5SiF4gf6cxpqmjS1xTCRp86Sc8PAssZUiID8N0M="
<meta content="authenticity_token" name="csrf-param"> name="csrf-token">
<meta content="wedm5SiF4gf6cxpqmjS1xTCRp86Sc8PAssZUiID8N0M=" name="csrf-token">
<link href="css/github-6053501db2b69fd2b04652c6349117be14468ce4.css" media="screen" rel="stylesheet" type="text/css">
<link href="css/github2-277183b6724249eea8a7d10300542831eac78d3f.css" media="screen" rel="stylesheet" type="text/css">
<script src="js/frameworks-a450c7f907bdc1ee6b362ab1ecca811c761fd259.js" type="text/javascript"></script>
<link href="css/github-6053501db2b69fd2b04652c6349117be14468ce4.css"
media="screen" rel="stylesheet" type="text/css">
<link href="css/github2-277183b6724249eea8a7d10300542831eac78d3f.css"
media="screen" rel="stylesheet" type="text/css">
<script src="js/frameworks-a450c7f907bdc1ee6b362ab1ecca811c761fd259.js"
type="text/javascript"></script>
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><link rel="stylesheet" type="text/css" href="flip_ie.css"/><![endif]--> <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><link rel="stylesheet" type="text/css" href="flip_ie.css"/><![endif]-->
<!-- <script src="http://www.google.com/jsapi"></script> --> <!-- <script src="http://www.google.com/jsapi"></script> -->
<script type="text/javascript">google.load("jquery", "1");</script> <script type="text/javascript">
google.load("jquery", "1");
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript"> <script language="javascript">
function clean() { function clean() {
document.getElementsByName('username')[0].value=""; document.getElementsByName('username')[0].value = "";
document.getElementsByName('password')[0].value=""; document.getElementsByName('password')[0].value = "";
document.getElementsByName('retype_pwd')[0].value=""; document.getElementsByName('retype_pwd')[0].value = "";
} }
function register() { function register() {
var userName = $('#username').val(); var userName = $('#username').val();
var password = $('#password').val(); var password = $('#password').val();
var rePassword = $("#retype_pwd").val(); var rePassword = $("#retype_pwd").val();
$.post('register', { $.post('register', {
userName : userName, userName : userName,
password : password, password : password,
rePassword:rePassword rePassword : rePassword
}, function(data) { }, function(data) {
if (data.success) { if (data.success) {
window.location.replace("registerSuccess.jsp"); window.location.replace("registerSuccess.jsp");
} } else {
else { alert(data.failedMessage);
alert(data.failedMessage); // $('#registerMsg').html($.i18n.prop('msgRegister'));
// $('#registerMsg').html($.i18n.prop('msgRegister'));
}
}, "json");
} }
}, "json");
function password_validation() { }
var null_flag=0;
var user_name = document.getElementsByName('username')[0].value;
var retype_pwd = document.getElementsByName('retype_pwd')[0].value;
var input_pwd = document.getElementsByName('password')[0].value;
function password_validation() {
if(user_name==""){ var null_flag = 0;
$('#usrmsg').show(); var user_name = document.getElementsByName('username')[0].value;
document.getElementsByName('username')[0].value=""; var retype_pwd = document.getElementsByName('retype_pwd')[0].value;
document.getElementsByName('username')[0].style.border="1px solid red"; var input_pwd = document.getElementsByName('password')[0].value;
null_flag=1;}
else{ if (user_name == "") {
$('#usrmsg').hide(); $('#usrmsg').show();
document.getElementsByName('username')[0].style.border=""; document.getElementsByName('username')[0].value = "";
} document.getElementsByName('username')[0].style.border = "1px solid red";
null_flag = 1;
if(input_pwd==""){ } else {
$('#pwdmsg').show(); $('#usrmsg').hide();
document.getElementsByName('password')[0].value=""; document.getElementsByName('username')[0].style.border = "";
document.getElementsByName('password')[0].style.border="1px solid red"; }
null_flag=1;}
else{ if (input_pwd == "") {
$('#pwdmsg').hide(); $('#pwdmsg').show();
document.getElementsByName('password')[0].style.border=""; document.getElementsByName('password')[0].value = "";
} document.getElementsByName('password')[0].style.border = "1px solid red";
if(input_pwd!=retype_pwd){ null_flag = 1;
$('#rtpmsg').show(); } else {
document.getElementsByName('retype_pwd')[0].value=""; $('#pwdmsg').hide();
document.getElementsByName('retype_pwd')[0].style.border="1px solid red"; document.getElementsByName('password')[0].style.border = "";
null_flag=1; }
} if (input_pwd != retype_pwd) {
else{ $('#rtpmsg').show();
$('#rtpmsg').hide(); document.getElementsByName('retype_pwd')[0].value = "";
document.getElementsByName('retype_pwd')[0].style.border=""; document.getElementsByName('retype_pwd')[0].style.border = "1px solid red";
} null_flag = 1;
if(null_flag==0) } else {
register(); $('#rtpmsg').hide();
} document.getElementsByName('retype_pwd')[0].style.border = "";
}
function form_validation(name) { if (null_flag == 0)
var input_value = document.getElementsByName(name)[0].value; register();
var regx=/^[a-zA-Z0-9]+$/; }
if(!regx.test(input_value)){
alert(name + " must be number!"); function form_validation(name) {
if(name=="username"){ var input_value = document.getElementsByName(name)[0].value;
$('#usrmsg').show(); var regx = /^[a-zA-Z0-9]+$/;
document.getElementsByName('username')[0].value=""; if (!regx.test(input_value)) {
document.getElementsByName('username')[0].style.border="1px solid red"; alert(name + " must be number!");
} if (name == "username") {
$('#usrmsg').show();
else if(name=="password"){ document.getElementsByName('username')[0].value = "";
$('#pwdmsg').show(); document.getElementsByName('username')[0].style.border = "1px solid red";
document.getElementsByName('password')[0].value=""; }
document.getElementsByName('password')[0].style.border="1px solid red";
} else if (name == "password") {
} $('#pwdmsg').show();
else document.getElementsByName('password')[0].value = "";
{ document.getElementsByName('password')[0].style.border = "1px solid red";
document.getElementsByName(name)[0].style.border="1px solid #ddd"; }
if(name=="username") $('#usrmsg').hide(); } else {
else if(name=="password") $('#pwdmsg').hide(); document.getElementsByName(name)[0].style.border = "1px solid #ddd";
//else $('#rtpmsg').hide(); if (name == "username")
} $('#usrmsg').hide();
} else if (name == "password")
$('#pwdmsg').hide();
</script> //else $('#rtpmsg').hide();
}
}
</script>
</head> </head>
<body class="logged_out wider windows env-production "> <body class="logged_out wider windows env-production ">
<div id="wrapper"> <div id="wrapper">
<div id="header" class="true clearfix">
<div class="container clearfix">
<a class="site-logo" href="index.jsp">
<!--[if IE]> <div id="header" class="true clearfix">
<div class="container clearfix">
<a class="site-logo" href="index.jsp"> <!--[if IE]>
<img alt="GitHub" class="github-logo" src="head_line/bench4q-1.png" height="30"/> <img alt="GitHub" class="github-logo" src="head_line/bench4q-1.png" height="30"/>
<img alt="GitHub" class="github-logo-hover" src="head_line/bench4q-2.png" height="30"/> <img alt="GitHub" class="github-logo-hover" src="head_line/bench4q-2.png" height="30"/>
<![endif]--> <![endif]--> <img alt="GitHub" class="github-logo-4x"
<img alt="GitHub" class="github-logo-4x" src="img/bench4q-1.png" height="30"> src="img/bench4q-1.png" height="30"> <img alt="GitHub"
<img alt="GitHub" class="github-logo-4x-hover" src="img/bench4q-2.png" height="30"> class="github-logo-4x-hover" src="img/bench4q-2.png" height="30">
</a> </a>
<!-- <!--
make sure to use fully qualified URLs here since this nav make sure to use fully qualified URLs here since this nav
is used on error pages on other domains is used on error pages on other domains
--> -->
<ul class="top-nav logged_out">
<li class="login"><a href="login.jsp">login</a></li>
</ul>
</div>
</div> <ul class="top-nav logged_out">
<div class="site home"> <li class="login"><a href="login.jsp"><fmt:message key="index_jsp_login"></fmt:message></a></li>
<div class="container"> </ul>
<div class="pagehead homehead">
<div class="hero">
<h1>
Bench4Q is a new methodology for QoS benchmarking
</h1>
</div>
</div>
</div>
</div>
<div style="margin:20px auto; width:958px; height:600px; background-color:#efefef"> </div>
<div id="fm" name="fm"> </div>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><table style="width:100%; height:50px; border:0; align:center; cellpadding:0; background-color:#efefef"></table></td>
</tr>
<tr>
<td>
<table style="width:100%; height:400px; border:0; cellpadding:0; background-color:#efefef;">
<tr>
<td style="width:50%;">
<table style="width:100%; height:100px; border:0;">
<tr style="height:50px; width:100%;">
<td><img src="img/tips.jpg"/></td>
</tr>
<tr style="width:100%; height:50px;"></tr>
</table>
<table style="width:100%; height:300px; border:0;">
<tr>
<td style="width:10%; height:50px; text-align:right;"><img src="img/username.jpg"/></td>
<td style="width:20%; height:50px; text-align:right; background-color:#efefef;">Username:</td>
<td style="width:25%; height:50px; text-align:right; background-color:#efefef;"><input style="height:20px" id="username" name="username" tabindex="1" type="text" onChange="javascript:form_validation('username')"/></td>
<td style="width:55%; height:50px; text-align:right; background-color:#efefef;">
<table>
<tr id="usrmsg" style="display:none;">
<td style="width:20%;"><img src="img/cuowu.jpg"/></td><td style="width:80%;">the username must be <br>5-20 letters or numbers</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width:10%; height:50px; text-align:right;"><img src="img/password.jpg"/></td>
<td style="width:20%; height:50px; text-align:right; background-color:#efefef;">Password:</td>
<td style="width:25%; height:50px; text-align:right; background-color:#efefef;"><input style="height:20px" id="password" name="password" tabindex="1" type="password" onChange="javascript:form_validation('password')"/></td>
<td style="width:55%; height:50px; text-align:right; background-color:#efefef;">
<table>
<tr id="pwdmsg" style="display:none;">
<td style="width:20%;"><img src="img/cuowu.jpg"/></td><td style="width:80%;">the password must be <br>6-20 letters or numbers</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width:10%; height:50px; text-align:right;"><img src="img/retype.jpg"/></td>
<td style="width:20%; height:50px; text-align:right; background-color:#efefef;">Retype Password:</td>
<td style="width:25%; height:50px; text-align:right; background-color:#efefef;"><input style="height:20px" id="retype_pwd" name="retype_pwd" tabindex="1" type="password"/></td>
<td style="width:55%; height:50px; text-align:right; background-color:#efefef;">
<table>
<tr id="rtpmsg" style="display:none;">
<td style="width:20%;"><img src="img/cuowu.jpg"/></td><td style="width:80%;">the password is wrong</td>
</tr>
</table>
</td>
</tr>
<tr style="height:120px;">
<td style="text-align:center; background-color:#efefef;" colspan="2">
<input type="image" name="Submit" value="Register" src="img/submit.jpg" onMouseOver="this.src='img/submiton.jpg'" onMouseOut="this.src='img/submit.jpg'" onClick="javascript:password_validation();return false"/>
</td>
<td style="text-align:center; background-color:#efefef;">
<img name="Clear" value="Clear" src="img/clear.jpg" onMouseOver="this.src='img/clearon.jpg'" onMouseOut="this.src='img/clear.jpg'" onClick="javascript:clean();return false"/>
</td>
</tr>
<tr style="width:100%; height:100px;"></tr>
</table>
</td>
<td style="width:50%;">
<table style="width:100%; height:400px; background-color:#efefef;">
<tr>
<td style="width:90%;"><img src="img/bench4qblog.jpg"/></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><table style="width:100%; height:100px; border:0; cellpadding:0; background-color:#efefef;"></table></td>
</tr>
</table>
</div>
</div>
<div class="site home">
<div class="container">
<div class="pagehead homehead">
<div class="hero">
<h1>Bench4Q is a new methodology for QoS benchmarking</h1>
</div>
</div>
</div>
</div>
<div
style="margin: 20px auto; width: 958px; height: 600px; background-color: #efefef">
<div id="fm" name="fm">
<table width="100%" height="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td align="center"><table
style="width: 100%; height: 50px; border: 0; align: center; cellpadding: 0; background-color: #efefef"></table></td>
</tr>
<tr>
<td>
<table
style="width: 100%; height: 400px; border: 0; cellpadding: 0; background-color: #efefef;">
<tr>
<td style="width: 50%;">
<table style="width: 100%; height: 100px; border: 0;">
<tr style="height: 50px; width: 100%;">
<td><img src="img/tips.jpg" /></td>
</tr>
<tr style="width: 100%; height: 50px;"></tr>
</table>
<table style="width: 100%; height: 300px; border: 0;">
<tr>
<td style="width: 10%; height: 50px; text-align: right;"><img
src="img/username.jpg" /></td>
<td
style="width: 20%; height: 50px; text-align: right; background-color: #efefef;"><fmt:message key="register_jsp_username"></fmt:message>:</td>
<td
style="width: 25%; height: 50px; text-align: right; background-color: #efefef;"><input
style="height: 20px" id="username" name="username"
tabindex="1" type="text"
onChange="javascript:form_validation('username')" /></td>
<td
style="width: 55%; height: 50px; text-align: right; background-color: #efefef;">
<table>
<tr id="usrmsg" style="display: none;">
<td style="width: 20%;"><img src="img/cuowu.jpg" /></td>
<td style="width: 80%;">the username must be <br>5-20
letters or numbers
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width: 10%; height: 50px; text-align: right;"><img
src="img/password.jpg" /></td>
<td
style="width: 20%; height: 50px; text-align: right; background-color: #efefef;"><fmt:message key="register_jsp_password"></fmt:message>:</td>
<td
style="width: 25%; height: 50px; text-align: right; background-color: #efefef;"><input
style="height: 20px" id="password" name="password"
tabindex="1" type="password"
onChange="javascript:form_validation('password')" /></td>
<td
style="width: 55%; height: 50px; text-align: right; background-color: #efefef;">
<table>
<tr id="pwdmsg" style="display: none;">
<td style="width: 20%;"><img src="img/cuowu.jpg" /></td>
<td style="width: 80%;">the password must be <br>6-20
letters or numbers
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width: 10%; height: 50px; text-align: right;"><img
src="img/retype.jpg" /></td>
<td
style="width: 20%; height: 50px; text-align: right; background-color: #efefef;"><fmt:message key="register_jsp_retype"></fmt:message>:</td>
<td
style="width: 25%; height: 50px; text-align: right; background-color: #efefef;"><input
style="height: 20px" id="retype_pwd" name="retype_pwd"
tabindex="1" type="password" /></td>
<td
style="width: 55%; height: 50px; text-align: right; background-color: #efefef;">
<table>
<tr id="rtpmsg" style="display: none;">
<td style="width: 20%;"><img src="img/cuowu.jpg" /></td>
<td style="width: 80%;">the password is wrong</td>
</tr>
</table>
</td>
</tr>
<tr style="height: 120px;">
<td style="text-align: center; background-color: #efefef;"
colspan="2"><input type="image" name="Submit"
value="Register" src="img/submit.jpg"
onMouseOver="this.src='img/submiton.jpg'"
onMouseOut="this.src='img/submit.jpg'"
onClick="javascript:password_validation();return false" />
</td>
<td style="text-align: center; background-color: #efefef;">
<img name="Clear" value="Clear" src="img/clear.jpg"
onMouseOver="this.src='img/clearon.jpg'"
onMouseOut="this.src='img/clear.jpg'"
onClick="javascript:clean();return false" />
</td>
</tr>
<tr style="width: 100%; height: 100px;"></tr>
</table>
</td>
<td style="width: 50%;">
<table
style="width: 100%; height: 400px; background-color: #efefef;">
<tr>
<td style="width: 90%;"><img src="img/bench4qblog.jpg" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><table
style="width: 100%; height: 100px; border: 0; cellpadding: 0; background-color: #efefef;"></table></td>
</tr>
</table>
</div>
</div>
</body> </body>
</html> </html>

View File

@ -180,7 +180,7 @@ function show(plugin, method) {
p.setAttribute("style", "cursor:pointer;"); p.setAttribute("style", "cursor:pointer;");
p.appendChild(textNode); p.appendChild(textNode);
div.appendChild(p); div.appendChild(p);
document.getElementById('behaviorArea').appendChild(div); document.getElementById('behaviorArea').appendChild(div);
loadMethodParams(behaviorData, index); loadMethodParams(behaviorData, index);
index++; index++;
@ -286,8 +286,12 @@ function loadMethodParams(behaviorData, behaviorIndex) {
+ boxHeader + boxHeader
+ "<div class='box-content'>" + "<div class='box-content'>"
+ fieldHTML + fieldHTML
+ "</div><div class='left table-margin'><button class='btn btn-primary btn-width' type='submit' onClick='saveBehavior(this);'>"+$.i18n.prop("plugin_jsp_save")+"</button>" + "</div><div class='left table-margin'><button class='btn btn-primary btn-width' type='submit' onClick='saveBehavior(this);'>"
+ "&nbsp;&nbsp;<button class='btn btn-primary btn-width' type='submit' onClick='cancelBehavior(this);'>"+$.i18n.prop("plugin_jsp_cancel")+"</button></div></div></div>"; + $.i18n.prop("plugin_jsp_save")
+ "</button>"
+ "&nbsp;&nbsp;<button class='btn btn-primary btn-width' type='submit' onClick='cancelBehavior(this);'>"
+ $.i18n.prop("plugin_jsp_cancel")
+ "</button></div></div></div>";
document.getElementById("showPluginMethod").innerHTML += documentHtml; document.getElementById("showPluginMethod").innerHTML += documentHtml;
}); });
} }
@ -330,9 +334,11 @@ function createMultiField(label, name, size, behaviorIndex) {
var labelNode = document.createTextNode(name + ":" + label); var labelNode = document.createTextNode(name + ":" + label);
var div = document.createElement("div"); var div = document.createElement("div");
var addFieldButton = document.createElement("button"); var addFieldButton = document.createElement("button");
var addFieldNode = document.createTextNode($.i18n.prop("plugin_jsp_addField")); var addFieldNode = document.createTextNode($.i18n
.prop("plugin_jsp_addField"));
var removeFieldButton = document.createElement("button"); var removeFieldButton = document.createElement("button");
var removeFieldNode = document.createTextNode($.i18n.prop("plugin_jsp_removeField")); var removeFieldNode = document.createTextNode($.i18n
.prop("plugin_jsp_removeField"));
var br = document.createElement("br"); var br = document.createElement("br");
var table = document.createElement("table"); var table = document.createElement("table");
@ -420,7 +426,8 @@ function createTable(methodParamModel, cols, behaviorIndex) {
var addColButton = document.createElement("button"); var addColButton = document.createElement("button");
var addColNode = document.createTextNode($.i18n.prop("plugin_jsp_addCol")); var addColNode = document.createTextNode($.i18n.prop("plugin_jsp_addCol"));
var removeColButton = document.createElement("button"); var removeColButton = document.createElement("button");
var removeColNode = document.createTextNode($.i18n.prop("plugin_jsp_removeCol")); var removeColNode = document.createTextNode($.i18n
.prop("plugin_jsp_removeCol"));
var table = document.createElement("table"); var table = document.createElement("table");
var thead = document.createElement("thead"); var thead = document.createElement("thead");
var tbody = document.createElement("tbody"); var tbody = document.createElement("tbody");
@ -534,72 +541,58 @@ function saveBehavior(selectedNode) {
type = "USERBEHAVIOR"; type = "USERBEHAVIOR";
} }
var parameters = new Array(); var parameters = new Array();
for (var i = 0; i < length; i++) for (var i = 0; i < length; i++) {
{
var node = div[i]; var node = div[i];
var nodeId = $(node).attr("id").split("_"); var nodeId = $(node).attr("id").split("_");
behaviorIndex = nodeId[0]; behaviorIndex = nodeId[0];
var parameterModel; var parameterModel;
var key = "", value = "",temp=""; var key = "", value = "", temp = "";
if ($(node).attr("class") == "Field sample_frame") if ($(node).attr("class") == "Field sample_frame") {
{
key = node.lastChild.firstChild.nodeValue; key = node.lastChild.firstChild.nodeValue;
temp= $(node).find("input").val(); temp = $(node).find("input").val();
if(temp!="") if (temp != "") {
{
value = temp; value = temp;
} }
} } else if ($(node).attr("class") == "MultiField sample_frame") {
else if ($(node).attr("class") == "MultiField sample_frame")
{
key = node.firstChild.firstChild.nodeValue.split(":")[0]; key = node.firstChild.firstChild.nodeValue.split(":")[0];
var fieldNode = $(node).find("table").children(); var fieldNode = $(node).find("table").children();
var fieldLength = $(fieldNode).length; var fieldLength = $(fieldNode).length;
for (var j = 0; j < fieldLength; j++) { for (var j = 0; j < fieldLength; j++) {
temp=$(fieldNode[j]).find("input").val(); temp = $(fieldNode[j]).find("input").val();
if(temp!="") if (temp != "") {
{
value = temp + ";"; value = temp + ";";
} }
} }
} } else if ($(node).attr("class") == "Table sample_frame") {
else if ($(node).attr("class") == "Table sample_frame")
{
key = node.lastChild.firstChild.nodeValue; key = node.lastChild.firstChild.nodeValue;
var table = $(node).find("table"); var table = $(node).find("table");
var col = table.find("th").length; var col = table.find("th").length;
var row = table.find("tbody").children().length; var row = table.find("tbody").children().length;
var tbody = $(node).find("tbody"); var tbody = $(node).find("tbody");
for (var m = 0; m < row; m++) for (var m = 0; m < row; m++) {
{ for (var n = 0; n < col; n++) {
for (var n = 0; n < col; n++)
{
var rowNode = $(tbody).children()[m]; var rowNode = $(tbody).children()[m];
var colNode = $(rowNode).children()[n]; var colNode = $(rowNode).children()[n];
temp=$(colNode).find("input").val(); temp = $(colNode).find("input").val();
if(temp!="") if (temp != "") {
{
value += temp + "|"; value += temp + "|";
} }
} }
if(value!="") if (value != "") {
{
value += ";"; value += ";";
} }
} }
} } else if ($(node).attr("class") == "CheckBox sample_frame") {
else if ($(node).attr("class") == "CheckBox sample_frame")
{
key = node.lastChild.firstChild.nodeValue; key = node.lastChild.firstChild.nodeValue;
var id = $(node).attr("id"); var id = $(node).attr("id");
$('input[name=' + id + ']:checked').each(function() { $('input[name=' + id + ']:checked').each(function() {
temp=$(this).val(); temp = $(this).val();
if(temp!=""){ if (temp != "") {
value += temp + ";"; value += temp + ";";
} }
}); });
} }
if(value!=""){ if (value != "") {
parameterModel = new ParameterModel(key, value); parameterModel = new ParameterModel(key, value);
parameters.push(parameterModel); parameters.push(parameterModel);
} }
@ -611,23 +604,23 @@ function saveBehavior(selectedNode) {
} }
var usePluginList = new Array(); var usePluginList = new Array();
function submitBehaviors(selectedNode) { function submitBehaviors(selectedNode) {
var scriptName=$(selectedNode.parentNode.parentNode).find("input").val(); var scriptName = $(selectedNode.parentNode.parentNode).find("input").val();
if(scriptName==null||scriptName==""){ if (scriptName == null || scriptName == "") {
alert("Please input scriptName."); alert("Please input scriptName.");
return; return;
} }
if(behaviors.length==0){ if (behaviors.length == 0) {
alert("Please save the behavior or fill in the form."); alert("Please save the behavior or fill in the form.");
return; return;
} }
for (var i = 0; i < pluginChoosedList.length; i++) for (var i = 0; i < pluginChoosedList.length; i++) {
{ var usePluginModel = new UsePluginModel(i, pluginChoosedList[i],
var usePluginModel = new UsePluginModel(i, pluginChoosedList[i], new Array()); new Array());
usePluginList.push(usePluginModel); usePluginList.push(usePluginModel);
} }
var scriptModel = new PluginEditScriptRequestModel(behaviors, var scriptModel = new PluginEditScriptRequestModel(behaviors,
usePluginList, scriptName); usePluginList, scriptName);
$.ajax({ $.ajax({
type : "POST", type : "POST",
url : "uploadPluginEditedScript", url : "uploadPluginEditedScript",

View File

@ -165,7 +165,7 @@ body {
onClick="addScenario();checkUserScenarios()"><fmt:message key="addScript" /> onClick="addScenario();checkUserScenarios()"><fmt:message key="addScript" />
</button> </button>
<button type="submit" class="btn btn-info" <button type="submit" class="btn btn-primary"
id="createNewScript" onClick="createNewScript()"><fmt:message key="test_jsp_makeNewScript" /> id="createNewScript" onClick="createNewScript()"><fmt:message key="test_jsp_makeNewScript" />
</button> </button>