modify the plugin-new.js and plugin.jsp

This commit is contained in:
zhengyingying 2014-03-26 21:00:46 +08:00
parent 05dc5952b4
commit 0f1f87ab0e
4 changed files with 108 additions and 32 deletions

View File

@ -117,6 +117,8 @@ plugin_jsp_finish=Finish
plugin_jsp_add=Add
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_recordScript=RecordScript
script_jsp_refresh=RefreshPage

View File

@ -118,6 +118,8 @@ plugin_jsp_finish=\u5B8C\u6210
plugin_jsp_add=\u6DFB\u52A0
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_recordScript=\u5F55\u5236\u811A\u672C
script_jsp_refresh=\u5237\u65B0\u9875\u9762

View File

@ -76,9 +76,10 @@ body {
<ul class="breadcrumb">
<li><a href="homepage.jsp"><fmt:message key="home" /></a> <span
class="divider">/</span></li>
<li><a href="script.jsp"><fmt:message key="scriptmanagement" /></a><span
class="divider">/</span></li>
<li><a href="plugin.jsp"><fmt:message key="script_jsp_makeScript" /></a></li>
<li><a href="script.jsp"><fmt:message
key="scriptmanagement" /></a><span class="divider">/</span></li>
<li><a href="plugin.jsp"><fmt:message
key="script_jsp_makeScript" /></a></li>
</ul>
</div>
@ -87,7 +88,7 @@ body {
<div class="box-header well" data-original-title>
<i class="icon-pencil left"></i>
<h2>
<span><fmt:message key="plugin_jsp_plugins" /></span>
<span><fmt:message key="plugin_jsp_plugins" />(usePlugins)</span>
</h2>
<div class="box-icon">
<a href="#" class="btn btn-setting btn-round"><i
@ -128,7 +129,9 @@ body {
<div class="box-header well" data-original-title>
<i class="icon-pencil left"></i>
<h2>
<i></i><fmt:message key="plugin_jsp_behavior" />
<i></i>
<fmt:message key="plugin_jsp_behavior" />
(behaviors)
</h2>
<div class="box-icon">
<a href="#" class="btn btn-setting btn-round"><i
@ -161,7 +164,7 @@ body {
</div>
<div id="showPluginMethod" class="showPluginMethod"></div>
<div class="hide" id="submitBehaviors">
<button class='btn-large' onClick="submitBehaviors();">
<button class='btn-large' onClick="submitPrompt();">
<fmt:message key="plugin_jsp_submit" />
</button>
</div>
@ -233,6 +236,29 @@ body {
</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

@ -173,13 +173,13 @@ function show(plugin, method) {
$('#myModal_Behavior').modal('hide');
var div = document.createElement("div");
var a = document.createElement("a");
var p = document.createElement("p");
var textNode = document.createTextNode(behaviorData);
a.setAttribute("class", index);
a.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams
a.setAttribute("style", "cursor:pointer;float:left;");
a.appendChild(textNode);
div.appendChild(a);
p.setAttribute("class", index);
p.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams
p.setAttribute("style", "cursor:pointer;");
p.appendChild(textNode);
div.appendChild(p);
document.getElementById('behaviorArea').appendChild(div);
loadMethodParams(behaviorData, index);
@ -282,7 +282,7 @@ function loadMethodParams(behaviorData, behaviorIndex) {
+ behaviorIndex
+ "' class='hide'><p class='hide'>"
+ behaviorData
+ "</p><div class='span11 box'>"
+ "</p><div class='span12 box' style='margin-left:-5px;'>"
+ boxHeader
+ "<div class='box-content'>"
+ fieldHTML
@ -534,58 +534,104 @@ 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 = "";
if ($(node).attr("class") == "Field sample_frame") {
var key = "", value = "",temp="";
if ($(node).attr("class") == "Field sample_frame")
{
key = node.lastChild.firstChild.nodeValue;
value = $(node).find("input").val();
} else if ($(node).attr("class") == "MultiField sample_frame") {
key = node.firstChild.firstChild.nodeValue;
temp= $(node).find("input").val();
if(temp!="")
{
value = temp;
}
}
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++) {
value = $(fieldNode[j]).find("input").val() + ",";
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];
value += $(colNode).find("input").val() + ";";
temp=$(colNode).find("input").val();
if(temp!="")
{
value += temp + "|";
}
}
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() {
value += $(this).val() + ";";
temp=$(this).val();
if(temp!=""){
value += temp + ";";
}
});
}
parameterModel = new ParameterModel(key, value);
parameters.push(parameterModel);
alert("key="+key);
alert("value="+value);
if(value!=""){
parameterModel = new ParameterModel(key, value);
parameters.push(parameterModel);
}
}
alert("id="+behaviorIndex);
var behaviorModel = new BehaviorModel(behaviorIndex, use, name, type,
parameters);
behaviors.push(behaviorModel);
alert("save success!");
}
var usePluginList = new Array();
function submitBehaviors() {
for (var i = 0; i < pluginChoosedList.length; i++) {
function submitPrompt(){
$('#myModal_ScriptName').modal('show');
}
function addScriptName(){
var scriptName=$('#writeAScriptName').val();
submitBehaviors(scriptName);
$('#myModal_ScriptName').modal('hide');
}
function submitBehaviors(scriptName) {
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");
usePluginList, scriptName);
$.ajax({
type : "POST",
url : "uploadPluginEditedScript",