* @package Mnemo */ class Mnemo_Form_CreateNotepad extends Horde_Form { public function __construct(&$vars) { parent::__construct($vars, _("Create Notepad")); $this->addVariable(_("Name"), 'name', 'text', true); $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60)); $this->setButtons(array(_("Create"))); } public function execute() { // Create new share. try { $notepad = $GLOBALS['mnemo_shares']->newShare($GLOBALS['registry']->getAuth(), strval(new Horde_Support_Uuid()), $this->_vars->get('name')); $notepad->set('desc', $this->_vars->get('description')); $GLOBALS['mnemo_shares']->addShare($notepad); $GLOBALS['display_notepads'][] = $notepad->getName(); $GLOBALS['prefs']->setValue('display_notepads', serialize($GLOBALS['display_notepads'])); } catch (Horde_Share_Exception $e) { Horde::log($e->getMessage(), 'ERR'); throw new Mnemo_Exception($e); } return $notepad; } }