Browse code

Rework the directory-structure

Manuel Thalmann authored on 24/04/2018 21:45:50
Showing 85 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 import * as Path from "path";
2 2
 import Package from "./lib/PackageSystem/Package";
3 3
 import RequiredPackageDescriptor from "./lib/PackageSystem/RequiredPackageDescriptor";
4
-import StyleInstructionCollection from "./lib/Customization/StyleInstructionCollection";
4
+import StyleInstructionCollection from "./lib/Customization/Styles/StyleInstructionCollection";
5 5
 import UpdateInstructionCollection from "./lib/Automation/UpdateInstructionCollection";
6 6
 
7 7
 function getComponentsPath(value: string): string
... ...
@@ -1,4 +1,4 @@
1
-import ACPTemplatesInstruction from "../lib/Customization/ACPTemplatesInstruction";
1
+import ACPTemplatesInstruction from "../lib/Customization/Presentation/ACPTemplatesInstruction";
2 2
 
3 3
 let acpTemplatesInstruction: ACPTemplatesInstruction = null;
4 4
 
... ...
@@ -1,5 +1,5 @@
1
-import BBCode from "../lib/Customization/BBCode";
2
-import BBCodesInstruction from "../lib/Customization/BBCodesInstruction";
1
+import BBCode from "../lib/Customization/BBCodes/BBCode";
2
+import BBCodesInstruction from "../lib/Customization/BBCodes/BBCodesInstruction";
3 3
 
4 4
 let bbcodesInstruction: BBCodesInstruction = new BBCodesInstruction({
5 5
     BBCodes: [
... ...
@@ -1,5 +1,5 @@
1
-import Emoji from "../lib/Customization/Emoji";
2
-import EmojisInstruction from "../lib/Customization/EmojisInstruction";
1
+import Emoji from "../lib/Customization/Emojis/Emoji";
2
+import EmojisInstruction from "../lib/Customization/Emojis/EmojisInstruction";
3 3
 
4 4
 let emojiInstruction: EmojisInstruction = new EmojisInstruction({
5 5
     Emojis: [
... ...
@@ -1,5 +1,5 @@
1
-import ErrorMessageNode from "../lib/Globalization/ErrorMessageNode";
2
-import ErrorMessagesInstruction from "../lib/Globalization/ErrorMessagesInstruction";
1
+import ErrorMessageNode from "../lib/Globalization/Errors/ErrorMessageNode";
2
+import ErrorMessagesInstruction from "../lib/Globalization/Errors/ErrorMessagesInstruction";
3 3
 
4 4
 let errorMessageInstruction: ErrorMessagesInstruction = new ErrorMessagesInstruction({
5 5
     TranslationNodes: [ 
... ...
@@ -1,11 +1,12 @@
1
-import Option from "../lib/ControlPanel/Option";
2
-import OptionItem from "../lib/ControlPanel/OptionItem";
3
-import OptionsInstruction from "../lib/ControlPanel/OptionsInstruction";
4
-import OptionType from "../lib/ControlPanel/OptionType";
5
-import SettingsNode from "../lib/ControlPanel/SettingsNode";
1
+import Option from "../lib/Options/ControlPanel/Option";
2
+import OptionItem from "../lib/Options/ControlPanel/OptionItem";
3
+import OptionsInstruction from "../lib/Options/ControlPanel/OptionsInstruction";
4
+import OptionType from "../lib/Options/ControlPanel/OptionType";
5
+import SettingsNode from "../lib/Options/ControlPanel/SettingsNode";
6 6
 
7 7
 let optionsInstruction: OptionsInstruction = new OptionsInstruction({
8 8
     SettingsNodes: [
9
+        
9 10
     ]
10 11
 });
11 12
 
... ...
@@ -1,5 +1,5 @@
1
-import TemplateListener from "../lib/Customization/TemplateListener";
2
-import TemplateListenersInstruction from "../lib/Customization/TemplateListenersInstruction";
1
+import TemplateListener from "../lib/Customization/Presentation/TemplateListener";
2
+import TemplateListenersInstruction from "../lib/Customization/Presentation/TemplateListenersInstruction";
3 3
 import WSCEnvironment from "../lib/WSCEnvironment";
4 4
 
5 5
 let templateListenersInstruction: TemplateListenersInstruction = new TemplateListenersInstruction({
... ...
@@ -1,4 +1,4 @@
1
-import TemplatesInstruction from "../lib/Customization/TemplatesInstruction";
1
+import TemplatesInstruction from "../lib/Customization/Presentation/TemplatesInstruction";
2 2
 
3 3
 let templatesInstruction: TemplatesInstruction = null;
4 4
 
... ...
@@ -1,6 +1,4 @@
1 1
 import IInstruction from "./IInstruction";
2
-import Instruction from "./Instruction";
3
-import Package from "../PackageSystem/Package";
4 2
 
5 3
 /**
6 4
  * Rerpesents a set of instructions.
... ...
@@ -1,27 +1,27 @@
1
-import ACPTemplatesInstruction from "../Customization/ACPTemplatesInstruction";
2
-import Emoji from "../Customization/Emoji";
3
-import EmojisInstruction from "../Customization/EmojisInstruction";
4
-import ErrorMessageNode from "../Globalization/ErrorMessageNode";
5
-import ErrorMessagesInstruction from "../Globalization/ErrorMessagesInstruction";
1
+import { isNullOrUndefined } from "util";
2
+
3
+import Emoji from "../Customization/Emojis/Emoji";
4
+import EmojisInstruction from "../Customization/Emojis/EmojisInstruction";
5
+import ACPTemplatesInstruction from "../Customization/Presentation/ACPTemplatesInstruction";
6
+import TemplateListener from "../Customization/Presentation/TemplateListener";
7
+import TemplateListenersInstruction from "../Customization/Presentation/TemplateListenersInstruction";
8
+import TemplatesInstruction from "../Customization/Presentation/TemplatesInstruction";
9
+import Style from "../Customization/Styles/Style";
10
+import StyleInstruction from "../Customization/Styles/StyleInstruction";
6 11
 import EventListener from "../Events/EventListener";
7 12
 import EventListenersInstruction from "../Events/EventListenersInstruction";
8
-import FileInstruction from "./FileInstruction";
9 13
 import FilesInstruction from "../FilesInstruction";
10
-import IInstruction from "./IInstruction";
11
-import IInstructionCollection from "./IInstructionCollection";
12
-import Instruction from "./Instruction";
13
-import Option from "../ControlPanel/Option";
14
-import OptionsInstruction from "../ControlPanel/OptionsInstruction";
15
-import Package from "../PackageSystem/Package";
16
-import SettingsNode from "../ControlPanel/SettingsNode";
17
-import Style from "../Customization/Style";
18
-import StyleInstruction from "../Customization/StyleInstruction";
19
-import TemplateListener from "../Customization/TemplateListener";
20
-import TemplateListenersInstruction from "../Customization/TemplateListenersInstruction";
21
-import TemplatesInstruction from "../Customization/TemplatesInstruction";
14
+import ErrorMessageNode from "../Globalization/Errors/ErrorMessageNode";
15
+import ErrorMessagesInstruction from "../Globalization/Errors/ErrorMessagesInstruction";
22 16
 import TranslationNode from "../Globalization/TranslationNode";
23 17
 import TranslationsInstruction from "../Globalization/TranslationsInstruction";
24
-import { isNullOrUndefined } from "util";
18
+import Option from "../Options/ControlPanel/Option";
19
+import OptionsInstruction from "../Options/ControlPanel/OptionsInstruction";
20
+import SettingsNode from "../Options/ControlPanel/SettingsNode";
21
+import Package from "../PackageSystem/Package";
22
+import FileInstruction from "./FileInstruction";
23
+import IInstructionCollection from "./IInstructionCollection";
24
+import Instruction from "./Instruction";
25 25
 
26 26
 /**
27 27
  * Rerpesents a set of instructions.
28 28
deleted file mode 100644
... ...
@@ -1,60 +0,0 @@
1
-import INode from "../Nodes/INode";
2
-import Localizable from "../Globalization/Localizable";
3
-import OptionItem from "./OptionItem";
4
-import OptionType from "./OptionType";
5
-
6
-/**
7
- * Represents an option that can be shown in the ACP.
8
- */
9
-export default interface IOption extends INode
10
-{
11
-    /**
12
-     * Gets or sets the id of the option.
13
-     */
14
-    ID: string;
15
-
16
-    /**
17
-     * Gets the displayname of the option.
18
-     */
19
-    DisplayName?: Localizable;
20
-
21
-    /**
22
-     * Gets the description of the option.
23
-     */
24
-    Description?: Localizable;
25
-
26
-    /**
27
-     * Gets the default value of the option.
28
-     */
29
-    Default?: any;
30
-
31
-    /**
32
-     * Gets or sets the type of the option.
33
-     */
34
-    Type?: OptionType;
35
-
36
-    /**
37
-     * Gets or sets a value indicating whether localization is supported.
38
-     */
39
-    SupportsLocalization?: boolean;
40
-
41
-    /**
42
-     * Gets or sets a value indicating whether this option is localized.
43
-     */
44
-    RequiresLocalization?: boolean;
45
-
46
-    /**
47
-     * Gets the items of the option.
48
-     */
49
-    Items?: OptionItem[];
50
-
51
-    /**
52
-     * Gets a comma-separated list of options which should be visually enabled when this option is enabled.  
53
-     * A leading exclamation mark (`!`, `U+0021`) will disable the specified option when this option is enabled.  
54
-     * For `ComboBox` and `RadioButton` types the list should be prefixed by the selectoptions name followed by a colon (`:`, `U+003A`).
55
-     *
56
-     * This setting is a visual helper for the administrator only.  
57
-     * It does not have an effect on the server side processing of the option.
58
-     */
59
-    EnableOptions?: string[];
60
-}
61 0
\ No newline at end of file
62 1
deleted file mode 100644
... ...
@@ -1,22 +0,0 @@
1
-import Localizable from "../GLobalization/Localizable";
2
-
3
-/**
4
- * Represents an item of an option.
5
- */
6
-export default interface IOptionItem
7
-{
8
-    /**
9
-     * Gets or sets the name of the item.
10
-     */
11
-    Name: string;
12
-
13
-    /**
14
-     * Gets the displayname of the item.
15
-     */
16
-    DisplayName?: Localizable;
17
-    
18
-    /**
19
-     * Gets or sets the value of the item.
20
-     */
21
-    Value: any;
22
-}
23 0
\ No newline at end of file
24 1
deleted file mode 100644
... ...
@@ -1,19 +0,0 @@
1
-import IDeleteInstruction from "../Automation/IDeleteInstruction";
2
-import IFileInstruction from "../Automation/IFileInstruction";
3
-import SettingsNode from "./SettingsNode";
4
-
5
-/**
6
- * Represents an instruction that provides options for the control-panel.
7
- */
8
-export default interface IOptionsInstruction extends IFileInstruction, IDeleteInstruction
9
-{
10
-    /**
11
-     * Gets or sets the categories and options provided by the instruction.
12
-     */
13
-    SettingsNodes: SettingsNode[];
14
-    
15
-    /**
16
-     * Gets or sets the directory to save the language-files to.
17
-     */
18
-    TranslationsDirectory?: string;
19
-}
20 0
\ No newline at end of file
21 1
deleted file mode 100644
... ...
@@ -1,36 +0,0 @@
1
-import INodeContainer from "../Nodes/INodeContainer";
2
-import Localizable from "../GLobalization/Localizable";
3
-import Node from "../Nodes/Node";
4
-import Option from "./Option";
5
-import SettingsNode from "./SettingsNode";
6
-
7
-/**
8
- * Represents a node that contains options and categories.
9
- */
10
-export default interface ISettingsNode extends INodeContainer
11
-{
12
-    /**
13
-     * Gets the displayname of the node.
14
-     */
15
-    DisplayName?: Localizable;
16
-    
17
-    /**
18
-     * Gets the description of the node.
19
-     */
20
-    Description?: Localizable;
21
-    
22
-    /**
23
-     * Gets the nodes contained by this node.
24
-     */
25
-    Nodes?: SettingsNode[];
26
-    
27
-    /**
28
-     * Gets the options contained by this node.
29
-     */
30
-    Options?: Option[];
31
-
32
-    /**
33
-     * The parent of the settings-node.
34
-     */
35
-    Parent?: Node;
36
-}
37 0
\ No newline at end of file
38 1
deleted file mode 100644
... ...
@@ -1,236 +0,0 @@
1
-import IOption from "./IOption";
2
-import Localizable from "../GLobalization/Localizable";
3
-import Node from "../Nodes/Node";
4
-import OptionItem from "./OptionItem";
5
-import OptionItemCollection from "./OptionItemCollection";
6
-import OptionType from "./OptionType";
7
-import SettingsNode from "./SettingsNode";
8
-import TranslationNode from "../Globalization/TranslationNode";
9
-import { isNullOrUndefined } from "util";
10
-
11
-/**
12
- * Represents an option that can be shown in the ACP.
13
- */
14
-export default class Option extends Node implements IOption
15
-{
16
-    /**
17
-     * The id of the option.
18
-     */
19
-    private id: string = null;
20
-
21
-    /**
22
-     * The displayname of the option.
23
-     */
24
-    private displayName: Localizable = new Localizable();
25
-
26
-    /**
27
-     * The description of the option.
28
-     */
29
-    private description: Localizable = new Localizable();
30
-
31
-    /**
32
-     * The default value of the option.
33
-     */
34
-    private default: any = null;
35
-
36
-    /**
37
-     * The type of the option.
38
-     */
39
-    private type: OptionType = OptionType.TextBox;
40
-
41
-    /**
42
-     * A value indicating whether localization is supported.
43
-     */
44
-    private supportsLocalization: boolean = false;
45
-
46
-    /**
47
-     * A value indicating whether this option is localized.
48
-     */
49
-    private requiresLocalization: boolean = false;
50
-
51
-    /**
52
-     * The items of the option.
53
-     */
54
-    private items: OptionItem[] = new OptionItemCollection(this);
55
-
56
-    /**
57
-     * A comma-separated list of options which should be visually enabled when this option is enabled.  
58
-     * A leading exclamation mark (`!`, U+0021) will disable the specified option when this option is enabled.  
59
-     * For `ComboBox` and `RadioButton` types the list should be prefixed by the selectoptions name followed by a colon (:, U+003A).
60
-     *
61
-     * This setting is a visual helper for the administrator only.  
62
-     * It does not have an effect on the server side processing of the option.
63
-     */
64
-    private enableOptions: string[] = [];
65
-
66
-    /**
67
-     * Initializes a new instance of the `Option` class.
68
-     */
69
-    public constructor(options: IOption)
70
-    {
71
-        super(options);
72
-        this.id = options.ID;
73
-
74
-        if (!isNullOrUndefined(options.DisplayName))
75
-        {
76
-            Object.assign(this.displayName, options.DisplayName);
77
-        }
78
-
79
-        if (!isNullOrUndefined(options.Description))
80
-        {
81
-            Object.assign(this.description, options.Description);
82
-        }
83
-
84
-        if (!isNullOrUndefined(options.Default))
85
-        {
86
-            this.default = options.Default;
87
-        }
88
-
89
-        if (!isNullOrUndefined(options.Type))
90
-        {
91
-            this.type = options.Type;
92
-        }
93
-
94
-        if (!isNullOrUndefined(options.SupportsLocalization))
95
-        {
96
-            this.supportsLocalization = options.SupportsLocalization;
97
-        }
98
-
99
-        if (!isNullOrUndefined(options.RequiresLocalization))
100
-        {
101
-            this.requiresLocalization = options.RequiresLocalization;
102
-        }
103
-
104
-        if (!isNullOrUndefined(options.Items))
105
-        {
106
-            this.items.push(...options.Items);
107
-        }
108
-
109
-        if (!isNullOrUndefined(options.EnableOptions))
110
-        {
111
-            this.enableOptions.push(...options.EnableOptions);
112
-        }
113
-    }
114
-
115
-    public get ID(): string
116
-    {
117
-        return this.id;
118
-    }
119
-
120
-    public set ID(value: string)
121
-    {
122
-        this.id = value;
123
-    }
124
-
125
-    public get DisplayName(): Localizable
126
-    {
127
-        return this.displayName;
128
-    }
129
-
130
-    public get FullName(): string
131
-    {
132
-        return "wcf.acp.option." + this.Name;
133
-    }
134
-
135
-    public get Description(): Localizable
136
-    {
137
-        return this.description;
138
-    }
139
-
140
-    public get Default(): any
141
-    {
142
-        return this.default;
143
-    }
144
-
145
-    public get Type(): OptionType
146
-    {
147
-        return this.type;
148
-    }
149
-
150
-    public set Type(value: OptionType)
151
-    {
152
-        this.type = value;
153
-    }
154
-
155
-    public get SupportsLocalization(): boolean
156
-    {
157
-        return this.supportsLocalization;
158
-    }
159
-
160
-    public set SupportsLocalization(value: boolean)
161
-    {
162
-        this.supportsLocalization = value;
163
-    }
164
-
165
-    public get RequiresLocalization(): boolean
166
-    {
167
-        return this.requiresLocalization;
168
-    }
169
-
170
-    public set RequiresLocalization(value: boolean)
171
-    {
172
-        this.requiresLocalization = value;
173
-    }
174
-
175
-    public get Items(): OptionItem[]
176
-    {
177
-        return this.items;
178
-    }
179
-
180
-    public get EnableOptions(): string[]
181
-    {
182
-        return this.enableOptions;
183
-    }
184
-
185
-    /**
186
-     * Gets the translation-nodes of the option.
187
-     */
188
-    public get TranslationNodes(): TranslationNode[]
189
-    {
190
-        let translationNode = new TranslationNode({ Name: "wcf.acp.option" });
191
-        let rootNodes: TranslationNode[] = [];
192
-
193
-        if (Object.keys(this.DisplayName))
194
-        {
195
-            translationNode.Nodes.push(
196
-                new TranslationNode({
197
-                    Name: this.Name,
198
-                    Translations: this.DisplayName
199
-                }));
200
-        }
201
-
202
-        if (Object.keys(this.Description))
203
-        {
204
-            translationNode.Nodes.push(
205
-                new TranslationNode({
206
-                    Name: this.Name,
207
-                    Nodes: [
208
-                        new TranslationNode(
209
-                            {
210
-                                Name: "description",
211
-                                Translations: this.Description
212
-                            }
213
-                        )
214
-                    ]
215
-                }))
216
-        }
217
-
218
-        for (let item of this.Items)
219
-        {
220
-            for (let childNode of item.TranslationNodes)
221
-            {
222
-                if (translationNode.Name === childNode.Name)
223
-                {
224
-                    translationNode.Nodes.push(...childNode.Nodes);
225
-                }
226
-            }
227
-        }
228
-
229
-        if (translationNode.GetTranslations().length > 0)
230
-        {
231
-            rootNodes.splice(0, 0, translationNode);
232
-        }
233
-
234
-        return rootNodes;
235
-    }
236
-}
237 0
\ No newline at end of file
238 1
deleted file mode 100644
... ...
@@ -1,121 +0,0 @@
1
-import IOptionItem from "./IOptionItem";
2
-import Localizable from "../Globalization/Localizable";
3
-import Node from "../Nodes/Node";
4
-import Option from "./Option";
5
-import TranslationNode from "../Globalization/TranslationNode";
6
-import { isNullOrUndefined } from "util";
7
-
8
-/**
9
- * Represents an item of an option.
10
- */
11
-export default class OptionItem implements IOptionItem
12
-{
13
-    /**
14
-     * The name of the item.
15
-     */
16
-    private name: string = "";
17
-
18
-    /**
19
-     * The displayname of the item.
20
-     */
21
-    private displayName: Localizable = new Localizable();
22
-
23
-    /**
24
-     * The value of the item.
25
-     */
26
-    private value: any = null;
27
-
28
-    /**
29
-     * The option this item belongs to.
30
-     */
31
-    private option: Option = null;
32
-
33
-    /**
34
-     * Initializes a new instance of the `OptionItem` class.
35
-     */
36
-    public constructor(options: IOptionItem)
37
-    {
38
-        this.name = options.Name;
39
-
40
-        if (!isNullOrUndefined(options.DisplayName))
41
-        {
42
-            Object.assign(this.DisplayName, options.DisplayName);
43
-        }
44
-
45
-        this.value = options.Value;
46
-    }
47
-
48
-    public get Name(): string
49
-    {
50
-        return this.name;
51
-    }
52
-
53
-    public set Name(value: string)
54
-    {
55
-        this.name = value;
56
-    }
57
-
58
-    public get DisplayName(): Localizable
59
-    {
60
-        return this.displayName;
61
-    }
62
-
63
-    /**
64
-     * Gets the full name of the item.
65
-     */
66
-    public get FullName(): string
67
-    {
68
-        return [ this.Option.FullName, this.Name ].join(".");
69
-    }
70
-
71
-    public get Value(): any
72
-    {
73
-        return this.value;
74
-    }
75
-
76
-    public set Value(value: any)
77
-    {
78
-        this.value = value;
79
-    }
80
-
81
-    /**
82
-     * Gets or sets the option this item belongs to.
83
-     */
84
-    public get Option(): Option
85
-    {
86
-        return this.option;
87
-    }
88
-
89
-    public set Option(value: Option)
90
-    {
91
-        this.option = value;
92
-    }
93
-
94
-    /**
95
-     * Gets the translation-nodes of this item.
96
-     */
97
-    public get TranslationNodes(): TranslationNode[]
98
-    {
99
-        if (Object.keys(this.DisplayName).length > 0)
100
-        {
101
-            return [ new TranslationNode({
102
-                Name: "wcf.acp.option",
103
-                Nodes: [
104
-                    new TranslationNode({
105
-                        Name: this.Option.Name,
106
-                        Nodes: [
107
-                            new TranslationNode({
108
-                                Name: this.Name,
109
-                                Translations: this.DisplayName
110
-                            })
111
-                        ]
112
-                    })
113
-                ]
114
-            }) ];
115
-        }
116
-        else
117
-        {
118
-            return [ ];
119
-        }
120
-    }
121
-}
122 0
\ No newline at end of file
123 1
deleted file mode 100644
... ...
@@ -1,37 +0,0 @@
1
-import Node from "../Nodes/Node";
2
-import NodeContainer from "../Nodes/NodeContainer";
3
-import Option from "./Option";
4
-import OptionItem from "./OptionItem";
5
-
6
-/**
7
- * Represents a set of option-items.
8
- */
9
-export default class OptionItemCollection<T extends OptionItem> extends Array<T>
10
-{
11
-    /**
12
-     * The option this collection belongs to.
13
-     */
14
-    private option: Option;
15
-
16
-    /**
17
-     * Initializes a new instance of the `OptionItemCollection` class.
18
-     * 
19
-     * @param option
20
-     * The option this collection belongs to.
21
-     */
22
-    public constructor(option: Option)
23
-    {
24
-        super();
25
-        this.option = option;
26
-    }
27
-
28
-    public push(...items: T[])
29
-    {
30
-        for (let item of items)
31
-        {
32
-            item.Option = this.option;
33
-        }
34
-
35
-        return super.push(...items);
36
-    }
37
-}
38 0
\ No newline at end of file
39 1
deleted file mode 100644
... ...
@@ -1,53 +0,0 @@
1
-/**
2
- * Specifies an option-type for the Admin Control-Panel.
3
- */
4
-enum OptionType
5
-{
6
-    /**
7
-     * Indicates a checkbox.
8
-     */
9
-    CheckBox = "boolean",
10
-
11
-    /**
12
-     * Indicates a list of checkboxes.
13
-     */
14
-    CheckBoxes = "checkboxes",
15
-
16
-    /**
17
-     * Indicates a text-box.
18
-     */
19
-    TextBox = "text",
20
-
21
-
22
-    /**
23
-     * Indicates a big text-box.
24
-     */
25
-    TextArea = "textarea",
26
-    
27
-    /**
28
-     * Indicates a big text-box which is localizable.
29
-     */
30
-    LocalizableTextArea = "textareaI18n",
31
-
32
-    /**
33
-     * Indicates a secure text-box.
34
-     */
35
-    PasswordTextBox = "password",
36
-
37
-    /**
38
-     * Indicates a combo-box.
39
-     */
40
-    ComboBox = "select",
41
-
42
-    /**
43
-     * Indicates a set of radio-buttons.
44
-     */
45
-    RadioButton = "radioButton",
46
-
47
-    /**
48
-     * Indicates a multiselect-list.
49
-     */
50
-    MultiSelect = "multiSelect"
51
-}
52
-
53
-export default OptionType;
54 0
\ No newline at end of file
55 1
deleted file mode 100644
... ...
@@ -1,137 +0,0 @@
1
-import * as Path from "path";
2
-import FileInstruction from "../Automation/FileInstruction";
3
-import Instruction from "../Automation/Instruction";
4
-import IOptionsInstruction from "./IOptionsInstruction";
5
-import ITranslationsInstruction from "../Globalization/ITranslationsInstruction";
6
-import Option from "./Option";
7
-import SettingsNode from "./SettingsNode";
8
-import TranslationNode from "../Globalization/TranslationNode";
9
-import { isNullOrUndefined } from "util";
10
-
11
-/**
12
- * Represents an instruction that provides options for the control-panel.
13
- */
14
-export default class OptionsInstruction extends FileInstruction implements IOptionsInstruction, ITranslationsInstruction
15
-{
16
-    /**
17
-     * A set of names of options to delete.
18
-     */
19
-    private objectsToDelete: string[] = [];
20
-
21
-    /**
22
-     * The categories and options provided by the instruction.
23
-     */
24
-    private settingsNodes: SettingsNode[] = [];
25
-
26
-    /**
27
-     * The directory to save the language-files to.
28
-     */
29
-    private translationsDirectory: string;
30
-
31
-    /**
32
-     * Initializes a new instance of the `OptionsInstruction` class.
33
-     */
34
-    public constructor(options: IOptionsInstruction)
35
-    {
36
-        super(options);
37
-
38
-        if (isNullOrUndefined(this.FileName))
39
-        {
40
-            this.FileName = "options.xml";
41
-        }
42
-
43
-        if (!isNullOrUndefined(options.ObjectsToDelete))
44
-        {
45
-            this.objectsToDelete.push(...options.ObjectsToDelete);
46
-        }
47
-        
48
-        if (!isNullOrUndefined(options.SettingsNodes))
49
-        {
50
-            this.settingsNodes.push(...options.SettingsNodes);
51
-        }
52
-
53
-        if (!isNullOrUndefined(options.TranslationsDirectory))
54
-        {
55
-            this.translationsDirectory = options.TranslationsDirectory;
56
-        }
57
-        else
58
-        {
59
-            this.translationsDirectory = Path.basename(this.FileName, Path.extname(this.FileName));
60
-        }
61
-    }
62
-
63
-    public get SettingsNodes(): SettingsNode[]
64
-    {
65
-        return this.settingsNodes;
66
-    }
67
-
68
-    public get TranslationsDirectory(): string
69
-    {
70
-        return this.translationsDirectory;
71
-    }
72
-
73
-    public set TranslationsDirectory(value: string)
74
-    {
75
-        this.translationsDirectory = value;
76
-    }
77
-
78
-    /**
79
-     * Gets all options provided by the instruction.
80
-     */
81
-    public get Options(): { [id: string]: Option }
82
-    {
83
-        let result: { [id: string]: Option } = { };
84
-
85
-        for (let settingsNode of (this.settingsNodes))
86
-        {
87
-            Object.assign(result, settingsNode.GetOptions());
88
-        }
89
-
90
-        return result;
91
-    }
92
-
93
-    /**
94
-     * Gets all categories provided by the instruction.
95
-     */
96
-    public get Categories(): SettingsNode[]
97
-    {
98
-        let result: SettingsNode[] = [];
99
-
100
-        for (let settingsNode of this.SettingsNodes)
101
-        {
102
-            result.push(...settingsNode.GetCategories());
103
-        }
104
-
105
-        return result;
106
-    }
107
-
108
-    /**
109
-     * Gets the translations provided by the instruction.
110
-     */
111
-    public get TranslationNodes(): TranslationNode[]
112
-    {
113
-        let result: TranslationNode[] = [];
114
-
115
-        for (let settingsNode of this.SettingsNodes)
116
-        {
117
-            for (let translationNode of settingsNode.TranslationNodes)
118
-            {
119
-                let i = result.findIndex((node: TranslationNode) => {
120
-                    return node.FullName === translationNode.FullName
121
-                });
122
-
123
-                if (i >= 0)
124
-                {
125
-                    result[i].Nodes.push(...translationNode.Nodes);
126
-                }
127
-            }
128
-        }
129
-
130
-        return result;
131
-    }
132
-
133
-    public get ObjectsToDelete(): string[]
134
-    {
135
-        return this.objectsToDelete;
136
-    }
137
-}
138 0
\ No newline at end of file
139 1
deleted file mode 100644
... ...
@@ -1,187 +0,0 @@
1
-import ISettingsNode from "./ISettingsNode";
2
-import Localizable from "../Globalization/Localizable";
3
-import NodeCollection from "../Nodes/NodeCollection";
4
-import NodeContainer from "../Nodes/NodeContainer";
5
-import Option from "./Option";
6
-import TranslationNode from "../Globalization/TranslationNode";
7
-import { isNullOrUndefined } from "util";
8
-
9
-/**
10
- * Represents a node that contains options and categories.
11
- */
12
-export default class SettingsNode extends NodeContainer implements ISettingsNode
13
-{
14
-    /**
15
-     * The displayname of the node.
16
-     */
17
-    private displayName: Localizable = new Localizable();
18
-
19
-    /**
20
-     * The description of the node.
21
-     */
22
-    private description: Localizable = new Localizable();
23
-
24
-    /**
25
-     * The nodes contained by this node.
26
-     */
27
-    private settingsNodes: SettingsNode[] = new NodeCollection(this);
28
-
29
-    /**
30
-     * The options contained by this node.
31
-     */
32
-    private options: Option[] = new NodeCollection(this);
33
-
34
-    /**
35
-     * Initializes a new instance of the `SettingsNode` class.
36
-     */
37
-    public constructor(options: ISettingsNode)
38
-    {
39
-        super(options);
40
-
41
-        if (!isNullOrUndefined(options.DisplayName))
42
-        {
43
-            Object.assign(this.DisplayName, options.DisplayName);
44
-        }
45
-
46
-        if (!isNullOrUndefined(options.Description))
47
-        {
48
-            Object.assign(this.Description, options.Description);
49
-        }
50
-
51
-        if (!isNullOrUndefined(options.Nodes))
52
-        {
53
-            this.settingsNodes.push(...options.Nodes);
54
-        }
55
-
56
-        if (!isNullOrUndefined(options.Options))
57
-        {
58
-            this.options.push(...options.Options);
59
-        }
60
-
61
-        if (!isNullOrUndefined(options.Parent))
62
-        {
63
-            this.Parent = options.Parent;
64
-        }
65
-    }
66
-
67
-    public get DisplayName(): Localizable
68
-    {
69
-        return this.displayName;
70
-    }
71
-
72
-    public get FullCategoryName(): string
73
-    {
74
-        return "wcf.acp.option.category." + this.Name;
75
-    }
76
-    
77
-    public get Description(): Localizable
78
-    {
79
-        return this.description;
80
-    }
81
-    
82
-    public get Nodes(): SettingsNode[]
83
-    {
84
-        return this.settingsNodes;
85
-    }
86
-
87
-    public get Options(): Option[]
88
-    {
89
-        return this.options;
90
-    }
91
-
92
-    /**
93
-     * Gets the translation-nodes of the settings-node.
94
-     */
95
-    public get TranslationNodes(): TranslationNode[]
96
-    {
97
-        let rootNodes: TranslationNode[] = [];
98
-        let childNodes: TranslationNode[] = [];
99
-        let translationNode = new TranslationNode({ Name: "wcf.acp.option" });
100
-    
101
-        if (Object.keys(this.DisplayName).length > 0)
102
-        {
103
-            translationNode.Nodes.push(new TranslationNode({
104
-                Name: "category." + this.Name,
105
-                Translations: this.DisplayName
106
-            }));
107
-        }
108
-
109
-        if (Object.keys(this.Description).length > 0)
110
-        {
111
-            translationNode.Nodes.push(new TranslationNode({
112
-                Name: "category." + this.Name,
113
-                Nodes: [
114
-                    new TranslationNode({
115
-                        Name: "description",
116
-                        Translations: this.Description
117
-                    })
118
-                ]
119
-            }));
120
-        }
121
-
122
-        for (let settingsNode of this.Nodes)
123
-        {
124
-            childNodes.push(...settingsNode.TranslationNodes);
125
-        }
126
-
127
-        for (let option of this.Options)
128
-        {
129
-            childNodes.push(...option.TranslationNodes);
130
-        }
131
-
132
-        for (let childNode of childNodes)
133
-        {
134
-            if (childNode.Name === translationNode.Name)
135
-            {
136
-                translationNode.Nodes.push(...childNode.Nodes);
137
-            }
138
-            else if (childNode.GetTranslations().length > 0)
139
-            {
140
-                rootNodes.push(childNode);
141
-            }
142
-        }
143
-
144
-        if (translationNode.GetTranslations().length > 0)
145
-        {
146
-            rootNodes.splice(0, 0, translationNode);
147
-        }
148
-
149
-        return rootNodes;
150
-    }
151
-
152
-    /**
153
-     * Gets all options in this node and all its sub-nodes.
154
-     */
155
-    public GetOptions(): { [id: string]: Option }
156
-    {
157
-        let result: { [id: string]: Option } = { };
158
-        
159
-        for (let option of this.Options)
160
-        {
161
-            result[option.ID] = option;
162
-        }
163
-
164
-        for (let node of this.Nodes)
165
-        {
166
-            Object.assign(result, node.GetOptions());
167
-        }
168
-
169
-        return result;
170
-    }
171
-
172
-    /**
173
-     * Gets all categories in this node and all its sub-nodes.
174
-     */
175
-    public GetCategories(): SettingsNode[]
176
-    {
177
-        let result: SettingsNode[] = [];
178
-        result.push(this);
179
-
180
-        for (let node of this.Nodes)
181
-        {
182
-            result.push(...node.GetCategories());
183
-        }
184
-
185
-        return result;
186
-    }
187
-}
188 0
\ No newline at end of file
189 1
deleted file mode 100644
... ...
@@ -1,16 +0,0 @@
1
-import FilesInstruction from "../FilesInstruction";
2
-import IFilesInstruction from "../IFilesInstruction";
3
-
4
-/**
5
- * Represents an instruction which provides a set of acp-templates.
6
- */
7
-export default class ACPTemplatesInstruction extends FilesInstruction
8
-{
9
-    /**
10
-     * Initializes a new instance of the `TemplatesInstruction` class.
11
-     */
12
-    public constructor(options: IFilesInstruction)
13
-    {
14
-        super(options);
15
-    }
16
-}
17 0
\ No newline at end of file
18 1
deleted file mode 100644
... ...
@@ -1,189 +0,0 @@
1
-import BBCodeAttribute from "./BBCodeAttribute";
2
-import IBBCode from "./IBBCode";
3
-import Localizable from "../Globalization/Localizable";
4
-import TranslationNode from "../Globalization/TranslationNode";
5
-import { isNullOrUndefined } from "util";
6
-
7
-/**
8
- * Represents a bb-code.
9
- */
10
-export default class BBCode implements IBBCode
11
-{
12
-    /**
13
-     * The name of the bb-code.
14
-     */
15
-    private name: string = "";
16
-
17
-    /**
18
-     * The display-name of the bb-code.
19
-     */
20
-    private displayName: Localizable = new Localizable();
21
-
22
-    /**
23
-     * The name of a font-awesome icon for the bb-code button.
24
-     */
25
-    private icon: string = null;
26
-
27
-    /**
28
-     * A class which provides the functionality to parse the bb-code.
29
-     * 
30
-     * Please keep in mind to provide the PHP-script using a `FilesInstruction`.
31
-     */
32
-    private className: string = null;
33
-
34
-    /**
35
-     * The content of the opening HTML-tag.
36
-     */
37
-    private openingTag: string = null;
38
-
39
-    /**
40
-     * The content of the closing HTML-tag.
41
-     */
42
-    private closingTag: string = null;
43
-
44
-    /**
45
-     * A value indicating whether the bb-code is an inline-element.
46
-     */
47
-    private isInline: boolean = true;
48
-
49
-    /**
50
-     * A value whether bb-codes inside this bb-code are converted.
51
-     */
52
-    private isBBCode: boolean = true;
53
-
54
-    /**
55
-     * The attributes of the bb-code.
56
-     */
57
-    private attributes: BBCodeAttribute[] = [];
58
-
59
-    /**
60
-     * Initializes a new instance of the `BBCode` class.
61
-     */
62
-    public constructor(options: IBBCode)
63
-    {
64
-        if (!isNullOrUndefined(options.Name))
65
-        {
66
-            this.name = options.Name;
67
-        }
68
-
69
-        if (!isNullOrUndefined(options.DisplayName))
70
-        {
71
-            Object.assign(this.displayName, options.DisplayName);
72
-        }
73
-
74
-        if (!isNullOrUndefined(options.Icon))
75
-        {
76
-            this.icon = options.Icon;
77
-        }
78
-
79
-        if (!isNullOrUndefined(options.ClassName))
80
-        {
81
-            this.className = options.ClassName;
82
-        }
83
-
84
-        if (!isNullOrUndefined(options.OpeningTag))
85
-        {
86
-            this.openingTag = options.OpeningTag;
87
-        }
88
-
89
-        if (!isNullOrUndefined(options.ClosingTag))
90
-        {
91
-            this.closingTag = options.ClosingTag;
92
-        }
93
-
94
-        if (!isNullOrUndefined(options.IsInline))
95
-        {
96
-            this.isInline = options.IsInline;
97
-        }
98
-
99
-        if (!isNullOrUndefined(options.IsBBCode))
100
-        {
101
-            this.isBBCode = options.IsBBCode;
102
-        }
103
-
104
-        if (!isNullOrUndefined(options.Attributes))
105
-        {
106
-            this.attributes.push(...options.Attributes);
107
-        }
108
-    }
109
-
110
-    public get Name(): string
111
-    {
112
-        return this.name;
113
-    }
114
-
115
-    public set Name(value: string)
116
-    {
117
-        this.name = value;
118
-    }
119
-
120
-    public get DisplayName(): Localizable
121
-    {
122
-        return this.displayName;
123
-    }
124
-
125
-    public get Icon(): string
126
-    {
127
-        return this.icon;
128
-    }
129
-
130
-    public set Icon(value: string)
131
-    {
132
-        this.icon = value;
133
-    }
134
-
135
-    public get ClassName(): string
136
-    {
137
-        return this.className;
138
-    }
139
-
140
-    public set ClassName(value: string)
141
-    {
142
-        this.className = value;
143
-    }
144
-
145
-    public get OpeningTag(): string
146
-    {
147
-        return this.openingTag;
148
-    }
149
-
150
-    public set OpeningTag(value: string)
151
-    {
152
-        this.openingTag = value;
153
-    }
154
-
155
-    public get ClosingTag(): string
156
-    {
157
-        return this.closingTag;
158
-    }
159
-
160
-    public set ClosingTag(value: string)
161
-    {
162
-        this.closingTag = value;
163
-    }
164
-
165
-    public get IsInline(): boolean
166
-    {
167
-        return this.isInline;
168
-    }
169
-
170
-    public set IsInline(value: boolean)
171
-    {
172
-        this.isInline = value;
173
-    }
174
-
175
-    public get IsBBCode(): boolean
176
-    {
177
-        return this.isBBCode;
178
-    }
179
-
180
-    public set IsBBCode(value: boolean)
181
-    {
182
-        this.isBBCode = value;
183
-    }
184
-
185
-    public get Attributes(): BBCodeAttribute[]
186
-    {
187
-        return this.attributes;
188
-    }
189
-}
190 0
\ No newline at end of file
191 1
deleted file mode 100644
... ...
@@ -1,96 +0,0 @@
1
-import IBBCodeAttribute from "./IBBCodeAttribute";
2
-import { isNullOrUndefined } from "util";
3
-
4
-/**
5
- * Represents an attribute of a bb-code.
6
- */
7
-export default class BBCodeAttribute implements IBBCodeAttribute
8
-{
9
-    /**
10
-     * A value indicating whether the attribute is required.
11
-     */
12
-    private required: boolean = false;
13
-
14
-    /**
15
-     * A value indicating if the value of the attribute - if not present - should be taken by the content of the bb-code.
16
-     */
17
-    private valueByContent: boolean = false;
18
-
19
-    /**
20
-     * The code that will be appended to the opening HTML-tag of the bb-code.
21
-     * 
22
-     * `%s` will be replaced by the value of the attribute.
23
-     */
24
-    private code: string = null;
25
-
26
-    /**
27
-     * A regex-pattern for validating the value of the attribute.
28
-     */
29
-    private validationPattern: RegExp = null;
30
-
31
-    /**
32
-     * Initializes a new instance of the `BBCodeAttribute` class.
33
-     */
34
-    public constructor(options: IBBCodeAttribute)
35
-    {
36
-        if (!isNullOrUndefined(options.Required))
37
-        {
38
-            this.required = options.Required;
39
-        }
40
-
41
-        if (!isNullOrUndefined(options.ValueByContent))
42
-        {
43
-            this.valueByContent = options.ValueByContent;
44
-        }
45
-
46
-        if (!isNullOrUndefined(options.Code))
47
-        {
48
-            this.code = options.Code;
49
-        }
50
-
51
-        if (!isNullOrUndefined(options.ValidationPattern))
52
-        {
53
-            this.validationPattern = options.ValidationPattern;
54
-        }
55
-    }
56
-
57
-    public get Required(): boolean
58
-    {
59
-        return this.required;
60
-    }
61
-    
62
-    public set Required(value: boolean)
63
-    {
64
-        this.Required = value;
65
-    }
66
-
67
-    public get ValueByContent(): boolean
68
-    {
69
-        return this.valueByContent;
70
-    }
71
-
72
-    public set ValueByContent(value: boolean)
73
-    {
74
-        this.valueByContent = value;
75
-    }
76
-
77
-    public get Code(): string
78
-    {
79
-        return this.code;
80
-    }
81
-
82
-    public set Code(value: string)
83
-    {
84
-        this.code = value;
85
-    }
86
-
87
-    public get ValidationPattern(): RegExp
88
-    {
89
-        return this.validationPattern;
90
-    }
91
-
92
-    public set ValidationPattern(value: RegExp)
93
-    {
94
-        this.validationPattern = value;
95
-    }
96
-}
97 0
\ No newline at end of file
98 1
new file mode 100644
... ...
@@ -0,0 +1,189 @@
1
+import BBCodeAttribute from "./BBCodeAttribute";
2
+import IBBCode from "./IBBCode";
3
+import Localizable from "../../Globalization/Localizable";
4
+import TranslationNode from "../../Globalization/TranslationNode";
5
+import { isNullOrUndefined } from "util";
6
+
7
+/**
8
+ * Represents a bb-code.
9
+ */
10
+export default class BBCode implements IBBCode
11
+{
12
+    /**
13
+     * The name of the bb-code.
14
+     */
15
+    private name: string = "";
16
+
17
+    /**