From 16c24dd261e086bbdcd5df204d5f4210988b56c8 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 29 Jan 2009 17:13:00 -0500 Subject: [PATCH] Add tag field to the edit and create calendar forms --- kronolith/lib/Forms/CreateCalendar.php | 3 +++ kronolith/lib/Forms/EditCalendar.php | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/kronolith/lib/Forms/CreateCalendar.php b/kronolith/lib/Forms/CreateCalendar.php index 61a098a57..685da9699 100755 --- a/kronolith/lib/Forms/CreateCalendar.php +++ b/kronolith/lib/Forms/CreateCalendar.php @@ -32,6 +32,7 @@ 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"))); } @@ -44,6 +45,8 @@ 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(), $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 ee76076d7..079db82f3 100644 --- a/kronolith/lib/Forms/EditCalendar.php +++ b/kronolith/lib/Forms/EditCalendar.php @@ -39,6 +39,7 @@ 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"))); } @@ -59,6 +60,9 @@ class Kronolith_EditCalendarForm extends Horde_Form { if (is_a($result, 'PEAR_Error')) { return PEAR::raiseError(sprintf(_("Unable to save calendar \"%s\": %s"), $new_name, $result->getMessage())); } + + $tagger = new Kronolith_Tagger(); + $tagger->replaceTags($this->_calendar->getName(), $this->_vars->get('tags'), 'calendar'); return true; } -- 2.11.0