-<:wrap admin/xbase.tmpl title => "Edit Product Option", menuitem=>none, showtitle=>1 :>
+<: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="<:= cgi.param("newvalue_count") or 0 :>" />
<:csrfp admin_save_option hidden:>
<input type="hidden" name="save_enabled" value="1" />
-<table class="editform">
+<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>
<th>Values:</th>
-<td>
+<td id="product_option_values">
<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.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>
<td></td>
</tr>
</table>
-</form>
\ No newline at end of file
+</form>