File: CustomerTicketProcess.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 (139 lines) | stat: -rw-r--r-- 6,924 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
# --
# 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("RichText") %]
<script src="[% Config("Frontend::RichTextPath") %]ckeditor.js" type="text/javascript"></script>
[% RenderBlockEnd("RichText") %]

<div id="MainBox" class="TicketProcess ARIARoleMain">
    <div class="Content">
        <form action="[% Env("CGIHandle") %]" method="post" enctype="multipart/form-data" name="compose" id="NewProcessTicket" class="Validate PreventMultipleSubmits">
            <input type="hidden" name="Action" value="[% Env("Action") %]"/>
            <input type="hidden" name="Subaction" value="DisplayActivityDialog"/>
            <input type="hidden" name="FormID" value="[% Data.FormID | html %]"/>
            <fieldset>
                <div>
[% RenderBlockStart("ProcessList") %]
                    <label class="Mandatory" for="ProcessEntityID"><span class="Marker">*</span>[% Translate("Process") | html %]:</label>
                    [% Data.ProcessList %]
                    <div id="ProcessEntityIDError" class="TooltipErrorMessage"><p>[% Translate("This field is required.") | html %]</p></div>
                    <div id="ProcessEntityIDServerError" class="TooltipErrorMessage"><p>[% Translate("This field is required.") | html %]</p></div>
                </div>
                <div class="Spacing Clear"></div>
[% RenderBlockEnd("ProcessList") %]
            </fieldset>
        </form>
        <div id="AJAXLoader" class="Spacing Center Hidden">
            <span class="AJAXLoader" title="[% Translate("Loading") | html %]"></span>
        </div>
        <div id="ActivityDialogContent"></div>
    </div>
</div>
[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
    $('#ProcessEntityID').bind('change', function() {

        // remove/destroy CKEditor instances
        // This is needed to initialize other instances (in other activity dialogs)
        // without a page reload
        if (typeof CKEDITOR !== 'undefined' && CKEDITOR.instances) {
            $.each(CKEDITOR.instances, function (Key, Value) {
                CKEDITOR.instances[Key].destroy();
            });
        }

        if ($('#ProcessEntityID').val()) {

            // remove the content of the activity dialog
            $('#ActivityDialogContent').empty();

            // fade out the empty container so it will fade in again on processes change
            // is not recommended to empty after fade out at this point since the transition offect
            // will not look so nice
            $('#ActivityDialogContent').fadeOut('fast');

            // show loader icon
            $('#AJAXLoader').removeClass('Hidden');

            // get new ActivityDialog content
            Core.AJAX.FunctionCall('[% Env("Baselink") %]', 'Action=[% Env("Action") %];Subaction=DisplayActivityDialogAJAX;IsMainWindow=1;IsAjaxRequest=1;ProcessEntityID=' + $('#ProcessEntityID').val(), function (Response) {
                var $ElementToUpdate = $('#ActivityDialogContent'),
                    JavaScriptString = '',
                    ErrorMessage = '';
                if (!Response) {

                    // We are out of the OTRS App scope, that's why an exception would not be caught. Therefor we handle the error manually.
                    Core.Exception.HandleFinalError(new Core.Exception.ApplicationError("No content received.", 'CommunicationError'));
                    $('#AJAXLoader').addClass('Hidden');
                }
                else if ($ElementToUpdate && isJQueryObject($ElementToUpdate) && $ElementToUpdate.length) {
                    $ElementToUpdate.get(0).innerHTML = Response;
                    $ElementToUpdate.find('script').each(function() {
                        JavaScriptString += $(this).html();
                        $(this).remove();
                    });
                    $ElementToUpdate.fadeIn();
                    try {
                        /*jslint evil: true */
                        eval(JavaScriptString);
                    }
                    catch (Exception) {}

                    // Handle special server errors (Response = <div class="ServerError" data-message="Message"></div>)
                    // Check if first element has class 'ServerError'
                    if ( $ElementToUpdate.children().first().hasClass('ServerError') ) {
                        ErrorMessage = $ElementToUpdate.children().first().data('message');

                        // Add class ServerError to the process select element
                        $('#ProcessEntityID').addClass('ServerError');
                        // Set a custom error message to the proccess select element
                        $('#ProcessEntityIDServerError').children().first().text(ErrorMessage);
                    }

                    Core.Form.Validate.Init();
                    $('#AJAXLoader').addClass('Hidden');
                    $('#AJAXDialog').val('1');

                    Core.UI.InputFields.Activate($ElementToUpdate);
                    // Register event for tree selection dialog
                    Core.UI.TreeSelection.InitTreeSelection();

                    // move help triggers into field rows for dynamic fields
                    $('.Row > .FieldHelpContainer').each(function() {
                        if (!$(this).next('label').find('.Marker').length) {
                            $(this).prependTo($(this).next('label'));
                        }
                        else {
                            $(this).insertAfter($(this).next('label').find('.Marker'));
                        }
                    });

                    // Initially display dynamic fields with TreeMode = 1 correctly
                    Core.UI.TreeSelection.InitDynamicFieldTreeViewRestore();
                }
                else {

                    // We are out of the OTRS App scope, that's why an exception would not be caught. Therefor we handle the error manually.
                    Core.Exception.HandleFinalError(new Core.Exception.ApplicationError("No such element id: " + $ElementToUpdate.attr('id') + " in page!", 'CommunicationError'));
                    $('#AJAXLoader').addClass('Hidden');
                }
            }, 'html');
        }
        else {
            $('#ActivityDialogContent').fadeOut(400, function() {
                $('#ActivityDialogContent').empty();
            });
        }
        return false;
    });
//]]></script>
[% RenderBlockStart("PreSelectProcess") %]
<script type="text/javascript">//<![CDATA[
$('#ProcessEntityID').val('[% Data.ProcessID | html %]').trigger('change');
//]]></script>
[% RenderBlockEnd("PreSelectProcess") %]
[% END %]