Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt
Owen Leonard e185aaf19b Bug 12519 - Convert OPAC list download pop-up to modal dialog
This patch changes the OPAC list download process so that the download
link triggers a modal dialog instead of a pop-up window. This
streamlines the process a little bit and makes it work better on mobile
devices.

The download list page has been altered so that it works better as a
standalone page, as it might be seen if JavaScript is disabled. Simple
form validation has been added to help prevent submission of the form
without choosing a format.

To test the virtualshelves system preference must be enabled.

- View an existing list in the OPAC and click the "download list" link.
- A modal dialog should be displayed with the download form.
- Submitting the form without selecting a format should trigger either a
  browser-based form validation error (in HTML5-supporting browsers) or
  a JavaScript alert (if your browser doesn't support the "required"
  attribute.
- Choosing a download format and submitting the form should close
  the dialog and trigger the correct download.
- Clicking the "Cancel" link should close the dialog.

Test with JavaScript disabled:

- Clicking the "download list" link should take you to a page which
  contains the same form which appeared in the modal dialog.
- Submitting the form without selecting a format should trigger either a
  browser-based form validation error (in HTML5-supporting browsers) or
  a JavaScript alert (if your browser doesn't support the "required"
  attribute..
- Choosing a download format and submitting the form should result in
  the corect download.
- Clicking the "Cancel" link should return you to the correct list.

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes QA script and tests, works as described.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2014-07-22 09:54:36 +12:00

118 lines
No EOL
6 KiB
Text

[% USE Koha %]
[% IF ( fullpage ) %]
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Download list [% shelfname %][% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
</head>
<body id="opac-downloadlist">
[% INCLUDE 'masthead.inc' %]
<div class="main">
<ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
[% IF ( loggedinusername ) %]
<li><a href="/cgi-bin/koha/opac-user.pl">[% FOREACH USER_INF IN USER_INFO %][% USER_INF.title %] [% USER_INF.firstname %] [% USER_INF.surname %][% END %]</a> <span class="divider">&rsaquo;</span></li>
[% END %]
<li>
[% IF ( showprivateshelves ) %]
<a href="/cgi-bin/koha/opac-shelves.pl">Your lists</a>
[% ELSE %]
<a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a>
[% END %]
<span class="divider">&rsaquo;</span>
</li>
<li>Download list <i>[% shelfname %]</i></li>
</ul>
<div class="container-fluid">
<div class="row-fluid">
[% IF ( OpacNav||loggedinusername ) %]
<div class="span2">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
[% END %]
[% IF ( OpacNav||loggedinusername ) %]
<div class="span10">
[% ELSE %]
<div class="span12">
[% END %]
[% END # / IF fullpage %]
<div id="userdownloadshelf" class="maincontent">
[% UNLESS ( invalidlist ) %]
[% IF ( format ) %]
<div class="alert alert-info">
<p>Your download should begin automatically.</p>
</div>
[% ELSE %]
<h1>Download list <i>[% shelfname %]</i></h1>
<form method="post" action="/cgi-bin/koha/opac-downloadshelf.pl">
<fieldset>
<select name="format" id="dlformat" required="required">
<option value="">-- Choose format --</option>
<option value="ris">RIS (Zotero, EndNote, others)</option>
<option value="bibtex">BibTeX</option>
<option value="iso2709">MARC</option>
[% FOREACH csv_profile IN csv_profiles %]
<option value="[% csv_profile.export_format_id %]">CSV - [% csv_profile.profile %]</option>
[% END %]
</select>
<span class="required">Required</span>
</fieldset>
<fieldset class="action">
<input type="hidden" name="shelfid" value="[% shelfid | html %]" />
<input type="submit" name="save" class="btn" value="Go" />
<a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfid %]" class="cancel close" data-dismiss="modal">Cancel</a>
</fieldset>
</form>
[% IF ( modal ) %]
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#userdownloadshelf form").on("submit",function(e){
if( $("#dlformat").val() == "" ){
e.preventDefault();
alert(_("Please choose a download format"));
} else {
$("#modalWin").modal("hide");
}
});
});
//]]>
</script>
[% END %]
[% END # / IF format %]
[% ELSE %]
<div class="alert">
<p>You do not have permission to download this list.</p>
</div>
[% END # / invalidlist %]
</div> <!-- / #userdownloadshelf -->
[% IF ( fullpage ) %]
</div> <!-- / .span10 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#userdownloadshelf form").on("submit",function(e){
if( $("#dlformat").val() == "" ){
e.preventDefault();
alert(_("Please choose a download format"));
}
});
});
//]]>
</script>
[% END %]
[% END # / IF fullpage %]