call the right method to report the reason for needing to logon
[bse.git] / site / templates / admin / edit_prodopts.tmpl
CommitLineData
8a3b8db8 1<:wrap admin/base.tmpl title=>[cat "Options for product: " [article title]], 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 8<div id="prodoptmenu">All options:
10dd37f9
AO
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} } BSE::TB::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 BSE::TB::Products->getByPkey([article id])->db_options:>">Reverse</a>
8a3b8db8 11<img src="/images/admin/busy.gif" id="busy_img" style="visibility: hidden" alt="busy" />
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>
5f3a2963 28<div id="vallist<:dboption id:>" class="prodoptvalues">
58baa27b 29<:iterator begin dboptionvalues:>
5f3a2963 30<div id="valentry<:dboptionvalue id:>" class="valueentry<:ifMatch [dboptionvalue_index] "[13579]$":> odd<:or:><:eif:>"><span id="prodoptvalue<:dboptionvalue id:>"><:dboptionvalue value:></span>
9b3a5df0
TC
31<:ifEq [dboptionvalue id] [dboption default_value]:>(default)<:or:><:eif:>
32<:if UserCan bse_edit_prodopt_edit:article:>
5f3a2963 33<div class="valueentrymenu">
9b3a5df0
TC
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:>
5f3a2963 37</div>
9b3a5df0 38<:or UserCan:><:eif UserCan:>
5f3a2963 39</div>
58baa27b 40<:iterator end dboptionvalues:>
5f3a2963 41</div>
9b3a5df0 42<:if UserCan bse_edit_prodopt_edit:article:>
5f3a2963
TC
43<div class="addvalueform">
44<form action="<:script:>" method="post" id="valform<:dboption id:>" class="addvalue"><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" class="add_field" /><input type="submit" name="a_add_option_value" value="Add Value" class="add_submit" /></form>
45</div>
9b3a5df0 46<:or UserCan:><:eif UserCan:>
58baa27b
TC
47</div>
48<:iterator end dboptions:>
49</div>
50<:or Dboptions:><:eif Dboptions:>
9b3a5df0 51<:if UserCan bse_edit_prodopt_add:article:>
8f786525 52<div id="addoptionform" class="prodopt">
58baa27b
TC
53<form action="<:script:>" method="post">
54<:csrfp admin_add_option hidden:>
55<input type="hidden" name="_t" value="prodopts" />
56<input type="hidden" name="id" value="<:article id:>" />
134b45bc 57<div class="prodoptmenu">Option: <input type="text" name="name" value="<:old name:>" maxlength="255" class="editor_field" title="Enter the name of your new option here" /><:error_img name:><input type="submit" name="a_add_option" value="Add New Option" class="editor_ok_button" /></div>
8f786525 58<div class="prodoptvalues">
134b45bc 59<div class="valueentry"><input type="text" name="value1" value="<:old value1:>" maxlength="255" class="editor_field" title="Enter some values here" /><:error_img value1:></div>
8f786525
TC
60<div class="valueentry odd"><input type="text" name="value2" value="<:old value2:>" maxlength="255" class="editor_field" /><:error_img value2:></div>
61<div class="valueentry"><input type="text" name="value3" value="<:old value3:>" maxlength="255" class="editor_field" /><:error_img value3:></div>
62<div class="valueentry odd"><input type="text" name="value4" value="<:old value4:>" maxlength="255" class="editor_field" /><:error_img value4:></div>
63<div class="valueentry"><input type="text" name="value5" value="<:old value5:>" maxlength="255" class="editor_field" /><:error_img value5:></div>
64</div>
70b17b6f 65</form>
58baa27b
TC
66</div>
67<div id="addoptionbutton" style="display: none">
68<a href="#" onclick="javascript: document.getElementById('addoptionform').style.display='block'; return false;">Add an option</a>
69</div>
9b3a5df0 70<:or UserCan:><:eif UserCan:>
8a3b8db8 71<script type="text/javascript">
58baa27b 72
58baa27b 73var prodopts = <:dboptionsjson:>;
58baa27b
TC
74var reorder_values_csrf = '<:csrfp admin_move_option_value:>';
75var reorder_options_csrf = '<:csrfp admin_move_option:>';
5708b3ac 76var edit_option_csrf = '<:csrfp admin_save_option:>';
1660ce30 77var edit_value_csrf = '<:csrfp admin_save_option_value:>';
4de47893
TC
78var article_id = "<:article id:>";
79var edit_script = "<:script:>";
58baa27b 80
9b3a5df0
TC
81var user_can_edit_option = <:ifUserCan bse_edit_prodopt_edit:>1<:or:>0<:eif:>;
82var user_can_delete_option = <:ifUserCan bse_edit_prodopt_delete:>1<:or:>0<:eif:>;
83var user_can_move_option = <:ifUserCan bse_edit_prodopt_move:>1<:or:>0<:eif:>;
58baa27b 84
5f3a2963
TC
85var show_add_form = <:ifCgi a_add_option:>true<:or:>false<:eif:>;
86
58baa27b 87</script>