[otrs-cvs] otrs/Kernel/Modules AgentTicketQueue.pm, 1.83, 1.84 AdminQueue.pm, 1.86, 1.87

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/Kernel/Modules
In directory lancelot:/tmp/cvs-serv12003/Kernel/Modules

Modified Files:
	AgentTicketQueue.pm AdminQueue.pm 
Log Message:
Fixed bug#7697 - Creating queues: sub-queues after level 4 not shown in dropdown box.

Author: mab

Index: AgentTicketQueue.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AgentTicketQueue.pm,v
retrieving revision 1.83
retrieving revision 1.84
diff -2 -u -d -r1.83 -r1.84
--- AgentTicketQueue.pm	20 Nov 2012 14:51:47 -0000	1.83
+++ AgentTicketQueue.pm	5 Dec 2012 11:11:47 -0000	1.84
@@ -391,36 +391,27 @@
         }
 
-        # should i highlight this queue
-        if ( $Param{SelectedQueue} =~ /^\Q$QueueName[0]\E/ && $Level - 1 >= $#QueueName ) {
-            if ( $#QueueName == 0 && $#MetaQueue >= 0 && $Queue{Queue} =~ /^\Q$MetaQueue[0]\E$/ ) {
-                $QueueStrg .= ' Active';
-            }
-            if (
-                $#QueueName == 1
-                && $#MetaQueue >= 1
-                && $Queue{Queue} =~ /^\Q$MetaQueue[0]::$MetaQueue[1]\E$/
-                )
-            {
-                $QueueStrg .= ' Active';
-            }
-            if (
-                $#QueueName == 2
-                && $#MetaQueue >= 2
-                && $Queue{Queue} =~ /^\Q$MetaQueue[0]::$MetaQueue[1]::$MetaQueue[2]\E$/
-                )
-            {
-                $QueueStrg .= ' Active';
-            }
-            if (
-                $#QueueName == 3
-                && $#MetaQueue >= 3
-                && $Queue{Queue}
-                =~ /^\Q$MetaQueue[0]::$MetaQueue[1]::$MetaQueue[2]::$MetaQueue[3]\E$/
-                )
-            {
-                $QueueStrg .= ' Active';
+        # display the current and all its lower levels in bold
+        my $CheckQueueName;
+        if (
+            $Level > scalar @QueueName
+            && scalar @MetaQueue >= scalar @QueueName
+            && $Param{SelectedQueue} =~ m{ \A \Q$QueueName[0]\E }xms
+            )
+        {
+            my $CheckLevel = 0;
+            CHECKLEVEL:
+            for ( $CheckLevel = 0; $CheckLevel < scalar @QueueName; ++$CheckLevel ) {
+                if ($CheckQueueName) {
+                    $CheckQueueName .= '::';
+                }
+                $CheckQueueName .= $MetaQueue[$CheckLevel];
             }
         }
 
+        # should i display this queue in bold?
+        if ( $CheckQueueName && $Queue{Queue} =~ m{ \A \Q$CheckQueueName\E \z }xms ) {
+            $QueueStrg .= ' Active';
+        }
+
         $QueueStrg .= '">';
 
@@ -437,45 +428,34 @@
         $QueueStrg .= '</a></li>';
 
-        if ( $#QueueName == 0 ) {
-            $Param{QueueStrg1} .= $QueueStrg;
-        }
-        elsif ( $#QueueName == 1 && $Level >= 2 && $Queue{Queue} =~ /^\Q$MetaQueue[0]::\E/ ) {
-            $Param{QueueStrg2} .= $QueueStrg;
-        }
-        elsif (
-            $#QueueName == 2
-            && $Level >= 3
-            && $Queue{Queue} =~ /^\Q$MetaQueue[0]::$MetaQueue[1]::\E/
-            )
-        {
-            $Param{QueueStrg3} .= $QueueStrg;
-        }
-        elsif (
-            $#QueueName == 3
-            && $Level >= 4
-            && $Queue{Queue} =~ /^\Q$MetaQueue[0]::$MetaQueue[1]::$MetaQueue[2]::\E/
-            )
-        {
-            $Param{QueueStrg4} .= $QueueStrg;
+        if ( scalar @QueueName eq 1 ) {
+            $Param{QueueStrg} .= $QueueStrg;
         }
-        elsif (
-            $#QueueName == 4
-            && $Level >= 5
-            && $Queue{Queue}
-            =~ /^\Q$MetaQueue[0]::$MetaQueue[1]::$MetaQueue[2]::$MetaQueue[3]::\E/
-            )
-        {
-            $Param{QueueStrg5} .= $QueueStrg;
+        elsif ( $Level >= scalar @QueueName ) {
+            my $CheckQueueStrgName = '';
+            for ( my $LevelCount = 0; $LevelCount < scalar @QueueName - 1; ++$LevelCount ) {
+                $CheckQueueStrgName .= $MetaQueue[$LevelCount] . '::';
+            }
+            if ( $Queue{Queue} =~ m{ \A \Q$CheckQueueStrgName\E }xms ) {
+
+                $Param{ 'QueueStrg' . scalar @QueueName - 1 } .= $QueueStrg;
+            }
         }
     }
-    for ( 1 .. 5 ) {
-        next if !$Param{ 'QueueStrg' . $_ };
-        $Param{QueueStrg}
-            .= '<ul class="QueueOverviewList">' . $Param{ 'QueueStrg' . $_ } . '</ul>';
+
+    my $Counter = 0;
+    KEYS:
+    for my $Keys ( sort keys %Param ) {
+        if ( $Keys !~ /^QueueStrg/ ) {
+            next KEYS;
+        }
+        $Param{QueueStrgLevel}
+            .= '<ul class="QueueOverviewList Level_' . $Counter . '">' . $Param{$Keys} . '</ul>';
+        $Counter++;
     }
+
     return (
         MainName      => 'Queues',
         SelectedQueue => $Param{SelectedQueue},
-        MainContent   => $Param{QueueStrg},
+        MainContent   => $Param{QueueStrgLevel},
         Total         => $Param{TicketsShown},
     );

Author: mab

Index: AdminQueue.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AdminQueue.pm,v
retrieving revision 1.86
retrieving revision 1.87
diff -2 -u -d -r1.86 -r1.87
--- AdminQueue.pm	20 Nov 2012 14:42:53 -0000	1.86
+++ AdminQueue.pm	5 Dec 2012 11:11:47 -0000	1.87
@@ -513,4 +513,7 @@
     my $ListType = $Self->{ConfigObject}->Get('Ticket::Frontend::ListType');
 
+    # get max queue level
+    my $MaxQueueLevel = $Self->{ConfigObject}->Get('Ticket::Frontend::MaxQueueLevel') || 5;
+
     # verify if queue list should be a list or a tree
     if ( $ListType eq 'tree' ) {
@@ -519,5 +522,5 @@
             Name => 'ParentQueueID',
             Selected       => $ParentQueue,
-            MaxLevel       => 3,
+            MaxLevel       => $MaxQueueLevel,
             OnChangeSubmit => 0,
         );
@@ -525,11 +528,11 @@
     else {
 
-        # leave only queues with 3 levels, because max allowed level is 4:
-        # new queue + 3 levels of parent queue = 4 levels
+    # leave only queues with $MaxQueueLevel levels, because max allowed level is $MaxQueueLevel + 1:
+    # new queue + $MaxQueueLevel levels of parent queue = $MaxQueueLevel + 1 levels
         for my $Key ( sort keys %CleanHash ) {
             my $QueueName      = $CleanHash{$Key};
             my @QueueNameLevel = split( ::, $QueueName );
             my $QueueLevel     = $#QueueNameLevel + 1;
-            if ( $QueueLevel > 3 ) {
+            if ( $QueueLevel > $MaxQueueLevel ) {
                 delete $CleanHash{$Key};
             }
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.