[Geoprisma-dev] Cleanup the samples

Alexandre Dube adube at mapgears.com
Thu Dec 9 11:40:59 EST 2010


+1 for me too btw.

   I've been playing with this a little and figured that we would need a 
way to put "sample-specific" stuff inside the template.  Here's a way I 
tried and it worked :

   * put a help.html file containing the explanation of the sample 
inside the sample directory.  Its content is pure html only.

   * include it in the template like this :

<xsl:variable name="helpFilePath">
<xsl:value-of 
select="php:functionString('getCurrentSampleDir')"></xsl:value-of>
<xsl:text>/help.html</xsl:text>
</xsl:variable>

                       var help = new Ext.Panel({
                           border: false,
                           html: '<xsl:copy-of 
select="document($helpFilePath)" />',
                           renderTo: Ext.getBody()
                       });

      That basically copy the content of the file and put in a panel 
that is simply rendered in the body.  It requires to have the 
"getCurrentSampleDir" method thought, which looks like this (I put it in 
config.php of the samples directory):

function getCurrentSampleDir() {
     global $g_strCurrentSampleDir;
     return $g_strCurrentSampleDir;
}

   and the sample needs to set it.  That's the only way I found yet to 
access the sample path since the current path "." in the xslt file is 
equal to where the template is, that being "./src/client/templates"

   The template could also have its own .css file to style content from 
the help files in a standard way, pretty much like openlayers and ext 
do.  We could even use one of them.

   Finally, instead of help.html, samples we could have 
"header.inc.html" and "footer.inc.html" to basically put anything you 
want before and after the panel that replaces the viewport (I think of 
titles, simple description on top, more description at bottom, etc.)

   Thoughts ?

Alexandre


On 10-12-09 11:16 AM, Etienne Dube wrote:
> +1. I particularly like the idea of having a plain template that we 
> can reuse in different samples, that would reduce the learning curve 
> of creating a new widget along with its sample.
>
> Etienne
>
>
> On 09/12/2010 9:26 AM, Alexandre Dube wrote:
>> Hi,
>>
>>   I'd like to work on this ticket on my spare times :
>> http://trac.osgeo.org/geoprisma/ticket/159
>>
>>   Before I begin, I'd like to know if anyone is against the idea.  
>> Basically, I'd do (in that order) :
>>
>>   * Create a new template I'd put in the src/client/templates 
>> directory that every sample could use.   It would look like the extjs 
>> and geoext samples (no viewport, plain text explaining the features 
>> shown in the sample, etc.)
>>
>>   * Remove all samples showing deprecated widgets
>>
>>   * Remove all samples showing multiple widgets at a time (BDGA, 
>> sample1, etc.).  Replace them if they were the only ones showing 
>> specific widgets.
>>
>>   * Remove all samples including mapfish (mapfish-client and all its 
>> widgets)
>>
>> Thanks for any feedback,
>>
>
>


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Geoprisma-dev mailing list