Changeset 6729 for extensions/AMetaData
- Timestamp:
- Jul 29, 2010, 10:12:25 AM (14 years ago)
- Location:
- extensions/AMetaData
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/JpegMetaData/Common/Const.class.php
r4686 r6729 142 142 } 143 143 144 class Schemas { 145 const EXIF = "exif"; 146 const IPTC = "iptc"; 147 const XMP = "xmp"; 148 const MAGIC = "magic"; 149 150 const EXIF_TIFF = "exif.tiff"; 151 const EXIF_EXIF = "exif.exif"; 152 const EXIF_GPS = "exif.gps"; 153 const EXIF_MAKER = "exif.maker"; 154 } 155 144 156 ?> -
extensions/AMetaData/JpegMetaData/Common/Tag.class.php
r4904 r6729 45 45 * - tagValue : the 'raw' value of the tag, not interpreted ; can be 46 46 * of any type 47 * - value label : the interpreted value of the tag ; in most case it's a47 * - valueLabel : the interpreted value of the tag ; in most case it's a 48 48 * String, but can be an Integer, a Float or an Array 49 49 * - tagIsKnown : indicates if the tag is a known tag or not … … 52 52 * - tagIsTranslatable : indicates if the interpreted value for the tag is 53 53 * translatable 54 * - schema : the schema associated with the tag ('exif', 'iptc', 'xmp', 'magic') 54 55 * 55 56 * This class provides theses public functions : … … 59 60 * - getLabel 60 61 * - getNote 62 * - getSchema 61 63 * - isKnown 62 64 * - isImplemented … … 67 69 * - setLabel 68 70 * - setNote 71 * - setSchema 69 72 * - setKnown 70 73 * - setImplemented … … 84 87 private $tagIsImplemented = false; 85 88 private $tagIsTranslatable = false; 89 private $tagSchema = ""; 86 90 87 91 /** … … 104 108 * @param Boolean $tagIstranslatable (optional) : determine if the tag value 105 109 * can be translated or not 106 * 107 */ 108 function __construct($tagId=0xffff, $tagValue=0, $tagName="", $valueLabel="", $tagNote="", $tagIsKnown=false, $tagIsImplemented=false, $tagIsTranslatable=false) 110 * @param String $schema (optional) : schema associated with to 111 * the tag 112 */ 113 function __construct($tagId=0xffff, $tagValue=0, $tagName="", $valueLabel="", $tagNote="", $tagIsKnown=false, $tagIsImplemented=false, $tagIsTranslatable=false, $schema="") 109 114 { 110 115 $this->tagId = $tagId; … … 116 121 $this->tagIsImplemented=$tagIsImplemented; 117 122 $this->tagIsTranslatable=$tagIsTranslatable; 123 $this->tagSchema = $schema; 118 124 } 119 125 … … 128 134 unset($this->tagIsImplemented); 129 135 unset($this->tagIsTranslatable); 136 unset($this->tagSchema); 130 137 } 131 138 … … 202 209 203 210 /** 211 * returns the schema associated to the tag 212 * 213 * @return String 214 */ 215 public function getSchema() 216 { 217 return($this->tagSchema); 218 } 219 220 /** 204 221 * returns true if the tag value can be translated 205 222 * … … 296 313 297 314 /** 315 * set a schema to the tag 316 * 317 * @param String $value 318 * @return String 319 */ 320 public function setSchema($value) 321 { 322 $this->tagSchema=$value; 323 return($this->tagSchema); 324 } 325 326 327 /** 298 328 * set if the tag value is translatable 299 329 * … … 313 343 if($mode=="all") 314 344 if(is_string($this->tagId)) 315 $returned.="tag: ".str_replace(" ", " ", sprintf("%-34s", $this->tagId))." ; "; 345 $returned.="tag: ".str_replace(" ", " ", sprintf("%-34s", $this->tagId))." ; 346 schema: ".str_replace(" ", " ", sprintf("%-5s", $this->tagSchema))." ; "; 316 347 else 317 348 $returned.="tag: 0x".sprintf("%04x", $this->tagId)." ; "; -
extensions/AMetaData/JpegMetaData/JpegMetaData.class.php
r6722 r6729 4 4 * 5 5 * Version : 1.0.1 6 * Date : 2010-07-2 46 * Date : 2010-07-29 7 7 * 8 8 * Author : Grum … … 41 41 * | 1.0.0 | | * first public release 42 42 * | | | 43 * | 1.0.1 | 2010-07-2 4| * mantis bug:168643 * | 1.0.1 | 2010-07-29 | * mantis bug:1686 44 44 * | | | . bug reported on IfdReader 45 45 * | | | When sub IFD (0x8769) refers to a sub IFD with … … 50 50 * | | | (right solution: to be able to read negative 51 51 * | | | offset) 52 * | | | 52 53 * | | | * mantis feature : 1719 53 54 * | | | . Coding a DateTime class ; used only if there is 54 55 * | | | no PHP built-in DateTime class 56 * | | | 57 * | | | * add the "schema" property to Tag class 58 * | | | 59 * | | | * fixed bug about filtering schema 60 * | | | . when loading metadata, filter on schema are now 61 * | | | applied ; 'magic' metadata are computed even if 62 * | | | the other schema are filtered 63 * | | | 64 * | | | 65 * | | | 66 * | | | 55 67 * | | | 56 68 * | | | … … 133 145 const TAGFILTER_IMPLEMENTED = 0x02; 134 146 const TAGFILTER_ALL = 0x03; 135 136 const KEY_EXIF_TIFF = "exif.tiff";137 const KEY_EXIF_EXIF = "exif.exif";138 const KEY_EXIF_GPS = "exif.gps";139 const KEY_EXIF = "exif";140 const KEY_IPTC = "iptc";141 const KEY_XMP = "xmp";142 const KEY_MAGIC = "magic";143 147 144 148 private $jpeg = null; … … 238 242 case "exif": 239 243 $tmp=new IfdTags(); 240 $schema= "exif";244 $schema=Schemas::EXIF; 241 245 break; 242 246 case "gps": 243 247 $tmp=new GpsTags(); 244 $schema= "exif.gps";248 $schema=Schemas::EXIF_GPS; 245 249 break; 246 250 case "iptc": 247 251 $tmp=new IptcTags(); 248 $schema= "iptc";252 $schema=Schemas::IPTC; 249 253 break; 250 254 case "xmp": 251 255 $tmp=new XmpTags(); 252 $schema= "xmp";256 $schema=Schemas::XMP; 253 257 break; 254 258 case "magic": 255 259 $tmp=new MagicTags(); 256 $schema= "magic";260 $schema=Schemas::MAGIC; 257 261 break; 258 262 case MAKER_PENTAX: 259 263 include_once(JPEG_METADATA_DIR."TagDefinitions/PentaxTags.class.php"); 260 264 $tmp=new PentaxTags(); 261 $schema= "exif.".MAKER_PENTAX;265 $schema=Schemas::EXIF_MAKER.'.'.MAKER_PENTAX; 262 266 break; 263 267 case MAKER_NIKON: 264 268 include_once(JPEG_METADATA_DIR."TagDefinitions/NikonTags.class.php"); 265 269 $tmp=new NikonTags(); 266 $schema= "exif.".MAKER_NIKON;270 $schema=Schemas::EXIF_MAKER.'.'.MAKER_NIKON; 267 271 break; 268 272 case MAKER_CANON: 269 273 include_once(JPEG_METADATA_DIR."TagDefinitions/CanonTags.class.php"); 270 274 $tmp=new CanonTags(); 271 $schema= "exif.".MAKER_CANON;275 $schema=Schemas::EXIF_MAKER.'.'.MAKER_CANON; 272 276 break; 273 277 default: … … 287 291 $name=$key; 288 292 289 if(array_key_exists('schema', $tag) and $val== "exif")293 if(array_key_exists('schema', $tag) and $val==Schemas::EXIF) 290 294 $subSchema=".".$tag['schema']; 291 295 else 292 296 $subSchema=""; 293 297 294 if($val== 'xmp')298 if($val==Schemas::XMP) 295 299 $keyName=$schema.$subSchema.".".$key; 296 300 else … … 405 409 * Load Exifs tags from Tiff block 406 410 */ 407 if($data->getNbIFDs()>0) 411 if($data->getNbIFDs()>0 and 412 ($this->options['magic'] or $this->options['exif'] or $this->options['maker'])) 408 413 { 409 $this->loadIfdTags($data->getIFD(0), self::KEY_EXIF_TIFF);414 $this->loadIfdTags($data->getIFD(0), Schemas::EXIF_TIFF); 410 415 } 411 416 } … … 415 420 * Load Xmp tags from Xmp block 416 421 */ 417 $this->loadTags($data->getTags(), self::KEY_XMP); 422 if($this->options['magic'] or $this->options['xmp']) 423 { 424 $this->loadTags($data->getTags(), Schemas::XMP); 425 } 418 426 } 419 427 elseif($data instanceof IptcReader) … … 425 433 $data->optimizeDateTime(); 426 434 427 $this->loadTags($data->getTags(), self::KEY_IPTC); 435 if($this->options['magic'] or $this->options['iptc']) 436 { 437 $this->loadTags($data->getTags(), Schemas::IPTC); 438 } 428 439 } 429 440 } … … 433 444 { 434 445 $this->processMagicTags(); 446 } 447 448 // clean all unwanted metadata 449 foreach($this->tags as $key => $tag) 450 { 451 if(!$this->options[$tag->getSchema()]) unset($this->tags[$key]); 435 452 } 436 453 … … 543 560 { 544 561 case 'Exif IFD Pointer': 545 $exifKey2= self::KEY_EXIF_EXIF;562 $exifKey2=Schemas::EXIF_EXIF; 546 563 break; 547 564 case 'MakerNote': 548 $exifKey2= self::KEY_EXIF.".".$tag->getTag()->getLabel()->getMaker();565 $exifKey2=Schemas::EXIF_MAKER.".".$tag->getTag()->getLabel()->getMaker(); 549 566 break; 550 567 case 'GPS IFD Pointer': 551 $exifKey2= self::KEY_EXIF_GPS;568 $exifKey2=Schemas::EXIF_GPS; 552 569 break; 553 570 default: … … 621 638 $tag->setImplemented($val['implemented']); 622 639 $tag->setTranslatable($val['translatable']); 640 $tag->setSchema(Schemas::MAGIC); 623 641 624 642 $i=count($val['tagValues']); -
extensions/AMetaData/JpegMetaData/Readers/CanonReader.class.php
r5222 r6729 56 56 class CanonReader extends MakerNotesReader 57 57 { 58 protected $schema = Schemas::EXIF; 59 58 60 /** 59 61 * The constructor needs, like the ancestor, the datas to be parsed … … 187 189 $entry->getTag()->setImplemented($tagDef['implemented']); 188 190 $entry->getTag()->setTranslatable($tagDef['translatable']); 191 $entry->getTag()->setSchema($this->schema); 189 192 190 193 if(array_key_exists('tagValues', $tagDef)) … … 333 336 $entry->getTag()->setImplemented($tagDef['implemented']); 334 337 $entry->getTag()->setTranslatable($tagDef['translatable']); 338 $entry->getTag()->setSchema($this->schema); 335 339 336 340 if(array_key_exists('tagValues', $tagDef)) … … 509 513 $entry->getTag()->setImplemented($subTagDef['implemented']); 510 514 $entry->getTag()->setTranslatable($subTagDef['translatable']); 515 $entry->getTag()->setSchema($this->schema); 511 516 512 517 if(array_key_exists('tagValues', $subTagDef)) … … 598 603 $entry->getTag()->setImplemented($subTagDef['implemented']); 599 604 $entry->getTag()->setTranslatable($subTagDef['translatable']); 605 $entry->getTag()->setSchema($this->schema); 600 606 601 607 if(array_key_exists('tagValues', $subTagDef)) -
extensions/AMetaData/JpegMetaData/Readers/GpsReader.class.php
r5222 r6729 54 54 class GpsReader extends IfdReader 55 55 { 56 protected $schema = Schemas::EXIF; 57 56 58 function __destruct() 57 59 { -
extensions/AMetaData/JpegMetaData/Readers/IfdReader.class.php
r6722 r6729 81 81 { 82 82 protected $byteOrder = BYTE_ORDER_LITTLE_ENDIAN; 83 protected $schema = Schemas::EXIF; 84 83 85 84 86 private $nextIFDOffset = 0; 85 87 86 88 private $dataOffset = 0; 89 87 90 88 91 /** … … 233 236 $entry->getTag()->setImplemented($tag['implemented']); 234 237 $entry->getTag()->setTranslatable($tag['translatable']); 238 $entry->getTag()->setSchema($this->schema); 235 239 236 240 /* -
extensions/AMetaData/JpegMetaData/Readers/IptcReader.class.php
r5237 r6729 65 65 const HEADER_1 = "Photoshop 3.0\x00"; 66 66 const HEADER_2 = "Adobe_Photoshop2.5:\x00"; 67 protected $schema = Schemas::IPTC; 67 68 68 69 private $header = ""; … … 237 238 $tag->setImplemented($tagProperties['implemented']); 238 239 $tag->setTranslatable($tagProperties['translatable']); 240 $tag->setSchema($this->schema); 239 241 240 242 /* -
extensions/AMetaData/JpegMetaData/Readers/NikonReader.class.php
r5228 r6729 59 59 class NikonReader extends MakerNotesReader 60 60 { 61 protected $schema = Schemas::EXIF; 62 61 63 /* these 2 specific metadata are used to decrypt some information, like the 62 64 * data lens -
extensions/AMetaData/JpegMetaData/Readers/PentaxReader.class.php
r5222 r6729 60 60 class PentaxReader extends MakerNotesReader 61 61 { 62 protected $schema = Schemas::EXIF; 63 62 64 /** 63 65 * The constructor needs, like the ancestor, the datas to be parsed -
extensions/AMetaData/JpegMetaData/Readers/XmpReader.class.php
r5237 r6729 53 53 class XmpReader extends GenericReader 54 54 { 55 protected $schema = Schemas::XMP; 56 55 57 private $xmlData = NULL; 56 58 … … 300 302 $tag->setImplemented($tagProperties['implemented']); 301 303 $tag->setTranslatable($tagProperties['translatable']); 302 304 $tag->setSchema($this->schema); 303 305 304 306 if(array_key_exists('name', $tagProperties)) -
extensions/AMetaData/admin/amd_metadata_select.tpl
r6722 r6729 201 201 <select id="iSelectFilterTagList" onchange="loadTagList();"> 202 202 <option value="" {if $datas.config_GetListTags_FilterType==""}selected{/if}>{'g003_no_filter'|@translate}</option> 203 {if !in_array('magic', $amdConfig.amd_FillDataBaseExcludeFilters)} 203 204 <option value="magic" {if $datas.config_GetListTags_FilterType=="magic"}selected{/if}>{'g003_magic_filter'|@translate}</option> 205 {/if} 204 206 <option value="userDefined" {if $datas.config_GetListTags_FilterType=="userDefined"}selected{/if}>{'g003_userDefined_filter'|@translate}</option> 207 208 {if !in_array('exif', $amdConfig.amd_FillDataBaseExcludeFilters)} 205 209 <option value="exif" {if $datas.config_GetListTags_FilterType=="exif"}selected{/if}>Exif</option> 206 <option value="exif.Canon" {if $datas.config_GetListTags_FilterType=="exif.Canon"}selected{/if}>Exif [Canon]</option> 207 <option value="exif.Nikon" {if $datas.config_GetListTags_FilterType=="exif.Nikon"}selected{/if}>Exif [Nikon]</option> 208 <option value="exif.Pentax" {if $datas.config_GetListTags_FilterType=="exif.Pentax"}selected{/if}>Exif [Pentax]</option> 210 {/if} 211 {if !in_array('exif.maker', $amdConfig.amd_FillDataBaseExcludeFilters)} 212 <option value="exif.maker.Canon" {if $datas.config_GetListTags_FilterType=="exif.maker.Canon"}selected{/if}>Exif [Canon]</option> 213 <option value="exif.maker.Nikon" {if $datas.config_GetListTags_FilterType=="exif.maker.Nikon"}selected{/if}>Exif [Nikon]</option> 214 <option value="exif.maker.Pentax" {if $datas.config_GetListTags_FilterType=="exif.maker.Pentax"}selected{/if}>Exif [Pentax]</option> 215 {/if} 216 {if !in_array('xmp', $amdConfig.amd_FillDataBaseExcludeFilters)} 209 217 <option value="xmp" {if $datas.config_GetListTags_FilterType=="xmp"}selected{/if}>Xmp</option> 218 {/if} 219 {if !in_array('iptc', $amdConfig.amd_FillDataBaseExcludeFilters)} 210 220 <option value="iptc" {if $datas.config_GetListTags_FilterType=="iptc"}selected{/if}>Iptc</option> 221 {/if} 211 222 </select> 212 223 </label> -
extensions/AMetaData/amd.css
r6722 r6729 56 56 } 57 57 .helper { 58 -moz-border-radius: 8px;59 -webkit-border-radius: 8px;60 -khtml-border-radius: 8px;61 border-radius: 8px;58 -moz-border-radius:4px; 59 -webkit-border-radius:4px; 60 -khtml-border-radius:4px; 61 border-radius:4px; 62 62 border:2px dashed #777777; 63 63 margin:4px 4px 4px 12px; … … 104 104 border-radius:8px; 105 105 } 106 107 .warnings { 108 -moz-border-radius:4px; 109 -webkit-border-radius:4px; 110 -khtml-border-radius:4px; 111 border-radius:4px; 112 } 113 .warnings p { 114 margin:0; 115 padding:0 0 6px; 116 text-align: justify; 117 } 118 .warnings ul { 119 margin:-6px 0; 120 padding:0 40px 6px; 121 } 122 table.mdInfo { 123 width:100%; 124 text-align:left; 125 } 126 table.mdInfo tr { 127 vertical-align:top; 128 } 129 table.mdInfo tr td ul { 130 margin:0px; 131 } 132 span.mdInfo { 133 width:100px; 134 display:inline-block; 135 font-weight:bold; 136 } -
extensions/AMetaData/amd_aip.class.inc.php
r6722 r6729 45 45 46 46 $this->loadConfig(); 47 $this->configForTemplate(); 47 48 $this->initEvents(); 48 49 … … 446 447 { 447 448 case 'state': 449 $template->assign('sheetContent', $this->displayDatabaseStatus()); 448 450 break; 449 451 case 'update': … … 454 456 $template->assign_var_from_handle('AMD_BODY_PAGE', 'body_page'); 455 457 } 458 459 460 461 /** 462 * display the database status 463 * 464 * @return String : the content of the page 465 */ 466 private function displayDatabaseStatus() 467 { 468 global $template, $page; 469 470 $template->set_filename('sheet_page', dirname(__FILE__).'/admin/amd_metadata_database_status.tpl'); 471 472 $datas=array( 473 'urlRequest' => $this->getAdminLink('ajax'), 474 'warning1' => GPCCore::BBtoHTML(l10n('g003_databaseWarning1')), 475 'nfoMetadata' => Array( 476 'exif' => 0, 477 'iptc' => 0, 478 'magic' => 0, 479 'xmp' => 0, 480 'userDefined' => 0, 481 'numOfPictures' => 0, 482 'numOfNotAnalyzedPictures' => 0, 483 'numOfPicturesWithoutTag' => 0, 484 'nfoSize' => 0, 485 'nfoRows' => 0, 486 'nfoSizeAndRows' => '', 487 ) 488 ); 489 490 $sql="SELECT SUM(numOfImg) AS nb, 'exif' AS `type` 491 FROM ".$this->tables['used_tags']." 492 WHERE tagId LIKE 'exif.%' 493 UNION 494 SELECT SUM(numOfImg), 'iptc' 495 FROM ".$this->tables['used_tags']." 496 WHERE tagId LIKE 'iptc.%' 497 UNION 498 SELECT SUM(numOfImg), 'magic' 499 FROM ".$this->tables['used_tags']." 500 WHERE tagId LIKE 'magic.%' 501 UNION 502 SELECT SUM(numOfImg), 'xmp' 503 FROM ".$this->tables['used_tags']." 504 WHERE tagId LIKE 'xmp.%' 505 UNION 506 SELECT SUM(numOfImg), 'userDefined' 507 FROM ".$this->tables['used_tags']." 508 WHERE tagId LIKE 'userDefined.%' 509 UNION 510 SELECT COUNT(imageId), 'numOfPictures' 511 FROM ".$this->tables['images']." 512 WHERE analyzed='y' 513 UNION 514 SELECT COUNT(imageId), 'numOfNotAnalyzedPictures' 515 FROM ".$this->tables['images']." 516 WHERE analyzed='n' 517 UNION 518 SELECT COUNT(imageId), 'numOfPicturesWithoutTag' 519 FROM ".$this->tables['images']." 520 WHERE nbTags=0"; 521 $result=pwg_query($sql); 522 if($result) 523 { 524 while($row=pwg_db_fetch_assoc($result)) 525 { 526 if(!is_null($row['nb'])) 527 { 528 $datas['nfoMetadata'][$row['type']]=$row['nb']; 529 if($row['type']=='exif' or 530 $row['type']=='iptc' or 531 $row['type']=='magic' or 532 $row['type']=='xmp' or 533 $row['type']=='userDefined') $datas['nfoMetadata']['nfoRows']+=$row['nb']; 534 } 535 } 536 } 537 538 $sql="SHOW TABLE STATUS WHERE name LIKE '".$this->tables['images_tags']."'"; 539 $result=pwg_query($sql); 540 if($result) 541 { 542 while($row=pwg_db_fetch_assoc($result)) 543 { 544 $datas['nfoMetadata']['nfoSize']=$row['Data_length']+$row['Index_length']; 545 } 546 } 547 548 if($datas['nfoMetadata']['nfoSize']<1048576) 549 { 550 $datas['nfoMetadata']['nfoSize']=sprintf('%.2fKio', $datas['nfoMetadata']['nfoSize']/1024); 551 } 552 else 553 { 554 $datas['nfoMetadata']['nfoSize']=sprintf('%.2fMio', $datas['nfoMetadata']['nfoSize']/1048576); 555 } 556 $datas['nfoMetadata']['nfoSizeAndRows']=sprintf(l10n('g003_sizeAndRows'), $datas['nfoMetadata']['nfoSize'], $datas['nfoMetadata']['nfoRows']); 557 $datas['nfoMetadata']['numOfPictures']=sprintf(l10n('g003_numberOfAnalyzedPictures'), $datas['nfoMetadata']['numOfPictures']); 558 $datas['nfoMetadata']['numOfNotAnalyzedPictures']=sprintf(l10n('g003_numberOfNotAnalyzedPictures'), $datas['nfoMetadata']['numOfNotAnalyzedPictures']); 559 $datas['nfoMetadata']['numOfPicturesWithoutTag']=sprintf(l10n('g003_numberOfPicturesWithoutTags'), $datas['nfoMetadata']['numOfPicturesWithoutTag']); 560 561 $template->assign("datas", $datas); 562 563 return($template->parse('sheet_page', true)); 564 } // displayDatabaseStatus 565 566 456 567 457 568 … … 491 602 492 603 /* 493 * delete metdata for images that are not in the AMD image table 494 */ 495 $sql="DELETE FROM ".$this->tables['images_tags']." 496 WHERE imageId NOT IN (SELECT imageId FROM ".$this->tables['images'].")"; 604 * delete metadata for images that are not in the AMD image table 605 */ 606 $sql="DELETE ait 607 FROM ".$this->tables['images_tags']." ait 608 JOIN (SELECT DISTINCT imageId FROM ".$this->tables['images_tags']." ) aitd 609 ON ait.imageId=aitd.imageId 610 WHERE aitd.imageId NOT IN (SELECT id FROM ".IMAGES_TABLE.") "; 497 611 pwg_query($sql); 498 612 499 613 500 $template->set_filename('sheet_page', dirname(__FILE__).'/admin/amd_metadata_database.tpl'); 614 615 616 $template->set_filename('sheet_page', dirname(__FILE__).'/admin/amd_metadata_database_database.tpl'); 501 617 502 618 $datas=array( -
extensions/AMetaData/amd_ajax.php
r6723 r6729 66 66 $_REQUEST['ajaxfct']=='admin.makeStats.doAnalyze' or 67 67 $_REQUEST['ajaxfct']=='admin.makeStats.consolidate' or 68 $_REQUEST['ajaxfct']=='admin.makeStats.getStatus' or69 68 $_REQUEST['ajaxfct']=='admin.showStats.getListTags' or 70 69 $_REQUEST['ajaxfct']=='admin.showStats.getListImages' or 71 70 $_REQUEST['ajaxfct']=='admin.updateTag.select' or 71 $_REQUEST['ajaxfct']=='admin.config.setOption' or 72 72 $_REQUEST['ajaxfct']=='admin.group.getList' or 73 73 $_REQUEST['ajaxfct']=='admin.group.delete' or … … 100 100 $_REQUEST['selectMode']=="caddieAdd" or 101 101 $_REQUEST['selectMode']=="caddieReplace" or 102 $_REQUEST['selectMode']=="analyzed" or 102 103 $_REQUEST['selectMode']=="all")) $_REQUEST['selectMode']="caddieAdd"; 103 104 104 105 if(!isset($_REQUEST['numOfItems'])) $_REQUEST['numOfItems']=25; 106 107 if(!isset($_REQUEST['ignoreOptions'])) $_REQUEST['ignoreOptions']=array(); 105 108 } 106 109 … … 135 138 136 139 if(!($_REQUEST['filterType']=="" or 137 $_REQUEST['filterType']=="magic"or140 ($_REQUEST['filterType']=="magic" and !in_array('magic', $this->config['amd_FillDataBaseExcludeFilters'])) or 138 141 $_REQUEST['filterType']=="userDefined" or 139 $_REQUEST['filterType']=="exif" or 140 $_REQUEST['filterType']=="exif.Canon" or 141 $_REQUEST['filterType']=="exif.Nikon" or 142 $_REQUEST['filterType']=="exif.Pentax" or 143 $_REQUEST['filterType']=="xmp" or 144 $_REQUEST['filterType']=="iptc")) $_REQUEST['filterType']=""; 142 ($_REQUEST['filterType']=="exif" and !in_array('exif', $this->config['amd_FillDataBaseExcludeFilters'])) or 143 ($_REQUEST['filterType']=="exif.maker.Canon" and !in_array('maker', $this->config['amd_FillDataBaseExcludeFilters'])) or 144 ($_REQUEST['filterType']=="exif.maker.Nikon" and !in_array('maker', $this->config['amd_FillDataBaseExcludeFilters'])) or 145 ($_REQUEST['filterType']=="exif.maker.Pentax" and !in_array('maker', $this->config['amd_FillDataBaseExcludeFilters'])) or 146 ($_REQUEST['filterType']=="xmp" and !in_array('xmp', $this->config['amd_FillDataBaseExcludeFilters'])) or 147 ($_REQUEST['filterType']=="iptc" and !in_array('iptc', $this->config['amd_FillDataBaseExcludeFilters'])) 148 )) $_REQUEST['filterType']=""; 145 149 146 150 if(!isset($_REQUEST['excludeUnusedTag'])) $_REQUEST['excludeUnusedTag']="n"; … … 176 180 177 181 if(!isset($_REQUEST['tagSelected'])) $_REQUEST['tagSelected']=""; 182 } 183 184 /* 185 * check admin.config.setOption values 186 */ 187 if($_REQUEST['ajaxfct']=="admin.config.setOption") 188 { 189 if(!isset($_REQUEST['id'])) $_REQUEST['ajaxfct']=''; 190 if(!isset($_REQUEST['value'])) $_REQUEST['ajaxfct']=''; 178 191 } 179 192 … … 315 328 { 316 329 case 'admin.makeStats.getList': 317 $result=$this->ajax_amd_admin_makeStatsGetList($_REQUEST['selectMode'], $_REQUEST['numOfItems'] );330 $result=$this->ajax_amd_admin_makeStatsGetList($_REQUEST['selectMode'], $_REQUEST['numOfItems'], $_REQUEST['ignoreOptions']); 318 331 break; 319 332 case 'admin.makeStats.doAnalyze': … … 323 336 $result=$this->ajax_amd_admin_makeStatsConsolidate(); 324 337 break; 325 case 'admin.makeStats.getStatus':326 $result=$this->ajax_amd_admin_makeStatsGetStatus();327 break;328 338 case 'admin.showStats.getListTags': 329 339 $result=$this->ajax_amd_admin_showStatsGetListTags($_REQUEST['orderType'], $_REQUEST['filterType'], $_REQUEST['excludeUnusedTag'], $_REQUEST['selectedTagOnly']); … … 334 344 case 'admin.updateTag.select': 335 345 $result=$this->ajax_amd_admin_updateTagSelect($_REQUEST['numId'], $_REQUEST['tagSelected']); 346 break; 347 case 'admin.config.setOption': 348 $result=$this->ajax_amd_admin_configSetOption($_REQUEST['id'], $_REQUEST['value']); 336 349 break; 337 350 case 'admin.group.getList': … … 452 465 * "23 78 4523 5670" 453 466 */ 454 private function ajax_amd_admin_makeStatsGetList($mode, $nbOfItems )467 private function ajax_amd_admin_makeStatsGetList($mode, $nbOfItems, $ignoreSchemas) 455 468 { 456 469 global $user; 457 470 458 471 $returned=""; 472 $this->config['amd_FillDataBaseIgnoreSchemas']=$ignoreSchemas; 459 473 $this->config['amd_NumberOfItemsPerRequest']=$nbOfItems; 460 474 $this->saveConfig(); 461 475 462 476 $sql="SELECT ait.imageId FROM ".$this->tables['images']." ait"; 463 if($mode== "notAnalyzed")477 if($mode=='notAnalyzed') 464 478 { 465 479 $sql.=" WHERE ait.analyzed='n'"; 466 480 } 467 elseif($mode=="caddieAdd" or $mode=="caddieReplace") 468 { 469 481 elseif($mode=='caddieAdd' or $mode=='caddieReplace') 482 { 470 483 $sql.=" LEFT JOIN ".CADDIE_TABLE." ct ON ait.imageId = ct.element_id 471 484 WHERE ct.user_id = ".$user['id']." "; 472 485 473 if($mode=="caddieAdd") $sql.=" AND ait.analyzed='n'"; 474 } 475 476 if($mode=="all" or $mode=="caddieReplace") 486 if($mode=='caddieAdd') $sql.=" AND ait.analyzed='n'"; 487 } 488 elseif($mode=='analyzed') 489 { 490 $sql.=" WHERE ait.analyzed='y'"; 491 492 pwg_query("UPDATE ".$this->tables['images']." SET nbTags=0 WHERE analyzed='y';"); 493 pwg_query("UPDATE ".$this->tables['used_tags']." SET numOfImg=0"); 494 pwg_query("DELETE FROM ".$this->tables['images_tags']); 495 } 496 497 if($mode=='all' or $mode=='caddieReplace') 477 498 { 478 499 pwg_query("UPDATE ".$this->tables['images']." SET analyzed='n', nbTags=0"); … … 563 584 564 585 /** 565 * returns a list of formated string, separated with a semi-colon :566 * - number of current analyzed pictures + number of current analyzed tags567 * for the analyzed pictures568 * - number of pictures not analyzed569 * - number of pictures without tag570 *571 * @return String572 */573 private function ajax_amd_admin_makeStatsGetStatus()574 {575 $numOfMetaData=0;576 $numOfPictures=0;577 $numOfPicturesNotAnalyzed=0;578 579 $sql="SELECT COUNT(imageId), SUM(nbTags) FROM ".$this->tables['images']."580 WHERE analyzed='y';";581 $result=pwg_query($sql);582 if($result)583 {584 while($row=pwg_db_fetch_row($result))585 {586 $numOfPictures=$row[0];587 $numOfMetaData=$row[1];588 }589 }590 591 592 $sql="SELECT COUNT(imageId) FROM ".$this->tables['images']."593 WHERE analyzed='n';";594 $result=pwg_query($sql);595 if($result)596 {597 while($row=pwg_db_fetch_row($result))598 {599 $numOfPicturesNotAnalyzed=$row[0];600 }601 }602 603 $sql="SELECT COUNT(imageId) FROM ".$this->tables['images']."604 WHERE nbTags=0;";605 $result=pwg_query($sql);606 if($result)607 {608 while($row=pwg_db_fetch_row($result))609 {610 $numOfPicturesWithoutTags=$row[0];611 }612 }613 614 return(sprintf(l10n("g003_numberOfAnalyzedPictures"), $numOfPictures, $numOfMetaData).";".615 sprintf(l10n("g003_numberOfNotAnalyzedPictures"), $numOfPicturesNotAnalyzed).";".616 sprintf(l10n("g003_numberOfPicturesWithoutTags"), $numOfPicturesWithoutTags));617 }618 619 620 /**621 586 * return a formatted <table> (using the template "amd_stat_show_iListTags") 622 587 * of used tag with, for each tag, the number and the percentage of pictures … … 1385 1350 $nbImg=$this->buildUserDefinedTags($id); 1386 1351 1387 $sql="UPDATE ".$this->tables['used_tags']." 1388 SET numOfImg='$nbImg';"; 1389 $result=pwg_query($sql); 1352 $this->makeStatsConsolidation(); 1390 1353 1391 1354 return($id.','.$nbImg); … … 1438 1401 } 1439 1402 1440 1441 } 1403 /** 1404 * set value(s) for option(s) 1405 * 1406 * @param Array or String $ids : a string or an array of string (id) 1407 * @param Array or String $values : a string or an array of string 1408 * @return String : ok or ko 1409 */ 1410 private function ajax_amd_admin_configSetOption($ids, $values) 1411 { 1412 if(is_array($ids) and is_array($values) and count($ids)==count($values)) 1413 { 1414 foreach($ids as $key=>$id) 1415 { 1416 if(isset($id, $this->config)) 1417 { 1418 $this->config[$id]=$values[$key]; 1419 } 1420 } 1421 $this->saveConfig(); 1422 return('ok'); 1423 } 1424 elseif(is_string($ids) and is_string($values)) 1425 { 1426 if(isset($ids, $this->config)) 1427 { 1428 $this->config[$ids]=$values; 1429 } 1430 $this->saveConfig(); 1431 return('ok'); 1432 } 1433 1434 return('ko'); 1435 } 1436 1437 1438 1439 } //class 1442 1440 1443 1441 -
extensions/AMetaData/amd_install.class.inc.php
r6722 r6729 156 156 $this->initConfig(); 157 157 $this->loadConfig(); 158 $this->loadConfigFromFile(dirname($this->getFileLocation()).'/activatePlugin.conf.php'); 158 159 159 160 /* … … 177 178 } 178 179 180 $this->config['amd_FillDataBaseExcludeTags']=array(); 179 181 $this->config['installed']=AMD_VERSION2; //update the installed release number 180 182 $this->saveConfig(); … … 234 236 private function initializeDatabase() 235 237 { 238 global $user; 239 236 240 L10n::setLanguage('en_UK'); 237 241 … … 249 253 { 250 254 $sql="INSERT INTO ".$this->tables['used_tags']." VALUES('', '".$key."', '".(($val['translatable'])?'y':'n')."', '".$val['name']."', 0, '".addslashes(L10n::get($val['name']))."');"; 255 pwg_query($sql); 256 } 257 258 /* 259 * exclude unauthorized tag with the 'amd_FillDataBaseExcludeTags' option 260 */ 261 if(count($this->config['amd_FillDataBaseExcludeTags'])) 262 { 263 $sql=""; 264 foreach($this->config['amd_FillDataBaseExcludeTags'] as $key => $tag) 265 { 266 if($sql!="") $sql.=" OR "; 267 $sql.=" tagId LIKE '$tag' "; 268 } 269 $sql="DELETE FROM ".$this->tables['used_tags']." 270 WHERE ".$sql; 251 271 pwg_query($sql); 252 272 } -
extensions/AMetaData/amd_root.class.inc.php
r6722 r6729 76 76 { 77 77 $this->config=array( 78 'amd_NumberOfItemsPerRequest' => 25,78 // options set by the plugin interface - don't modify them manually 79 79 'amd_GetListTags_OrderType' => "tag", 80 80 'amd_GetListTags_FilterType' => "magic", … … 82 82 'amd_GetListTags_SelectedTagOnly' => "n", 83 83 'amd_GetListImages_OrderType' => "value", 84 'amd_AllPicturesAreAnalyzed' => "n", 84 85 'amd_FillDataBaseContinuously' => "y", 85 'amd_AllPicturesAreAnalyzed' => "n", 86 'amd_FillDataBaseIgnoreSchemas' => array(), 87 88 // theses options can be set manually 89 'amd_NumberOfItemsPerRequest' => 25, 90 'amd_DisplayWarningsMessageStatus' => "y", 91 'amd_DisplayWarningsMessageUpdate' => "y", 92 'amd_FillDataBaseExcludeTags' => array(), 93 'amd_FillDataBaseExcludeFilters' => array(), 86 94 ); 95 /* 96 * ==> amd_FillDataBaseExcludeTags : array of tagId 97 * the listed tag are completely excluded by the plugin, as they don't 98 * exist 99 * for each tagId you can use generic char as the LIKE sql operator 100 * array('xmp.%', 'exif.maker.%') 101 * -> exclude all XMP and EXIF MAKER tags 102 * 103 * ==> amd_FillDataBaseExcludeFilters : array of filterValue 104 * if you exclude all the xmp tag you probably want to exclude everything 105 * displaying 'xmp' 106 * array('exif.maker', 107 * 'exif', 108 * 'iptc', 109 * 'xmp', 110 * 'magic') 111 * 112 * ==> amd_DisplayWarningsMessageStatus : 'y' or 'n' 113 * amd_DisplayWarningsMessageUpdate 114 * you can disable warnings messages displayed on the database status&update 115 * page 116 */ 87 117 } 88 118 … … 107 137 return(parent::getAdminLink()); 108 138 } 139 } 140 141 /** 142 * 143 */ 144 protected function configForTemplate() 145 { 146 global $template; 147 148 $template->assign('amdConfig', $this->config); 109 149 } 110 150 … … 175 215 protected function analyzeImageFile($fileName, $imageId, $loaded=false) 176 216 { 217 $schemas=array_flip($this->config['amd_FillDataBaseIgnoreSchemas']); 177 218 /* 178 219 * the JpegMetaData object is instancied in the constructor … … 185 226 'filter' => AMD_JpegMetaData::TAGFILTER_IMPLEMENTED, 186 227 'optimizeIptcDateTime' => true, 187 'exif' => true, 188 'iptc' => true, 189 'xmp' => true 228 'exif' => !isset($schemas['exif']), 229 'iptc' => !isset($schemas['iptc']), 230 'xmp' => !isset($schemas['xmp']), 231 'magic' => !isset($schemas['magic']), 190 232 ) 191 233 ); … … 469 511 protected function makeStatsConsolidation() 470 512 { 513 // reset numbers 514 $sql="UPDATE ".$this->tables['used_tags']." ut 515 SET ut.numOfImg = 0;"; 516 pwg_query($sql); 517 518 $sql="UPDATE ".$this->tables['images']." pai 519 SET pai.nbTags = 0;"; 520 pwg_query($sql); 521 522 523 // count number of images per tag 471 524 $sql="UPDATE ".$this->tables['used_tags']." ut, 472 (SELECT COUNT( imageId) AS nb, numId525 (SELECT COUNT(DISTINCT imageId) AS nb, numId 473 526 FROM ".$this->tables['images_tags']." 474 527 GROUP BY numId) nb 475 528 SET ut.numOfImg = nb.nb 476 529 WHERE ut.numId = nb.numId;"; 530 pwg_query($sql); 531 532 //count number of tags per images 533 $sql="UPDATE ".$this->tables['images']." pai, 534 (SELECT COUNT(DISTINCT numId) AS nb, imageId 535 FROM ".$this->tables['images_tags']." 536 GROUP BY imageId) nb 537 SET pai.nbTags = nb.nb 538 WHERE pai.imageId = nb.imageId;"; 477 539 pwg_query($sql); 478 540 -
extensions/AMetaData/language/fr_FR/plugin.lang.php
r6722 r6729 13 13 $lang['g003_show'] = "Consulter"; 14 14 15 $lang['g003_numberOfAnalyzedPictures'] = "%d images ont fait l'objet d'une analyse et représentent %d métadonnées";16 15 $lang['g003_numberOfNotAnalyzedPictures'] = "%d images n'ont pas fait l'objet d'une analyse"; 17 16 $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"; … … 78 77 $lang['g003_warning_on_analyze_3a'] = "du nombre de photos dans la galerie"; 79 78 $lang['g003_warning_on_analyze_3b'] = "du nombre de pages visualisées quotidiennement"; 80 $lang['g003_warning_on_analyze_4a'] = "le référentiel n'est exploité qu'à des fins statistiques et facilite le choix des métadonnées sélectionnées pour affichage"; 81 $lang['g003_warning_on_analyze_4b'] = "une image non prise prise en compte pour l'alimentation du référentiel disposera quand même des métadonnées sur la galerie"; 79 82 80 $lang['g003_warning_on_analyze_5'] = "Afin de disposer rapidement d'un référentiel complet, il est possible de procéder à une analyse plus directe de la galerie :"; 83 81 $lang['g003_warning_on_analyze_0'] = "Attention !"; … … 165 163 [/ul]"; 166 164 167 168 // release 0.5.0 165 /* 166 * release 0.5.0 167 */ 169 168 170 169 $lang['g003_y'] = "Oui"; … … 211 210 $lang['g003_userDefined_filter'] = "Métadonnées personnalisées"; 212 211 212 $lang['g003_informations'] = "Informations"; 213 $lang['g003_databaseInformation'] = "Informations importantes à propos du référentiel"; 214 $lang['g003_databaseWarning1']="[p]Le référentiel est constitué des métadonnées contenues dans les images de galerie ainsi que de métadonnées calculées par le plugin. En fonction du nombre d'images et du nombre de métadonnées y étant rattachées, le référentiel peut s'avérer être très volumineux. 215 Avant d'alimenter le référentiel, assurez-vous que la base de données proposée par votre hébergeur permet ce type d'usage. 216 [/p][p]Il est toutefois à noter que l'usage du référentiel est facultatif, ce dernier n'étant pas exploité pour l'affichage des métadonnées des photos de la galerie. 217 [/p][p]L'alimentation du référentiel est nécessaire si vous souhaitez :[/p] 218 [ul] 219 [li]Disposer de statistiques sur les métadonnées présentes dans vos photos (c'est aussi une aide pour la sélection de métadonnées)[/li] 220 [li]Disposer du moteur de recherche[/li] 221 [/ul] 222 "; 223 $lang['g003_sizeAndRows'] = "Le référentiel fait %s et est constitué de %s métadonnées"; 224 $lang['g003_numberOfAnalyzedPictures'] = "%d images ont fait l'objet d'une analyse"; 225 226 $lang['g003_options'] = "Options"; 227 $lang['g003_fillDatabaseContinuously'] = "Alimenter le référentiel au fil de l'eau"; 228 $lang['g003_ignoreMetadata'] = "Ignorer les métadonnées suivantes :"; 229 230 $lang['g003_analyze_analyzed_pictures'] = "L'analyse ne porte que sur les images ayant déjà fait l'objet d'une analyse"; 231 $lang['g003_fillDatabaseIgnoreWarning'] = "Pour être prise en compte, la modification des paramètres de cette option nécessite d'effectuer une analyse"; 232 233 /* 234 * removed keys 235 */ 236 //$lang['g003_warning_on_analyze_4a'] 237 //$lang['g003_warning_on_analyze_4b'] 238 239 213 240 ?> -
extensions/AMetaData/main.inc.php
r6722 r6729 56 56 | | | . Add possibility for user to build their own "magic" 57 57 | | | tags 58 | | | * mantis : feature 1777 59 | | | . Weight of the metadata database can becomes very 60 | | | heavy 58 61 | | | * ajax management was entirely rewritted 59 62 | | | * user interface reviewed 60 | | |61 | | |62 63 | | | 63 64 | | | -
extensions/AMetaData/maintain.inc.php
r6722 r6729 83 83 function plugin_activate($plugin_id, $plugin_version, &$errors) 84 84 { 85 global $prefixeTable ;85 global $prefixeTable, $gpcNeeded; 86 86 87 87 $amd=new AMD_install($prefixeTable, __FILE__);
Note: See TracChangeset
for help on using the changeset viewer.