DTL Template: Priorität lässt sich nicht anpassen

English! place to talk about development, programming and coding
Post Reply
TheoFontane
Znuny newbie
Posts: 9
Joined: 26 Feb 2009, 17:03

DTL Template: Priorität lässt sich nicht anpassen

Post by TheoFontane »

Hallo,

ich habe den Formulareditor von Intelligent Surfaces verwendet und habe nun das Problem, dass die Standardpriorität des Tickets immer auf "1 sehr niedrig" steht. Besser wäre, wenn die Priorität auf "3 normal" steht. Dieses einfache Vorhaben gestaltet sich als weitaus schwieriger als angenommen.

Da die Standardpriorität bei diesem Formular nicht greift, versuche ich die Änderung über den Code vorzunehmen.

Ich habe es zuerst über ein JavaScript versucht:

Code: Select all

<script type="text/javascript">
	//die Priorität "normal" soll ausgewählt sein
	for(i = 0; i < document.getElementById('priority').options.length; i++)
    {
        if("3" == document.getElementById('priority').options[i].value)
        {
            document.getElementById('priority').options[i].selected = true;
            break;
        }
    }	
</script>
Leider scheint dies weder im IE noch im Firefox zu funktionieren.

Also habe ich es über eine bedingte Zuweisung mittels "dtl if" probiert:

Code: Select all

<select name="priority">
   <!-- dtl:block:ViewFormAjaxQuestionPriority -->
   <dtl set $Data{"Selektiert"} = "blub">
   <dtl if ($Data{"Name"} eq "3 normal") {$Data{"Selektiert"} = " selected="selected"";}>
   <option value="$QData{"ID"}" $Data{"Selektiert"}>$QData{"Name"} $QData{"Selektiert"} option>
   <!-- dtl:block:ViewFormAjaxQuestionPriority -->
</select>
Interessanterweise greift der IF-Block überhaupt nicht. Auch dann nicht, wenn ich die folgende Zeile schreibe:

Code: Select all

<dtl if ($Data{"Selektiert"} eq $Data{"Selektiert"}) {$Data{"Selektiert"} = "Hugo";}>
Ich habe zwei Fragen:
1.) Wie kann ich noch die Priorität auf "3 normal" umstellen?
2.) Warum funktioniert der "dtl if" - Block nicht?

Ich bin neu in Perl und für jeden Hinweis dankbar!

So sieht übrigens nachher der HTML-Code des Dropdowns aus:
<select name="priority">
<!--start ViewFormAjaxQuestionPriority-->
<option value="1" blub="">1 sehr niedrig blub </option>
<!--stop ViewFormAjaxQuestionPriority -->
<!--start ViewFormAjaxQuestionPriority-->
<option value="2" blub="">2 niedrig blub </option>
<!--stop ViewFormAjaxQuestionPriority -->
<!--start ViewFormAjaxQuestionPriority-->
<option value="3" blub="">3 normal blub </option>
<!--stop ViewFormAjaxQuestionPriority -->
<!--start ViewFormAjaxQuestionPriority-->
<option value="4" blub="">4 hoch blub </option>
<!--stop ViewFormAjaxQuestionPriority -->
<!--start ViewFormAjaxQuestionPriority-->
<option value="5" blub="">5 sehr hoch</option>
<!--stop ViewFormAjaxQuestionPriority -->
</select>
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

DTL Template: Priorität lässt sich nicht anpassen

Post by jojo »

Hast Du ein bestehendes Template geändert oder ein neues erstellt?

Gibt es ein Modul das das Template verarbeitet?
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
TheoFontane
Znuny newbie
Posts: 9
Joined: 26 Feb 2009, 17:03

noch keine Lösung

Post by TheoFontane »

Ich habe ein bestehendes Template verändert. Das Template heißt "IS.dtl" und es wird von dem Modul "AjaxIS.pm" verarbeitet.

Ich verstehe deinen Gedankengang: es könnte sein, dass ein Element im Modul meine Variable überschreibt. Dies schließe ich aber aktuell aus, da ich die Variable zum ersten Mal direkt im Template erzeuge und gleich wieder verwenden möchte. Dazu ist der Variablenname auf Deutsch.

Ich verstehe nach wie vor nicht, warum selbst eine einfache "dtl if" - Anweisung wie

Code: Select all

<dtl if (1 == 1) {$Data{"Selektiert"} = "Es funktioniert";}>
nicht funktionieren kann.
Post Reply