keys %errors
and return $self->_service_error($req, $article, $articles, undef, \%errors);
+ $req->set_variable(option => $option);
+ $req->messages($errors);
my $it = BSE::Util::Iterate->new;
my %acts;
%acts =
keys %errors
and return $self->_service_error($req, $article, $articles, undef, \%errors);
+ $req->set_variable(option => $option);
+ $req->set_variable(option_value => $option_value);
my %acts;
%acts =
(
<:wrap admin/base.tmpl title => "Delete Product Option", menuitem=>"none", showtitle=>"1" :>
<:include admin/product_menu.tmpl:>
<form action="<:script:>" method="post">
-<input type="hidden" name="id" value="<:article id:>" />
-<input type="hidden" name="option_id" value="<:option id:>" />
+<input type="hidden" name="id" value="<:= article.id:>" />
+<input type="hidden" name="option_id" value="<:= option.id:>" />
<input type="hidden" name="_t" value="prodopts" />
<:csrfp admin_delete_option hidden:>
<table class="editform editformtiny">
<tr>
<th>Option:</th>
- <td><:option name:></td>
+ <td><:= option.name:></td>
</tr>
<tr>
<th>Values:</th>
<td>
-<:if Dboptionvalues:>
-<:iterator begin dboptionvalues:>
-<div><:dboptionvalue value:></div>
-<:iterator end dboptionvalues:>
-<:or Dboptionvalues:>
+<:.set values = [ option.values ] :>
+<:.if values.size :>
+<:.for dboptionvalue in values :>
+<div><:= dboptionvalue.value:></div>
+<:.end for :>
+<:.else :>
<p>No values defined for this option</p>
-<:eif Dboptionvalues:>
+<:.end if:>
</td>
</tr>
<tr>
<:wrap admin/base.tmpl title => "Edit Product Option", menuitem=>"none", showtitle=>"1", js => "admin_editprodopt.js" :>
<:include admin/product_menu.tmpl:>
<form action="<:script:>" method="post">
-<input type="hidden" name="id" value="<:article id:>" />
-<input type="hidden" name="option_id" value="<:option id:>" />
+<input type="hidden" name="id" value="<:=article.id:>" />
+<input type="hidden" name="option_id" value="<:=option.id:>" />
<input type="hidden" name="_t" value="prodopts" />
-<input type="hidden" name="newvaluecount" id="newvaluecount" value="<:ifCgi newvaluecount:><:cgi newvaluecount:><:or:>0<:eif:>" />
+<input type="hidden" name="newvaluecount" id="newvaluecount" value="<:= cgi.param("newvalue_count") or 0 :>" />
<:csrfp admin_save_option hidden:>
<input type="hidden" name="save_enabled" value="1" />
<table class="editform editformsmall">
<tr>
<th>Name:</th>
- <td><input type="text" name="name" value="<:old name option name:>" /></td>
- <td class="help"><:error_img name:></td>
+ <td><input type="text" name="name" value="<:.call "old", field: "name", default: option.name :>" /></td>
+ <td class="help"><:.call "error_img", field: "name" :></td>
</tr>
<tr>
<th>Enabled:</th>
- <td><input type="checkbox" name="enabled" value="1" <:ifOld enabled option enabled:>checked="checked"<:or:><:eif:> /></td>
+ <td><input type="checkbox" name="enabled" value="1" <:.if cgi.param("save_enabled") ? cgi.param("enabled") : option.enabled:>checked="checked"<:.end if:> /></td>
<td class="help"><:error_img name:></td>
</tr>
<tr>
<table class="editform">
<tr>
<td colspan="2"></td>
- <th>Default<:error_img default_value:></th>
+ <th>Default<:.call "error_img", field:"default_value":></th>
</tr>
-<:iterator begin dboptionvalues:>
+<:.for value in [ option.values ] :>
<tr>
<th>Value:</th>
- <td><input type="text" name="value<:dboptionvalue id:>" value="<:oldi [concatenate value [dboptionvalue id]] 0 dboptionvalue value:>" /><:error_img [concatenate value [dboptionvalue id]]:></td>
- <td class="check"><input type="radio" name="default_value" value="<:dboptionvalue id:>" <:ifEq [dboptionvalue id] [option default_value]:>checked="checked"<:or:><:eif:> /></td>
+ <td><input type="text" name="value<:= value.id:>" value="<:= cgi.param("save_enabled") ? cgi.param("value" _ value.id) : value.value:>" /><:.call "error_img", field:"value" _ value.id:></td>
+ <td class="check"><input type="radio" name="default_value" value="<:= value.id:>" <:.if value.id == option.default_value:>checked="checked"<:.end if:> /></td>
</tr>
-<:iterator end dboptionvalues:>
+<:.end for:>
</table>
-<:if Cgi newvaluecount:>
-<:iterator begin repeats [cgi newvaluecount]:>
-<div><label for="newvalue<:repeat value:>">Value:</label>
-<input type="text" name="newvalue<:repeat value:>" value="<:cgi [cat newvalue [repeat value]]:>" /><:error_img [cat newvalue [repeat value]]:></div>
-<:iterator end repeats:>
-<:or Cgi:><:eif Cgi:>
+<:.if cgi.param("newvaluecount"):>
+<:.for i in [ 1 .. cgi.param("newvaluecount") ] :>
+<div><label for="newvalue<:= i:>">Value:</label>
+<input type="text" name="newvalue<:= i:>" value="<:=cgi.param("newvalue" _ i) :>:>" /><:.call "error_img", field:"newvalue" _ i :></div>
+<:.end for :>
+<:.end if :>
</td>
<td class="help"></td>
</tr>
<:wrap admin/base.tmpl title => "Delete Product Option Value", menuitem=>"prodopt_delete", showtitle => "1" :>
<:include admin/product_menu.tmpl:>
<form action="<:script:>" method="post">
-<input type="hidden" name="id" value="<:article id:>" />
-<input type="hidden" name="value_id" value="<:option_value id:>" />
+<input type="hidden" name="id" value="<:= article.id:>" />
+<input type="hidden" name="value_id" value="<:= option_value.id:>" />
<input type="hidden" name="_t" value="prodopts" />
<:csrfp admin_delete_option_value hidden:>
<table class="editform editformtiny">
</tr>
<tr>
<th>Value:</th>
- <td><:option_value value:></td>
+ <td><:= option_value.value:></td>
</tr>
<tr>
<td colspan="2" class="buttons">
<:wrap admin/base.tmpl title => "Edit Product Option Value", menuitem=>"none", showtitle=>"1" :>
<:include admin/product_menu.tmpl:>
<form action="<:script:>" method="post">
-<input type="hidden" name="id" value="<:article id:>" />
-<input type="hidden" name="value_id" value="<:option_value id:>" />
+<input type="hidden" name="id" value="<:= article.id:>" />
+<input type="hidden" name="value_id" value="<:= option_value.id:>" />
<input type="hidden" name="_t" value="prodopts" />
<:csrfp admin_save_option_value hidden:>
<table class="editform editformsmall">
<tr>
<th>Option:</th>
- <td><:option name:></td>
+ <td><:= option.name:></td>
<td></td>
</tr>
<tr>
<th>Value:</th>
-<td><input type="text" name="value" value="<:old value option_value value:>" /></td><td class="help"><:error_img value:></td></tr>
+<td><input type="text" name="value" value="<:.call "old", field: "value", default: option_value.value :>" /></td><td class="help"><:.call "error_img", field: "value":></td></tr>
<tr>
<td class="buttons" colspan="3"><input type="submit" name="a_save_option_value" value="Save" /><input type="submit" value="Return to product options" /></td>
</tr>