| 1 |
[- |
| 2 |
use File::Basename ; |
| 3 |
use Data::Dumper ; |
| 4 |
|
| 5 |
|
| 6 |
$DBIx::Recordset::Debug = 3; |
| 7 |
$maxrow = 30 ; |
| 8 |
|
| 9 |
$r = shift ; |
| 10 |
$ct = $r->{category_texts}; |
| 11 |
$cy = $r->{category_types}; |
| 12 |
$cf = $r->{category_fields}; |
| 13 |
$cr = $r->{category_remarks}; |
| 14 |
$cfnl = $r->{category_fields_nolang}; |
| 15 |
|
| 16 |
@langs = ([{'id' => ''}, $cfnl]) ; |
| 17 |
while ($rec = ${$r -> {language_set}} -> Next) |
| 18 |
{ |
| 19 |
push @langs, [$rec, $cf] ; |
| 20 |
} |
| 21 |
|
| 22 |
-] |
| 23 |
|
| 24 |
<script> |
| 25 |
[+ do { local $escmode = 0 ; $r -> {validate} -> get_script_code } +] |
| 26 |
</script> |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
[$ if $r -> {category_set}{headline} !~ /^\s+$/$] |
| 31 |
<table width="100%"> |
| 32 |
<tr bgcolor="#fefcad"> |
| 33 |
<td><font size="4"> |
| 34 |
[$if $r -> {category_set}{headline} $] |
| 35 |
[+ $r -> {category_set}{headline} +] |
| 36 |
[$else$] |
| 37 |
[$ if $r -> {edit} $][= edit1 =] [$ else $][= add1 =] [$ endif $] [+ $r -> {category_set}{category} +] |
| 38 |
[$endif$] |
| 39 |
</font></td> |
| 40 |
</tr> |
| 41 |
</table> |
| 42 |
[$endif$] |
| 43 |
|
| 44 |
[$ if !$r->{error} $] |
| 45 |
|
| 46 |
<form action="[+ $r -> app -> posturl('show.epl') +]" method="POST" |
| 47 |
name="form" onSubmit="return epform_validate_form()"> |
| 48 |
|
| 49 |
[$if $cf && @$cf $] |
| 50 |
[= add2a =]<br> |
| 51 |
[= add2b =]<br><br> |
| 52 |
[$endif$] |
| 53 |
[$ if $r -> {category_set}{add_info}$] |
| 54 |
<B>[+ $r -> {category_set}{add_info} +]</b><br><br> |
| 55 |
[$ endif $] |
| 56 |
|
| 57 |
|
| 58 |
[$if $r -> {user_admin} $] |
| 59 |
<table> |
| 60 |
<tr> |
| 61 |
<td class="cText" rowspan="2" valign="top">[= state =]: </td><td class="cInput"><input type="radio" name="state" value="1"[$ if ($r->{item_set}{state}) $] CHECKED[$ endif $]>[= display =]</td> |
| 62 |
<td class="cText" rowspan="2" valign="top">[= modtime =]: </td> |
| 63 |
<td class="cInput" rowspan="2"><input type="input" name="modtime" value="[+ $r -> {edit}?$r -> {item_set}{modtime}:'' +]"></td> |
| 64 |
</tr> |
| 65 |
<tr> |
| 66 |
<td class="cInput"><input type="radio" name="state" value="0"[$ if !$r->{item_set}{state} $] CHECKED[$ endif $]>[= hide =]</td> |
| 67 |
</tr> |
| 68 |
</table> |
| 69 |
[$endif$] |
| 70 |
|
| 71 |
<table width="100%"> |
| 72 |
[$foreach $lang (@langs) $] |
| 73 |
[- |
| 74 |
$rec = $lang -> [0] ; |
| 75 |
$cf = $lang -> [1] ; |
| 76 |
$postfix = $rec -> {id}?"_$rec->{id}":'' ; |
| 77 |
-] |
| 78 |
[$if $cf && @$cf $] |
| 79 |
<tr bgcolor="#fefcad"><font size="3"> |
| 80 |
<td><font size=3><b>[+ $rec -> {name} +]</b></font></td> |
| 81 |
</tr> |
| 82 |
<tr> |
| 83 |
<td> |
| 84 |
[$ syntax EmbperlBlocks $] |
| 85 |
<table width="100%"> |
| 86 |
[$ foreach $type (@$cf) $] |
| 87 |
[$ if ($txt = $ct->{$type . '_text'}) && ($cy->{$type} !~ /^show/) $] |
| 88 |
<tr> |
| 89 |
[$ syntax Embperl $] |
| 90 |
[# <td class="cText" valign="top" colspan="3">[+ $txt +] / [+ $type +] / [+ $i++ +]</td> #] |
| 91 |
[$ if $cy->{$type} =~ /static/ $] |
| 92 |
<td valign="top" colspan="3">[+ $txt +] </td> |
| 93 |
[$ elsif $cy->{$type} =~ /checkboxrow/ $] |
| 94 |
<td class="cText" valign="top">[+ $txt +]: </td> |
| 95 |
<td class="cInput"> |
| 96 |
[- |
| 97 |
if ($type =~ /^(.*?)_id$/) { |
| 98 |
$table = $1 ; |
| 99 |
} else { |
| 100 |
$table = $type; |
| 101 |
} |
| 102 |
$table =~ s/^.*__// ; |
| 103 |
$poss = $r->app->get_titles($r,$table); |
| 104 |
-] |
| 105 |
|
| 106 |
[# [+ $type +] / [+ $table +] / [+ $r->{category_title_type} +]<PRE>[+ Dumper $poss +]</PRE> #] |
| 107 |
|
| 108 |
[- $i = 0; -] |
| 109 |
[$ while ( $t = $poss->[$i++] ) $] |
| 110 |
<input type="checkbox" name="[+ $table +]" value="[+ $t->{id} +]" >[+ $t->{title} +]</input> |
| 111 |
[$ endwhile $] |
| 112 |
</td> |
| 113 |
[$ elsif $cy->{$type} =~ /checkbox/ $] |
| 114 |
<td class="cText" valign="top">[+ $txt +]: </td> |
| 115 |
<td class="cInput"> |
| 116 |
<input type="checkbox" name="[+ "$type$postfix" +]" value="1"> |
| 117 |
</td> |
| 118 |
[$ elsif $cy->{$type} =~ /textarea/ $] |
| 119 |
<td class="cText" valign="top">[+ $txt +]: </td> |
| 120 |
<td class="cInput"> |
| 121 |
<textarea name="[+ "$type$postfix" +]" style="width: 100%" cols="60" rows="10"></textarea> |
| 122 |
</td> |
| 123 |
[$ elsif $cy->{$type} =~ /pulldown/ $] |
| 124 |
<td class="cText" valign="top">[+ $txt +]: </td> |
| 125 |
<td class="cInput"> |
| 126 |
[- |
| 127 |
$type =~ /^(.*?)_id$/; |
| 128 |
$table = $1 ; |
| 129 |
$table ||= $type; |
| 130 |
$table =~ s/^.*__// ; |
| 131 |
$poss = $r->app->get_titles($r,$table); |
| 132 |
|
| 133 |
-] |
| 134 |
|
| 135 |
[# [+ $type +] / [+ $table +] / [+ $r->{category_title_type} +]<PRE>[+ Dumper $poss +]</PRE> #] |
| 136 |
|
| 137 |
<select name="[+ "$type$postfix" +]"> |
| 138 |
[- $item = $poss->[$row] -] |
| 139 |
<option value="[+ $item->{id} +]">[+ $item->{title} +]</option> |
| 140 |
</select> |
| 141 |
</td> |
| 142 |
[$ else $] |
| 143 |
<td class="cText" valign="top">[+ $txt +]: </td> |
| 144 |
<td class="cInput"><input type="text" size="60" name="[+ "$type$postfix" +]" size="80"> </td> |
| 145 |
[$ endif $] |
| 146 |
<td valign="top" align="right"> |
| 147 |
[+ $cr->{$type} +] |
| 148 |
</td> |
| 149 |
[$ syntax EmbperlBlocks $] |
| 150 |
</tr> |
| 151 |
[$ endif $] |
| 152 |
[$ endforeach $] |
| 153 |
</table> |
| 154 |
[$ syntax Embperl $] |
| 155 |
<input type="hidden" name="id_[+ $rec -> {id} +]"> |
| 156 |
</td> |
| 157 |
</tr> |
| 158 |
[$endif$] |
| 159 |
[$endforeach$] |
| 160 |
</table> |
| 161 |
|
| 162 |
[$ if $r -> {edit} $] |
| 163 |
<br>Owner: [+ $r->{item_set}{email} +] |
| 164 |
[$endif$] |
| 165 |
|
| 166 |
<br><br> |
| 167 |
[$ if $r -> {edit} $] |
| 168 |
<input type="submit" name="-update_item" value="[= update3 =]"> |
| 169 |
<input type="submit" name="-delete_item" value="[= delete3 =]"> |
| 170 |
[$ else $] |
| 171 |
<input type="submit" name="-add_item" value="[$ |
| 172 |
if $r -> {category_set}{sendtext} $][+ $r -> {category_set}{sendtext} +][$else$] |
| 173 |
[= add3 =] [+ $r -> {category_set}{category} +][$endif$]"> |
| 174 |
[$endif$] |
| 175 |
|
| 176 |
|
| 177 |
<input type="hidden" name="category_id"> |
| 178 |
<input type="hidden" name="[+ $r -> {category_set}{table_type} +]_id"> |
| 179 |
<input type="hidden" name="-logintext" value="[+ $r -> {category_set}{logintext} +]"> |
| 180 |
|
| 181 |
</form> |
| 182 |
[$ endif $] |
| 183 |
|
| 184 |
[# |
| 185 |
<PRE> |
| 186 |
[+ |
| 187 |
Data::Dumper->Dump( |
| 188 |
[ |
| 189 |
{%fdat}, |
| 190 |
$r->{edit}, |
| 191 |
$r->{category_set}{add_info}, |
| 192 |
$r->{action_prefix}, |
| 193 |
$r->{category_set}{category}, |
| 194 |
$r->{user_admin}, |
| 195 |
[keys %$r], |
| 196 |
$r->{category_fields}, |
| 197 |
$r->{category_texts}, |
| 198 |
$state, |
| 199 |
$item_set, |
| 200 |
# ${$r->{category_set}}, |
| 201 |
# ${$r->{language_set}}, |
| 202 |
# $r->{item_set}, |
| 203 |
],[qw[ |
| 204 |
fdat |
| 205 |
edit |
| 206 |
add_info |
| 207 |
action_prefix |
| 208 |
category |
| 209 |
user_admin |
| 210 |
r_keys |
| 211 |
category_fields |
| 212 |
category_texts |
| 213 |
state |
| 214 |
category_set |
| 215 |
language_set |
| 216 |
item_set |
| 217 |
] |
| 218 |
] |
| 219 |
) |
| 220 |
+] |
| 221 |
</PRE> |
| 222 |
#] |
| 223 |
|
| 224 |
|
| 225 |
|