Changeset 6891 for extensions/AMetaData/amd_ajax.php
- Timestamp:
- Sep 13, 2010, 8:40:44 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/amd_ajax.php
r6729 r6891 83 83 $_REQUEST['ajaxfct']=='admin.userDefined.setTag' or 84 84 $_REQUEST['ajaxfct']=='admin.userDefined.deleteTag' or 85 $_REQUEST['ajaxfct']=='admin.tag.getValues' or 85 86 86 87 $_REQUEST['ajaxfct']=='public.makeStats.doPictureAnalyze')) $_REQUEST['ajaxfct']=''; … … 309 310 310 311 /* 312 * check admin.tag.getValues values 313 */ 314 if($_REQUEST['ajaxfct']=="admin.tag.getValues" and !isset($_REQUEST['id'])) 315 { 316 $_REQUEST['ajaxfct']=''; 317 } 318 319 320 /* 311 321 * check public.makeStats.doPictureAnalyze values 312 322 */ … … 387 397 $result=$this->ajax_amd_admin_userDefinedDeleteTag($_REQUEST['id']); 388 398 break; 399 case 'admin.tag.getValues': 400 $result=$this->ajax_amd_admin_tagGetValues($_REQUEST['id']); 401 break; 389 402 390 403 … … 406 419 { 407 420 // get a randomly picture... 408 $sql="SELECT pai.imageId, pi.path 421 $sql="SELECT pai.imageId, pi.path, pi.has_high 409 422 FROM ".$this->tables['images']." pai 410 423 LEFT JOIN ".IMAGES_TABLE." pi ON pai.imageId=pi.id … … 426 439 { 427 440 $imageId=$row['imageId']; 428 $filename=$path."/".$row['path']; 441 if($row['has_high']===true and $this->config['amd_UseMetaFromHD']=='y') 442 { 443 $filename=$path."/".dirname($row['path'])."/pwg_high/".basename($row['path']); 444 } 445 else 446 { 447 $filename=$path."/".$row['path']; 448 } 429 449 } 430 450 … … 546 566 $path=dirname(dirname(dirname(__FILE__))); 547 567 548 $sql="SELECT id, path FROM ".IMAGES_TABLE." WHERE id IN (".implode(", ", $list).")";568 $sql="SELECT id, path, has_high FROM ".IMAGES_TABLE." WHERE id IN (".implode(", ", $list).")"; 549 569 $result=pwg_query($sql); 550 570 if($result) … … 564 584 //$mem1=memory_get_usage(); 565 585 //echo "memory before analyze:".$mem1."\n"; 566 $returned.=$this->analyzeImageFile($path."/".$row['path'], $row['id']); 586 if($row['has_high']===true and $this->config['amd_UseMetaFromHD']=='y') 587 { 588 $returned.=$this->analyzeImageFile($path."/".dirname($row['path'])."/pwg_high/".basename($row['path']), $row['id']); 589 } 590 else 591 { 592 $returned.=$this->analyzeImageFile($path."/".$row['path'], $row['id']); 593 } 567 594 //echo $returned."\n"; 568 595 //$mem2=memory_get_usage(); … … 722 749 { 723 750 $datas[]=array( 724 "value" => $this->prepareValueForDisplay($row['value'], ($row['translatable']=='y'), ", "),751 "value" => AMD_root::prepareValueForDisplay($row['value'], ($row['translatable']=='y'), ", "), 725 752 "nb" => $row['Nb'], 726 753 "pct" => ($row['numOfImg']!=0)?sprintf("%.2f", 100*$row['Nb']/$row['numOfImg']):"-" … … 1342 1369 foreach($properties['rules'] as $rule) 1343 1370 { 1371 print_r($rule['value']); 1344 1372 $inserts[]="('$id', '".$rule['defId']."', '".$rule['parentId']."', '".$rule['order']."', '".$rule['type']."', '".$rule['value']."', '".$rule['conditionType']."', '".$rule['conditionValue']."')"; 1345 1373 } … … 1401 1429 } 1402 1430 1431 1432 /** 1433 * return the known values for a given tag id 1434 * 1435 * @param String $id : a tag numId 1436 * @return String : an HTML list ready to use 1437 */ 1438 private function ajax_amd_admin_tagGetValues($numId) 1439 { 1440 $returned=""; 1441 1442 $sql="SELECT DISTINCT pait.value, COUNT(pait.imageId) AS nbImg, paut.translatable 1443 FROM ".$this->tables['images_tags']." pait 1444 LEFT JOIN ".$this->tables['used_tags']." paut 1445 ON pait.numId=paut.numId 1446 WHERE pait.numId = '$numId' 1447 GROUP BY pait.value 1448 ORDER BY pait.value"; 1449 $result=pwg_query($sql); 1450 if($result) 1451 { 1452 while($row=pwg_db_fetch_assoc($result)) 1453 { 1454 $value=htmlspecialchars(AMD_root::prepareValueForDisplay($row['value'], ($row['translatable']=='y'), ", "), ENT_QUOTES); 1455 $returned.="<option displayvalue='$value' rawvalue='".$row['value']."'>$value (".$row['nbImg']." ".l10n('images').")</option>"; 1456 } 1457 } 1458 return($returned); 1459 } 1460 1461 1403 1462 /** 1404 1463 * set value(s) for option(s)
Note: See TracChangeset
for help on using the changeset viewer.