File: AdminDynamicField.tt

package info (click to toggle)
otrs2 5.0.16-1%2Bdeb9u6
  • links: PTS
  • area: non-free
  • in suites: stretch
  • size: 141,108 kB
  • sloc: perl: 746,356; xml: 54,469; sql: 10,505; sh: 430; makefile: 64
file content (234 lines) | stat: -rw-r--r-- 9,864 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# --
# Copyright (C) 2001-2017 OTRS AG, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

[% RenderBlockStart("Main") %]
<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
    <h1>[% Translate("Dynamic Fields Management") | html %] - [% Translate(Data.Action) | html %]</h1>

    <div class="Clear"></div>

    <div class="SidebarColumn">
        <div class="WidgetSimple">
            <div class="Header">
                <h2>[% Translate("Actions") | html %]</h2>
            </div>
            <div class="Content">
                <ul class="ActionList">
[% RenderBlockStart("ActionAddDynamicField") %]
                    <li>
                        <h4><label for="[% Data.SelectName | html %]">[% Translate(Data.ObjectType) | html %]</label></h4>
                        [% Data.AddDynamicFieldStrg %]
                        <div class="FieldExplanation">
                            <p>[% Translate("Add new field for object") | html %]: [% Translate(Data.ObjectType) | html %]</p>
                        </div>
                    </li>
[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
$('#[% Data.SelectName %]').bind('change', function() {
    if ($(this).val() !== '') {
        Core.Agent.Admin.DynamicField.Redirect($(this).val(), '[% Data.ObjectType %]');

        // reset select value to none
        $(this).val('');
    }
});
//]]></script>
[% END %]
[% RenderBlockEnd("ActionAddDynamicField") %]
                </ul>
            </div>
        </div>

[% RenderBlockStart("ConfigSet") %]
[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
    Core.Config.Set('DynamicFields', [% Data.FieldDialogsConfig %] );
//]]></script>
[% END %]
[% RenderBlockEnd("ConfigSet") %]

[% RenderBlockStart("Hint") %]
        <div class="WidgetSimple">
            <div class="Header">
                <h2>[% Translate("Hint") | html %]</h2>
            </div>
            <div class="Content">
                <div class="FieldExplanation">
                    <p>
                        [% Translate("To add a new field, select the field type from one of the object's list, the object defines the boundary of the field and it can't be changed after the field creation.") | html %]
                    </p>
                </div>
            </div>
        </div>
[% RenderBlockEnd("Hint") %]
    </div>
    <div class="ContentColumn">
        <div class="WidgetSimple">
            <div class="Header">
                <h2>[% Translate("Dynamic Fields List") | html %]</h2>

[% RenderBlockStart("ContextSettings") %]
                <ul class="ContextFunctions">
                    <li class="ContextSettings">
                        <a href="#" id="ShowContextSettingsDialog" title="[% Translate("Settings") | html %]">
                            <i class="fa fa-cog"></i>
                            <span>[% Translate("Settings") | html %]</span>
                        </a>
                    </li>
                </ul>

                <div id="ContextSettingsDialogContainer" class="Hidden">
                    <form action="[% Env("CGIHandle") %]" method="post" id="ContextSettingsDialog">
                        <input type="hidden" name="Action" value="AgentPreferences"/>
                        <input type="hidden" name="Subaction" value="Update"/>
                        <input type="hidden" name="Group" value="[% Data.Group | html %]"/>
                        <input type="hidden" name="RedirectURL" value="[% Data.RequestedURL | html %]"/>
                        <fieldset class="TableLike">
                            <label for="[% Data.PreferencesKey | html %]">[% Translate("Dynamic fields per page") | html %]:</label>
                            <div class="Field">
                                [% Data.PageShownString %]
                            </div>
                            <div class="Clear"></div>
                        </fieldset>
                    </form>
                </div>

[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
$('#ShowContextSettingsDialog').bind('click', function (Event) {
    Core.UI.Dialog.ShowContentDialog($('#ContextSettingsDialogContainer'), [% Translate("Settings") | JSON %], '20%', 'Center', true,
        [
            {
                Label: [% Translate("Submit") | JSON %],
                Type: 'Submit',
                Class: 'Primary'}
        ]);
    Event.preventDefault();
    Event.stopPropagation();
    return false;
});
//]]></script>
[% END %]
[% RenderBlockEnd("ContextSettings") %]

            </div>
            <div class="DynamicFieldsPagination">
                <span class="Pagination">
[% RenderBlockStart("OverviewNavBarPageNavBar") %]
                    [% Data.ResultLong %]
                    [% Data.SiteNavBarLong %]
[% RenderBlockEnd("OverviewNavBarPageNavBar") %]
                </span>
            </div>
            <div class="Clear"></div>

            <div class="DynamicFieldsContent">
                <table class="DataTable" id="DynamicFieldsTable" summary="List of all registered Dynamic Fields">
                    <thead>
                        <tr>
                            <th>[% Translate("Name") | html %]</th>
                            <th>[% Translate("Label") | html %]</th>
                            <th>[% Translate("Order") | html %]</th>
                            <th>[% Translate("Type") | html %]</th>
                            <th>[% Translate("Object") | html %]</th>
                            <th>[% Translate("Validity") | html %]</th>
                            <th>[% Translate("Delete") | html %]</th>
                        </tr>
                    </thead>
                    <tbody>
[% RenderBlockStart("NoDataFound") %]
                        <tr>
                            <td colspan="6">
                                [% Translate("No data found.") | html %]
                            </td>
                        </tr>
[% RenderBlockEnd("NoDataFound") %]
[% RenderBlockStart("DynamicFieldsRow") %]
                        <tr class="MasterAction[% IF Data.ValidID != 1%] Invalid[% END %]" id="DynamicFieldID_[% Data.ID | html %]">
                            <td>
                                <a href="[% Env("Baselink") %]Action=[% Data.ConfigDialog | uri %];Subaction=Change;ObjectType=[% Data.ObjectType | uri %];FieldType=[% Data.FieldType | uri %];ID=[% Data.ID | uri %]" title="[% Data.Name | html %]" class="MasterActionLink">[% Data.Name %]</a>
                            </td>
                            <td>
                                <div>[% Translate(Data.Label) | html %]</div>
                            </td>
                            <td>
                                <div>[% Data.FieldOrder %]</div>
                            </td>
                            <td>
                                <div>[% Translate(Data.FieldTypeName) | html %]</div>
                            </td>
                            <td>
                                <div>[% Translate(Data.ObjectTypeName) | html %]</div>
                            </td>
                            <td>
                                <div>[% Translate(Data.Valid) | html %]</div>
                            </td>
                            <td class="Center">
[% RenderBlockStart("DeleteLink") %]
                                <a class="TrashCan DynamicFieldDelete" href="#" data-query-string="Action=AdminDynamicField;Subaction=DynamicFieldDelete;ID=[% Data.ID | uri %];[% Env("ChallengeTokenParam") | html %]" title="[% Translate("Delete this field") | html %]">[% Translate("Delete this field") | html %]
                                    <i class="fa fa-trash-o"></i>
                                </a>
[% RenderBlockEnd("DeleteLink") %]
                            </td>
                        </tr>
[% RenderBlockEnd("DynamicFieldsRow") %]
                    </tbody>
                </table>
            </div>
        </div>
[% RenderBlockStart("MaxFieldOrder") %]
        <input id="MaxFieldOrder" type="hidden" name="MaxFieldOrder" value="[% Data.MaxFieldOrder | html %]"/>
[% RenderBlockEnd("MaxFieldOrder") %]

        <div class="Clear"></div>
    </div>
</div>
[% RenderBlockEnd("Main") %]

[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
$('.MasterAction').bind('click', function (Event) {
    var $MasterActionLink = $(this).find('.MasterActionLink');
    // only act if the link was not clicked directly
    if (Event.target !== $MasterActionLink.get(0)) {
        window.location = $MasterActionLink.attr('href');
        return false;
    }
});

$('.DynamicFieldDelete').bind('click', function (Event) {

    if (window.confirm([% Translate("Do you really want to delete this dynamic field? ALL associated data will be LOST!") | JSON %])) {

        Core.UI.Dialog.ShowDialog({
            Title: [% Translate("Delete field") | JSON %],
            HTML: [% Translate("Deleting the field and its data. This may take a while...") | JSON %],
            Modal: true,
            CloseOnClickOutside: false,
            CloseOnEscape: false,
            PositionTop: '20%',
            PositionLeft: 'Center',
            Buttons: []
        });

        Core.AJAX.FunctionCall(
            '[% Env("Baselink") %]',
            $(this).data('query-string') + 'Confirmed=1;',
            function() {
                window.location.reload();
            }
        );
    }

    // don't interfere with MasterAction
    Event.stopPropagation();
    Event.preventDefault();
    return false;
});
//]]></script>
[% END %]