1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10: 11: 12: 13: 14: 15:
16: class Mnemo_Form_CreateNotepad extends Horde_Form
17: {
18: public function __construct(&$vars)
19: {
20: parent::__construct($vars, _("Create Notepad"));
21:
22: $this->addVariable(_("Name"), 'name', 'text', true);
23: $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
24:
25: $this->setButtons(array(_("Create")));
26: }
27:
28: public function execute()
29: {
30:
31: try {
32: $notepad = $GLOBALS['mnemo_shares']->newShare($GLOBALS['registry']->getAuth(), strval(new Horde_Support_Uuid()), $this->_vars->get('name'));
33: } catch (Horde_Share_Exception $e) {
34: Horde::logMessage($e->getMessage(), 'ERR');
35: throw new Mnemo_Exception($e);
36: }
37: $notepad->set('desc', $this->_vars->get('description'));
38: return $GLOBALS['mnemo_shares']->addShare($notepad);
39: }
40:
41: }
42: