[Chameleon] Creating new widgets - Please help me

Normand Savard nsavard at mapgears.com
Thu Oct 26 16:37:33 EDT 2006


Ines wrote:

>Hello, I'm trying to make a new widget because I need to make a special
>widget for my application. I'm tying to make a new widget from the tutorial
>but it have some errors in the code, so I can´t make the widget for try to
>make my first widget. I'm new making widgets and chameleon applications.
>
>I'm trying to make the widget with this tutorial:
>http://chameleon-tiki.maptools.org/tiki-index.php?page=Developing+a+new+Cham
>eleon+Widget
>
>Do any body have some code without errors than can help me? It is very new
>for me and I don´t understand very much.
>
>When I can create the new widget I have to make another function for this,
>but I can't still make the first step (create the widget) for try.
>
>  
>
Ines,

You need to do the corrections below in order for the tutorial to work.

Norm

You need to change the maturity level to alpha of the application by 
going into "http://myserver/chameleon/admin/main.phtml" page in your 
browser.

The code in step 13 shoud be modify to:



        // show the report
        $szShowReport = strlen( $this->mszReport ) > 
0?"alert('".$this->mszReport."')":"";
        $szJsFunctionName = "showReport";
        $szFunction = <<<EOT
function {$szJsFunctionName}()
{
    {$szShowReport};
    return true;
                }
EOT;
        $aReturn[$szJsFunctionName] = $szFunction;

WATCH OUT, there must be no space in front of the function block.  It 
means the function block must have no indentation.

The code in step 15 should be modify to:

        // show report
        $aReturn['showReport'] = "showReport();\n";


The code in step 21 should be modify to:

        // add attributes
        $this->maAttributes['COORDS'] =
            new StringAttribute( 'COORDS', true, array( 
'pix','geo','both' ) );
        $this->maAttributes['LAYERSTATUS'] =
            new BooleanAttribute( 'LAYERSTATUS', false );

The code in step 22 should be modify to:

        // set the values from the attributes
        $this->mszCoords = isset( $this->maParams['COORDS'] )?

            $this->maParams['COORDS'] : '';
        $this->mbLayerStatus = isset( $this->maParams['LAYERSTATUS'] ) &&
            $this->maParams['LAYERSTATUS'] == "true";
        // end InitDefaults function.

Their is a mispelling in the code of step 24.    'cords="pix" ' must be 
changed to 'coords="pix"








More information about the Chameleon mailing list