call the right method to report the reason for needing to logon
[bse.git] / site / templates / admin / edit_prodopts.tmpl
1 <:wrap admin/base.tmpl title=>[cat "Options for product: " [article title]], showtitle=>1, menuitem=>prodopts, js=>"admin_prodopts.js":>
2 <:ifMessage:><div id="message"><:message:></div><:or:><:eif:>
3 <:include admin/product_menu.tmpl:>
4
5 <:if Dboptions:>
6 <h2>Product options</h2>
7 <:if UserCan bse_edit_prodopt_move:article:>
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} } 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>
11 <img src="/images/admin/busy.gif" id="busy_img" style="visibility: hidden" alt="busy" />
12 </div>
13 <:or UserCan:><:eif UserCan:>
14 <div id="productoptions" <:ifUserCan bse_edit_prodopt_move:>class="moveable"<:or:><:eif:>>
15 <:iterator begin dboptions:>
16 <div id="prodopt<:dboption id:>" class="prodopt">
17 <div id="prodoptmenu<:dboption id:>" class="prodoptmenu">Option:<span id="prodoptname<:dboption id:>"><:dboption name:></span>
18 <div class="prodoptmenuoptions">
19 <:if UserCan bse_edit_prodopt_edit:article :>
20 <a id="editoption<:dboption id:>" href="<:script:>?id=<:article id:>&amp;a_edit_option=1&amp;option_id=<:dboption id:>">Edit</a>
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>
24 <:or UserCan:><:eif UserCan:>
25 <:ifUserCan bse_edit_prodopt_move:article:><:dboption_move:><:or:><:eif:>
26 </div>
27 </div>
28 <div id="vallist<:dboption id:>" class="prodoptvalues">
29 <:iterator begin dboptionvalues:>
30 <div id="valentry<:dboptionvalue id:>" class="valueentry<:ifMatch [dboptionvalue_index] "[13579]$":> odd<:or:><:eif:>"><span id="prodoptvalue<:dboptionvalue id:>"><:dboptionvalue value:></span>
31 <:ifEq [dboptionvalue id] [dboption default_value]:>(default)<:or:><:eif:>
32 <:if UserCan bse_edit_prodopt_edit:article:>
33 <div class="valueentrymenu">
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 </div>
38 <:or UserCan:><:eif UserCan:>
39 </div>
40 <:iterator end dboptionvalues:>
41 </div>
42 <:if UserCan bse_edit_prodopt_edit:article:>
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>
46 <:or UserCan:><:eif UserCan:>
47 </div>
48 <:iterator end dboptions:>
49 </div>
50 <:or Dboptions:><:eif Dboptions:>
51 <:if UserCan bse_edit_prodopt_add:article:>
52 <div id="addoptionform" class="prodopt">
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:>" />
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>
58 <div class="prodoptvalues">
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>
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>
65 </form>
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>
70 <:or UserCan:><:eif UserCan:>
71 <script type="text/javascript">
72
73 var prodopts = <:dboptionsjson:>;
74 var reorder_values_csrf = '<:csrfp admin_move_option_value:>';
75 var reorder_options_csrf = '<:csrfp admin_move_option:>';
76 var edit_option_csrf = '<:csrfp admin_save_option:>';
77 var edit_value_csrf = '<:csrfp admin_save_option_value:>';
78 var article_id = "<:article id:>";
79 var edit_script = "<:script:>";
80
81 var user_can_edit_option = <:ifUserCan bse_edit_prodopt_edit:>1<:or:>0<:eif:>;
82 var user_can_delete_option = <:ifUserCan bse_edit_prodopt_delete:>1<:or:>0<:eif:>;
83 var user_can_move_option = <:ifUserCan bse_edit_prodopt_move:>1<:or:>0<:eif:>;
84
85 var show_add_form = <:ifCgi a_add_option:>true<:or:>false<:eif:>;
86
87 </script>