parent
fccd5d0a27
commit
9fc76cf05e
|
@ -1,15 +1,17 @@
|
||||||
var EditorFactory = function() {
|
var EditorFactory = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
EditorFactory.prototype.createBaseEditor = function(label, id) {
|
EditorFactory.prototype.createBaseEditor = function(label, id, required) {
|
||||||
if (label == null) {
|
if (label == null) {
|
||||||
label = "";
|
label = "";
|
||||||
}
|
}
|
||||||
var containerBox = document.createElement("div");
|
var containerBox = document.createElement("div");
|
||||||
$(containerBox).addClass("containerBox");
|
$(containerBox).addClass("containerBox");
|
||||||
var boxHeader = document.createElement("div");
|
var boxHeader = document.createElement("div");
|
||||||
var p = document.createElement("p")
|
var p = document.createElement("p");
|
||||||
$(p).html(label)
|
if (required == "true")
|
||||||
|
label = label + "   (required)";
|
||||||
|
$(p).html(label);
|
||||||
$(boxHeader).append(p);
|
$(boxHeader).append(p);
|
||||||
$(boxHeader).addClass("containerHeader")
|
$(boxHeader).addClass("containerHeader")
|
||||||
$(containerBox).append(boxHeader);
|
$(containerBox).append(boxHeader);
|
||||||
|
@ -51,7 +53,7 @@ EditorFactory.prototype.createChoice = function(value, defaultValue, name,
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorFactory.prototype.createField = function(label, name, required, size, id, value) {
|
EditorFactory.prototype.createField = function(label, name, required, size, id, value) {
|
||||||
var div = this.createBaseEditor(label, id);
|
var div = this.createBaseEditor(label, id, required);
|
||||||
$(div).children(".editor").attr("editorType", "field");
|
$(div).children(".editor").attr("editorType", "field");
|
||||||
$(div).children(".editor").append(this.createFieldLine(size, name, required, value));
|
$(div).children(".editor").append(this.createFieldLine(size, name, required, value));
|
||||||
return div;
|
return div;
|
||||||
|
@ -59,7 +61,7 @@ EditorFactory.prototype.createField = function(label, name, required, size, id,
|
||||||
|
|
||||||
EditorFactory.prototype.createMultiField = function(label, name, required, size, id,
|
EditorFactory.prototype.createMultiField = function(label, name, required, size, id,
|
||||||
value) {
|
value) {
|
||||||
var div = this.createBaseEditor(label, id);
|
var div = this.createBaseEditor(label, id, required);
|
||||||
$(div).children(".editor").attr("editorType", "multiField");
|
$(div).children(".editor").attr("editorType", "multiField");
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
var values = value.split(";");
|
var values = value.split(";");
|
||||||
|
@ -114,7 +116,7 @@ EditorFactory.prototype.createFile = function(label, name, required, size, id, v
|
||||||
size = 150;
|
size = 150;
|
||||||
}
|
}
|
||||||
|
|
||||||
var div = this.createBaseEditor(label, id);
|
var div = this.createBaseEditor(label, id, required);
|
||||||
$(div).children(".editor").attr("editorType", "file");
|
$(div).children(".editor").attr("editorType", "file");
|
||||||
var fileEditor = document.createElement("div");
|
var fileEditor = document.createElement("div");
|
||||||
|
|
||||||
|
@ -142,7 +144,7 @@ EditorFactory.prototype.createTable = /**
|
||||||
*/
|
*/
|
||||||
function(label, name, required, cols, id, value) {
|
function(label, name, required, cols, id, value) {
|
||||||
|
|
||||||
var div = this.createBaseEditor(label, id);
|
var div = this.createBaseEditor(label, id, required);
|
||||||
$(div).children(".editor").attr("editorType", "table");
|
$(div).children(".editor").attr("editorType", "table");
|
||||||
var headers = getHeaders(cols);
|
var headers = getHeaders(cols);
|
||||||
|
|
||||||
|
@ -273,7 +275,7 @@ EditorFactory.prototype.createDate = function(label, name, required, size, id, v
|
||||||
if (size == null || size < 0) {
|
if (size == null || size < 0) {
|
||||||
size = 150
|
size = 150
|
||||||
}
|
}
|
||||||
var div = this.createBaseEditor(label, id);
|
var div = this.createBaseEditor(label, id, required);
|
||||||
$(div).children(".editor").attr("editorType", "date");
|
$(div).children(".editor").attr("editorType", "date");
|
||||||
var dateLabel = document.createElement("label");
|
var dateLabel = document.createElement("label");
|
||||||
$(dateLabel).html(name);
|
$(dateLabel).html(name);
|
||||||
|
|
Loading…
Reference in New Issue