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_Spam extends IMP_Prefs_Special_SpecialMboxes implements Horde_Core_Prefs_Ui_Special
24: {
25: 26:
27: public function init(Horde_Core_Prefs_Ui $ui)
28: {
29: }
30:
31: 32:
33: public function display(Horde_Core_Prefs_Ui $ui)
34: {
35: global $injector, $page_output;
36:
37: $page_output->addScriptFile('folderprefs.js');
38: $page_output->addInlineJsVars(array(
39: 'ImpFolderPrefs.mboxes.spam' => _("Enter the name for your new spam mailbox.")
40: ));
41:
42: $view = new Horde_View(array(
43: 'templatePath' => IMP_TEMPLATES . '/prefs'
44: ));
45: $view->addHelper('Horde_Core_View_Helper_Label');
46:
47: $view->nombox = IMP_Mailbox::formTo(self::PREF_NO_MBOX);
48:
49: $iterator = new IMP_Ftree_IteratorFilter(
50: $injector->getInstance('IMP_Ftree')
51: );
52: $iterator->add($iterator::NONIMAP);
53: $iterator->mboxes = array('INBOX');
54:
55: $view->flist = new IMP_Ftree_Select(array(
56: 'basename' => true,
57: 'iterator' => $iterator,
58: 'new_mbox' => true,
59: 'selected' => IMP_Mailbox::getPref(IMP_Mailbox::MBOX_SPAM)
60: ));
61: $view->special_use = $this->_getSpecialUse(Horde_Imap_Client::SPECIALUSE_JUNK);
62:
63: return $view->render('spam');
64: }
65:
66: 67:
68: public function update(Horde_Core_Prefs_Ui $ui)
69: {
70: global $injector;
71:
72: if (!$this->_updateSpecialMboxes(IMP_Mailbox::MBOX_SPAM, IMP_Mailbox::formFrom($ui->vars->spam), $ui->vars->spam_new, Horde_Imap_Client::SPECIALUSE_JUNK, $ui)) {
73: return false;
74: }
75:
76: $injector->getInstance('IMP_Factory_Imap')->create()->updateFetchIgnore();
77: return true;
78: }
79:
80: }
81: