Changeset 7443 for extensions/AMetaData


Ignore:
Timestamp:
Oct 27, 2010, 11:23:36 PM (13 years ago)
Author:
grum
Message:

fix bug bug:1968
implement feature bug:1912

Location:
extensions/AMetaData
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMetaData/amd_ajax.php

    r6977 r7443  
    4040  class AMD_ajax extends AMD_root
    4141  {
     42    private $tagSeparators=array(
     43      'xmp.digiKam:TagsList' => '/',
     44      'xmp.lr:hierarchicalSubject' => '|'
     45    );
     46
    4247    /**
    4348     * constructor
     
    15051510      $returned=array();
    15061511      $keywordsList=array();
    1507       $sql="SELECT pait.value, pait.imageId, paut.numId
     1512      $sql="SELECT DISTINCT pait.value, pait.imageId, paut.numId, paut.tagId
    15081513            FROM (".$this->tables['images_tags']." pait
    15091514              JOIN ".$this->tables['used_tags']." paut ON pait.numId = paut.numId)
    15101515
    15111516            WHERE (paut.tagId = 'xmp.dc:subject' OR
    1512                    paut.tagId = 'xmp.digiKam:tagsList' OR
     1517                   paut.tagId = 'xmp.digiKam:TagsList' OR
     1518                   paut.tagId = 'xmp.lr:hierarchicalSubject' OR
    15131519                   paut.tagId = 'iptc.Keywords');";
    15141520      $result=pwg_query($sql);
     
    15251531            foreach($tmp['values'] as $val)
    15261532            {
    1527               $keywordsList[]="('".mysql_escape_string($val)."', ".$row['imageId'].")";
     1533              if($row['tagId']=='xmp.digiKam:TagsList' or $row['tagId']=='xmp.lr:hierarchicalSubject')
     1534              {
     1535                $list=explode($this->tagSeparators[$row['tagId']], $val);
     1536                foreach($list as $subTag)
     1537                {
     1538                  $keywordsList[]="('".mysql_escape_string(trim($subTag))."', ".$row['imageId'].")";
     1539                }
     1540              }
     1541              else
     1542              {
     1543                $keywordsList[]="('".mysql_escape_string($val)."', ".$row['imageId'].")";
     1544              }
    15281545            }
    15291546          }
     
    15541571                      LEFT JOIN ".IMAGE_TAG_TABLE." pit ON pit.tag_id = ptt.id
    15551572                    GROUP BY att.value
    1556                     HAVING nbPicturesTagged < nbPictures";
     1573                    HAVING nbPicturesTagged < nbPictures
     1574                    ORDER BY att.value";
    15571575              $result=pwg_query($sql);
    15581576              if($result)
     
    15951613       */
    15961614      $keywordsList=array();
    1597       $sql="SELECT pait.value, pait.imageId, paut.numId
     1615      $sql="SELECT DISTINCT pait.value, pait.imageId, paut.numId, paut.tagId
    15981616            FROM (".$this->tables['images_tags']." pait
    15991617              JOIN ".$this->tables['used_tags']." paut ON pait.numId = paut.numId)
    16001618
    16011619            WHERE (paut.tagId = 'xmp.dc:subject' OR
    1602                    paut.tagId = 'xmp.digiKam:tagsList' OR
     1620                   paut.tagId = 'xmp.digiKam:TagsList' OR
     1621                   paut.tagId = 'xmp.lr:hierarchicalSubject' OR
    16031622                   paut.tagId = 'iptc.Keywords');";
    16041623      $result=pwg_query($sql);
     
    16151634            foreach($tmp['values'] as $val)
    16161635            {
    1617               $keywordsList[]="('".mysql_escape_string($val)."', ".$row['imageId'].")";
     1636              if($row['tagId']=='xmp.digiKam:TagsList')
     1637              {
     1638                $list=explode($this->tagSeparators[$row['tagId']], $val);
     1639                foreach($list as $subTag)
     1640                {
     1641                  $keywordsList[]="('".mysql_escape_string(trim($subTag))."', ".$row['imageId'].")";
     1642                }
     1643              }
     1644              else
     1645              {
     1646                $keywordsList[]="('".mysql_escape_string($val)."', ".$row['imageId'].")";
     1647              }
    16181648            }
    16191649          }
     
    16401670            /*
    16411671             * 2/ join temp table with piwigo tags table, found the keywords
    1642              *    that don't have a corresponding keyword
     1672             *    that don't have a corresponding tag
    16431673             */
    16441674            $sql="SELECT DISTINCT att.value
    16451675                  FROM amd_temp_tags att LEFT JOIN ".TAGS_TABLE." ptt ON att.value = ptt.name
    16461676                  WHERE ptt.id IS NULL
    1647                     AND".implode(' OR ', $keywords);
     1677                    AND (".implode(' OR ', $keywords).") ";
    16481678            $result=pwg_query($sql);
    16491679            if($result)
     
    16751705        }
    16761706      }
    1677 
    16781707      return($returned);
    16791708    }
  • extensions/AMetaData/main.inc.php

    r7399 r7443  
    150150|         |            |     user
    151151|         |            |
     152|         |            | * mantis bug:1912
     153|         |            |   . Reading digiKam hierarchical keywords as 'flat'
     154|         |            |     keywords
     155|         |            |
     156|         |            | * mantis bug:1968
     157|         |            |   . Keyword to tag conversion generate duplicated tags
    152158|         |            |
    153159|         |            |
Note: See TracChangeset for help on using the changeset viewer.