[horde] Problem with renderNodeDefinitions in sidebar.php

Juan Germano jigermano at uolsinectis.com.ar
Wed Jan 19 07:07:43 PST 2005



   In line 213 of
   horde/services/portal/sidebar.php
   we have:

   $tree = &Horde_Tree::singleton('horde_menu', 'javascript');

   Now, we are not guaranteed  to actually get a Horde_Tree_javascript
   instance because of this:
   Horde/Tree.php

        function &singleton($name, $renderer, $params = array())
        {
            static $instances = array();

            $id = $name . ':' . $renderer . ':' . serialize($params);
            if (!isset($instances[$id])) {
                $instances[$id] = &Horde_Tree::factory($name, $renderer,
   $params);
                if (!$instances[$id]->isSupported()) {
                    $renderer = Horde_Tree::fallback($renderer);
                    if (is_a($renderer, 'PEAR_Error')) {
                        return $renderer;
                    }
                    return Horde_Tree::singleton($name, $renderer, $params);
                }
            }

            return $instances[$id];
        }

   $instances[$id]->isSupported() may not always true:
   Horde/Tree/javascript.php

        function isSupported()
        {
            return $GLOBALS['browser']->hasFeature('dom');
        }

   We may get a Horde_Tree_html which has no method renderNodeDefinitions,  
so
   horde/services/portal/sidebar.php, line 276

        echo $tree->renderNodeDefinitions();

   Is throwing  a Call to an undefined function:  rendernodedefinitions()

   with a  browser without DOM support.

   --
   Juan
 



More information about the horde mailing list