Individuelle Formulare mit dynamischen Feldern

Allgemein Fragen, deutsche News, Ankündigungen & Events zum OTRS
Post Reply
mesodev
Znuny newbie
Posts: 2
Joined: 10 Aug 2018, 10:03
Znuny Version: OTRS 6 Patch Level 6

Individuelle Formulare mit dynamischen Feldern

Post by mesodev »

Die Kollegen der engl. Seiten scheinen im verdienten Sommerurlaub zu sein. Deswegen stelle ich https://forums.otterhub.org/viewtopic.php?f=53&t=39649 mal auf Deutsch (ewig nicht mehr in einem dt. Forum was geschrieben :D )

Wir haben die Anforderung, dass auch dynamische Felder individuell in einem Template notiert werden sollen. Also z.B. brauchen wir 2 spaltiges Layout.

Bisher haben wir herausgefunden, dass dynamische Felder einfach von OTRS unten angehängt werden. Diesen Workflow müssen wir nun aufbrechen. Wie macht man das am Bestem?
  • OTRS darf nicht mehr selbst die dynamischen Felder anhängen
  • Wie notiere ich dynamische Felder in der tt-Datei, sodass sie erkannt werden?
Danke im Voraus!
RIAIngo
Znuny newbie
Posts: 77
Joined: 26 Nov 2012, 18:18
Znuny Version: 6.0.9
Real Name: Ingo

Re: Individuelle Formulare mit dynamischen Feldern

Post by RIAIngo »

Hallo,

ich weiß nicht genau was gefordert ist, aber wir blenden im Customer Frontend die Dynamischen Felder ein oder aus, je nachdem welche Queue gewählt ist.
Voraussetzung ist das alle dynamischen Felder im Customer Frontend erlaub sind.
Dann editiert man die /opt/otrs/Custom/Kernel/Output/HTML/Templates/Standard/CustomerTicketMessage.tt

Code: Select all

[% RenderBlockEnd("TicketType") %]

[% RenderBlockStart("Queue") %]


# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------				
# Beispiel :
# ----------				
				
#				[% RenderBlockStart("Queue") %]
#                <div>
#                    <label for="Dest" class="Mandatory">
#                        <span class="Marker">*</span>
#                        [% Translate("To") | html %]:
#                    </label>
#                    [% Data.ToStrg %]
#                    <div id="DestError" class="TooltipErrorMessage" ><p>[% Translate("This field is required.") | html %]</p></div>
#                    <div id="DestServerError" class="TooltipErrorMessage NoJavaScriptMessage[% Data.QueueInvalid | html %]" ><p>[% Translate("This field is required.") | html %]</p></div>
#                    <div class="Clear"></div>
#                </div>
#[% WRAPPER JSOnDocumentComplete %]
#<script type="text/javascript">//<![CDATA[
#
#//// START EDIT
#//// myDropDown01 is available and mandatory only for ACME01::Queue1
#//// myTextField01 is available and mandatory for ACME02::Queue2 and ACME02::Queue3
#//// myTextField02 is available and mandatory only for ACME02::Queue3
#//// ACME01::Queue1 and ACME02::Queue1 queues have a subject and body already filled out
#
#$(document).ready(function() {
#
#    function hideDynFields() {
#        $("[id^=DynamicField]").parent().hide();
#        $("[id^=LabelDynamicField]").parent().hide();
#        $("[id^=DynamicField]").removeClass('Validate_Required');
#    }
#    
#    function initText(subValue,bodyValue) {
#        var thisSubject = $('#Subject').val();
#        var thisRichText = CKEDITOR.instances.RichText.getData() ;
#        var sbjLen = thisSubject.length;
#        var textLen = thisRichText.length;
#        var totLen = sbjLen*1 + textLen*1;
#        if (totLen == 0) 
#        {
#            document.compose.Subject.value = subValue;
#            CKEDITOR.instances.RichText.setData( bodyValue, function() {this.checkDirty();});
#        }
#        else 
#        {
#          var r=confirm("Click Ok to keep the data, or Cancel to load the default body and subject");
#          if (r==false)
#          {
#            document.compose.Subject.value = subValue;
#            CKEDITOR.instances.RichText.setData( bodyValue, function() {this.checkDirty();});
#          }
#        }
#		hideDynFields();
#    }
#	
#    function selectQueues() {
#        switch ($('#Dest').val() ) {
#         case  "10||ACME01::Queue1":
#          initText('ACME01::Queue1 subject','<B>ACME01::Queue1</B>&nbsp<br/>body...&nbsp<br/>blah...&nbsp<br/>blah...&nbsp<br/>');
#          $("[id^=DynamicField_myDropDown01]").parent().show();
#          $("[id^=LabelDynamicField_myDropDown01]").parent().show();
#          document.getElementById('DynamicField_myDropDown01').className = 'TicketFreeText Validate_Required ServerError';
#          break;
#		  
#         case  "20||ACME02::Queue1":
#          initText('ACME02::Queue1 subject','<B>ACME02::Queue1</B>&nbsp<br/>body...&nbsp<br/>blah...&nbsp<br/>blah...&nbsp<br/>');
#          break;
#
#         case  "21||ACME02::Queue2":
#          initText('','');
#          $("[id^=DynamicField_myTextField01]").parent().show();
#          $("[id^=LabelDynamicField_myTextField01]").parent().show();
#          document.getElementById('DynamicField_myTextField01').className = 'TicketFreeText Validate_Required ServerError';
#          break;
#
#         case  "22||ACME02::Queue3":
#          initText('','');
#          $("[id^=DynamicField_myTextField01]").parent().show();
#          $("[id^=LabelDynamicField_myTextField01]").parent().show();
#          $("[id^=DynamicField_myTextField02]").parent().show();
#          $("[id^=LabelDynamicField_myTextField02]").parent().show();
#          document.getElementById('DynamicField_myTextField01').className = 'TicketFreeText Validate_Required ServerError';
#          document.getElementById('DynamicField_myTextField02').className = 'TicketFreeText Validate_Required ServerError';
#          break;
#          
#         default:
#          initText('','');
#        } // End switch	
#	} // End selectQueues
#	
#    $('#Dest').bind('change', function (Event) {
#        Core.AJAX.FormUpdate($('#NewCustomerTicket'), 'AJAXUpdate', 'Dest', ['TypeID', 'PriorityID', 'ServiceID', 'SLAID', [% Data.DynamicFieldNamesStrg %]]);
#        selectQueues();
#    });
#
#    selectQueues();
#
#}); // End document ready
#
#//// END EDIT
#
#//]]></script>
#[% END %]
#[% RenderBlockEnd("Queue") %]

# --------------------------------------------------------------------------------------------------------------------------

Post Reply