return to the incomplete input when submit script
return to the incomplete input when submit script
This commit is contained in:
parent
270c4b8d14
commit
bc164c3ece
|
@ -326,6 +326,10 @@ function Behavior(usePlugin, containerId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.getBehaviorEditorMap = function(){
|
||||||
|
return behaviorEditorMap;
|
||||||
|
}
|
||||||
|
|
||||||
this.getPages = function() {
|
this.getPages = function() {
|
||||||
updateBehaviorEditors();
|
updateBehaviorEditors();
|
||||||
var treeObj = $("#" + containerId).jstree(true);
|
var treeObj = $("#" + containerId).jstree(true);
|
||||||
|
|
|
@ -16,22 +16,46 @@ $(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function checkPluginsInput(plugins) {
|
function checkPluginsInput(plugins, usePlugin) {
|
||||||
|
|
||||||
for (var i = 0; i < plugins.length; i++){
|
for (var i = 0; i < plugins.length; i++){
|
||||||
for (var j = 0; j < plugins[i].parameters.length; j++){
|
for (var j = 0; j < plugins[i].parameters.length; j++){
|
||||||
if (plugins[i].parameters[j].check =="false")
|
if (plugins[i].parameters[j].check =="false"){
|
||||||
|
$("#tabs").tabs("option", "active", 0 );
|
||||||
|
|
||||||
|
var usePluginEditorMap = usePlugin.getUsePluginEditorMap();
|
||||||
|
$("#pluginEditor").append(usePluginEditorMap.get(plugins[i].id));
|
||||||
|
var inputs = $("#"+ plugins[i].parameters[j].key + " input");
|
||||||
|
for (var p = 0; p < inputs.length; p++){
|
||||||
|
if ($(inputs[p]).val() == ""){
|
||||||
|
$(inputs[p]).focus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPagesInput(pages) {
|
function checkPagesInput(pages, usePlugin) {
|
||||||
|
|
||||||
for (var i = 0;i < pages.length; i++){
|
for (var i = 0;i < pages.length; i++){
|
||||||
for (var j = 0; j < pages[i].batches.length; j++){
|
for (var j = 0; j < pages[i].batches.length; j++){
|
||||||
for (var k = 0; k < pages[i].batches[j].behaviors.length; k++){
|
for (var k = 0; k < pages[i].batches[j].behaviors.length; k++){
|
||||||
for (var q = 0; q < pages[i].batches[j].behaviors[k].parameters.length; q++){
|
for (var q = 0; q < pages[i].batches[j].behaviors[k].parameters.length; q++){
|
||||||
if (pages[i].batches[j].behaviors[k].parameters[q].check =="false"){
|
if (pages[i].batches[j].behaviors[k].parameters[q].check =="false"){
|
||||||
|
$("#tabs").tabs("option", "active", 1 );
|
||||||
|
var behaviorEditorMap = usePlugin.getBehaviorEditorMap();
|
||||||
|
$("#behaviorEditor").append(behaviorEditorMap.get(pages[i].batches[j].behaviors[k].id));
|
||||||
|
var inputs = $("#"+ pages[i].batches[j].behaviors[k].parameters[q].key + " input");
|
||||||
|
for (var p = 0; p < inputs.length; p++){
|
||||||
|
if ($(inputs[p]).val() == ""){
|
||||||
|
$(inputs[p]).focus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,10 @@ $(function() {
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
var plugins = usePlugin.getPlugins(formData);
|
var plugins = usePlugin.getPlugins(formData);
|
||||||
var pages = usePlugin.getPages();
|
var pages = usePlugin.getPages();
|
||||||
if(checkPluginsInput(plugins) && checkPagesInput(pages))
|
if(checkPluginsInput(plugins, usePlugin) && checkPagesInput(pages, usePlugin))
|
||||||
submitScript(pages, plugins, formData);
|
submitScript(pages, plugins, formData);
|
||||||
else
|
else{
|
||||||
information("Please complete the required parameters.");
|
information("Please complete the required parameters.");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@ $(function() {
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
var plugins = usePlugin.getPlugins(formData);
|
var plugins = usePlugin.getPlugins(formData);
|
||||||
var pages = usePlugin.getPages();
|
var pages = usePlugin.getPages();
|
||||||
if(checkPluginsInput(plugins) && checkPagesInput(pages))
|
if(checkPluginsInput(plugins, usePlugin) && checkPagesInput(pages, usePlugin))
|
||||||
updateScript(scriptId,pages,plugins,formData);
|
updateScript(scriptId,pages,plugins,formData);
|
||||||
else
|
else
|
||||||
information("Please complete the required parameters.");
|
information("Please complete the required parameters.");
|
||||||
|
|
|
@ -85,6 +85,11 @@ function UsePlugin(behaviorListContainerId) {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.getUsePluginEditorMap = function() {
|
||||||
|
return usePluginEditorMap;
|
||||||
|
}
|
||||||
|
|
||||||
function getPluginList() {
|
function getPluginList() {
|
||||||
var usePlugin = this;
|
var usePlugin = this;
|
||||||
$.post("loadPluginName", {}, function(data) {
|
$.post("loadPluginName", {}, function(data) {
|
||||||
|
@ -197,6 +202,10 @@ function UsePlugin(behaviorListContainerId) {
|
||||||
return behavior.getPages();
|
return behavior.getPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.getBehaviorEditorMap = function(){
|
||||||
|
return behavior.getBehaviorEditorMap();
|
||||||
|
}
|
||||||
|
|
||||||
this.initPluginAndPages = function(scriptObj){
|
this.initPluginAndPages = function(scriptObj){
|
||||||
initPluginList(scriptObj.usePlugins);
|
initPluginList(scriptObj.usePlugins);
|
||||||
behavior.initBehaviorList(scriptObj.pages);
|
behavior.initBehaviorList(scriptObj.pages);
|
||||||
|
|
Loading…
Reference in New Issue