Changeset 7447 for extensions/AMetaData


Ignore:
Timestamp:
Oct 28, 2010, 1:30:33 AM (13 years ago)
Author:
grum
Message:

implement feature bug:1924

Location:
extensions/AMetaData
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMetaData/admin/amd_metadata_database_database.tpl

    r6950 r7447  
    2424  function doAnalyze()
    2525  {
    26     mode="all";
    27     modeLabel="";
    28 
    29     if($("#ianalyze_action0").get(0).checked)
    30     {
    31       mode="notAnalyzed";
    32       modeLabel="{/literal}{'g003_analyze_not_analyzed_pictures'|@translate}{literal}";
    33     }
    34     else if($("#ianalyze_action1").get(0).checked)
    35     {
    36       mode="all";
    37       modeLabel="{/literal}{'g003_analyze_all_pictures'|@translate}{literal}";
    38     }
    39     else if($("#ianalyze_action2").get(0).checked)
    40     {
    41       mode="caddieAdd";
    42       modeLabel="{/literal}{'g003_analyze_caddie_add_pictures'|@translate}{literal}";
    43     }
    44     else if($("#ianalyze_action3").get(0).checked)
    45     {
    46       mode="caddieReplace";
    47       modeLabel="{/literal}{'g003_analyze_caddie_replace_pictures'|@translate}{literal}";
    48     }
    49     else if($("#ianalyze_action4").get(0).checked)
    50     {
    51       mode="analyzed";
    52       modeLabel="{/literal}{'g003_analyze_analyzed_pictures'|@translate}{literal}";
    53     }
    54 
    55     ignoreOptions=[];
    56     if($('#iFillDataBaseIgnore_magic').get(0).checked)
    57     {
    58       ignoreOptions.push('magic');
    59     }
    60     if($('#iFillDataBaseIgnore_exif').get(0).checked)
    61     {
    62       ignoreOptions.push('exif');
    63     }
    64     if($('#iFillDataBaseIgnore_iptc').get(0).checked)
    65     {
    66       ignoreOptions.push('iptc');
    67     }
    68     if($('#iFillDataBaseIgnore_xmp').get(0).checked)
    69     {
    70       ignoreOptions.push('xmp');
    71     }
    72 
    73 
    74     doAnalyzeDialog="<br><form id='iDialogProgress' class='formtable'>"+
     26    var mode="all",
     27        modeLabel="",
     28        numOfRandomItems=0,
     29        doAnalyzeDialog="<br><form id='iDialogProgress' class='formtable'>"+
    7530      "<div id='iprogressbar_contener' class='gcBorderInput'>"+
    7631      "<span id='iprogressbar_bg' class='gcBgInput' style='width:0%;'>&nbsp;</span>"+
    7732      "<span id='iprogressbar_fg' class='gcLink'>0%</span>"+
    7833      "</div><p>{/literal}{'g003_analyze_in_progress'|@translate}{literal}"+
    79       "<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>"
    80       "</p></form>";
     34      "<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>"+
     35      "</p></form>",
     36        re=/^\d+$/;
     37
     38
     39    if($("#ianalyze_action0").get(0).checked)
     40    {
     41      mode="notAnalyzed";
     42      modeLabel="{/literal}{'g003_analyze_not_analyzed_pictures'|@translate}{literal}";
     43    }
     44    else if($("#ianalyze_action1").get(0).checked)
     45    {
     46      mode="all";
     47      modeLabel="{/literal}{'g003_analyze_all_pictures'|@translate}{literal}";
     48    }
     49    else if($("#ianalyze_action2").get(0).checked)
     50    {
     51      mode="caddieAdd";
     52      modeLabel="{/literal}{'g003_analyze_caddie_add_pictures'|@translate}{literal}";
     53    }
     54    else if($("#ianalyze_action3").get(0).checked)
     55    {
     56      mode="caddieReplace";
     57      modeLabel="{/literal}{'g003_analyze_caddie_replace_pictures'|@translate}{literal}";
     58    }
     59    else if($("#ianalyze_action4").get(0).checked)
     60    {
     61      mode="analyzed";
     62      modeLabel="{/literal}{'g003_analyze_analyzed_pictures'|@translate}{literal}";
     63    }
     64    else if($("#ianalyze_action5").get(0).checked)
     65    {
     66      mode="randomList";
     67      numOfRandomItems=$("#ianalyze_action6").val();
     68      if(numOfRandomItems<=0 || re.exec(numOfRandomItems)==null)
     69      {
     70        alert("{/literal}{'g003_invalid_random_number'|@translate}{literal}");
     71        return(false);
     72      }
     73      modeLabel="{/literal}{'g003_analyze_random_pictures'|@translate|replace:'%s':'"+numOfRandomItems+"'}{literal}";
     74    }
     75
     76    ignoreOptions=[];
     77    if($('#iFillDataBaseIgnore_magic').get(0).checked)
     78    {
     79      ignoreOptions.push('magic');
     80    }
     81    if($('#iFillDataBaseIgnore_exif').get(0).checked)
     82    {
     83      ignoreOptions.push('exif');
     84    }
     85    if($('#iFillDataBaseIgnore_iptc').get(0).checked)
     86    {
     87      ignoreOptions.push('iptc');
     88    }
     89    if($('#iFillDataBaseIgnore_xmp').get(0).checked)
     90    {
     91      ignoreOptions.push('xmp');
     92    }
     93
    8194
    8295    $("#dialog")
     
    107120            numOfItems:NumberOfItemsPerRequest,
    108121            ignoreOptions:ignoreOptions,
     122            numOfRandomItems:numOfRandomItems,
    109123          },
    110124        success: function(msg)
     
    267281    <fieldset>
    268282      <legend>{'g003_update_metadata'|@translate}</legend>
    269         <label>
    270           <input type="radio" value="caddieAdd" name="fAMD_analyze_action" id="ianalyze_action2" checked>&nbsp;
    271           {'g003_analyze_caddie_add_pictures'|@translate}
    272         </label><br>
    273 
    274         <label>
    275           <input type="radio" value="caddieReplace" name="fAMD_analyze_action" id="ianalyze_action3">&nbsp;
    276           {'g003_analyze_caddie_replace_pictures'|@translate}
    277         </label><br>
    278 
     283        <div>
     284          <div style='display: inline-block; border-right: 1px dotted; margin-right: 4px; padding-right: 8px;'>
     285            <label>
     286              <input type="radio" value="caddieAdd" name="fAMD_analyze_action" id="ianalyze_action2" checked>&nbsp;
     287              {'g003_analyze_caddie_add_pictures'|@translate}&nbsp;
     288            </label><br>
     289
     290            <label>
     291              <input type="radio" value="caddieReplace" name="fAMD_analyze_action" id="ianalyze_action3">&nbsp;
     292              {'g003_analyze_caddie_replace_pictures'|@translate}&nbsp;
     293            </label><br>
     294          </div>
     295          <span style='font-style: italic; position: relative; top: -12px;'>{$datas.caddieNbPictures}</span>
     296        </div>
    279297
    280298        <label>
     
    287305          {'g003_analyze_all_pictures'|@translate}
    288306        </label><br>
     307
     308
     309
     310          <input type="radio" value="randomList" name="fAMD_analyze_action" id="ianalyze_action5">&nbsp;
     311          {'g003_analyze_random_pictures'|@translate|replace:'%s':"<input type='text' size='4' id='ianalyze_action6' value='500' style='display:inline;' onfocus='$(&quot;#ianalyze_action5&quot;).attr(&quot;checked&quot;, true);'>"}
     312        <br>
     313
    289314
    290315        <span id='iAnalyzeAnalyzed' style='display:none;'>
  • extensions/AMetaData/amd_aip.class.inc.php

    r6950 r7447  
    667667  private function displayDatabaseDatabase()
    668668  {
    669     global $template, $page;
     669    global $template, $page, $user;
    670670
    671671    /*
     
    700700
    701701
     702    $caddieNbPictures=0;
     703    $sql="SELECT COUNT(element_id) AS nbPictures
     704          FROM ".CADDIE_TABLE."
     705          WHERE user_id='".$user['id']."';";
     706    $result=pwg_query($sql);
     707    if($result)
     708    {
     709      while($row=pwg_db_fetch_assoc($result))
     710      {
     711        $caddieNbPictures=$row['nbPictures'];
     712      }
     713    }
    702714
    703715
     
    707719      'urlRequest' => $this->getAdminLink('ajax'),
    708720      'NumberOfItemsPerRequest' => $this->config['amd_NumberOfItemsPerRequest'],
     721      'caddieNbPictures' => ($caddieNbPictures==1)?l10n('g003_1_picture_in_caddie'):sprintf(l10n('g003_n_pictures_in_caddie'), $caddieNbPictures)
    709722    );
    710723
  • extensions/AMetaData/amd_ajax.php

    r7443 r7447  
    109109               $_REQUEST['selectMode']=="caddieReplace" or
    110110               $_REQUEST['selectMode']=="analyzed" or
     111               $_REQUEST['selectMode']=="randomList" or
    111112               $_REQUEST['selectMode']=="all")) $_REQUEST['selectMode']="caddieAdd";
     113
     114          if($_REQUEST['selectMode']=="randomList" and
     115              (!isset($_REQUEST['numOfRandomItems']) or
     116               $_REQUEST['numOfRandomItems']<=0 or
     117               preg_match('/^\d+$/', $_REQUEST['numOfRandomItems'])==0
     118              )
     119            ) $_REQUEST['ajaxfct']='';
     120
    112121
    113122          if(!isset($_REQUEST['numOfItems'])) $_REQUEST['numOfItems']=25;
     
    358367      {
    359368        case 'admin.makeStats.getList':
    360           $result=$this->ajax_amd_admin_makeStatsGetList($_REQUEST['selectMode'], $_REQUEST['numOfItems'], $_REQUEST['ignoreOptions']);
     369          $result=$this->ajax_amd_admin_makeStatsGetList($_REQUEST['selectMode'], $_REQUEST['numOfItems'], $_REQUEST['ignoreOptions'], $_REQUEST['numOfRandomItems']);
    361370          break;
    362371        case 'admin.makeStats.doAnalyze':
     
    508517     * @param String $mode
    509518     * @param Integer $nbOfItems : number of items per request
     519     * @param
     520     * @param Integer $numOfRandomItems : number of random items (used if $mode=='randomList')
    510521     * @return String : list of image id to be analyzed, separated with a space
    511522     *                      "23 78 4523 5670"
    512523     */
    513     private function ajax_amd_admin_makeStatsGetList($mode, $nbOfItems, $ignoreSchemas)
     524    private function ajax_amd_admin_makeStatsGetList($mode, $nbOfItems, $ignoreSchemas, $numOfRandomItems)
    514525    {
    515526      global $user;
     
    521532
    522533      $sql="SELECT ait.imageId FROM ".$this->tables['images']." ait";
    523       if($mode=='notAnalyzed')
     534      if($mode=='notAnalyzed' or $mode=='randomList' )
    524535      {
    525536        $sql.=" WHERE ait.analyzed='n'";
     
    546557        pwg_query("UPDATE ".$this->tables['used_tags']." SET numOfImg=0");
    547558        pwg_query("DELETE FROM ".$this->tables['images_tags']);
     559      }
     560
     561      if($mode=='randomList')
     562      {
     563        $sql.=" ORDER BY RAND() LIMIT 0, $numOfRandomItems;";
    548564      }
    549565
  • extensions/AMetaData/language/en_UK/plugin.lang.php

    r7035 r7447  
    1818$lang['g003_analyze_not_analyzed_pictures'] = "The analysis focuses on the images that have never been analyzed, and adds to the existing repository";
    1919$lang['g003_analyze_all_pictures'] = "The analysis includes all the images in the gallery, and replaces the current repository";
    20 $lang['g003_analyze_caddie_add_pictures'] = "The analysis focuses on the images in the basket, and adds to the existing repository";
    21 $lang['g003_analyze_caddie_replace_pictures'] = "The analysis focuses on the images in the basket, and replaces the current repository";
     20$lang['g003_analyze_caddie_add_pictures'] = "The analysis focuses on the images in the caddie, and adds to the existing repository";
     21$lang['g003_analyze_caddie_replace_pictures'] = "The analysis focuses on the images in the caddie, and replaces the current repository";
    2222$lang['g003_analyze'] = "Analyze";
    2323$lang['g003_update_metadata'] = "Update metadata repository";
     
    334334
    335335
     336/** ----------------------------------------------------------------------------
     337 * new keys from releases 0.5.3
     338 */
     339$lang['g003_1_picture_in_caddie']="1 picture in caddie";
     340$lang['g003_n_pictures_in_caddie']="%s pictures in caddie";
     341$lang['g003_analyze_random_pictures'] = "The analysis focuses on %s images selected randomly among images that have never been analyzed, and adds to the existing repository";
     342$lang['g003_invalid_random_number']="The number of images to process is not valid";
     343
     344
    336345
    337346
  • extensions/AMetaData/main.inc.php

    r7444 r7447  
    161161|         |            |     displayed
    162162|         |            |
    163 |         |            |
    164 |         |            |
     163|         |            | * mantis bug:1294
     164|         |            |   . filling database method
    165165|         |            |
    166166|         |            |
Note: See TracChangeset for help on using the changeset viewer.