From: Banana Date: Wed, 15 Jun 2011 13:15:37 +0000 (+0200) Subject: tag operations are working now X-Git-Tag: 2.1-alpha-2019-0-29~120 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=61e44371226e79a5d68a09f44856c2755c3e056a;p=insipid.git tag operations are working now --- diff --git a/BUGS b/BUGS index 8ee0a88..a4bbf34 100644 --- 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 === diff --git a/ChangeLog b/ChangeLog index 3e59dce..d542267 100755 --- 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 diff --git a/lib/Insipid/Tags.pm b/lib/Insipid/Tags.pm index 96e837b..4844a15 100755 --- a/lib/Insipid/Tags.pm +++ b/lib/Insipid/Tags.pm @@ -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 '

Reanming...

'; @@ -99,10 +95,22 @@ sub tag_operations { elsif(param("doDelete") && param("deleteTag") && param("moveTo")) { print '

Delete...

'; + # 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 'Done !';