Thread Gruppierungsproblematik, wie lösen? (9 answers)
Opened by mandawar at 2008-02-04 12:51

renee
 2008-02-04 13:51
#105541 #105541
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Geschickt wäre es ungefähr so:

Code: (dl )
1
2
3
4
5
6
7
8
9
HTML-Formular
|
| bei Auswahl Ajax-Request an CGI-Skript
v
zweite Select-Box füllen
|
| bei Auswahl zweiter Select-Box Ajax-Request
v
...


Ein allererster Ansatz könnte sein
Code (perl): (dl )
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
#!/usr/bin/perl

use strict;
use warnings;
use CGI;
use CGI::Ajax;

my $file = 'article.txt';
my %hash = read_articles( $file );

my $cgi = CGI->new;

my $pjx = new CGI::Ajax( 
    'group_one'   => \&group_one,
    'group_two'   => \&group_two,
    'group_three' => \&group_three,
);
print $pjx->build_html( $cgi, \&Show_HTML);

sub group_one{
   # gib Select-Box mit Hauptgruppe zurück
}

sub group_two{
   # gib Select-Box mit Subgruppe in Abhängigkeit von Hauptgruppe zurück
}

sub group_three{
   #...
}

sub read_articles{
   my %hash;
   if( open my $fh, '<', shift ){
      while( my $line = <$fh> ){
         chomp $line;
         my ($art,$g1,$g2,$g3) = split / /, $line;
         push @{ $hash{$g1}->{$g2}->{$g3} }, $art;
      }
   }

   return %hash;
}


Schau Dir mal die Doku zu CPAN:CGI::Ajax an.

Da erst noch was in XML umzuwandeln halte ich für zu umständlich (aber vielleicht hat da jemand anderes eine Idee zu).
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Gruppierungsproblematik, wie lösen?