[2343] Hide "duplicate root budget" if no root budget selected
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / budgets-admin.inc
blob480b08191d502c3ac97432c95d79684a02a2f981
1 <div id="toolbar"><script type="text/javascript">
2         //<![CDATA[
4         // prepare DOM for YUI Toolbar
5          $(document).ready(function() {
6             $("#periods_menuc").empty();
7             $("#budgets_menuc").empty();
11 // IF THERE IS NO BUDGETS DEFINED YET, THEN DISPLAY PERIOD BUTTON *ONLY*
12 <!-- TMPL_UNLESS NAME="period_button_only" -->
13             $("#planning_menuc").empty();
14 <!-- /TMPL_UNLESS  -->
17             yuiToolbar();
18          });
20         // YUI Toolbar Functions
22         function yuiToolbar() {
23                 var periods_menu = [
24                         { text: _("Display all root budgets"), url: "/cgi-bin/koha/admin/aqbudgetperiods.pl" },
25                         { text: _("New root budget"), url: "/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form" },
26                         <!-- TMPL_IF NAME="budget_period_id" -->
27                         { text: _("Edit root budget '<!-- TMPL_VAR NAME="budget_period_description" -->'"), url: "/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form&budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->" },
28                         { text: _("Duplicate root budget '<!-- TMPL_VAR NAME="budget_period_description" -->'"), },
29                         <!-- /TMPL_IF -->
30                 ]
32 // IF THERE IS NO BUDGETS DEFINED YET, THEN DISPLAY PERIOD BUTTON *ONLY*
33 <!-- TMPL_IF NAME="budget_period_id" -->
35                 var budgets_menu = [
36                         { text: _("Display budgets"), url: "/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->" },                        
37                         { text: _("New budget for '<!-- TMPL_VAR NAME="budget_period_description" -->'"), url: "/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->"
38                            <!-- TMPL_IF NAME="budget_period_locked" -->,  disabled:true<!-- /TMPL_IF  -->
39                            <!-- TMPL_UNLESS NAME="CAN_user_acquisition_budget_add_del" -->,  disabled:true <!-- /TMPL_UNLESS  -->
40                           },
41                 ]
43                 var planning_menu = [
45                         { text: _("Plan by MONTHS"), 
46                             url: "/cgi-bin/koha/admin/aqplan.pl?budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->&authcat=MONTHS"
47                             <!-- TMPL_UNLESS NAME="CAN_user_acquisition_planning_manage" -->,  id:'disabled' <!-- /TMPL_UNLESS  -->
48                         },
50                         { text: _("Plan by BRANCHES"), 
51                             url: "/cgi-bin/koha/admin/aqplan.pl?budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->&authcat=BRANCHES" 
52                             <!-- TMPL_UNLESS NAME="CAN_user_acquisition_planning_manage" -->,  id:'disabled' <!-- /TMPL_UNLESS  -->
53                         },
55                         { text: _("Plan by ITEMTYPES"), 
56                             url: "/cgi-bin/koha/admin/aqplan.pl?budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->&authcat=ITEMTYPES"  
57                             <!-- TMPL_UNLESS NAME="CAN_user_acquisition_planning_manage" -->,  id:'disabled' <!-- /TMPL_UNLESS  -->
58                         },
60                 <!-- TMPL_LOOP NAME="auth_cats_loop" -->
61                         { text: _("Plan by <!-- TMPL_VAR NAME="authcat" -->    "), 
62                             url: "/cgi-bin/koha/admin/aqplan.pl?budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->&authcat=<!-- TMPL_VAR NAME="authcat" -->"
63                             <!-- TMPL_UNLESS NAME="CAN_user_acquisition_planning_manage" -->,  id:'disabled' <!-- /TMPL_UNLESS  -->
64                         },
66                 <!-- /TMPL_LOOP -->
68                 ]
72 <!-- /TMPL_IF  -->
74             new YAHOO.widget.Button({
75                 type: "menu",
76                 label: _("Root Budgets"),
77                 name: "periods_button",
78                 menu: periods_menu,
79                 container: "periods_menuc"
80             });
82 // IF THERE IS NO BUDGETS DEFINED YET, THEN DISPLAY PERIOD BUTTON *ONLY*
83 <!-- TMPL_UNLESS NAME="period_button_only" -->
85             new YAHOO.widget.Button({
86                 type: "menu",
87                 label: _("Budgets"),
88                 name: "budgets_button",
89                 menu: budgets_menu,
90                 container: "budgets_menuc"
91             });
94             new YAHOO.widget.Button({
95                 type: "menu",
96                 label: _("Budget planning"),
97                 name: "planning_button",
98                 menu: planning_menu,
99                 container: "planning_menuc"
100             });
102 <!-- /TMPL_UNLESS -->
110         } //yui-toolbar...
112         //]]>
113         </script>
114         <ul class="toolbar">
116   <li id="periods_menuc"><a id="periods_menu" href="/cgi-bin/koha/admin/aqbudgetperiods.pl?op=add_form">Root Budgets</a></li>
119 <!-- TMPL_UNLESS NAME="period_button_only" -->
120   <li id="budgets_menuc"><a id="budgets_menu" href="/cgi-bin/koha/cataloguing/addbiblio.pl">Budgets</a></li>
121   <li id="planning_menuc"><a id="planning_menu" href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->">Budget planning</a></li>
122 <!-- /TMPL_UNLESS -->
125 </ul>
126 </div>