try the following in the file layerselect.js from the plugin direcorry: after createTree: function() { this.root = PM.ini.pluginsConfig.layerselect.categories.category;
add if (! $.isArray(this.root)) { this.root = [PM.ini.pluginsConfig.layerselect.categories.category]; } On the other hand I do not know what's the use of categories if there's only 1... armin On 21/02/2012 16:48, Serge Claudio Rafanoharana wrote: > Dear Armin, > > I just found out that for the layerselect plugin, if we only have one > category, the plugin won't work correctly. > > For example if we have: > > <categories> > <category name="cat_admin"> > <group>countries</group> > <group>cities10000eu</group> > <group>rivers</group> > <group>dem</group> > <group>jpl_wms_global_mosaic</group> > </category> > </categories> > > We'll have a problem (it creates a new undefined layer group). > > > It should be at least two categories like: > > <categories> > <category name="cat_admin"> > <group>countries</group> > <group>cities10000eu</group> > <group>rivers</group> > </category> > <category name="cat_admin"> > <group>dem</group> > <group>jpl_wms_global_mosaic</group> > </category> > </categories> > > Cheers, > Serge > > > On Sat, Oct 29, 2011 at 5:35 PM, Rafanoharana Serge Claudio > <rafanohar...@gmail.com <mailto:rafanohar...@gmail.com>> wrote: > > Dear Armin, > > My apologies for the very late reply... It is working very well... > great... > > Regards, > > Serge > > > > > On Thu, Sep 22, 2011 at 2:01 AM, Armin Burger > <armin.bur...@gmail.com <mailto:armin.bur...@gmail.com>> wrote: > > Serge > > I guess you mean that there's a problem if the category defined > under > <pluginsConfig> > <layerselect> > > just contains 1 group. I noticed this now, probably never before > because > I had always more than 1 layer/group defined for the layerselect. > > The problem is due to the way PHP parses XML, if there are 2 or more > entries <group> then they are placed inside an *array*, if it's > a single > entry then it's a *string*. Therefore also the strange splitting > up of > the group name into each character because an array is expected, > and if > it's a string it is treated as array of characters. > > I added a patch for this on SVN trunk, > => http://svn.pmapper.net/trac/changeset/1213 > > please download the new file here > > > http://svn.pmapper.net/trac/export/1213/trunk/pmapper/plugins/layerselect/layerselect.js > > Let me know if it works then. > > Armin > > > On 22/09/2011 04:08, Rafanoharana Serge Claudio wrote: > > Dear Armin, > > > > I got it. I did not deactivate the cookies for session in > php.ini but I > > replaced the .js file. > > At first I got 500 internal Server Error and I tried to > figure out if there > > was any wrong configuration but everything seemed to be ok. > Then I just > > restarted my laptop and then it was resolved. > > > > For information, I just want to specify that the plugin will > work correctly > > if: > > - the layers/groups are used together with category definitions > > <map> > > <categories> > > (you have already mentioned it) > > > > but I want to add that > > - the group under the category sould be more than one > > <map> > > <categories> > > <category> > > <group>group1</group> > > <group>group2</group> > > ...... > > > > If only one group is declared, the layer will disappear once > we do an > > update. > > > > > > Again, thank you, > > > > Serge > > > > > > > > On Wed, Sep 21, 2011 at 2:09 PM, Armin > Burger<armin.bur...@gmx.net <mailto:armin.bur...@gmx.net>> wrote: > > > >> First: > >> deactivate cookies for session handling in php.ini > >> > >> if it still does not help: > >> replace the *.js file in plugins/layerselect/ with the one > from here > >> > >> > > http://svn.pmapper.net/trac/export/1212/trunk/pmapper/plugins/layerselect/layerselect.js > >> > >> this should in principal not be necessary since for me it > works also > >> with thenold file, but who knows... > >> > >> empty cache and cookies in your browser before reloading and > trying again. > >> > >> > >> armin > >> > >> On 21/09/2011 22:01, Rafanoharana Serge Claudio wrote: > >>> Dear Armin, > >>> > >>> I found out that there was one comma missing. > >>> I still have error with the plugin. > >>> > >>> In my config.xml, I have: > >>> > >>> > >>> <pmapper> > >>> <ini> > >>> <pmapper> > >>> ..... > >>> <plugins>layerselect</plugins> > >>> </pmapper> > >>> ... > >>> ... > >>> <map> > >>> ... > >>> <categories> > >>> <category name="cat_pot"> > >>> <group>potential</group> > >>> </category> > >>> > >>> <category name="cat_pos"> > >>> <group>road</group> > >>> <group>river</group> > >>> ... > >>> </category> > >>> ... > >>> </map> > >>> ... > >>> > >>> <pluginsConfig> > >>> ... > >>> <layerselect> > >>> <categories> > >>> <category name="cat_pot"> > >>> <group>potential</group> > >>> > >>> </category> > >>> > >>> <category name="cat_pos"> > >>> <group>road</group> > >>> <group>river</group> > >>> ... > >>> </category> > >>> > >>> </categories> > >>> </layerselect> > >>> </pluginsConfig> > >>> ... > >>> > >>> I comment and uncomment the<allGroups> but no success. > >>> > >>> > >>> When I click the Layer button/link, I obtain a dialog box > with the error: > >>> > >>> Group "p" is not defined correctly in<categories>. Check > config XML! > >>> > >>> When I click OK, it goes to the next character which is o > >>> > >>> Group "o" is not defined correctly in<categories>. Check > config XML! > >>> > >>> .... all characters from "p o t e n t i a l", then the next > group "r o a > >> d" > >>> then "r i v e r" ...... > >>> > >>> > >>> Thank you for your help, > >>> > >>> Serge > >>> > >>> > >>> > >>> On Sat, Sep 17, 2011 at 2:18 AM, Armin > Burger<armin.bur...@gmail.com <mailto:armin.bur...@gmail.com> > >>> wrote: > >>> > >>>> please run some JavaScript debugging (see Wiki -> FAQ), > I would guess > >>>> there is a comma missing or one too much. > >>>> > >>>> In any case, I found out a misleading description in the > Readme.txt > >>>> (changed and committed to SVN trunk), There is a special > requirement for > >>>> the XML config file: > >>>> > >>>> The plugin only works correctly if: > >>>> - the layers/groups are used together with category > definitions > >>>> <map> > >>>> <categories> > >>>> - there is no entry for > >>>> <map> > >>>> <allGroups> > >>>> > >>>> So comment out the<allGroups> tag for testing the plugin. > >>>> > >>>> armin > >>>> > >>>> > >>>> On 17/09/2011 00:41, Rafanoharana Serge Claudio wrote: > >>>>> Dear Armin, > >>>>> > >>>>> I set up the layerselect plugin but I have errors. > >>>>> When I load the page, I got a warning: > >>>>> > >>>>> "Warning: array_key_exists() expects parameter 2 to be > array, null give > >>>> in > >>>>> C:\ms4w\apps\web\incphp\init\initmap.php on line 154 > Warning: Invalid > >>>>> argument supplied for foreach() in > >>>> C:\ms4w\apps\web\incphp\init\initmap.php > >>>>> on line 158" > >>>>> > >>>>> first before the page is loaded. I checked but cannot > figure it out. > >>>>> > >>>>> Then the page is loaded but the loading bar is always > there, the tool > >>>> link > >>>>> element is blank, and the layers and legends are blank. > >>>>> Only the map (always loading) and the reference map are > present. > >>>>> > >>>>> What I did are: > >>>>> - Enable the plugin by adding a line in config_XXXXX.xml file > >>>>> <plugins>layerselect</plugins> > >>>>> > >>>>> - Add the corresponding tool (Tool link elements) > >>>>> {linkid:'layers', name:'Layers', > run:'PM.Plugin.Layerselect.openDlg', > >>>>> imgsrc:'layers-bw.png'} > >>>>> > >>>>> - Specify categories and groups in config_XXXXX.xml file > >>>>> <pmapper> > >>>>> <ini> > >>>>> ... > >>>>> <pluginsConfig> > >>>>> ... > >>>>> <layerselect> > >>>>> <categories> > >>>>> <category name=... > >>>>> <group>.......... > >>>>> ........... > >>>>> </pmapper> > >>>>> > >>>>> I think the problem is from the Tool link elements > because when I > >> comment > >>>>> it, everything works perfectly (but without the tools) > >>>>> > >>>>> Any idea or did I miss something? > >>>>> > >>>>> Thank you, > >>>>> > >>>>> Serge > >>>>> > >>>>> > >>>> > >>>> > >>>> > >> > > ------------------------------------------------------------------------------ > >>>> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > >>>> http://p.sf.net/sfu/rim-devcon-copy2 > >>>> _______________________________________________ > >>>> pmapper-users mailing list > >>>> pmapper-users@lists.sourceforge.net > <mailto:pmapper-users@lists.sourceforge.net> > >>>> https://lists.sourceforge.net/lists/listinfo/pmapper-users > >>>> > >>> > >>> > >>> > >> > >> > >> > > ------------------------------------------------------------------------------ > >> All the data continuously generated in your IT > infrastructure contains a > >> definitive record of customers, application performance, > security > >> threats, fraudulent activity and more. Splunk takes this > data and makes > >> sense of it. Business sense. IT sense. Common sense. > >> http://p.sf.net/sfu/splunk-d2dcopy1 > >> _______________________________________________ > >> pmapper-users mailing list > >> pmapper-users@lists.sourceforge.net > <mailto:pmapper-users@lists.sourceforge.net> > >> https://lists.sourceforge.net/lists/listinfo/pmapper-users > >> > > > > > > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure > contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data > and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > pmapper-users mailing list > pmapper-users@lists.sourceforge.net > <mailto:pmapper-users@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/pmapper-users > > > > > -- > Serge > > > > > -- > Serge ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ pmapper-users mailing list pmapper-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pmapper-users