1040 lines
54 KiB
Plaintext
1040 lines
54 KiB
Plaintext
[% USE Koha %]
|
|
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE TablesSettings %]
|
|
[%- USE KohaSpan -%]
|
|
[% USE KohaTimes %]
|
|
[% PROCESS 'i18n.inc' %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
[% IF library %][% SET OpacLibraryInfo = library.opac_info( lang => lang ) %][% END %]
|
|
|
|
<title
|
|
>[% FILTER collapse %]
|
|
[% IF op == 'add_form' %]
|
|
[% IF library %]
|
|
[% tx("Modify library '{library}'", { library = library.branchcode }) | html %]
|
|
[% ELSE %]
|
|
[% t("New library") | html %]
|
|
[% END %]
|
|
›
|
|
[% ELSIF op == 'delete_confirm' %]
|
|
[% tx("Confirm deletion of library '{library}'", { library = library.branchcode }) | html %]
|
|
›
|
|
[% END %]
|
|
[% t("Libraries") | html %]
|
|
› [% t("Administration") | html %] › [% t("Koha") | html %]
|
|
[% END %]</title
|
|
>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
|
|
[% Asset.css("lib/codemirror/lint.min.css") | $raw %]
|
|
[% FILTER collapse %]
|
|
<style>
|
|
.opac-library-info {
|
|
border: 1px solid #dedede;
|
|
border-radius: 2px;
|
|
padding: 0.375rem 0.75rem;
|
|
}
|
|
.opac-library-info + .opac-library-info {
|
|
margin-top: 0.5rem;
|
|
}
|
|
</style>
|
|
[% END %]
|
|
</head>
|
|
|
|
<body id="admin_branches" class="admin">
|
|
[% WRAPPER 'header.inc' %]
|
|
[% INCLUDE 'prefs-admin-search.inc' %]
|
|
[% END %]
|
|
|
|
[% WRAPPER 'sub-header.inc' %]
|
|
[% WRAPPER breadcrumbs %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
|
|
[% END %]
|
|
|
|
[% IF op == 'add_form' || op == 'delete_confirm' || op == 'view' %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/branches.pl">Libraries</a>
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>Libraries</span>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF op == 'add_form' %]
|
|
[% IF library %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
[% tx("Modify library '{library}'", { library = library.branchcode }) | html %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>New library</span>
|
|
[% END %]
|
|
[% END %]
|
|
[% ELSIF op == 'delete_confirm' %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
[% tx("Confirm deletion of library '{library}'", { library = library.branchcode }) | html %]
|
|
[% END %]
|
|
[% ELSIF op == 'view' %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
[% library.branchname | html %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END #/ WRAPPER breadcrumbs %]
|
|
[% END #/ WRAPPER sub-header.inc %]
|
|
|
|
[% WRAPPER 'main-container.inc' aside='admin-menu' %]
|
|
|
|
[% FOREACH m IN messages %]
|
|
<div class="alert alert-[% m.type | html %]">
|
|
[% SWITCH m.code %]
|
|
[% CASE 'error_on_update' %]
|
|
<span>An error occurred when updating this library. Perhaps it already exists.</span>
|
|
[% CASE 'error_on_insert' %]
|
|
<span>An error occurred when adding this library. The branchcode might already exist.</span>
|
|
[% CASE 'error_on_delete' %]
|
|
<span>An error occurred when deleting this library. Check the logs for details.</span>
|
|
[% CASE 'success_on_update' %]
|
|
<span>Library updated successfully.</span>
|
|
[% CASE 'success_on_insert' %]
|
|
<span>Library added successfully.</span>
|
|
[% CASE 'success_on_delete' %]
|
|
<span>Library deleted successfully.</span>
|
|
[% CASE 'cannot_delete_library' %]
|
|
<span>This library cannot be deleted. Patrons or items are still using it</span>
|
|
[% IF m.data.patrons_count and m.data.items_count %]
|
|
<span>([% m.data.patrons_count | html %] patrons and [% m.data.items_count | html %] items).</span>
|
|
[% ELSIF m.data.patrons_count %]
|
|
<span>([% m.data.patrons_count | html %] patrons).</span>
|
|
[% ELSIF m.data.items_count %]
|
|
<span>([% m.data.items_count | html %] items).</span>
|
|
[% END %]
|
|
[% CASE %]
|
|
<span>[% m.code | html %]</span>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'list' || op == 'view' %]
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<a class="btn btn-default" id="newbranch" href="/cgi-bin/koha/admin/branches.pl?op=add_form"><i class="fa fa-plus"></i> New library</a>
|
|
[% IF op == 'view' && library %]
|
|
<a class="btn btn-default" id="editbranch" href="/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode=[% library.branchcode | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit library</a>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'add_form' %]
|
|
<h1>
|
|
[% IF library %]
|
|
[% tx("Modify library '{library}'", { library = library.branchcode }) | html %]
|
|
[% ELSE %]
|
|
New library
|
|
[% END %]
|
|
</h1>
|
|
<form action="/cgi-bin/koha/admin/branches.pl" id="Aform" name="Aform" class="validated" method="post">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<fieldset class="fg">
|
|
<input type="hidden" name="op" value="cud-add_validate" />
|
|
[% IF library %]
|
|
<input type="hidden" name="is_a_modif" value="1" />
|
|
[% END %]
|
|
<div class="fg-row">
|
|
[% IF library %]
|
|
<div class="fg-label">
|
|
<span class="label">Library code: </span>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
|
|
<div class="fg-text">[% library.branchcode | html %]</div>
|
|
</div>
|
|
[% ELSE %]
|
|
<div class="fg-label">
|
|
<label for="branchcode" class="required">Library code: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode | html %]" class="required focus" required="required" />
|
|
</div>
|
|
<div class="required">Required</div>
|
|
[% END %]
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchname" class="required">Name: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
[% IF library %]
|
|
<input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required focus" required="required" />
|
|
[% ELSE %]
|
|
<input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname | html %]" class="required" required="required" />
|
|
[% END %]
|
|
</div>
|
|
<div class="required">Required</div>
|
|
</div>
|
|
</fieldset>
|
|
<fieldset class="fg">
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchaddress1">Address line 1: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% library.branchaddress1 | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchaddress2">Address line 2: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchaddress2" id="branchaddress2" size="60" value="[% library.branchaddress2 | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchaddress3">Address line 3: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchaddress3" id="branchaddress3" size="60" value="[% library.branchaddress3 | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchcity">City: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchcity" id="branchcity" size="60" value="[% library.branchcity | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchstate">State: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchstate" id="branchstate" size="60" value="[% library.branchstate | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchzip">ZIP/Postal code: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchzip" id="branchzip" size="25" maxlength="25" value="[% library.branchzip | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchcountry">Country: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchcountry" id="branchcountry" size="60" value="[% library.branchcountry | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchphone">Phone: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchphone" id="branchphone" size="60" value="[% library.branchphone | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchfax">Fax: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchfax" id="branchfax" size="60" value="[% library.branchfax | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchemail">Email: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchemail" id="branchemail" class="email" size="80" value="[% library.branchemail | html %]" />
|
|
</div>
|
|
</div>
|
|
[% IF (Koha.Preference('ILLModule')) %]
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchillemail">ILL staff email: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchillemail" id="branchillemail" class="email" size="80" value="[% library.branchillemail | html %]" />
|
|
</div>
|
|
<div class="hint">
|
|
[% IF ( CAN_user_parameters_manage_sysprefs ) %]
|
|
[% pref_ILLDefaultStaffEmail_link = BLOCK %]<a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ILLDefaultStaffEmail">ILLDefaultStaffEmail</a>[% END %]
|
|
Default: [% pref_ILLDefaultStaffEmail_link | $raw | $KohaSpan %] system preference
|
|
[% ELSE %]
|
|
Default: ILLDefaultStaffEmail system preference
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
[% END %]
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchreplyto">Reply-To: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchreplyto" id="branchreplyto" class="email" size="80" value="[% library.branchreplyto | html %]" />
|
|
</div>
|
|
<div class="hint">
|
|
[% IF ( CAN_user_parameters_manage_sysprefs ) %]
|
|
[% pref_ReplyToDefault_link = BLOCK %]<a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReplyToDefault">ReplyToDefault</a>[% END %]
|
|
Default: [% pref_ReplyToDefault_link | $raw | $KohaSpan %] system preference
|
|
[% ELSE %]
|
|
Default: ReplyToDefault system preference
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchreturnpath">Return-Path: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchreturnpath" id="branchreturnpath" class="email" size="80" value="[% library.branchreturnpath | html %]" />
|
|
</div>
|
|
<div class="hint">
|
|
[% IF ( CAN_user_parameters_manage_sysprefs ) %]
|
|
[% pref_ReturnpathDefault_link = BLOCK %]<a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReturnpathDefault">ReturnpathDefault</a>[% END %]
|
|
Default: [% pref_ReturnpathDefault_link | $raw | $KohaSpan %] system preference
|
|
[% ELSE %]
|
|
Default: ReturnpathDefault system preference
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="smtp_server">SMTP server: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<select name="smtp_server" id="smtp_server">
|
|
[% IF library AND library.smtp_server.is_system_default %]
|
|
<option value="*" selected="selected">Default</option>
|
|
[% ELSE %]
|
|
<option value="*">Default</option>
|
|
[% END %]
|
|
[% FOREACH smtp_server IN smtp_servers %]
|
|
[% IF library AND smtp_server.id == library.smtp_server.id %]
|
|
<option value="[% smtp_server.id | html %]" selected="selected">[% smtp_server.name | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% smtp_server.id | html %]">[% smtp_server.name | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchurl">URL: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchurl" id="branchurl" size="80" value="[% library.branchurl | html %]" class="url" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="opac_info">OPAC information: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
[% IF OpacLibraryInfo %]
|
|
<!-- opac_info -->
|
|
[% FOREACH info IN OpacLibraryInfo %]
|
|
[% IF library.branchcode == info.branchcode %]
|
|
<div id="opac_library_info_[% info.additional_content_id | $raw %]" class="opac-library-info">[% info.content | $raw %]</div>
|
|
[% IF ( CAN_user_tools_edit_additional_contents ) %]
|
|
<a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&id=[% info.additional_content_id | $raw %]&editmode=wysiwyg" target="_blank">
|
|
<i class="fa fa-pencil"></i> Edit HTML content
|
|
</a>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% IF ( CAN_user_tools_edit_additional_contents ) %]
|
|
<a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&editmode=wysiwyg" target="_blank"> <i class="fa fa-plus"></i> Add HTML content </a>
|
|
[% END %]
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchip">IP: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchip" id="branchip" size="15" maxlength="15" value="[% library.branchip | html %]" />
|
|
</div>
|
|
<div class="hint">Enter as a single IP address, or a subnet such as 192.168.1.*</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="marcorgcode">MARC organization code: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="marcorgcode" id="marcorgcode" size="16" maxlength="16" value="[% library.marcorgcode | html %]" />
|
|
</div>
|
|
<div class="hint">
|
|
[% IF ( CAN_user_parameters_manage_sysprefs ) %]
|
|
[% pref_MARCOrgCode_link = BLOCK %]<a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=MARCOrgCode">MARCOrgCode</a>[% END %]
|
|
Default: [% pref_MARCOrgCode_link | $raw | $KohaSpan %] system preference.
|
|
[% ELSE %]
|
|
Default: MARCOrgCode system preference.
|
|
[% END %]
|
|
Obtain a library code from the <a href="https://www.loc.gov/marc/organizations/orgshome.html" target="_blank">Library of Congress</a>.
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="branchnotes">Notes: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<input type="text" name="branchnotes" id="branchnotes" size="80" value="[% library.branchnotes | html %]" />
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="pickup_location">Pickup location: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<select name="pickup_location" id="pickup_location">
|
|
[% IF !library || library.pickup_location == 1 %]
|
|
<option value="1" selected="selected">Yes</option>
|
|
<option value="0">No</option>
|
|
[% ELSE %]
|
|
<option value="1">Yes</option>
|
|
<option value="0" selected="selected">No</option>
|
|
[% END %]
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="public">Public: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<select name="public" id="public">
|
|
[% IF !library || library.public == 1 %]
|
|
<option value="1" selected="selected">Yes</option>
|
|
<option value="0">No</option>
|
|
[% ELSE %]
|
|
<option value="1">Yes</option>
|
|
<option value="0" selected="selected">No</option>
|
|
[% END %]
|
|
</select>
|
|
</div>
|
|
<div class="hint">Set to 'Yes' to show this library as a search option and on the libraries page in the OPAC.</div>
|
|
</div>
|
|
<div class="fg-row wide">
|
|
<div class="fg-label">
|
|
<label for="library_hours">Library hours: </label>
|
|
</div>
|
|
<div class="fg-table">
|
|
<table id="library_hours_table">
|
|
<thead>
|
|
<tr>
|
|
<th>Day</th>
|
|
<th>Open time</th>
|
|
<th>Close time</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% SET CalendarFirstDayOfWeek = Koha.Preference("CalendarFirstDayOfWeek") %]
|
|
[% IF library.library_hours.count > 0 # Existing hours %]
|
|
[% SET library_hours = library.library_hours.as_list %]
|
|
|
|
[% FOR i IN [0..6] %]
|
|
[% SET d = ( CalendarFirstDayOfWeek + i ) % 7 %]
|
|
[% SET hr = library_hours.$d %]
|
|
<tr id="hours_[% d | html %]">
|
|
<td>
|
|
[% PROCESS dayname day=d %]
|
|
<input type="hidden" value="[% d | html %]" name="day" />
|
|
</td>
|
|
<td>
|
|
[% IF hr.open_time %]
|
|
<input type="text" size="5" value="[% hr.open_time | html %]" name="open_time" class="flatpickr" data-flatpickr-time-only="true" />
|
|
[% ELSE %]
|
|
<input type="text" size="5" value="" name="open_time" class="flatpickr" data-flatpickr-time-only="true" />
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF hr.close_time %]
|
|
<input type="text" size="5" value="[% hr.close_time | html %]" name="close_time" class="flatpickr" data-flatpickr-time-only="true" />
|
|
[% ELSE %]
|
|
<input type="text" size="5" value="" name="close_time" class="flatpickr" data-flatpickr-time-only="true" />
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% ELSE # New hours %]
|
|
[% FOR i IN [0..6] %]
|
|
[% SET d = ( CalendarFirstDayOfWeek + i ) % 7 %]
|
|
<tr id="hours_[% d | html %]">
|
|
<td>
|
|
[% PROCESS dayname day=d %]
|
|
<input type="hidden" value="[% d | html %]" name="day" />
|
|
</td>
|
|
<td>
|
|
<input type="text" size="5" name="open_time" class="noEnterSubmit flatpickr" data-flatpickr-time-only="true" />
|
|
</td>
|
|
<td>
|
|
<input type="text" size="5" name="close_time" class="noEnerSubmit flatpickr" data-flatpickr-time-only="true" />
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="opacuserjs">Specific OPAC JS: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<a class="expand-textarea btn btn-link" id="expand_opacuserjs" data-target="opacuserjs" data-syntax="javascript" href="#">Edit</a>
|
|
<textarea style="display:none" name="opacuserjs" id="opacuserjs" class="codemirror" rows="10" cols="40">[% library.opacuserjs | html %]</textarea>
|
|
<a class="collapse-textarea btn btn-link" id="collapse_opacuserjs" data-target="opacuserjs" data-syntax="javascript" style="display:none" href="#">Collapse<br /></a>
|
|
</div>
|
|
</div>
|
|
<div class="fg-row">
|
|
<div class="fg-label">
|
|
<label for="opacusercss">Specific OPAC CSS: </label>
|
|
</div>
|
|
<div class="fg-input">
|
|
<a class="expand-textarea btn btn-link" id="expand_opacusercss" data-target="opacusercss" data-syntax="css" href="#">Edit</a>
|
|
<textarea style="display:none" name="opacusercss" id="opacusercss" class="" rows="10" cols="40">[% library.opacusercss | html %]</textarea>
|
|
<a class="collapse-textarea btn btn-link" id="collapse_opacusercss" data-target="opacusercss" data-syntax="css" style="display:none" href="#">Collapse<br /></a>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
[% IF additional_fields.size %]
|
|
[% INCLUDE 'additional-fields-entry.inc' available=additional_fields values=additional_field_values wrap_fieldset=1 %]
|
|
[% END %]
|
|
<fieldset class="action">
|
|
<input type="submit" class="btn btn-primary" value="Submit" />
|
|
<a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
[% BLOCK dayname %]
|
|
[% IF day == 0 %]
|
|
<span>Sunday</span>
|
|
[% ELSIF day == 1 %]
|
|
<span>Monday</span>
|
|
[% ELSIF day == 2 %]
|
|
<span>Tuesday</span>
|
|
[% ELSIF day == 3 %]
|
|
<span>Wednesday</span>
|
|
[% ELSIF day == 4 %]
|
|
<span>Thursday</span>
|
|
[% ELSIF day == 5 %]
|
|
<span>Friday</span>
|
|
[% ELSE %]
|
|
<span>Saturday</span>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF op == 'delete_confirm' and not ( items_count or patrons_count ) %]
|
|
<div class="alert alert-warning">
|
|
<form action="/cgi-bin/koha/admin/branches.pl" method="post">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<h1>Are you sure you want to delete [% library.branchname | html %] ([% library.branchcode | html %])?</h1>
|
|
<input type="hidden" name="op" value="cud-delete_confirmed" />
|
|
<input type="hidden" name="branchcode" value="[% library.branchcode | html %]" />
|
|
<input type="hidden" name="branchname" value="[% library.branchname | html %]" />
|
|
<button type="submit" class="btn btn-default approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
|
|
</form>
|
|
<form action="/cgi-bin/koha/admin/branches.pl" method="get">
|
|
<button type="submit" class="btn btn-default deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
|
|
</form>
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'list' %]
|
|
<h1>Libraries</h1>
|
|
[% IF libraries_count > 0 %]
|
|
<div class="page-section">
|
|
<table id="libraries">
|
|
<thead>
|
|
<tr>
|
|
<th data-colname="library_name">Name</th>
|
|
<th data-colname="library_code">Code</th>
|
|
<th data-colname="library_address">Address</th>
|
|
<th data-colname="marc_organization_code">MARC organization code</th>
|
|
<th data-colname="library_ip">IP</th>
|
|
<th data-colname="is_pickup_location">Pickup location</th>
|
|
<th data-colname="public">Public</th>
|
|
<th data-colname="smtp_server">SMTP server</th>
|
|
<th data-colname="library_hours">Library hours</th>
|
|
<th data-colname="actions" data-class-name="actions no-export">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
[% ELSE %]
|
|
<div class="alert alert-info">There are no libraries defined. <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">Start defining libraries</a>.</div>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF op == 'view' && library %]
|
|
<h1>[% library.branchname | html %]</h1>
|
|
<div class="center-block row page-section">
|
|
<div class="col-sm-6">
|
|
<div class="rows">
|
|
<ol>
|
|
<li>
|
|
<span class="label">Library code: </span>
|
|
[% library.branchcode | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Name: </span>
|
|
[% library.branchname | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Address line 1: </span>
|
|
[% library.branchaddress1 | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Address line 2: </span>
|
|
[% library.branchaddress2 | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Address line 3: </span>
|
|
[% library.branchaddress3 | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">City: </span>
|
|
[% library.branchcity | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">State: </span>
|
|
[% library.branchstate | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">ZIP/Postal code: </span>
|
|
[% library.branchzip | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Country: </span>
|
|
[% library.branchcountry | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Phone: </span>
|
|
[% library.branchphone | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Fax: </span>
|
|
[% library.branchfax | html %]
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<div class="rows">
|
|
<ol>
|
|
<li>
|
|
<span class="label">Email: </span>
|
|
[% IF ( library.branchemail ) %]
|
|
<a href="mailto:[% library.branchemail | url %]">[% library.branchemail | html %]</a>
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<span class="label">ILL staff email: </span>
|
|
[% IF ( library.branchillemail ) %]
|
|
<a href="mailto:[% library.branchillemail | url %]">[% library.branchillemail | html %]</a>
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Reply-To: </span>
|
|
[% IF ( library.branchreplyto ) %]
|
|
<a href="mailto:[% library.branchreplyto | url %]">[% library.branchreplyto | html %]</a>
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Return-Path: </span>
|
|
[% library.branchreturnpath | html %]
|
|
</li>
|
|
[% IF ( library.smtp_server.id ) %]
|
|
<li>
|
|
<span class="label">SMTP server: </span>
|
|
[% IF ( CAN_user_parameters_manage_smtp_servers ) %]
|
|
<a href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id=[% library.smtp_server.id | uri %]">[% library.smtp_server.name | html %]</a>
|
|
[% ELSE %]
|
|
[% library.smtp_server.name | html %]
|
|
[% END %]
|
|
</li>
|
|
[% END %]
|
|
<li>
|
|
<span class="label">URL: </span>
|
|
[% IF ( library.branchurl ) %]
|
|
<a href="[% library.branchurl | url %]" target="_blank">[% library.branchurl | html %]</a>
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<span class="label">IP: </span>
|
|
[% library.branchip | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">MARC organization code:</span>
|
|
[% library.marcorgcode | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Notes: </span>
|
|
[% library.branchnotes | html %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Pickup location: </span>
|
|
[% IF ( library.pickup_location ) %]
|
|
<span>Yes</span>
|
|
[% ELSE %]
|
|
<span>No</span>
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Public: </span>
|
|
[% IF ( library.public ) %]
|
|
<span>Yes</span>
|
|
[% ELSE %]
|
|
<span>No</span>
|
|
[% END %]
|
|
</li>
|
|
<li>
|
|
<span class="label">Library hours: </span>
|
|
[% SET CalendarFirstDayOfWeek = Koha.Preference("CalendarFirstDayOfWeek") %]
|
|
[% SET set_hours = 0 %]
|
|
[% IF library.library_hours.count > 0 %]
|
|
[% FOR i IN [0..6] %]
|
|
[% IF library.library_hours.as_list.$i.open_time != null || library.library_hours.as_list.$i.close_time != null %]
|
|
[% set_hours = 1 %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% IF set_hours > 0 # Existing library %]
|
|
[% SET library_hours = library.library_hours.as_list %]
|
|
<table id="library_hours_table">
|
|
<thead>
|
|
<tr>
|
|
<th>Day</th>
|
|
<th>Open time</th>
|
|
<th>Close time</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOR i IN [0..6] %]
|
|
[% SET d = ( CalendarFirstDayOfWeek + i) % 7 %]
|
|
[% SET hr = library_hours.$d %]
|
|
<tr id="hours_[% d | html %]">
|
|
<td>
|
|
<span>[% PROCESS dayname day=d %]</span>
|
|
</td>
|
|
<td>
|
|
<span>[% IF hr.open_time != null %][% hr.open_time | $KohaTimes %][% END %]</span>
|
|
</td>
|
|
<td>
|
|
<span>[% IF hr.close_time != null %][% hr.close_time | $KohaTimes %][% END %]</span>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% ELSE %]
|
|
<span>Library hours not set</span>
|
|
[% END %]
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<!-- /.rows -->
|
|
</div>
|
|
<!-- /.col-sm-6 -->
|
|
</div>
|
|
<!-- /.row -->
|
|
[% IF additional_fields && additional_field_values %]
|
|
<div class="rows page-section">
|
|
<h2>Additional fields</h2>
|
|
[% INCLUDE 'additional-fields-display.inc' available=additional_fields values=additional_field_values %]
|
|
</div>
|
|
[% END %]
|
|
[% IF OpacLibraryInfo %]
|
|
<!-- opac_info -->
|
|
<div class="row page-section">
|
|
<div class="col-sm-12">
|
|
<h2>OPAC information</h2>
|
|
[% IF OpacLibraryInfo %]
|
|
<!-- opac_info -->
|
|
[% FOREACH info IN OpacLibraryInfo %]
|
|
[% IF library.branchcode == info.branchcode %]
|
|
<div id="opac_library_info_[% info.additional_content_id | $raw %]" class="opac-library-info">[% info.content | $raw %]</div>
|
|
[% IF ( CAN_user_tools_edit_additional_contents ) %]
|
|
<a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&id=[% info.additional_content_id | $raw %]&editmode=wysiwyg" target="_blank">
|
|
<i class="fa fa-pencil"></i> Edit HTML content
|
|
</a>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% IF ( CAN_user_tools_edit_additional_contents ) %]
|
|
<a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&editmode=wysiwyg" target="_blank"> <i class="fa fa-plus"></i> Add HTML content </a>
|
|
[% END %]
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
[% END %]
|
|
[% ELSIF op == 'view' %]
|
|
<div>This library does not exist.</div>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/admin-menu.js") | $raw %]
|
|
[% Asset.js("js/additional-fields-entry.js") | $raw %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/codemirror/css.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/codemirror/javascript.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/codemirror/yaml.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/linters/jshint.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/linters/htmlhint.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/linters/csslint.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/linters/js-yaml.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/codemirror/html-lint.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/codemirror/javascript-lint.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/codemirror/css-lint.min.js" ) | $raw %]
|
|
[% Asset.js( "lib/codemirror/yaml-lint.min.js" ) | $raw %]
|
|
[% Asset.css("lib/codemirror/codemirror.css") | $raw %]
|
|
<style>
|
|
.CodeMirror {
|
|
border: 1px solid #eee;
|
|
margin: 1em, 1em, 1em, 0;
|
|
resize: vertical;
|
|
width: 50em;
|
|
}
|
|
</style>
|
|
<script>
|
|
var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
|
|
var calendarFirstDayOfWeek = '[% Koha.Preference('CalendarFirstDayOfWeek') | html %]';
|
|
|
|
var libraries_table;
|
|
$(document).ready(function() {
|
|
|
|
var libraries_url = '/api/v1/libraries';
|
|
libraries_table = $("#libraries").kohaTable({
|
|
"ajax": {
|
|
"url": libraries_url
|
|
},
|
|
'embed': [ 'smtp_server', 'library_hours' ],
|
|
'emptyTable': '<div class="alert alert-info">'+_("There are no libraries defined.")+' <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">'+_("Start defining libraries")+'</a>.</div>',
|
|
"columnDefs": [ {
|
|
"targets": [1,3,4,5,6],
|
|
"render": function (data, type, row, meta) {
|
|
if ( type == 'display' ) {
|
|
if ( data != null ) {
|
|
return data.escapeHtml();
|
|
}
|
|
else {
|
|
return "";
|
|
}
|
|
}
|
|
return data;
|
|
}
|
|
} ],
|
|
"columns": [
|
|
{
|
|
"data": "name",
|
|
"searchable": true,
|
|
"orderable": true,
|
|
"render": function( data, type, row, meta ) {
|
|
return "<a href=\"/cgi-bin/koha/admin/branches.pl?op=view&branchcode=" + encodeURIComponent( row.library_id ) + "\">" + row.name.escapeHtml() + "</a>";
|
|
}
|
|
},
|
|
{
|
|
"data": "library_id",
|
|
"searchable": true,
|
|
"orderable": true
|
|
},
|
|
{
|
|
"render": function( data, type, row, meta ) {
|
|
const library_info = [];
|
|
if ( row.address1 != null ) library_info.push(row.address1.escapeHtml());
|
|
if ( row.address2 != null ) library_info.push(row.address2.escapeHtml());
|
|
if ( row.address3 != null ) library_info.push(row.address3.escapeHtml());
|
|
// geographical_location = city, state postal_code
|
|
const locations = [];
|
|
if ( row.city != null ) locations.push(row.city.escapeHtml());
|
|
if ( row.state != null ) locations.push(row.state.escapeHtml());
|
|
const geographical_location = locations.join(', ');
|
|
if ( geographical_location != '' && row.postal_code != null) {
|
|
library_info.push(geographical_location+' '+row.postal_code.escapeHtml());
|
|
}
|
|
else {
|
|
library_info.push(geographical_location);
|
|
}
|
|
if ( row.country != null ) library_info.push(row.country.escapeHtml());
|
|
if ( row.phone != null ) library_info.push(_("Ph: ") + row.phone.escapeHtml());
|
|
if ( row.fax != null ) library_info.push(_("Fax: ") + row.fax.escapeHtml());
|
|
if ( row.email != null ) library_info.push('<a href="mailto:'+encodeURIComponent(row.email)+'">'+row.email.escapeHtml()+'</a>');
|
|
if ( row.url != null ) library_info.push('<a href="'+encodeURI(row.url)+'">'+row.url.escapeHtml()+'</a>');
|
|
if ( row.notes != null ) library_info.push(_("Notes")+': '+row.notes.escapeHtml());
|
|
return library_info.join('<br/>');
|
|
},
|
|
"searchable": false,
|
|
"orderable": false
|
|
},
|
|
{
|
|
"data": "marc_org_code",
|
|
"searchable": true,
|
|
"orderable": true
|
|
},
|
|
{
|
|
"data": "ip",
|
|
"searchable": true,
|
|
"orderable": true
|
|
},
|
|
{
|
|
"data": "pickup_location",
|
|
"searchable": true,
|
|
"orderable": true,
|
|
"render": function( data, type, row, meta ) {
|
|
return (data) ? _("Yes") : _("No");
|
|
}
|
|
},
|
|
{
|
|
"data": "public",
|
|
"searchable": true,
|
|
"orderable": true,
|
|
"render": function( data, type, row, meta ) {
|
|
return (data) ? _("Yes") : _("No");
|
|
}
|
|
},
|
|
{
|
|
"data": "smtp_server",
|
|
"render": function( data, type, row, meta ) {
|
|
if ( data.smtp_server_id ) {
|
|
return '<a href="/cgi-bin/koha/admin/smtp_servers.pl?op=edit_form&smtp_server_id='+encodeURIComponent(data.smtp_server_id)+'">'+data.name.escapeHtml()+'</a>';
|
|
}
|
|
else {
|
|
return _("Default").escapeHtml();
|
|
}
|
|
},
|
|
"searchable": false,
|
|
"visible": true,
|
|
"orderable": false
|
|
},
|
|
{
|
|
"data": function( row, type, val, meta ) {
|
|
let result = '';
|
|
let set_hours = 0;
|
|
if ( row.library_hours.length > 0 ) {
|
|
for (let check_counter = 0; check_counter < 7; check_counter++) {
|
|
if ( row.library_hours[check_counter].open_time != null || row.library_hours[check_counter].close_time != null ) {
|
|
set_hours = 1;
|
|
}
|
|
}
|
|
}
|
|
if ( set_hours > 0 ) {
|
|
const daysOfWeek = [ _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday") ];
|
|
|
|
result = '<table id="library_hours_table"><thead><tr><th>Day</th><th>Open time</th><th>Close time</th></tr></thead><tbody>';
|
|
let counter = 0;
|
|
for (let i = calendarFirstDayOfWeek; counter < 7; i++) {
|
|
const day = i % 7; // Wrap around the day using modulo operator
|
|
result += '<tr id="hours_'+day+'">';
|
|
result += '<td>'+daysOfWeek[day].escapeHtml()+'</td>';
|
|
result += '<td><span>';
|
|
result += row.library_hours[day].open_time != null ? $kohatime(row.library_hours[day].open_time): '';
|
|
result += '</span></td>';
|
|
result += '<td><span>';
|
|
result += row.library_hours[day].close_time != null ? $kohatime(row.library_hours[day].close_time): '';
|
|
result += '</span></td>';
|
|
result += '</tr>';
|
|
counter++;
|
|
}
|
|
result += '</tbody></table>';
|
|
} else {
|
|
result = _("Library hours not set").escapeHtml();
|
|
}
|
|
return result;
|
|
},
|
|
"searchable": false,
|
|
"orderable": false
|
|
},
|
|
{
|
|
"data": function( row, type, val, meta ) {
|
|
|
|
var result = '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode='+encodeURIComponent(row.library_id)+'" role="button"><i class="fa-solid fa-pencil" aria-hidden="true"></i> '+_("Edit")+'</a>';
|
|
result += '<form action="/cgi-bin/koha/admin/branches.pl" method="get">';
|
|
result += '<input type="hidden" name="branchcode" value="'+row.library_id.escapeHtml()+'" />'+"\n";
|
|
result += '<input type="hidden" name="op" value="delete_confirm" />';
|
|
result += '<button type="submit" id="delete_library_'+row.library_id.escapeHtml()+'" class="btn btn-default btn-xs" role="button"><i class="fa fa-trash-can" aria-hidden="true"></i> '+_("Delete")+'</button></form>';
|
|
|
|
return result;
|
|
|
|
},
|
|
"searchable": false,
|
|
"orderable": false
|
|
},
|
|
],
|
|
bKohaColumnsUseNames: true,
|
|
}, table_settings);
|
|
|
|
[% UNLESS library %]
|
|
$("#Aform").on("submit", function( event ) {
|
|
if ( $("#branchcode").val().match(/\s/) ) {
|
|
event.preventDefault();
|
|
alert(_("The library code entered contains whitespace characters. Please remove any whitespace characters from the library code"));
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
});
|
|
[% END %]
|
|
});
|
|
|
|
$( ".expand-textarea" ).on("click", function(e){
|
|
e.preventDefault();
|
|
$(this).hide();
|
|
var target = $(this).data("target");
|
|
var syntax = $(this).data("syntax");
|
|
$("#collapse_" + target ).show();
|
|
if( syntax ){
|
|
var esLintConfig = { 'esversion': 6 };
|
|
var lint_type = syntax === 'javascript' ? esLintConfig : true;
|
|
var editor = CodeMirror.fromTextArea( document.getElementById( target ), {
|
|
lineNumbers: true,
|
|
mode: syntax,
|
|
lineWrapping: true,
|
|
viewportMargin: Infinity,
|
|
gutters: ["CodeMirror-lint-markers"],
|
|
lint: lint_type,
|
|
});
|
|
editor.on("blur", function(){
|
|
editor.save();
|
|
});
|
|
} else {
|
|
$( target ).show();
|
|
}
|
|
});
|
|
|
|
$( ".collapse-textarea" ).on("click", function(e){
|
|
e.preventDefault();
|
|
$(this).hide();
|
|
var target = $(this).data("target");
|
|
var syntax = $(this).data("syntax");
|
|
$("#expand_" + target ).show();
|
|
if( syntax ){
|
|
var editor = $( "#" + target ).next(".CodeMirror")[0].CodeMirror;
|
|
editor.toTextArea();
|
|
}
|
|
$( "#" + target ).hide();
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|