KMAIN-348 - Add Page Number Navigation to My Lists
authorBill Erickson <berickxx@gmail.com>
Wed, 29 Oct 2014 21:06:17 +0000 (17:06 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
    Cross-port: 6e75f1b

Conflicts:
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

KCLS/openils/var/templates_kcls/opac/myopac/lists.tt2
KCLS/openils/var/templates_kcls/opac/myopac/prefs_my_lists.tt2 [new file with mode: 0644]
KCLS/openils/var/templates_kcls/opac/parts/myopac/prefs_base.tt2
KCLS/sql/add_setting_for_selecting_lists_per_page_for_my_list.sql [new file with mode: 0644]
Open-ILS/web/images/sub_prefs_my_lists_off.jpg [new file with mode: 0644]
Open-ILS/web/images/sub_prefs_my_lists_on.jpg [new file with mode: 0644]

index b37c993..8b51401 100644 (file)
         <span class='float-left' style='padding-left: 10px;'>
             [%- IF offset > 0 -%]
                 <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
-                    limit => limit, offset => (offset - limit)
+                    offset => (offset - limit)
                 }) %]'><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
             [%- END; -%]
+
+            [%- IF (offset - (limit * 3)) >= 0 -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset - (limit * 3))
+                }) %]'>[% ((offset - (limit * 3)) / limit) + 1 %]</a>
+            [%- END; -%]
+            [%- IF (offset - (limit * 2)) >= 0 -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset - (limit * 2))
+                }) %]'>[% ((offset - (limit * 2)) / limit) + 1 %]</a>
+            [%- END; -%]
+            [%- IF (offset - limit) >= 0 -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset - limit)
+                }) %]'>[% ((offset - limit) / limit) + 1 %]</a>
+            [%- END; -%]
+
+            <span style="color:red;" >[% (offset / limit) + 1 %]</span>
+
+            [%- IF (ctx.bookbag_count - offset) > limit; -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset + limit)
+                }) %]'>[% ((offset + limit) / limit) + 1 %]</a>
+            [%- END; -%]
+            [%- IF (ctx.bookbag_count - offset) > limit * 2; -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset + (limit * 2))
+                }) %]'>[% ((offset + (limit * 2)) / limit) + 1 %]</a>
+            [%- END; -%]
+            [%- IF (ctx.bookbag_count - offset) > limit * 3; -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset + (limit * 3))
+                }) %]'>[% ((offset + (limit * 3)) / limit) + 1 %]</a>
+            [%- END; -%]
+
             [%- IF (ctx.bookbag_count - offset) > limit; -%] 
                 <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
-                    limit => limit, offset => (offset + limit)
+                    offset => (offset + limit)
                 }) %]'>[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
             </span>
             [%- END; -%]
         <span class='float-left' style='padding-left: 10px;'>
             [%- IF offset > 0 -%]
                 <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
-                    limit => limit, offset => (offset - limit)
+                    offset => (offset - limit)
                 }) %]'><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
             [%- END; -%]
+
+            [%- IF (offset - (limit * 3)) >= 0 -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset - (limit * 3))
+                }) %]'>[% ((offset - (limit * 3)) / limit) + 1 %]</a>
+            [%- END; -%]
+            [%- IF (offset - (limit * 2)) >= 0 -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset - (limit * 2))
+                }) %]'>[% ((offset - (limit * 2)) / limit) + 1 %]</a>
+            [%- END; -%]
+            [%- IF (offset - limit) >= 0 -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset - limit)
+                }) %]'>[% ((offset - limit) / limit) + 1 %]</a>
+            [%- END; -%]
+
+            <span style="color:red;" >[% (offset / limit) + 1 %]</span>
+
+            [%- IF (ctx.bookbag_count - offset) > limit; -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset + limit)
+                }) %]'>[% ((offset + limit) / limit) + 1 %]</a>
+            [%- END; -%]
+            [%- IF (ctx.bookbag_count - offset) > limit * 2; -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset + (limit * 2))
+                }) %]'>[% ((offset + (limit * 2)) / limit) + 1 %]</a>
+            [%- END; -%]
+            [%- IF (ctx.bookbag_count - offset) > limit * 3; -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    offset => (offset + (limit * 3))
+                }) %]'>[% ((offset + (limit * 3)) / limit) + 1 %]</a>
+            [%- END; -%]
+
             [%- IF (ctx.bookbag_count - offset) > limit; -%] 
                 <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
-                    limit => limit, offset => (offset + limit)
+                    offset => (offset + limit)
                 }) %]'>[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
             </span>
             [%- END; -%]
diff --git a/KCLS/openils/var/templates_kcls/opac/myopac/prefs_my_lists.tt2 b/KCLS/openils/var/templates_kcls/opac/myopac/prefs_my_lists.tt2
new file mode 100644 (file)
index 0000000..99e7799
--- /dev/null
@@ -0,0 +1,41 @@
+[%  PROCESS "opac/parts/header.tt2";
+    WRAPPER "opac/parts/myopac/prefs_base.tt2";
+    myopac_page = "prefs_my_lists";
+    prefs_page = 'my_lists' %]
+
+
+    <form method='post'>
+
+       <table class="full-width data_grid" id="acct_search_main">
+            <tbody>
+
+                [% IF ctx.updated_user_settings %]
+                <tr><td colspan='2'>
+                    <div class='renew-summary'>
+                        [% l('Account Successfully Updated') %]
+                    </div>
+                </td></tr>
+                [% END %]
+
+                [%- setting = 'opac.lists_per_page' -%]
+                <tr >
+                    <td width='20%'><label for='[% setting %]'>[%l("Lists per page") %]</label></td>
+                    <td>
+                        <select id='[% setting %]' name='[% setting %]'>
+                            [%  UNLESS ctx.user_setting_map.$setting;
+                                    ctx.user_setting_map.$setting = 10;
+                                END;
+                                FOR val IN [10, 15, 20, 25] %]
+                                <option value='[% val | uri %]' 
+                                    [% IF ctx.user_setting_map.$setting == val %]
+                                        selected='selected'[% END %]>[% val | html %]</option>
+                            [% END %]
+                        </select>
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+       <input type="submit" value="[% l('Save') %]" alt="[% l('Save') %]" class="opac-button"/>
+    </form>
+    [% INCLUDE "opac/parts/myopac/prefs_hints.tt2" %]
+[% END %]
\ No newline at end of file
index 1b641a6..f350c73 100644 (file)
@@ -15,6 +15,9 @@
             </div>
             [% END %]
             <div class="align">
+                <a href='prefs_my_lists'><img src="[% ctx.media_prefix %]/images/sub_prefs_my_lists_off.jpg" /></a>
+            </div>
+            <div class="align">
                 <a href='prefs_settings'><img src="[% ctx.media_prefix %]/images/sub_prefs_search_off.jpg" /></a>
             </div>
         [% ELSIF prefs_page == 'notify' %]
             <div class="align">
                 <a href='#'><img src="[% ctx.media_prefix %]/images/sub_prefs_notify_on.jpg" /></a>
             </div>
+            <div class="align">
+                <a href='prefs_my_lists'><img src="[% ctx.media_prefix %]/images/sub_prefs_my_lists_off.jpg" /></a>
+            </div>
             <div class="align" >
                 <a href='prefs_settings'><img src="[% ctx.media_prefix %]/images/sub_prefs_search_off.jpg" /></a>
             </div>
-        [% ELSE %]
+        [% ELSIF prefs_page == 'settings' %]
             <div class="align">
                 <a href='prefs'><img src="[% ctx.media_prefix %]/images/sub_prefs_info_off.jpg" /></a>
             </div>
                 <a href='prefs_notify'><img src="[% ctx.media_prefix %]/images/sub_prefs_notify_off.jpg" /></a>
             </div>
             [% END %]
+            <div class="align">
+                <a href='prefs_my_lists'><img src="[% ctx.media_prefix %]/images/sub_prefs_my_lists_off.jpg" /></a>
+            </div>
             <div class="align" >
                 <a href='#'><img src="[% ctx.media_prefix %]/images/sub_prefs_search_on.jpg" /></a>
             </div>
+        [% ELSE %]
+            <div class="align">
+                <a href='prefs'><img src="[% ctx.media_prefix %]/images/sub_prefs_info_off.jpg" /></a>
+            </div>
+            [% IF ctx.opt_in_settings.size > 0 %]
+            <div class="align">
+                <a href='prefs_notify'><img src="[% ctx.media_prefix %]/images/sub_prefs_notify_off.jpg" /></a>
+            </div>
+            [% END %]
+            <div class="align">
+                <a href='#'><img src="[% ctx.media_prefix %]/images/sub_prefs_my_lists_on.jpg" /></a>
+            </div>
+            <div class="align">
+                <a href='prefs_settings'><img src="[% ctx.media_prefix %]/images/sub_prefs_search_off.jpg" /></a>
+            </div>
         [% END %]
         </div>
     </div> 
diff --git a/KCLS/sql/add_setting_for_selecting_lists_per_page_for_my_list.sql b/KCLS/sql/add_setting_for_selecting_lists_per_page_for_my_list.sql
new file mode 100644 (file)
index 0000000..aeeb5cc
--- /dev/null
@@ -0,0 +1,23 @@
+-- Adds a setting for selecting the number of lists per page for my list.
+
+BEGIN;
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+    VALUES (
+        'opac.lists_per_page',
+        TRUE,
+        oils_i18n_gettext(
+            'opac.lists_per_page',
+            'Lists per Page',
+            'cust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'opac.lists_per_page',
+            'A number designating the amount of lists displayed per page.',
+            'cust',
+            'description'
+        ),
+        'string'
+    );
+COMMIT;
\ No newline at end of file
diff --git a/Open-ILS/web/images/sub_prefs_my_lists_off.jpg b/Open-ILS/web/images/sub_prefs_my_lists_off.jpg
new file mode 100644 (file)
index 0000000..7a0a85b
Binary files /dev/null and b/Open-ILS/web/images/sub_prefs_my_lists_off.jpg differ
diff --git a/Open-ILS/web/images/sub_prefs_my_lists_on.jpg b/Open-ILS/web/images/sub_prefs_my_lists_on.jpg
new file mode 100644 (file)
index 0000000..5669e3c
Binary files /dev/null and b/Open-ILS/web/images/sub_prefs_my_lists_on.jpg differ