-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathadd.php
50 lines (41 loc) · 1.29 KB
/
add.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
require("../../global/library.php");
use FormTools\Core;
use FormTools\Modules;
use FormTools\Modules\ExtendedClientFields\Fields;
$module = Modules::initModulePage("admin");
$LANG = Core::$L;
$L = $module->getLangStrings();
$success = true;
$message = "";
if (isset($_POST["add"])) {
list($success, $message) = Fields::addField($_POST, $L);
}
$page_vars = array(
"g_success" => $success,
"g_message" => $message,
"head_title" => $L["phrase_add_field"],
"js_messages" => array("word_delete")
);
$page_vars["head_js"] =<<< EOF
var check_field_identifier = function () {
var field = $("#field_identifier");
if (/[^a-zA-Z0-9_]/g.test(field.val())) {
return [[field, "{$L["validation_invalid_field_identifier"]}"]];
}
return true;
}
var rules = [];
rules.push("required,template_hook,{$L["validation_no_template_hook"]}");
rules.push("required,field_label,{$L["validation_no_field_label"]}");
rules.push("required,field_type,{$L["validation_no_field_type"]}");
rules.push("function,check_field_identifier");
$(function() {
ecf_ns.add_field_option(null, null);
ecf_ns.add_field_option(null, null);
$("#field_type").val("").bind("change keyup", function() {
ecf_ns.change_field_type(this.value);
});
});
EOF;
$module->displayPage("templates/add.tpl", $page_vars);