File: AdminSelectBox.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 (138 lines) | stat: -rw-r--r-- 6,221 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
# --
# 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.
# --

<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
    <h1>[% Translate("SQL Box") | html %]</h1>

    <div class="SidebarColumn">
        <div class="WidgetSimple">
            <div class="Header">
                <h2>[% Translate("Hint") | html %]</h2>
            </div>
            <div class="Content">
[% RenderBlockStart("ExplanationOnlySelect") %]
                <p class="FieldExplanation">
                    [% Translate("Here you can enter SQL to send it directly to the application database. It is not possible to change the content of the tables, only select queries are allowed.") | html %]
                </p>
[% RenderBlockEnd("ExplanationOnlySelect") %]
[% RenderBlockStart("ExplanationAllSqlQueries") %]
                <p class="FieldExplanation">
                    [% Translate("Here you can enter SQL to send it directly to the application database.") | html %]
                </p>
[% RenderBlockEnd("ExplanationAllSqlQueries") %]
            </div>
        </div>
    </div>

    <div class="ContentColumn">
        <div class="WidgetSimple">
            <div class="Header">
                <h2>[% Translate("Options") | html %]</h2>
            </div>
            <div class="Content">

                <form action="[% Env("CGIHandle") %]" method="post" class="Validate" id="AdminSelectBoxForm">
                    <input type="hidden" name="Action" value="[% Env("Action") %]"/>
                    <input type="hidden" name="Subaction" value="Select"/>
                    <fieldset class="TableLike FixedLabelSmall">

                        <label class="Mandatory" for="SQL"><span class="Marker">*</span> [% Translate("SQL") | html %]:</label>
                        <div class="Field">
                            <textarea name="SQL" id="SQL" rows="3" class="W100pc Validate_Required [% Data.SQLInvalid | html %]">[% Data.SQL | html %]</textarea>
                            <div id="SQLError" class="TooltipErrorMessage"><p>[% Translate("This field is required.") | html %]</p></div>
                            <div id="SQLServerError" class="TooltipErrorMessage">
                                <p>
[% RenderBlockStart("FieldRequiredServerError") %]
                                    [% Translate("This field is required.") | html %]
[% RenderBlockEnd("FieldRequiredServerError") %]
[% RenderBlockStart("SQLIsNotSelectServerError") %]
                                    [% Translate("Only select queries are allowed.") | html %]
[% RenderBlockEnd("SQLIsNotSelectServerError") %]
[% RenderBlockStart("SQLSyntaxServerError") %]
                                    [% Translate("The syntax of your SQL query has a mistake. Please check it.") | html %]
[% RenderBlockEnd("SQLSyntaxServerError") %]
[% RenderBlockStart("BindParamServerError") %]
                                    [% Translate("There is at least one parameter missing for the binding. Please check it.") | html %]
[% RenderBlockEnd("BindParamServerError") %]

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

                        <label for="Max">[% Translate("Limit") | html %]:</label>
                        <div class="Field">
                            <input type="text" name="Max" id="Max" value="[% Data.Max | html %]" class="W50px" />
                        </div>
                        <div class="Clear"></div>

                        <label for="ResultFormat">[% Translate("Result format") | html %]:</label>
                        <div class="Field">
                            [% Data.ResultFormatStrg %]
                        </div>
                        <div class="Clear"></div>

                        <div class="Field SpacingTop">
                            <button class="Primary CallForAction" type="submit" id="Run" value="[% Translate("Run Query") | html %]"><span>[% Translate("Run Query") | html %]</span></button>
                        </div>
[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
Core.Form.Validate.SetSubmitFunction($('#AdminSelectBoxForm'), function (Form) {
    Form.submit();

    if ($('#ResultFormat option:selected').text() !== 'CSV'
        && $('#ResultFormat option:selected').text() !== 'Excel'
     ) {
        window.setTimeout(function(){
            Core.Form.DisableForm( $(Form) );
        }, 0);
    }
});
//]]></script>
[% END %]
                    </fieldset>
                </form>
            </div>
        </div>

[% RenderBlockStart("Result") %]
        <div class="WidgetSimple">
            <div class="Header">
                <h2>[% Translate("Results") | html %]</h2>
            </div>
            <div class="Content">
                <table class="DataTable">
                    <thead>
                        <tr>
[% RenderBlockStart("ColumnHead") %]
                            <th>[% Data.ColumnName | html %]</th>
[% RenderBlockEnd("ColumnHead") %]
                        </tr>
                    </thead>
                    <tbody>
[% RenderBlockStart("NoMatches") %]
                        <tr><td colspan="[% Data.Colspan | html %]">[% Translate("No matches found.") | html %]</td></tr>
[% RenderBlockEnd("NoMatches") %]
[% RenderBlockStart("NoSelectResult") %]
                        <tr><td colspan="[% Data.Colspan | html %]">[% Translate("Query is executed.") | html %]</td></tr>
[% RenderBlockEnd("NoSelectResult") %]
[% RenderBlockStart("Row") %]
                        <tr>
[% RenderBlockStart("Cell") %]
                            <td title="[% Data.Content | html %]">[% Data.Content | truncate(80) | html %]</td>
[% RenderBlockEnd("Cell") %]
                        </tr>
[% RenderBlockEnd("Row") %]
                    </tbody>
                </table>
            </div>
        </div>
[% RenderBlockEnd("Result") %]
    </div>
    <div class="Clear"></div>
</div>