Don't use the calendar/event property forms for adding/removing tags.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 27 Jan 2009 01:10:39 +0000 (20:10 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 29 Jan 2009 22:39:52 +0000 (17:39 -0500)
(At least for now)

Plus some more phpdoc and formatting.

kronolith/lib/Forms/CreateCalendar.php
kronolith/lib/Forms/EditCalendar.php
kronolith/lib/Tagger.php

index b30db8a..61a098a 100755 (executable)
@@ -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);
     }
 
index 03464e3..ee76076 100644 (file)
@@ -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')) {
index cc389ed..2ffc471 100644 (file)
@@ -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
     }
 
 }