Thread Treemenu Admin Script: funzt nich... (13 answers)
Opened by FlorianL at 2007-06-08 10:13

renee
 2007-06-11 10:57
#77391 #77391
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
*) Numerischer Vergleich geht mit ==, also if ($use_preserved == 0) {

*) Statt der vielen if-elsif's würde ich mit einer Schleife arbeiten:

Statt:
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
44
45
46
47
48
       my $use_buildall = $confquery->param('buildall');
       my $use_highlight = $confquery->param('highlight');
       my $use_preserved = $confquery->param('preservedstate');
       my $use_startallopen = $confquery->param('startallopen');
       my $use_frames = $confquery->param('useframes');
       my $use_icons = $confquery->param('useicons');
       my $use_textlinks = $confquery->param('usetextlinks');
       my $use_wraptext = $confquery->param('wraptext');
    if ($use_buildall eq '0') {
           print CONFIG_HEAD ("BUILDALL = 0\n")
    } elsif ($use_buildall eq '1') {
        print CONFIG_HEAD ("BUILDALL = 1\n")
    }
    if ($use_highlight eq '0') {
               print CONFIG_HEAD ("HIGHLIGHT = 0\n")
       } elsif ($use_highlight eq '1') {
               print CONFIG_HEAD ("HIGHLIGHT = 1\n")
       }
       if ($use_preserved eq '0') {
               print CONFIG_HEAD ("PRESERVESTATE = 0\n")
       } elsif ($use_preserved eq '1') {
               print CONFIG_HEAD ("PRESERVESTATE = 1\n")
       }
       if ($use_startallopen eq '0') {
               print CONFIG_HEAD ("STARTALLOPEN = 0\n")
       } elsif ($use_startallopen eq '1') {
               print CONFIG_HEAD ("STARTALLOPEN = 1\n")
       }
       if ($use_frames eq '0') {
               print CONFIG_HEAD ("USEFRAMES = 0\n")
       } elsif ($use_frames eq '1') {
               print CONFIG_HEAD ("USEFRAMES = 1\n")
       }
       if ($use_icons eq '0') {
               print CONFIG_HEAD ("USEICONS = 0\n")
       } elsif ($use_icons eq '1') {
               print CONFIG_HEAD ("USEICONS = 1\n")
       }
       if ($use_textlinks eq '0') {
               print CONFIG_HEAD ("USETEXTLINKS = 0\n")
       } elsif ($use_textlinks eq '1') {
               print CONFIG_HEAD ("USETEXTLINKS = 1\n")
       }
       if ($use_wraptext eq '0') {
               print CONFIG_HEAD ("WRAPTEXT = 0\n")
       } elsif ($use_wraptext eq '1') {
               print CONFIG_HEAD ("WRAPTEXT = 1\n")
       }


das hier:
Code (perl): (dl )
1
2
3
4
5
6
my @fields = qw(buildall highlight preservedstate startallopen useframes useicons usetextlinks wraptext);

for my $field ( @fields ){
    my $value = $confquery->param( $field ) == 1 ? 1 : 0;
    print CONFIG_HEAD uc($field), "=", $value, "\n";
}
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 Treemenu Admin Script: funzt nich...