add missing commas
[bse.git] / site / templates / admin / edit_prodopts.tmpl
CommitLineData
4de47893 1<:wrap admin/xbase.tmpl title=>"[articleType] Options", showtitle=>1, menuitem=>prodopts, js=>"admin_prodopts.js":>
58baa27b
TC
2<:ifMessage:><div id="message"><:message:></div><:or:><:eif:>
3<:include admin/product_menu.tmpl:>
4
5<:if Dboptions:>
6<h2>Product options</h2>
9b3a5df0 7<:if UserCan bse_edit_prodopt_move:article:>
4de47893
TC
8<div id="prodoptmenu">All options:
9<a id="sortoptions" href="<:script:>?a_option_reorder=1&amp;_t=prodopts&amp;id=<:article id:>&amp;_csrfp=<:csrfp admin_move_option:>&amp;option_ids=<:arithmetic join ",", map $_->{id}, sort { lc $a->{name} cmp lc $b->{name} } Products->getByPkey([article id])->db_options:>">Sort</a>
10<a id="reverseoptions" href="<:script:>?a_option_reorder=1&amp;_t=prodopts&amp;id=<:article id:>&amp;_csrfp=<:csrfp admin_move_option:>&amp;option_ids=<:arithmetic join ",", map $_->{id}, reverse Products->getByPkey([article id])->db_options:>">Reverse</a>
5825cab3 11<img src="/images/admin/busy.gif" id="busy_img" style="visibility: hidden" />
4de47893 12</div>
9b3a5df0 13<:or UserCan:><:eif UserCan:>
1660ce30 14<div id="productoptions" <:ifUserCan bse_edit_prodopt_move:>class="moveable"<:or:><:eif:>>
58baa27b
TC
15<:iterator begin dboptions:>
16<div id="prodopt<:dboption id:>" class="prodopt">
1660ce30 17<div id="prodoptmenu<:dboption id:>" class="prodoptmenu">Option:<span id="prodoptname<:dboption id:>"><:dboption name:></span>
1dbed965 18<div class="prodoptmenuoptions">
9b3a5df0 19<:if UserCan bse_edit_prodopt_edit:article :>
5708b3ac 20<a id="editoption<:dboption id:>" href="<:script:>?id=<:article id:>&amp;a_edit_option=1&amp;option_id=<:dboption id:>">Edit</a>
4de47893
TC
21<a href="<:script:>?id=<:article id:>&amp;a_delconf_option=1&amp;option_id=<:dboption id:>">Delete</a>
22<a id="sortvals<:dboption id:>" href="<:script:>?id=<:article id:>&amp;a_option_value_reorder=1&amp;option_id=<:dboption id:>&amp;_csrfp=<:csrfp admin_move_option_value:>&amp;_t=prodopts&amp;value_ids=<:arithmetic join ',', map $_->{id}, sort { lc $a->{value} cmp lc $b->{value} } BSE::TB::ProductOptions->getByPkey([dboption id])->values:>">Sort</a>
23<a id="reversevals<:dboption id:>" href="<:script:>?id=<:article id:>&amp;a_option_value_reorder=1&amp;option_id=<:dboption id:>&amp;_csrfp=<:csrfp admin_move_option_value:>&amp;_t=prodopts&amp;value_ids=<:arithmetic join ',', map $_->{id}, reverse BSE::TB::ProductOptions->getByPkey([dboption id])->values:>">Reverse</a>
9b3a5df0
TC
24<:or UserCan:><:eif UserCan:>
25<:ifUserCan bse_edit_prodopt_move:article:><:dboption_move:><:or:><:eif:>
4de47893 26</div>
1dbed965 27</div>
58baa27b
TC
28<:if Dboptionvalues:>
29<ul id="vallist<:dboption id:>" class="prodoptvalues">
30<:iterator begin dboptionvalues:>
1660ce30 31<li id="valentry<:dboptionvalue id:>"><span id="prodoptvalue<:dboptionvalue id:>"><:dboptionvalue value:></span>
9b3a5df0
TC
32<:ifEq [dboptionvalue id] [dboption default_value]:>(default)<:or:><:eif:>
33<:if UserCan bse_edit_prodopt_edit:article:>
34<a href="<:script:>?id=<:product id:>&amp;value_id=<:dboptionvalue id:>&amp;a_edit_option_value=1">Edit</a>
35<a href="<:script:>?id=<:product id:>&amp;value_id=<:dboptionvalue id:>&amp;a_confdel_option_value=1">Delete</a>
36<:dboptionvalue_move:>
37<:or UserCan:><:eif UserCan:>
38</li>
58baa27b 39<:iterator end dboptionvalues:>
9b3a5df0 40</ul>
58baa27b 41<:or Dboptionvalues:><:eif Dboptionvalues:>
9b3a5df0
TC
42<:if UserCan bse_edit_prodopt_edit:article:>
43<form action="<:script:>" method="post" id="valform<:dboption id:>" /><input type="hidden" name="id" value="<:article id:>" /><input type="hidden" name="option_id" value="<:dboption id:>" /><input type="hidden" name="_t" value="prodopts" /><:csrfp admin_add_option_value hidden:><input type="text" name="value" /><input type="submit" name="a_add_option_value" value="Add Value" /></form>
44<:or UserCan:><:eif UserCan:>
58baa27b
TC
45</div>
46<:iterator end dboptions:>
47</div>
48<:or Dboptions:><:eif Dboptions:>
9b3a5df0 49<:if UserCan bse_edit_prodopt_add:article:>
58baa27b
TC
50<div id="addoptionform">
51<form action="<:script:>" method="post">
52<:csrfp admin_add_option hidden:>
53<input type="hidden" name="_t" value="prodopts" />
54<input type="hidden" name="id" value="<:article id:>" />
9b3a5df0 55<table class="editform editformsmall">
58baa27b
TC
56 <tr>
57 <th>Name</th>
58 <td><input type="text" name="name" value="<:old name:>" size="40" maxlength="40" /><:error_img name:></td>
59 </tr>
60 <tr>
61 <th>Values</th>
62 <td><input type="text" name="value1" value="<:old value1:>" size="40" maxlength="40" /><:error_img value1:><br />
63<input type="text" name="value2" value="<:old value2:>" size="40" maxlength="40" /><:error_img value2:><br />
64<input type="text" name="value3" value="<:old value3:>" size="40" maxlength="40" /><:error_img value3:><br />
65<input type="text" name="value4" value="<:old value4:>" size="40" maxlength="40" /><:error_img value4:><br />
66<input type="text" name="value5" value="<:old value5:>" size="40" maxlength="40" /><:error_img value5:><br /></td>
67 </tr>
68 <tr>
69 <td colspan="2"><input type="submit" name="a_add_option" value="Add New Option" /></td>
70 </tr>
71</table>
72</form>
73</div>
74<div id="addoptionbutton" style="display: none">
75<a href="#" onclick="javascript: document.getElementById('addoptionform').style.display='block'; return false;">Add an option</a>
76</div>
9b3a5df0 77<:or UserCan:><:eif UserCan:>
58baa27b
TC
78<script>
79
58baa27b 80var prodopts = <:dboptionsjson:>;
58baa27b
TC
81var reorder_values_csrf = '<:csrfp admin_move_option_value:>';
82var reorder_options_csrf = '<:csrfp admin_move_option:>';
5708b3ac 83var edit_option_csrf = '<:csrfp admin_save_option:>';
1660ce30 84var edit_value_csrf = '<:csrfp admin_save_option_value:>';
4de47893
TC
85var article_id = "<:article id:>";
86var edit_script = "<:script:>";
58baa27b 87
9b3a5df0
TC
88var user_can_edit_option = <:ifUserCan bse_edit_prodopt_edit:>1<:or:>0<:eif:>;
89var user_can_delete_option = <:ifUserCan bse_edit_prodopt_delete:>1<:or:>0<:eif:>;
90var user_can_move_option = <:ifUserCan bse_edit_prodopt_move:>1<:or:>0<:eif:>;
58baa27b 91
58baa27b 92</script>