View | Details | Raw Unified | Return to bug 14544
Collapse All | Expand All

(-)a/C4/Output.pm (-3 / +16 lines)
Lines 86-95 This function returns HTML, without any language dependency. Link Here
86
=cut
86
=cut
87
87
88
sub pagination_bar {
88
sub pagination_bar {
89
	my $base_url = (@_ ? shift : $ENV{SCRIPT_NAME} . $ENV{QUERY_STRING}) or return;
89
    my $base_url = (@_ ? shift : $ENV{SCRIPT_NAME} . $ENV{QUERY_STRING});
90
    return unless defined $base_url;
90
    my $nb_pages       = (@_) ? shift : 1;
91
    my $nb_pages       = (@_) ? shift : 1;
91
    my $current_page   = (@_) ? shift : undef;	# delay default until later
92
    my $current_page   = (@_) ? shift : undef;	# delay default until later
92
    my $startfrom_name = (@_) ? shift : 'page';
93
    my $startfrom_name = (@_) ? shift : 'page';
94
    my $additional_parameters = shift || {};
93
95
94
    # how many pages to show before and after the current page?
96
    # how many pages to show before and after the current page?
95
    my $pages_around = 2;
97
    my $pages_around = 2;
Lines 106-111 sub pagination_bar { Link Here
106
	$base_url =~ s/$delim$//;		# remove trailing delim
108
	$base_url =~ s/$delim$//;		# remove trailing delim
107
109
108
    my $url = $base_url . (($base_url =~ m/$delim/ or $base_url =~ m/\?/) ? '&' : '?' ) . $startfrom_name . '=';
110
    my $url = $base_url . (($base_url =~ m/$delim/ or $base_url =~ m/\?/) ? '&' : '?' ) . $startfrom_name . '=';
111
    my $url_suffix;
112
    while ( my ( $k, $v ) = each %$additional_parameters ) {
113
        $url_suffix .= '&' . $k . '=' . $v;
114
    }
109
    my $pagination_bar = '';
115
    my $pagination_bar = '';
110
116
111
    # navigation bar useful only if more than one page to display !
117
    # navigation bar useful only if more than one page to display !
Lines 117-123 sub pagination_bar { Link Here
117
                "\n" . ' '
123
                "\n" . ' '
118
              . '<a href="'
124
              . '<a href="'
119
              . $url
125
              . $url
120
              . '1" rel="start">'
126
              . '1'
127
              . $url_suffix
128
              . '"rel="start">'
121
              . '&lt;&lt;' . '</a>';
129
              . '&lt;&lt;' . '</a>';
122
        }
130
        }
123
        else {
131
        else {
Lines 134-139 sub pagination_bar { Link Here
134
              . '<a href="'
142
              . '<a href="'
135
              . $url
143
              . $url
136
              . $previous
144
              . $previous
145
              . $url_suffix
137
              . '" rel="prev">' . '&lt;' . '</a>';
146
              . '" rel="prev">' . '&lt;' . '</a>';
138
        }
147
        }
139
        else {
148
        else {
Lines 172-178 sub pagination_bar { Link Here
172
                        "\n" . '&nbsp;'
181
                        "\n" . '&nbsp;'
173
                      . '<a href="'
182
                      . '<a href="'
174
                      . $url
183
                      . $url
175
                      . $page_number . '">'
184
                      . $page_number
185
                      . $url_suffix
186
                      . '">'
176
                      . $page_number . '</a>';
187
                      . $page_number . '</a>';
177
                }
188
                }
178
                $last_displayed_page = $page_number;
189
                $last_displayed_page = $page_number;
Lines 187-192 sub pagination_bar { Link Here
187
              . '&nbsp;<a href="'
198
              . '&nbsp;<a href="'
188
              . $url
199
              . $url
189
              . $next
200
              . $next
201
              . $url_suffix
190
              . '" rel="next">' . '&gt;' . '</a>';
202
              . '" rel="next">' . '&gt;' . '</a>';
191
        }
203
        }
192
        else {
204
        else {
Lines 200-205 sub pagination_bar { Link Here
200
              . '&nbsp;<a href="'
212
              . '&nbsp;<a href="'
201
              . $url
213
              . $url
202
              . $nb_pages
214
              . $nb_pages
215
              . $url_suffix
203
              . '" rel="last">'
216
              . '" rel="last">'
204
              . '&gt;&gt;' . '</a>';
217
              . '&gt;&gt;' . '</a>';
205
        }
218
        }
(-)a/C4/Utils/DataTables/VirtualShelves.pm (-3 / +4 lines)
Lines 5-11 use C4::Branch qw/onlymine/; Link Here
5
use C4::Context;
5
use C4::Context;
6
use C4::Members qw/GetMemberIssuesAndFines/;
6
use C4::Members qw/GetMemberIssuesAndFines/;
7
use C4::Utils::DataTables;
7
use C4::Utils::DataTables;
8
use C4::VirtualShelves;
8
use Koha::Virtualshelves;
9
9
10
sub search {
10
sub search {
11
    my ( $params ) = @_;
11
    my ( $params ) = @_;
Lines 121-128 sub search { Link Here
121
    ( $iTotalRecords ) = $dbh->selectrow_array( $query, undef, @args );
121
    ( $iTotalRecords ) = $dbh->selectrow_array( $query, undef, @args );
122
122
123
    for my $shelf ( @$shelves ) {
123
    for my $shelf ( @$shelves ) {
124
        $shelf->{can_manage_shelf} = C4::VirtualShelves::ShelfPossibleAction( $loggedinuser, $shelf->{shelfnumber}, 'manage' );
124
        my $s = Koha::Virtualshelves->find( $shelf->{shelfnumber} );
125
        $shelf->{can_delete_shelf} = C4::VirtualShelves::ShelfPossibleAction( $loggedinuser, $shelf->{shelfnumber}, 'delete_shelf' );
125
        $shelf->{can_manage_shelf} = $s->can_be_managed( $loggedinuser );
126
        $shelf->{can_delete_shelf} = $s->can_be_deleted( $loggedinuser );
126
    }
127
    }
127
    return {
128
    return {
128
        iTotalRecords => $iTotalRecords,
129
        iTotalRecords => $iTotalRecords,
(-)a/C4/VirtualShelves/Page.pm (-19 lines)
Lines 68-74 sub shelfpage { Link Here
68
    loggedinuser => $loggedinuser,
68
    loggedinuser => $loggedinuser,
69
    OpacAllowPublicListCreation => C4::Context->preference('OpacAllowPublicListCreation'),
69
    OpacAllowPublicListCreation => C4::Context->preference('OpacAllowPublicListCreation'),
70
    );
70
    );
71
    my $edit;
72
    my $shelves;
71
    my $shelves;
73
    my @paramsloop;
72
    my @paramsloop;
74
    my $totitems;
73
    my $totitems;
Lines 209-215 sub shelfpage { Link Here
209
                my $shelf = Koha::Virtualshelves->find( $shelfnumber );
208
                my $shelf = Koha::Virtualshelves->find( $shelfnumber );
210
                my $member = GetMember( 'borrowernumber' => $shelf->owner );
209
                my $member = GetMember( 'borrowernumber' => $shelf->owner );
211
                my $ownername = defined($member) ? $member->{firstname} . " " . $member->{surname} : '';
210
                my $ownername = defined($member) ? $member->{firstname} . " " . $member->{surname} : '';
212
                $edit = 1;
213
                $template->param(
211
                $template->param(
214
                    edit                => 1,
212
                    edit                => 1,
215
                    display             => $displaymode,
213
                    display             => $displaymode,
Lines 231-239 sub shelfpage { Link Here
231
        #View a shelf
229
        #View a shelf
232
        if ( $shelfnumber = $query->param('viewshelf') ) {
230
        if ( $shelfnumber = $query->param('viewshelf') ) {
233
            my $shelf = Koha::Virtualshelves->find( $shelfnumber );
231
            my $shelf = Koha::Virtualshelves->find( $shelfnumber );
234
            $template->param(
235
                'DisplayMultiPlaceHold' => C4::Context->preference('DisplayMultiPlaceHold'),
236
            );
237
            if (C4::Context->preference('TagsEnabled')) {
232
            if (C4::Context->preference('TagsEnabled')) {
238
                $template->param(TagsEnabled => 1);
233
                $template->param(TagsEnabled => 1);
239
                    foreach (qw(TagsShowOnList TagsInputOnList)) {
234
                    foreach (qw(TagsShowOnList TagsInputOnList)) {
Lines 494-513 sub shelfpage { Link Here
494
        csv_profiles                                                       => GetCsvProfilesLoop('marc')
489
        csv_profiles                                                       => GetCsvProfilesLoop('marc')
495
    );
490
    );
496
491
497
    unless( $shelfnumber or $shelves or $edit ) {
498
        # Only used for intranet
499
        $template->param( op => 'list' );
500
    }
501
502
    if ($shelves or    # note: this part looks duplicative, but is intentional
503
        $edit
504
      ) {
505
        $template->param( seflag => 1 );
506
        #This hack is just another argument for refactoring this script one day
507
        #At this point you are adding or editing a list; if you add, then you add a private list (by default) with permissions as below; if you edit, do not pass these permissions, they must come from the database
508
        $template->param( allow_add => 0, allow_delete_own => 1, allow_delete_other => 0) unless $shelfnumber;
509
    }
510
511
#Next call updates the shelves for the Lists button.
492
#Next call updates the shelves for the Lists button.
512
#May not always be needed (when nothing changed), but doesn't take much.
493
#May not always be needed (when nothing changed), but doesn't take much.
513
    my ($total, $pubshelves, $barshelves) = C4::VirtualShelves::GetSomeShelfNames($loggedinuser, 'MASTHEAD');
494
    my ($total, $pubshelves, $barshelves) = C4::VirtualShelves::GetSomeShelfNames($loggedinuser, 'MASTHEAD');
(-)a/Koha/Virtualshelf.pm (+47 lines)
Lines 19-24 use Modern::Perl; Link Here
19
19
20
use Carp;
20
use Carp;
21
21
22
use C4::Auth;
23
24
use Koha::Borrowers;
22
use Koha::Database;
25
use Koha::Database;
23
use Koha::DateUtils qw( dt_from_string );
26
use Koha::DateUtils qw( dt_from_string );
24
use Koha::Exceptions;
27
use Koha::Exceptions;
Lines 200-205 sub remove_biblios { Link Here
200
    return $number_deleted;
203
    return $number_deleted;
201
}
204
}
202
205
206
sub can_be_viewed {
207
    my ( $self, $borrowernumber ) = @_;
208
}
209
210
sub can_be_deleted {
211
    my ( $self, $borrowernumber ) = @_;
212
213
    return unless $borrowernumber;
214
    return 1 if $self->owner == $borrowernumber;
215
216
    my $patron = Koha::Borrowers->find( $borrowernumber );
217
218
    return 1 if $self->category == $PUBLIC and C4::Auth::haspermission( $patron->userid, { shelves => 'delete_public_lists' } );
219
220
    return;
221
}
222
223
sub can_be_managed {
224
    my ( $self, $borrowernumber ) = @_;
225
    return 1
226
      if $borrowernumber and $self->owner == $borrowernumber;
227
    return 0;
228
}
229
230
sub can_biblios_be_added {
231
    my ( $self, $borrowernumber ) = @_;
232
233
    return 1
234
      if $borrowernumber
235
      and ($self->owner == $borrowernumber
236
        or $self->allow_add );
237
    return 0;
238
}
239
240
sub can_biblios_be_deleted {
241
    my ( $self, $borrowernumber ) = @_;
242
243
    return 1
244
      if $borrowernumber
245
      and ($self->allow_delete_own
246
        or $self->allow_delete_other );
247
    return 0;
248
}
249
203
sub type {
250
sub type {
204
    return 'Virtualshelve';
251
    return 'Virtualshelve';
205
}
252
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc (-14 / +10 lines)
Lines 1-7 Link Here
1
<script type="text/javascript">
1
<script type="text/javascript">
2
//<![CDATA[
2
//<![CDATA[
3
3
4
[% IF ( viewshelf ) %]
4
[% IF op == 'view' %]
5
5
6
    function sendList(){
6
    function sendList(){
7
        open(CGIBIN+'virtualshelves/sendshelf.pl?shelfid=[% shelfnumber %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
7
        open(CGIBIN+'virtualshelves/sendshelf.pl?shelfid=[% shelfnumber %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
Lines 13-19 Link Here
13
            return false;
13
            return false;
14
        });
14
        });
15
        $("#deleteshelf").click(function(e){
15
        $("#deleteshelf").click(function(e){
16
            if(confirmDelete(_("Are you sure you want to delete this list?"))){
16
            if(confirm(_("Are you sure you want to delete this list?"))){
17
                return true;
17
                return true;
18
            } else {
18
            } else {
19
                e.preventDefault();
19
                e.preventDefault();
Lines 27-46 Link Here
27
</script>
27
</script>
28
28
29
<div id="toolbar" class="btn-toolbar">
29
<div id="toolbar" class="btn-toolbar">
30
    <div class="btn-group"><a id="newshelf" class="btn btn-small" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1"><i class="icon-plus"></i> New list</a></div>
30
    <div class="btn-group"><a id="newshelf" class="btn btn-small" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=add_form&amp;referer=[% op %]"><i class="icon-plus"></i> New list</a></div>
31
31
32
    [% IF ( viewshelf ) %]
32
    [% IF op == 'view' %]
33
        [% IF ( manageshelf ) %]
33
        [% IF can_manage %]
34
        <div class="btn-group">
34
        <div class="btn-group">
35
            <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-pencil"></i> Edit <span class="caret"></span></button>
35
            <button class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-pencil"></i> Edit <span class="caret"></span></button>
36
                <ul class="dropdown-menu">
36
            <ul class="dropdown-menu">
37
                    <li><a href="/cgi-bin/koha/virtualshelves/shelves.pl?shelfnumber=[% shelfnumber %]&amp;op=modif&amp;display=viewshelf">Edit list</a></li>
37
                <li><a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=edit_form&amp;shelfnumber=[% shelf.shelfnumber %]&amp;referer=[% op %]">Edit list</a></li>
38
                    [% IF ( showprivateshelves ) %]
38
                <li><a id="deleteshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=delete&amp;shelfnumber=[% shelf.shelfnumber %]">Delete list</a></li>
39
                        <li><a id="deleteshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves&amp;shelves=1&amp;DEL-[% shelfnumber %]=1">Delete list</a></li>
39
            </ul>
40
                    [% ELSE %]
41
                        <li><a id="deleteshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1&amp;DEL-[% shelfnumber %]=1">Delete list</a></li>
42
                    [% END %]
43
                </ul>
44
        </div>
40
        </div>
45
        [% END %]
41
        [% END %]
46
42
Lines 56-61 Link Here
56
                </ul>
52
                </ul>
57
        </div>
53
        </div>
58
        <div class="btn-group"><a class="btn btn-small" href="#" id="sendlist"><i class="icon-envelope"></i> Send list</a></div>
54
        <div class="btn-group"><a class="btn btn-small" href="#" id="sendlist"><i class="icon-envelope"></i> Send list</a></div>
59
        <div class="btn-group"><a class="btn btn-small" id="printlist" target="_blank" href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&amp;print=1"><i class="icon-print"></i> Print list</a></div>
55
        <div class="btn-group"><a class="btn btn-small" id="printlist" target="_blank" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]&amp;print=1"><i class="icon-print"></i> Print list</a></div>
60
    [% END %]
56
    [% END %]
61
</div>
57
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +2 lines)
Lines 359-365 function verify_images() { Link Here
359
        [% IF ( GetShelves ) %]
359
        [% IF ( GetShelves ) %]
360
            <span class="results_summary"><span class="label">Lists that include this title: </span>
360
            <span class="results_summary"><span class="label">Lists that include this title: </span>
361
            [% FOREACH GetShelve IN GetShelves %]
361
            [% FOREACH GetShelve IN GetShelves %]
362
                <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% GetShelve.shelfnumber %]">[% GetShelve.shelfname %]</a>
362
                <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% GetShelve.shelfnumber %]">[% GetShelve.shelfname %]</a>
363
                [% IF ( loop.last ) %][% ELSE %]|[% END %]
363
                [% IF ( loop.last ) %][% ELSE %]|[% END %]
364
            [% END %]
364
            [% END %]
365
            </span>
365
            </span>
Lines 524-530 function verify_images() { Link Here
524
	        <li><strong>Lists that include this title: </strong>
524
	        <li><strong>Lists that include this title: </strong>
525
	        <ul>
525
	        <ul>
526
	        [% FOREACH GetShelve IN GetShelves %]
526
	        [% FOREACH GetShelve IN GetShelves %]
527
		        <li><a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% GetShelve.shelfnumber %]">[% GetShelve.shelfname %]</a></li>
527
		        <li><a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% GetShelve.shelfnumber %]">[% GetShelve.shelfname %]</a></li>
528
	        [% END %]
528
	        [% END %]
529
	        </ul>
529
	        </ul>
530
	        </li>
530
	        </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-131 / +140 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
2
[% USE KohaDates %]
3
[% SET PRIVATE = 1 %]
4
[% SET PUBLIC = 2 %]
1
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; [% IF ( viewshelf ) %]Lists &rsaquo; Contents of [% shelfname | html %][% ELSE %]Lists[% END %][% IF ( shelves ) %] &rsaquo; Create new list[% END %][% IF ( edit ) %] &rsaquo; Edit list [% shelfname | html %][% END %]</title>
6
<title>Koha &rsaquo; [% IF op == 'view' %]Lists &rsaquo; Contents of [% shelf.shelfname | html %][% ELSE %]Lists[% END %][% IF op == 'add_form' %] &rsaquo; Create new list[% END %][% IF op == 'edit_form' %] &rsaquo; Edit list [% shelf.shelfname | html %][% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
8
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
5
[% INCLUDE 'datatables.inc' %]
9
[% INCLUDE 'datatables.inc' %]
Lines 14-20 Link Here
14
</script>
18
</script>
15
[% END %]
19
[% END %]
16
20
17
[% IF ( viewshelf ) %]
21
[% IF op == 'view' %]
18
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
22
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
19
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
23
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
20
[% END %]
24
[% END %]
Lines 27-33 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to remove this list?"); Link Here
27
31
28
[% IF op == 'list' %]
32
[% IF op == 'list' %]
29
$(document).ready(function(){
33
$(document).ready(function(){
30
    var type = 1;
34
    [% IF category == PUBLIC %]
35
        var type = [% PUBLIC %];
36
    [% ELSE %]
37
        var type = [% PRIVATE %];
38
    [% END %]
31
    var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
39
    var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, {
32
        'bServerSide': true,
40
        'bServerSide': true,
33
        'sAjaxSource': "/cgi-bin/koha/svc/virtualshelves/search",
41
        'sAjaxSource': "/cgi-bin/koha/svc/virtualshelves/search",
Lines 81-93 $(document).ready(function(){ Link Here
81
    dtListResults.fnAddFilters("filter", 750);
89
    dtListResults.fnAddFilters("filter", 750);
82
90
83
    var tabs = $("#tabs").tabs({
91
    var tabs = $("#tabs").tabs({
92
        [% IF category == PUBLIC %]
93
            active: 1,
94
        [% ELSE %]
95
            active: 0,
96
        [% END %]
84
        activate: function(e, ui) {
97
        activate: function(e, ui) {
85
            var active = tabs.tabs("option", "active" );
98
            var active = tabs.tabs("option", "active" );
86
            if ( active == 0 ) {
99
            if ( active == 0 ) {
87
                type = 1; // private
100
                type = [% PRIVATE %];
88
                dtListResults.fnDraw();
101
                dtListResults.fnDraw();
89
            } else if ( active == 1 ) {
102
            } else if ( active == 1 ) {
90
                type = 2; // public
103
                type = [% PUBLIC %];
91
                dtListResults.fnDraw();
104
                dtListResults.fnDraw();
92
            }
105
            }
93
        }
106
        }
Lines 95-101 $(document).ready(function(){ Link Here
95
});
108
});
96
[% END %]
109
[% END %]
97
110
98
[% IF ( viewshelf ) %]
111
[% IF op == 'view' %]
99
$(document).ready(function(){
112
$(document).ready(function(){
100
    [% IF ( itemsloop ) %]$('#searchheader').fixFloat();[% END %]
113
    [% IF ( itemsloop ) %]$('#searchheader').fixFloat();[% END %]
101
    $("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/shelves.pl\">"+_("Clear all")+"<\/a>");
114
    $("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/shelves.pl\">"+_("Clear all")+"<\/a>");
Lines 173-186 $(document).ready(function(){ Link Here
173
});
186
});
174
[% END %]
187
[% END %]
175
188
176
	function confirmDelete(message){
177
		if (window.confirm(message)) {
178
		    location.href="/cgi-bin/koha/virtualshelves/shelves.pl?[% IF ( showprivateshelves ) %]display=privateshelves&[% END %]shelves=1&DEL-[% shelfnumber %]=1&shelfoff=[% shelfoff %]";
179
		} else { 
180
			return false;
181
		}
182
	}
183
184
    /**
189
    /**
185
     * This function checks if the adequate number of records are checked for merging
190
     * This function checks if the adequate number of records are checked for merging
186
     */
191
     */
Lines 272-306 function placeHold () { Link Here
272
[% INCLUDE 'header.inc' %]
277
[% INCLUDE 'header.inc' %]
273
[% INCLUDE 'cat-search.inc' %]
278
[% INCLUDE 'cat-search.inc' %]
274
279
275
[% BLOCK list_permissions %]
280
<div id="breadcrumbs">
276
    <li>
281
    <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
277
        <label for="permissions">Permissions: </label>
282
    [% IF op != 'list' %]
278
        <select name="allow_add" id="allow_add">
283
        <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a>
279
            [% IF allow_add %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
284
    [% ELSE %]
280
            [% IF allow_add %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
285
        Lists
281
        </select>
286
    [% END %]
282
        &nbsp;<span>anyone else to add entries.</span>
287
    [% IF shelf AND shelf.category == PRIVATE %] &rsaquo;
283
    </li>
288
        [% IF op == 'view' OR op == 'edit_form' %]
284
    <li>
289
            <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&amp;category=[% PRIVATE %]">Your lists</a>
285
        <label>&nbsp;</label>
290
        [% ELSE %]
286
        <select name="allow_delete_own" id="allow_delete_own">
291
            Your lists
287
            [% IF allow_delete_own %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
292
        [% END %]
288
            [% IF allow_delete_own %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
293
    [% ELSIF shelf AND shelf.category == PUBLIC %] &rsaquo;
289
        </select>
294
        [% IF op == 'view' %]
290
        &nbsp;<span>anyone to remove his own contributed entries.</span>
295
            <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&amp;category=[% PUBLIC %]">Public lists</a>
291
    </li>
296
        [% ELSE %]
292
    <li>
297
            Public lists
293
        <label>&nbsp;</label>
298
        [% END %]
294
        <select name="allow_delete_other" id="allow_delete_other">
299
    [% END %]
295
            [% IF allow_delete_other %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
296
            [% IF allow_delete_other %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
297
        </select>
298
        &nbsp;<span>anyone to remove other contributed entries.</span>
299
    </li>
300
[% END %]
301
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/virtualshelves/shelves.pl">Lists</a> [% IF ( category1 ) %] &rsaquo; [% IF ( viewshelf || edit ) %] <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your lists</a> [% ELSE %] Your lists [% END %] [% ELSIF ( category2 ) %] &rsaquo; [% IF ( viewshelf ) %] <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public lists</a> [% ELSE %] Public lists [% END %] [% ELSIF ( showprivateshelves ) %] &rsaquo; [% IF ( viewshelf || edit ) %] <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves">Your lists</a> [% ELSE %] Your lists [% END %] [% ELSIF ( showpublicshelves ) %] &rsaquo; [% IF ( viewshelf || edit ) %] <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=publicshelves">Public lists</a> [% ELSE %] Public lists [% END %] [% END %]
302
300
303
[% IF ( viewshelf ) %]&rsaquo; Contents of <i>[% shelfname | html %]</i>[% END %][% IF ( shelves ) %] &rsaquo; Create new list[% END %][% IF ( edit ) %] &rsaquo; Edit list <i>[% shelfname | html %]</i>[% END %]</div>
301
[% IF op == 'view' %]&rsaquo; Contents of <i>[% shelf.shelfname | html %]</i>[% END %][% IF op == 'add_form' %] &rsaquo; Create new list[% END %][% IF op == 'edit_form' %] &rsaquo; Edit list <i>[% shelf.shelfname | html %]</i>[% END %]</div>
304
302
305
<div id="doc2" class="yui-t7">
303
<div id="doc2" class="yui-t7">
306
 <div id="bd">
304
 <div id="bd">
Lines 323-330 function placeHold () { Link Here
323
            List inserted with success.
321
            List inserted with success.
324
        [% CASE 'success_on_delete' %]
322
        [% CASE 'success_on_delete' %]
325
            List deleted with success.
323
            List deleted with success.
326
        [% CASE 'Koha::Exception::DuplicateObject' %]
324
        [% CASE 'does_not_exist' %]
325
            This list does not exist.
326
        [% CASE 'unauthorized_on_update' %]
327
            You do not have permission to update this list.
328
        [% CASE 'unauthorized_on_delete' %]
329
            You do not have permission to delete this list.
330
        [% CASE 'Koha::Exceptions::Virtualshelves::DuplicateObject' %]
327
            An error occurred when inserting this list. The name already [% shelfname %] exists.
331
            An error occurred when inserting this list. The name already [% shelfname %] exists.
332
        [% CASE 'DBIx::Class::Exception' %]
333
            [% m.msg %]
328
        [% CASE %]
334
        [% CASE %]
329
            [% m.code %]
335
            [% m.code %]
330
        [% END %]
336
        [% END %]
Lines 371-384 function placeHold () { Link Here
371
[% END %]
377
[% END %]
372
[% END %] 
378
[% END %] 
373
379
374
[% IF ( viewshelf ) %]
380
[% IF op == 'view' %]
375
   <div class="yui-g">
381
   <div class="yui-g">
376
    [% IF ( itemsloop ) %]
382
    [% IF itemsloop %]
377
383
378
    <h3>Contents of <i>[% shelfname | html %]</i></h3>
384
    <h3>Contents of <i>[% shelf.shelfname | html %]</i></h3>
379
    <div class="pages">[% pagination_bar %]</div>
385
    <div class="pages">[% pagination_bar %]</div>
380
    <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="listform" method="post" class="checkboxed">
386
    <form action="/cgi-bin/koha/virtualshelves/shelves.pl" id="listform" method="post" class="checkboxed">
381
        <input type="hidden" name="viewshelf" value="[% shelfnumber %]" />
387
        <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
382
        <input type="hidden" name="modifyshelfcontents" value="1" />
388
        <input type="hidden" name="modifyshelfcontents" value="1" />
383
389
384
[% IF direction == 'asc' %]
390
[% IF direction == 'asc' %]
Lines 389-404 function placeHold () { Link Here
389
[% END %]
395
[% END %]
390
396
391
<div id="searchheader" class="noprint">
397
<div id="searchheader" class="noprint">
392
    [% IF ( itemsloop ) %]
398
    [% IF itemsloop %]
393
        <div id="selection_ops"><span class="checkall"></span> |
399
        <div id="selection_ops"><span class="checkall"></span> |
394
        <span class="clearall"></span>
400
        <span class="clearall"></span>
395
401
396
        <span class="addto">| </span>
402
        <span class="addto">| </span>
397
        &nbsp;
403
        &nbsp;
398
        [% IF ( CAN_user_reserveforothers && DisplayMultiPlaceHold ) %]
404
        [% IF CAN_user_reserveforothers && Koha.Preference('DisplayMultiPlaceHold') %]
399
            <div class="btn-group"><button class="btn btn-mini placehold"><i class="icon-hold"></i> Place hold</button></div>
405
            <div class="btn-group"><button class="btn btn-mini placehold"><i class="icon-hold"></i> Place hold</button></div>
400
        [% END %]
406
        [% END %]
401
        [% IF ( allowremovingitems ) %]
407
        [% IF can_delete_biblios %]
402
            <div class="btn-group"><button type="submit" class="btn btn-mini list-remove"><i class="icon-remove-sign"></i> Remove selected</button></div>
408
            <div class="btn-group"><button type="submit" class="btn btn-mini list-remove"><i class="icon-remove-sign"></i> Remove selected</button></div>
403
        [% END %]
409
        [% END %]
404
        [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]<div class="btn-group"><button type="submit" class="btn btn-mini merge-items"><i class="icon-merge"></i> Merge selected</button></div>[% END %]
410
        [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]<div class="btn-group"><button type="submit" class="btn btn-mini merge-items"><i class="icon-merge"></i> Merge selected</button></div>[% END %]
Lines 412-418 function placeHold () { Link Here
412
418
413
                [% UNLESS ( item_level_itypes ) %]<th>Item type</th>[% END %]
419
                [% UNLESS ( item_level_itypes ) %]<th>Item type</th>[% END %]
414
                <th>
420
                <th>
415
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&amp;sort=title&amp;direction=[% IF sort != 'title' %]asc[% ELSE %][% new_direction %][% END %]">Title</a>
421
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelfnumber %]&amp;sort=title&amp;direction=[% IF sort != 'title' %]asc[% ELSE %][% new_direction %][% END %]">Title</a>
416
                    [% IF sort == 'title' %]
422
                    [% IF sort == 'title' %]
417
                        <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
423
                        <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
418
                    [% ELSE %]
424
                    [% ELSE %]
Lines 420-426 function placeHold () { Link Here
420
                    [% END %]
426
                    [% END %]
421
                </th>
427
                </th>
422
                <th>
428
                <th>
423
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&amp;sort=author&amp;direction=[% IF sort != 'author' %]asc[% ELSE %][% new_direction %][% END %]">Author</a>
429
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelfnumber %]&amp;sort=author&amp;direction=[% IF sort != 'author' %]asc[% ELSE %][% new_direction %][% END %]">Author</a>
424
                   [% IF sort == 'author' %]
430
                   [% IF sort == 'author' %]
425
                        <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
431
                        <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
426
                   [% ELSE %]
432
                   [% ELSE %]
Lines 429-435 function placeHold () { Link Here
429
                 </th>
435
                 </th>
430
                <th>Date added</th>
436
                <th>Date added</th>
431
                <th>
437
                <th>
432
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]&amp;sort=itemcallnumber&amp;direction=[% IF sort != 'itemcallnumber' %]asc[% ELSE %][% new_direction %][% END %]">Call number</a>
438
                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelfnumber %]&amp;sort=itemcallnumber&amp;direction=[% IF sort != 'itemcallnumber' %]asc[% ELSE %][% new_direction %][% END %]">Call number</a>
433
                   [% IF sort == 'itemcallnumber' %]
439
                   [% IF sort == 'itemcallnumber' %]
434
                        <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
440
                        <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
435
                   [% ELSE %]
441
                   [% ELSE %]
Lines 481-490 function placeHold () { Link Here
481
                            | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% itemsloo.biblionumber %]">Edit items</a>
487
                            | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% itemsloo.biblionumber %]">Edit items</a>
482
                        [% END %]
488
                        [% END %]
483
                    </p>
489
                    </p>
484
			</td>
490
            </td>
485
			<td>[% itemsloo.author %]</td>
491
            <td>[% itemsloo.author %]</td>
486
			<td>[% itemsloo.dateadded %]</td>
492
            <td>[% itemsloo.dateadded | $KohaDates%]</td>
487
			<td>
493
            <td>
488
                <ul>
494
                <ul>
489
                [% FOREACH result IN itemsloo.ITEM_RESULTS %]
495
                [% FOREACH result IN itemsloo.ITEM_RESULTS %]
490
                    <li>[% result.holdingbranch %] [% IF ( result.location_intranet ) %] ([% result.location_intranet %]) [% END %]
496
                    <li>[% result.holdingbranch %] [% IF ( result.location_intranet ) %] ([% result.location_intranet %]) [% END %]
Lines 503-511 function placeHold () { Link Here
503
509
504
	[% END %]
510
	[% END %]
505
   </div>
511
   </div>
506
[% END %]<!-- /viewshelf -->
512
[% END %]
507
513
508
[% IF ( allowaddingitem ) %]
514
[% IF can_add_biblios %]
509
<div class="yui-g">
515
<div class="yui-g">
510
<form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
516
<form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
511
 <fieldset class="brief noprint">
517
 <fieldset class="brief noprint">
Lines 514-520 function placeHold () { Link Here
514
            <li>
520
            <li>
515
                <label for="addbarcode">Barcode:</label>
521
                <label for="addbarcode">Barcode:</label>
516
                <input name="addbarcode" type="text" id="addbarcode" size="14" />
522
                <input name="addbarcode" type="text" id="addbarcode" size="14" />
517
                <input type="hidden" name="viewshelf" value="[% shelfnumber %]" />
523
                <input type="hidden" name="shelfnumber" value="[% shelfnumber %]" />
518
                <input type="hidden" name="modifyshelfcontents" value="1" />
524
                <input type="hidden" name="modifyshelfcontents" value="1" />
519
                <input type="submit" value="Add" />
525
                <input type="submit" value="Add" />
520
            </li>
526
            </li>
Lines 522-609 function placeHold () { Link Here
522
 </fieldset>
528
 </fieldset>
523
</form>
529
</form>
524
</div>
530
</div>
525
[% END %]<!-- /allowaddingitem -->
526
527
[% IF ( debug ) %]
528
  [% IF ( edit ) %]<div>Edit is on ([% shelfname | html %])</div>[% END %]
529
  [% IF ( seflag ) %]<div>seflag is on ([% seflag %])</div>[% END %]
530
[% END %]
531
[% END %]
531
532
532
[% IF ( seflag ) %]
533
[% IF op == 'add_form' OR op == 'edit_form' %]
533
<div class="yui-ge">
534
<div class="yui-ge">
534
    <div class="yui-u first">
535
    <div class="yui-u first">
535
    <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl" class="validated">
536
    <form method="post" action="/cgi-bin/koha/virtualshelves/shelves.pl" class="validated">
536
        <fieldset class="rows">
537
        <fieldset class="rows">
537
538
538
    [% IF ( shelves ) %]
539
        [% IF op == 'add_form' %]
539
        <legend>Create a new list</legend>
540
            <legend>Create a new list</legend>
540
        <input type="hidden" name="shelves" value="1" />
541
            <input type="hidden" name="op" value="add" />
542
        [% ELSE %]
543
            <legend>Edit list <i>[% shelf.shelfname | html %]</i></legend>
544
            <input type="hidden" name="op" value="edit" />
545
        [% END %]
546
        <input type="hidden" name="referer" value="[% referer %]" />
547
        <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber %]" />
541
        <ol>
548
        <ol>
542
        <li><label class="required" for="addshelf">List name:</label><input id="addshelf" type="text" name="addshelf" size="25" required="required" class="required" />
549
            <li>
543
            <span class="required">Required</span>
550
                <label for="shelfname" class="required">Name: </label><input type="text" id="shelfname" name="shelfname" size="25" value="[% shelf.shelfname |html %]" required="required" class="required" />
544
        </li>
545
        <li><span class="label">Owner: </span><input type="hidden" name="owner" id="owner" value="[% loggedinuser %]" />[% loggedinusername %]</li>
546
        <li><label for="sortfield" >Sort this list by: </label>
547
        <select name="sortfield" id="sortfield">
548
            <option value="title">Title</option>
549
            <option value="author">Author</option>
550
            <option value="copyrightdate">Copyrightdate</option>
551
            <option value="itemcallnumber">Call number</option>
552
        </select></li>
553
        <li><label for="category">Category: </label>
554
            <select name="category" id="category">
555
                  <option value="1">Private</option>
556
                  <option value="2">Public</option>
557
                     </select></li>
558
            [% INCLUDE list_permissions %]
559
        </ol>
560
    [% END %]
561
562
    [% IF ( edit ) %]
563
        <legend>Edit list <i>[% shelfname | html %]</i></legend>
564
        <input type="hidden" name="display" value="[% display %]" />
565
        <input type="hidden" name="op" value="modifsave" />
566
        [% IF ( showprivateshelves ) %]<input type="hidden" name="display" value="privateshelves" />[% END %]
567
        <input type="hidden" name="shelfnumber" value="[% shelfnumber %]" />
568
		<ol>
569
            <li><label for="shelfname" class="required">Name: </label><input type="text" id="shelfname" name="shelfname" size="25" value="[% shelfname |html %]" required="required" class="required" />
570
            <span class="required">Required</span>
551
            <span class="required">Required</span>
571
        </li>
552
            </li>
572
		<li><label for="owner">Owner: </label><input type="hidden" id="owner" name="owner" value="[% IF ( owner ) %][% ownername %][% ELSE %][% loggedinusername %][% END %]" />[% IF ( owner ) %][% ownername %][% ELSE %][% loggedinusername %][% END %]</li>
553
            <li>
573
		<li><label for="sortfield" >Sort this list by: </label>
554
                <span class="label">Owner: </span>
574
		<select name="sortfield">
555
                [% IF op == 'add_form' %]
575
        [% IF ( sortfield == "title" ) %]<option value="title" selected="selected">Title</option>[% ELSE %]<option value="title">Title</option>[% END %]
556
                    <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber %]" />[% loggedinusername %]</li>
576
        [% IF ( sortfield == "author" ) %]<option value="author" selected="selected">Author</option>[% ELSE %]<option value="author">Author</option>[% END %]
557
                [% ELSE %]
577
        [% IF ( sortfield == "copyrightdate" ) %]<option value="copyrightdate" selected="selected">Copyrightdate</option>[% ELSE %]<option value="copyrightdate">Copyrightdate</option>[% END %]
558
                    [% IF owner %]
578
        [% IF ( sortfield == "itemcallnumber" ) %]<option value="itemcallnumber" selected="selected">Call number</option>[% ELSE %]<option value="itemcallnumber">Call number</option>[% END %]
559
                        <input type="hidden" id="owner" name="owner" value="[% owner.borrowernumber %]" />[% owner.firstname _ ' ' _ owner.surname %]
579
		</select></li>
560
                    [% ELSE %]
580
		<li><label for="category">Category: </label>
561
                        <input type="hidden" id="owner" name="owner" value="[% loggedinusernumber %]" />[% loggedinusername %]
581
			<select id="category" name="category">
562
                    [% END %]
582
			[% IF ( category1 ) %]
563
                [% END %]
583
				<option value="1" selected="selected">Private</option>
564
            </li>
584
			[% ELSE %]
565
            <li><label for="sortfield" >Sort this list by: </label>
585
				<option value="1">Private</option>
566
            <select name="sortfield">
586
			[% END %]
567
            [% IF shelf.sortfield == "title" %]<option value="title" selected="selected">Title</option>[% ELSE %]<option value="title">Title</option>[% END %]
587
			[% IF ( category2 ) %]
568
            [% IF shelf.sortfield == "author" %]<option value="author" selected="selected">Author</option>[% ELSE %]<option value="author">Author</option>[% END %]
588
				<option value="2" selected="selected">Public</option>
569
            [% IF shelf.sortfield == "copyrightdate" %]<option value="copyrightdate" selected="selected">Copyrightdate</option>[% ELSE %]<option value="copyrightdate">Copyrightdate</option>[% END %]
589
			[% ELSE %]
570
            [% IF shelf.sortfield == "itemcallnumber" %]<option value="itemcallnumber" selected="selected">Call number</option>[% ELSE %]<option value="itemcallnumber">Call number</option>[% END %]
590
				<option value="2">Public</option>
571
            </select></li>
591
			[% END %]
572
            <li><label for="category">Category: </label>
592
                       </select></li>
573
                <select id="category" name="category">
593
            [% INCLUDE list_permissions %]
574
                [% IF shelf.category == PRIVATE %]
594
            </ol>
575
                    <option value="1" selected="selected">Private</option>
595
	[% END %]
576
                [% ELSE %]
577
                    <option value="1">Private</option>
578
                [% END %]
579
                [% IF shelf.category == PUBLIC %]
580
                    <option value="2" selected="selected">Public</option>
581
                [% ELSE %]
582
                    <option value="2">Public</option>
583
                [% END %]
584
                           </select></li>
596
585
597
		</fieldset>
586
            [% FOR permission IN ['allow_add', 'allow_delete_own', 'allow_delete_other'] %]
587
                <li>
588
                    [% IF loop.first %]
589
                        <label for="permissions">Permissions: </label>
590
                    [% ELSE %]
591
                        <label>&nbsp;</label>
592
                    [% END %]
593
                    <select name="[% permission %]" id="[% permission %]">
594
                        [% IF shelf.$permission %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
595
                        [% IF shelf.$permission %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
596
                    </select>
597
                    [% SWITCH permission %]
598
                        [% CASE 'allow_add' %]&nbsp;<span>anyone else to add entries.</span>
599
                        [% CASE 'allow_delete_own' %]&nbsp;<span>anyone to remove his own contributed entries.</span>
600
                        [% CASE 'allow_delete_other' %]&nbsp;<span>anyone to remove other contributed entries.</span>
601
                    [% END %]
602
                </li>
603
            [% END %]
604
        </ol>
605
    </fieldset>
598
606
599
    <fieldset class="action"><input type="submit" value="Save" class="submit" />
607
    <fieldset class="action">
600
        [% IF ( showprivateshelves ) %]
608
        <input type="submit" value="Save" class="submit" />
601
            <a href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves" class="cancel">Cancel</a>
609
        [% IF referer == 'view' %]
602
        [% ELSE %]
610
           <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]" class="cancel">Cancel</a>
603
            [% IF ( display == "viewshelf" ) %]
611
       [% ELSE %]
604
               <a href="/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% shelfnumber %]" class="cancel">Cancel</a>
612
            [% IF category == PUBLIC %]
613
                <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&amp;category=[% PUBLIC %]" class="cancel">Cancel</a>
605
            [% ELSE %]
614
            [% ELSE %]
606
                <a href="/cgi-bin/koha/virtualshelves/shelves.pl" class="cancel">Cancel</a>
615
                <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=list&amp;category=[% PRIVATE %]" class="cancel">Cancel</a>
607
            [% END %]
616
            [% END %]
608
        [% END %]
617
        [% END %]
609
    </fieldset>
618
    </fieldset>
Lines 618-624 function placeHold () { Link Here
618
        </div>
627
        </div>
619
    </div>
628
    </div>
620
</div>
629
</div>
621
[% END %]<!-- /seflag -->
630
[% END %]
622
631
623
[% IF op == 'list' %]
632
[% IF op == 'list' %]
624
    <h2>Lists</h2>
633
    <h2>Lists</h2>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt (-2 / +2 lines)
Lines 9-15 Link Here
9
                "dt_type":
9
                "dt_type":
10
                    "[% data.type %]",
10
                    "[% data.type %]",
11
                "dt_shelfname":
11
                "dt_shelfname":
12
                    "<a href='/cgi-bin/koha/virtualshelves/shelves.pl?viewshelf=[% data.shelfnumber %]'>[% data.shelfname | html%]</a>",
12
                    "<a href='/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% data.shelfnumber %]'>[% data.shelfname | html%]</a>",
13
                "dt_count":
13
                "dt_count":
14
                    "[% data.count %] item(s)",
14
                    "[% data.count %] item(s)",
15
                "dt_owner":
15
                "dt_owner":
Lines 29-35 Link Here
29
29
30
[% BLOCK action_form -%]
30
[% BLOCK action_form -%]
31
    [%- IF can_manage_shelf -%]
31
    [%- IF can_manage_shelf -%]
32
<form action='shelves.pl' method='get'><input type='hidden' name='shelfnumber' value='[% shelfnumber %]' /><input type='hidden' name='op' value='modif' /><input type='submit' class='editshelf' value='Edit' /></form>[% IF can_manage_shelf OR can_delete_shelf %]<form action='shelves.pl' method='post'><input type='hidden' name='shelfoff' value='[% shelfoff %]' /><input type='hidden' name='shelves' value='1' /><input type='hidden' name='DEL-[% shelfnumber %]' value='1' /><input type='hidden' name='CONFIRM-[% shelfnumber %]' value='1' />[% IF type == 1 %]<input type='hidden' name='display' value='privateshelves' />[% ELSE %]<input type='hidden' name='display' value='publicshelves' />[% END %]<input type='submit' class='deleteshelf' onclick='return confirmDelete(MSG_CONFIRM_DELETE_LIST)' value='Delete' /></form>[% END %]
32
<form action='shelves.pl' method='get'><input type='hidden' name='shelfnumber' value='[% shelfnumber %]' /><input type='hidden' name='op' value='edit_form' /><input type='hidden' name='category' value='[% type %]' /><input type='submit' class='editshelf' value='Edit' /></form>[% IF can_manage_shelf OR can_delete_shelf %]<form action='shelves.pl' method='post'><input type='hidden' name='shelfoff' value='[% shelfoff %]' /><input type='hidden' name='op' value='delete' /><input type='hidden', name='shelfnumber', value='[% shelfnumber %] /><input type='hidden' name='category' value='[% type %]' /><input type='submit' class='deleteshelf' onclick='return confirmDelete(MSG_CONFIRM_DELETE_LIST)' value='Delete' /></form>[% END %]
33
    [%- ELSE -%]
33
    [%- ELSE -%]
34
        None
34
        None
35
    [%- END -%]
35
    [%- END -%]
(-)a/virtualshelves/addbybiblionumber.pl (-3 / +4 lines)
Lines 155-161 sub HandleNewVirtualShelf { Link Here
155
}
155
}
156
156
157
sub HandleShelfNumber {
157
sub HandleShelfNumber {
158
    if($authorized= ShelfPossibleAction($loggedinuser, $shelfnumber, 'add')) {
158
    my $shelf = Koha::Virtualshelves->find( $shelfnumber );
159
    if($authorized = $shelf->can_biblios_be_added( $loggedinuser ) ) {
159
    AddBibliosToShelf($shelfnumber, @biblionumber);
160
    AddBibliosToShelf($shelfnumber, @biblionumber);
160
    #Close this page and return
161
    #Close this page and return
161
    print $query->header;
162
    print $query->header;
Lines 167-175 sub HandleShelfNumber { Link Here
167
}
168
}
168
169
169
sub HandleSelectedShelf {
170
sub HandleSelectedShelf {
170
    if($authorized= ShelfPossibleAction( $loggedinuser, $shelfnumber, 'add')){
171
    my $shelf = Koha::Virtualshelves->find( $shelfnumber );
172
    if($authorized = $shelf->can_biblios_be_added( $loggedinuser ) ) {
171
        #confirm adding to specific shelf
173
        #confirm adding to specific shelf
172
        my $shelf = Koha::Virtualshelves->find( $shelfnumber );
173
        $template->param(
174
        $template->param(
174
        singleshelf               => 1,
175
        singleshelf               => 1,
175
        shelfnumber               => $shelf->shelfnumber,
176
        shelfnumber               => $shelf->shelfnumber,
(-)a/virtualshelves/shelves.pl (-10 / +174 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
#
3
# Copyright 2015 Koha Team
4
# Copyright 2000-2002 Katipo Communications
5
#
4
#
6
# This file is part of Koha.
5
# This file is part of Koha.
7
#
6
#
Lines 18-39 Link Here
18
# You should have received a copy of the GNU General Public License
17
# You should have received a copy of the GNU General Public License
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
19
21
use strict;
20
use Modern::Perl;
22
use warnings;
23
use CGI qw ( -utf8 );
21
use CGI qw ( -utf8 );
24
use C4::VirtualShelves::Page;
22
use C4::VirtualShelves;
25
use C4::Auth;
23
use C4::Auth;
24
use C4::Biblio;
25
use C4::Koha;
26
use C4::Items;
27
use C4::Members;
28
use C4::Output;
29
use C4::XSLT;
30
use Koha::Virtualshelves;
26
31
27
my $query = new CGI;
32
my $query = new CGI;
28
33
29
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
34
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
30
    {
35
    {   template_name   => "virtualshelves/shelves.tt",
31
        template_name   => "virtualshelves/shelves.tt",
32
        query           => $query,
36
        query           => $query,
33
        type            => "intranet",
37
        type            => "intranet",
34
        authnotrequired => 0,
38
        authnotrequired => 0,
35
        flagsrequired   => { catalogue => 1 },
39
        flagsrequired   => { catalogue => 1 },
36
    }
40
    }
37
);
41
);
38
$template->param( print => $query->param('print') );
42
39
shelfpage('intranet', $query, $template, $loggedinuser, $cookie);
43
my $op       = $query->param('op')       || 'list';
44
my $referer  = $query->param('referer')  || $op;
45
my $category = $query->param('category') || 1;
46
my ( $shelf, $shelfnumber, @messages );
47
48
if ( $op eq 'add_form' ) {
49
    # Nothing to do
50
} elsif ( $op eq 'edit_form' ) {
51
    $shelfnumber = $query->param('shelfnumber');
52
    $shelf       = Koha::Virtualshelves->find($shelfnumber);
53
54
    $category = $shelf->category;
55
    my $patron = GetMember( 'borrowernumber' => $shelf->owner );
56
    $template->param( owner => $patron, );
57
    unless ( $shelf->can_be_edited( $loggedinuser ) ) {
58
        push @messages, { type => 'error', code => 'unauthorized_on_update' };
59
        $op = 'list';
60
    }
61
} elsif ( $op eq 'add' ) {
62
    eval {
63
        $shelf = Koha::Virtualshelf->new(
64
            {   shelfname          => $query->param('shelfname'),
65
                sortfield          => $query->param('sortfield'),
66
                category           => $query->param('category'),
67
                allow_add          => $query->param('allow_add'),
68
                allow_delete_own   => $query->param('allow_delete_own'),
69
                allow_delete_other => $query->param('allow_delete_other'),
70
                owner              => $query->param('owner'),
71
            }
72
        );
73
        $shelf->store;
74
        $shelfnumber = $shelf->shelfnumber;
75
    };
76
    if ($@) {
77
        push @messages, { type => 'error', code => ref($@), msg => $@ };
78
    } elsif ( not $shelf ) {
79
        push @messages, { type => 'error', code => 'error_on_insert' };
80
    } else {
81
        push @messages, { type => 'message', code => 'success_on_insert' };
82
        $op = 'view';
83
    }
84
} elsif ( $op eq 'edit' ) {
85
    $shelfnumber = $query->param('shelfnumber');
86
    $shelf       = Koha::Virtualshelves->find($shelfnumber);
87
    $op = $referer;
88
    if ( $shelf->can_be_managed( $loggedinuser ) ) {
89
        $shelf->shelfname( $query->param('shelfname') );
90
        $shelf->sortfield( $query->param('sortfield') );
91
        $shelf->allow_add( $query->param('allow_add') );
92
        $shelf->allow_delete_own( $query->param('allow_delete_own') );
93
        $shelf->allow_delete_other( $query->param('allow_delete_other') );
94
        $shelf->category( $query->param('category') );
95
        eval { $shelf->store };
96
97
        if ($@) {
98
            push @messages, { type => 'error', code => 'error_on_update' };
99
            $op = 'edit_form';
100
        } else {
101
            push @messages, { type => 'message', code => 'success_on_update' };
102
        }
103
    } else {
104
        push @messages, { type => 'error', code => 'unauthorized_on_update' };
105
    }
106
} elsif ( $op eq 'delete' ) {
107
    $shelfnumber = $query->param('shelfnumber');
108
    $shelf       = Koha::Virtualshelves->find($shelfnumber);
109
    if ($shelf) {
110
        if ( $shelf->can_be_deleted( $loggedinuser ) ) {
111
            eval { $shelf->delete; };
112
            if ($@) {
113
                push @messages, { type => 'error', code => ref($@), msg => $@ };
114
            } else {
115
                push @messages, { type => 'message', code => 'success_on_delete' };
116
            }
117
        } else {
118
            push @messages, { type => 'error', code => 'unauthorized_on_delete' };
119
        }
120
    } else {
121
        push @messages, { type => 'error', code => 'does_not_exist' };
122
    }
123
    $op = $referer;
124
}
125
126
if ( $op eq 'view' ) {
127
    $shelfnumber ||= $query->param('shelfnumber');
128
    $shelf = Koha::Virtualshelves->find($shelfnumber);
129
    my $sortfield = $query->param('sort')      || $shelf->sortfield;    # Passed in sorting overrides default sorting
130
    my $direction = $query->param('direction') || 'asc';
131
    my ( $shelflimit, $shelfoffset, $itemoff );
132
    unless ( $query->param('print') ) {
133
        $shelflimit = C4::Context->preference('numSearchResults') || 20;
134
        $itemoff = ( $query->param('itemoff') ? $query->param('itemoff') : 1 );
135
        $shelfoffset = ( $itemoff - 1 ) * $shelflimit;    # Sets the offset to begin retrieving items at
136
    }
137
    my ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction );
138
139
    my $borrower = GetMember( borrowernumber => $loggedinuser );
140
141
    for my $this_item (@$items) {
142
        my $biblionumber = $this_item->{biblionumber};
143
        my $record       = GetMarcBiblio($biblionumber);
144
145
        if ( C4::Context->preference("XSLTResultsDisplay") ) {
146
            $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "XSLTResultsDisplay" );
147
        }
148
149
        my $marcflavour = C4::Context->preference("marcflavour");
150
        $this_item->{'imageurl'}        = getitemtypeinfo( $this_item->{'itemtype'}, 'intranet' )->{'imageurl'};
151
        $this_item->{'coins'}           = GetCOinSBiblio($record);
152
        $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $this_item->{'biblionumber'} ) );
153
        $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
154
        $this_item->{'normalized_ean'}  = GetNormalizedEAN( $record, $marcflavour );
155
        $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour );
156
        $this_item->{'normalized_isbn'} = GetNormalizedISBN( undef, $record, $marcflavour );
157
158
        unless ( defined $this_item->{size} ) {
159
160
            #TT has problems with size
161
            $this_item->{size} = q||;
162
        }
163
164
        # Getting items infos for location display
165
        my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'} );
166
        $this_item->{'ITEM_RESULTS'} = \@items_infos;
167
    }
168
169
    # Build drop-down list for 'Add To:' menu...
170
    my ( $totalref, $pubshelves, $barshelves ) = C4::VirtualShelves::GetSomeShelfNames( $loggedinuser, 'COMBO', 1 );
171
    $template->param(
172
        addbarshelves      => $totalref->{bartotal},
173
        addbarshelvesloop  => $barshelves,
174
        addpubshelves      => $totalref->{pubtotal},
175
        addpubshelvesloop  => $pubshelves,
176
        can_manage_shelf   => $shelf->can_be_managed($loggedinuser),
177
        can_delete_shelf   => $shelf->can_be_deleted($loggedinuser),
178
        can_delete_biblios => $shelf->can_biblios_be_deleted($loggedinuser),
179
        can_add_biblios    => $shelf->can_biblios_be_added($loggedinuser),
180
        sortfield          => $sortfield,
181
        itemsloop          => $items,
182
        sortfield          => $sortfield,
183
        direction          => $direction,
184
    );
185
    if ($shelflimit) {
186
        $template->param(
187
            pagination_bar => pagination_bar(
188
                q||, ( int( $totitems / $shelflimit ) ) + ( ( $totitems % $shelflimit ) > 0 ? 1 : 0 ),
189
                $itemoff, "itemoff", { op => 'view', shelfnumber => $shelf->shelfnumber, sortfield => $sortfield, direction => $direction, }
190
            ),
191
        );
192
    }
193
}
194
195
$template->param(
196
    op       => $op,
197
    referer  => $referer,
198
    shelf    => $shelf,
199
    messages => \@messages,
200
    category => $category,
201
    print    => $query->param('print') || 0,
202
);
203
204
output_html_with_http_headers $query, $cookie, $template->output;
40
- 

Return to bug 14544