Bug 9769 [Revised] Replace YUI buttons on acquisitions basket page with Bootstrap

Toolbar buttons on the acquisitions basket page are constructed by YUI.
They should use Bootstrap instead.

Other minor changes: Fixes for invalid markup.

To test, view baskets in various states: Empty, open closed. View
baskets in groups and not in groups. Buttons should look correct and
work correctly:

- Edit
- Delete
- Close
- Reopen
- Export

Revision corrects check for 'skip_confirm_reopen' variable when
reopening baskets. Please test with BasketConfirmations both on and off.

Signed-off-by: Brendan <brendan@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested all options, some notes about behaviour:
- closing a basket is only possible, when there are no uncertain prices
  (no button close basket)
- reopening a basket requires, that you first remove the basket from
  any basket group (no button to reopen basket)
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Owen Leonard 2013-03-08 09:46:13 -05:00 committed by Jared Camins-Esakov
parent 186d97ff2b
commit 250467eb41

View file

@ -78,7 +78,8 @@
[% UNLESS ( grouped ) %]
<script type="text/javascript">
//<![CDATA[
function confirm_reopen(skip) {
function confirm_reopen() {
var skip = [% IF ( skip_confirm_reopen ) %] 1 [% ELSE %] 0 [% END %];
var is_confirmed = skip || confirm(_("Are you sure you want to reopen this basket?"));
if (is_confirmed) {
window.location = "[% script_name %]?op=reopen&basketno=[% basketno %]";
@ -104,7 +105,15 @@
var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, {
"sPaginationType": "four_button"
} ) );
} );
$("#delbasketbutton").on("click",function(e){
e.preventDefault();
confirm_deletion();
});
$("#reopenbutton").on("click",function(e){
e.preventDefault();
confirm_reopen();
});
});
//]]>
</script>
@ -127,62 +136,25 @@
[% UNLESS ( confirm_close ) %]
[% UNLESS ( selectbasketg ) %]
[% UNLESS ( closedate ) %]
<div id="toolbar">
<script type="text/javascript">
//<![CDATA[
// prepare DOM for YUI Toolbar
$(document).ready(function() {
yuiToolbar();
});
// YUI Toolbar Functions
function yuiToolbar() {
[% IF ( unclosable ) %]
new YAHOO.widget.Button("closebutton", {disabled:true});
[% ELSIF ( uncertainprices ) %]
new YAHOO.widget.Button("uncertpricesbutton");
[% ELSE %]
new YAHOO.widget.Button("closebutton");
[% END %]
new YAHOO.widget.Button("basketheadbutton");
new YAHOO.widget.Button("exportbutton");
new YAHOO.widget.Button("delbasketbutton");
}
//]]>
</script>
<ul id="toolbar-list" class="toolbar">
<li><a href="basketheader.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;op=add_form" class="button" id="basketheadbutton">Edit basket</a></li>
<li><a href="javascript:confirm_deletion();" class="button" id="delbasketbutton">Delete this basket</a></li>
<div id="toolbar" class="btn-toolbar">
<div class="btn-group"><a href="basketheader.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]&amp;op=add_form" class="btn btn-small" id="basketheadbutton"><i class="icon-pencil"></i> Edit basket</a></div>
<div class="btn-group"><a href="#" class="btn btn-small" id="delbasketbutton"><i class="icon-remove"></i> Delete this basket</a></div>
[% IF ( unclosable ) %]
[% ELSIF ( uncertainprices ) %]
<li><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&amp;owner=1" class="button" id="uncertpricesbutton">Uncertain prices</a></li>
<div class="btn-group"><a href="/cgi-bin/koha/acqui/uncertainprice.pl?booksellerid=[% booksellerid %]&amp;owner=1" class="btn btn-small" id="uncertpricesbutton">Uncertain prices</a></div>
[% ELSE %]
<li><a href="[% script_name %]?op=close&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="button" id="closebutton">Close this basket</a></li>
<div class="btn-group">
<a href="[% script_name %]?op=close&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="closebutton"><i class="icon-remove-sign"></i> Close this basket</a>
</div>
[% END %]
<li><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="button" id="exportbutton">Export this basket as CSV</a></li>
</ul>
<div class="btn-group"><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="icon-download"></i> Export this basket as CSV</a></div>
</div>
[% ELSE %]
[% UNLESS ( grouped ) %]
<div id="toolbar">
<script type="text/javascript">
//<![CDATA[
// prepare DOM for YUI Toolbar
$(document).ready(function() {
yuiToolbar();
});
// YUI Toolbar Functions
function yuiToolbar() {
new YAHOO.widget.Button("reopenbutton");
new YAHOO.widget.Button("exportbutton");
}
//]]>
</script>
<ul id="toolbar-list" class="toolbar">
<li><a href="javascript:confirm_reopen([% skip_confirm_reopen %]);" class="button" id="reopenbutton">Reopen this basket</a></li>
<li><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="button" id="exportbutton">Export this basket as CSV</a></li>
</ul>
<div id="toolbar" class="btn-toolbar">
<div class="btn-group"><a href="#" class="btn btn-small" id="reopenbutton"><i class="icon-refresh"></i> Reopen this basket</a></div>
<div class="btn-group"><a href="[% script_name %]?op=export&amp;basketno=[% basketno %]&amp;booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="icon-download"></i> Export this basket as CSV</a></div>
</div>
[% END %]
[% END %]
@ -307,13 +279,16 @@
[% FOREACH foot_loo IN book_foot_loop %]
<tr>
<th>Total (GST [% foot_loo.gstgsti %])</th>
<th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
<th class="gste">&nbsp;</th>
<th class="gste">&nbsp;</th>
<th class="gsti">&nbsp;</th>
<th class="gsti">&nbsp;</th>
<th>[% foot_loo.quantity %]</th>
<th class="gste">[% foot_loo.totalgste %]</th>
<th class="gsti">[% foot_loo.totalgsti %]</th>
<th/>
<th>&nbsp;</th>
<th>[% foot_loo.gstvalue %]</th>
<th/>
<th>&nbsp;</th>
[% IF ( active ) %]
[% UNLESS ( closedate ) %]
<th>&nbsp;</th>
@ -324,13 +299,16 @@
[% END %]
<tr>
<th>Total ([% currency %])</th>
<th class="gste"/><th class="gste"/><th class="gsti"/><th class="gsti"/>
<th class="gste">&nbsp;</th>
<th class="gste">&nbsp;</th>
<th class="gsti">&nbsp;</th>
<th class="gsti">&nbsp;</th>
<th>[% total_quantity %]</th>
<th class="gste">[% total_gste %]</th>
<th class="gsti">[% total_gsti %]</th>
<th/>
<th>&nbsp;</th>
<th>[% total_gstvalue %]</th>
<th/>
<th>&nbsp;</th>
[% IF ( active ) %]
[% UNLESS ( closedate ) %]
<th>&nbsp;</th>
@ -356,12 +334,12 @@
Suggested by: [% books_loo.surnamesuggestedby %][% IF ( books_loo.firstnamesuggestedby ) %], [% books_loo.firstnamesuggestedby %] [% END %]
(<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid %]&amp;op=show">suggestion #[% books_loo.suggestionid %]</a>)
[% END %]
</p>
[% IF ( books_loo.notes ) %]
<p class="ordernote"><strong>Note: </strong>[% books_loo.notes|html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]">Change note</a>]</p>
[% ELSE %]
[<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]">Add note</a>]
<p>[<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]">Add note</a>]</p>
[% END %]
</p>
</td>
<td class="number gste [% IF books_loo.rrpgste.search('^0') %]error[% END %]">[% books_loo.rrpgste %]</td>
<td class="number gste [% IF books_loo.ecostgste.search('^0') %]error[% END %]">[% books_loo.ecostgste %]</td>