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

(-)a/Koha/Objects.pm (+11 lines)
Lines 126-131 sub count { Link Here
126
    return $self->_resultset()->count($params);
126
    return $self->_resultset()->count($params);
127
}
127
}
128
128
129
=head3 Koha::Objects->pager();
130
131
my $pager = Koha::Objects->pager;
132
133
=cut
134
135
sub pager {
136
    my ( $self ) = @_;
137
    return $self->_resultset->pager;
138
}
139
129
=head3 Koha::Objects->next();
140
=head3 Koha::Objects->next();
130
141
131
my $object = Koha::Objects->next();
142
my $object = Koha::Objects->next();
(-)a/Koha/Virtualshelf.pm (-2 / +14 lines)
Lines 101-112 sub is_shelfname_valid { Link Here
101
101
102
sub get_shares {
102
sub get_shares {
103
    my ( $self ) = @_;
103
    my ( $self ) = @_;
104
    return $self->{_result}->virtualshelfshares;
104
    my $shares = $self->{_result}->virtualshelfshares;
105
    return $shares;
105
}
106
}
106
107
107
sub get_contents {
108
sub get_contents {
108
    my ( $self ) = @_;
109
    my ( $self ) = @_;
109
    return $self->{_result}->virtualshelfcontents;
110
    my $contents = $self->{_result}->virtualshelfcontents;
111
    return $contents;
110
}
112
}
111
113
112
sub share {
114
sub share {
Lines 132-137 sub is_shared { Link Here
132
    )->count;
134
    )->count;
133
}
135
}
134
136
137
sub is_shared_with {
138
    my ( $self, $borrowernumber ) = @_;
139
    return unless $borrowernumber;
140
    return  $self->get_shares->search(
141
        {
142
            borrowernumber => $borrowernumber,
143
        }
144
    )->count;
145
}
146
135
sub remove_share {
147
sub remove_share {
136
    my ( $self, $borrowernumber ) = @_;
148
    my ( $self, $borrowernumber ) = @_;
137
    my $shelves = Koha::Virtualshelfshares->search(
149
    my $shelves = Koha::Virtualshelfshares->search(
(-)a/Koha/Virtualshelves.pm (-13 / +11 lines)
Lines 41-64 Koha::Virtualshelf - Koha Virtualshelf Object class Link Here
41
41
42
sub get_private_shelves {
42
sub get_private_shelves {
43
    my ( $self, $params ) = @_;
43
    my ( $self, $params ) = @_;
44
    my $limit = $params->{limit};
44
    my $page = $params->{page};
45
    my $offset = $params->{offset} || 0;
45
    my $rows = $params->{rows};
46
    my $borrowernumber = $params->{borrowernumber};
46
    my $borrowernumber = $params->{borrowernumber} || 0;
47
47
48
    $self->search(
48
    $self->search(
49
        {
49
        {
50
            'virtualshelfshares.borrowernumber' => $borrowernumber,
51
            category => 1,
50
            category => 1,
52
            -or => {
51
            -or => {
53
                'virtualshelfshares.owner' => $borrowernumber,
52
                'virtualshelfshares.borrowernumber' => $borrowernumber,
54
                'virtualshelves.borrowernumber' => $borrowernumber,
53
                'me.owner' => $borrowernumber,
55
            }
54
            }
56
        },
55
        },
57
        {
56
        {
58
            join => ['borrowers', 'virtualshelfcontents', 'virtualshelfshares' ],
57
            join => [ 'virtualshelfshares' ],
59
            group_by => 'shelfnumber',
58
            group_by => 'shelfnumber',
60
            order_by => 'shelfname',
59
            order_by => 'shelfname',
61
            limit => "$limit,$offset",
60
            ( ( $page and $rows ) ? ( page => $page, rows => $rows ) : () ),
62
        }
61
        }
63
    );
62
    );
64
}
63
}
Lines 66-83 sub get_private_shelves { Link Here
66
65
67
sub get_public_shelves {
66
sub get_public_shelves {
68
    my ( $self, $params ) = @_;
67
    my ( $self, $params ) = @_;
69
    my $limit = $params->{limit};
68
    my $page = $params->{page};
70
    my $offset = $params->{offset} || 0;
69
    my $rows = $params->{rows};
71
70
72
    $self->search(
71
    $self->search(
73
        {
72
        {
74
            category => 1,
73
            category => 2,
75
        },
74
        },
76
        {
75
        {
77
            join => [ 'virtualshelfcontents' ],
78
            group_by => 'shelfnumber',
76
            group_by => 'shelfnumber',
79
            order_by => 'shelfname',
77
            order_by => 'shelfname',
80
            limit => "$limit,$offset",
78
            ( ( $page and $rows ) ? ( page => $page, rows => $rows ) : () ),
81
        }
79
        }
82
    );
80
    );
83
}
81
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt (+2 lines)
Lines 36-41 Link Here
36
        [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
36
        [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
37
        [%~ action_block = action_block _ '<input type="hidden" name="op" value="edit_form" />' ~%]
37
        [%~ action_block = action_block _ '<input type="hidden" name="op" value="edit_form" />' ~%]
38
        [%~ action_block = action_block _ '<input type="hidden" name="category" value="' _ type _ '" />' ~%]
38
        [%~ action_block = action_block _ '<input type="hidden" name="category" value="' _ type _ '" />' ~%]
39
        [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
39
        [%~ action_block = action_block _ '<input type="submit" class="editshelf" value="Edit" />' ~%]
40
        [%~ action_block = action_block _ '<input type="submit" class="editshelf" value="Edit" />' ~%]
40
        [%~ action_block = action_block _ '</form>' ~%]
41
        [%~ action_block = action_block _ '</form>' ~%]
41
    [%~ END ~%]
42
    [%~ END ~%]
Lines 46-51 Link Here
46
        [%~ action_block = action_block _ '<input type="hidden" name="op" value="delete" />' ~%]
47
        [%~ action_block = action_block _ '<input type="hidden" name="op" value="delete" />' ~%]
47
        [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
48
        [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber  _ '" />' ~%]
48
        [%~ action_block = action_block _ '<input type="hidden" name="category" value="' _ type _ '" />' ~%]
49
        [%~ action_block = action_block _ '<input type="hidden" name="category" value="' _ type _ '" />' ~%]
50
        [%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
49
        [%~ action_block = action_block _ '<input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" value="Delete" />' ~%]
51
        [%~ action_block = action_block _ '<input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" value="Delete" />' ~%]
50
        [%~ action_block = action_block _ '</form>' ~%]
52
        [%~ action_block = action_block _ '</form>' ~%]
51
    [%~ END ~%]
53
    [%~ END ~%]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (-7 / +7 lines)
Lines 38-63 Link Here
38
                                <a href="#" title="Show lists" class="dropdown-toggle" id="listsmenu" data-toggle="dropdown" role="button"><i class="icon-list icon-white"></i> <span class="listslabel">Lists</span> <b class="caret"></b></a>
38
                                <a href="#" title="Show lists" class="dropdown-toggle" id="listsmenu" data-toggle="dropdown" role="button"><i class="icon-list icon-white"></i> <span class="listslabel">Lists</span> <b class="caret"></b></a>
39
                                <ul aria-labelledby="listsmenu" role="menu" class="dropdown-menu">
39
                                <ul aria-labelledby="listsmenu" role="menu" class="dropdown-menu">
40
                                    [% IF ( pubshelves ) %]
40
                                    [% IF ( pubshelves ) %]
41
                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves" tabindex="-1" role="menuitem"><strong>Public lists</strong></a></li>
41
                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=2" tabindex="-1" role="menuitem"><strong>Public lists</strong></a></li>
42
                                        [% FOREACH pubshelvesloo IN pubshelvesloop %]
42
                                        [% FOREACH pubshelvesloo IN pubshelvesloop %]
43
                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% pubshelvesloo.shelfnumber %]&amp;sortfield=[% pubshelvesloo.sortfield %]" tabindex="-1" role="menuitem">[% pubshelvesloo.shelfname |html %]</a></li>
43
                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% pubshelvesloo.shelfnumber %]&amp;sortfield=[% pubshelvesloo.sortfield %]" tabindex="-1" role="menuitem">[% pubshelvesloo.shelfname |html %]</a></li>
44
                                        [% END %]
44
                                        [% END %]
45
                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves" tabindex="-1" role="menuitem" class="listmenulink">View All</a></li>
45
                                            <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=2" tabindex="-1" role="menuitem" class="listmenulink">View All</a></li>
46
                                    [% ELSE %]
46
                                    [% ELSE %]
47
                                        <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No public lists</a></li>
47
                                        <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No public lists</a></li>
48
                                    [% END %]
48
                                    [% END %]
49
                                    <li class="divider" role="presentation"></li>
49
                                    <li class="divider" role="presentation"></li>
50
                                    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
50
                                    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
51
                                        <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" tabindex="-1" role="menuitem"><strong>Your lists</strong></a></li>
51
                                        <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1" tabindex="-1" role="menuitem"><strong>Your lists</strong></a></li>
52
                                        [% IF ( loggedinusername ) %]
52
                                        [% IF ( loggedinusername ) %]
53
                                            [% IF ( barshelves ) %]
53
                                            [% IF ( barshelves ) %]
54
                                                [% FOREACH barshelvesloo IN barshelvesloop %]
54
                                                [% FOREACH barshelvesloo IN barshelvesloop %]
55
                                                    <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% barshelvesloo.shelfnumber %]&amp;sortfield=[% barshelvesloo.sortfield %]" tabindex="-1" role="menuitem">[% barshelvesloo.shelfname |html %]</a></li>
55
                                                    <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% barshelvesloo.shelfnumber %]&amp;sortfield=[% barshelvesloo.sortfield %]" tabindex="-1" role="menuitem">[% barshelvesloo.shelfname |html %]</a></li>
56
                                                [% END %]
56
                                                [% END %]
57
                                                <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" tabindex="-1" role="menuitem" class="listmenulink">View all</a></li>
57
                                                <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1" tabindex="-1" role="menuitem" class="listmenulink">View all</a></li>
58
                                            [% ELSE %]
58
                                            [% ELSE %]
59
                                                <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No private lists</a></li>
59
                                                <li role="presentation"><a href="#" tabindex="-1" class="menu-inactive" role="menuitem">No private lists</a></li>
60
                                                <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" tabindex="-1" role="menuitem" class="listmenulink">New list</a></li>
60
                                                <li role="presentation"><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1" tabindex="-1" role="menuitem" class="listmenulink">New list</a></li>
61
                                            [% END %]
61
                                            [% END %]
62
                                        [% ELSE %]
62
                                        [% ELSE %]
63
                                            <li role="presentation"><a href="/cgi-bin/koha/opac-user.pl" tabindex="-1" class="menu-inactive loginModal-trigger" role="menuitem">Log in to create your own lists</a></li>
63
                                            <li role="presentation"><a href="/cgi-bin/koha/opac-user.pl" tabindex="-1" class="menu-inactive loginModal-trigger" role="menuitem">Log in to create your own lists</a></li>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc (-1 / +1 lines)
Lines 91-97 Link Here
91
                [% ELSE %]
91
                [% ELSE %]
92
                    <li>
92
                    <li>
93
                [% END %]
93
                [% END %]
94
                <a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">your lists</a></li>
94
                <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1">your lists</a></li>
95
            [% END %]
95
            [% END %]
96
96
97
            [% IF Koha.Preference( 'useDischarge' ) == 1 %]
97
            [% IF Koha.Preference( 'useDischarge' ) == 1 %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-2 / +2 lines)
Lines 391-398 Link Here
391
                    <!--This grabs all of the lists a bib record appears in -->
391
                    <!--This grabs all of the lists a bib record appears in -->
392
                    [% IF shelves %]
392
                    [% IF shelves %]
393
                        <span class="results_summary lists"><span class="label">List(s) this item appears in: </span>
393
                        <span class="results_summary lists"><span class="label">List(s) this item appears in: </span>
394
                        [% FOREACH shelf IN shelves %]
394
                        [% FOREACH s IN shelves %]
395
                            <a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelf.shelfnumber %]">[% shelf.shelfname %]</a>
395
                            <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber %]">[% s.shelfname %]</a>
396
                            [% IF ( loop.last ) %][% ELSE %]|[% END %]
396
                            [% IF ( loop.last ) %][% ELSE %]|[% END %]
397
                        [% END %]
397
                        [% END %]
398
                        </span>
398
                        </span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt (-8 / +8 lines)
Lines 1-7 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% IF ( fullpage ) %]
2
[% IF ( fullpage ) %]
3
    [% INCLUDE 'doc-head-open.inc' %]
3
    [% INCLUDE 'doc-head-open.inc' %]
4
    <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Download list [% shelfname %]</title>[% INCLUDE 'doc-head-close.inc' %]
4
    <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Download list [% shelf.shelfname %]</title>[% INCLUDE 'doc-head-close.inc' %]
5
    [% BLOCK cssinclude %][% END %]
5
    [% BLOCK cssinclude %][% END %]
6
    </head>
6
    </head>
7
    [% INCLUDE 'bodytag.inc' bodyid='opac-downloadlist' %]
7
    [% INCLUDE 'bodytag.inc' bodyid='opac-downloadlist' %]
Lines 13-26 Link Here
13
                    <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>
13
                    <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>
14
                [% END %]
14
                [% END %]
15
                <li>
15
                <li>
16
                    [% IF ( showprivateshelves ) %]
16
                    [% IF shelf.category == 1 %]
17
                        <a href="/cgi-bin/koha/opac-shelves.pl">Your lists</a>
17
                        <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1">Your lists</a>
18
                    [% ELSE %]
18
                    [% ELSE %]
19
                        <a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a>
19
                        <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=2">Public lists</a>
20
                    [% END %]
20
                    [% END %]
21
                    <span class="divider">&rsaquo;</span>
21
                    <span class="divider">&rsaquo;</span>
22
                </li>
22
                </li>
23
                <li>Download list <i>[% shelfname %]</i></li>
23
                <li>Download list <i>[% shelf.shelfname %]</i></li>
24
            </ul>
24
            </ul>
25
            <div class="container-fluid">
25
            <div class="container-fluid">
26
                <div class="row-fluid">
26
                <div class="row-fluid">
Lines 47-53 Link Here
47
                                    <p>Your download should begin automatically.</p>
47
                                    <p>Your download should begin automatically.</p>
48
                                </div>
48
                                </div>
49
                            [% ELSE %]
49
                            [% ELSE %]
50
                                <h1>Download list <i>[% shelfname %]</i></h1>
50
                                <h1>Download list <i>[% shelf.shelfname %]</i></h1>
51
                                <form method="post" action="/cgi-bin/koha/opac-downloadshelf.pl">
51
                                <form method="post" action="/cgi-bin/koha/opac-downloadshelf.pl">
52
                                    <fieldset>
52
                                    <fieldset>
53
                                        <select name="format" id="dlformat" required="required">
53
                                        <select name="format" id="dlformat" required="required">
Lines 64-72 Link Here
64
                                    </fieldset>
64
                                    </fieldset>
65
65
66
                                    <fieldset class="action">
66
                                    <fieldset class="action">
67
                                        <input type="hidden" name="shelfid" value="[% shelfid | html %]" />
67
                                        <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
68
                                        <input type="submit" name="save" class="btn" value="Go" />
68
                                        <input type="submit" name="save" class="btn" value="Go" />
69
                                        <a href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfid | html %]" class="cancel close" data-dismiss="modal">Cancel</a>
69
                                        <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | html %]" class="cancel close" data-dismiss="modal">Cancel</a>
70
                                    </fieldset>
70
                                    </fieldset>
71
                                </form>
71
                                </form>
72
                                [% IF ( modal ) %]
72
                                [% IF ( modal ) %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelfform.tt (-3 / +3 lines)
Lines 15-21 Link Here
15
                                <div class="alert alert-success">
15
                                <div class="alert alert-success">
16
                                    <p>The list was sent to: [% email %]</p>
16
                                    <p>The list was sent to: [% email %]</p>
17
                                </div>
17
                                </div>
18
                                <p><a class="focus close" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfid %]">Back to lists</a></p>
18
                                <p><a class="focus close" href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelfid %]">Back to lists</a></p>
19
                            [% END %]
19
                            [% END %]
20
                            [% IF ( error ) %]
20
                            [% IF ( error ) %]
21
                                <div class="alert">
21
                                <div class="alert">
Lines 27-33 Link Here
27
                                <div class="alert">
27
                                <div class="alert">
28
                                    <p>You do not have permission to send this list.</p>
28
                                    <p>You do not have permission to send this list.</p>
29
                                </div>
29
                                </div>
30
                                <p><a class="button close" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfid %]">Back to lists</a></p>
30
                                <p><a class="button close" href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelfid %]">Back to lists</a></p>
31
                            [% ELSE %]
31
                            [% ELSE %]
32
                                <h1>Sending your list</h1>
32
                                <h1>Sending your list</h1>
33
                                <form action="[% url %]" method="post" id="sendshelfform">
33
                                <form action="[% url %]" method="post" id="sendshelfform">
Lines 42-48 Link Here
42
                                    </fieldset>
42
                                    </fieldset>
43
                                    <fieldset class="action">
43
                                    <fieldset class="action">
44
                                        <input type="submit" value="Send" class="btn" />
44
                                        <input type="submit" value="Send" class="btn" />
45
                                        <a class="cancel close" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfid %]">Cancel</a>
45
                                        <a class="cancel close" href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelfid %]">Cancel</a>
46
                                    </fieldset>
46
                                    </fieldset>
47
                                </form>
47
                                </form>
48
48
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shareshelf.tt (-3 / +3 lines)
Lines 41-47 Link Here
41
        [% IF errcode==6 %]<div class="alert">Sorry, but you did not enter a valid email address.</div>[% END %]
41
        [% IF errcode==6 %]<div class="alert">Sorry, but you did not enter a valid email address.</div>[% END %]
42
        [% IF errcode==7 %]<div class="alert">Sorry, but we could not accept this key. The invitation may have expired. Contact the patron who sent you the invitation.</div>[% END %]
42
        [% IF errcode==7 %]<div class="alert">Sorry, but we could not accept this key. The invitation may have expired. Contact the patron who sent you the invitation.</div>[% END %]
43
        [% IF errcode==8 %]<div class="alert">As owner of a list you cannot accept an invitation for sharing it.</div>[% END %]
43
        [% IF errcode==8 %]<div class="alert">As owner of a list you cannot accept an invitation for sharing it.</div>[% END %]
44
        <p><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Return to your lists</a></p>
44
        <p><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;category=1">Return to your lists</a></p>
45
45
46
    [% ELSIF op=='invite' %]
46
    [% ELSIF op=='invite' %]
47
        <div id="invite">
47
        <div id="invite">
Lines 59-65 Link Here
59
        </fieldset>
59
        </fieldset>
60
        <fieldset class="action">
60
        <fieldset class="action">
61
            <input type="submit" value="Send" class="btn" />
61
            <input type="submit" value="Send" class="btn" />
62
            <a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves" class="cancel">Cancel</a>
62
            <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;category=1" class="cancel">Cancel</a>
63
        </fieldset>
63
        </fieldset>
64
        </form>
64
        </form>
65
        </div>
65
        </div>
Lines 75-81 Link Here
75
        [% IF approvedaddress %]
75
        [% IF approvedaddress %]
76
        <p>You will receive an email notification if someone accepts your share within two weeks.</p>
76
        <p>You will receive an email notification if someone accepts your share within two weeks.</p>
77
        [% END %]
77
        [% END %]
78
        <p><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Return to your lists</a></p>
78
        <p><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;category=1">Return to your lists</a></p>
79
        </div>
79
        </div>
80
80
81
    [% ELSIF op=='accept' %]
81
    [% ELSIF op=='accept' %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves-rss.tt (-3 / +3 lines)
Lines 3-11 Link Here
3
<rss version="2.0">
3
<rss version="2.0">
4
4
5
<channel>
5
<channel>
6
 <title>[% shelfname %]</title>
6
 <title>[% shelf.shelfname %]</title>
7
 <link>[% OPACBaseURL %]/cgi-bin/koha/opac-shelves.pl?rss=1&amp;viewshelf=[% shelfnumber %]</link>
7
 <link>[% OPACBaseURL %]/cgi-bin/koha/opac-shelves.pl?rss=1&amp;viewshelf=[% shelf.shelfnumber %]</link>
8
 <description>RSS feed for public list [% shelfname | html %]</description>
8
 <description>RSS feed for public list [% shelf.shelfname | html %]</description>
9
9
10
[% FOREACH i IN itemsloop %]
10
[% FOREACH i IN itemsloop %]
11
 <item>
11
 <item>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (-368 / +270 lines)
Lines 1-9 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %]
2
[% SET PRIVATE = 1 %]
3
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %]
3
[% SET PUBLIC = 2 %]
4
[% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && Koha.Preference('TagsShowOnList') ) %]
5
[% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && Koha.Preference('TagsInputOnList') ) %]
4
6
5
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
6
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;   [% IF ( viewshelf ) %]Contents of [% shelfname |html %][% ELSE %]Your lists[% END %]</title>[% INCLUDE 'doc-head-close.inc' %]
8
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;   [% IF op == 'view' %]Contents of [% shelf.shelfname |html %][% ELSE %]Your lists[% END %]</title>[% INCLUDE 'doc-head-close.inc' %]
7
[% BLOCK cssinclude %][% END %]
9
[% BLOCK cssinclude %][% END %]
8
</head>
10
</head>
9
[% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-userlists' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-lists' bodyclass='scrollto' %][% END %]
11
[% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-userlists' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-lists' bodyclass='scrollto' %][% END %]
Lines 12-46 Link Here
12
    <li>
14
    <li>
13
        <label for="allow_add">Permissions: </label>
15
        <label for="allow_add">Permissions: </label>
14
        <select name="allow_add" id="allow_add">
16
        <select name="allow_add" id="allow_add">
15
            [% IF allow_add %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
17
            [% IF shelf.allow_add %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
16
            [% IF allow_add %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
18
            [% IF shelf.allow_add %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
17
        </select>
19
        </select>
18
        &nbsp;<span>anyone else to add entries. (The owner of a list is always allowed to add entries, but needs permission to remove.)</span>
20
        &nbsp;<span>anyone else to add entries. (The owner of a list is always allowed to add entries, but needs permission to remove.)</span>
19
    </li>
21
    </li>
20
    <li>
22
    <li>
21
        <label>&nbsp;</label>
23
        <label>&nbsp;</label>
22
        <select name="allow_delete_own" id="allow_delete_own">
24
        <select name="allow_delete_own" id="allow_delete_own">
23
            [% IF allow_delete_own %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
25
            [% IF shelf.allow_delete_own %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
24
            [% IF allow_delete_own %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
26
            [% IF shelf.allow_delete_own %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
25
        </select>
27
        </select>
26
        &nbsp;<span>anyone to remove his own contributed entries.</span>
28
        &nbsp;<span>anyone to remove his own contributed entries.</span>
27
    </li>
29
    </li>
28
    <li>
30
    <li>
29
        <label>&nbsp;</label>
31
        <label>&nbsp;</label>
30
        <select name="allow_delete_other" id="allow_delete_other">
32
        <select name="allow_delete_other" id="allow_delete_other">
31
            [% IF allow_delete_other %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
33
            [% IF shelf.allow_delete_other %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
32
            [% IF allow_delete_other %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
34
            [% IF shelf.allow_delete_other %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
33
        </select>
35
        </select>
34
        &nbsp;<span>anyone to remove other contributed entries.</span>
36
        &nbsp;<span>anyone to remove other contributed entries.</span>
35
    </li>
37
    </li>
36
[% END %]
38
[% END %]
37
[% BLOCK remove_share %]
38
    [%# Use: add parameter shelfnumber and add end form tag %]
39
    <form action="opac-shelves.pl" method="post" class="form-inline">
40
        <input type="hidden" name="shelves" value="1" />
41
        <input type="hidden" name="display" value="privateshelves" />
42
        <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_REMOVE_SHARE);" value="Remove share" />
43
[% END %]
44
39
45
[% INCLUDE 'masthead.inc' %]
40
[% INCLUDE 'masthead.inc' %]
46
<div class="main">
41
<div class="main">
Lines 50-91 Link Here
50
            <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>
45
            <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>
51
        [% END %]
46
        [% END %]
52
47
53
        [% IF ( category1 ) %]
48
        [% IF op != 'list' %]
54
            [% IF ( viewshelf || edit ) %]
49
            <li><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a></li>
55
                <li><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your lists</a></li>
50
        [% ELSE %]
56
            [% ELSE %]
51
            <li>Lists</li>
57
                <li>Your lists</li>
52
        [% END %]
58
            [% END %]
53
59
        [% ELSIF ( category2 ) %]
54
        [% IF shelf and shelf.category == PRIVATE %]
60
            [% IF ( viewshelf || edit ) %]
55
            [% IF op == 'view' OR op == 'edit_form' %]
61
                <li><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
56
                <li><span class="divider">&rsaquo;</span> <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE %]">Your lists</a></li>
62
            [% ELSE %]
63
                <li>Public lists</li>
64
            [% END %]
65
        [% ELSIF ( showprivateshelves ) %]
66
            [% IF ( viewshelf || edit ) %]
67
                <li><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your lists</a></li>
68
            [% ELSE %]
57
            [% ELSE %]
69
                <li>Your lists</li>
58
                <li><span class="divider">&rsaquo;</span> Your lists</li>
70
            [% END %]
59
            [% END %]
71
        [% ELSIF ( showpublicshelves ) %]
60
        [% ELSIF shelf AND shelf.category == PUBLIC %]
72
            [% IF ( viewshelf || edit || shelves ) %]
61
            [% IF op == 'view' %]
73
                <li><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
62
                <li><span class="divider">&rsaquo;</span> <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PUBLIC %]">Public lists</a></li>
74
            [% ELSE %]
63
            [% ELSE %]
75
                <li>Public lists</li>
64
                <li><span class="divider">&rsaquo;</span> Public lists</li>
76
            [% END %]
65
            [% END %]
77
        [% END %]
66
        [% END %]
78
67
79
        [% IF ( viewshelf ) %]
68
        [% IF op == 'view' %]
80
            <li><span class="divider">&rsaquo;</span> Contents of <i>[% shelfname | html %]</i></li>
69
            <li><span class="divider">&rsaquo;</span> Contents of <i>[% shelf.shelfname | html %]</i></li>
81
        [% END %]
70
        [% END %]
82
71
83
        [% IF ( shelves ) %]
72
        [% IF op == 'add_form' %]
84
            <li><span class="divider">&rsaquo;</span> Create new list</li>
73
            <li><span class="divider">&rsaquo;</span> Create new list</li>
85
        [% END %]
74
        [% END %]
86
75
87
        [% IF ( edit ) %]
76
        [% IF op == 'edit_form' %]
88
            <li><span class="divider">&rsaquo;</span> Edit list <i>[% shelfname | html %]</i></li>
77
            <li><span class="divider">&rsaquo;</span> Edit list <i>[% shelf.shelfname | html %]</i></li>
89
        [% END %]
78
        [% END %]
90
79
91
    </ul> <!-- / .breadcrumb -->
80
    </ul> <!-- / .breadcrumb -->
Lines 107-158 Link Here
107
            [% END %]
96
            [% END %]
108
                <div id="usershelves" class="maincontent">
97
                <div id="usershelves" class="maincontent">
109
98
110
                    [% IF ( paramsloop ) %]
99
                [% FOR m IN messages %]
111
                        [% FOREACH paramsloo IN paramsloop %]
100
                    [% SWITCH m.type %]
112
                            [% IF ( paramsloo.status ) %]<div class="alert">[% paramsloo.string %]</div>[% END %]
101
                        [% CASE 'message' %]
113
                            [% IF ( paramsloo.nobarcode ) %]<div class="alert">ERROR: No barcode given.</div>[% END %]
102
                            <div class="alert alert-success" role="alert">
114
                            [% IF ( paramsloo.noshelfnumber ) %]<div class="alert">ERROR: No shelfnumber given.</div>[% END %]
103
                        [% CASE 'error' %]
115
                            [% IF ( paramsloo.need_confirm ) %]
104
                            <div class="alert alert-danger" role="alert">
116
                              <div class="alert">
105
                    [% END %]
117
                                The list <i>[% paramsloo.need_confirm %]</i> is not empty.
106
                    [% SWITCH m.code %]
118
                                <br />It has <b>[% paramsloo.count %]</b> [% IF paramsloo.count == 1 %]entry[% ELSE %]entries[% END %].
107
                    [% CASE 'error_on_update' %]
119
                                <br />Use the "Confirm" button below to confirm deletion.
108
                        An error occurred when updating this list. Perhaps the value already exists.
120
                             </div>
109
                    [% CASE 'error_on_insert' %]
121
                            [% END %]
110
                        An error occurred when inserting this list. Perhaps the name already exists.
122
                            [% IF ( paramsloo.nopermission ) %]
111
                    [% CASE 'error_on_delete' %]
123
                              <div class="alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission |html%].</div>
112
                        An error occurred when deleteing this list. Check the logs.
124
                            [% END %]
113
                    [% CASE 'error_on_add_biblio' %]
125
                            [% IF ( paramsloo.failgetitem ) %]
114
                        The item has not been added to the list. Please check it's not in this list yet.
126
                              <div class="alert">ERROR: No item found with barcode [% paramsloo.failgetitem %].</div>
115
                    [% CASE 'error_on_remove_share' %]
127
                            [% END %]
116
                        The share has not been removed.
128
                            [% IF ( paramsloo.duplicatebiblio ) %]
117
                    [% CASE 'success_on_update' %]
129
                              <div class="alert">A record matching barcode <b>[% paramsloo.duplicatebiblio %]</b> has already been added.</div>
118
                        List updated with success.
130
                            [% END %]
119
                    [% CASE 'success_on_insert' %]
131
                            [% IF ( paramsloo.delete_ok ) %]
120
                        List inserted with success.
132
                              <div class="alert alert-info">List [% paramsloo.delete_ok |html %] Deleted.</div>
121
                    [% CASE 'success_on_delete' %]
133
                            [% END %]
122
                        List deleted with success.
134
                            [% IF ( paramsloo.delete_fail ) %]
123
                    [% CASE 'success_on_add_biblio' %]
135
                              <div class="alert alert-info">ERROR: Database error. Delete (list number [% paramsloo.delete_fail |html %]) failed.</div>
124
                        The item has been added to the list.
136
                            [% END %]
125
                    [% CASE 'success_on_remove_biblios' %]
137
                            [% IF ( paramsloo.unrecognized ) %]
126
                        The item has been removed from the list.
138
                              <div class="alert alert-info">ERROR: List number [% paramsloo.unrecognized %] unrecognized.</div>
127
                    [% CASE 'success_on_remove_share' %]
139
                            [% END %]
128
                        The share has been removed.
140
                            [% IF ( paramsloo.modifyfailure) %]
129
                    [% CASE 'does_not_exist' %]
141
                              <div class="alert alert-info">ERROR: Shelf could not be renamed to [% paramsloo.modifyfailure %]. This name may not be unique for this type of list. Please check.</div>
130
                        This list does not exist.
142
                            [% END %]
131
                    [% CASE 'item_does_not_exist' %]
143
                            [% IF ( paramsloo.nothingdeleted) %]
132
                        This item does not exist.
144
                              <div class="alert alert-info">Warning: You could not delete any selected items from this shelf.</div>
133
                    [% CASE 'unauthorized_on_view' %]
145
                            [% END %]
134
                        You do not have permission to view this list.
146
                            [% IF ( paramsloo.somedeleted) %]
135
                    [% CASE 'unauthorized_on_update' %]
147
                              <div class="alert alert-info">Warning: You could not delete all selected items from this shelf.</div>
136
                        You do not have permission to update this list.
148
                            [% END %]
137
                    [% CASE 'unauthorized_on_delete' %]
149
                        [% END # / FOREACH paramsloop %]
138
                        You do not have permission to delete this list.
150
                    [% END # / IF paramsloop %]
139
                    [% CASE 'unauthorized_on_add_biblio' %]
140
                        You do not have permission to add a biblio to this list.
141
                    [% CASE 'no_biblio_removed' %]
142
                        No biblio has been removed.
143
                    [% CASE 'Koha::Exceptions::Virtualshelves::DuplicateObject' %]
144
                        An error occurred when inserting this list. The name already [% shelfname %] exists.
145
                    [% CASE 'DBIx::Class::Exception' %]
146
                        [% m.msg %]
147
                    [% CASE %]
148
                        [% m.code %]
149
                        [% m.msg %]
150
                    [% END %]
151
                    </div>
152
                [% END %]
151
153
152
                    [% IF ( viewshelf ) %]<!--  Viewing a particular shelf -->
154
                    [% IF op == 'view' %]
153
                        <h3>
155
                        <h3>
154
                            [% shelfname |html %]
156
                            [% shelf.shelfname |html %]
155
                            <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-shelves.pl?rss=1&amp;viewshelf=[% shelfnumber %]" class="rss-list-link noprint">
157
                            <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-shelves.pl?rss=1&amp;op=view&amp;shelfnumber=[% shelf.shelfnumber %]" class="rss-list-link noprint">
156
                                <img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png" alt="Subscribe to this list" title="Subscribe to this list" border="0" class="rsssearchicon"/>
158
                                <img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png" alt="Subscribe to this list" title="Subscribe to this list" border="0" class="rsssearchicon"/>
157
                            </a>
159
                            </a>
158
                        </h3>
160
                        </h3>
Lines 160-227 Link Here
160
                        [% IF ( itemsloop ) %]
162
                        [% IF ( itemsloop ) %]
161
                            <div id="toolbar" class="toolbar clearfix">
163
                            <div id="toolbar" class="toolbar clearfix">
162
                                <div class="list-actions">
164
                                <div class="list-actions">
163
                                    <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a> <span class="sep">|</span>
165
                                    <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form">New list</a> <span class="sep">|</span>
164
                                    <a href="/cgi-bin/koha/opac-downloadshelf.pl?shelfid=[% shelfnumber | html %]&amp;showprivateshelves=[% showprivateshelves | html %]" class="download" data-toggle="modal" data-target="#modalWin">Download list</a>
166
                                    <a href="/cgi-bin/koha/opac-downloadshelf.pl?shelfnumber=[% shelf.shelfnumber | html %]" class="download" data-toggle="modal" data-target="#modalWin">Download list</a>
165
167
166
                                    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
168
                                    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
167
                                        <span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber | html %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); return false; ">Send list</a></span>
169
                                        <span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber | html %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); return false; ">Send list</a></span>
168
                                    [% END %]
170
                                    [% END %]
169
171
170
                                    <a class="print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfnumber %]&sort=[% sort %]&direction=[% direction |uri %]&print=1">Print list</a>
172
                                    <a class="print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]&sortfield=[% sortfield %]&direction=[% direction |uri %]&print=1">Print list</a>
171
173
172
                                    [% IF ( manageshelf ) %]
174
                                    [% IF can_manage_shelf %]
173
                                        <span class="sep">|</span>
175
                                        <span class="sep">|</span>
174
                                        <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
176
                                        <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
175
                                            <input type="hidden" name="op" value="modif" />
177
                                            <input type="hidden" name="op" value="edit_form" />
176
                                            <input type="hidden" name="display" value="viewshelf" />
178
                                            <input type='hidden' name='category' value='[% category %]' />
177
                                            <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
179
                                            <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
178
                                            <input type="submit" class="editshelf" value="Edit list" />
180
                                            <input type="submit" class="editshelf" value="Edit list" />
179
                                        </form>
181
                                        </form>
180
182
181
                                        <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
183
                                        <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
182
                                            <input type="hidden" value="1" name="shelves"/>
184
                                            <input type="hidden" name="op" value="delete" />
183
                                            <input type="hidden" value="1" name="DEL-[% shelfnumber | html %]"/>
185
                                            <input type='hidden' name='category' value='[% category %]' />
184
                                            [% IF ( showprivateshelves ) %]
186
                                            <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
185
                                                <input type="hidden" name="display" value="privateshelves"/>
186
                                            [% END %]
187
                                            <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
187
                                            <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
188
                                        </form>
188
                                        </form>
189
                                        [% IF showprivateshelves && Koha.Preference('OpacAllowSharingPrivateLists') %]
189
                                        [% IF category == PRIVATE && Koha.Preference('OpacAllowSharingPrivateLists') %]
190
                                            <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelfnumber | html %]" class="">Share list</a>
190
                                            <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelf.shelfnumber | html %]" class="">Share list</a>
191
                                        [% END %]
191
                                        [% END %]
192
                                    [% ELSIF showprivateshelves # not manageshelf and private means shared %]
192
                                    [% ELSIF category == PRIVATE # not manageshelf and private means shared %]
193
                                        [% INCLUDE remove_share %]
193
                                        <form action="/cgi-bin/koha/opac-shelves.pl" method="post" class="form-inline">
194
                                            <input type="hidden" name="REMSHR-[% shelfnumber | html %]" value="1" />
194
                                            <input type="hidden" name="op" value="remove_share" />
195
                                            <input type='hidden' name='category' value='[% category %]' />
196
                                            <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
197
                                            <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_REMOVE_SHARE);" value="Remove share" />
195
                                        </form>
198
                                        </form>
196
                                    [% END # / IF manageshelf %]
199
                                    [% END %]
197
                                </div>
200
                                </div>
198
201
199
                                <form action="/cgi-bin/koha/opac-shelves.pl" id="sorting-form" class="form-inline sort_by pull-right">
202
                                <form action="/cgi-bin/koha/opac-shelves.pl" id="sorting-form" class="form-inline sort_by pull-right">
200
                                    <input type="hidden" name="viewshelf" value="[% shelfnumber | html %]" />
203
                                    <input type="hidden" name="op" value="view" />
204
                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
201
205
202
                                    <label for="sort">Sort by: </label>
206
                                    <label for="sortfield">Sort by: </label>
203
                                    <select name="sort" id="sort" class="resort" onchange="$('#sorting-form').submit()">
207
                                    <select name="sortfield" id="sortfield" class="resort" onchange="$('#sorting-form').submit()">
204
                                        <option value="">Default sorting</option>
208
                                        <option value="">Default sorting</option>
205
209
206
                                        [% IF sort == 'author' %]
210
                                        [% IF sortfield == 'author' %]
207
                                            <option value="author" selected="selected">Author</option>
211
                                            <option value="author" selected="selected">Author</option>
208
                                        [% ELSE %]
212
                                        [% ELSE %]
209
                                            <option value="author">Author</option>
213
                                            <option value="author">Author</option>
210
                                        [% END %]
214
                                        [% END %]
211
215
212
                                        [% IF sort == 'title' %]
216
                                        [% IF sortfield == 'title' %]
213
                                            <option value="title" selected="selected">Title</option>
217
                                            <option value="title" selected="selected">Title</option>
214
                                        [% ELSE %]
218
                                        [% ELSE %]
215
                                            <option value="title">Title</option>
219
                                            <option value="title">Title</option>
216
                                        [% END %]
220
                                        [% END %]
217
221
218
                                        [% IF sort == 'itemcallnumber' %]
222
                                        [% IF sortfield == 'itemcallnumber' %]
219
                                            <option value="itemcallnumber" selected="selected">Call number</option>
223
                                            <option value="itemcallnumber" selected="selected">Call number</option>
220
                                        [% ELSE %]
224
                                        [% ELSE %]
221
                                            <option value="itemcallnumber">Call number</option>
225
                                            <option value="itemcallnumber">Call number</option>
222
                                        [% END %]
226
                                        [% END %]
223
227
224
                                        [% IF sort == 'copyrightdate' %]
228
                                        [% IF sortfield == 'copyrightdate' %]
225
                                            <option value="copyrightdate" selected="selected">Copyright date</option>
229
                                            <option value="copyrightdate" selected="selected">Copyright date</option>
226
                                        [% ELSE %]
230
                                        [% ELSE %]
227
                                            <option value="copyrightdate">Copyright date</option>
231
                                            <option value="copyrightdate">Copyright date</option>
Lines 265-287 Link Here
265
                                          <a href="#" id="tagsel_cancel">Cancel</a>
269
                                          <a href="#" id="tagsel_cancel">Cancel</a>
266
                                        </span>
270
                                        </span>
267
                                    [% END %]
271
                                    [% END %]
268
                                    [% IF ( loggedinusername && allowremovingitems ) %]
272
                                    [% IF loggedinusername && can_remove_biblios %]
269
                                        <span id="removeitems"></span>
273
                                        <span id="removeitems"></span>
270
                                    [% END %]
274
                                    [% END %]
271
                                </span> <!-- / .links -->
275
                                </span> <!-- / .links -->
272
                            </div> <!-- / #selections-toolbar -->
276
                            </div> <!-- / #selections-toolbar -->
273
277
274
                            <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="myform" class="checkboxed">
278
                            <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="myform" class="checkboxed">
275
                                [% IF ( manageshelf ) %]
279
                                [% IF can_manage_shelf %]
276
                                    <input type="hidden" name="viewshelf" value="[% shelfnumber | html %]" />
280
                                    <input type="hidden" name="op" value="remove_biblios" />
277
                                    <input type="hidden" name="modifyshelfcontents" value="1" />
281
                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
278
                                [% END %]
282
                                [% END %]
279
                                <div class="searchresults">
283
                                <div class="searchresults">
280
                                    <table id="listcontents" class="table">
284
                                    <table id="listcontents" class="table">
281
                                        <tbody>
285
                                        <tbody>
282
                                        [% FOREACH itemsloo IN itemsloop %]
286
                                        [% FOREACH itemsloo IN itemsloop %]
283
                                            <tr>
287
                                            <tr>
284
                                                <td class="select selectcol"><input type="checkbox" class="cb" name="REM-[% itemsloo.biblionumber %]" value="[% itemsloo.biblionumber %]" /></td>
288
                                                <td class="select selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber %]" /></td>
285
                                                [% UNLESS ( item_level_itypes ) %]
289
                                                [% UNLESS ( item_level_itypes ) %]
286
                                                    <td>
290
                                                    <td>
287
                                                        [% UNLESS ( noItemTypeImages ) %]
291
                                                        [% UNLESS ( noItemTypeImages ) %]
Lines 455-462 Link Here
455
                                                            <span class="actions"><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]'); return false;">Save to another list</a></span>
459
                                                            <span class="actions"><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]'); return false;">Save to another list</a></span>
456
                                                        [% END %]
460
                                                        [% END %]
457
461
458
                                                        [% IF ( allowremovingitems ) %]
462
                                                        [% IF can_remove_biblios %]
459
                                                            <span class="actions"><a class="removefromlist hidden" id="REM-[% itemsloo.biblionumber %]" href="#">Remove from this list</a></span>
463
                                                            <span class="actions"><a class="removefromlist" href="/cgi-bin/koha/opac-shelves.pl?op=remove_biblios&amp;shelfnumber=[% shelf.shelfnumber %]&amp;biblionumber=[% itemsloo.biblionumber %]">Remove from this list</a></span>
460
                                                        [% END %]
464
                                                        [% END %]
461
465
462
                                                        [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
466
                                                        [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
Lines 484-508 Link Here
484
                        [% ELSE %]
488
                        [% ELSE %]
485
                            <div id="toolbar" class="toolbar clearfix">
489
                            <div id="toolbar" class="toolbar clearfix">
486
                                <div class="list-actions">
490
                                <div class="list-actions">
487
                                    <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a> <span class="sep"></span>
491
                                    <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form">New list</a> <span class="sep"></span>
488
                                    [% IF ( manageshelf ) %]
492
                                    [% IF can_manage_shelf %]
489
                                        <span class="sep">|</span>
493
                                        <span class="sep">|</span>
490
                                        <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
494
                                        <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
491
                                            <input type="hidden" name="op" value="modif" />
495
                                            <input type="hidden" name="op" value="edit_form" />
492
                                            <input type="hidden" name="display" value="viewshelf" />
496
                                            <input type="hidden" name="category" value="category" />
493
                                            <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
497
                                            <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
494
                                            <input type="submit" class="editshelf" value="Edit list" />
498
                                            <input type="submit" class="editshelf" value="Edit list" />
495
                                        </form>
499
                                        </form>
496
500
497
                                        <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
501
                                        <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
498
                                            <input type="hidden" value="1" name="shelves"/>
502
                                            <input type="hidden" name="op" value="delete" />
499
                                            <input type="hidden" value="1" name="DEL-[% shelfnumber | html  %]"/>
503
                                            <input type="hidden" name="shelfnumber" value="[% shelfnumber | html  %]"/>
500
                                            [% IF ( showprivateshelves ) %]
504
                                            <input type="hidden" name="category" value="category" />
501
                                                <input type="hidden" name="display" value="privateshelves"/>
502
                                            [% END %]
503
                                            <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
505
                                            <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
504
                                        </form>
506
                                        </form>
505
                                    [% END # / IF manageshelf %]
507
                                    [% END %]
506
                                </div> <!-- / .list-actions -->
508
                                </div> <!-- / .list-actions -->
507
                            </div> <!-- / #toolbar -->
509
                            </div> <!-- / #toolbar -->
508
510
Lines 513-809 Link Here
513
                                [% END %]
515
                                [% END %]
514
                            </div>
516
                            </div>
515
                        [% END # / IF itemsloop %]
517
                        [% END # / IF itemsloop %]
516
                    [% END # / IF viewshelf %]
518
                    [% END %]
517
519
518
                    [% IF ( itemsloop && allowremovingitems ) %]
520
                    [% IF itemsloop && can_remove_biblios %]
519
                        <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
521
                        <input type="hidden" name="op" value="view" />
522
                        <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
520
                        <input type="hidden" name="modifyshelfcontents" value="1" />
523
                        <input type="hidden" name="modifyshelfcontents" value="1" />
521
                        <input type="hidden" name="viewshelf" value="[% shelfnumber | html %]" /><input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
524
                        <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
522
                        </form>
525
                        </form>
523
                    [% ELSIF ( !itemsloop && manageshelf ) %]
526
                    [% ELSIF !itemsloop && can_manage_shelf %]
524
                        <form method="post" action="opac-shelves.pl">
527
                        <form method="post" action="opac-shelves.pl">
525
                        <input type="hidden" name="DEL-[% shelfnumber | html %]" value="1" />
528
                        <input type="hidden" name="op" value="delete" />
526
                        <input type="hidden" name="shelves" value="1" />
529
                        <input type="hidden" name="referer" value="list" />
527
                        <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
530
                        <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html  %]"/>
528
                        <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
531
                        <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
529
                        </form>
532
                        </form>
530
                    [% END %]
533
                    [% END %]
531
534
532
                    [% IF ( edit ) %]
535
                    [% IF op == 'add_form' OR op == 'edit_form' %]
533
                        <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
536
                        <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
534
                            <input type="hidden" name="op" value="modifsave" />
535
                            <input type="hidden" name="display" value="[% display |html %]" />
536
                            <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
537
                            <fieldset class="rows">
537
                            <fieldset class="rows">
538
                                <legend>Editing <em>[% shelfname |html %]</em></legend>
538
                                [% IF op == 'add_form' %]
539
                                    <div id="addshelf">
540
                                    <legend>Create a new list</legend>
541
                                    <input type="hidden" name="op" value="add" />
542
                                [% ELSE %]
543
                                    <legend>Editing <em>[% shelf.shelfname |html %]</em></legend>
544
                                    <input type="hidden" name="op" value="edit" />
545
                                    <input type="hidden" name="referer" value="view" />
546
                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
547
                                [% END %]
548
                                <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber %]" />
539
                                <ol>
549
                                <ol>
540
                                    <li><label for="shelfname">List name: </label><input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelfname |html %]" /></li>
550
                                    <li>
551
                                        <label class="required" for="shelfname">List name: </label>
552
                                        <input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname |html %]" /></li>
541
                                    <li>
553
                                    <li>
542
                                        <label for="sortfield" >Sort this list by: </label>
554
                                        <label for="sortfield" >Sort this list by: </label>
543
                                        <select name="sortfield" id="sortfield">
555
                                        <select name="sortfield" id="sortfield">
544
                                            [% IF ( sortfield == "title" ) %]
556
                                            [% IF shelf.sortfield == "title" %]
545
                                                <option value="title" selected="selected">Title</option>
557
                                                <option value="title" selected="selected">Title</option>
546
                                            [% ELSE %]
558
                                            [% ELSE %]
547
                                                <option value="title">Title</option>
559
                                                <option value="title">Title</option>
548
                                            [% END %]
560
                                            [% END %]
549
                                            [% IF ( sortfield == "author" ) %]
561
                                            [% IF shelf.sortfield == "author" %]
550
                                                <option value="author" selected="selected">Author</option>
562
                                                <option value="author" selected="selected">Author</option>
551
                                            [% ELSE %]
563
                                            [% ELSE %]
552
                                                <option value="author">Author</option>
564
                                                <option value="author">Author</option>
553
                                            [% END %]
565
                                            [% END %]
554
                                            [% IF ( sortfield == "copyrightdate" ) %]
566
                                            [% IF shelf.sortfield == "copyrightdate" %]
555
                                                <option value="copyrightdate" selected="selected">Year</option>
567
                                                <option value="copyrightdate" selected="selected">Year</option>
556
                                            [% ELSE %]
568
                                            [% ELSE %]
557
                                                <option value="copyrightdate">Year</option>
569
                                                <option value="copyrightdate">Year</option>
558
                                            [% END %]
570
                                            [% END %]
559
                                            [% IF ( sortfield == "itemcallnumber" ) %]
571
                                            [% IF shelf.sortfield == "itemcallnumber" %]
560
                                                <option value="itemcallnumber" selected="selected">Call number</option>
572
                                                <option value="itemcallnumber" selected="selected">Call number</option>
561
                                            [% ELSE %]
573
                                            [% ELSE %]
562
                                                <option value="itemcallnumber">Call number</option>
574
                                                <option value="itemcallnumber">Call number</option>
563
                                            [% END %]
575
                                            [% END %]
564
                                        </select>
576
                                        </select>
565
                                    </li>
577
                                    </li>
566
                                    [% IF ( OpacAllowPublicListCreation || category2 ) %]
578
                                    [% IF Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
567
                                        <li>
579
                                        <li>
568
                                            <label for="category">Category:</label>
580
                                            <label for="category">Category:</label>
569
                                            <select name="category" id="category">
581
                                            <select name="category" id="category">
570
                                                [% IF ( category1 ) %]
582
                                                [% IF shelf.category == PRIVATE %]
571
                                                        <option value="1" selected="selected">Private</option>
583
                                                        <option value="1" selected="selected">Private</option>
572
                                                    [% ELSE %]
584
                                                    [% ELSE %]
573
                                                        <option value="1">Private</option>
585
                                                        <option value="1">Private</option>
574
                                                    [% END %]
586
                                                    [% END %]
575
                                                [% IF ( category2 ) %]
587
                                                [% IF shelf.category == PUBLIC %]
576
                                                    <option value="2" selected="selected">Public</option>
588
                                                    <option value="2" selected="selected">Public</option>
577
                                                [% ELSE %]
589
                                                [% ELSE %]
578
                                                    <option value="2">Public</option>
590
                                                    <option value="2">Public</option>
579
                                                [% END %]
591
                                                [% END %]
580
                                            </select>
592
                                            </select>
581
                                            [% IF ( category2 && !OpacAllowPublicListCreation ) %]
593
                                            [% IF shelf.category == PUBLIC AND NOT Koha.Preference('OpacAllowPublicListCreation') %]
582
                                                <span class="hint alert alert-info">The library has disabled the ability for patrons to create new public lists.  If you make your list private, you will not be able to make it public again.</span>
594
                                                <span class="hint alert alert-info">The library has disabled the ability for patrons to create new public lists.  If you make your list private, you will not be able to make it public again.</span>
583
                                            [% END %]
595
                                            [% END %]
584
                                        </li>
596
                                        </li>
585
                                        [% INCLUDE list_permissions %]
597
                                        [% INCLUDE list_permissions %]
586
                                    [% END %]
598
                                    [% END %]
587
                                </ol>
599
                                </ol>
588
                                [% UNLESS ( OpacAllowPublicListCreation || category2 ) %]
600
                                [% UNLESS Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
589
                                    <input type="hidden" name="category" value="1" />
601
                                    <input type="hidden" name="category" value="[% PRIVATE %]" />
590
                                [% END %]
602
                                [% END %]
591
                            </fieldset>
603
                            </fieldset>
592
604
593
                            <fieldset class="action">
605
                            <fieldset class="action">
594
                                <input type="submit" value="Save" class="btn" />
606
                                <input type="submit" onclick="Check(this.form); return false;" value="Save" class="btn" />
595
                                [% IF ( showprivateshelves ) %]
607
                                [% IF referer == 'view' %]
596
                                    <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber | html %]&amp;display=privateshelves">Cancel</a>
608
                                    <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]" class="cancel">Cancel</a>
597
                                [% ELSE %]
609
                                [% ELSE %]
598
                                    <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber | html %]">Cancel</a>
610
                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE %]" class="cancel">Cancel</a>
599
                                [% END %]
611
                                 [% END %]
612
600
                            </fieldset>
613
                            </fieldset>
601
                        </form>
614
                        </form>
602
                    [% END # / IF edit %]
603
615
616
                    [% ELSIF op == 'list' %]
617
                        <h2>Lists</h2>
618
                        <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
619
                        <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
620
                            [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
621
                                [% IF category == PRIVATE %]
622
                                    <li id="privateshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=listamp;category=[% PRIVATE %]">Your lists</a></li>
623
                                [% ELSE %]
624
                                    <li id="privateshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE %]">Your lists</a></li>
625
                                [% END %]
626
                            [% END %]
627
                            [% IF category == PUBLIC %]
628
                                <li id="publicshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PUBLIC %]">Public lists</a></li>
629
                            [% ELSE %]
630
                                <li id="publicshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PUBLIC %]">Public lists</a></li>
631
                            [% END %]
632
                        </ul>
604
633
605
                    [% UNLESS ( edit ) %]
634
                        [% IF category == PRIVATE %]
606
                        [% UNLESS ( viewshelf ) %]
635
                            <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
607
                            [% UNLESS ( shelves ) %]
636
                        [% ELSE %]
608
                                <h2>Lists</h2>
637
                            <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
609
                                <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
638
                        [% END %]
610
                                <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
639
611
                                    [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
640
                            <div id="toolbar" class="toolbar"><a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form">New list</a></div>
612
                                        [% IF ( showprivateshelves ) %]
641
                            [% IF shelves %]
613
                                            <li id="privateshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your lists</a></li>
642
                                <table class="table">
614
                                        [% ELSE %]
643
                                    <thead>
615
                                            <li id="privateshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your lists</a></li>
644
                                        <tr>
616
                                        [% END %]
645
                                            <th>List name</th>
617
                                    [% END %]
646
                                            <th>Contents</th>
618
                                    [% IF ( showpublicshelves ) %]
647
                                            <th>Type</th>
619
                                        <li id="publicshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
648
                                            <th>&nbsp;</th>
620
                                    [% ELSE %]
649
                                        </tr>
621
                                        <li id="publicshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
650
                                    </thead>
622
                                    [% END %]
651
                                    <tbody>
623
                                </ul>
652
                                        [% FOREACH s IN shelves %]
624
653
                                            [% SET contents = s.get_contents %]
625
                                [% IF ( showprivateshelves ) %]
654
                                            <tr>
626
                                        <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
655
                                                <td><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber %]">[% s.shelfname |html %]</a></td>
627
656
                                                <td>[% IF contents.count %][% contents.count %] [% IF contents.count == 1 %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
628
                                        [% IF ( loggedinusername ) %]
657
                                                <td>
629
                                            <div id="toolbar" class="toolbar"><a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a></div>
658
                                                    [% IF s.category == PRIVATE %]
630
                                            [% IF ( showprivateshelves ) %]
659
                                                        [% IF s.is_shared %]Shared[% ELSE %]Private[% END %]
631
                                                [% IF ( shelveslooppriv ) %]
660
                                                    [% ELSE %]
632
                                                    <table class="table">
661
                                                        Public
633
                                                        <thead>
662
                                                    [% END %]
634
                                                            <tr>
663
                                                </td>
635
                                                                <th>List name</th>
664
                                                <td>
636
                                                                <th>Contents</th>
665
                                                    [% IF s.can_be_managed( loggedinusernumber ) %]
637
                                                                <th>Type</th>
666
                                                        <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
638
                                                                <th>&nbsp;</th>
667
                                                            <input type="hidden" name="shelfnumber" value="[% s.shelfnumber |html %]" />
639
                                                            </tr>
668
                                                            <input type="hidden" name="category" value="[% s.category %]" />
640
                                                        </thead>
669
                                                            <input type="hidden" name="op" value="edit_form" />
641
                                                        <tbody>
670
                                                            <input type="hidden" name="referer" value="list" />
642
                                                            [% FOREACH shelveslooppri IN shelveslooppriv %]
671
                                                            <input type="submit" class="editshelf" value="Edit" />
643
                                                                <tr>
672
                                                        </form>
644
                                                                    <td><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves&amp;viewshelf=[% shelveslooppri.shelf %]&amp;sortfield=[% shelveslooppri.sortfield %]">[% shelveslooppri.shelfname |html %]</a></td>
673
                                                    [% END %]
645
                                                                    <td>[% IF ( shelveslooppri.count ) %][% shelveslooppri.count %] [% IF shelveslooppri.count == 1 %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
674
                                                    [% IF s.can_be_deleted( loggedinusernumber ) %]
646
                                                                    <td>
675
                                                        <form action="/cgi-bin/koha/opac-shelves.pl" method="post" class="form-inline">
647
                                                                        [% IF ( shelveslooppri.viewcategory1 ) %][% IF !shelveslooppri.shares %]Private[% ELSE %]Shared[% END %][% END %]
676
                                                            <input type="hidden" name="op" value="delete" />
648
                                                                    </td>
677
                                                            <input type="hidden" name="referer" value="list" />
649
                                                                    <td>
678
                                                            <input type='hidden' name='category' value='[% category %]' />
650
                                                                        [% IF ( shelveslooppri.mine ) %]
679
                                                            <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
651
                                                                        <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
680
                                                            <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
652
                                                                            <input type="hidden" name="shelfnumber" value="[% shelveslooppri.shelf |html %]" />
681
                                                        </form>
653
                                                                            <input type="hidden" name="display" value="privateshelves" />
682
                                                    [% END %]
654
                                                                            <input type="hidden" name="op" value="modif" />
683
                                                    [% IF s.category == PRIVATE AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %]
655
                                                                            <input type="submit" class="editshelf" value="Edit" />
684
                                                        <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% s.shelfnumber |html %]" class="">Share</a>
656
                                                                        </form>
685
                                                    [% END %]
657
                                                                        <form action="opac-shelves.pl" method="post" class="form-inline">
686
                                                    [% IF s.is_shared_with( loggedinusernumber ) %]
658
                                                                            <input type="hidden" name="shelves" value="1" />
687
                                                        <form action="opac-shelves.pl" method="post" class="form-inline">
659
                                                                            <input type="hidden" name="display" value="privateshelves" />
688
                                                            <input type="hidden" name="op" value="remove_share" />
660
                                                                            <input type="hidden" name="DEL-[% shelveslooppri.shelf |html %]" value="1" />
689
                                                            <input type="hidden" name="referer" value="list" />
661
                                                                            <input type="hidden" name="shelfoff" value="[% shelfoff |html %]" />
690
                                                            <input type='hidden' name='category' value='[% category %]' />
662
                                                                            [% IF ( shelveslooppri.confirm ) %]
691
                                                            <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
663
                                                                                <input type="hidden" name="CONFIRM-[% shelveslooppri.confirm |html %]" value="1" />
692
                                                            <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_REMOVE_SHARE);" value="Remove share" />
664
                                                                                <input type="submit" class="btn btn-danger confirm" value="Confirm" />
693
                                                        </form>
665
                                                                            [% ELSE %]
694
                                                    [% END %]&nbsp;
666
                                                                                <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
695
                                                </td>
667
                                                                            [% END %]
696
                                            </tr>
668
                                                                        </form>
669
                                                                            [% IF Koha.Preference('OpacAllowSharingPrivateLists') %]
670
                                                                                <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelveslooppri.shelf |html %]" class="">Share</a>
671
                                                                            [% END %]
672
                                                                        [% ELSE # not shelveslooppri.mine, so shared %]
673
                                                                            [% INCLUDE remove_share  # if pref is off, you should still be able to remove shares %]
674
                                                                            <input type="hidden" name="shelfoff" value="[% shelfoff |html %]" />
675
                                                                            <input type="hidden" name="REMSHR-[% shelveslooppri.shelf |html %]" value="1" />
676
                                                                            </form>
677
                                                                        [% END %]&nbsp;
678
                                                                    </td>
679
                                                                </tr>
680
                                                            [% END # / FOREACH shelveslooppri %]
681
                                                        </tbody>
682
                                                    </table>
683
                                                    <div class="pages">[% pagination_bar %]</div>
684
                                                [% ELSE %]
685
                                                    <p>No private lists.</p>
686
                                                [% END # / IF shelveslooppriv %]
687
                                            [% END # / IF showprivateshelves %]
688
                                        [% ELSE %]
689
                                            [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
690
                                                <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
691
                                            [% END %]
692
                                        [% END  # IF loggedinusername %]
693
                                    </div><!-- / #privateshelves -->
694
                                [% END # / IF showprivateshelves %]
695
                                [% IF ( showpublicshelves ) %]
696
                                    <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
697
698
                                    [% IF ( loggedinusername ) %]
699
                                        <div id="toolbar" class="toolbar"> <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a></div>
700
                                    [% ELSE %]
701
                                        [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
702
                                            <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
703
                                        [% END %]
704
                                    [% END # / IF loggedinusername %]
705
706
                                    [% IF ( shelvesloop ) %]
707
                                        <table class="table">
708
                                            <thead>
709
                                                <tr>
710
                                                    <th>List name</th>
711
                                                    <th>Contents</th>
712
                                                    <th>Type</th><th>&nbsp;</th>
713
                                                </tr>
714
                                            </thead>
715
                                            <tbody>
716
                                                [% FOREACH shelvesloo IN shelvesloop %]
717
                                                    <tr>
718
                                                        <td><a class="title" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelvesloo.shelf %]&amp;sortfield=[% shelvesloo.sortfield %]">[% shelvesloo.shelfname |html %]</a></td>
719
                                                        <td>[% shelvesloo.count %] [% IF shelvesloo.count == 1 %]item[% ELSE %]item(s)[% END %]</td>
720
                                                        <td>
721
                                                            [% IF ( shelvesloo.viewcategory2 ) %]Public[% END %]
722
                                                        </td>
723
                                                        <td>
724
                                                            [% IF ( shelvesloo.mine ) %]
725
                                                                <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
726
                                                                    <input type="hidden" name="shelfnumber" value="[% shelvesloo.shelf %]" />
727
                                                                    <input type="hidden" name="op" value="modif" />
728
                                                                    <input type="hidden" name="display" value="publicshelves" />
729
                                                                    <input type="submit" class="editshelf" value="Edit" />
730
                                                                </form>
731
                                                                <form action="opac-shelves.pl" method="post" class="form-inline">
732
                                                                    <input type="hidden" name="shelves" value="1" />
733
                                                                    <input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
734
                                                                    [% IF ( shelvesloo.confirm ) %]
735
                                                                        <input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" />
736
                                                                        <input type="submit" class="btn btn-danger confirm" value="Confirm" />
737
                                                                    [% ELSE %]
738
                                                                        <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
739
                                                                    [% END %]
740
                                                                </form>
741
                                                            [% END %]&nbsp;
742
                                                        </td>
743
                                                    </tr>
744
                                                [% END # / FOREACH shelvesloop %]
745
                                            </tbody>
746
                                        </table>
747
                                        [% IF ( pagination_bar ) %]<div class="pages">[% pagination_bar %]</div>[% END %]
748
                                    [% ELSE %]
749
                                        [% IF ( showpublicshelves ) %]<p>No public lists.</p>[% END %]
750
                                    [% END # / IF shelvesloop %]
751
752
                                    </div><!-- / # publicshelves -->
753
                                [% END # / IF showprivateshelves %]
754
                                </div> <!-- / .ui-tabs-panel -->
755
                            [% END # / UNLESS shelves %]
756
                        [% END # / UNLESS viewshelf %]
757
                    [% END # / UNLESS edit %]
758
759
                    [% IF ( shelves ) %]
760
                        <div id="addshelf">
761
                            <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
762
                                <fieldset class="rows">
763
                                    <legend>Create a new list</legend>
764
                                    <input type="hidden" name="shelves" value="1" />
765
                                    <ol>
766
                                        <li>
767
                                            <label class="required" for="addshelf">List name:</label>
768
                                            [% IF shelfname %]
769
                                              <input id="addshelf" type="text" name="addshelf" value="[% shelfname %]" maxlength="255" class="input-fluid" />
770
                                            [% ELSE %]
771
                                              <input id="addshelf" type="text" name="addshelf" maxlength="255" class="input-fluid" />
772
                                            [% END %]
773
                                            <input type="hidden" name="owner" id="owner" value="[% loggedinuser %]" />
774
                                        </li>
775
                                        <li>
776
                                            <label for="sortfield" >Sort this list by: </label>
777
                                            <select name="sortfield" id="sortfield">
778
                                              <option value="title">Title</option>
779
                                              <option value="author">Author</option>
780
                                              <option value="copyrightdate">Year</option>
781
                                              <option value="itemcallnumber">Call number</option>
782
                                            </select>
783
                                        </li>
784
                                        [% IF (OpacAllowPublicListCreation) %]
785
                                            <li>
786
                                                <label for="category">Category:</label>
787
                                                <select name="category" id="category">
788
                                                    <option value="1">Private</option>
789
                                                    <option value="2">Public</option>
790
                                                </select>
791
                                            </li>
792
                                            [% INCLUDE list_permissions %]
793
                                        [% END %]
697
                                        [% END %]
794
                                    </ol>
698
                                    </tbody>
795
                                    [% UNLESS (OpacAllowPublicListCreation) %]
699
                                </table>
796
                                        <input type="hidden" name="category" value="1" />
700
                                <div class="pages">[% pagination_bar %]</div>
797
                                    [% END %]
701
                            [% ELSE %]
798
                                </fieldset>
702
                                [% IF category == PUBLIC %]
799
                                <fieldset class="action">
703
                                    <p>No public lists.</p>
800
                                    <input type="submit" onclick="Check(this.form); return false;" value="Save" class="btn" />
704
                                [% ELSE %]
801
                                    <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl">Cancel</a>
705
                                    <p>No private lists.</p>
802
                                </fieldset>
706
                                [% END %]
803
                            </form>
707
                            [% END %]
804
                        </div> <!-- / #addshelf -->
708
                            <div> [%# privateshelves or publicshelves %]
805
                    [% END # / IF shelves %]
709
                            </div> [%# <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all"> %]
806
710
                        [% ELSIF NOT loggedinusernumber %]
711
                            [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
712
                                <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
713
                            [% END %]
714
                        [% END  # IF loggedinusername %]
807
                </div> <!-- / #usershelves -->
715
                </div> <!-- / #usershelves -->
808
                </div> <!-- / .span10/12 -->
716
                </div> <!-- / .span10/12 -->
809
      </div> <!-- / .row-fluid -->
717
      </div> <!-- / .row-fluid -->
Lines 987-1001 $(function() { Link Here
987
        });
895
        });
988
    [% END %]
896
    [% END %]
989
897
990
    [% IF ( loggedinusername && allowremovingitems ) %]
898
    [% IF loggedinusername && can_remove_biblios %]
991
        var removeFromListLinks = $(".removefromlist");
899
        $(".removefromlist").on("click", function(e){
992
        removeFromListLinks.removeClass("hidden");
900
            return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
993
        // "remove from list" appearing on each line of the list output
994
        removeFromListLinks.on("click",function(){
995
            $(".checkboxed").unCheckCheckboxes();
996
            var listitem = $("input[name="+this.id+"]");
997
            listitem.prop("checked",true);
998
            $("#myform").submit();
999
        });
901
        });
1000
902
1001
        $("#myform").submit(function(){
903
        $("#myform").submit(function(){
(-)a/opac/opac-downloadshelf.pl (-12 / +6 lines)
Lines 46-62 my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( Link Here
46
    }
46
    }
47
);
47
);
48
48
49
my $shelfid = $query->param('shelfid');
49
my $shelfnumber = $query->param('shelfnumber');
50
my $format  = $query->param('format');
50
my $format  = $query->param('format');
51
my $context = $query->param('context');
51
my $context = $query->param('context');
52
my $showprivateshelves = $query->param('showprivateshelves');
53
my $dbh     = C4::Context->dbh;
52
my $dbh     = C4::Context->dbh;
54
53
55
if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $shelfid, 'view' ) ) {
54
my $shelf = Koha::Virtualshelves->find( $shelfnumber );
55
if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
56
56
57
    if ($shelfid && $format) {
57
    if ($shelfnumber && $format) {
58
58
59
        my ($items, $totitems)  = GetShelfContents($shelfid);
59
        my ($items, $totitems)  = GetShelfContents($shelfnumber);
60
        my $marcflavour         = C4::Context->preference('marcflavour');
60
        my $marcflavour         = C4::Context->preference('marcflavour');
61
        my $output;
61
        my $output;
62
        my $extension;
62
        my $extension;
Lines 116-128 if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh Link Here
116
            $template->param(fullpage => 1);
116
            $template->param(fullpage => 1);
117
        }
117
        }
118
        $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
118
        $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
119
        $template->param(
119
        $template->param( shelf => $shelf );
120
            showprivateshelves  => $showprivateshelves,
121
            shelfid             => $shelf->shelfnumber,
122
            shelfnumber         => $shelf->shelfnumber,
123
            viewshelf           => $shelf->shelfnumber,
124
            shelfname           => $shelf->shelfname,
125
        );
126
        output_html_with_http_headers $query, $cookie, $template->output;
120
        output_html_with_http_headers $query, $cookie, $template->output;
127
    }
121
    }
128
122
(-)a/opac/opac-shelves.pl (-7 / +307 lines)
Lines 1-6 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
# Copyright 2000-2002 Katipo Communications
3
# Copyright 2015 Koha Team
4
#
4
#
5
# This file is part of Koha.
5
# This file is part of Koha.
6
#
6
#
Lines 17-29 Link Here
17
# 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
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use strict;
20
use Modern::Perl;
21
use warnings;
22
use CGI qw ( -utf8 );
21
use CGI qw ( -utf8 );
23
use C4::VirtualShelves::Page;
22
use C4::VirtualShelves;
24
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::Tags qw( get_tags );
30
use C4::XSLT;
31
use Koha::Virtualshelves;
25
32
26
my $query = CGI->new();
33
my $query = new CGI;
27
34
28
my $template_name = $query->param('rss') ? "opac-shelves-rss.tt" : "opac-shelves.tt";
35
my $template_name = $query->param('rss') ? "opac-shelves-rss.tt" : "opac-shelves.tt";
29
36
Lines 34-42 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ Link Here
34
        authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
41
        authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
35
    });
42
    });
36
43
44
my $op       = $query->param('op')       || 'list';
45
my $referer  = $query->param('referer')  || $op;
46
my $category = $query->param('category') || 1;
47
my ( $shelf, $shelfnumber, @messages );
48
49
if ( $op eq 'add_form' ) {
50
    # Nothing to do
51
} elsif ( $op eq 'edit_form' ) {
52
    $shelfnumber = $query->param('shelfnumber');
53
    $shelf       = Koha::Virtualshelves->find($shelfnumber);
54
55
    if ( $shelf ) {
56
        $category = $shelf->category;
57
        my $patron = GetMember( 'borrowernumber' => $shelf->owner );
58
        $template->param( owner => $patron, );
59
        unless ( $shelf->can_be_managed( $loggedinuser ) ) {
60
            push @messages, { type => 'error', code => 'unauthorized_on_update' };
61
            $op = 'list';
62
        }
63
    } else {
64
        push @messages, { type => 'error', code => 'does_not_exist' };
65
    }
66
} elsif ( $op eq 'add' ) {
67
    eval {
68
        $shelf = Koha::Virtualshelf->new(
69
            {   shelfname          => $query->param('shelfname'),
70
                sortfield          => $query->param('sortfield'),
71
                category           => $query->param('category') || 1,
72
                allow_add          => $query->param('allow_add'),
73
                allow_delete_own   => $query->param('allow_delete_own'),
74
                allow_delete_other => $query->param('allow_delete_other'),
75
                owner              => $query->param('owner'),
76
            }
77
        );
78
        $shelf->store;
79
        $shelfnumber = $shelf->shelfnumber;
80
    };
81
    if ($@) {
82
        push @messages, { type => 'error', code => ref($@), msg => $@ };
83
    } elsif ( not $shelf ) {
84
        push @messages, { type => 'error', code => 'error_on_insert' };
85
    } else {
86
        push @messages, { type => 'message', code => 'success_on_insert' };
87
        $op = 'view';
88
    }
89
} elsif ( $op eq 'edit' ) {
90
    $shelfnumber = $query->param('shelfnumber');
91
    $shelf       = Koha::Virtualshelves->find($shelfnumber);
92
    if ( $shelf ) {
93
        $op = $referer;
94
        if ( $shelf->can_be_managed( $loggedinuser ) ) {
95
            $shelf->shelfname( $query->param('shelfname') );
96
            $shelf->sortfield( $query->param('sortfield') );
97
            $shelf->allow_add( $query->param('allow_add') );
98
            $shelf->allow_delete_own( $query->param('allow_delete_own') );
99
            $shelf->allow_delete_other( $query->param('allow_delete_other') );
100
            $shelf->category( $query->param('category') );
101
            eval { $shelf->store };
102
103
            if ($@) {
104
                push @messages, { type => 'error', code => 'error_on_update' };
105
                $op = 'edit_form';
106
            } else {
107
                push @messages, { type => 'message', code => 'success_on_update' };
108
            }
109
        } else {
110
            push @messages, { type => 'error', code => 'unauthorized_on_update' };
111
        }
112
    } else {
113
        push @messages, { type => 'error', code => 'does_not_exist' };
114
    }
115
} elsif ( $op eq 'delete' ) {
116
    $shelfnumber = $query->param('shelfnumber');
117
    $shelf       = Koha::Virtualshelves->find($shelfnumber);
118
    if ($shelf) {
119
        if ( $shelf->can_be_deleted( $loggedinuser ) ) {
120
            eval { $shelf->delete; };
121
            if ($@) {
122
                push @messages, { type => 'error', code => ref($@), msg => $@ };
123
            } else {
124
                push @messages, { type => 'message', code => 'success_on_delete' };
125
            }
126
        } else {
127
            push @messages, { type => 'error', code => 'unauthorized_on_delete' };
128
        }
129
    } else {
130
        push @messages, { type => 'error', code => 'does_not_exist' };
131
    }
132
    $op = $referer;
133
} elsif ( $op eq 'remove_share' ) {
134
    $shelfnumber = $query->param('shelfnumber');
135
    $shelf = Koha::Virtualshelves->find($shelfnumber);
136
    if ($shelf) {
137
        my $removed = eval { $shelf->remove_share( $loggedinuser ); };
138
        if ($@) {
139
            push @messages, { type => 'error', code => ref($@), msg => $@ };
140
        } elsif ( $removed ) {
141
            push @messages, { type => 'message', code => 'success_on_remove_share' };
142
        } else {
143
            push @messages, { type => 'error', code => 'error_on_remove_share' };
144
        }
145
    } else {
146
        push @messages, { type => 'error', code => 'does_not_exist' };
147
    }
148
    $op = $referer;
149
150
} elsif ( $op eq 'add_biblio' ) {
151
    $shelfnumber = $query->param('shelfnumber');
152
    $shelf = Koha::Virtualshelves->find($shelfnumber);
153
    if ($shelf) {
154
        if( my $barcode = $query->param('barcode') ) {
155
            my $item = GetItem( 0, $barcode);
156
            if (defined $item && $item->{itemnumber}) {
157
                my $biblio = GetBiblioFromItemNumber( $item->{itemnumber} );
158
                if ( $shelf->can_biblios_be_added( $loggedinuser ) ) {
159
                    my $added = eval { $shelf->add_biblio( $biblio->{biblionumber}, $loggedinuser ); };
160
                    if ($@) {
161
                        push @messages, { type => 'error', code => ref($@), msg => $@ };
162
                    } elsif ( $added ) {
163
                        push @messages, { type => 'message', code => 'success_on_add_biblio' };
164
                    } else {
165
                        push @messages, { type => 'message', code => 'error_on_add_biblio' };
166
                    }
167
                } else {
168
                    push @messages, { type => 'error', code => 'unauthorized_on_add_biblio' };
169
                }
170
            } else {
171
                push @messages, { type => 'error', code => 'item_does_not_exist' };
172
            }
173
        }
174
    } else {
175
        push @messages, { type => 'error', code => 'does_not_exist' };
176
    }
177
    $op = $referer;
178
} elsif ( $op eq 'remove_biblios' ) {
179
    $shelfnumber = $query->param('shelfnumber');
180
    $shelf = Koha::Virtualshelves->find($shelfnumber);
181
    my @biblionumber = $query->param('biblionumber');
182
    if ($shelf) {
183
        if ( $shelf->can_biblios_be_removed( $loggedinuser ) ) {
184
            my $number_of_biblios_removed = eval {
185
                $shelf->remove_biblios(
186
                    {
187
                        biblionumbers => \@biblionumber,
188
                        borrowernumber => $loggedinuser,
189
                    }
190
                );
191
            };
192
            if ($@) {
193
                push @messages, { type => 'error', code => ref($@), msg => $@ };
194
            } elsif ( $number_of_biblios_removed ) {
195
                push @messages, { type => 'message', code => 'success_on_remove_biblios' };
196
            } else {
197
                push @messages, { type => 'error', code => 'no_biblio_removed' };
198
            }
199
        } else {
200
            push @messages, { type => 'error', code => 'unauthorized_on_remove_biblios' };
201
        }
202
    } else {
203
        push @messages, { type => 'error', code => 'does_not_exist' };
204
    }
205
    $op = 'view';
206
}
207
208
if ( $op eq 'view' ) {
209
    $shelfnumber ||= $query->param('shelfnumber');
210
    $shelf = Koha::Virtualshelves->find($shelfnumber);
211
    if ( $shelf ) {
212
        if ( $shelf->can_be_viewed( $loggedinuser ) ) {
213
            $category = $shelf->category;
214
            my $sortfield = $query->param('sortfield') || $shelf->sortfield;    # Passed in sorting overrides default sorting
215
            my $direction = $query->param('direction') || 'asc';
216
            my ( $shelflimit, $shelfoffset, $itemoff );
217
            unless ( $query->param('print') or $query->param('rss') ) {
218
                $shelflimit = C4::Context->preference('OPACnumSearchResults') || 20;
219
                $itemoff = ( $query->param('itemoff') ? $query->param('itemoff') : 1 );
220
                $shelfoffset = ( $itemoff - 1 ) * $shelflimit;    # Sets the offset to begin retrieving items at
221
            }
222
            my ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction );
223
224
            # get biblionumbers stored in the cart
225
            my @cart_list;
226
            if(my $cart_list = $query->cookie('bib_list')){
227
                @cart_list = split(/\//, $cart_list);
228
            }
229
230
            my $borrower = GetMember( borrowernumber => $loggedinuser );
231
232
            for my $this_item (@$items) {
233
                my $biblionumber = $this_item->{biblionumber};
234
                my $record       = GetMarcBiblio($biblionumber);
235
236
                if ( C4::Context->preference("OPACXSLTResultsDisplay") ) {
237
                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTResultsDisplay" );
238
                }
239
240
                my $marcflavour = C4::Context->preference("marcflavour");
241
                $this_item->{'imageurl'}        = getitemtypeinfo( $this_item->{'itemtype'}, 'intranet' )->{'imageurl'};
242
                $this_item->{'coins'}           = GetCOinSBiblio($record);
243
                $this_item->{'subtitle'}        = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $this_item->{'biblionumber'} ) );
244
                $this_item->{'normalized_upc'}  = GetNormalizedUPC( $record, $marcflavour );
245
                $this_item->{'normalized_ean'}  = GetNormalizedEAN( $record, $marcflavour );
246
                $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour );
247
                $this_item->{'normalized_isbn'} = GetNormalizedISBN( undef, $record, $marcflavour );
248
249
                unless ( defined $this_item->{size} ) {
250
251
                    #TT has problems with size
252
                    $this_item->{size} = q||;
253
                }
254
255
                # Getting items infos for location display
256
                my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'} );
257
                $this_item->{'ITEM_RESULTS'} = \@items_infos;
258
259
                if (C4::Context->preference('TagsEnabled') and C4::Context->preference('TagsShowOnList')) {
260
                    $this_item->{TagLoop} = get_tags({
261
                        biblionumber=>$this_item->{'biblionumber'}, approved=>1, 'sort'=>'-weight',
262
                        limit => C4::Context->preference('TagsShowOnList'),
263
                    });
264
                }
265
266
                $this_item->{allow_onshelf_holds} = C4::Reserves::OnShelfHoldsAllowed($this_item, $borrower);
267
268
269
                if ( grep {$_ eq $biblionumber} @cart_list) {
270
                    $this_item->{incart} = 1;
271
                }
272
273
                if ( $query->param('rss') ) {
274
                    $this_item->{title} = $content->biblionumber->title;
275
                    $this_item->{author} = $content->biblionumber->author;
276
                    $this_item->{biblionumber} = $biblionumber;
277
                }
278
                push @items, $this_item;
279
            }
280
281
            # Build drop-down list for 'Add To:' menu...
282
            my ( $totalref, $pubshelves, $barshelves ) = C4::VirtualShelves::GetSomeShelfNames( $loggedinuser, 'COMBO', 1 );
283
            $template->param(
284
                addbarshelves      => $totalref->{bartotal},
285
                addbarshelvesloop  => $barshelves,
286
                addpubshelves      => $totalref->{pubtotal},
287
                addpubshelvesloop  => $pubshelves,
288
                can_manage_shelf   => $shelf->can_be_managed($loggedinuser),
289
                can_delete_shelf   => $shelf->can_be_deleted($loggedinuser),
290
                can_remove_biblios => $shelf->can_biblios_be_removed($loggedinuser),
291
                can_add_biblios    => $shelf->can_biblios_be_added($loggedinuser),
292
                sortfield          => $sortfield,
293
                itemsloop          => $items,
294
                sortfield          => $sortfield,
295
                direction          => $direction,
296
            );
297
            if ($shelflimit) {
298
                $template->param(
299
                    pagination_bar => pagination_bar(
300
                        q||, ( int( $totitems / $shelflimit ) ) + ( ( $totitems % $shelflimit ) > 0 ? 1 : 0 ),
301
                        $itemoff, "itemoff", { op => 'view', shelfnumber => $shelf->shelfnumber, sortfield => $sortfield, direction => $direction, }
302
                    ),
303
                );
304
            }
305
        } else {
306
            push @messages, { type => 'error', code => 'unauthorized_on_view' };
307
        }
308
    } else {
309
        push @messages, { type => 'error', code => 'does_not_exist' };
310
    }
311
}
312
313
if ( $op eq 'list' ) {
314
    my $shelves;
315
    my ( $page, $rows ) = ( $query->param('page') || 1, 20 );
316
    if ( $category == 1 ) {
317
        $shelves = Koha::Virtualshelves->get_private_shelves({ page => $page, rows => $rows, borrowernumber => $loggedinuser, });
318
    } else {
319
        $shelves = Koha::Virtualshelves->get_public_shelves({ page => $page, rows => $rows, });
320
    }
321
322
    my $pager = $shelves->pager;
323
    $template->param(
324
        shelves => $shelves,
325
        pagination_bar => pagination_bar(
326
            q||, $pager->last_page - $pager->first_page + 1,
327
            $page, "page", { op => 'list', category => $category, }
328
        ),
329
    );
330
}
331
37
$template->param(
332
$template->param(
333
    op       => $op,
334
    referer  => $referer,
335
    shelf    => $shelf,
336
    messages => \@messages,
337
    category => $category,
338
    print    => $query->param('print') || 0,
38
    listsview => 1,
339
    listsview => 1,
39
    print     => $query->param('print')
40
);
340
);
41
341
42
shelfpage('opac', $query, $template, $loggedinuser, $cookie);
342
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/t/db_dependent/Virtualshelves.t (-6 / +71 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 4;
4
use Test::More tests => 5;
5
use DateTime::Duration;
5
use DateTime::Duration;
6
6
7
use C4::Context;
7
use C4::Context;
Lines 14-23 use t::lib::TestBuilder; Link Here
14
14
15
my $dbh = C4::Context->dbh;
15
my $dbh = C4::Context->dbh;
16
$dbh->{AutoCommit} = 0;
16
$dbh->{AutoCommit} = 0;
17
17
teardown();
18
$dbh->do(q|DELETE FROM virtualshelfshares|);
19
$dbh->do(q|DELETE FROM virtualshelfcontents|);
20
$dbh->do(q|DELETE FROM virtualshelves|);
21
18
22
my $builder = t::lib::TestBuilder->new;
19
my $builder = t::lib::TestBuilder->new;
23
20
Lines 81-86 subtest 'CRUD' => sub { Link Here
81
    is( $is_deleted, 1, 'The shelf has been deleted correctly' );
78
    is( $is_deleted, 1, 'The shelf has been deleted correctly' );
82
    $number_of_shelves = Koha::Virtualshelves->search->count;
79
    $number_of_shelves = Koha::Virtualshelves->search->count;
83
    is( $number_of_shelves, 1, 'To be sure the shelf has been deleted' );
80
    is( $number_of_shelves, 1, 'To be sure the shelf has been deleted' );
81
82
    teardown();
84
};
83
};
85
84
86
subtest 'Sharing' => sub {
85
subtest 'Sharing' => sub {
Lines 149-154 subtest 'Sharing' => sub { Link Here
149
    is( $shelf_to_share->remove_share( $share_with_me->{borrowernumber} ), 1, '1 share should have been removed if the shelf was shared with this patron' );
148
    is( $shelf_to_share->remove_share( $share_with_me->{borrowernumber} ), 1, '1 share should have been removed if the shelf was shared with this patron' );
150
    $number_of_shelves_shared = Koha::Virtualshelfshares->search->count;
149
    $number_of_shelves_shared = Koha::Virtualshelfshares->search->count;
151
    is( $number_of_shelves_shared, 1, 'To be sure the share has been removed' );
150
    is( $number_of_shelves_shared, 1, 'To be sure the share has been removed' );
151
152
    teardown();
152
};
153
};
153
154
154
subtest 'Shelf content' => sub {
155
subtest 'Shelf content' => sub {
Lines 235-240 subtest 'Shelf content' => sub { Link Here
235
    is( $number_of_deleted_biblios, 1, );
236
    is( $number_of_deleted_biblios, 1, );
236
    $number_of_contents = Koha::Virtualshelfcontents->search->count;
237
    $number_of_contents = Koha::Virtualshelfcontents->search->count;
237
    is( $number_of_contents, 1, 'The biblio should have been deleted to the shelf by the patron 2, even if it is not his own content (allow_delete_other=1)' );
238
    is( $number_of_contents, 1, 'The biblio should have been deleted to the shelf by the patron 2, even if it is not his own content (allow_delete_other=1)' );
239
240
    teardown();
238
};
241
};
239
242
240
subtest 'Shelf permissions' => sub {
243
subtest 'Shelf permissions' => sub {
Lines 340-343 subtest 'Shelf permissions' => sub { Link Here
340
343
341
    is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to his list' );
344
    is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to his list' );
342
    is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 1, 'Private list could be modified (remove) by someone else # individual check done later' );
345
    is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 1, 'Private list could be modified (remove) by someone else # individual check done later' );
346
347
    teardown();
348
};
349
350
subtest 'Get shelves' => sub {
351
    plan tests => 4;
352
    my $patron1 = $builder->build({
353
        source => 'Borrower',
354
    });
355
    my $patron2 = $builder->build({
356
        source => 'Borrower',
357
    });
358
359
    my $private_shelf1_1 = Koha::Virtualshelf->new({
360
            shelfname => "private shelf 1 for patron 1",
361
            owner => $patron1->{borrowernumber},
362
            category => 1,
363
        }
364
    )->store;
365
    my $private_shelf1_2 = Koha::Virtualshelf->new({
366
            shelfname => "private shelf 2 for patron 1",
367
            owner => $patron1->{borrowernumber},
368
            category => 1,
369
        }
370
    )->store;
371
    my $private_shelf2_1 = Koha::Virtualshelf->new({
372
            shelfname => "private shelf 1 for patron 2",
373
            owner => $patron2->{borrowernumber},
374
            category => 1,
375
        }
376
    )->store;
377
    my $public_shelf1_1 = Koha::Virtualshelf->new({
378
            shelfname => "public shelf 1 for patron 1",
379
            owner => $patron1->{borrowernumber},
380
            category => 2,
381
        }
382
    )->store;
383
    my $public_shelf1_2 = Koha::Virtualshelf->new({
384
            shelfname => "public shelf 2 for patron 1",
385
            owner => $patron1->{borrowernumber},
386
            category => 2,
387
        }
388
    )->store;
389
390
    my $private_shelves = Koha::Virtualshelves->get_private_shelves;
391
    is( $private_shelves->count, 0, 'Without borrowernumber given, get_private_shelves should not return any shelf' );
392
    $private_shelves = Koha::Virtualshelves->get_private_shelves({ borrowernumber => $patron1->{borrowernumber} });
393
    is( $private_shelves->count, 2, 'get_private_shelves should return all shelves for a given patron' );
394
395
    $private_shelf2_1->share('a key')->accept('a key', $patron1->{borrowernumber});
396
    $private_shelves = Koha::Virtualshelves->get_private_shelves({ borrowernumber => $patron1->{borrowernumber} });
397
    is( $private_shelves->count, 3, 'get_private_shelves should return all shelves for a given patron, even the shared ones' );
398
399
    my $public_shelves = Koha::Virtualshelves->get_public_shelves;
400
    is( $public_shelves->count, 2, 'get_public_shelves should return all public shelves, no matter who is the owner' );
401
402
    teardown();
343
};
403
};
344
- 
404
405
sub teardown {
406
    $dbh->do(q|DELETE FROM virtualshelfshares|);
407
    $dbh->do(q|DELETE FROM virtualshelfcontents|);
408
    $dbh->do(q|DELETE FROM virtualshelves|);
409
}

Return to bug 14544