1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17: 18: 19: 20: 21: 22:
23: class IMP_Prefs_Special_ComposeTemplates
24: extends IMP_Prefs_Special_SpecialMboxes
25: implements Horde_Core_Prefs_Ui_Special
26: {
27: 28:
29: public function init(Horde_Core_Prefs_Ui $ui)
30: {
31: }
32:
33: 34:
35: public function display(Horde_Core_Prefs_Ui $ui)
36: {
37: global $injector, $page_output, $prefs;
38:
39: if ($prefs->isLocked(IMP_Mailbox::MBOX_TEMPLATES)) {
40: return '';
41: }
42:
43: $page_output->addScriptFile('folderprefs.js');
44: $page_output->addInlineJsVars(array(
45: 'ImpFolderPrefs.mboxes.templates' => _("Enter the name for your new compose templates mailbox.")
46: ));
47:
48: $view = new Horde_View(array(
49: 'templatePath' => IMP_TEMPLATES . '/prefs'
50: ));
51: $view->addHelper('Horde_Core_View_Helper_Label');
52:
53: $iterator = new IMP_Ftree_IteratorFilter(
54: $injector->getInstance('IMP_Ftree')
55: );
56: $iterator->add($iterator::NONIMAP);
57: $iterator->mboxes = array('INBOX');
58:
59: $view->mbox_flist = new IMP_Ftree_Select(array(
60: 'basename' => true,
61: 'iterator' => $iterator,
62: 'new_mbox' => true,
63: 'selected' => IMP_Mailbox::getPref(IMP_Mailbox::MBOX_TEMPLATES)
64: ));
65: $view->mbox_nomailbox = IMP_Mailbox::formTo(self::PREF_NO_MBOX);
66:
67: return $view->render('composetemplates');
68: }
69:
70: 71:
72: public function update(Horde_Core_Prefs_Ui $ui)
73: {
74: if ($GLOBALS['prefs']->isLocked(IMP_Mailbox::MBOX_TEMPLATES)) {
75: return false;
76: }
77:
78: return $this->_updateSpecialMboxes(
79: IMP_Mailbox::MBOX_TEMPLATES,
80: IMP_Mailbox::formFrom($ui->vars->templates),
81: $ui->vars->templates_new,
82: null,
83: $ui
84: );
85: }
86:
87: }
88: