copy loc groups: UI round 2
authorBill Erickson <berick@esilibrary.com>
Fri, 17 Feb 2012 18:04:04 +0000 (13:04 -0500)
committerBill Erickson <berick@esilibrary.com>
Fri, 17 Feb 2012 18:04:04 +0000 (13:04 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/opac/parts/org_selector.tt2

index bd2a7bc..3f8b754 100644 (file)
@@ -4,8 +4,7 @@
 #       value=org_id show_loc_groups=1/0 can_have_vols_only=1/0
 
 BLOCK build_org_selector;
-    root_node = org_unit || ctx.aou_tree;
-    node_stack = [{org => root_node}] %]
+    node_stack = [{org => org_unit || ctx.aou_tree}] %]
 
     <select [% IF id %] id='[% id %]' [% END %] name='[% name %]'>
     [% 
@@ -17,37 +16,37 @@ BLOCK build_org_selector;
             disabled = '';
             selected = '';
 
-            IF ctx.is_staff || org_unit.opac_visible == 't';
+            NEXT UNLESS ctx.is_staff || org_unit.opac_visible == 't';
 
-                IF !loc_grp;
-                    IF show_loc_groups;
-                        FOR grp IN ctx.copy_location_groups.$ou_id.sort('pos').reverse;
-                            node_stack.push({org => org_unit, loc_grp => grp});
-                        END;
-                    END;
-                    FOR child IN org_unit.children.reverse;
-                        node_stack.push({org => child});
+            IF !loc_grp;
+                IF show_loc_groups;
+                    FOR grp IN ctx.copy_location_groups.$ou_id.sort('pos').reverse;
+                        node_stack.push({org => org_unit, loc_grp => grp});
                     END;
                 END;
+                FOR child IN org_unit.children.reverse;
+                    node_stack.push({org => child});
+                END;
+            END;
 
-                IF can_have_vols_only AND org_unit.ou_type.can_have_vols != 't';
-                    disabled = 'disabled="disabled"';
-                ELSIF ou_id == value; # TODO: test for copy_loc value
-                    selected = 'selected="selected"';
-                END %] 
+            IF can_have_vols_only AND org_unit.ou_type.can_have_vols != 't';
+                disabled = 'disabled="disabled"';
+            ELSIF ou_id == value; # TODO: test for copy_loc value
+                selected = 'selected="selected"';
+            END %] 
 
-                <option value='[% org_unit.id | uri %]' [% selected %] [% disabled %]> 
-                [%
-                    depth = org_unit.ou_type.depth;
-                    IF loc_grp; depth = depth + 1; END;
-                    pad = depth * 2;
-                    FOR idx IN [0..pad]; '&nbsp;'; END;
-                    loc_grp ? loc_grp.name : org_unit.name | html ;
-                %]
-                </option> 
+            <option value='[% org_unit.id | uri %]' [% selected %] [% disabled %]> 
+            [%
+                # loc_grp's are displayed as children of the current org
+                depth = org_unit.ou_type.depth;
+                IF loc_grp; depth = depth + 1; END;
+                pad = depth * 2;
+                FOR idx IN [0..pad]; '&nbsp;'; END;
+                loc_grp ? loc_grp.name : org_unit.name | html ;
+            %]
+            </option> 
 
-                [%
-            END;
+            [%
         END;
     %]
     </select>