Changeset 14551

Show
Ignore:
Timestamp:
01/22/08 12:17:56 (11 months ago)
Author:
flack
Message:

sort navigation items in Asgard by sitegroup and label directly in qb (i.e. reflector)

also, read-only objects are marked in navigation for easier recognition

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.helper.reflector/reflector_tree.php

    r14465 r14551  
    249249        }*/ 
    250250 
     251                $ref = $this->get($this->mgdschema_class); 
     252                $qb->add_order('sitegroup', 'DESC'); 
     253        $qb->add_order($ref->get_label_property()); 
    251254        $objects = $qb->execute(); 
    252255 
     
    469472            unset($type_children); 
    470473        } 
     474 
    471475        return $child_objects; 
    472476    } 
     
    613617            return false; 
    614618        } 
     619        $ref = $this->get($schema_type); 
     620                $qb->add_order('sitegroup', 'DESC'); 
     621        $qb->add_order($ref->get_label_property()); 
    615622        $objects = $qb->execute(); 
    616623        return $objects; 
  • trunk/midcom/midgard.admin.asgard/navigation.php

    r14495 r14551  
    154154            foreach ($siblings as $type => $children) 
    155155            { 
    156                 $label_mapping = Array(); 
    157                 $i = 0; 
     156 
    158157                foreach ($children as $child) 
    159158                { 
    160                     $ref =& $this->_get_reflector(&$child); 
    161                     $label_mapping[$i] = htmlspecialchars($ref->get_object_label($child)); 
    162                     $i++; 
    163                 } 
    164                 asort($label_mapping); 
    165  
    166  
    167                 foreach($label_mapping as $index => $label) 
    168                 { 
    169                     $child =& $children[$index]; 
    170159                    if (isset($this->shown_objects[$child->guid])) 
    171160                    { 
     
    175164                    $ref =& $this->_get_reflector(&$child); 
    176165 
     166                                        $label = $this->_get_reflector(&$child); 
    177167                    $selected = $this->_is_selected($child); 
    178168                    $css_class = $type; 
     
    204194    } 
    205195 
     196        /** 
     197         * Renders the given root objects to HTML and calls _list_child_elements() 
     198         * 
     199         * @param array &$root_objects reference to the array of root objects 
     200         * @param midcom_helper_reflector_tree &$ref Reflector singleton 
     201         */ 
     202        function _list_root_elements(&$root_objects, &$ref) 
     203        { 
     204            echo "<ul class=\"midgard_admin_asgard_navigation\">\n"; 
     205 
     206            foreach ($root_objects as $object) 
     207            { 
     208                $label = $ref->get_object_label($object); 
     209                $selected = $this->_is_selected($object); 
     210                $css_class = get_class($object); 
     211                $this->_common_css_classes($object, $ref, $css_class); 
     212                $this->shown_objects[$object->guid] = true; 
     213 
     214                echo "    <li class=\"{$css_class}\">"; 
     215 
     216                $label = htmlspecialchars($label); 
     217                $icon = $ref->get_object_icon($object); 
     218 
     219                if (empty($label)) 
     220                { 
     221                    $label = "#oid_{$object->id}"; 
     222                } 
     223 
     224                echo "<a href=\"{$_MIDGARD['self']}__mfa/asgard/object/view/{$object->guid}/\" title=\"GUID: {$object->guid}, ID: {$object->id}\">{$icon}{$label}</a>\n"; 
     225 
     226                if ($selected) 
     227                { 
     228                    $this->_list_child_elements($object); 
     229                } 
     230 
     231                echo "    </li>\n"; 
     232            } 
     233 
     234            echo "</ul>\n"; 
     235        } 
     236 
    206237    function _draw_plugins() 
    207238    { 
     
    256287        { 
    257288            $css_class .= ' current'; 
     289        } 
     290        if ( !$object->can_do('midgard:update')) 
     291        { 
     292            $css_class .= ' readonly'; 
    258293        } 
    259294    } 
     
    307342                if (count($root_objects) > 0) 
    308343                { 
    309                     echo "<ul class=\"midgard_admin_asgard_navigation\">\n"; 
    310  
    311                     $object_label_mapping = Array(); 
    312  
    313                     $i = 0; 
    314                     foreach ($root_objects as $object) 
    315                     { 
    316                         $object_label_mapping[$i] = $ref->get_object_label($object); 
    317                         $i++; 
    318                     } 
    319                     asort($object_label_mapping); 
    320  
    321                     foreach ($object_label_mapping as $index => $label) 
    322                     { 
    323                         $object =& $root_objects[$index]; 
    324                         $selected = $this->_is_selected($object); 
    325                         $css_class = get_class($object); 
    326                         $this->_common_css_classes($object, $ref, $css_class); 
    327                         $this->shown_objects[$object->guid] = true; 
    328  
    329                         echo "    <li class=\"{$css_class}\">"; 
    330  
    331                         $label = htmlspecialchars($label); 
    332                         $icon = $ref->get_object_icon($object); 
    333                         if (empty($label)) 
    334                         { 
    335                             $label = "#{$object->id}"; 
    336                         } 
    337  
    338                         echo "<a href=\"{$_MIDGARD['self']}__mfa/asgard/object/view/{$object->guid}/\" title=\"GUID: {$object->guid}, ID: {$object->id}\">{$icon}{$label}</a>\n"; 
    339  
    340                         if ($selected) 
    341                         { 
    342                             $this->_list_child_elements($root_object); 
    343                         } 
    344  
    345                         echo "    </li>\n"; 
    346                     } 
    347  
    348                     echo "</ul>\n"; 
     344                                        $this->_list_root_elements($root_objects, &$ref); 
    349345                } 
    350346            } 
     
    410406            && count($root_objects) > 0) 
    411407        { 
    412             midcom_show_style('midgard_admin_asgard_navigation_section_header'); 
    413             echo "<ul class=\"midgard_admin_asgard_navigation\">\n"; 
    414  
    415             $object_label_mapping = Array(); 
    416  
    417             $i = 0; 
    418             foreach ($root_objects as $object) 
    419             { 
    420                 $object_label_mapping[$i] = $ref->get_object_label($object); 
    421                 $i++; 
    422             } 
    423             asort($object_label_mapping); 
    424  
    425             foreach ($object_label_mapping as $index => $label) 
    426             { 
    427                 $object =& $root_objects[$index]; 
    428                 $selected = $this->_is_selected($object); 
    429                 $css_class = get_class($object); 
    430                 $this->_common_css_classes($object, $ref, $css_class); 
    431                 $this->shown_objects[$object->guid] = true; 
    432  
    433                 echo "    <li class=\"{$css_class}\">"; 
    434  
    435                 $label = htmlspecialchars($label); 
    436                 $icon = $ref->get_object_icon($object); 
    437  
    438                 if (empty($label)) 
    439                 { 
    440                     $label = "#oid_{$object->id}"; 
    441                 } 
    442  
    443                 echo "<a href=\"{$_MIDGARD['self']}__mfa/asgard/object/view/{$object->guid}/\" title=\"GUID: {$object->guid}, ID: {$object->id}\">{$icon}{$label}</a>\n"; 
    444  
    445                 if ($selected) 
    446                 { 
    447                     $this->_list_child_elements($root_object); 
    448                 } 
    449  
    450                 echo "    </li>\n"; 
    451             } 
    452  
    453             echo "</ul>\n"; 
    454             midcom_show_style('midgard_admin_asgard_navigation_section_footer'); 
     408                        midcom_show_style('midgard_admin_asgard_navigation_section_header'); 
     409                        $this->_list_root_elements($root_objects, $ref); 
     410                        midcom_show_style('midgard_admin_asgard_navigation_section_footer'); 
    455411        } 
    456412    } 
  • trunk/midcom/midgard.admin.asgard/static/screen.css

    r14483 r14551  
    139139{ 
    140140    font-weight: normal; 
     141} 
     142#navigation div.section ul.midgard_admin_asgard_navigation li.readonly a 
     143{ 
     144    color: #444444; 
     145} 
     146#navigation div.section ul.midgard_admin_asgard_navigation li.readonly li a 
     147{ 
    141148} 
    142149