Debian Codegraph @

eg/web/db/list.epl

raw
1 [-
2 $r = shift ;
3 $set = $r -> {item_set} ;
4 $$set -> Reset ;
5
6 $tt = $r->{category_set}{table_type};
7 $cy = $r->{category_types};
8 $cf = $r->{category_fields};
9 $cfnl = $r->{category_fields_nolang};
10 $title_type = $r->{category_title_type};
11 $fdat{-mode} = $udat{-displaymode} = $fdat{-mode} || $udat{-displaymode} ;
12
13 -]
14
15 [$ sub show_field $]
16 [* my ($type, $rec) = @_ ; *]
17 [$ if $r->{category_types}{$type} =~ /url/ $]
18 <A HREF="[+ do { local $escmode = 0; $rec -> {$type} } +]">[+ $rec -> {$type} +]</A>
19 [$ elsif $cy->{$type} =~ /pulldown/ $]
20 [+ $r->app->get_title($r,$type,$rec->{$type}) +]
21 [$ else $]
22 [- $txt = $rec -> {$type}; -]
23 [$ if $fdat{-mode} eq 'shortlist' $][-
24 $txt =~ s/\s+/ /gom;
25 if ( length ($txt) > 85 ) {
26 $txt = substr ($txt, 0, 80) . " ..." ;
27 }
28 -][+ $txt +]
29 [$ else $][-
30 @txt = split (/\n/, $txt);
31 -][$ foreach $t (@txt) $][+ $t +]<br>[$ endforeach $]
32 [$ endif $]
33 [$ endif $]
34 [$endsub$]
35
36 [$ sub show_edit $]
37 [* my ($rec) = @_ ; *]
38 [[
39
40 [+ $rec->{email} +] | [+ $date +]
41 [$ if ($r->{user_id} && $r->{user_id} == $rec->{user_id}) || $r->{user_admin} $]
42 |
43 [+ $r -> gettext($r->{item_set}{state} ? 'display' : 'hide') +]
44 |
45 <A HREF="show.epl?[+ $tt +]_id=[+ $rec->{$tt.'_id'} +]&-show_item=1&category_id=[+ $rec->{category_id} +]">View</A>
46 |
47 <A HREF="add.epl?[+ $tt +]_id=[+ $rec->{$tt.'_id'} +]&-edit_item=1&category_id=[+ $rec->{category_id} +]">Edit</A>
48 [$ endif $]
49 |
50 <a href="#top">Top</a>
51 ]
52
53 [$endsub$]
54
55 <p>
56 [= displaymode =]:
57 &nbsp;[[<a href="list.epl?[+ { %fdat, -mode => 'shortlist' } +]">[= shortlist =]</a>]
58 &nbsp;[[<a href="list.epl?[+ { %fdat, -mode => 'longlist' } +]">[= longlist =]</a>]
59 &nbsp;[[<a href="list.epl?[+ { %fdat, -mode => 'tab' } +]">[= table =]</a>]
60 </p>
61
62 <table width="100%" border="0" cellspacing="0" cellpadding="6">
63 <tr>
64 <td class="cPodH1">[+ $r -> {category_set}{category} +]<br>
65 ([= items_of =] [+ $r -> {user_email} +][+ $r->{user_admin}?"[admin]":'' +])</td>
66 <td class="cPodH1Link"><a href="add.epl?category_id=[+ $fdat{category_id} +]">[= add_item =]</a></td>
67 </tr>
68 <tr><td colspan="2" height="5"></td></tr>
69 </table>
70
71
72 <table width="100%" border="0" cellspacing="3" cellpadding="4">
73 [$ if $fdat{-mode} eq 'tab' $]
74 [# --- tabelle --- #]
75 <tr>
76 [$ foreach $type ((@$cfnl, @$cf)) $]
77 [$ if $r->{category_types}{$type} !~ /static/ $]
78 <td valign="top" bgcolor="#bbbbdd">
79 <a href="list.epl?[+ { %fdat, -order => $type } +]"><b>[+ $r->{category_texts}{$type.'_text'}
80 +]</b></a></td>
81 [$endif$]
82 [$ endforeach $]
83 </tr>
84 [$else $]
85 [# --- liste --- #]
86 <colgroup>
87 <col width="5%">
88 <col width="90%">
89 <col width="5%">
90 </colgroup>
91 [$endif$]
92
93 [- $$set -> Reset -]
94 [$ while ($rec = $$set -> Next) $]
95
96 [$ if ($r -> {user_id} and (($r -> {user_id} == $rec->{user_id}) or ($r -> {user_admin}))) $]
97 [-
98 $date = $rec -> {modtime} ;
99 $date =~ /^(\d+)-(\d+)-(\d+)/ ;
100 $date = $r -> param -> language eq 'de'?"$3.$2.$1":"$1-$2-$3" ;
101 -]
102
103 [$ if $fdat{-mode} eq 'tab' $]
104 [# --- tabelle --- #]
105 <tr>
106 [$ foreach $type ((@$cfnl, @$cf)) $]
107 [$ if $r->{category_types}{$type} !~ /static/ $]
108 <td valign="top" bgcolor="#eeeeee">[- show_field($type, $rec) -]</td>
109 [$endif$]
110 [$ endforeach $]
111 <td valign="top">[- show_edit($rec) -]</td>
112 </tr>
113 [$else $]
114 [# --- liste --- #]
115 <tr>
116 <td colspan="2" class="cPodH2">
117 [$ if $cy->{$title_type} =~ /pulldown/ $]
118 [+ $r->app->get_title($r,$title_type,$rec->{$title_type}) +]
119 [$ else $]
120 [+ $rec -> {$title_type} +]
121 [$ endif $]
122 </td>
123 <td align="right" nowrap class="cPodH2Link">[- show_edit($rec) -]</td>
124 </tr>
125
126
127 [$ foreach $type (grep { $_ ne $title_type } (@$cfnl, @$cf)) $]
128 [$ if $r->{category_types}{$type} !~ /static/ $]
129 <tr>
130 <td valign="top"><b>[+ $r->{category_texts}{$type.'_text'} +]</b></td>
131 <td colspan="2" valign="top">[- show_field($type, $rec) -]</td>
132 </tr>
133 [$endif$]
134 [$ endforeach $]
135 [$endif$]
136 [$ endif $]
137 [$ endwhile $]
138 </table>
139