[fusion-trac] #72: Flyout causes exception if container is missing

Fusion trac_fusion at osgeo.org
Wed May 28 21:14:00 EDT 2008


#72: Flyout causes exception if container is missing
------------------------+---------------------------------------------------
   Reporter:  pagameba  |       Owner:  madair
       Type:  defect    |      Status:  new   
   Priority:  P2        |   Milestone:  1.1   
  Component:  Widgets   |     Version:  1.0.6 
   Severity:  Minor     |    Keywords:        
External_id:            |       State:  New   
    Browser:  All       |          Os:  All   
------------------------+---------------------------------------------------
 Reported by David Hequet on fusion-users:

 {{{
 I noticed that creating Fusion template without a toolbar that include
 Flyout or tweaking existing with Mapguide Studio can throw javascript
 error.
 (tested with MapGuide Enterprise 2009 and MGOS 2.0, don't know what
 version
 of Fusion is in).

 IE: If you remove the FileMenu composant from an existing template (with
 Studio) and render the layout in your browser, Fusion will try to render
 sub-element from this toolbar (Map Menu and view Menu).
 Because of the container (toolbar) does not exist, when Fusion try to add
 the Flyout it throw a javascript error.

 As the flyout menu is saved in the repository's ApplicationDefinition you
 can remove the flyout from the toolbar then remove the toolbar from the
 template (then it will not try to render, so no error).

 I tweaked the Fusion's applicationdefinition.js code so it don't try to
 render menu if container doesn't exist.

 If you have better idea tell me, if my code tweak seems self-sufisant put
 it
 in the next release :)

 Here is the code :

 Fusion.Lib.ApplicationDefinition.Item = Class.create();
 Fusion.Lib.ApplicationDefinition.Item.prototype = {
 ..................
            case 'Flyout':
                /* create a menu */

                var menu;
                var opt = {};
                opt.label = this.flyout.label;
                opt.tooltip = this.flyout.tooltip;
                opt.image = this.flyout.imageUrl;
                opt.imageClass = this.flyout.imageClass;
                if (container instanceof Jx.Toolbar) {
                    menu = new Jx.Menu(opt);
                } else if (container instanceof Jx.Menu ||
                           container instanceof Jx.ContextMenu ||
                           container instanceof Jx.SubMenu) {
                    menu = new Jx.SubMenu(opt);
                } else if (container == undefined) // if container does not
 exist, does not create the menu
                {
                  break;
                }
                container.add(menu);
                this.flyout.create(widgetSet, menu);

                break;
 .............
 };
 }}}

 Requires testing to reproduce and determine if there are other possible
 cases which could cause exceptions.

-- 
Ticket URL: <http://trac.osgeo.org/fusion/ticket/72>
Fusion <http://trac.osgeo.org/fusion>
Fusion is a web-mapping application development framework for MapServer and MapGuide OS.


More information about the fusion-trac mailing list