[Chameleon-dev] [Bug 1332] [Chameleon-Core]MLT resources are not loaded in external widgets

bugzilla-daemon at bugzilla.maptools.org bugzilla-daemon at bugzilla.maptools.org
Thu Mar 9 05:03:29 EST 2006


http://bugzilla.maptools.org/show_bug.cgi?id=1332





------- Additional Comments From bartvde at xs4all.nl  2006-03-09 05:03 -------
I have implemented a fix for this in my local copy of WidgetManager.php and
verified that it works correctly this way.

Changes are:

1) add an attribute to store the current widget dir:

    var $mszCurrentWidgetDir;

2) set the mszCurrentWidgetDir variable in the existing loop which scans the
directories (only 1 line is new):

        if (!class_exists($szWidget))
        {
            // If a version is specified, don't look in widget directories.
            if ($szVersion == "")
            {
                $i=-1;
                $nDirectories = count($this->maszWidgetDirectories);
                while( ++$i < $nDirectories )
                {
                    $szFile =
$this->maszWidgetDirectories[$i].'/'.$szWidget.'/'.$szWidget.'.widget.php';
                    if (file_exists( $szFile ))
                    {
                        $this->mszCurrentWidgetDir =
$this->maszWidgetDirectories[$i];
                        include( $szFile );
                        return $szWidget;
                    }
                }
            }

3) use the mszCurrentWidgetDir in the call to the MLT loadResource function:

            if ( is_object( $this->moMLT ) )
            {
/*                $this->moMLT->loadResource( $oWidget->mszWidgetName,
                                            str_replace("\\","/",
                                            dirname(__FILE__) ).'/widgets/'.
                                            $oWidget->mszWidgetName );*/

                $this->moMLT->loadResource( $oWidget->mszWidgetName,
                  $this->mszCurrentWidgetDir.$oWidget->mszWidgetName );
            }

Does anybody see any potential problems? If not, I'll commit this fix.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Please do NOT reply to this email, use the link above instead to 
login to bugzilla and submit your comment. Any email reply to this
address will be lost.


More information about the Chameleon-dev mailing list