Conflicts:
	Bench4Q-Web/src/main/webapp/script/editor/usePlugin.js
This commit is contained in:
hmm 2014-08-21 13:38:38 +08:00
commit ee901e8633
2 changed files with 14 additions and 19 deletions

View File

@ -79,7 +79,7 @@ function jstreeCreate(containerId){
"themes" : { "stripes" : true } "themes" : { "stripes" : true }
}, },
"types" : { "types" : {
"#" : { "max_depth" : 4, "valid_children" : ["page"] }, "#" : { "max_depth" : 4, "valid_children" : ["page","default"] },
"page" : { "icon" : false, "valid_children" : ["batch"] }, "page" : { "icon" : false, "valid_children" : ["batch"] },
"batch" : { "icon" : false, "valid_children" : ["default"] }, "batch" : { "icon" : false, "valid_children" : ["default"] },
"default" : { "icon" : false, "valid_children" : [] } "default" : { "icon" : false, "valid_children" : [] }

View File

@ -6,21 +6,19 @@ function PluginModel(id, name) {
} }
function UsePlugin() { function UsePlugin() {
var containerId = "usePluginList"; var containerId = "usePluginList";
var usePlugin = this; var usePlugin = this;
this.map = new HashMap(); this.map = new HashMap();
this.index = 1; this.index = 1;
this.usePluginEditorMap = new HashMap(); this.usePluginEditorMap = new HashMap();
//init tree //init tree
jstreeCreate(containerId); jstreeCreate(containerId);
$("#addPlugin").click(function() { $("#addPlugin").click(function() {
$("#addPlugin").addClass("clicked"); $("#addPlugin").addClass("clicked");
$("#selectUsePlugin").modal('show'); $("#selectUsePlugin").modal('show');
}); });
$("#deletePlugin").click(function() {
});
$("#selectUsePlugin #ok").click( $("#selectUsePlugin #ok").click(
function() { function() {
var pluginName = $( var pluginName = $(
@ -34,32 +32,28 @@ function UsePlugin() {
// $("#usePluginList").append( // $("#usePluginList").append(
// createRadio( pluginModel.id, pluginModel.nickName, // createRadio( pluginModel.id, pluginModel.nickName,
// "usePlugin",pluginModel.name)); // "usePlugin",pluginModel.name));
usePlugin.map.put(pluginModel.id, pluginModel); usePlugin.map.put(pluginModel.id, pluginModel);
usePlugin.updateUsePlugin(); usePlugin.updateUsePlugin();
usePlugin.createEditor(pluginModel); usePlugin.createEditor(pluginModel);
usePlugin.index++; usePlugin.index++;
$("#selectUsePlugin").modal('hide'); $("#selectUsePlugin").modal('hide');
}); });
$("#selectUsePlugin #cancel").click(function() { $("#selectUsePlugin #cancel").click(function() {
$("#selectUsePlugin").modal('hide'); $("#selectUsePlugin").modal('hide');
}); });
$("#removePlugin").click( $("#removePlugin").click(
function() { function() {
var pluginId = $( var pluginId = getSelectedNodes(usePlugin.containerId);
"#usePluginList input[name='usePlugin']:checked").attr( if (!pluginId.length) {
"id");
if (pluginId == undefined) {
return; return;
} else { }
usePlugin.map.remove(pluginId); usePlugin.map.remove(pluginId);
usePlugin.usePluginEditorMap.remove(pluginId); usePlugin.usePluginEditorMap.remove(pluginId);
usePlugin.createUsePlugin(usePlugin.map); jstreeDeleteNode(usePlugin.containerId);
} // usePlugin.createUsePlugin(usePlugin.map);
$("#usePluginEditor").attr("usePlugin", ""); $("#usePluginEditor").attr("usePlugin", "");
$("#usePluginEditor").html(""); $("#usePluginEditor").html("");
@ -68,6 +62,7 @@ function UsePlugin() {
$("#usePluginList").html(""); $("#usePluginList").html("");
usePlugin.map.clear(); usePlugin.map.clear();
usePlugin.usePluginEditorMap.clear(); usePlugin.usePluginEditorMap.clear();
//jstreeClearNode(usePlugin.containerId);
}); });
this.createUsePlugin = function(map) { this.createUsePlugin = function(map) {
$("#usePluginList").html(""); $("#usePluginList").html("");