Passed
Push — main ( fac3c3...502827 )
by Stefan
02:24
created

script/FormGenerator.js   A

Complexity

Total Complexity 10
Complexity/F 2.5

Size

Lines of Code 51
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 10
eloc 31
mnd 6
bc 6
fnc 4
dl 0
loc 51
rs 10
bpm 1.5
cpm 2.5
noi 9
c 0
b 0
f 0

4 Functions

Rating   Name   Duplication   Size   Complexity  
A FormGenerator.js ➔ validateForm 0 5 1
A FormGenerator.js ➔ displayJSError 0 14 2
B FormGenerator.js ➔ initFormGenerator 0 19 6
A FormGenerator.js ➔ browseServer 0 7 1
1
document.addEventListener('DOMContentLoaded', initFormGenerator);
2
3
function initFormGenerator()
4
{
5
    if (g_oConfigFromPHP.Color !== undefined) {
0 ignored issues
show
Bug introduced by
The variable g_oConfigFromPHP seems to be never declared. If this is a global, consider adding a /** global: g_oConfigFromPHP */ comment.

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.

Loading history...
6
        if (typeof jscolor === undefined) {
0 ignored issues
show
Bug introduced by
The variable jscolor seems to be never declared. If this is a global, consider adding a /** global: jscolor */ comment.

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.

Loading history...
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) {
0 ignored issues
show
Bug introduced by
The variable CKEDITOR seems to be never declared. If this is a global, consider adding a /** global: CKEDITOR */ comment.

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.

Loading history...
14
            displayJSError('You must include [ckeditor.js] to use the FormCKEdit input element!', 'Warning');
15
        }
16
        if (typeof loadEditor === undefined) {
0 ignored issues
show
Bug introduced by
The variable loadEditor seems to be never declared. If this is a global, consider adding a /** global: loadEditor */ comment.

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.

Loading history...
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);
0 ignored issues
show
Bug introduced by
The variable FormDataValidator seems to be never declared. If this is a global, consider adding a /** global: FormDataValidator */ comment.

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.

Loading history...
Bug introduced by
The variable g_oConfigFromPHP seems to be never declared. If this is a global, consider adding a /** global: g_oConfigFromPHP */ comment.

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.

Loading history...
26
    return FDV.validate();
27
}
28
29
30
function displayJSError(msg, level)
31
{
32
    if (g_oConfigFromPHP.DebugMode) {
0 ignored issues
show
Bug introduced by
The variable g_oConfigFromPHP seems to be never declared. If this is a global, consider adding a /** global: g_oConfigFromPHP */ comment.

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.

Loading history...
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);
0 ignored issues
show
Bug introduced by
The variable g_oConfigFromPHP seems to be never declared. If this is a global, consider adding a /** global: g_oConfigFromPHP */ comment.

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.

Loading history...
Bug introduced by
The variable RichFmConnector seems to be never declared. If this is a global, consider adding a /** global: RichFmConnector */ comment.

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.

Loading history...
48
    FmConnector.editID = editID;
49
    FmConnector.imgID = imgID;
50
    FmConnector.browseServerModal(strExpand);
51
}
52
        
53
54