Changeset 6919 for extensions/AMetaData


Ignore:
Timestamp:
Sep 14, 2010, 7:14:43 PM (14 years ago)
Author:
grum
Message:

Implement basic/advanced modes, release 0.5.1
bug:1857

Location:
extensions/AMetaData
Files:
2 added
8 edited

Legend:

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

    r6722 r6919  
    153153        {
    154154          resizable: true,
    155           width:480,
     155          width:640,
    156156          height:120,
    157157          modal: true,
     
    212212      {
    213213        resizable: true,
    214         width:480,
     214        width:640,
    215215        height:120,
    216216        modal: true,
     
    280280      {
    281281        resizable: false,
    282         width:480,
    283         height:320,
     282        width:640,
     283        height:480,
    284284        modal: true,
    285285        draggable:true,
  • extensions/AMetaData/admin/plugin_admin.php

    r5935 r6919  
    2020if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
    2121
    22 include(AMD_PATH."amd_aip.class.inc.php");
    23 
    2422global $prefixeTable;
    2523
     
    2826$main_plugin_object = get_plugin_data($plugin_id);
    2927
    30 $plugin_ai = new AMD_AIP($prefixeTable, $main_plugin_object->getFileLocation());
     28/*
     29 * if the plugin is newly installed, display a special configuration page
     30 * otherwise, display normal page
     31 */
     32
     33$config=Array();
     34GPCCore::loadConfig('amd', $config);
     35
     36if($config['newInstall']=='n')
     37{
     38  include(AMD_PATH."amd_aip.class.inc.php");
     39  $plugin_ai = new AMD_AIP($prefixeTable, $main_plugin_object->getFileLocation());}
     40else
     41{
     42  include(AMD_PATH."amd_aip_install.class.inc.php");
     43  $plugin_ai = new AMD_AIPInstall($prefixeTable, $main_plugin_object->getFileLocation());
     44}
     45
    3146$plugin_ai->manage();
    3247
  • extensions/AMetaData/amd_aip.class.inc.php

    r6891 r6919  
    4848
    4949    $this->tabsheet = new tabsheet();
    50     $this->tabsheet->add('database',
    51                           l10n('g003_database'),
    52                           $this->getAdminLink().'&fAMD_tabsheet=database');
    53     $this->tabsheet->add('metadata',
    54                           l10n('g003_metadata'),
    55                           $this->getAdminLink().'&fAMD_tabsheet=metadata');
    56     $this->tabsheet->add('search',
    57                           l10n('g003_search'),
    58                           $this->getAdminLink().'&fAMD_tabsheet=search');
    59     $this->tabsheet->add('help',
    60                           l10n('g003_help'),
    61                           $this->getAdminLink().'&fAMD_tabsheet=help');
     50
     51    if($this->config['amd_interfaceMode']=='basic')
     52    {
     53      $this->tabsheet->add('metadata',
     54                            l10n('g003_metadata'),
     55                            $this->getAdminLink().'&fAMD_tabsheet=metadata');
     56      $this->tabsheet->add('help',
     57                            l10n('g003_help'),
     58                            $this->getAdminLink().'&fAMD_tabsheet=help');
     59    }
     60    else
     61    {
     62      $this->tabsheet->add('database',
     63                            l10n('g003_database'),
     64                            $this->getAdminLink().'&fAMD_tabsheet=database');
     65      $this->tabsheet->add('metadata',
     66                            l10n('g003_metadata'),
     67                            $this->getAdminLink().'&fAMD_tabsheet=metadata');
     68      $this->tabsheet->add('search',
     69                            l10n('g003_search'),
     70                            $this->getAdminLink().'&fAMD_tabsheet=search');
     71      $this->tabsheet->add('help',
     72                            l10n('g003_help'),
     73                            $this->getAdminLink().'&fAMD_tabsheet=help');
     74    }
    6275  }
    6376
     
    155168    if(!isset($_REQUEST['fAMD_tabsheet']))
    156169    {
    157       if($this->getNumOfPictures()==0)
     170      if($this->getNumOfPictures()==0 and $this->config['amd_interfaceMode']=='advanced')
    158171      {
    159172        $_REQUEST['fAMD_tabsheet']="database";
     
    168181
    169182    if(!($_REQUEST['fAMD_tabsheet']=="metadata" or
    170          $_REQUEST['fAMD_tabsheet']!="help" or
    171          $_REQUEST['fAMD_tabsheet']!="database" or
    172          $_REQUEST['fAMD_tabsheet']!="search"))
     183         $_REQUEST['fAMD_tabsheet']=="help" or
     184         $_REQUEST['fAMD_tabsheet']=="database" or
     185         $_REQUEST['fAMD_tabsheet']=="search")
     186         or
     187         $this->config['amd_interfaceMode']=='basic' and
     188         (
     189           $_REQUEST['fAMD_tabsheet']=="database" or
     190           $_REQUEST['fAMD_tabsheet']=="search"
     191         )
     192      )
    173193    {
    174194      $_REQUEST['fAMD_tabsheet']="metadata";
     
    180200    if($_REQUEST['fAMD_tabsheet']=="metadata")
    181201    {
    182       if(!isset($_REQUEST['fAMD_page'])) $_REQUEST['fAMD_page']="select";
     202      if(!isset($_REQUEST['fAMD_page']))
     203      {
     204        if($this->config['amd_interfaceMode']=='basic')
     205        {
     206          $_REQUEST['fAMD_page']="display";
     207        }
     208        else
     209        {
     210          $_REQUEST['fAMD_page']="select";
     211        }
     212      }
    183213
    184214      if(!($_REQUEST['fAMD_page']=="personnal" or
    185215           $_REQUEST['fAMD_page']=="select" or
    186            $_REQUEST['fAMD_page']=="display")) $_REQUEST['fAMD_page']="select";
     216           $_REQUEST['fAMD_page']=="display")
     217           or
     218           $this->config['amd_interfaceMode']=='basic' and
     219           (
     220             $_REQUEST['fAMD_page']=="select"
     221           )
     222        )
     223      {
     224        if($this->config['amd_interfaceMode']=='basic')
     225        {
     226          $_REQUEST['fAMD_page']="display";
     227        }
     228        else
     229        {
     230          $_REQUEST['fAMD_page']="select";
     231        }
     232      }
    187233    }
    188234
     
    281327                          l10n('g003_personnal'),
    282328                          $this->getAdminLink().'&fAMD_tabsheet=metadata&fAMD_page=personnal');
    283     $statTabsheet->add('select',
    284                           l10n('g003_select'),
    285                           $this->getAdminLink().'&fAMD_tabsheet=metadata&fAMD_page=select');
     329    if($this->config['amd_interfaceMode']=='advanced')
     330    {
     331      $statTabsheet->add('select',
     332                            l10n('g003_select'),
     333                            $this->getAdminLink().'&fAMD_tabsheet=metadata&fAMD_page=select');
     334    }
    286335    $statTabsheet->add('display',
    287336                          l10n('g003_display'),
  • extensions/AMetaData/amd_ajax.php

    r6891 r6919  
    318318
    319319
     320
     321
    320322        /*
    321323         * check public.makeStats.doPictureAnalyze values
     
    14951497
    14961498
    1497 
    14981499  } //class
    14991500
  • extensions/AMetaData/amd_install.class.inc.php

    r6891 r6919  
    5050      $this->loadConfig();
    5151      $this->config['installed']=AMD_VERSION2;
     52      $this->config['newInstall']='y';
    5253      $this->saveConfig();
    5354
     
    121122      unset($tables_def);
    122123
    123       $tables_insert=array(
     124
     125      $tablesInsert=array(
    124126"INSERT INTO `".$this->tables['groups']."` VALUES(1, 0)",
    125127"INSERT INTO `".$this->tables['groups_names']."` VALUES(1, '".$user['language']."', '".$lang['g003_default_group_name']."')",
     
    135137    ('magic.ShotInfo.Flash.Fired', 8, 1)"
    136138      );
    137       foreach($tables_insert as $sql)
     139      foreach($tablesInsert as $sql)
    138140      {
    139141        pwg_query($sql);
    140142      }
     143
    141144
    142145      return($result);
     
    279282        pwg_query($sql);
    280283      }
    281 
    282       $listToAnalyze=Array(Array(), Array());
    283       /*
    284        * select 25 pictures into the caddie
    285        */
    286       $sql="SELECT ti.id, ti.path
    287             FROM ".CADDIE_TABLE." tc
    288               LEFT JOIN ".IMAGES_TABLE." ti ON ti.id = tc.element_id
    289             WHERE tc.user_id = ".$user['id']."
    290               AND ti.id IS NOT NULL
    291             ORDER BY RAND() LIMIT 25;";
    292       $result=pwg_query($sql);
    293       if($result)
    294       {
    295         while($row=pwg_db_fetch_assoc($result))
    296         {
    297           $listToAnalyze[0][]=$row;
    298           $listToAnalyze[1][]=$row['id'];
    299         }
    300       }
    301       /*
    302        * if caddie is empty, of is have less than 25 pictures, select other
    303        * pictures from the gallery
    304        */
    305       if(count($listToAnalyze[0])<25)
    306       {
    307         if(count($listToAnalyze[0])>0)
    308         {
    309           $excludeList="WHERE ti.id NOT IN(".implode(",", $listToAnalyze[1]).") ";
    310         }
    311         else
    312         {
    313           $excludeList="";
    314         }
    315         $sql="SELECT ti.id, ti.path, ti.has_high
    316               FROM ".IMAGES_TABLE." ti ".$excludeList."
    317               ORDER BY RAND() LIMIT ".(25-count($listToAnalyze[0])).";";
    318         $result=pwg_query($sql);
    319         if($result)
    320         {
    321           while($row=pwg_db_fetch_assoc($result))
    322           {
    323             $listToAnalyze[0][]=$row;
    324           }
    325         }
    326       }
    327 
    328       /*
    329        * analyze the 25 selected pictures
    330        */
    331       if(count($listToAnalyze[0])>0)
    332       {
    333         // $path = path of piwigo's on the server filesystem
    334         $path=dirname(dirname(dirname(__FILE__)));
    335 
    336         foreach($listToAnalyze[0] as $val)
    337         {
    338           if($val['has_high']===true and $this->config['amd_UseMetaFromHD']=='y')
    339           {
    340             $this->analyzeImageFile($path."/".dirname($val['path'])."/pwg_high/".basename($val['path']), $val['id']);
    341           }
    342           else
    343           {
    344             $this->analyzeImageFile($path."/".$val['path'], $val['id']);
    345           }
    346 
    347         }
    348 
    349         $this->makeStatsConsolidation();
    350       }
    351284    }
    352285
  • extensions/AMetaData/amd_root.class.inc.php

    r6891 r6919  
    8787      'amd_FillDataBaseIgnoreSchemas' => array(),
    8888      'amd_UseMetaFromHD' => "y",
     89      'amd_InterfaceMode' => "advanced",    // 'advanced' or 'basic'
    8990
    9091      // theses options can be set manually
  • extensions/AMetaData/language/fr_FR/plugin.lang.php

    r6891 r6919  
    163163[/ul]";
    164164
    165 /*
    166  * release 0.5.0
     165
     166
     167/** ----------------------------------------------------------------------------
     168 * new keys from releases 0.5.0/0.5.1
    167169 */
    168170
    169171$lang['g003_y'] = "Oui";
    170172$lang['g003_n'] = "Non";
    171 
    172173
    173174$lang['g003_state'] = "Etat";
     
    265266$lang['g003_please_set_a_value'] = "Merci de définir une valeur";
    266267
    267 /*
    268  * removed keys
     268
     269$lang['g003_install']="Installation";
     270$lang['g003_basic_mode']="Basique";
     271$lang['g003_advanced_mode']="Avancé";
     272$lang['g003_validate']="Valider";
     273$lang['g003_step_1']="Choix du type d'usage du plugin";
     274$lang['g003_basic_mode_help']="
     275Le mode [i]basique[/i] s'adresse à ceux qui souhaitent simplement afficher les métadonnées de leurs photos et propose :[ul]
     276[li]une interface simplifiée au maximum[/li]
     277[li]une liste réduite de métadonnées (environ 140, dont les plus courantes)[/li]
     278[/ul]";
     279$lang['g003_advanced_mode_help']="
     280Le mode [i]avancé[/i] s'adresse à ceux qui souhaitent exploiter au maximum les métadonnées de leurs photos et propose :[ul]
     281[li]une interface plus complexe, mais complète[/li]
     282[li]une liste de métadonnées plus complète (environ 540)[/li]
     283[li]des fonctionnalités étendues (statistiques, recherche, ...)[/li]
     284[/ul]
     285Le mode [i]avancé[/i] nécessite la constitution d'un référentiel.";
     286
     287
     288/** ----------------------------------------------------------------------------
     289 * removed keys from releases 0.5.0/0.5.1
    269290 */
    270291//$lang['g003_warning_on_analyze_4a']
  • extensions/AMetaData/main.inc.php

    r6891 r6919  
    6767|         |            | * mantis : feature 1846
    6868|         |            |   . Read the metadata in the HD picture
     69|         |            | * mantis : feature 1857
     70|         |            |   . Implement a basic and an advanced interface mode
    6971|         |            | * ajax management entirely rewritted
    7072|         |            | * user interface reviewed
Note: See TracChangeset for help on using the changeset viewer.