edit usePlugin

This commit is contained in:
luqiong 2014-08-21 13:40:00 +08:00
parent 41f7dd7b42
commit 8ff57d21dc
2 changed files with 16 additions and 21 deletions

View File

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

View File

@ -6,17 +6,18 @@ function PluginModel(id, name) {
}
function UsePlugin() {
this.containerId = "usePluginList";
var usePlugin = this;
this.map = new HashMap();
this.index = 1;
this.usePluginEditorMap = new HashMap();
jstreeCreate(this.containerId);
$("#addPlugin").click(function() {
$("#addPlugin").addClass("clicked");
$("#selectUsePlugin").modal('show');
});
$("#deletePlugin").click(function() {
});
$("#selectUsePlugin #ok").click(
function() {
var pluginName = $(
@ -25,36 +26,29 @@ function UsePlugin() {
return;
}
var pluginModel = new PluginModel(usePlugin.index, pluginName);
$("#usePluginList").append(
createRadio( pluginModel.id, pluginModel.nickName,
"usePlugin",pluginModel.name));
pos = "after";
jstreeCreateNode("usePluginList",pluginName,pluginName,usePlugin.index,pos);
usePlugin.map.put(pluginModel.id, pluginModel);
usePlugin.updateUsePlugin();
usePlugin.createEditor(pluginModel);
usePlugin.index++;
$("#selectUsePlugin").modal('hide');
});
$("#selectUsePlugin #cancel").click(function() {
$("#selectUsePlugin").modal('hide');
});
$("#removePlugin").click(
function() {
var pluginId = $(
"#usePluginList input[name='usePlugin']:checked").attr(
"id");
if (pluginId == undefined) {
var pluginId = getSelectedNodes(usePlugin.containerId);
if (!pluginId.length) {
return;
} else {
usePlugin.map.remove(pluginId);
usePlugin.usePluginEditorMap.remove(pluginId);
usePlugin.createUsePlugin(usePlugin.map);
}
}
usePlugin.map.remove(pluginId);
usePlugin.usePluginEditorMap.remove(pluginId);
jstreeDeleteNode(usePlugin.containerId);
// usePlugin.createUsePlugin(usePlugin.map);
$("#usePluginEditor").attr("usePlugin", "");
$("#usePluginEditor").html("");
@ -63,6 +57,7 @@ function UsePlugin() {
$("#usePluginList").html("");
usePlugin.map.clear();
usePlugin.usePluginEditorMap.clear();
//jstreeClearNode(usePlugin.containerId);
});
this.createUsePlugin = function(map) {
$("#usePluginList").html("");