Passed
Push — bugfix/462-backend-errors ( 851204 )
by Michael
07:39
created

www/src/AdminBundle/Resources/public/js/admin.js   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 579

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 579
rs 8.2857
c 2
b 1
f 0

17 Functions

Rating   Name   Duplication   Size   Complexity  
B admin.js ➔ importfileImport 0 37 1
A admin.js ➔ importfileCheckActions 0 14 4
B module.exports.init 0 92 1
A admin.js ➔ getToolbar 0 13 1
A admin.js ➔ topicSave 0 3 1
A admin.js ➔ sendActivationMail 0 16 1
A admin.js ➔ hasNewRow 0 6 1
A admin.js ➔ userSave 0 3 1
B admin.js ➔ formsave 0 42 3
A admin.js ➔ ajaxCallback 0 5 2
A admin.js ➔ checkFormBindStatus 0 9 2
A admin.js ➔ licenseeSave 0 3 1
A admin.js ➔ showError 0 7 1
A admin.js ➔ addNewRow 0 13 3
B module.exports.getUiJson 0 282 1
A admin.js ➔ importfileSave 0 3 1
A admin.js ➔ buildStatusFilter 0 9 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
/* Copyright (C) 2015 Michael Giesler
2
 *
3
 * This file is part of Dembelo.
4
 *
5
 * Dembelo is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Affero General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * Dembelo is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 * GNU Affero General Public License 3 for more details.
14
 *
15
 * You should have received a copy of the GNU Affero General Public License 3
16
 * along with Dembelo. If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
/*global:webix,paths,XMLHttpRequest,module*/
20
(function () {
21
    function showError(msg) {
22
        webix.modalbox({
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
23
            title: "Fehler",
24
            buttons: ["Ok"],
25
            text: msg
26
        });
27
    }
28
29
    function checkFormBindStatus() {
30
        var values = this.getValues();
31
32
        if (values.hasOwnProperty('id')) {
33
            this.enable();
34
        } else {
35
            this.disable();
36
        }
37
    }
38
39
    function importfileCheckActions() {
40
        var values = $$('importfileform').getValues();
41
        if (values.name !== '' && values.licenseeId !== '') {
42
            $$("importfileSaveButton").enable();
43
            if (values.id !== 'new') {
44
                $$("importfileImportButton").enable();
45
            } else {
46
                $$("importfileImportButton").disable();
47
            }
48
        } else {
49
            $$("importfileSaveButton").disable();
50
            $$("importfileImportButton").disable();
51
        }
52
    }
53
54
    function formsave(type) {
55
        var id = type + "form",
56
            values = $$(id).getValues();
57
58
        if (values.id.substring(0,4) === 'new_') {
59
            values.id = 'new';
60
        }
61
        values['formtype'] = type;
62
63
        if (!$$(id).validate()) {
64
            return;
65
        }
66
67
        webix.ajax().post(window.paths.adminFormSave, values, function (text) {
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
68
            var params = JSON.parse(text);
69
            if (params.session_expired) {
70
                window.location = window.paths.login;
71
                return;
72
            }
73
            if (params['error'] === false) {
74
                if (type === 'topic') {
75
                    $$("topicuploadimagelist").clearAll();
76
                    $$('topicform').setValues({imageFileName: null}, true);
77
                }
78
79
                if (params['newId']) {
80
                    $$(type + 'grid').getSelectedItem().id = params['newId'];
81
                    $$(type + 'form').setValues({id: params['newId']}, true);
82
                }
83
84
                $$(id).save();
85
86
                webix.modalbox({
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
87
                    title: "Gespeichert",
88
                    buttons: ["Ok"],
89
                    text: "Der Datensatz wurde erfolgreich gespeichert..."
90
                });
91
            } else {
92
                showError("Das Speichern ist leider fehlgeschlagen...");
93
            }
94
        });
95
    }
96
97
    function userSave() {
98
        formsave("user");
99
    }
100
101
    function licenseeSave() {
102
        formsave("licensee");
103
    }
104
105
    function topicSave() {
106
        formsave("topic");
107
    }
108
109
    function importfileSave() {
110
        formsave("importfile");
111
    }
112
113
    function importfileImport() {
114
        var importfileId = $$('importfilegrid').getSelectedItem().id;
115
116
        webix.ajax().post(window.paths.adminImport, {importfileId: importfileId}, {
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
117
            success: function (text) {
118
                var params = JSON.parse(text);
119
                if (params.session_expired) {
120
                    window.location = window.paths.login;
121
                    return;
122
                }
123
                if (params['success'] === true && params['returnValue'] === true) {
124
                    webix.modalbox({
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
125
                        title: "Datei importiert",
126
                        buttons: ["OK"],
127
                        text: "Die Datei wurde erfolgreich importiert."
128
                    });
129
                } else {
130
                    webix.modalbox({
131
                        title: "Fehler",
132
                        buttons: ["OK"],
133
                        text: "Fehler: " + params['message']
134
                    });
135
                }
136
            },
137
            error: function (dom, obj, ajaxObj) {
138
                var message = 'Unbekannter Fehler';
139
                if (ajaxObj instanceof XMLHttpRequest) {
0 ignored issues
show
Bug introduced by
The variable XMLHttpRequest seems to be never declared. If this is a global, consider adding a /** global: XMLHttpRequest */ 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...
140
                    message = ajaxObj.statusText;
141
                }
142
                webix.modalbox({
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
143
                    title: "Fehler",
144
                    buttons: ["OK"],
145
                    text: "Fehler: " + message
146
                });
147
            }
148
        });
149
    }
150
151
    function getToolbar(type) {
152
        return {
153
            view: "toolbar",
154
            cols: [
155
                {
156
                    id: "newBtn" + type,
157
                    view: "button",
158
                    value: "Neu",
159
                    type: "form"
160
                }
161
            ]
162
        };
163
    }
164
165
    function sendActivationMail() {
166
        var userId = $$('usergrid').getSelectedId().id;
167
168
        webix.ajax().post(window.paths.adminUserActivationMail, {userId: userId}, function (text) {
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
169
            var params = JSON.parse(text);
170
            if (params['error'] === false) {
171
                webix.modalbox({
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
172
                    title: "Aktivierungsmail versandt",
173
                    buttons: ["Ok"],
174
                    text: "Die Email zur Aktivierung wurde erfolgreich versandt."
175
                });
176
            } else {
177
                showError("Der Mailversandt ist leider fehlgeschlagen...");
178
            }
179
        });
180
    }
181
182
    function buildStatusFilter(grid) {
183
        var filter = grid.getFilter("status"),
184
            oldStatusValue = filter.value
185
        filter.innerHTML = "<option value></option>" +
186
            "<option value=\"0\">inaktiv</option>" +
187
            "<option value=\"1\">aktiv</option>";
188
189
        filter.value = oldStatusValue;
190
    }
191
192
    function ajaxCallback(text, response) {
193
        if (response.json().session_expired) {
194
            window.location = window.paths.login;
195
        }
196
    }
197
198
    function hasNewRow(type) {
199
        var newRows = $$(type+'grid').find(function (obj) {
200
            return obj.id === 'new';
201
        });
202
        return newRows.length > 0;
203
    }
204
205
    function addNewRow(type, row) {
206
        var itemId;
207
208
        if (hasNewRow(type)) {
209
            return;
210
        }
211
        if (row === undefined) {
212
            row = {};
213
        }
214
        row.id = 'new_'+Date.now();
215
        itemId = $$(type + 'grid').add(row);
216
        $$(type + 'grid').select(itemId);
217
    }
218
219
    module.exports = {
220
        init: function () {
221
            $$("mainnav").attachEvent("onAfterSelect", function (id){
222
                if (id === '1') {
223
                    $$('usergrid').clearAll();
224
                    $$('usergrid').load(window.paths.adminUsers, ajaxCallback);
225
                    $$('userstuff').show();
226
                } else if (id === '2') {
227
                    $$('licenseegrid').clearAll();
228
                    $$('licenseegrid').load(window.paths.adminLicensees, ajaxCallback);
229
                    $$('licenseestuff').show();
230
                } else if (id === '3') {
231
                    $$('topicgrid').clearAll();
232
                    $$('topicgrid').load(window.paths.adminTopics, ajaxCallback);
233
                    $$('topicstuff').show();
234
                } else if (id === '4') {
235
                    $$('importfilegrid').clearAll();
236
                    $$('importfilegrid').load(window.paths.adminImportfiles, ajaxCallback);
237
                    $$('importfilestuff').show();
238
                } else if (id === '5') {
239
                    $$('textnodegrid').clearAll();
240
                    $$('textnodegrid').load(window.paths.adminTextnodes, ajaxCallback);
241
                    $$('textnodestuff').show();
242
                }
243
            });
244
245
            $$("mainnav").select(1);
246
            $$('usergrid').load(window.paths.adminUsers, ajaxCallback);
247
            $$('userstuff').show();
248
249
            $$('userform').attachEvent('onValues', checkFormBindStatus);
250
            $$('textnodeform').attachEvent('onValues', checkFormBindStatus);
251
            $$('importfileform').attachEvent('onValues', checkFormBindStatus);
252
            $$('topicform').attachEvent('onValues', checkFormBindStatus);
253
254
255
            $$('userform').bind($$('usergrid'));
256
            $$('userformrole').attachEvent('onChange', function (newValue) {
257
                if (newValue === 'ROLE_LICENSEE') {
258
                    $$('userformlicensee').enable()
259
                } else {
260
                    $$('userformlicensee').setValue('');
261
                    $$('userformlicensee').disable()
262
                }
263
            });
264
            $$('userformstatus').attachEvent('onChange', function (newValue) {
265
                if (newValue === 'inaktiv') {
266
                    $$('userformactivation').enable();
267
                } else {
268
                    $$('userformactivation').disable();
269
                }
270
            });
271
272
            $$('topicuploadimage').attachEvent("onUploadComplete", function(response) {
273
                if (response.status === "error") {
274
                    showError("Das Hochladen des Bildes ist fehlgeschlagen...");
275
                }
276
                $$('topicform').setValues(response, true);
277
            });
278
279
            $$('uploadfile').attachEvent("onUploadComplete", function(response) {
280
                $$('importfileform').setValues(response, true);
281
            });
282
283
            $$('importfileform').bind($$('importfilegrid'));
284
            $$('importfileform').attachEvent('onChange', importfileCheckActions);
285
            $$('importfileform').attachEvent('onValues', importfileCheckActions);
286
287
288
            $$('licenseeform').bind($$('licenseegrid'));
289
            $$('licenseeform').attachEvent('onValues', checkFormBindStatus);
290
291
292
            $$("topicgrid").attachEvent("onAfterLoad", function () {
293
                buildStatusFilter($$("topicgrid"));
294
            });
295
296
            $$("topicform").bind($$("topicgrid"));
297
            $$("textnodeform").bind($$("textnodegrid"));
298
299
            $$('newBtnuser').attachEvent('onItemClick', function () {
300
                addNewRow('user', {email: '', roles: 'ROLE_USER'});
301
            });
302
            $$('newBtnlicensee').attachEvent('onItemClick', function () {
303
                addNewRow('licensee', {name: ''});
304
            });
305
            $$('newBtntopic').attachEvent('onItemClick', function () {
306
                addNewRow('topic', {name: '', status: '0'});
307
            });
308
            $$('newBtnimportfile').attachEvent('onItemClick', function () {
309
                addNewRow('importfile', {name: ''});
310
            });
311
        },
312
313
        getUiJson: function () {
314
            return {
315
                rows: [
316
                    {
317
                        view: "template",
318
                        type: "header", template: "Was zu lesen - Admin Area"
319
                    },
320
                    {
321
                        cols: [
322
                            {
323
                                id: "mainnav",
324
                                view: "tree",
325
                                gravity: 0.15,
326
                                select: true,
327
                                data: window.mainMenuData
328
                            },
329
                            {view: "resizer"},
330
                            {
331
                                rows: [
332
                                    {
333
                                        fitBiggest:true,
334
                                        multiview: true,
335
                                        cells: [
336
                                            {
337
                                                id: "userstuff",
338
                                                cols: [
339
                                                    {
340
                                                        rows: [
341
                                                            getToolbar('user'),
342
                                                            {
343
                                                                id: "usergrid",
344
                                                                view: "datatable",
345
                                                                autoConfig: true,
346
                                                                select: true,
347
                                                                datatype: "json",
348
                                                                columns: [
349
                                                                    {id: 'email', header: ['Email', {content: 'serverFilter'}], fillspace: true},
350
                                                                    {id: 'status', header: ['Status', {content: 'serverSelectFilter'}], format: function (value) { if (value === 0) { return 'inaktiv'; } else { return 'aktiv'; }}},
351
                                                                    {id: 'roles', header: 'Rolle', format:function(value){ switch(value){case 'ROLE_ADMIN': return 'Admin';case 'ROLE_LICENSEE': return 'Lizenznehmer';} return 'Leser';}}
0 ignored issues
show
Coding Style introduced by
As per coding-style, switch statements should have a default case.
Loading history...
352
                                                                ]
353
                                                            }
354
                                                        ]
355
                                                    },
356
                                                    {view: "resizer"},
357
                                                    {
358
                                                        view: "scrollview",
359
                                                        scroll: "y",
360
                                                        body: {
361
                                                            rows: [
362
                                                                {
363
                                                                    view: "form",
364
                                                                    id: "userform",
365
                                                                    gravity: 0.5,
366
                                                                    elements: [
367
                                                                        {view: "text", name: "email", label: "Email", validate:webix.rules.isEmail},
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
368
                                                                        {cols: [
369
                                                                            {view: "label", label: "Angelegt", width: 80},
370
                                                                            {view: "label", id: "userformcreated", name: "created"},
371
                                                                        ]},
372
                                                                        {cols: [
373
                                                                            {view: "label", label: "Aktualisiert", width: 80},
374
                                                                            {view: "label", id: "userformupdated", name: "updated"},
375
                                                                        ]},
376
                                                                        {view: "combo", id: "userformrole", name: "roles", label: "Rolle", options: [{id:"ROLE_ADMIN", value: "Admin"}, {id:"ROLE_USER", value: "Leser"}, {id:"ROLE_LICENSEE", value: "Lizenznehmer"}], validate:webix.rules.isNotEmpty},
377
                                                                        {view: "combo", id: "userformlicensee", name: "licenseeId", label: "Lizenznehmer", suggest: window.paths.adminLicenceeSuggest, disabled: true},
378
                                                                        {view: "combo", id: "userformgender", name: "gender", label: "Geschlecht", options: [{id: 'm', value: 'männlich'},{ id: 'f', value: 'weiblich'}]},
379
                                                                        {view: "combo", id: "userformstatus", name: "status", label: "Status", options: [{id: '0', value: 'inaktiv'}, {id: '1', value: 'aktiv'}], validate:webix.rules.isNotEmpty},
380
                                                                        {view: "textarea", id: "userformsource", name: "source", label: "Quelle", height: 100},
381
                                                                        {view: "textarea", id: "userformreason", name: "reason", label: "Grund", height: 100},
382
                                                                        {view: "text", name: "password", type:"password", label:"Passwort"},
383
                                                                        {view: "button", id: "userformactivation", value:"Aktivierungsmail verschicken", click: sendActivationMail, disabled: true},
384
                                                                        {view: "button", value:"Speichern", click:userSave }
385
                                                                    ]
386
                                                                }
387
                                                            ]
388
                                                        }
389
                                                    }
390
                                                ]
391
                                            },
392
                                            {
393
                                                id: "licenseestuff",
394
                                                cols: [
395
                                                    {
396
                                                        rows: [
397
                                                            getToolbar('licensee'),
398
                                                            {
399
                                                                id: "licenseegrid",
400
                                                                view: "datatable",
401
                                                                autoConfig: true,
402
                                                                select: true,
403
                                                                datatype: "json"
404
                                                            }
405
                                                        ]
406
                                                    },
407
                                                    {
408
                                                        view: "form",
409
                                                        id: "licenseeform",
410
                                                        gravity: 0.5,
411
                                                        elements: [
412
                                                            {view: "text", name: "name", label: "Name", validate:webix.rules.isNotEmpty},
413
                                                            {view: "button", value:"Speichern", click:licenseeSave }
414
                                                        ]
415
                                                    }
416
                                                ]
417
                                            },
418
                                            {
419
                                                id: "topicstuff",
420
                                                cols: [
421
                                                    {
422
                                                        rows: [
423
                                                            getToolbar('topic'),
424
                                                            {
425
                                                                id: "topicgrid",
426
                                                                view: "datatable",
427
                                                                autoConfig: true,
428
                                                                select: true,
429
                                                                datatype: "json",
430
                                                                columns: [
431
                                                                    {id: 'name', header: ['Name', {content: 'serverFilter'}], fillspace: true},
432
                                                                    {id: 'status', header: ['Status', {content: 'serverSelectFilter'}], format: function (value) { if (value === '0') return 'inaktiv'; else return 'aktiv';}},
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
433
                                                                    {id: 'sortKey', header: ["Sortierschlüssel"]},
434
                                                                ]
435
                                                            }
436
                                                        ]
437
                                                    },
438
                                                    {view: "resizer"},
439
                                                    {
440
                                                        view: "scrollview",
441
                                                        scroll: "y",
442
                                                        body: {
443
                                                            rows: [
444
                                                                {
445
                                                                    view: "form",
446
                                                                    id: "topicform",
447
                                                                    gravity: 0.5,
448
                                                                    disabled: true,
449
                                                                    elements: [
450
                                                                        {view: "text", name: "name", label: "Name", validate:webix.rules.isNotEmpty},
0 ignored issues
show
Bug introduced by
The variable webix seems to be never declared. If this is a global, consider adding a /** global: webix */ 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...
451
                                                                        {view: "combo", id: "topicformstatus", name: "status", label: "Status", options: [{id:"0", value: "inaktiv"}, {id:"1", value: "aktiv"}], validate:webix.rules.isNotEmpty},
452
                                                                        {view: "text", id: "topicformsortkey", name: "sortKey", label: "Sortierschlüssel", validate:webix.rules.isNumber()},
453
                                                                        {view: "text", name: "originalImageName", label: "Bild", disabled: true},
454
                                                                        {
455
                                                                            view:"uploader",
456
                                                                            id: "topicuploadimage",
457
                                                                            value:"Dateiauswahl",
458
                                                                            link:"topicuploadimagelist",
459
                                                                            upload: window.paths.adminTopicImageUploader,
460
                                                                            multiple: false
461
                                                                        },
462
                                                                        {
463
                                                                            view:"list",
464
                                                                            id:"topicuploadimagelist",
465
                                                                            type:"uploader",
466
                                                                            autoheight:true,
467
                                                                            borderless:true
468
                                                                        },
469
                                                                        {view: "button", value:"Speichern", click:topicSave }
470
                                                                    ]
471
                                                                }
472
                                                            ]
473
                                                        }
474
                                                    }
475
                                                ]
476
                                            },
477
                                            {
478
                                                id: "importfilestuff",
479
                                                cols: [
480
                                                    {
481
                                                        rows: [
482
                                                            getToolbar('importfile'),
483
                                                            {
484
                                                                id: "importfilegrid",
485
                                                                view: "datatable",
486
                                                                autoConfig: true,
487
                                                                select: true,
488
                                                                datatype: "json",
489
                                                                columns: [
490
                                                                    {id: 'name', header: 'Name', fillspace: true},
491
                                                                    {id: 'author', header: 'Autor'},
492
                                                                    {id: 'publisher', header: 'Verlag'},
493
                                                                    {id: 'imported', header: 'Importiert'}
494
                                                                ]
495
                                                            }
496
                                                        ]
497
                                                    },
498
                                                    {view: "resizer"},
499
                                                    {
500
                                                        view: "scrollview",
501
                                                        scroll: "y",
502
                                                        body: {
503
                                                            rows: [
504
                                                                {
505
                                                                    view: "form",
506
                                                                    id: "importfileform",
507
                                                                    disabled: true,
508
                                                                    gravity: 0.5,
509
                                                                    elements: [
510
                                                                        {view: "text", name: "name", label: "Name"},
511
                                                                        {view: "text", name: "author", label: "Autor"},
512
                                                                        {view: "text", name: "publisher", label: "Verlag"},
513
                                                                        {view: "combo", id: "importfilelicensee", name: "licenseeId", label: "Lizenznehmer", suggest: window.paths.adminLicenceeSuggest},
514
                                                                        {view: "combo", id: "importfiletopic", name: "topicId", label: "Themenfeld", suggest: window.paths.adminTopicSuggest},
515
                                                                        {view: "text", name: "orgname", label: "Datei", disabled: true},
516
                                                                        {
517
                                                                            view:"uploader",
518
                                                                            id: "uploadfile",
519
                                                                            value:"Dateiauswahl",
520
                                                                            link:"uploadfilelist",
521
                                                                            upload: window.paths.adminImportfileUploader,
522
                                                                            multiple: false
523
                                                                        },
524
                                                                        {
525
                                                                            view:"list",
526
                                                                            id:"uploadfilelist",
527
                                                                            type:"uploader",
528
                                                                            autoheight:true,
529
                                                                            borderless:true
530
                                                                        },
531
                                                                        {view: "button", id: "importfileSaveButton", value:"Speichern", click:importfileSave, disabled: true },
532
                                                                        {view: "button", id: "importfileImportButton", value:"Importieren", click:importfileImport, disabled: true}
533
                                                                    ]
534
                                                                }
535
                                                            ]
536
                                                        }
537
                                                    }
538
                                                ]
539
540
                                            },
541
                                            {
542
                                                id: "textnodestuff",
543
                                                cols: [
544
                                                    {
545
                                                        rows: [
546
                                                            {
547
                                                                id: "textnodegrid",
548
                                                                view: "datatable",
549
                                                                autoConfig: true,
550
                                                                select: true,
551
                                                                datatype: "json",
552
                                                                columns: [
553
                                                                    {id: 'created', header: 'angelegt'},
554
                                                                    {id: 'status', header: 'Status'},
555
                                                                    {id: 'financenode', header: 'Finanz'},
556
                                                                    {id: 'beginning', header: 'Text', fillspace: true},
557
                                                                    {id: 'importfile', header: 'Importdatei'}
558
                                                                ]
559
                                                            }
560
                                                        ]
561
                                                    },
562
                                                    {
563
                                                        view: "form",
564
                                                        id: "textnodeform",
565
                                                        disabled: true,
566
                                                        gravity: 0.5,
567
                                                        scroll: "y",
568
                                                        elements: [
569
                                                            {view: "text", name: "id", label: "ID", disabled: true},
570
                                                            {view: "text", name: "twineId", label: "twineID", disabled: true},
571
                                                            {view: "text", name: "arbitraryId", label: "aID", disabled: true, tooltip: "arbitraryID"},
572
                                                            {view: "text", name: "created", label: "angelegt", disabled: true},
573
                                                            {view: "text", name: "status", label: "Status", disabled: true},
574
                                                            {view: "text", name: "financenode", label: "Finanzierung", disabled: true},
575
                                                            {view: "text", name: "access", label: "Access-Knoten", disabled: true},
576
                                                            {view: "text", name: "licensee", label: "Lizenznehmer", disabled: true},
577
                                                            {view: "text", name: "importfile", label: "Importdatei", disabled: true},
578
                                                            {view: "textarea", name: "beginning", label: "Textanfang", height: 200, disabled: true},
579
                                                            {view: "textarea", name: "metadata", label: "Metadaten", height: 200, attributes: {disabled: "true"}},
580
                                                            {view: "textarea", name: "parentnodes", label: "Elternknoten", height: 200, attributes: {disabled: "true"}},
581
                                                            {view: "textarea", name: "childnodes", label: "Kindknoten", height: 200, attributes: {disabled: "true"}}
582
                                                        ]
583
                                                    }
584
                                                ]
585
                                            }
586
                                        ]
587
                                    }
588
                                ]
589
                            }
590
                        ]
591
                    }
592
                ]
593
            };
594
        }
595
596
    };
597
598
}());