add pluginManage.jsp and refactor pluginActionController.java
This commit is contained in:
parent
893772aa09
commit
9a407a3b04
|
@ -1,18 +1,17 @@
|
|||
package org.bench4q.web.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.master.plugin.MethodParamModel;
|
||||
import org.bench4q.share.models.master.plugin.BehaviorInfoModel;
|
||||
import org.bench4q.share.models.master.plugin.PluginResponseModel;
|
||||
import org.bench4q.share.models.master.plugin.PluginUIModel;
|
||||
import org.bench4q.web.exception.CustomGenericException;
|
||||
import org.bench4q.web.model.BaseResponseModel;
|
||||
import org.bench4q.web.service.BaseService;
|
||||
|
@ -21,12 +20,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
@Controller
|
||||
@SessionAttributes({"accessToken","loadMethod"})
|
||||
@SessionAttributes({ "accessToken"})
|
||||
public class PluginActionController {
|
||||
|
||||
private final String baseUrl = "plugin";
|
||||
|
@ -51,26 +52,28 @@ public class PluginActionController {
|
|||
return BASECALLER;
|
||||
}
|
||||
|
||||
@RequestMapping("loadPlugin")
|
||||
@RequestMapping("loadPluginName")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadPlugin(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
System.out.println("loadPluginList!!");
|
||||
String caller = new String("PluginActionController:loadPlugin");
|
||||
String url = this.getBaseUrl() + "/loadPluginList";
|
||||
String caller = new String("PluginActionController:loadPluginName");
|
||||
String url = this.getBaseUrl() + "/loadPluginNameList";
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
PluginResponseModel.class, null, caller);
|
||||
try {
|
||||
Logger.getLogger(PluginActionController.class).info(MarshalHelper.marshal(PluginResponseModel.class, pluginResponseModel));
|
||||
Logger.getLogger(PluginActionController.class).info(
|
||||
MarshalHelper.marshal(PluginResponseModel.class,
|
||||
pluginResponseModel));
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
System.out.println("pluginResponseModel has been used");
|
||||
List<String> pluginList = pluginResponseModel.getPluginList();
|
||||
//System.out.println(pluginList.size());
|
||||
// System.out.println(pluginList.size());
|
||||
if (pluginList == null) {
|
||||
pluginList = new ArrayList<String>();
|
||||
System.out.println("pluginList is empty");
|
||||
|
@ -82,15 +85,38 @@ public class PluginActionController {
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping("loadMethod")
|
||||
@RequestMapping("loadPluginUIInfo")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadMethod(HttpServletRequest request,
|
||||
BaseResponseModel loadPluginUIInfo(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken)
|
||||
throws CustomGenericException {
|
||||
String caller = new String("PluginActionController:loadPluginUIInfo");
|
||||
String url = this.getBaseUrl() + "/loadPluginUI";
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
PluginResponseModel.class, null, caller);
|
||||
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
List<PluginUIModel> pluginUIModels = pluginResponseModel
|
||||
.getPluginUIModels();
|
||||
if (pluginUIModels == null) {
|
||||
pluginUIModels = new ArrayList<PluginUIModel>();
|
||||
System.out.println("pluginUIModels is empty");
|
||||
}
|
||||
return new BaseResponseModel(true, pluginUIModels);
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("loadBehaviorList")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadBehaviorList(HttpServletRequest request,
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String pluginName) throws CustomGenericException {
|
||||
|
||||
System.out.println("loadMethodList!!");
|
||||
String caller = new String("PluginActionController:loadMethodList");
|
||||
String url = this.getBaseUrl() + "/loadMethodList/" + pluginName;
|
||||
String caller = new String("PluginActionController:loadBehaviorList");
|
||||
String url = this.getBaseUrl() + "/loadBehaviors/" + pluginName;
|
||||
Map<String, String> params = BaseService.makeParamsMap("pluginName",
|
||||
pluginName);
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
|
@ -98,65 +124,77 @@ public class PluginActionController {
|
|||
PluginResponseModel.class, params, caller);
|
||||
|
||||
try {
|
||||
Logger.getLogger(PluginActionController.class).info(MarshalHelper.marshal(PluginResponseModel.class, pluginResponseModel));
|
||||
Logger.getLogger(PluginActionController.class).info(
|
||||
MarshalHelper.marshal(PluginResponseModel.class,
|
||||
pluginResponseModel));
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
System.out.println("pluginResponseModel has been used");
|
||||
List<String> methodList = pluginResponseModel.getMethodList();
|
||||
if (methodList == null) {
|
||||
methodList = new ArrayList<String>();
|
||||
System.out.println("methodList is empty");
|
||||
List<BehaviorInfoModel> behaviorInfoModels = pluginResponseModel
|
||||
.getBehaviorInfoModels();
|
||||
if (behaviorInfoModels == null) {
|
||||
behaviorInfoModels = new ArrayList<BehaviorInfoModel>();
|
||||
}
|
||||
return new BaseResponseModel(true, methodList);
|
||||
return new BaseResponseModel(true, behaviorInfoModels);
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("loadMethodParameters")
|
||||
public @ResponseBody
|
||||
BaseResponseModel loadMethodParameters(HttpServletRequest request,
|
||||
@RequestMapping(value = "uploadPluginFile", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BaseResponseModel uploadPluginFile(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String pluginName, @RequestParam String methodName)
|
||||
@RequestParam CommonsMultipartFile pluginFile)
|
||||
throws CustomGenericException {
|
||||
String caller = new String("PluginActionController:uploadPluginFile");
|
||||
String url = this.getBaseUrl() + "/addPlugin";
|
||||
|
||||
System.out.println("loadMethodParameters!!");
|
||||
if (pluginFile.isEmpty()) {
|
||||
return new BaseResponseModel(false, "empty file");
|
||||
}
|
||||
try {
|
||||
|
||||
String pluginUIModel = new String(pluginFile.getBytes());
|
||||
MarshalHelper.unmarshal(PluginUIModel.class, pluginUIModel);
|
||||
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModelByPut(
|
||||
accessToken, url, pluginUIModel,
|
||||
PluginResponseModel.class, caller);
|
||||
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
return new BaseResponseModel(true,
|
||||
"upload plugin file success!");
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping("deletePluginByPluginName")
|
||||
public @ResponseBody
|
||||
BaseResponseModel deletePluginByPluginName(
|
||||
@ModelAttribute("accessToken") String accessToken,
|
||||
@RequestParam String pluginName) throws CustomGenericException {
|
||||
String caller = new String(
|
||||
"PluginActionController:loadMethodParameters");
|
||||
String url = this.getBaseUrl() + "/loadMethodParams/" + pluginName
|
||||
+ "/" + methodName;
|
||||
|
||||
"PluginActionController:deletePluginByPluginName");
|
||||
String url = this.getBaseUrl() + "deletePlugin/" + pluginName;
|
||||
Map<String, String> params = BaseService.makeParamsMap("pluginName",
|
||||
pluginName);
|
||||
params.put("methodName", methodName);
|
||||
|
||||
PluginResponseModel pluginResponseModel = (PluginResponseModel) this
|
||||
.getCommunicateWithMaster().getResponseModel(accessToken, url,
|
||||
PluginResponseModel.class, params, caller);
|
||||
|
||||
try {
|
||||
Logger.getLogger(PluginActionController.class).info(MarshalHelper.marshal(PluginResponseModel.class, pluginResponseModel));
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
if(pluginResponseModel.isSuccess()){
|
||||
return new BaseResponseModel(true,"delete success");
|
||||
}else{
|
||||
return new BaseResponseModel(false,pluginResponseModel.getFailMessage());
|
||||
}
|
||||
|
||||
if (pluginResponseModel.isSuccess()) {
|
||||
System.out.println("pluginResponseModel has been used");
|
||||
Set<MethodParamModel> methodParamSet = pluginResponseModel
|
||||
.getMethosMethodParamModels();
|
||||
if (methodParamSet == null) {
|
||||
methodParamSet = new HashSet<MethodParamModel>();
|
||||
}
|
||||
return new BaseResponseModel(true, methodParamSet);
|
||||
} else {
|
||||
return new BaseResponseModel(false,
|
||||
pluginResponseModel.getFailMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ scriptname=Script Name
|
|||
datecreated=Date created
|
||||
actions=Actions
|
||||
settings=Add Script
|
||||
agentManage_jsp_addAgent=Add Agent
|
||||
portManage_jsp_addPort=Add Port
|
||||
configuredmessage=Here settings can be configured
|
||||
startserver=Start Server
|
||||
stopserver=Stop Server
|
||||
|
@ -71,6 +73,12 @@ warningcontent1=You need to have
|
|||
warningcontent2=enabled to use this site
|
||||
agentmanage=Agent Manage
|
||||
portmanage=Port Manage
|
||||
pluginmanage=Plug-in Manage
|
||||
pluginManage_jsp_plugin=plug-in
|
||||
pluginManage_jsp_pluginName=plug-in Name
|
||||
pluginManage_jsp_createDate=Date created
|
||||
pluginManage_jsp_action=Actions
|
||||
pluginManage_jsp_addPlugin=Add Plug-in
|
||||
homepage=Homepage
|
||||
changetheme=Change Theme / Skin
|
||||
classic=Classic
|
||||
|
|
|
@ -35,6 +35,8 @@ scriptname=\u811A\u672C\u540D\u79F0
|
|||
datecreated=\u521B\u5EFA\u65E5\u671F
|
||||
actions=\u64CD\u4F5C
|
||||
settings=\u6DFB\u52A0\u811A\u672C
|
||||
agentManage_jsp_addAgent=\u6DFB\u52A0\u4EE3\u7406
|
||||
portManage_jsp_addPort=\u6DFB\u52A0\u7AEF\u53E3
|
||||
configuredmessage=\u5728\u8FD9\u91CC\u53EF\u4EE5\u914D\u7F6E
|
||||
startserver=\u542F\u52A8\u670D\u52A1\u5668
|
||||
stopserver=\u505C\u6B62\u670D\u52A1\u5668
|
||||
|
@ -71,6 +73,12 @@ warningcontent1=\u9700\u8981\u652F\u6301
|
|||
warningcontent2=\u4F7F\u7F51\u9875\u53EF\u4EE5\u6B63\u5E38\u663E\u793A
|
||||
agentmanage=\u4EE3\u7406\u7BA1\u7406
|
||||
portmanage=\u7AEF\u53E3\u7BA1\u7406
|
||||
pluginmanage=\u63D2\u4EF6\u7BA1\u7406
|
||||
pluginManage_jsp_plugin=\u63D2\u4EF6
|
||||
pluginManage_jsp_pluginName=\u63D2\u4EF6\u540D\u79F0
|
||||
pluginManage_jsp_createDate=\u521B\u5EFA\u65E5\u671F
|
||||
pluginManage_jsp_action=\u64CD\u4F5C
|
||||
pluginManage_jsp_addPlugin=\u6DFB\u52A0\u63D2\u4EF6
|
||||
homepage=\u4E3B\u9875
|
||||
changetheme=\u66F4\u6362\u4E3B\u9898\ / \u76AE\u80A4
|
||||
classic=\u7ECF\u5178\u6837\u5F0F
|
||||
|
@ -129,7 +137,7 @@ script_jsp_recordScript=\u5F55\u5236\u811A\u672C
|
|||
script_jsp_refresh=\u5237\u65B0\u9875\u9762
|
||||
test_jsp_makeNewScript=\u65B0\u5EFA\u811A\u672C
|
||||
index_jsp_Bench4Q_as_a_Service=Bench4Q_as_a_Service \u662F\u57FA\u4E8EBench4Q\u9879\u76EE\u5B9E\u73B0\u7684\u3002\u6211\u4EEC\u91CD\u65B0\u5B9E\u73B0\u4E86Bench4Q\u5DE5\u5177\uFF0C\u4F7F\u5B83\u53EF\u4EE5\u4F5C\u4E3A\u4E00\u79CD\u670D\u52A1\u88AB\u90E8\u7F72\u5230\u5E94\u7528\u670D\u52A1\u5668\u4E0A\u3002Bench4Q\u652F\u6301\u4E91\u8BA1\u7B97\u6240\u63D0\u4F9B\u7684\u5F39\u6027\u548C\u591A\u79DF\u6237\u529F\u80FD\u3002
|
||||
index_jsp_Bench4Q=Bench4Q\u662F\u8D28\u91CF\u670D\u52A1\u5BFC\u5411\u7535\u5B50\u5546\u52A1\u6807\u6746\u7684\u4E00\u4E2A\u975E\u5E38\u65B0\u7684\u65B9\u6CD5\u5B66 \u3002Bench4Q\u6709\u5F88\u591A\u7279\u70B9\u6765\u63A8\u8BBA\u590D\u6742\u7684\u57FA\u4E8E\u4F1A\u8BDD\u7684\u5DE5\u4F5C\u8D1F\u8F7D\u7684\u53EF\u63A7\u7684\u548C\u7075\u6D3B\u7684\u8868\u793A\u6CD5\uFF0C\u5E76\u4E14\u53EF\u4EE5\u6A21\u62DF\u771F\u5B9E\u7528\u6237\u7684\u884C\u4E3A\u3002
|
||||
index_jsp_Bench4Q=Bench4Q\u5728\u8FD0\u7528\u4E91\u8BA1\u7B97\u6280\u672F\u7684\u540C\u65F6\uFF0C\u589E\u5F3A\u4E86\u5BF9\u4E8E\u8D1F\u8F7D\u6CE8\u5165\u4EE3\u7406\u6C60\u7684\u63A7\u5236\u548C\u7BA1\u7406\uFF0C\u52A0\u4E4B\u4EE5\u8D1F\u8F7D\u6CE8\u5165\u4EE3\u7406\u7684\u63D2\u4EF6\u5316\u7075\u6D3B\u6269\u5C55\uFF0C\u4F7F\u5F97\u5927\u89C4\u6A21\u6027\u80FD\u6D4B\u8BD5\u6210\u4E3A\u4EF7\u683C\u66F4\u4E3A\u4F4E\u5EC9\u3001\u66F4\u4E3A\u5B9E\u60E0\u7684\u9700\u6C42\u3002
|
||||
index_jsp_FreeRegister=\u514D\u8D39\u6CE8\u518C\uFF0C\u8BA4\u8BC1\uFF0C\u4E0B\u8F7D\u6D4B\u8BD5\uFF0C\u5B9E\u65F6\u76D1\u63A7\uFF0C\u5206\u6790\u62A5\u544A\u4E0B\u8F7D\uFF0C\u67E5\u770B\u5386\u53F2\u6570\u636E...
|
||||
index_jsp_Title=Bench4Q\u2014\u2014\u57FA\u4E8E\u4E91\u7684\u6D4B\u8BD5\u4E0B\u8F7D\u5E73\u53F0
|
||||
register_jsp_Title=Bench4Q\u2014\u2014\u57FA\u4E8E\u4E91\u7684\u6D4B\u8BD5\u4E0B\u8F7D\u5E73\u53F0
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">x</button>
|
||||
<h3>
|
||||
<fmt:message key="settings" />
|
||||
<fmt:message key="agentManage_jsp_addAgent" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
|
|
@ -12,6 +12,11 @@ h1 {
|
|||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
font-size: 30px;
|
||||
font-family: "ff-tisa-web-pro-1", "ff-tisa-web-pro-2", "Lucida Grande",
|
||||
"Helvetica Neue", Helvetica, Arial, "Hiragino Sans GB",
|
||||
"Hiragino Sans GB W3", "Microsoft YaHei UI", "Microsoft YaHei",
|
||||
"WenQuanYi Micro Hei", sans-serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.content {
|
||||
|
@ -112,17 +117,22 @@ h1 {
|
|||
font-size: 15;
|
||||
line-height: 30px;
|
||||
font-weight: bold;
|
||||
font-family: Microsoft YaHei,'ËÎÌå' , Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif;
|
||||
/* font-family: Microsoft YaHei,'ËÎÌå' , Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif; */
|
||||
font-family: "ff-tisa-web-pro-1", "ff-tisa-web-pro-2", "Lucida Grande",
|
||||
"Helvetica Neue", Helvetica, Arial, "Hiragino Sans GB",
|
||||
"Hiragino Sans GB W3", "Microsoft YaHei UI", "Microsoft YaHei",
|
||||
"WenQuanYi Micro Hei", sans-serif;
|
||||
/* font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; */
|
||||
}
|
||||
|
||||
.bottom-logo {
|
||||
align:right;
|
||||
align: right;
|
||||
width: 25%;
|
||||
height: 200px;
|
||||
padding-top: 20px;
|
||||
float: left
|
||||
}
|
||||
|
||||
body{
|
||||
font-size:13px;
|
||||
body {
|
||||
font-size: 13px;
|
||||
}
|
|
@ -3,4 +3,12 @@
|
|||
width: 958px;
|
||||
height: 600px;
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
#font {
|
||||
font-family: "ff-tisa-web-pro-1", "ff-tisa-web-pro-2", "Lucida Grande",
|
||||
"Helvetica Neue", Helvetica, Arial, "Hiragino Sans GB",
|
||||
"Hiragino Sans GB W3", "Microsoft YaHei UI", "Microsoft YaHei",
|
||||
"WenQuanYi Micro Hei", sans-serif;
|
||||
font-weight: bold;
|
||||
}
|
|
@ -58,7 +58,7 @@
|
|||
<div class="container">
|
||||
<div class="pagehead homehead">
|
||||
<div class="hero">
|
||||
<h1>
|
||||
<h1 id="font">
|
||||
<fmt:message key="login_jsp_Title" />
|
||||
</h1>
|
||||
</div>
|
||||
|
|
|
@ -73,17 +73,17 @@ body {
|
|||
</ul>
|
||||
<div class="tab">
|
||||
<ul style="cursor: pointer" class="nav nav-tabs">
|
||||
<li id="tow1" onclick='setTab("tow",1,3);' class="on"><a
|
||||
<li id="tow1" onclick='setTab("tow",1,2);' class="on"><a
|
||||
href="#"><fmt:message key="plugin_jsp_plugins" />(usePlugins)</a></li>
|
||||
<li id="tow2" onclick='setTab("tow",2,3);'><a href="#">参数化(Parameters)</a></li>
|
||||
<li id="tow3" onclick='setTab("tow",3,3);'><a href="#"><fmt:message
|
||||
<!-- <li id="tow2" onclick='setTab("tow",2,3);'><a href="#">参数化(Parameters)</a></li> -->
|
||||
<li id="tow2" onclick='setTab("tow",2,2);'><a href="#"><fmt:message
|
||||
key="plugin_jsp_behavior" /> (behaviors)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tabContent">
|
||||
<div class="span12">
|
||||
<div id="cont_tow_1" class="one block">
|
||||
<div class="box span10">
|
||||
<div class="box span6">
|
||||
<div class="box-header well" data-original-title>
|
||||
<i class="icon-pencil left"></i>
|
||||
<h2>
|
||||
|
@ -96,7 +96,7 @@ body {
|
|||
</div>
|
||||
<div class="box-content row-fluid">
|
||||
|
||||
<div id="pluginArea" class="listArea span6"></div>
|
||||
<div id="pluginArea" class="listArea span8"></div>
|
||||
<div class=" span4 button-div">
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary btn-width"
|
||||
|
@ -119,9 +119,10 @@ body {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span6" id="pluginParams"></div>
|
||||
</div>
|
||||
<div id="cont_tow_2" class="one " style="display: none"></div>
|
||||
<div id="cont_tow_3" class="one " style="display: none">
|
||||
<!-- <div id="cont_tow_2" class="one " style="display: none"></div> -->
|
||||
<div id="cont_tow_2" class="one " style="display: none">
|
||||
<div class="box span6">
|
||||
<div class="box-header well" data-original-title>
|
||||
<i class="icon-pencil left"></i>
|
||||
|
@ -131,10 +132,7 @@ body {
|
|||
(behaviors)
|
||||
</h2>
|
||||
<div class="box-icon">
|
||||
<a href="#" class="btn btn-setting btn-round"><i
|
||||
class="icon-plus"></i></a> <a href="#" class="btn btn-round"><i
|
||||
class="icon-list"></i></a> <a href="#"
|
||||
class="btn btn-minimize btn-round"><i
|
||||
<a href="#" class="btn btn-minimize btn-round"><i
|
||||
class="icon-chevron-up"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
<!DOCTYPE html>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<html>
|
||||
<head>
|
||||
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<title>Agent manage</title>
|
||||
<link id="bs-css" href="lib/chrisma/css/bootstrap-cerulean.css"
|
||||
rel="stylesheet">
|
||||
<link href="lib/chrisma/css/opa-icons.css" rel="stylesheet">
|
||||
<link
|
||||
href="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.2/css/bootstrap-responsive.css"
|
||||
rel="stylesheet">
|
||||
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="images/bench4q.png">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<fmt:bundle basename="i18n">
|
||||
<jsp:include page="publiccontrol/navigatebar.jsp"></jsp:include>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<jsp:include page="publiccontrol/adminleftmenubar.jsp"></jsp:include>
|
||||
<div id="content" class="span10">
|
||||
<div>
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="#"><fmt:message key="home" /></a> <span
|
||||
class="divider">/</span></li>
|
||||
<li><a href="#"><fmt:message key="pluginmanage" /></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row-fluid sortable">
|
||||
<div class="box span12 center">
|
||||
<div class="box-header well" data-original-title>
|
||||
<h2>
|
||||
<i><fmt:message key="pluginManage_jsp_plugin" /></i>
|
||||
</h2>
|
||||
<div class="box-icon">
|
||||
<a class="btn btn-setting btn-round" onClick="showModel();"><i class="icon-plus"></i></a>
|
||||
<a class="btn btn-round" id="agentList"><i
|
||||
class="icon-list"></i></a> <a class="btn btn-minimize btn-round"><i
|
||||
class="icon-chevron-up"></i></a> <a
|
||||
class="btn btn-close btn-round"><i class="icon-remove"></i></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<table id="addPluginTable"
|
||||
class="table table-striped table-bordered bootstrap-datatable datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><fmt:message key="pluginManage_jsp_pluginName" /></th>
|
||||
<th><fmt:message key="pluginManage_jsp_createDate" /></th>
|
||||
<th><fmt:message key="pluginManage_jsp_action" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="modal hide fade " id="myModal_plugin">
|
||||
<div class="modal-header">
|
||||
<button type="button" id="myModal-close" class="close"
|
||||
data-dismiss="modal">×</button>
|
||||
<h3>
|
||||
<fmt:message key="pluginManage_jsp_addPlugin" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" enctype="multipart/form-data"
|
||||
action="uploadPluginFile">
|
||||
<p>
|
||||
file name:<input class="input-mini" type="text"
|
||||
name="pluginFileName" id="fileName">
|
||||
</p>
|
||||
<p>
|
||||
file to upload:<input type="file" name="pluginFile" />
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer"></div>
|
||||
</div>
|
||||
<jsp:include page="publiccontrol/footer.jsp"></jsp:include>
|
||||
|
||||
</div>
|
||||
<script
|
||||
src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script>
|
||||
<script
|
||||
src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script>
|
||||
<script
|
||||
src='http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.js'></script>
|
||||
<script src="lib/bootstrap/js/bootstrap-modal.js"></script>
|
||||
<script
|
||||
src="http://ajax.aspnetcdn.com/ajax/bootstrap/2.3.1/bootstrap.min.js"></script>
|
||||
<script src="lib/bootstrap/js/bootstrap-modal.js"></script>
|
||||
<script src="lib/chrisma/js/jquery.cookie.js"></script>
|
||||
<script src="lib/chrisma/js/theme.js"></script>
|
||||
<script src="lib/jqueryi18n/jquery.i18n.properties-1.0.9.js"></script>
|
||||
<script src="script/base.js"></script>
|
||||
<script src="script/bench4q.table.js"></script>
|
||||
<script src="script/admin/agentManage.js"></script>
|
||||
<script src="script/admin/pluginManage.js"></script>
|
||||
</fmt:bundle>
|
||||
</body>
|
||||
</html>
|
|
@ -62,7 +62,7 @@
|
|||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">x</button>
|
||||
<h3>
|
||||
<fmt:message key="settings" />
|
||||
<fmt:message key="portManage_jsp_addPort" />
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
|
|
@ -1,19 +1,24 @@
|
|||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<div class="span2 main-menu-span">
|
||||
<fmt:bundle basename="i18n">
|
||||
<div class="well nav-collapse sidebar-nav">
|
||||
<ul class="nav nav-tabs nav-stacked main-menu">
|
||||
<li class="nav-header hidden-tablet"><fmt:message key="main" /></li>
|
||||
<li><a class="ajax-link" href="agentManage.jsp"><i
|
||||
class="icon-home"></i><span class="hidden-tablet"><fmt:message key="agentmanage" /></span></a></li>
|
||||
<li><a class="ajax-link" href="portManage.jsp"><i
|
||||
class="icon-eye-open"></i><span class="hidden-tablet"><fmt:message key="portmanage" /></span></a></li>
|
||||
</ul>
|
||||
<label id="for-is-ajax" class="hidden-tablet" for="is-ajax"> <input
|
||||
id="is-ajax" type="checkbox"> Ajax on menu
|
||||
</label>
|
||||
</div>
|
||||
</fmt:bundle>
|
||||
<fmt:bundle basename="i18n">
|
||||
<div class="well nav-collapse sidebar-nav">
|
||||
<ul class="nav nav-tabs nav-stacked main-menu">
|
||||
<li class="nav-header hidden-tablet"><fmt:message key="main" /></li>
|
||||
<li><a class="ajax-link" href="agentManage.jsp"><i
|
||||
class="icon-home"></i><span class="hidden-tablet"><fmt:message
|
||||
key="agentmanage" /></span></a></li>
|
||||
<li><a class="ajax-link" href="portManage.jsp"><i
|
||||
class="icon-eye-open"></i><span class="hidden-tablet"><fmt:message
|
||||
key="portmanage" /></span></a></li>
|
||||
<li><a class="ajax-link" href="pluginManage.jsp"><i
|
||||
class="icon-file"></i><span class="hidden-tablet"><fmt:message
|
||||
key="pluginmanage"></fmt:message></span></a>
|
||||
</ul>
|
||||
<label id="for-is-ajax" class="hidden-tablet" for="is-ajax">
|
||||
<input id="is-ajax" type="checkbox"> Ajax on menu
|
||||
</label>
|
||||
</div>
|
||||
</fmt:bundle>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
var table = $('#addPluginTable');
|
||||
var deleteButton = "<a class='btn btn-info' onClick='deleteScript(this)'><i class='icon-trash icon-white'></i>Delete</a>";
|
||||
|
||||
function showModel() {
|
||||
$('#myModal_plugin').modal('show');
|
||||
$('form').ajaxForm({
|
||||
success : function(data) {
|
||||
$('#myModal_plugin').modal('hide');
|
||||
if (data.success)
|
||||
addPluginDataRow();
|
||||
else
|
||||
alert(data.failedMessage);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addPluginDataRow() {
|
||||
var fileName=$('#fileName').val();
|
||||
table.dataTable().fnAddData([ fileName, Date(), deleteButton ]);
|
||||
}
|
|
@ -24,7 +24,7 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
function loadPluginList() {
|
||||
$.post("loadPlugin", {}, function(data) {
|
||||
$.post("loadPluginName", {}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
|
@ -96,7 +96,7 @@ function createALine(pluginName, index, list) {
|
|||
if (list == "pluginMethodList") {
|
||||
p.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams
|
||||
} else if (list == "pluginChoosedList") {
|
||||
p.setAttribute("onClick", "choosePlugin(" + index + ");");
|
||||
p.setAttribute("onClick", "choosePlugin(this);");// 此处用于显示plugin文档
|
||||
}
|
||||
p.setAttribute("style", "cursor:pointer;width:85%");
|
||||
p.appendChild(i);
|
||||
|
@ -105,8 +105,23 @@ function createALine(pluginName, index, list) {
|
|||
return div;
|
||||
}
|
||||
|
||||
function choosePlugin(index) {
|
||||
clickPluginChoosedNode = index;
|
||||
//实现plug-in参数传递
|
||||
function loadPluginParams(plugin){
|
||||
$.post("loadPluginParams", {
|
||||
pluginName : plugin
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;
|
||||
document.getElementById("pluginParams").innerHTML += createAPage(
|
||||
data, plugin, clickPluginChoosedNode);
|
||||
});
|
||||
}
|
||||
|
||||
function choosePlugin(selectedNode) {
|
||||
clickPluginChoosedNode = $(selectedNode).attr("id");
|
||||
var pluginChoosedNode = $('#pluginArea').children();
|
||||
var length = pluginChoosedNode.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
|
@ -116,6 +131,9 @@ function choosePlugin(index) {
|
|||
$(pluginChoosedNode[i]).find("p").attr("class", "");
|
||||
}
|
||||
}
|
||||
var plugin=selectedNode.lastChild.nodeValue;
|
||||
alert("pluginName="+plugin);
|
||||
loadPluginParams(plugin);
|
||||
}
|
||||
|
||||
function pluginFinish() {
|
||||
|
@ -314,47 +332,34 @@ function loadMethodParams(behaviorData, behaviorIndex) {
|
|||
plugin = temp[0].split('_')[0];
|
||||
var method = temp[1];
|
||||
|
||||
$
|
||||
.post(
|
||||
"loadMethodParameters",
|
||||
{
|
||||
pluginName : plugin,
|
||||
methodName : method
|
||||
},
|
||||
function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;
|
||||
var documentHtml = "";
|
||||
var boxHeader = "";
|
||||
boxHeader = "<div class='box-header well' data-original-title> "
|
||||
+ "<i class='icon-pencil left'></i>"
|
||||
+ "<h2>sample:<i>"
|
||||
+ behaviorData
|
||||
+ "</i></h2></div>";
|
||||
var fieldHTML = createBehaviorsForm(data, behaviorData,
|
||||
behaviorIndex);
|
||||
documentHtml = "<div id='"
|
||||
+ behaviorIndex
|
||||
+ "' class='hide'><p class='hide'>"
|
||||
+ behaviorData
|
||||
+ "</p><div class='span12 box' style='margin-left:-2px;'>"
|
||||
+ boxHeader
|
||||
+ "<div class='box-content'>"
|
||||
+ fieldHTML
|
||||
+ "</div>"
|
||||
/*+"<div class='right table-margin'><button class='btn btn-primary btn-width' type='submit' onClick='saveBehavior(this);'>"
|
||||
+ $.i18n.prop("save")
|
||||
+ "</button>"
|
||||
+ " <button class='btn btn-primary btn-width' type='submit' onClick='cancelBehavior(this);'>"
|
||||
+ $.i18n.prop("cancel")
|
||||
+ "</button></div>" */
|
||||
+"</div></div>";
|
||||
$.post("loadMethodParameters", {
|
||||
pluginName : plugin,
|
||||
methodName : method
|
||||
}, function(data) {
|
||||
if (!data.success) {
|
||||
alert(data.failedMessage);
|
||||
return;
|
||||
}
|
||||
data = data.data;
|
||||
document.getElementById("showPluginMethod").innerHTML += createAPage(
|
||||
data, behaviorData, behaviorIndex);
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById("showPluginMethod").innerHTML += documentHtml;
|
||||
});
|
||||
// 生成页面显示
|
||||
function createAPage(data, behaviorData, behaviorIndex) {
|
||||
var documentHtml = "";
|
||||
var boxHeader = "";
|
||||
boxHeader = "<div class='box-header well' data-original-title> "
|
||||
+ "<i class='icon-pencil left'></i>" + "<h2>sample:<i>"
|
||||
+ behaviorData + "</i></h2></div>";
|
||||
var fieldHTML = createBehaviorsForm(data, behaviorData, behaviorIndex);
|
||||
documentHtml = "<div id='" + behaviorIndex
|
||||
+ "' class='hide'><p class='hide'>" + behaviorData
|
||||
+ "</p><div class='span12 box' style='margin-left:-2px;'>"
|
||||
+ boxHeader + "<div class='box-content'>" + fieldHTML + "</div>"
|
||||
+ "</div></div>";
|
||||
return documentHtml;
|
||||
}
|
||||
|
||||
function saveBehavior(selectedNode) {
|
||||
|
@ -363,15 +368,15 @@ function saveBehavior(selectedNode) {
|
|||
saveABehavior(div);
|
||||
}
|
||||
|
||||
function submit(selectedNode){
|
||||
function submit(selectedNode) {
|
||||
var scriptName = $(selectedNode.parentNode.parentNode).find("input").val();
|
||||
var children=document.getElementById("showPluginMethod").childNodes;
|
||||
var length=children.length;
|
||||
for(var i=0;i<length;i++){
|
||||
for(var j=0;j<length;j++){
|
||||
var node=children[j];
|
||||
if($(node).attr("id")==i){
|
||||
var div=node.lastChild.firstChild.nextSibling.childNodes;
|
||||
var children = document.getElementById("showPluginMethod").childNodes;
|
||||
var length = children.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
for (var j = 0; j < length; j++) {
|
||||
var node = children[j];
|
||||
if ($(node).attr("id") == i) {
|
||||
var div = node.lastChild.firstChild.nextSibling.childNodes;
|
||||
saveABehavior(div);
|
||||
break;
|
||||
}
|
||||
|
@ -382,7 +387,7 @@ function submit(selectedNode){
|
|||
}
|
||||
}
|
||||
|
||||
function saveABehavior(div){
|
||||
function saveABehavior(div) {
|
||||
var length = div.length;
|
||||
var behaviorIndex = 0, use = "", name = "", type = "";
|
||||
var plugin_method = div[0].parentNode.parentNode.previousSibling.firstChild.nodeValue
|
||||
|
@ -487,7 +492,6 @@ function makeUsePluginList() {
|
|||
}
|
||||
|
||||
function submitBehaviors(scriptName) {
|
||||
/*var scriptName = $(selectedNode.parentNode.parentNode).find("input").val();*/
|
||||
if (scriptName == null || scriptName == "") {
|
||||
alert("Please input scriptName.");
|
||||
return;
|
||||
|
|
|
@ -1,221 +1,51 @@
|
|||
$(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
var choosePlugin;
|
||||
function addPlugin() {
|
||||
$('#myModal_Plugin').modal('show');
|
||||
$("input[type='radio'][name='radio'][value='HttpPlugin']").attr("checked",
|
||||
"checked");
|
||||
|
||||
$("input:radio").click(function() {
|
||||
|
||||
$(this).attr("checked", "checked");
|
||||
});
|
||||
|
||||
}
|
||||
var commandListPlugin = 0;
|
||||
var constantTimerPlugin = 0;
|
||||
var httpPlugin = 0;
|
||||
var logPlugin = 0;
|
||||
var num = 0;
|
||||
var data;
|
||||
function pluginFinish() {
|
||||
|
||||
$('#myModal_Plugin').modal('hide');
|
||||
var item = $("input[name='radio']:checked").val();
|
||||
data = item + "_" + num;
|
||||
num++;
|
||||
|
||||
// 显示到pluginArea中
|
||||
var newTrNode = document.createElement("tr");
|
||||
var newTdNode1 = document.createElement("td");
|
||||
var newTdNode2 = document.createElement("td");
|
||||
var i = document.createElement("i");
|
||||
i.setAttribute("class", "icon-ok-sign");
|
||||
i.setAttribute("style", "cursor:pointer");
|
||||
i.setAttribute("onClick", "showInsertPlugin(this)");
|
||||
var textNode = document.createTextNode(data);
|
||||
|
||||
newTrNode.setAttribute("id", data);
|
||||
newTdNode1.setAttribute("style", "width:40px;cursor:pointer;");
|
||||
newTdNode1.appendChild(textNode);
|
||||
newTdNode2.appendChild(i);
|
||||
newTrNode.appendChild(newTdNode1);
|
||||
newTrNode.appendChild(newTdNode2);
|
||||
document.getElementById("pluginAreaTable").appendChild(newTrNode);
|
||||
}
|
||||
|
||||
function insertPlugin(){
|
||||
$('#myModal_Behavior').modal('show');
|
||||
var table=$('#pluginAreaTable').html();
|
||||
document.getElementById("insertPluginAreaPlugins").innerHTML=table;
|
||||
}
|
||||
|
||||
var html;
|
||||
function showInsertPlugin(selectNode){
|
||||
var textNode=selectNode.parentNode.previousSibling.firstChild;
|
||||
var data=textNode.nodeValue;
|
||||
//得到_前的内容
|
||||
var type=data.split("_");
|
||||
var result=type[0];
|
||||
//document.write(result);
|
||||
if(result=="HttpPlugin"){
|
||||
html="<tr><td><a id='httpPlugin_post' style='cursor: pointer;' onClick='showMethodPost();'>HttpPlugin.post</a></td></tr>"
|
||||
+"<tr><td><a id='httpPlugin_get' style='cursor: pointer;' onClick='showMethodGet();'>HttpPlugin.get</td></tr>"
|
||||
+"<tr><td><a id='httpPlugin_put' style='cursor: pointer;' onClick='showMethodPut();'>HttpPlugin.put</a></td></tr>"
|
||||
+"<tr><td><a id='httpPlugin_delete' style='cursor: pointer;' onClick='showMethodDelete();'>HttpPlugin.delete</a></td></tr>";
|
||||
}
|
||||
document.getElementById("pluginMethod").innerHTML=html;
|
||||
}
|
||||
|
||||
function showMethodPost(){
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
$('#httpPlugin_post').attr("class", "");
|
||||
}
|
||||
|
||||
function showMethodGet(){
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
$('#httpPlugin_get').attr("class", "");
|
||||
}
|
||||
|
||||
function showMethodPut(){
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
$('#httpPlugin_put').attr("class", "");
|
||||
}
|
||||
|
||||
function showMethodDelete(){
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
$('#httpPlugin_delete').attr("class", "");
|
||||
}
|
||||
|
||||
function pluginCancel() {
|
||||
$('#myModal_Plugin').modal('hide');
|
||||
}
|
||||
|
||||
function removeInsertPlugin(){
|
||||
|
||||
}
|
||||
|
||||
$('#removePlugin').click(function() {
|
||||
|
||||
});
|
||||
|
||||
$('#removeAllPlugin').click(function() {
|
||||
document.getElementById('pluginAreaTable').innerHTML="";
|
||||
});
|
||||
|
||||
$('#behaviorFinish').click(function() {
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
});
|
||||
|
||||
$('#behaviorCancel').click(function() {
|
||||
$('#myModal_Behavior').modal('hide');
|
||||
});
|
||||
|
||||
var field = 0;
|
||||
function addField() {
|
||||
|
||||
var data = "field_" + field + ":";
|
||||
field = field + 1;
|
||||
var newTrNode = document.createElement("tr");
|
||||
var newTdNode1 = document.createElement("td");
|
||||
var newTdNode2 = document.createElement("td");
|
||||
var newTdNode3 = document.createElement("td");
|
||||
var i = document.createElement("i");
|
||||
i.setAttribute("class", "icon-trash");
|
||||
i.setAttribute("style", "cursor:pointer");
|
||||
i.setAttribute("onClick", "deleteField(this)");
|
||||
newTdNode1.setAttribute("style", "width:40px;cursor:pointer;");
|
||||
newTdNode1.setAttribute("class", data);
|
||||
newTdNode2.setAttribute("style", "width:40px;");
|
||||
var textNode = document.createTextNode(data);
|
||||
var inputNode = document.createElement("input");
|
||||
inputNode.setAttribute("type", "text");
|
||||
inputNode.setAttribute("size", 20);
|
||||
|
||||
newTdNode1.appendChild(textNode);
|
||||
newTdNode2.appendChild(inputNode);
|
||||
newTdNode3.appendChild(i);
|
||||
newTrNode.appendChild(newTdNode1);
|
||||
newTrNode.appendChild(newTdNode2);
|
||||
newTrNode.appendChild(newTdNode3);
|
||||
document.getElementById("addFieldTable").appendChild(newTrNode);
|
||||
}
|
||||
function deleteField(selectedNode) {
|
||||
var deletedNode = selectedNode.parentNode.parentNode;
|
||||
var parentNode = deletedNode.parentNode;
|
||||
parentNode.removeChild(deletedNode);
|
||||
}
|
||||
function removeField() {
|
||||
$('#addFieldTable').empty();
|
||||
}
|
||||
|
||||
function addHeaders() {
|
||||
var newTrNode = document.createElement("tr");
|
||||
var newTdNode1 = document.createElement("td");
|
||||
var newTdNode2 = document.createElement("td");
|
||||
var newTdNode3 = document.createElement("td");
|
||||
var i = document.createElement("i");
|
||||
i.setAttribute("class", "icon-trash");
|
||||
i.setAttribute("style", "cursor:pointer");
|
||||
i.setAttribute("onClick", "deleteHeaders(this)");
|
||||
var inputNode1 = document.createElement("input");
|
||||
var inputNode2 = document.createElement("input");
|
||||
|
||||
inputNode1.setAttribute("type", "text");
|
||||
inputNode1.setAttribute("size", 20);
|
||||
inputNode2.setAttribute("type", "text");
|
||||
inputNode2.setAttribute("size", 20);
|
||||
|
||||
newTdNode1.appendChild(inputNode1);
|
||||
newTdNode2.appendChild(inputNode2);
|
||||
newTdNode3.appendChild(i);
|
||||
newTrNode.appendChild(newTdNode1);
|
||||
newTrNode.appendChild(newTdNode2);
|
||||
newTrNode.appendChild(newTdNode3);
|
||||
document.getElementById("addHeadersTable").appendChild(newTrNode);
|
||||
}
|
||||
|
||||
function deleteHeaders(selectedNode) {
|
||||
var deletedNode = selectedNode.parentNode.parentNode;
|
||||
var parentNode = deletedNode.parentNode;
|
||||
parentNode.removeChild(deletedNode);
|
||||
}
|
||||
|
||||
function removeHeaders() {
|
||||
$('#addHeadersTable').empty();
|
||||
}
|
||||
var bodyField = 0;
|
||||
function addBodyField() {
|
||||
var data = "field_" + bodyField + ":";
|
||||
bodyField = bodyField + 1;
|
||||
var newTrNode = document.createElement("tr");
|
||||
var newTdNode1 = document.createElement("td");
|
||||
var newTdNode2 = document.createElement("td");
|
||||
var newTdNode3 = document.createElement("td");
|
||||
var i = document.createElement("i");
|
||||
i.setAttribute("class", "icon-trash");
|
||||
i.setAttribute("style", "cursor:pointer");
|
||||
i.setAttribute("onClick", "deleteField(this)");
|
||||
newTdNode1.setAttribute("style", "width:40px;cursor:pointer;");
|
||||
newTdNode1.setAttribute("class", data);
|
||||
newTdNode2.setAttribute("style", "width:40px;");
|
||||
var textNode = document.createTextNode(data);
|
||||
var inputNode = document.createElement("input");
|
||||
inputNode.setAttribute("type", "text");
|
||||
inputNode.setAttribute("size", 20);
|
||||
|
||||
newTdNode1.appendChild(textNode);
|
||||
newTdNode2.appendChild(inputNode);
|
||||
newTdNode3.appendChild(i);
|
||||
newTrNode.appendChild(newTdNode1);
|
||||
newTrNode.appendChild(newTdNode2);
|
||||
newTrNode.appendChild(newTdNode3);
|
||||
document.getElementById("addBodyFieldTable").appendChild(newTrNode);
|
||||
}
|
||||
|
||||
function removeBodyField() {
|
||||
$('#addBodyFieldTable').empty();
|
||||
}
|
||||
|
||||
var img_num = 0;
|
||||
$(function() {
|
||||
$('.news1').find('li').hover(function() {
|
||||
$(this).addClass('li_now');
|
||||
}, function() {
|
||||
$(this).removeClass('li_now');
|
||||
});
|
||||
for (var i = 0; i < $('.case1').find('li').length; i++) {
|
||||
if (i % 3 == 2) {
|
||||
// alert(i);
|
||||
$('.case1').find('li').eq(i).addClass('li_now');
|
||||
}
|
||||
}
|
||||
|
||||
$('.btn_right').click(function() {
|
||||
clearInterval(timerID);
|
||||
if (img_num < $('.flash_div').find('.div_td').length - 1) {
|
||||
img_num++;
|
||||
} else {
|
||||
img_num = 0;
|
||||
}
|
||||
$('.flash_div').find('.div_box').animate({
|
||||
scrollLeft : 891 * img_num
|
||||
}, "slow");
|
||||
timerID = setInterval("flash_div_fun()", 5000);
|
||||
});
|
||||
$('.btn_left').click(function() {
|
||||
clearInterval(timerID);
|
||||
if (img_num > 0) {
|
||||
img_num--;
|
||||
} else {
|
||||
img_num = $('.flash_div').find('.div_td').length - 1;
|
||||
}
|
||||
$('.flash_div').find('.div_box').animate({
|
||||
scrollLeft : 891 * img_num
|
||||
}, "slow");
|
||||
timerID = setInterval("flash_div_fun()", 5000);
|
||||
});
|
||||
timerID = setInterval("flash_div_fun()", 5000);
|
||||
|
||||
});
|
||||
function flash_div_fun() {
|
||||
if (img_num < $('.flash_div').find('.div_td').length - 1) {
|
||||
img_num++;
|
||||
} else {
|
||||
img_num = 0;
|
||||
}
|
||||
$('.flash_div').find('.div_box').animate({
|
||||
scrollLeft : 891 * img_num
|
||||
}, "slow");
|
||||
}
|
Loading…
Reference in New Issue