[Chameleon] popupcss shareattribute broken?

Paul Spencer pspencer at dmsolutions.ca
Thu Jan 13 22:10:49 EST 2005


Ken-ichi

Ken-ichi wrote:
> Hey Paul.  Thanks for looking into this.  When I get rid of the 
> ErrorReport widget, the warning goes away.  However, there are still 2 
> problems:
> 
> 1) LayerManager seems to disregard my popup css entirely, instead 
> linking to the one in the default skin.  I take it this is because 
> LayerManager is its own little Chameleon app, but is there a way around 
> this?

not currently.  This actually kinda sucks and I don't like how it works. 
  The same problem exists with the WMSBrowser widget.

> 
> 2) The path to the stylesheet is successfully changed in the Query 
> popup, but it's an absolute system path regardless of how I refer to it 
> in my template.  So for instance if I use
> 
> <cwc2 type="SharedResource" name="PopupCSS" value="css/popup.css"/>
> 
> it will output
> 
> <link href="/home/myaccount/www/skin/css/popup.css" rel="stylesheet" 
> type="text/css">
> 
> And when I try
> 
> <cwc2 type="SharedResource" name="PopupCSS" 
> value="/~myaccount/skin/css/popup.css"/>
> 
> it just leaves the href blank.  Is this another bug or am I not reading 
> the docs correctly?

it could be a bug.  It should be outputting a URL rather than a path. 
The code uses a function called fileSystemToURL to convert a filesystem 
path to a URL.  This function relies on the file being somewhere within 
the web-accessible portion of your application.  So if your index.phtml 
file is in:

myapp/htdocs/index.phtml

then the first version (above) *should* find the file in

myapp/htdocs/css/popup.css

and convert that to http://server/myapp/css/popup.css.

This is obviously not happening.  Symlinks may be confusing it.  I think 
the code in Popup.php can be changed on line 157 to read:

$szPopupCSS = $oApp->fileSystemToURL( $szPopupCSS, true );

by adding the true parameter to the fileSystemToURL call.  The second 
parameter effectively forces a non-web-accessible file to be 
web-accessible by copying it to the ms_tmp directory first and then 
calculating the path from there.

I am hesitant to make this change in cvs until I have done some testing 
on this to figure out if this can be replicated.

Cheers,

Paul

> 
> -Ken-ichi
> 
> 
> Paul Spencer wrote:
> 
>> Opps.  The issue here is that Chameleon will now emit warnings if you 
>> use invalid attributes in widgets.  In this case, VALUE is not 
>> declared as an official attribute of the SharedResource widget, hence 
>> the warning.  However, the Popup.php code assumes that value is set.  
>> Right now, if you didn't include an errorreport widget, all would work 
>> wonderfully and you just wouldn't see the warning.
>>
>> The quick fix is to add the VALUE attribute to SharedResource.  I'm 
>> not sure if that is the right fix, however.  I'll give it some thought 
>> and commit a fix shortly.
>>
>> recorded in http://www.maptools.org/bugzilla/show_bug.cgi?id=925
>>
>> Cheers
>>
>> Paul
>>
>> Ken-ichi wrote:
>>
>>> Hi all.  I'm trying to set the PopupCSS SharedResource like this
>>>
>>> <cwc2 type="SharedResource" name="PopupCSS" 
>>> value="/absolute/or/relative/path/to/popup.css"/>
>>>
>>> but I get this warning
>>>
>>> WARNING: following attributes are invalid for a sharedresource 
>>> widget: VALUE. The widget tag was: <cwc2 type="SharedResource" 
>>> name="PopupCSS" value="/absolute/or/relative/path/to/popup.css"/>
>>>
>>> I'm running Chameleon 2.0.  Was the syntax for this changed for 2.0, 
>>> or am I missing something?
>>>
>>> Thanks.
>>>
>>> -Ken-ichi
>>> _______________________________________________
>>> Chameleon mailing list
>>> Chameleon at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/chameleon
>>>
>>
> 
> 

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


More information about the Chameleon mailing list