Index: tensions/AMetaData/admin/amd_database.tpl
===================================================================
--- /extensions/AMetaData/admin/amd_database.tpl	(revision 5079)
+++ 	(revision )
@@ -1,252 +1,0 @@
-{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
-{known_script id="jquery.ui.slider" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.slider.packed.js"}
-{known_script id="jquery.ui.dialog" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.dialog.packed.js"}
-
-{literal}
-<style>
- .ui-slider {
-    width:350px;
-    height:10px;
-    border:1px solid;
-    margin-left:10px;
-  }
- .ui-slider-handle {
-    width:12px;
-    height:12px;
-    position:relative;
-    top:-2px;
-    border:1px solid;
-    background:#cccccc;
-  }
-</style>
-
-<script type="text/javascript">
-
-  function init()
-  {
-    formatNbItemPerRequest({/literal}{$datas.NumberOfItemsPerRequest}{literal});
-    $("#iamd_nb_item_per_request_slider").slider(
-      {
-        min:5,
-        max:150,
-        steps:29,
-        startValue:{/literal}{$datas.NumberOfItemsPerRequest}{literal},
-        slide: function(event, ui) { formatNbItemPerRequest(ui.value); }
-      }
-    );
-    getStatus();
-  }
-
-  function formatNbItemPerRequest(nbItems)
-  {
-    $("#iamd_NumberOfItemsPerRequest").val(nbItems);
-    $("#iamd_nb_item_per_request_display").html(nbItems);
-  }
-
-  function getStatus()
-  {
-    data=$.ajax(
-      {
-        type: "POST",
-        url: "{/literal}{$datas.urlRequest}{literal}",
-        async: false,
-        data: { ajaxfct:"makeStatsGetStatus" }
-      }
-    ).responseText;
-
-    list=data.split(";");
-    $("#ianalyzestatus").html("<ul><li>"+list[0]+"</li><li>"+list[1]+"</li><li>"+list[2]+"</li></ul>");
-  }
-
-  function doAnalyze()
-  {
-    $("body").css("cursor", "wait");
-
-    mode="all";
-    modeLabel="{/literal}{'g003_analyze_all_pictures'|@translate}{literal}";
-    if($("#ianalyze_action0").get(0).checked)
-    {
-      mode="notAnalyzed";
-      modeLabel="{/literal}{'g003_analyze_not_analyzed_pictures'|@translate}{literal}";
-    }
-
-    doAnalyze="<br><form id='iDialogProgress' class='formtable'>"+
-      "<div id='iprogressbar_contener'>"+
-      "<span id='iprogressbar_bg' style='width:0%;'>&nbsp;</span>"+
-      "<span id='iprogressbar_fg'>0%</span>"+
-      "</div>{/literal}{'g003_analyze_in_progress'|@translate}{literal}</form>";
-
-    $("#dialog")
-    .html("")
-    .dialog(
-      {
-        resizable: false,
-        width:480,
-        height:120,
-        modal: true,
-        draggable:false,
-        title: '{/literal}{"g003_updating_metadata"|@translate}{literal}&nbsp;('+modeLabel+')',
-        overlay:
-        {
-          backgroundColor: '#000',
-          opacity: 0.5,
-        }
-      }
-    ).html(doAnalyze);
-
-    NumberOfItemsPerRequest=$("#iamd_NumberOfItemsPerRequest").val();
-
-    $.ajax(
-      {
-        type: "POST",
-        url: "{/literal}{$datas.urlRequest}{literal}",
-        async: false,
-        data: { ajaxfct:"makeStatsGetList", selectMode:mode, numOfItems:NumberOfItemsPerRequest },
-        success: function(msg)
-          {
-            doStep_getList(msg);
-          },
-        error: function()
-          {
-            alert('error');
-          }
-      }
-    );
-  }
-
-
-  function displayTime(eTime)
-  {
-    seconds=(eTime%60).toFixed(2);
-    minutes=((eTime-seconds)/60).toFixed(0);
-    returned=seconds+"s";
-    if(minutes>0) returned=minutes+"m"+returned;
-    return(returned);
-  }
-
-  function doStep_getList(data)
-  {
-    timeStart = new Date();
-    list=data.split(";");
-    for(i=0;i<list.length-1;i++)
-    {
-      tmp = $.ajax({
-        type: "POST",
-        url: "{/literal}{$datas.urlRequest}{literal}",
-        async: false,
-        data: { ajaxfct:"makeStatsDoAnalyze", imagesList:list[i] }
-       }).responseText;
-
-      pct=100*(i+1)/list.length;
-      $("#iprogressbar_bg").css("width", pct+"%");
-      $("#iprogressbar_fg").html(Math.round(pct)+"%");
-    }
-
-    tmp = $.ajax({
-      type: "POST",
-      url: "{/literal}{$datas.urlRequest}{literal}",
-      async: false,
-      data: { ajaxfct:"makeStatsConsolidation" }
-     }).responseText;
-
-
-    timeEnd = new Date();
-    timeElapsed=timeEnd.getTime()-timeStart.getTime();
-
-
-    $("#dialog")
-    .dialog("destroy")
-    .html("")
-    .get(0).removeAttribute('style');
-
-    $("#dialog")
-    .dialog(
-      {
-        resizable: false,
-        width:480,
-        height:120,
-        modal: true,
-        draggable:false,
-        title: '{/literal}{"g003_updating_metadata"|@translate}{literal}',
-        overlay:
-        {
-          backgroundColor: '#000',
-          opacity: 0.5
-        },
-        open: function(event, ui)
-        {
-          bH=$("div.ui-dialog-buttonpane").get(0).clientHeight;
-          $("#dialog").css('height', (this.clientHeight-bH)+"px");
-        },
-        buttons:
-        {
-          '{/literal}{"g003_ok"|@translate}{literal}':
-            function()
-            {
-              $(this).dialog('destroy').html("").get(0).removeAttribute('style');
-            }
-        }
-      }
-    ).html("<br>{/literal}{'g003_analyze_is_finished'|@translate}{literal}&nbsp;("+displayTime(timeElapsed/1000)+")");
-
-    getStatus();
-    $("body").css("cursor", "default");
-  }
-
-
-
-</script>
-{/literal}
-
-<h3>{'g003_status_of_database'|@translate}</h3>
-
-<div id="dialog"></div>
-
-<div id="ianalyzestatus">
-  <ul>
-    <li>{'g003_loading'|@translate}</li>
-    <li>{'g003_loading'|@translate}</li>
-    <li>{'g003_loading'|@translate}</li>
-  </ul>
-</div>
-
-<div id='ianalyzearea'>
-  <fieldset>
-    <legend>{'g003_update_metadata'|@translate}</legend>
-      <form class="formtable">
-        <div class="warning">
-          <p style="font-weight:bold; font-size:+1;">{'g003_warning_on_analyze_0'|@translate}</p>
-          <p>{'g003_warning_on_analyze_1'|@translate}</p>
-          <p  style="font-weight:bold;">{'g003_warning_on_analyze_2'|@translate}</p>
-          <p>{'g003_warning_on_analyze_3'|@translate}</p>
-        </div>
-
-        <label>
-          <input type="radio" value="notAnalayzed" name="fAMD_analyze_action" id="ianalyze_action0" checked>&nbsp;
-          {'g003_analyze_not_analyzed_pictures'|@translate}
-        </label><br>
-
-        <label>
-          <input type="radio" value="all" name="fAMD_analyze_action" id="ianalyze_action1">&nbsp;
-          {'g003_analyze_all_pictures'|@translate}
-        </label><br>
-
-        <br>
-        {'g003_setting_nb_items_per_request'|@translate}&nbsp;
-        <input type="hidden" id="iamd_NumberOfItemsPerRequest" value="{$datas.NumberOfItemsPerRequest}">
-        <div id="iamd_nb_item_per_request_slider"></div>
-        <div id="iamd_nb_item_per_request_display"></div>
-        <br><br>
-
-        <input type="button" value="{'g003_analyze'|@translate}" onclick="doAnalyze();">
-
-      </form>
-  </fieldset>
-</div>
-
-
-
-
-<script type="text/javascript">
-  init();
-</script>
Index: /extensions/AMetaData/admin/amd_metadata_database.tpl
===================================================================
--- /extensions/AMetaData/admin/amd_metadata_database.tpl	(revision 5080)
+++ /extensions/AMetaData/admin/amd_metadata_database.tpl	(revision 5080)
@@ -0,0 +1,280 @@
+{known_script id="jquery.ui" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.core.packed.js"}
+{known_script id="jquery.ui.slider" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.slider.packed.js"}
+{known_script id="jquery.ui.dialog" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.dialog.packed.js"}
+
+{literal}
+<style>
+ .ui-slider {
+    width:350px;
+    height:10px;
+    border:1px solid;
+    margin-left:10px;
+  }
+ .ui-slider-handle {
+    width:12px;
+    height:12px;
+    position:relative;
+    top:-2px;
+    border:1px solid;
+    background:#cccccc;
+  }
+</style>
+
+<script type="text/javascript">
+
+  function init()
+  {
+    formatNbItemPerRequest({/literal}{$datas.NumberOfItemsPerRequest}{literal});
+    $("#iamd_nb_item_per_request_slider").slider(
+      {
+        min:5,
+        max:150,
+        steps:29,
+        startValue:{/literal}{$datas.NumberOfItemsPerRequest}{literal},
+        slide: function(event, ui) { formatNbItemPerRequest(ui.value); }
+      }
+    );
+    getStatus();
+  }
+
+  function formatNbItemPerRequest(nbItems)
+  {
+    $("#iamd_NumberOfItemsPerRequest").val(nbItems);
+    $("#iamd_nb_item_per_request_display").html(nbItems);
+  }
+
+  function getStatus()
+  {
+    data=$.ajax(
+      {
+        type: "POST",
+        url: "{/literal}{$datas.urlRequest}{literal}",
+        async: false,
+        data: { ajaxfct:"makeStatsGetStatus" }
+      }
+    ).responseText;
+
+    list=data.split(";");
+    $("#ianalyzestatus").html("<ul><li>"+list[0]+"</li><li>"+list[1]+"</li><li>"+list[2]+"</li></ul>");
+  }
+
+  function doAnalyze()
+  {
+    $("body").css("cursor", "wait");
+
+    mode="all";
+    modeLabel="";
+
+    if($("#ianalyze_action0").get(0).checked)
+    {
+      mode="notAnalyzed";
+      modeLabel="{/literal}{'g003_analyze_not_analyzed_pictures'|@translate}{literal}";
+    }
+    else if($("#ianalyze_action1").get(0).checked)
+    {
+      mode="all";
+      modeLabel="{/literal}{'g003_analyze_all_pictures'|@translate}{literal}";
+    }
+    else if($("#ianalyze_action2").get(0).checked)
+    {
+      mode="caddieAdd";
+      modeLabel="{/literal}{'g003_analyze_caddie_add_pictures'|@translate}{literal}";
+    }
+    else if($("#ianalyze_action3").get(0).checked)
+    {
+      mode="caddieReplace";
+      modeLabel="{/literal}{'g003_analyze_caddie_replace_pictures'|@translate}{literal}";
+    }
+
+
+    doAnalyze="<br><form id='iDialogProgress' class='formtable'>"+
+      "<div id='iprogressbar_contener'>"+
+      "<span id='iprogressbar_bg' style='width:0%;'>&nbsp;</span>"+
+      "<span id='iprogressbar_fg'>0%</span>"+
+      "</div>{/literal}{'g003_analyze_in_progress'|@translate}{literal}</form>";
+
+    $("#dialog")
+    .html("")
+    .dialog(
+      {
+        resizable: false,
+        width:480,
+        height:120,
+        modal: true,
+        draggable:false,
+        title: '{/literal}{"g003_updating_metadata"|@translate}{literal}&nbsp;('+modeLabel+')',
+        overlay:
+        {
+          backgroundColor: '#000',
+          opacity: 0.5,
+        }
+      }
+    ).html(doAnalyze);
+
+    NumberOfItemsPerRequest=$("#iamd_NumberOfItemsPerRequest").val();
+
+    $.ajax(
+      {
+        type: "POST",
+        url: "{/literal}{$datas.urlRequest}{literal}",
+        async: false,
+        data: { ajaxfct:"makeStatsGetList", selectMode:mode, numOfItems:NumberOfItemsPerRequest },
+        success: function(msg)
+          {
+            doStep_getList(msg);
+          },
+        error: function()
+          {
+            alert('error');
+          }
+      }
+    );
+  }
+
+
+  function displayTime(eTime)
+  {
+    seconds=(eTime%60).toFixed(2);
+    minutes=((eTime-seconds)/60).toFixed(0);
+    returned=seconds+"s";
+    if(minutes>0) returned=minutes+"m"+returned;
+    return(returned);
+  }
+
+  function doStep_getList(data)
+  {
+    timeStart = new Date();
+    list=data.split(";");
+    for(i=0;i<list.length-1;i++)
+    {
+      tmp = $.ajax({
+        type: "POST",
+        url: "{/literal}{$datas.urlRequest}{literal}",
+        async: false,
+        data: { ajaxfct:"makeStatsDoAnalyze", imagesList:list[i] }
+       }).responseText;
+
+      pct=100*(i+1)/list.length;
+      $("#iprogressbar_bg").css("width", pct+"%");
+      $("#iprogressbar_fg").html(Math.round(pct)+"%");
+    }
+
+    tmp = $.ajax({
+      type: "POST",
+      url: "{/literal}{$datas.urlRequest}{literal}",
+      async: false,
+      data: { ajaxfct:"makeStatsConsolidation" }
+     }).responseText;
+
+
+    timeEnd = new Date();
+    timeElapsed=timeEnd.getTime()-timeStart.getTime();
+
+
+    $("#dialog")
+    .dialog("destroy")
+    .html("")
+    .get(0).removeAttribute('style');
+
+    $("#dialog")
+    .dialog(
+      {
+        resizable: false,
+        width:480,
+        height:120,
+        modal: true,
+        draggable:false,
+        title: '{/literal}{"g003_updating_metadata"|@translate}{literal}',
+        overlay:
+        {
+          backgroundColor: '#000',
+          opacity: 0.5
+        },
+        open: function(event, ui)
+        {
+          bH=$("div.ui-dialog-buttonpane").get(0).clientHeight;
+          $("#dialog").css('height', (this.clientHeight-bH)+"px");
+        },
+        buttons:
+        {
+          '{/literal}{"g003_ok"|@translate}{literal}':
+            function()
+            {
+              $(this).dialog('destroy').html("").get(0).removeAttribute('style');
+            }
+        }
+      }
+    ).html("<br>{/literal}{'g003_analyze_is_finished'|@translate}{literal}&nbsp;("+displayTime(timeElapsed/1000)+")");
+
+    getStatus();
+    $("body").css("cursor", "default");
+  }
+
+
+
+</script>
+{/literal}
+
+<h3>{'g003_status_of_database'|@translate}</h3>
+
+<div id="dialog"></div>
+
+<div id="ianalyzestatus">
+  <ul>
+    <li>{'g003_loading'|@translate}</li>
+    <li>{'g003_loading'|@translate}</li>
+    <li>{'g003_loading'|@translate}</li>
+  </ul>
+</div>
+
+<div id='ianalyzearea'>
+  <fieldset>
+    <legend>{'g003_update_metadata'|@translate}</legend>
+      <form class="formtable">
+        <div class="warning">
+          <p style="font-weight:bold; font-size:+1;">{'g003_warning_on_analyze_0'|@translate}</p>
+          <p>{'g003_warning_on_analyze_1'|@translate}</p>
+          <p  style="font-weight:bold;">{'g003_warning_on_analyze_2'|@translate}</p>
+          <p>{'g003_warning_on_analyze_3'|@translate}</p>
+        </div>
+
+        <label>
+          <input type="radio" value="caddieAdd" name="fAMD_analyze_action" id="ianalyze_action2" checked>&nbsp;
+          {'g003_analyze_caddie_add_pictures'|@translate}
+        </label><br>
+
+        <label>
+          <input type="radio" value="caddieReplace" name="fAMD_analyze_action" id="ianalyze_action3">&nbsp;
+          {'g003_analyze_caddie_replace_pictures'|@translate}
+        </label><br>
+
+
+        <label>
+          <input type="radio" value="notAnalayzed" name="fAMD_analyze_action" id="ianalyze_action0">&nbsp;
+          {'g003_analyze_not_analyzed_pictures'|@translate}
+        </label><br>
+
+        <label>
+          <input type="radio" value="all" name="fAMD_analyze_action" id="ianalyze_action1">&nbsp;
+          {'g003_analyze_all_pictures'|@translate}
+        </label><br>
+
+        <br>
+        {'g003_setting_nb_items_per_request'|@translate}&nbsp;
+        <input type="hidden" id="iamd_NumberOfItemsPerRequest" value="{$datas.NumberOfItemsPerRequest}">
+        <div id="iamd_nb_item_per_request_slider"></div>
+        <div id="iamd_nb_item_per_request_display"></div>
+        <br><br>
+
+        <input type="button" value="{'g003_analyze'|@translate}" onclick="doAnalyze();">
+
+      </form>
+  </fieldset>
+</div>
+
+
+
+
+<script type="text/javascript">
+  init();
+</script>
Index: /extensions/AMetaData/amd_aip.class.inc.php
===================================================================
--- /extensions/AMetaData/amd_aip.class.inc.php	(revision 5079)
+++ /extensions/AMetaData/amd_aip.class.inc.php	(revision 5080)
@@ -53,7 +53,7 @@
                           l10n('g003_metadata'),
                           $this->page_link.'&amp;fAMD_tabsheet=metadata');
-    $this->tabsheet->add('database',
-                          l10n('g003_database'),
-                          $this->page_link.'&amp;fAMD_tabsheet=database');
+    $this->tabsheet->add('help',
+                          l10n('g003_help'),
+                          $this->page_link.'&amp;fAMD_tabsheet=help');
     $this->ajax = new Ajax();
     $this->jpegMD=new JpegMetaData();
@@ -99,7 +99,7 @@
     $template->assign('plugin', $template_plugin);
 
-    if($_REQUEST['fAMD_tabsheet']=='database')
-    {
-      $this->displayDatabase();
+    if($_REQUEST['fAMD_tabsheet']=='help')
+    {
+      //$this->displayHelp();
     }
     elseif($_REQUEST['fAMD_tabsheet']=='metadata')
@@ -213,5 +213,5 @@
     else
     {
-      $defautTabsheet="metadata";
+      $defautTabsheet="select";
     }
 
@@ -222,19 +222,20 @@
 
     if($_REQUEST['fAMD_tabsheet']!="metadata" and
-       $_REQUEST['fAMD_tabsheet']!="database")
-    {
-      $_REQUEST['fAMD_tabsheet']=$defautTabsheet;
+       $_REQUEST['fAMD_tabsheet']!="help")
+    {
+      $_REQUEST['fAMD_tabsheet']="metadata";
     }
 
     if($_REQUEST['fAMD_tabsheet']=="metadata" and !isset($_REQUEST['fAMD_page']))
     {
-      $_REQUEST['fAMD_page']="select";
+      $_REQUEST['fAMD_page']=$defautTabsheet;
     }
 
     if($_REQUEST['fAMD_tabsheet']=="metadata" and
        !($_REQUEST['fAMD_page']=="select" or
+         $_REQUEST['fAMD_page']=="database" or
          $_REQUEST['fAMD_page']=="display"))
     {
-      $_REQUEST['fAMD_page']="select";
+      $_REQUEST['fAMD_page']=$defautTabsheet;
     }
 
@@ -249,12 +250,14 @@
       if($_REQUEST['ajaxfct']=="makeStatsGetList" and !isset($_REQUEST['selectMode']))
       {
-        $_REQUEST['selectMode']="notAnalyzed";
+        $_REQUEST['selectMode']="caddieAdd";
       }
 
       if($_REQUEST['ajaxfct']=="makeStatsGetList" and
          !($_REQUEST['selectMode']=="notAnalyzed" or
+           $_REQUEST['selectMode']=="caddieAdd" or
+           $_REQUEST['selectMode']=="caddieReplace" or
            $_REQUEST['selectMode']=="all"))
       {
-        $_REQUEST['selectMode']="notAnalyzed";
+        $_REQUEST['selectMode']="caddieAdd";
       }
 
@@ -477,60 +480,4 @@
 
   /**
-   * display and manage the database page
-   *
-   * the function automatically update the AMD tables :
-   *  - add new pictures in the AMD image table (assuming image is not analyzed
-   *    yet)
-   *  - remove deleted pictures in the AMD image & image_tags table
-   *
-   * @return String : the content of the page
-   */
-  private function displayDatabase()
-  {
-    global $template, $page;
-
-    /*
-     * insert new image (from piwigo images table) in the AMD images table, with
-     * statut 'not analyzed'
-     */
-    $sql="INSERT INTO ".$this->tables['images']."
-            SELECT id, 'n', 0
-              FROM ".IMAGES_TABLE."
-              WHERE id NOT IN (SELECT imageId FROM ".$this->tables['images'].")";
-    pwg_query($sql);
-
-
-    /*
-     * delete image who are in the AMD images table and not in the piwigo image
-     * table
-     */
-    $sql="DELETE FROM ".$this->tables['images']."
-            WHERE imageId NOT IN (SELECT id FROM ".IMAGES_TABLE.")";
-    pwg_query($sql);
-
-
-    /*
-     * delete metdata for images that are not in the AMD image table
-     */
-    $sql="DELETE FROM ".$this->tables['images_tags']."
-            WHERE imageId NOT IN (SELECT imageId FROM ".$this->tables['images'].")";
-    pwg_query($sql);
-
-
-    $template->set_filename('body_page', dirname(__FILE__).'/admin/amd_database.tpl');
-
-    $datas=array(
-      'urlRequest' => $this->page_link,
-      'NumberOfItemsPerRequest' => $this->my_config['amd_NumberOfItemsPerRequest'],
-    );
-
-    $template->assign("datas", $datas);
-
-    $template->assign_var_from_handle('AMD_BODY_PAGE', 'body_page');
-  } // displayDatabase
-
-
-
-  /**
    * display and manage the metadata page
    * the page have two tabsheet :
@@ -547,4 +494,7 @@
     $statTabsheet = new tabsheet('statTabsheet', $this->tabsheet->get_titlename());
     $statTabsheet->select($tab);
+    $statTabsheet->add('database',
+                          l10n('g003_database'),
+                          $this->page_link.'&amp;fAMD_tabsheet=metadata&amp;fAMD_page=database');
     $statTabsheet->add('select',
                           l10n('g003_select'),
@@ -561,7 +511,11 @@
       $template->assign('sheetContent', $this->displayMetaDataSelect());
     }
+    elseif($tab=="display")
+    {
+      $template->assign('sheetContent', $this->displayMetaDataDisplay());
+    }
     else
     {
-      $template->assign('sheetContent', $this->displayMetaDataDisplay());
+      $template->assign('sheetContent', $this->displayDatabase());
     }
 
@@ -670,4 +624,60 @@
 
 
+  /**
+   * display and manage the database page
+   *
+   * the function automatically update the AMD tables :
+   *  - add new pictures in the AMD image table (assuming image is not analyzed
+   *    yet)
+   *  - remove deleted pictures in the AMD image & image_tags table
+   *
+   * @return String : the content of the page
+   */
+  private function displayDatabase()
+  {
+    global $template, $page;
+
+    /*
+     * insert new image (from piwigo images table) in the AMD images table, with
+     * statut 'not analyzed'
+     */
+    $sql="INSERT INTO ".$this->tables['images']."
+            SELECT id, 'n', 0
+              FROM ".IMAGES_TABLE."
+              WHERE id NOT IN (SELECT imageId FROM ".$this->tables['images'].")";
+    pwg_query($sql);
+
+
+    /*
+     * delete image who are in the AMD images table and not in the piwigo image
+     * table
+     */
+    $sql="DELETE FROM ".$this->tables['images']."
+            WHERE imageId NOT IN (SELECT id FROM ".IMAGES_TABLE.")";
+    pwg_query($sql);
+
+
+    /*
+     * delete metdata for images that are not in the AMD image table
+     */
+    $sql="DELETE FROM ".$this->tables['images_tags']."
+            WHERE imageId NOT IN (SELECT imageId FROM ".$this->tables['images'].")";
+    pwg_query($sql);
+
+
+    $template->set_filename('sheet_page', dirname(__FILE__).'/admin/amd_metadata_database.tpl');
+
+    $datas=array(
+      'urlRequest' => $this->page_link,
+      'NumberOfItemsPerRequest' => $this->my_config['amd_NumberOfItemsPerRequest'],
+    );
+
+    $template->assign("datas", $datas);
+
+    return($template->parse('sheet_page', true));
+  } // displayDatabase
+
+
+
 
   /**
@@ -729,19 +739,12 @@
           if($sqlInsert!="") $sqlInsert.=", ";
           $sqlInsert.="($imageId, '$numId', '".addslashes($value)."')";
-          $massInsert[]=array(
-            'imageId' => $imageId,
-            'numId' => $numId,
-            'value' => addslashes($value)
-          );
+          $massInsert[]="('$imageId', '$numId', '".addslashes($value)."') ";
         }
       }
     }
 
-    /*if($sqlInsert!="")
-    {
-      $sqlInsert="INSERT INTO ".$this->tables['images_tags']." VALUES ".$sqlInsert;
-      pwg_query($sqlInsert);
-    }*/
-    mass_inserts($this->tables['images_tags'], array('imageId', 'numId', 'value'), $massInsert);
+    $sql="REPLACE INTO ".$this->tables['images_tags']." (imageId, numId, value)
+          VALUES ".implode(", ", $massInsert);
+    //mass_inserts($this->tables['images_tags'], array('imageId', 'numId', 'value'), $massInsert);
 
     $sql="UPDATE ".$this->tables['images']."
@@ -803,14 +806,23 @@
   private function ajax_amd_makeStatsGetList($mode, $nbOfItems)
   {
+    global $user;
+
     $returned="";
     $this->my_config['amd_NumberOfItemsPerRequest']=$nbOfItems;
     $this->save_config();
 
-    $sql="SELECT imageId FROM ".$this->tables['images'];
+    $sql="SELECT ait.imageId FROM ".$this->tables['images']." ait";
     if($mode=="notAnalyzed")
     {
-      $sql.=" WHERE analyzed='n'";
-    }
-    else
+      $sql.=" WHERE ait.analyzed='n'";
+    }
+    elseif($mode=="caddieAdd" or $mode=="caddieReplace")
+    {
+
+      $sql.=" LEFT JOIN ".CADDIE_TABLE." ct ON ait.imageId = ct.element_id
+            WHERE ct.user_id = ".$user['id'].";";
+    }
+
+    if($mode=="all" or $mode=="caddieReplace")
     {
       pwg_query("UPDATE ".$this->tables['images']." SET analyzed='n', nbTags=0");
Index: /extensions/AMetaData/language/fr_FR/plugin.lang.php
===================================================================
--- /extensions/AMetaData/language/fr_FR/plugin.lang.php	(revision 5079)
+++ /extensions/AMetaData/language/fr_FR/plugin.lang.php	(revision 5080)
@@ -20,6 +20,8 @@
 $lang['g003_numberOfAnalyzedPictures'] = "%d images ont fait l'objet d'une analyse et représentent %d métadonnées";
 $lang['g003_numberOfNotAnalyzedPictures'] = "%d images n'ont pas fait l'objet d'une analyse";
-$lang['g003_analyze_not_analyzed_pictures'] = "Analyser les images manquantes";
-$lang['g003_analyze_all_pictures'] = "Analyser toutes les images";
+$lang['g003_analyze_not_analyzed_pictures'] = "L'analyse porte sur les images n'ayant jamais été analysées et vient s'ajouter au référentiel actuel";
+$lang['g003_analyze_all_pictures'] = "L'analyse porte sur toutes les images de la galerie et vient remplacer le référentiel actuel";
+$lang['g003_analyze_caddie_add_pictures'] = "L'analyse porte sur les images du panier et vient s'ajouter au référentiel actuel";
+$lang['g003_analyze_caddie_replace_pictures'] = "L'analyse porte sur les images du panier et vient remplacer le référentiel actuel";
 $lang['g003_analyze'] = "Analyser";
 $lang['g003_update_metadata'] = "Mettre à jour le référentiel de métadonnées";
@@ -78,7 +80,7 @@
 
 $lang['g003_warning_on_analyze_0'] = "Attention !";
-$lang['g003_warning_on_analyze_1'] = "En fonction du nombre de photos dans votre galerie, l'alimentation du référentiel est un processus qui peut s'avérer être long (jusqu'à plusieurs minutes de traitement), et gourmand en ressources sur le serveur.";
+$lang['g003_warning_on_analyze_1'] = "L'alimentation du référentiel est un processus qui peut s'avérer être long (jusqu'à plusieurs minutes de traitement) et gourmand en ressources sur le serveur en fonction du nombre de photos sélectionnées pour l'analyse.";
 $lang['g003_warning_on_analyze_2'] = "Certains hébergeurs peuvent sanctionner ce type d'usage.";
-$lang['g003_warning_on_analyze_3'] = "L'alimentation du référentiel n'est pas nécessaire pour que le plugin puisse exploiter les métadonnées de vos photos : il n'est nécessaire que pour les analyses statistiques";
+$lang['g003_warning_on_analyze_3'] = "Il est fortement recommandé de remplir le panier avec une cinquantaine de photos représentatives de la galerie pour procéder au traitement.";
 
 
