Koha/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc
Owen Leonard e6a3029470 Fix for Bug 3319 - Need error message when adding patron and libraries are defined
- Hiding patron add toolbar when branches or categories are undefined
- Blocking patron entry form if branches or categories are undefined
- Removing nonfunctional template logic for displaying missing category
  error message.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-02-03 22:21:45 +13:00

73 lines
No EOL
2.5 KiB
HTML

<!-- TMPL_UNLESS NAME="no_add" -->
<div id="toolbar">
<script type="text/javascript">
//<![CDATA[
// prepare DOM for YUI Toolbar
$(document).ready(function() {
<!--TMPL_IF Name="AddPatronLists_categorycode"-->
<!--TMPL_ELSE-->
$("#addchild").parent().remove();
$("#addprofessional").parent().remove();
$("#addorganisation").parent().remove();
$("#addstaff").parent().remove();
$("#addstatistical").parent().remove();
<!--/TMPL_IF-->
$("#newmenuc").empty();
yuiToolbar();
});
// YUI Toolbar Functions
function yuiToolbar() {
var newmenu = [
<!--TMPL_IF Name="AddPatronLists_categorycode"-->
<!--TMPL_LOOP Name="categories"-->
{ text: "<!--TMPL_VAR Name="description"-->", url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;categorycode=<!--TMPL_VAR Name="categorycode"-->" },
<!--/TMPL_LOOP-->
<!--TMPL_ELSE-->
{ text: _("Adult Patron"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=A" },
{ text: _("Child Patron"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=C" },
{ text: _("Professional Patron"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=P" },
{ text: _("Organization"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=I" },
{ text: _("Staff"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=S" },
{ text: _("Statistical"), url: "/cgi-bin/koha/members/memberentry.pl?op=add&amp;category_type=X" },
<!--/TMPL_IF-->
]
new YAHOO.widget.Button({
type: "menu",
label: _("New"),
name: "newmenubutton",
menu: newmenu,
container: "newmenuc"
});
}
//]]>
</script>
<ul class="toolbar">
<li id="newmenuc">
<form action="/cgi-bin/koha/members/memberentry.pl" method="get">
<input type="hidden" name="op" value="add" />
<label for="newcategorycode">New Patron: </label><select name="categorycode" id="newcategorycode">
<!--TMPL_IF Name="AddPatronLists_categorycode"-->
<!--TMPL_LOOP Name="categories"--><option value="<!--TMPL_VAR Name="categorycode"-->"><!--TMPL_VAR Name="description"--></option><!--/TMPL_LOOP-->
<!-- TMPL_ELSE -->
<option value="A">Adult Patron</option>
<option value="C">Child Patron</option>
<option value="P">Professional Patron</option>
<option value="I">Organization</option>
<option value="S">Staff</option>
<option value="X">Statistical</option>
<!--/TMPL_IF-->
</select>
<input type="submit" class="submit" value="Go" />
</form>
</li>
</ul>
</div>
<!-- /TMPL_UNLESS -->