Index: /extensions/GMaps/admin/gmaps_category_maps.tpl
===================================================================
--- /extensions/GMaps/admin/gmaps_category_maps.tpl	(revision 7138)
+++ /extensions/GMaps/admin/gmaps_category_maps.tpl	(revision 7139)
@@ -28,5 +28,5 @@
             autoOpen:false,
             width:800,
-            height:450,
+            height:465,
             modal: true,
             dialogClass: 'gcBgTabSheet gcBorder',
@@ -50,6 +50,24 @@
       $('#iBDAssocMapId').bind('change', changeMapDisplayType);
       $('[name=fBDAssocKmlFile]').bind('change', changeKmlFileSource);
+      $('#iBDAssocIcon').bind('change', changeIcon);
+      $('#iBDAssocMarker').bind('change', changeMarker);
 
       loadList();
+    }
+
+    /**
+     * called when the icon is changed
+     */
+    var changeIcon = function ()
+    {
+      $('#iBDAssocIcon').attr('style', $('#iBDAssocIcon option:selected').attr('style')).blur();
+    }
+
+    /**
+     * called when the marker is changed
+     */
+    var changeMarker = function ()
+    {
+      $('#iBDAssocMarker').attr('style', $('#iBDAssocMarker option:selected').attr('style')).blur();
     }
 
@@ -225,4 +243,5 @@
         $('#iBDAssocKmlFileUrl').val('');
         $('#iBDAssocIcon').val($('#iBDAssocIcon option:first').val());
+        $('#iBDAssocMarker').val($('#iBDAssocMarker option:first').val());
         $('#iBDAssocTitle').val('');
       }
@@ -249,4 +268,5 @@
         $('#iBDAssocKmlFileUrl').val(tmp.kmlFileUrl);
         $('#iBDAssocIcon').val(tmp.icon);
+        $('#iBDAssocMarker').val(tmp.marker);
         $('#iBDAssocTitle').val(tmp.title);
       }
@@ -254,4 +274,6 @@
       changeMapDisplayType();
       changeKmlFileSource();
+      changeIcon();
+      changeMarker();
     }
 
@@ -313,4 +335,5 @@
         kmlFileUrl:($('#iBDAssocKmlSelect').attr('checked'))?'':$('#iBDAssocKmlFileUrl').val(),
         icon:$('#iBDAssocIcon').val(),
+        marker:$('#iBDAssocMarker').val(),
         title:$('#iBDAssocTitle').val(),
       }
@@ -430,5 +453,5 @@
               <select id='iBDAssocCatId'>
                   {foreach from=$datas.cats item=cat}
-                    <option value='{$cat.id}'>{$cat.name}</option>
+                    <option value='{$cat.id}' style='padding-left:{$cat.level*12}px;font-size:{$cat.level*-4+130}%;'>{$cat.name}</option>
                   {/foreach}
               </select>
@@ -465,9 +488,23 @@
               <select id='iBDAssocIcon'>
                   {foreach from=$datas.icons item=icon}
-                    <option class='{$icon.type}' value='{$icon.file}'>{$icon.file}</option>
+                    <option style='background-image:url(plugins/GMaps/img/{$icon.file});' value='{$icon.file}'></option>
                   {/foreach}
               </select>
-            </td>
-          </tr>
+              <p id='iBDKmlIconWarning' class='helps' style="width:520px;padding-right:20px;">{'gmaps_icon_info'|@translate}</p>
+            </td>
+          </tr>
+
+
+          <tr>
+            <td>{'gmaps_map_marker'|@translate}</td>
+            <td>
+              <select id='iBDAssocMarker'>
+                  {foreach from=$datas.markers item=marker}
+                    <option style='background-image:url(plugins/GMaps/img/{$marker.file});' value='{$marker.file}'></option>
+                  {/foreach}
+              </select>
+            </td>
+          </tr>
+
 
           <tr>
Index: /extensions/GMaps/gmaps.css
===================================================================
--- /extensions/GMaps/gmaps.css	(revision 7138)
+++ /extensions/GMaps/gmaps.css	(revision 7139)
@@ -56,9 +56,4 @@
 }
 
-#iBDAssocCatId, #iBDAssocMapId {
-  font-family:monospace;
-  font-size:125%;
-}
-
 #iDialogGMapNfo {
   height:18px;
@@ -78,2 +73,27 @@
   filter:alpha(opacity:55);
 }
+#iBDAssocIcon, #iBDAssocIcon option {
+  height:34px;
+  background-repeat:no-repeat;
+  background-position:2px 2px;
+}
+#iBDAssocIcon {
+  width:75px;
+  padding-left:50px;
+}
+#iBDAssocIcon option {
+  width:75px;
+}
+
+#iBDAssocMarker, #iBDAssocMarker option {
+  background-position:2px 2px;
+  background-repeat:no-repeat;
+  height:40px;
+}
+#iBDAssocMarker {
+  width:60px;
+  padding-left:40px;
+}
+#iBDAssocMarker option {
+  width:40px;
+}
Index: /extensions/GMaps/gmaps_aip.class.inc.php
===================================================================
--- /extensions/GMaps/gmaps_aip.class.inc.php	(revision 7138)
+++ /extensions/GMaps/gmaps_aip.class.inc.php	(revision 7139)
@@ -27,4 +27,5 @@
   {
     parent::__construct($prefixeTable, $filelocation);
+
     $this->loadConfig();
     $this->configForTemplate();
@@ -36,5 +37,4 @@
 
     $this->tabsheet = new tabsheet();
-
 
     if($this->amdState!='advanced')
@@ -231,7 +231,8 @@
     $datas=Array(
       'urlRequest' => $this->getAdminLink('ajax'),
-      'cats' => $this->makeCategoriesTree(),
+      'cats' => $this->makeCategoryList(),
       'maps' => $this->makeMapsList(),
       'icons' => $this->makeIconsList(),
+      'markers' => $this->makeMarkersList(),
       'kmlFiles'  => $this->makeKmlFilesList()
     );
@@ -322,34 +323,90 @@
 
 
-  /**
-   * build the categories tree
-   * @return Array : an array, ready to use in the template
-   */
-  private function makeCategoriesTree()
+
+  /**
+   * build an ordered category list
+   * returns an array, each item is an array like :
+   *  'id'     => the category Id
+   *  'name'   => the category name
+   *  'rank'   => the category rank (global)
+   *  'level'  => the category level
+   *
+   * @return Array : the list
+   */
+  protected function makeCategoryList()
   {
     $returned=array(
       array(
-        'id' => 0,
-        'name' => '-- '.l10n('gmaps_applyForAllTheGallery').' --'
+        'id'     => 0,
+        'name'   => l10n('gmaps_applyForAllTheGallery'),
+        'rank'   => '0000',
+        'level'  => 0,
+        'status' => 'public',
+        'childs'  => false
       )
     );
 
-    $sql="SELECT id, name, global_rank
-          FROM ".CATEGORIES_TABLE."
-          ORDER BY global_rank";
-    $result = pwg_query($sql);
+    $sql="SELECT DISTINCT pct.id, pct.name, pct.global_rank AS rank
+          FROM ".CATEGORIES_TABLE." pct
+            JOIN (
+              SELECT DISTINCT pgat.cat_id AS catId FROM ".GROUP_ACCESS_TABLE." pgat
+              UNION DISTINCT
+              SELECT DISTINCT puat.cat_id AS catId FROM ".USER_ACCESS_TABLE." puat
+                 ) pat
+            ON (pat.catId = pct.id AND pct.status = 'private') OR (pct.status = 'public')
+          ORDER BY global_rank;";
+    $result=pwg_query($sql);
     if($result)
     {
-      while ($row = pwg_db_fetch_assoc($result))
+      while($row=pwg_db_fetch_assoc($result))
       {
-        $returned[]=array(
-          'id' => $row['id'],
-          'name' => str_repeat('&nbsp;&nbsp;', substr_count($row['global_rank'], '.')).$row['name']
-        );
+        $row['level']=1+substr_count($row['rank'], '.');
+
+        /* rank is in formated without leading zero, giving bad order
+         *  1
+         *  1.10
+         *  1.11
+         *  1.2
+         *  1.3
+         *  ....
+         *
+         *  this loop cp,vert all sub rank in four 0 format, allowing to order
+         *  categories easily
+         *  0001
+         *  0001.0010
+         *  0001.0011
+         *  0001.0002
+         *  0001.0003
+         */
+        $row['rank']=explode('.', $row['rank']);
+        foreach($row['rank'] as $key=>$rank)
+        {
+          $row['rank'][$key]=str_pad($rank, 4, '0', STR_PAD_LEFT);
+        }
+        $row['rank']=implode('.', $row['rank']);
+
+        $returned[]=$row;
       }
     }
 
+    usort($returned, array(&$this, 'compareCat'));
+
     return($returned);
-  } //makeCategoriesTree
+  }
+
+  /**
+   * used for sort comparison
+   * defined as public, but don't use it directly
+   *
+   * this function compare two categorie with their rank value
+   */
+  public function compareCat($catA, $catB)
+  {
+    if($catA['rank'] == $catB['rank'])
+    {
+      return(0);
+    }
+    return( ($catA['rank'] < $catB['rank'])?-1:1 );
+  }
 
 
@@ -400,5 +457,4 @@
       {
         $returned[]=array(
-          'type' => (strtolower(substr($file,0,1))=='i')?'img':'other',
           'file' => $file
         );
@@ -409,4 +465,27 @@
   } //makeIconsList
 
+
+  /**
+   * build the markers list
+   * @return Array : an array, ready to use in the template
+   */
+  private function makeMarkersList()
+  {
+    $returned=array();
+
+    $directory=scandir(GMAPS_PATH.'img/');
+    foreach($directory as $file)
+    {
+      $ext=(pathinfo($file, PATHINFO_EXTENSION));
+      if(preg_match('/^mS(\d\d)_(\d\d)\.png$/i', $file))
+      {
+        $returned[]=array(
+          'file' => $file
+        );
+      }
+    }
+
+    return($returned);
+  } //makeIconsList
 
   /**
Index: /extensions/GMaps/gmaps_ajax.php
===================================================================
--- /extensions/GMaps/gmaps_ajax.php	(revision 7138)
+++ /extensions/GMaps/gmaps_ajax.php	(revision 7139)
@@ -206,4 +206,5 @@
                  isset($_REQUEST['datas']['kmlFileUrl']) &&
                  isset($_REQUEST['datas']['icon']) &&
+                 isset($_REQUEST['datas']['marker']) &&
                  isset($_REQUEST['datas']['title']) ))
             {
@@ -664,4 +665,5 @@
                 $properties['kmlFileUrl']."', '".
                 $properties['icon']."', '".
+                $properties['marker']."', '".
                 mysql_escape_string($properties['title'])."');";
         $result=pwg_query($sql);
@@ -677,5 +679,6 @@
                 $properties['kmlFileUrl']."', kmlFileId='".
                 $properties['kmlFileId']."', icon='".
-                $properties['icon']."', title='".
+                $properties['icon']."', marker='".
+                $properties['marker']."', title='".
                 mysql_escape_string($properties['title'])."'
               WHERE id='$id';";
@@ -705,9 +708,10 @@
         'kmlFileUrl' => '',
         'icon' => '',
+        'marker' => '',
         'title' => ''
       );
 
       $sql="SELECT id, categoryId, mapId, applySubCat, kmlFileId, kmlFileUrl,
-                   icon, title
+                   icon, marker, title
             FROM ".$this->tables['category_maps']."
             WHERE id='$id';";
Index: /extensions/GMaps/gmaps_install.class.inc.php
===================================================================
--- /extensions/GMaps/gmaps_install.class.inc.php	(revision 7138)
+++ /extensions/GMaps/gmaps_install.class.inc.php	(revision 7139)
@@ -72,4 +72,5 @@
   `kmlFileUrl` varchar(255) NOT NULL,
   `icon` varchar(255) NOT NULL,
+  `marker` varchar(255) NOT NULL,
   `title` varchar(200) NOT NULL,
   PRIMARY KEY  (`id`),
Index: /extensions/GMaps/gmaps_pip.class.inc.php
===================================================================
--- /extensions/GMaps/gmaps_pip.class.inc.php	(revision 7138)
+++ /extensions/GMaps/gmaps_pip.class.inc.php	(revision 7139)
@@ -167,5 +167,5 @@
                 id:'iGMapsIcon',
                 zoomLevel:".$map['zoomLevel'].",
-                marker:true,
+                markerImg:'".$map['marker']."',
                 mapType:'".$map['mapType']."',
                 mapTypeControl:'".$map['mapTypeControl']."',
@@ -369,5 +369,5 @@
         id:'iGMaps".(($map['displayType']=='IP')?'Icon':$map['id'])."',
         zoomLevel:".$map['zoomLevel'].",
-        marker:true,
+        markerImg:'".$map['marker']."',
         mapType:'".$map['mapType']."',
         mapTypeControl:'".$map['mapTypeControl']."',
Index: /extensions/GMaps/gmaps_root.class.inc.php
===================================================================
--- /extensions/GMaps/gmaps_root.class.inc.php	(revision 7138)
+++ /extensions/GMaps/gmaps_root.class.inc.php	(revision 7139)
@@ -204,5 +204,5 @@
       $sql="SELECT DISTINCT pgcm.id, pgcm.categoryId,
               pgcm.imgSort, pgcm.applySubCat, pgcm.kmlFileUrl, pgcm.kmlFileId, pgkf.file AS kmlFileUrlId,
-              pgcm.icon, pgcm.title,
+              pgcm.icon, pgcm.title, pgcm.marker,
               pgmm.displayType, pgmm.sizeMode,
               pgmm.width, pgmm.height, pgmm.zoomLevel,
Index: /extensions/GMaps/img/index.php
===================================================================
--- /extensions/GMaps/img/index.php	(revision 7139)
+++ /extensions/GMaps/img/index.php	(revision 7139)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/GMaps/js/gmapsCategory.js
===================================================================
--- /extensions/GMaps/js/gmapsCategory.js	(revision 7138)
+++ /extensions/GMaps/js/gmapsCategory.js	(revision 7139)
@@ -1,4 +1,13 @@
 
 var currentMapLoad;
+var markerImgProp = [
+  null,
+  { w:32, h:32, x:15, y:31 }, // s01
+  { w:32, h:32, x:15, y:31 }, // s02
+  { w:32, h:32, x:10, y:31 }, // s03
+  { w:30, h:40, x:4, y:39 }, // s04
+];
+
+
 
 /**
@@ -39,4 +48,20 @@
   {
     kmlFile=null;
+  }
+
+  re=/^mS(\d\d)_.*/i;
+  iM=re.exec(properties.markerImg);
+  if(iM!=null) iM=new Number(iM[1]);
+
+  if(iM!=null)
+  {
+    map.markerImg = new google.maps.MarkerImage('plugins/GMaps/img/'+properties.markerImg,
+        new google.maps.Size(markerImgProp[iM].w, markerImgProp[iM].h),
+        new google.maps.Point(0,0),
+        new google.maps.Point(markerImgProp[iM].x, markerImgProp[iM].y));
+  }
+  else
+  {
+    map.markerImg = null;
   }
 
@@ -149,4 +174,6 @@
     );
 
+    if(map.markerImg!=null) marker.setIcon(map.markerImg);
+
     marker.info=markers[i];
     marker.info.displayed=0;
Index: /extensions/GMaps/js/gmapsPicture.js
===================================================================
--- /extensions/GMaps/js/gmapsPicture.js	(revision 7138)
+++ /extensions/GMaps/js/gmapsPicture.js	(revision 7139)
@@ -4,4 +4,12 @@
   meta:false
 };
+var markerImgProp = [
+  null,
+  { w:32, h:32, x:15, y:31 }, // s01
+  { w:32, h:32, x:15, y:31 }, // s02
+  { w:32, h:32, x:10, y:31 }, // s03
+  { w:30, h:40, x:4, y:39 }, // s04
+];
+
 
 function applyMap(properties)
@@ -26,14 +34,30 @@
   );
 
-  if(properties.marker)
-  {
-    var marker = new google.maps.Marker(
-      {
-        position:latlng,
-        map: map,
-        title:properties.markerTitle
-      }
-    );
-  }
+
+  var marker = new google.maps.Marker(
+    {
+      position:latlng,
+      map: map,
+      title:properties.markerTitle
+    }
+  );
+
+
+  re=/^mS(\d\d)_.*/i;
+  iM=re.exec(properties.markerImg);
+  if(iM!=null) iM=new Number(iM[1]);
+
+  if(iM!=null)
+  {
+    var markerImg = new google.maps.MarkerImage('plugins/GMaps/img/'+properties.markerImg,
+        new google.maps.Size(markerImgProp[iM].w, markerImgProp[iM].h),
+        new google.maps.Point(0,0),
+        new google.maps.Point(markerImgProp[iM].x, markerImgProp[iM].y));
+    marker.setIcon(markerImg);
+  }
+
+
+
+
 
   if(properties.kmlFileUrl!='')
Index: /extensions/GMaps/js/index.php
===================================================================
--- /extensions/GMaps/js/index.php	(revision 7139)
+++ /extensions/GMaps/js/index.php	(revision 7139)
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery                           |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
+// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
+// | last modifier : $Author: rub $
+// | revision      : $Revision: 1912 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/GMaps/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/GMaps/language/fr_FR/plugin.lang.php	(revision 7138)
+++ /extensions/GMaps/language/fr_FR/plugin.lang.php	(revision 7139)
@@ -156,6 +156,8 @@
 $lang['gmaps_kml_file_none']="Aucun";
 
-$lang['gmaps_kml_file_access']="Les fichiers KML/KMZ doivent, pour pouvoir être affichés sur une carte, être accessibles par les serveurs de Google";
+$lang['gmaps_kml_file_access']="Les fichiers KML/KMZ doivent, pour pouvoir être affichés sur une carte, être accessibles par les serveurs de Google.";
+$lang['gmaps_icon_info']="Si le thème dispose d'une icône aux mêmes dimensions que celle sélectionnée, elle sera appliquée en priorité.";
 
+$lang['gmaps_map_marker']="Aspect du marqueur";
 
 ?>
