MapTools.org

[Chameleon] Problem with CWC2OnLoadFunction...

Paul Spencer spencer@dmsolutions.ca
Thu, 01 Apr 2004 13:21:14 -0500
Aaron,

I believe that there is a potential problem in that if the UIManager 
does not have any widgets that want to use the onload function, then it 
will not output the code for this function.

Somewhere in UIManager you may find this code block (starting at line 
216 in my copy, but it is probably changed from yours):

         if ($szOnLoadFunc != "")
         {
             $szOnLoadFunc = "function 
CWC2OnLoadFunction()\n{\n".$szOnLoadFunc;
             $szOnLoadFunc.= "\n}\n";
         }

At some point, this block was changed to:

         //if ($szOnLoadFunc != "")
         //{
             $szOnLoadFunc = "function 
CWC2OnLoadFunction()\n{\n".$szOnLoadFunc;
             $szOnLoadFunc.= "\n}\n";
         //}

If you have the first and not the second version then you can modify the 
code to look like the second version and your problem should (hopefully) 
go away.  If you do have the second version, then I am not sure why you 
are having the problem and will have to put more thought into it.

This change is in the latest CVS version but I am not sure if it is in 
any of the tarball packages yet.

Cheers,

Paul

Aaron Racicot wrote:

> Jason,
> 
> I have been going through the chameleon code to try and locate where I am
> having problems.  I have taken your advise and gone back to the downloaded
> demo from the MapTools web site.  
> 
> I have started to systematically walk through the code to try to debug my
> problem.  What I have come up with is that in the UIManager.php file I am
> getting a JS runtime error at the following piece of code:
> 
> +++++++++++++ Start code +++++++++++++++++++++++
> function DrawPublish()
> {
> 
>     //get javascript code from widgets
>     $this->ProcessWidgetIncludes();
> 
>     // Debug Added by Aaron Racicot
>     echo "PRIORITY_MAXIMUM= ".PRIORITY_MAXIMUM."<br>";
>     echo "PRIORITY_MINIMUM= ".PRIORITY_MINIMUM."<br>";
> 
>     //process widgets into template
>     for ($i=PRIORITY_MAXIMUM; $i>=PRIORITY_MINIMUM; $i--)
>     {
>       foreach( $this->manPriorities[$i] as $nWidgetIndex )
>       {
> 	  // Debug Added by Aaron Racicot
>         echo "Loop i= ".$i."   nWidgetIndex= ".$nWidgetIndex."<br>";
> 
>         $oWidget =& $this->maoWidgets[$nWidgetIndex];
>         $this->oCWCParser->SetElement( $nWidgetIndex,
> $oWidget->DrawPublish() );
>       }
>     }
>     $this->oCWCParser->ProcessElements();
> ++++++++++++++ End Code +++++++++++++++++++++++++
> 
> I added some debug output to show the looping indexes and widget index and I
> get the following:
> 
> PRIORITY_MAXIMUM= 5
> PRIORITY_MINIMUM= 0
> Loop i= 4 nWidgetIndex= 12
> Loop i= 3 nWidgetIndex= 17
> Loop i= 2 nWidgetIndex= 0
> Loop i= 2 nWidgetIndex= 1
> Loop i= 2 nWidgetIndex= 2
> Loop i= 2 nWidgetIndex= 3
> Loop i= 2 nWidgetIndex= 4
> Loop i= 2 nWidgetIndex= 5
> Loop i= 2 nWidgetIndex= 9
> Loop i= 2 nWidgetIndex= 13
> Loop i= 2 nWidgetIndex= 14
> Loop i= 2 nWidgetIndex= 15
> Loop i= 2 nWidgetIndex= 16
> Loop i= 2 nWidgetIndex= 18
> Loop i= 2 nWidgetIndex= 19
> 
> At this point I get an error which is from the CWC2OnLoadFunction never
> getting created just after this in the DrawPublish function.  The
> interesting thing is that the index $i never reaches 1 or 0.  
> 
> Does this ring a bell for you?  I am very confused why my installation seems
> to have this problem (which now does not seem to be path or permissions
> related).  Thanks
> 
> Aaron
> 
> Again, my setup is:
> RedHat Enterprise Linux 3.0 AS on Intel Box (2.8gHz,1G,Dual 40G drives)
> Mapserver/Mapscript - 4.0.1 
> Postgresql - 7.4.2 
> Postgis - 0.8.1 
> PHP - 4.3.4 
> Maplab - 2.1-rc3 
> Chameleon 1.1alpha-20031031
> chameleon-sample - From MapTools.org
> 
> 
> -----Original Message-----
> From: chameleon-admin@lists.maptools.org
> [mailto:chameleon-admin@lists.maptools.org] On Behalf Of Jason Fournier
> Sent: Tuesday, March 23, 2004 4:31 PM
> To: Aaron Racicot
> Cc: chameleon@lists.maptools.org
> Subject: Re: [Chameleon] Problem with CWC2OnLoadFunction...
> 
> Hi Aaron,
> 
> Have you tried downloading and installing (ie, unzipping) the Chameleon 
> sample application from Maptools.org 
> (http://maptools.org/chameleon/index.phtml?page=downloads.html)?  It's 
> located at the bottom of the page.  At the very least it will give you 
> an indication of the files required for an application as well as a 
> suggested directory structure. 
> 
> Generally speaking a Chameleon application will reside outside your core 
> Chameleon installation.
> 
> Best Regards,
> Jason
> 

-- 
  -----------------------------------------------------------------
|Paul Spencer                           pspencer@dmsolutions.ca   |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------



This archive was generated by Pipermail.