]> 91.132.146.200 Git - insipid.git/commitdiff
tag operations are working now
authorBanana <banana@starscream.de>
Wed, 15 Jun 2011 13:15:37 +0000 (15:15 +0200)
committerBanana <banana@starscream.de>
Wed, 15 Jun 2011 13:15:37 +0000 (15:15 +0200)
BUGS
ChangeLog
lib/Insipid/Tags.pm

diff --git a/BUGS b/BUGS
index 8ee0a88c9c4e99165e52c3434980d053684d3ece..a4bbf3470f8d820a41cbeeaa064245f84b9a6f90 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -2,7 +2,6 @@
 
 * Case-sensitivity in SELECT statements with Postgres really do a number on
   the tag algorithms
-* Tag operations (op=tags) or not working yet.
 
 === Fixed in 0.9.21 ===
 
index 3e59dce46e136e028cd4670a1e0a9b2672cab3db..d5422678390493236e3ccfd4fb173286e4e7df85 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
        * tag rename feature implemented
        * tag rename case sensitive problem
        * add bookmark only if url and title are not empty
+       * tag delete is available now. It moves the selected bookmarks
+               to another one
        
 Tue Jul 14 21:38 EST 2009  Luke Reeve   <luke@neuro-tech.net>
 
index 96e837bf79e3f42bddd03f250c6820ff9f387c63..4844a150b9917994d2ccfb4690ecb24c0ec30548 100755 (executable)
@@ -48,10 +48,6 @@ sub tag_operations {
        
        check_access();
        
-       print Dumper param("doDelete");
-       print Dumper param("deleteTag");
-       print Dumper param("moveTo");
-       
        if(param('save') && param('newName')) {
                print '<p>Reanming...</p>';
                
@@ -99,10 +95,22 @@ sub tag_operations {
        elsif(param("doDelete") && param("deleteTag") && param("moveTo")) {
                print '<p>Delete...</p>';
                
+               # this moves the selected tag and its bookmarks to the new one
+               # the tag is still availbale in the DB
+               
                my($delTagName,$moveToTagName) = (param('deleteTag'), param('moveTo'));
                
-               if($delTagName && $moveToTagName && ($delTagName != $moveToTagName)) {
-                       
+               if($delTagName && $moveToTagName && ($delTagName ne $moveToTagName)) {
+                       # get the ones with the old tag
+                       my $oldTagId = get_tag_id_by_name($delTagName);
+                       my $moveToTagId = get_tag_id_by_name($moveToTagName);
+                       if($oldTagId && $moveToTagId) {
+                               my $sql = "UPDATE IGNORE `$tbl_bookmark_tags`
+                                                       SET `tag_id` = ?
+                                                       WHERE `tag_id` = ?";
+                               my $sth = $dbh->prepare($sql);
+                               $sth->execute($moveToTagId,$oldTagId);
+                       }
                }
                
                print '<span style="color: green;">Done !</span>';