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_addScriptName=Please add ScriptName
plugin_jsp_scriptName=Script Name:
script_jsp_makeScript=MakeScript
script_jsp_makeScript=ScriptEdit
script_jsp_recordScript=RecordScript
script_jsp_refresh=RefreshPage
test_jsp_makeNewScript=NewScript
@ -143,4 +143,7 @@ login_jsp_passwordWarnning=The password cannot be empty!
login_jsp_admin=Admin
script_edit_jsp_save=Save
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_addScriptName=\u8BF7\u8F93\u5165\u811A\u672C\u540D
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_refresh=\u5237\u65B0\u9875\u9762
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
login_jsp_home=\u4E3B\u9875
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_signIn=\u767B\u5F55
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
script_edit_jsp_save=\u4FDD\u5B58
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">
<fmt:message key="plugin_jsp_cancel" />
</button>
</div>
</div>
<div class="modal hide fade " id="myModal_Behavior">
@ -239,30 +237,6 @@ body {
</button>
</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>
<jsp:include page="publiccontrol/footer.jsp"></jsp:include>
</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>
<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="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Bench4Q</title>
<link rel="search" type="application/opensearchdescription+xml" href="https://github.com/opensearch.xml" title="GitHub">
<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=" 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>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Bench4Q</title>
<link rel="search" type="application/opensearchdescription+xml"
href="https://github.com/opensearch.xml" title="GitHub">
<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="
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>
<!--[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 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">
<script language="javascript">
function clean() {
document.getElementsByName('username')[0].value="";
document.getElementsByName('password')[0].value="";
document.getElementsByName('retype_pwd')[0].value="";
}
function register() {
var userName = $('#username').val();
var password = $('#password').val();
var rePassword = $("#retype_pwd").val();
$.post('register', {
userName : userName,
password : password,
rePassword:rePassword
}, function(data) {
if (data.success) {
window.location.replace("registerSuccess.jsp");
}
else {
alert(data.failedMessage);
// $('#registerMsg').html($.i18n.prop('msgRegister'));
}
}, "json");
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript">
function clean() {
document.getElementsByName('username')[0].value = "";
document.getElementsByName('password')[0].value = "";
document.getElementsByName('retype_pwd')[0].value = "";
}
function register() {
var userName = $('#username').val();
var password = $('#password').val();
var rePassword = $("#retype_pwd").val();
$.post('register', {
userName : userName,
password : password,
rePassword : rePassword
}, function(data) {
if (data.success) {
window.location.replace("registerSuccess.jsp");
} else {
alert(data.failedMessage);
// $('#registerMsg').html($.i18n.prop('msgRegister'));
}
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;
}, "json");
}
if(user_name==""){
$('#usrmsg').show();
document.getElementsByName('username')[0].value="";
document.getElementsByName('username')[0].style.border="1px solid red";
null_flag=1;}
else{
$('#usrmsg').hide();
document.getElementsByName('username')[0].style.border="";
}
if(input_pwd==""){
$('#pwdmsg').show();
document.getElementsByName('password')[0].value="";
document.getElementsByName('password')[0].style.border="1px solid red";
null_flag=1;}
else{
$('#pwdmsg').hide();
document.getElementsByName('password')[0].style.border="";
}
if(input_pwd!=retype_pwd){
$('#rtpmsg').show();
document.getElementsByName('retype_pwd')[0].value="";
document.getElementsByName('retype_pwd')[0].style.border="1px solid red";
null_flag=1;
}
else{
$('#rtpmsg').hide();
document.getElementsByName('retype_pwd')[0].style.border="";
}
if(null_flag==0)
register();
}
function form_validation(name) {
var input_value = document.getElementsByName(name)[0].value;
var regx=/^[a-zA-Z0-9]+$/;
if(!regx.test(input_value)){
alert(name + " must be number!");
if(name=="username"){
$('#usrmsg').show();
document.getElementsByName('username')[0].value="";
document.getElementsByName('username')[0].style.border="1px solid red";
}
else if(name=="password"){
$('#pwdmsg').show();
document.getElementsByName('password')[0].value="";
document.getElementsByName('password')[0].style.border="1px solid red";
}
}
else
{
document.getElementsByName(name)[0].style.border="1px solid #ddd";
if(name=="username") $('#usrmsg').hide();
else if(name=="password") $('#pwdmsg').hide();
//else $('#rtpmsg').hide();
}
}
</script>
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;
if (user_name == "") {
$('#usrmsg').show();
document.getElementsByName('username')[0].value = "";
document.getElementsByName('username')[0].style.border = "1px solid red";
null_flag = 1;
} else {
$('#usrmsg').hide();
document.getElementsByName('username')[0].style.border = "";
}
if (input_pwd == "") {
$('#pwdmsg').show();
document.getElementsByName('password')[0].value = "";
document.getElementsByName('password')[0].style.border = "1px solid red";
null_flag = 1;
} else {
$('#pwdmsg').hide();
document.getElementsByName('password')[0].style.border = "";
}
if (input_pwd != retype_pwd) {
$('#rtpmsg').show();
document.getElementsByName('retype_pwd')[0].value = "";
document.getElementsByName('retype_pwd')[0].style.border = "1px solid red";
null_flag = 1;
} else {
$('#rtpmsg').hide();
document.getElementsByName('retype_pwd')[0].style.border = "";
}
if (null_flag == 0)
register();
}
function form_validation(name) {
var input_value = document.getElementsByName(name)[0].value;
var regx = /^[a-zA-Z0-9]+$/;
if (!regx.test(input_value)) {
alert(name + " must be number!");
if (name == "username") {
$('#usrmsg').show();
document.getElementsByName('username')[0].value = "";
document.getElementsByName('username')[0].style.border = "1px solid red";
}
else if (name == "password") {
$('#pwdmsg').show();
document.getElementsByName('password')[0].value = "";
document.getElementsByName('password')[0].style.border = "1px solid red";
}
} else {
document.getElementsByName(name)[0].style.border = "1px solid #ddd";
if (name == "username")
$('#usrmsg').hide();
else if (name == "password")
$('#pwdmsg').hide();
//else $('#rtpmsg').hide();
}
}
</script>
</head>
<body class="logged_out wider windows env-production ">
<div id="wrapper">
<body class="logged_out wider windows env-production ">
<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-hover" src="head_line/bench4q-2.png" height="30"/>
<![endif]-->
<img alt="GitHub" class="github-logo-4x" src="img/bench4q-1.png" height="30">
<img alt="GitHub" class="github-logo-4x-hover" src="img/bench4q-2.png" height="30">
</a>
<![endif]--> <img alt="GitHub" class="github-logo-4x"
src="img/bench4q-1.png" height="30"> <img alt="GitHub"
class="github-logo-4x-hover" src="img/bench4q-2.png" height="30">
</a>
<!--
<!--
make sure to use fully qualified URLs here since this nav
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">
<div class="container">
<div class="pagehead homehead">
<div class="hero">
<h1>
Bench4Q is a new methodology for QoS benchmarking
</h1>
</div>
</div>
</div>
</div>
<li class="login"><a href="login.jsp"><fmt:message key="index_jsp_login"></fmt:message></a></li>
</ul>
<div style="margin:20px auto; width:958px; height:600px; background-color:#efefef">
</div>
<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;">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>
<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>
</html>

View File

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

View File

@ -165,7 +165,7 @@ body {
onClick="addScenario();checkUserScenarios()"><fmt:message key="addScript" />
</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" />
</button>