Revert "add content Verification"

This reverts commit 885758c3d3.
This commit is contained in:
daisyonly 2014-08-29 10:26:55 +08:00
parent 885758c3d3
commit 2d2739f7ad
5 changed files with 17 additions and 78 deletions

View File

@ -1,38 +1,5 @@
$(function() {
$(document).ready(function(){
$("#behaviorEditor").on("focusout",".editor input",function(){
var input = $(this);
if(input.attr("required") == "required" && input.val() == ""){
information("Please fill in the parameter");
input.focus();
}
})
});
});
function checkPluginsInput(plugins) {
for (var i = 0; i < plugins.length; i++){
for (var j = 0; j < plugins[i].parameters.length; j++){
if (plugins[i].parameters[j].check =="false")
return false;
}
}
return true;
}
function checkPagesInput(pages) {
for (var i = 0;i < pages.length; i++){
console.log(pages[i].batches.length);
for (var j = 0; j < pages[i].batches.length; j++){
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++){
if (pages[i].batches[j].behaviors[k].parameters[q].check == "false"){
return false;
}
}
}
}
}
return true;
}
$(document).ready(function(){
$("#behaviorEditor").on("focusout",".editor input",function(){
console.log(this);
})
});

View File

@ -6,9 +6,6 @@ $(function() {
$("#submitScript").click(function() {
var plugins = usePlugin.getPlugins();
var pages = usePlugin.getPages();
if(checkPluginsInput(plugins) && checkPagesInput(pages))
submitScript(pages,plugins);
else
information("必填的参数没有填写完整,请补充完整后提交");
submitScript(pages,plugins);
});
});

View File

@ -1,11 +1,6 @@
var Parameter = function(key, value, check) {
var Parameter = function(key, value) {
this.key = key;
this.value = value;
if (check == undefined)
this.check = "true";
else
this.check = check;
}
var DataCollector = function() {
};
@ -29,26 +24,19 @@ DataCollector.prototype.fieldData = function(editor) {
var name = $(editor).attr("id");
editor = $(editor.children('.field'));
var value = editor.children("input").val();
var required = editor.children("input").attr("required");
var check = "true";
if (required == "required" && value == "")
check = "false";
// if (!this.validate(value)) {
// return false;
// }
return new Parameter(name, value, check);
return new Parameter(name, value);
};
DataCollector.prototype.dateData = function(editor) {
var name = editor.attr("id");
var value = editor.children("input").val();
var required = editor.children("input").attr("required");
var check = "true";
if (required == "required" && value == "")
check = "false";
// if (!this.validate(value)) {
// return false;
// }
return new Parameter(name, value, check);
return new Parameter(name, value);
};
DataCollector.prototype.multiFieldData = function(editor) {
var editorArray = editor.children(".field");
@ -59,13 +47,9 @@ DataCollector.prototype.multiFieldData = function(editor) {
}
var name = editor.attr("id")
var value = "";
var check = "true";
for ( var i = 0; i < editorArray.length; i++) {
var fieldValue = $(editorArray[i]).children("input").val();
var tmpRequired = $(editorArray[i]).children("input").attr("required");
if (tmpRequired =="required" && fieldValue == ""){
check = "false";
}
if (fieldValue == "") {
continue;
}
@ -76,7 +60,7 @@ DataCollector.prototype.multiFieldData = function(editor) {
// if (!this.validate(value)) {
// return false;
// }
return new Parameter(name, value, check);
return new Parameter(name, value);
};
@ -85,15 +69,10 @@ DataCollector.prototype.tableData = function(editor) {
var editorArray = editor.find("tbody").children("tr");
var name = editor.attr("id");
var value = "";
var check = "true";
for ( var i = 0; i < editorArray.length; i++) {
var tdArray = $(editorArray[i]).children("td");
var trValue = "";
for ( var j = 0; j < tdArray.length; j++) {
var tmpRequired = $(tdArray[j]).children("input").attr("required");
var tmpValue = $(tdArray[j]).children("input").val();
if (tmpRequired == "Required" && tmpValue == "")
check = "false";
if ($(tdArray[j]).children("input").val() == undefined
|| $(tdArray[j]).children("input").val() == "") {
continue;
@ -109,7 +88,7 @@ DataCollector.prototype.tableData = function(editor) {
// if (!this.validate(value)) {
// return false;
// }
return new Parameter(name, value, check);
return new Parameter(name, value);
};
DataCollector.prototype.selectData = function(editor) {

View File

@ -101,7 +101,7 @@ EditorFactory.prototype.createFieldLine = function(size, name, required, value)
$(fieldName).html(name);
var field = document.createElement("input");
$(field).attr("type", "text");
if(required == "true"){
if(required=="true"){
$(field).attr("required", "required");
}
// $(field).attr("maxlength", size);
@ -227,7 +227,7 @@ function(label, name, required, cols, id, value) {
$(input).attr("type", "text");
$(input).attr("style","width:"+"90%");
if(required == "true"){
$(input).attr("required", "required");
$(field).attr("required", "required");
}
if(values[i] != undefined){
$(input).val(values[i].split("=")[1]);
@ -280,7 +280,7 @@ EditorFactory.prototype.createDate = function(label, name, required, size, id, v
var date = document.createElement("input");
$(date).attr("type", "date");
if(required == "true"){
$(date).attr("required", "required");
$(field).attr("required", "required");
}
$(div).children(".editor").append(dateLabel);
$(div).children(".editor").append(date);

View File

@ -28,7 +28,6 @@ $(function() {
var scriptId = getvars()['scriptId'];
var usePlugin = new UsePlugin("useBehaviorList");
getScriptObject(scriptId,usePlugin);
$("#scriptName").val(getvars()['name']);
$("#tabs").tabs();
@ -37,10 +36,7 @@ $(function() {
$("#submitScript").click(function() {
var plugins = usePlugin.getPlugins();
var pages = usePlugin.getPages();
if(checkPluginsInput(plugins) && checkPagesInput(pages))
updateScript(scriptId,pages,plugins);
else
information("必填的参数没有填写完整,请补充完整后提交");
updateScript(scriptId,pages,plugins);
});
});