| 1 |
[- |
| 2 |
$r = shift ; |
| 3 |
-] |
| 4 |
|
| 5 |
<table width="100%"> |
| 6 |
<tr bgcolor="#fefcad"> |
| 7 |
<td><font size="4"> |
| 8 |
[$ if $fdat{-update_item} $] |
| 9 |
[= edit1 =] [+ $r->{category_set}{category} +] |
| 10 |
[$ elsif $fdat{-delete_item} $] |
| 11 |
[= del1 =] |
| 12 |
[$ elsif $fdat{-add_item} $] |
| 13 |
[= add1 =] [+ $r->{category_set}{category} +] |
| 14 |
[$ else $] |
| 15 |
[# [= show1 =] #][+ $r->{category_set}{category} +] |
| 16 |
[$ endif $] |
| 17 |
</font></td> |
| 18 |
</tr> |
| 19 |
</table> |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
[$ if ($item_set = $r->{item_set}) $] [# && (ref ($item_set) ne 'ARRAY' || @$item_set > 0) $]#] |
| 24 |
|
| 25 |
[$ if $fdat{-update_item} $] |
| 26 |
[= edit2 =] |
| 27 |
[$ elsif $fdat{-delete_item} $] |
| 28 |
[= del2 =] |
| 29 |
[$ elsif $fdat{-add_item} $] |
| 30 |
[= add2 =] |
| 31 |
[$ else $] |
| 32 |
[= show2 =] |
| 33 |
[$ endif $] |
| 34 |
|
| 35 |
[$ if $fdat{-delete_item} && !$r->{error} $] |
| 36 |
<P><A HREF="addsel.epl">[= back_to_index =]</A></P> |
| 37 |
[$ endif $] |
| 38 |
|
| 39 |
<br> |
| 40 |
|
| 41 |
[- |
| 42 |
$ct = $r->{category_texts}; |
| 43 |
$cy = $r->{category_types}; |
| 44 |
$cf = $r->{category_fields}; |
| 45 |
$cfnl = $r->{category_fields_nolang}; |
| 46 |
$rec = $item_set->[0] ; |
| 47 |
$email = $rec -> {email} ; |
| 48 |
$date = $item_set -> {modtime} ; |
| 49 |
$date =~ /^(\d+)-(\d+)-(\d+)/ ; |
| 50 |
$date = $r -> param -> language eq 'de'?"$3.$2.$1":"$1-$2-$3" ; |
| 51 |
$status = eval { $r -> gettext ($item_set->{state} ? 'display' : 'hide') } ; |
| 52 |
-] |
| 53 |
[# <pre>[- use Data::Dumper -][+ Dumper ($cfnl, $rec) +]</pre> #] |
| 54 |
|
| 55 |
[$if $cfnl && @$cfnl $] |
| 56 |
<table width="100%"> |
| 57 |
<tr> |
| 58 |
<td> |
| 59 |
<table> |
| 60 |
[$ foreach $type (@$cfnl) $] |
| 61 |
[$ if $txt = $ct->{$type . '_text'} $] |
| 62 |
[$ if $cy->{$type} =~ /showstatic/ $] |
| 63 |
[- @txt = split (/\n/, $txt) -][$ foreach $t (@txt) $][+ $t +]<br>[$ endforeach $] |
| 64 |
[$ elsif $cy->{$type} !~ /static/ $] |
| 65 |
<tr> |
| 66 |
<td valign=top>[+ $txt +]:</td><td> |
| 67 |
[$ if $cy->{$type} =~ /pulldown/ $] |
| 68 |
[+ $r->app->get_title($r,$type,$rec->{$type}) +] |
| 69 |
[$ elsif $cy->{$type} =~ /checkboxrow/ $] |
| 70 |
[- |
| 71 |
%selected = map { $_ => 1 } split ("\t", $rec->{$type}); |
| 72 |
#warn "selected checkboxes: ", Data::Dumper->Dumper (\%selected), "\n"; |
| 73 |
if ($type =~ /^(.*?)_id$/) { |
| 74 |
$table = $1 ; |
| 75 |
} else { |
| 76 |
$table = $type; |
| 77 |
} |
| 78 |
$table =~ s/^.*__// ; |
| 79 |
$poss = $r->app->get_titles($r,$table); |
| 80 |
$i = 0; |
| 81 |
$moreThanOne = 0; |
| 82 |
-] |
| 83 |
[$ while $t = ($poss->[$i++]) $] |
| 84 |
[# - #warn "checkboxrow[$i] = ", Data::Dumper->Dumper ($t), "\n"; - #] |
| 85 |
[+ $selected{$t->{id}} ? ($moreThanOne++ ? ", " : "") . $t->{title} : "" +] |
| 86 |
[$ endwhile $] |
| 87 |
[$ elsif $cy->{$type} =~ /checkbox/ $] |
| 88 |
<!-- Todo: Internationalisierung per Tabelle ... --> |
| 89 |
[+ $r -> param -> language eq 'de'?($rec->{$type}?'Ja':'Nein'):($rec->{$type}?'Yes':'No') +] |
| 90 |
[$ else $] |
| 91 |
[- @txt = split (/\n/, $rec -> {$type}) -][$ foreach $t (@txt) $][+ $t +]<br>[$ endforeach $] |
| 92 |
[$ endif $] |
| 93 |
</td> |
| 94 |
</tr> |
| 95 |
[$endif$] |
| 96 |
[$endif$] |
| 97 |
[$endforeach$] |
| 98 |
</table> |
| 99 |
</td> |
| 100 |
</tr> |
| 101 |
</table> |
| 102 |
[$endif$] |
| 103 |
[$if $cf && @$cf $] |
| 104 |
<table width="100%"> |
| 105 |
<tr bgcolor="#fefcad"> |
| 106 |
[- $rec = $item_set->[$row] -] |
| 107 |
<td><font size=3><b>[+ $rec -> {name} +]</b></font></td> |
| 108 |
</tr> |
| 109 |
<tr> |
| 110 |
<td> |
| 111 |
<table> |
| 112 |
[$ foreach $type (@$cf) $] |
| 113 |
[$ if $cy->{$type} !~ /static/ $] |
| 114 |
[$ if $txt = $ct->{$type . '_text'} $] |
| 115 |
<tr> |
| 116 |
<td valign=top>[+ $txt +]:</td> |
| 117 |
<td> |
| 118 |
[$ if $cy->{$type} =~ /pulldown/ $] |
| 119 |
[+ $r->app->get_title($r,$type,$rec->{$type}) +] |
| 120 |
[$ elsif $cy->{$type} =~ /checkboxrow/ $] |
| 121 |
[- |
| 122 |
%selected = map { $_ => 1 } split ("\t", $rec->{$type}); |
| 123 |
if ($type =~ /^(.*?)_id$/) { |
| 124 |
$table = $1 ; |
| 125 |
} else { |
| 126 |
$table = $type; |
| 127 |
} |
| 128 |
$table =~ s/^.*__// ; |
| 129 |
$poss = $r->app->get_titles($r,$table); |
| 130 |
$i = 0; |
| 131 |
$moreThanOne = 0; |
| 132 |
-] |
| 133 |
[$ while $t = ($poss->[$i++]) $] |
| 134 |
[- warn "checkboxrow[$i] = ", Data::Dumper->Dumper ($t), "\n"; -] |
| 135 |
[+ $selected{$t->{id}} ? ($moreThanOne++ ? ", " : "") . $t->{title} : "" +] |
| 136 |
[$ endwhile $] |
| 137 |
[$ elsif $cy->{$type} =~ /checkbox/ $] |
| 138 |
<!-- Todo: Internationalisierung per Tabelle ... --> |
| 139 |
[$ if $rec->{$type} $] |
| 140 |
Ja |
| 141 |
[$ else $] |
| 142 |
Nein |
| 143 |
[$ endif $] |
| 144 |
[$ else $] |
| 145 |
[- @txt = split (/\n/, $rec-> {$type}) -] |
| 146 |
[$ foreach $t (@txt) $] |
| 147 |
[+ $t +]<br> |
| 148 |
[$ endforeach $] |
| 149 |
[$ endif $] |
| 150 |
</td> |
| 151 |
</tr> |
| 152 |
[$endif$] |
| 153 |
[$endif$] |
| 154 |
[$endforeach$] |
| 155 |
</table> |
| 156 |
</td> |
| 157 |
</tr> |
| 158 |
</table> |
| 159 |
[$endif$] |
| 160 |
|
| 161 |
<hr> |
| 162 |
[$ if $udat{user_email} $] |
| 163 |
[- $tt = $r->{category_set}{table_type} -] |
| 164 |
<A HREF="add.epl?category_id=[+ $fdat{category_id} +]">[New]</A> |
| 165 |
<A HREF="add.epl?[+ $tt +]_id=[+ $fdat{"${tt}_id"} +]&-edit_item=1&category_id=[+ $fdat{category_id} +]">[Edit]</A> |
| 166 |
<A HREF="list.epl?category_id=[+ $fdat{category_id} +]">[Overview]</A> |
| 167 |
[$ endif $] |
| 168 |
Owner: [+ $email +] |
| 169 |
Status: [+ $status +] |
| 170 |
[+ $date +] |
| 171 |
<br> |
| 172 |
|
| 173 |
|
| 174 |
[$ endif $] |
| 175 |
|
| 176 |
<br><br> |
| 177 |
|
| 178 |
[# |
| 179 |
[! use Data::Dumper; !] |
| 180 |
[- $DBIx::Recordset::FetchsizeWarn = 0; -] |
| 181 |
<PRE> |
| 182 |
[+ Dumper $r->{error},\%fdat,[keys %$r],[@{$r->{category_fields}}],{%{$r->{category_texts}}},{%{$r->{category_set}}},$r->{item_set} +] |
| 183 |
</PRE> |
| 184 |
#] |