From: Michael J. Rubinsky Date: Tue, 27 Jan 2009 01:10:39 +0000 (-0500) Subject: Don't use the calendar/event property forms for adding/removing tags. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=89496c13e4a8ed0527922356b2bc94a614ee2210;p=horde.git Don't use the calendar/event property forms for adding/removing tags. (At least for now) Plus some more phpdoc and formatting. --- diff --git a/kronolith/lib/Forms/CreateCalendar.php b/kronolith/lib/Forms/CreateCalendar.php index b30db8a3c..61a098a57 100755 --- a/kronolith/lib/Forms/CreateCalendar.php +++ b/kronolith/lib/Forms/CreateCalendar.php @@ -32,7 +32,6 @@ class Kronolith_CreateCalendarForm extends Horde_Form { $this->addVariable(_("Name"), 'name', 'text', true); $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60)); - $this->addVariable(_("Tags"), 'tags', 'text', false); $this->setButtons(array(_("Create"))); } @@ -45,8 +44,6 @@ class Kronolith_CreateCalendarForm extends Horde_Form { } $calendar->set('name', $this->_vars->get('name')); $calendar->set('desc', $this->_vars->get('description')); - $tagger = new Kronolith_Tagger(); - $tagger->tag($calendar->getName(), explode(',', $this->_vars->get('tags')), 'calendar'); return $GLOBALS['kronolith_shares']->addShare($calendar); } diff --git a/kronolith/lib/Forms/EditCalendar.php b/kronolith/lib/Forms/EditCalendar.php index 03464e3b2..ee76076d7 100644 --- a/kronolith/lib/Forms/EditCalendar.php +++ b/kronolith/lib/Forms/EditCalendar.php @@ -39,7 +39,6 @@ class Kronolith_EditCalendarForm extends Horde_Form { $this->addHidden('', 'c', 'text', true); $this->addVariable(_("Name"), 'name', 'text', true); $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60)); - $this->addVariable(_("Tags"), 'tags', 'text', false); $this->setButtons(array(_("Save"))); } @@ -49,8 +48,6 @@ class Kronolith_EditCalendarForm extends Horde_Form { $new_name = $this->_vars->get('name'); $this->_calendar->set('name', $new_name); $this->_calendar->set('desc', $this->_vars->get('description')); - $tagger = new Kronolith_Tagger(); - $tagger->tag($this->_calendar->getName(), explode(',', $this->_vars->get('tags')), 'calendar'); if ($original_name != $new_name) { $result = $GLOBALS['kronolith_driver']->rename($original_name, $new_name); if (is_a($result, 'PEAR_Error')) { diff --git a/kronolith/lib/Tagger.php b/kronolith/lib/Tagger.php index cc389edd9..2ffc471d5 100644 --- a/kronolith/lib/Tagger.php +++ b/kronolith/lib/Tagger.php @@ -81,7 +81,12 @@ class Kronolith_Tagger { } /** - * Retrieve the tags on a given object(s) + * Retrieve the tags on given object(s). + * + * @param string $localId The identifier of the kronolith object. + * @param string $type The type of object $localId represents. + * + * @return a tag_id => tag_name hash. */ public function getTags($localId, $type = 'event') { @@ -96,20 +101,31 @@ class Kronolith_Tagger { return $tags; } + /** + * Remove a tag from a kronolith object. Removes *all* tags - regardless of + * the user that added the tag. + * + * @param string $localId The kronolith object identifier. + * @param mixed $tag Either a tag_id, tag_name or an array of + * ids or names to remove. + * @param string $content_type The type of object that $localId represents. + * + * @return void + */ public function untag($localId, $tag, $content_type = 'event') { - self::$_tagger->removeTagFromObject(array('object' => $localId, 'type' => $content_type), $tag); + self::$_tagger->removeTagFromObject( + array('object' => $localId, 'type' => $content_type), + $tag); } /** - * tag search - return all types of content we care about tagged with - * the passed in tags - * + * @TODO * @param array $tags An array of tag ids. */ public function search($tags, $content_type = null) { - $this->getObjects(array('tagId' => $tags, '')); + //TODO } }