File: show.epl

package info (click to toggle)
libembperl-perl 2.5.0-17
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 7,632 kB
  • sloc: ansic: 21,387; perl: 14,497; javascript: 4,280; cpp: 467; xml: 49; makefile: 35; sh: 24
file content (184 lines) | stat: -rw-r--r-- 5,540 bytes parent folder | download | duplicates (10)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
[-
$r = shift ;
-]

<table width="100%">
    <tr bgcolor="#fefcad">
        <td><font size="4">
	  [$ if $fdat{-update_item} $]
	    [= edit1 =] [+ $r->{category_set}{category} +]
	  [$ elsif $fdat{-delete_item} $]
	    [= del1 =]
	  [$ elsif $fdat{-add_item} $]
	    [= add1 =] [+ $r->{category_set}{category} +]
	  [$ else $]
	    [# [= show1 =] #][+ $r->{category_set}{category} +]
	  [$ endif $]
	</font></td>
    </tr>
</table>



[$ if ($item_set = $r->{item_set}) $] [# && (ref ($item_set) ne 'ARRAY' || @$item_set > 0) $]#]

	  [$ if $fdat{-update_item} $]
	    [= edit2 =]
	  [$ elsif $fdat{-delete_item} $]
	    [= del2 =]
	  [$ elsif $fdat{-add_item} $]
	    [= add2 =]
	  [$ else $]
	    [= show2 =]
	  [$ endif $]

[$ if $fdat{-delete_item} && !$r->{error} $]
<P><A HREF="addsel.epl">[= back_to_index =]</A></P>
[$ endif $]

<br>

[-
 $ct = $r->{category_texts};
 $cy = $r->{category_types};
 $cf = $r->{category_fields};
 $cfnl = $r->{category_fields_nolang};
 $rec = $item_set->[0] ;
 $email = $rec -> {email} ;
 $date = $item_set -> {modtime} ;
 $date =~ /^(\d+)-(\d+)-(\d+)/ ;
 $date = $r -> param -> language eq 'de'?"$3.$2.$1":"$1-$2-$3" ;
 $status = eval { $r -> gettext ($item_set->{state} ? 'display' : 'hide') } ;
-]
[# <pre>[- use Data::Dumper -][+ Dumper ($cfnl, $rec) +]</pre> #]

[$if $cfnl && @$cfnl $]
<table width="100%">
    <tr>
        <td>
            <table>
                [$ foreach $type (@$cfnl) $]
                  [$ if $txt = $ct->{$type . '_text'} $]
		     [$ if $cy->{$type} =~ /showstatic/ $]
			     [- @txt = split (/\n/, $txt) -][$ foreach $t (@txt) $][+ $t +]<br>[$ endforeach $]
		     [$ elsif $cy->{$type} !~ /static/ $]
                        <tr>
                           <td valign=top>[+ $txt +]:</td><td>
			   [$ if $cy->{$type} =~ /pulldown/ $]
			     [+ $r->app->get_title($r,$type,$rec->{$type}) +]
			   [$ elsif $cy->{$type} =~ /checkboxrow/ $]
			     [-
			       %selected = map { $_ => 1 } split ("\t", $rec->{$type});
			       #warn "selected checkboxes: ", Data::Dumper->Dumper (\%selected), "\n";
			       if ($type =~ /^(.*?)_id$/) {
				   $table = $1 ;
			       } else {
				   $table = $type;
			       }
			       $table =~ s/^.*__// ;
			       $poss = $r->app->get_titles($r,$table);
			       $i = 0;
			       $moreThanOne = 0;
			     -]
			     [$ while $t = ($poss->[$i++]) $]
			       [# - #warn "checkboxrow[$i] = ", Data::Dumper->Dumper ($t), "\n"; - #]
			       [+ $selected{$t->{id}} ? ($moreThanOne++ ? ", " : "") . $t->{title} : "" +]
			     [$ endwhile $]
			   [$ elsif $cy->{$type} =~ /checkbox/ $]
			     <!-- Todo: Internationalisierung per Tabelle ... -->
			     [+ $r -> param -> language eq 'de'?($rec->{$type}?'Ja':'Nein'):($rec->{$type}?'Yes':'No') +]
			   [$ else $]
				[- @txt = split (/\n/, $rec -> {$type}) -][$ foreach $t (@txt) $][+ $t +]<br>[$ endforeach $]
			   [$ endif $]
			   </td>
                        </tr>
                    [$endif$]
                  [$endif$]
                [$endforeach$]
            </table>
        </td>
    </tr>
</table>
[$endif$]
[$if $cf && @$cf $]
<table width="100%">
    <tr bgcolor="#fefcad">
        [- $rec = $item_set->[$row] -]
        <td><font size=3><b>[+ $rec -> {name} +]</b></font></td>
    </tr>
    <tr>
        <td>
            <table>
                [$ foreach $type (@$cf) $]
		  [$ if $cy->{$type} !~ /static/ $]
                    [$ if $txt = $ct->{$type . '_text'} $]
                        <tr>
                           <td valign=top>[+ $txt +]:</td>
			   <td>
			     [$ if $cy->{$type} =~ /pulldown/ $]
			       [+ $r->app->get_title($r,$type,$rec->{$type}) +]
			     [$ elsif $cy->{$type} =~ /checkboxrow/ $]
			       [-
				 %selected = map { $_ => 1 } split ("\t", $rec->{$type});
				 if ($type =~ /^(.*?)_id$/) {
				   $table = $1 ;
			         } else {
				   $table = $type;
			         }
				 $table =~ s/^.*__// ;
				 $poss = $r->app->get_titles($r,$table);
			         $i = 0;
				 $moreThanOne = 0;
			       -]
			       [$ while $t = ($poss->[$i++]) $]
			         [- warn "checkboxrow[$i] = ", Data::Dumper->Dumper ($t), "\n"; -]
				 [+ $selected{$t->{id}} ? ($moreThanOne++ ? ", " : "") . $t->{title} : "" +]
			       [$ endwhile $]
			     [$ elsif $cy->{$type} =~ /checkbox/ $]
			       <!-- Todo: Internationalisierung per Tabelle ... -->
			       [$ if $rec->{$type} $]
				 Ja
			       [$ else $]
				 Nein
			       [$ endif $]
			     [$ else $]
			       [- @txt = split (/\n/, $rec-> {$type}) -]
			       [$ foreach $t (@txt) $]
				   [+ $t +]<br>
			       [$ endforeach $]
			     [$ endif $]
			   </td>
                        </tr>
                    [$endif$]
                  [$endif$]
                [$endforeach$]
            </table>
        </td>
    </tr>
</table>
[$endif$]

<hr>
[$ if $udat{user_email} $]
[- $tt = $r->{category_set}{table_type} -]
<A HREF="add.epl?category_id=[+ $fdat{category_id} +]">[New]</A>&nbsp;&nbsp;
<A HREF="add.epl?[+ $tt +]_id=[+ $fdat{"${tt}_id"} +]&amp;-edit_item=1&amp;category_id=[+ $fdat{category_id} +]">[Edit]</A>&nbsp;&nbsp;
<A HREF="list.epl?category_id=[+ $fdat{category_id} +]">[Overview]</A>
[$ endif $]
&nbsp;&nbsp; Owner: [+ $email +]
&nbsp;&nbsp; Status: [+ $status +]
&nbsp;&nbsp; [+ $date +]
<br>


[$ endif $]

<br><br>

[#
[! use Data::Dumper; !]
[- $DBIx::Recordset::FetchsizeWarn = 0; -]
<PRE>
[+ Dumper $r->{error},\%fdat,[keys %$r],[@{$r->{category_fields}}],{%{$r->{category_texts}}},{%{$r->{category_set}}},$r->{item_set} +]
</PRE>
#]