Author: Michael Slusarz (slusarz@horde.org)
Inheritance: extends IMP_Dynamic_Base
Ejemplo n.º 1
0
 /**
  * @throws IMP_Exception
  */
 protected function _init()
 {
     global $page_output;
     if (isset($this->vars->msgid) && isset($this->vars->type) && isset(IMP_Maillog_Storage_History::$drivers[$this->vars->type])) {
         $log = new IMP_Maillog_Storage_History::$drivers[$this->vars->type](array('msgid' => $this->vars->msgid));
         $query = $log->searchQuery();
         foreach ($log->searchMailboxes() as $val) {
             $indices = $val->runSearchQuery($query);
             if (count($indices)) {
                 list($mbox, $uid) = $indices->getSingle();
                 $url = IMP_Dynamic_Message::url();
                 $url->add($mbox->urlParams($uid));
                 $url->redirect();
             }
         }
     }
     $page_output->addScriptFile('maillog.js');
     $page_output->addInlineJsVars(array('ImpMaillog.error_msg' => _("Could not load message.")));
 }
Ejemplo n.º 2
0
 /**
  */
 protected function _addMailboxVars()
 {
     global $injector, $prefs, $registry;
     /* Does server support ACLs? */
     $imp_imap = $injector->getInstance('IMP_Factory_Imap')->create();
     $acl = $imp_imap->access(IMP_Imap::ACCESS_ACL);
     $subscribe = $prefs->getValue('subscribe');
     $this->js_conf += array_filter(array('URI_LISTINFO' => strval(IMP_Basic_Listinfo::url()->setRaw(true)), 'URI_MESSAGE' => strval(IMP_Dynamic_Message::url()->setRaw(true)), 'URI_PORTAL' => strval($registry->getServiceLink('portal')->setRaw(true)), 'URI_PREFS_IMP' => strval($registry->getServiceLink('prefs', 'imp')->setRaw(true)), 'URI_SEARCH' => strval(IMP_Basic_Search::url()->setRaw(true)), 'URI_THREAD' => strval(IMP_Basic_Thread::url()->setRaw(true)), 'FLAG_DELETED' => Horde_Imap_Client::FLAG_DELETED, 'FLAG_DRAFT' => Horde_Imap_Client::FLAG_DRAFT, 'FLAG_INNOCENT' => Horde_Imap_Client::FLAG_NOTJUNK, 'FLAG_SEEN' => Horde_Imap_Client::FLAG_SEEN, 'FLAG_SPAM' => Horde_Imap_Client::FLAG_JUNK, 'msglist_template_horiz' => file_get_contents(IMP_TEMPLATES . '/dynamic/msglist_horiz.html'), 'msglist_template_vert' => file_get_contents(IMP_TEMPLATES . '/dynamic/msglist_vert.html'), 'acl' => $acl, 'filter_any' => intval($prefs->getValue('filter_any_mailbox')), 'fsearchid' => IMP_Mailbox::formTo(IMP_Search::MBOX_PREFIX . IMP_Search::FILTERSEARCH), 'initial_page' => is_null($initial_page = IMP::getInitialPage()->mbox) ? null : $initial_page->form_to, 'mbox_expand' => intval($prefs->getValue('nav_expanded') == 2), 'name' => $registry->get('name', 'imp'), 'poll_alter' => intval(!$prefs->isLocked('nav_poll') && !$prefs->getValue('nav_poll_all')), 'qsearchid' => IMP_Mailbox::formTo(IMP_Search::MBOX_PREFIX . IMP_Search::QUICKSEARCH), 'refresh_time' => intval($prefs->getValue('refresh_time')), 'sidebar_width' => max(intval($prefs->getValue('sidebar_width')), 150), 'sort' => array('from' => array('c' => 'msgFrom', 't' => _("From"), 'v' => Horde_Imap_Client::SORT_FROM), 'to' => array('c' => 'msgFrom', 'ec' => 'msgFromTo', 't' => _("To"), 'v' => Horde_Imap_Client::SORT_TO), 'subject' => array('c' => 'msgSubject', 't' => _("Subject"), 'v' => Horde_Imap_Client::SORT_SUBJECT), 'thread' => array('c' => 'msgSubject', 'v' => Horde_Imap_Client::SORT_THREAD), 'date' => array('c' => 'msgDate', 't' => _("Date"), 'v' => IMP::IMAP_SORT_DATE), 'msgarrival' => array('c' => 'msgDate', 'v' => Horde_Imap_Client::SORT_ARRIVAL), 'msgdate' => array('c' => 'msgDate', 'v' => Horde_Imap_Client::SORT_DATE), 'sequence' => array('v' => Horde_Imap_Client::SORT_SEQUENCE), 'size' => array('c' => 'msgSize', 't' => _("Size"), 'v' => Horde_Imap_Client::SORT_SIZE)), 'subscribe' => intval($subscribe)));
     $context = array('ctx_container' => array('_mbox' => '', '_sep1' => null, 'create' => _("Create subfolder"), 'rename' => _("Rename"), 'delete' => _("Delete subfolders"), '_sep2' => null, 'search' => _("Search"), '_sep3' => null, 'expand' => _("Expand All"), 'collapse' => _("Collapse All")), 'ctx_datesort' => array('*msgarrival' => _("Arrival Time"), '*msgdate' => _("Message Date")), 'ctx_flag' => array(), 'ctx_flagunset' => array(), 'ctx_flag_search' => array(), 'ctx_mbox_flag' => array('seen' => _("Seen"), 'unseen' => _("Unseen")), 'ctx_noactions' => array('_mbox' => '', '_sep1' => null, 'noaction' => _("No actions available")), 'ctx_remoteauth' => array('_mbox' => '', '_sep1' => null, 'create' => _("Create Mailbox"), 'logout' => _("Log Out")), 'ctx_sortopts' => array('from' => _("From"), 'to' => _("To"), 'subject' => _("Subject"), 'thread' => _("Thread"), 'msgarrival' => _("Date (Arrival)"), 'msgdate' => _("Date (Message)"), 'size' => _("Size"), '_sep1' => null, 'sequence' => _("No Sort")), 'ctx_subjectsort' => array('thread' => _("Thread Sort")), 'ctx_template' => array('edit' => _("Edit Template"), 'new' => _("Create New Template")), 'ctx_vcontainer' => array('_mbox' => _("Virtual Folders"), '_sep1' => null, 'edit' => _("Edit Virtual Folders")), 'ctx_vfolder' => array('_mbox' => '', '_sep1' => null, 'edit' => _("Edit Virtual Folder"), 'delete' => _("Delete Virtual Folder")));
     /* Folder options context menu. */
     if ($imp_imap->access(IMP_Imap::ACCESS_FOLDERS)) {
         $context['ctx_folderopts'] = array('new' => _("Create Mailbox"), 'sub' => _("Hide Unsubscribed"), 'unsub' => _("Show All Mailboxes"), 'expand' => _("Expand All"), 'collapse' => _("Collapse All"), '_sep1' => null, 'reload' => _("Rebuild Folder List"));
     }
     if (!$subscribe) {
         unset($context['ctx_folderopts']['sub'], $context['ctx_folderopts']['unsub']);
     }
     /* Message context menu. */
     $context['ctx_message'] = array('_sub1' => array('resume' => _("Resume Draft"), 'template' => _("Use Template"), 'template_edit' => _("Edit Template"), 'view' => _("View Message")), 'reply' => _("Reply"), 'forward' => _("Forward"), '_sub2' => array('_sep1' => null, 'setflag' => _("Mark as") . '...', 'unsetflag' => _("Unmark as") . '...'), '_sep2' => null, 'spam' => _("Report as Spam"), 'innocent' => _("Report as Innocent"), 'blacklist' => _("Blacklist"), 'whitelist' => _("Whitelist"), 'addfilter' => _("Create Filter"), 'delete' => _("Delete"), 'undelete' => _("Undelete"), '_sub3' => array('_sep3' => null, 'source' => _("View Source")));
     if (empty($imp_imap->config->spam_params)) {
         unset($context['ctx_message']['spam']);
     }
     if (empty($imp_imap->config->innocent_params)) {
         unset($context['ctx_message']['innocent']);
     }
     if (!$registry->hasLink('mail/newEmailFilter')) {
         unset($context['ctx_message']['addfilter']);
     }
     $view_source = $injector->getInstance('Horde_Core_Perms')->hasAppPermission('view_msg_source');
     if (!$view_source) {
         unset($context['ctx_message']['_sub3']);
     }
     /* Mailbox context menu. */
     $context['ctx_mbox'] = array('_mbox' => '', '_sep1' => null, 'create' => _("Create subfolder"), 'rename' => _("Rename"), 'empty' => _("Empty"), 'delete' => _("Delete"), '_sep2' => null, 'setflag' => _("Mark all as"), '_sep3' => null, 'poll' => _("Check for New Mail"), 'nopoll' => _("Do Not Check for New Mail"), 'sub' => _("Subscribe"), 'unsub' => _("Unsubscribe"), '_sep4' => null, 'search' => _("Search"), '_sub1' => array('_sep5' => null, 'expand' => _("Expand All"), 'collapse' => _("Collapse All")), '_sep6' => null, 'export' => _("Export"), 'import' => _("Import"), '_sep7' => null, 'size' => _("Mailbox Size"), '_sub2' => array('_sep8' => null, 'acl' => _("Edit ACL")));
     if (!$subscribe) {
         unset($context['ctx_mbox']['sub'], $context['ctx_mbox']['unsub']);
     }
     if (!$imp_imap->access(IMP_Imap::ACCESS_IMPORT)) {
         unset($context['ctx_mbox']['import']);
     }
     if (!$imp_imap->access(IMP_Imap::ACCESS_FLAGS)) {
         unset($context['ctx_mbox']['_sep2'], $context['ctx_mbox']['setflag'], $context['ctx_mbox']['_sep3'], $context['ctx_mbox']['poll'], $context['ctx_mbox']['nopoll']);
     }
     if (!$imp_imap->access(IMP_Imap::ACCESS_FOLDERS)) {
         unset($context['ctx_mbox']['_sep7'], $context['ctx_mbox']['size']);
     }
     if (!$imp_imap->access(IMP_Imap::ACCESS_SEARCH)) {
         unset($context['ctx_mbox']['_sep4'], $context['ctx_mbox']['search']);
     }
     if (!$imp_imap->access(IMP_Imap::ACCESS_FLAGS) || $prefs->isLocked('acl')) {
         unset($context['ctx_mbox']['_sub2']);
     }
     /* Other Actions context menu. */
     $context['ctx_oa'] = array('preview_hide' => _("Hide Preview"), 'preview_show' => _("Show Preview"), 'layout_horiz' => _("Horizontal Layout"), 'layout_vert' => _("Vertical Layout"), '_sub1' => array('_sep1' => null, 'setflag' => _("Mark as") . '...', 'unsetflag' => _("Unmark as") . '...'), 'blacklist' => _("Blacklist"), 'whitelist' => _("Whitelist"), '_sub2' => array('_sep2' => null, 'purge_deleted' => _("Purge Deleted"), 'undelete' => _("Undelete")), 'show_deleted' => _("Show Deleted"), 'hide_deleted' => _("Hide Deleted"), '_sub3' => array('_sep3' => null, 'clear_sort' => _("Clear Sort")));
     if ($prefs->isLocked('delhide')) {
         unset($context['ctx_oa']['hide_deleted']);
     }
     /* Shared between message and other actions menus. */
     if (!$registry->hasMethod('mail/blacklistFrom')) {
         unset($context['ctx_message']['blacklist'], $context['ctx_oa']['blacklist']);
     }
     if (!$registry->hasMethod('mail/whitelistFrom')) {
         unset($context['ctx_message']['whitelist'], $context['ctx_oa']['whitelist']);
     }
     /* Preview context menu. */
     $context['ctx_preview'] = array('save' => _("Save"), 'viewsource' => _("View Source"), 'allparts' => _("All Parts"), 'thread' => _("View Thread"), 'listinfo' => _("List Info"));
     if (!$view_source) {
         unset($context['ctx_preview']['viewsource']);
     }
     /* Search related context menus. */
     if ($imp_imap->access(IMP_Imap::ACCESS_SEARCH)) {
         $context['ctx_filteropts'] = array('*filter' => _("Filter By"), '*flag' => _("Show Only"), '*flagnot' => _("Don't Show"));
         if (IMP_Filter::canApplyFilters()) {
             $context['ctx_filteropts']['_sub1'] = array('_sep1' => null, 'applyfilters' => _("Apply Filters"));
         }
         $context['ctx_qsearchopts'] = array('*all' => _("Entire Message"), '*body' => _("Body"), '*from' => _("From"), '*recip' => _("Recipients (To/Cc/Bcc)"), '*subject' => _("Subject"), '_sep1' => null, '*advanced' => _("Advanced Search..."));
         /* Generate filter array. */
         $iterator = IMP_Search_IteratorFilter::create(IMP_Search_IteratorFilter::FILTER);
         $context['ctx_filter'] = array();
         foreach ($iterator as $val) {
             if ($val->enabled) {
                 $context['ctx_filter']['*' . $val->id] = $val->label;
             }
         }
     }
     /* Remote accounts context menu. */
     if ($imp_imap->access(IMP_Imap::ACCESS_REMOTE)) {
         $context['ctx_rcontainer'] = array('*prefs' => _("Manage Remote Accounts"));
     }
     $this->js_context = array_merge($context, $this->js_context);
     $this->js_text += array('atc_downloadall' => _("Download All (%s)"), 'badaddr' => _("Invalid Address"), 'badsubject' => _("Invalid Subject"), 'baselevel' => _("base level of the folder tree"), 'check' => _("Checking..."), 'copyto' => _("Copy %s to %s"), 'create_prompt' => _("Create mailbox:"), 'createsub_prompt' => _("Create subfolder of %s:"), 'delete_mbox' => _("Permanently delete %s?"), 'download_mbox' => _("All messages in this mailbox will be downloaded into the format that you choose. Depending on the size of the mailbox, this action may take awhile."), 'empty_mbox' => _("Permanently delete all %d messages in %s?"), 'import_mbox' => _("Mbox or .eml file:"), 'import_mbox_loading' => _("Importing (this may take some time)..."), 'listmsg_wait' => _("The server is still generating the message list."), 'listmsg_timeout' => _("The server was unable to generate the message list."), 'loading' => _("Loading..."), 'message_0' => _("No messages"), 'message_1' => _("1 message"), 'message_2' => _("%d messages"), 'mboxsize' => _("%s is: %s."), 'moveto' => _("Move %s to %s"), 'newflag_name' => _("Flag Name:"), 'newflag_wait' => _("Creating New Flag..."), 'no_folder_name' => _("Must enter a folder name"), 'onlogout' => _("Logging Out..."), 'portal' => _("Portal"), 'prefs' => _("User Options"), 'remote_password' => _("Password for %s:"), 'rename_prompt' => _("Rename %s to:"), 'search' => _("Search"), 'search_input' => _("Search (%s)"), 'search_time' => _("Results are %d Minutes Old"), 'selected' => _("%s selected."), 'slidertext' => _("Messages %d - %d"), 'vfolder' => _("Virtual Folder: %s"), 'vp_empty' => _("There are no messages in this mailbox."), 'vp_empty_search' => _("No messages matched the search query."));
     if ($subscribe) {
         $this->js_text += array('subscribe_mbox' => _("Subscribe to %s?"), 'subscribe_mbox_subfolders' => _("Subscribe to all subfolders of %s?"), 'unsubscribe_mbox' => _("Unsubscribe to %s?"), 'unsubscribe_mbox_subfolders' => _("Unsubscribe to all subfolders of %s?"));
     }
 }