PINES Customization for Carousels
authorTerran McCanna <tmccanna@georgialibraries.org>
Tue, 26 Nov 2019 15:51:50 +0000 (10:51 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 16 Mar 2020 21:15:49 +0000 (17:15 -0400)
Added carousels in the 3.4.1 upgrade January 2020.

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/templates/opac/css/style.css.tt2
Open-ILS/src/templates/opac/parts/homesearch.tt2
Open-ILS/src/templates/opac/parts/org_selector.tt2

index 7b4ebdd..378b922 100644 (file)
@@ -3587,9 +3587,6 @@ label[for*=expert_]
     height: 160px;
     border: 1px solid #999;
 }
-.carousel-entry-title a {
-    color: [% css_colors.link %];
-}
 .carousel .glide__arrow {
     color: [% css_colors.button_text %];
     font-weight: bold !important;
index 6e44942..9c7bbc5 100644 (file)
@@ -1,31 +1,16 @@
-<div id="homesearch_main_logo" style="float:left;text-align:center;border:0px; width:90%;">
-    <!-- <img src="[% ctx.media_prefix %]/opac/images/main_logo.png[% ctx.cache_key %]"
-        [% img_alt(l('Evergreen Logo')) %]/> -->
-               
-       <div style="border:0px;text-align:center;height:250px;width:250px;float:left;margin-left:0px;">
-           <a href="http://pines.georgialibraries.org/pinesLocator/locator.html" target="_blank" style="text-decoration:none;">
-                   <img alt="[% l('Library Locations') %]" src="[% ctx.media_prefix %]/images/pines-map.gif" style="height:150px;" /><br/>
-                       <span style="font-size:125%;font-weight:bold;">[% l('Library Locations') %]</span>
-               </a><br/>
-               <p>[% l('PINES Library Locations Note') %]</p>
-    </div>
+<div id="homesearch_main_logo" style="width:100%;margin-left:-20px;">
+    <!-- PINES Customizations -->
 
-       <div style="border:0px;text-align:center;height:250px;width:370px;float:left;margin-left:40px;margin-right:40px;">
-           <img alt="[% l('New Arrivals') %]" src="[% ctx.media_prefix %]/images/books.jpg" style="height:150px;" /><br/>
-               <span style="font-size:125%;font-weight:bold;color:#00593d;">[% l('New Library Materials') %]</span><br/>
+    <div class="pines_carousel_selector">
+        <img alt="[% l('New Arrivals') %]" src="[% ctx.media_prefix %]/images/books.jpg" class="pines_carousel_selector_image"/><br/>
+        <span class="pines_carousel_selector_text">[% l('New Library Materials') %]</span><br/>
         <br/>
         <form>
-            [% INCLUDE build_org_selector_newitems show_loc_groups=1 %]
+            [% INCLUDE build_org_selector_carousel show_loc_groups=1 %]
         </form>
     </div>
-    
-       <div style="border:0px;text-align:center;height:250px;width:250px;float:left;margin-left:0px;">
-           <a href="http://pines.georgialibraries.org/catalog-help" target="_blank" style="text-decoration:none;">
-                   <img alt="[% l('PINES Catalog Help') %]" src="[% ctx.media_prefix %]/images/home-largehelp.png" style="height:150px;" /><br/>
-                       <span style="font-size:125%;font-weight:bold;">[% l('PINES Catalog Help') %]</span>
-               </a><br/>
-               <p>[% l('PINES Help Note') %]</p>
-    </div>
-    
+
+    <!-- End PINES Customizations -->
+
+    [% PROCESS carousels %]
 </div>
-[% PROCESS carousels %]
index c0b7fa9..1b7ac42 100644 (file)
@@ -139,6 +139,7 @@ BLOCK build_org_selector;
 
 [%  # PINES Customization for New Library Materials
     # Build second org selector that uses shortname instead of id
+    # This is deprecated as of 3.4.1 January 2020 Upgrade
 
 BLOCK build_org_selector_newitems;
     node_stack = [{org => org_unit || ctx.aouct_tree || ctx.aou_tree}];
@@ -269,3 +270,138 @@ BLOCK build_org_selector_newitems;
     </select>
 [%- END %]
 
+
+
+
+[%  # PINES Customization for Carousels
+    # Build org selector that refreshes page with physical_loc set to control which carousels display
+
+BLOCK build_org_selector_carousel;
+    node_stack = [{org => org_unit || ctx.aouct_tree || ctx.aou_tree}];
+    inherited_vis = ctx.get_cgf('opac.org_unit.non_inherited_visibility').enabled == 'f';
+
+    IF !name;
+        name = loc_name;
+    END;
+    IF !value;
+        value = loc_value;
+    END;
+
+    # if the selected org unit is out of hiding scope,
+    # disable the ou-hide scoping altogether.
+    hiding_disabled = ctx.org_hiding_disabled(value);
+
+    -%]
+
+    <select id='carousel_selector'
+            title='[% arialabel || l("Select Library") %]'
+            class="org_selector_dropdown"
+            onchange="location = '/eg/opac/home?physical_loc=' +
+                this.options[this.selectedIndex].value">
+    <option value="" class="org_unit" disabled selected="selected">Choose a library to see newly purchased items</option>
+    [%-
+        WHILE node_stack.size > 0;
+            node = node_stack.pop();
+            org_unit = node.org;
+            loc_grp = node.loc_grp;
+            ou_id = org_unit.id;
+            css_class = '';
+            disabled = '';
+            selected = '';
+            visible = org_unit.opac_visible == 't';
+
+            # org and all children are invisible.
+            NEXT IF !visible AND inherited_vis AND !ctx.is_staff;
+
+            IF !loc_grp; # processing an org unit
+
+                top_loc_groups = [];
+                IF show_loc_groups;
+                    # add the location groups that sort below the child org units
+                    FOR grp IN ctx.copy_location_groups.$ou_id.reverse;
+                        IF grp.top == 't';
+                            top_loc_groups.push(grp);
+                        ELSE;
+                            node_stack.push({org => org_unit, loc_grp => grp});
+                        END;
+                    END;
+                END;
+
+                # add the child org units
+                FOR child IN org_unit.children.reverse;
+                    node_stack.push({org => child});
+                END;
+
+                # add the location groups that sort to the top
+                # above the child org units
+                FOR grp IN top_loc_groups;
+                    node_stack.push({org => org_unit, loc_grp => grp});
+                END;
+
+            END;
+
+            # org is not publicly visible (though its children may be).
+            NEXT UNLESS ctx.is_staff OR visible;
+
+            # org is not within hiding scope (though its children may be).
+            NEXT UNLESS hiding_disabled OR ctx.org_within_hiding_scope(ou_id);
+
+            node_value = ou_id;
+            IF loc_grp;
+                node_value = node_value _ ':' _ loc_grp.id;
+                css_class = 'class="loc_grp"';
+            ELSE;
+                css_class = 'class="org_unit"';
+            END;
+
+            IF can_have_vols_only AND org_unit.ou_type.can_have_vols != 't';
+                disabled = 'disabled="disabled"';
+            ELSIF node_value == value;
+                selected = 'selected="selected"';
+            END;
+
+            IF can_have_users_only AND org_unit.ou_type.can_have_users != 't';
+                disabled = 'disabled="disabled"';
+            ELSIF node_value == value;
+                selected = 'selected="selected"';
+            END;
+
+            IF hold_pickup_lib AND ctx.get_org_setting(
+                    org_unit.id, 'opac.holds.org_unit_not_pickup_lib');
+                disabled = 'disabled="disabled"';
+            END;
+
+            # caller provided a list of valid org units.
+            # all orgs not in the list are marked invalid.
+            IF valid_org_list AND
+                    !valid_org_list.grep('^' _ org_unit.id _ '$').size;
+                disabled = 'disabled="disabled"';
+                selected = '';
+            END;
+
+            pad_depth = 0;
+
+            # copy loc groups appear as children of the owning org unit
+            SET pad_depth = pad_depth + 1 IF loc_grp;
+
+            # determine the depth by calculating the distance from the root
+            porg = ctx.get_aou(org_unit.parent_ou);
+            WHILE porg;
+                SET pad_depth = pad_depth + 1 IF porg.opac_visible == 't' OR ctx.is_staff;
+                porg = ctx.get_aou(porg.parent_ou);
+            END;
+
+            pad_depth = pad_depth * 5;
+            display_name = loc_grp ? loc_grp.name : org_unit.name %]
+            [% IF node_value == 1 %]
+                [% display_name = "All PINES Libraries" %]
+            [% END %]
+
+            <option value='[% org_unit.id %]' [% selected %] [% disabled %] [% css_class %]>
+                [% '&nbsp;' FOR [0..pad_depth]; display_name | html %]
+            </option>
+
+        [%- END %]
+    </select>
+[%- END %]
+