|
1
|
|
|
document.addEventListener('DOMContentLoaded', initFormGenerator); |
|
2
|
|
|
|
|
3
|
|
|
function initFormGenerator() |
|
4
|
|
|
{ |
|
5
|
|
|
if (g_oConfigFromPHP.Color !== undefined) { |
|
|
|
|
|
|
6
|
|
|
if (typeof jscolor === undefined) { |
|
|
|
|
|
|
7
|
|
|
displayJSError('You must include [jscolor.js / jscolor.min.js] to use the FormColor input element!', 'Warning'); |
|
8
|
|
|
} |
|
9
|
|
|
jscolor.presets.default = g_oConfigFromPHP.Color; |
|
10
|
|
|
} |
|
11
|
|
|
|
|
12
|
|
|
if (g_oConfigFromPHP.CKEditor !== undefined) { |
|
13
|
|
|
if (typeof CKEDITOR === undefined) { |
|
|
|
|
|
|
14
|
|
|
displayJSError('You must include [ckeditor.js] to use the FormCKEdit input element!', 'Warning'); |
|
15
|
|
|
} |
|
16
|
|
|
if (typeof loadEditor === undefined) { |
|
|
|
|
|
|
17
|
|
|
displayJSError('You must include [FormCKEdit.js] to use the FormCKEdit input element!', 'Warning'); |
|
18
|
|
|
} |
|
19
|
|
|
loadEditor(); |
|
20
|
|
|
} |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
function validateForm() |
|
24
|
|
|
{ |
|
25
|
|
|
var FDV = new FormDataValidator(g_oConfigFromPHP.FormDataValidation); |
|
|
|
|
|
|
26
|
|
|
return FDV.validate(); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
function displayJSError(msg, level) |
|
31
|
|
|
{ |
|
32
|
|
|
if (g_oConfigFromPHP.DebugMode) { |
|
|
|
|
|
|
33
|
|
|
let div = document.createElement('div'); |
|
34
|
|
|
div.id = 'JSError'; |
|
35
|
|
|
let header = document.createElement('h1'); |
|
36
|
|
|
div.appendChild(header); |
|
37
|
|
|
let body = document.createElement('p'); |
|
38
|
|
|
div.appendChild(body); |
|
39
|
|
|
header.innerHTML = 'Javascript ' + level; |
|
40
|
|
|
body.innerHTML = msg; |
|
41
|
|
|
document.body.insertBefore(div, document.body.firstChild); |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
function browseServer(editID, imgID, strExpand) |
|
46
|
|
|
{ |
|
47
|
|
|
let FmConnector = new RichFmConnector(g_oConfigFromPHP.RichFilemanager.Path); |
|
|
|
|
|
|
48
|
|
|
FmConnector.editID = editID; |
|
49
|
|
|
FmConnector.imgID = imgID; |
|
50
|
|
|
FmConnector.browseServerModal(strExpand); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
|
|
54
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.