linkTooltip() 공개 정적인 메소드

Uses DOM Tooltips to display the 'title' attribute for link() calls.
public static linkTooltip ( string $url, string $status = '', string $class = '', string $target = '', string $onclick = '', string $title = '', string $accesskey = '', array $attributes = [] ) : string
$url string The full URL to be linked to
$status string The JavaScript mouse-over string
$class string The CSS class of the link
$target string The window target to point to.
$onclick string JavaScript action for the 'onclick' event.
$title string The link title (tooltip). Most not contain HTML data other than <br>, which will be converted to a linebreak.
$accesskey string The access key to use.
$attributes array Any other name/value pairs to add to the <a> tag.
리턴 string The full tag.
예제 #1
0
파일: Summary.php 프로젝트: DSNS-LAB/Dmail
 /**
  */
 protected function _content()
 {
     global $registry, $prefs;
     if (!empty($this->_params['show_notepad'])) {
         $shares = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Share')->create();
     }
     $html = '';
     $memos = Mnemo::listMemos($prefs->getValue('sortby'), $prefs->getValue('sortdir'));
     foreach ($memos as $id => $memo) {
         $html .= '<tr>';
         if (!empty($this->_params['show_actions'])) {
             $editImg = Horde_Themes::img('edit.png');
             $editurl = Horde::url('memo.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id']));
             $html .= '<td width="1%">' . Horde::link(htmlspecialchars(Horde::url($editurl, true)->add('actionID', 'modify_memo')), _("Edit Note")) . Horde::img($editImg, _("Edit Note")) . '</a></td>';
         }
         if (!empty($this->_params['show_notepad'])) {
             $html .= '<td>' . htmlspecialchars(Mnemo::getLabel($shares->getShare($memo['memolist_id']))) . '</td>';
         }
         $viewurl = Horde::url('view.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id']));
         $html .= '<td>' . Horde::linkTooltip(htmlspecialchars(Horde::url($viewurl, true)), '', '', '', '', $memo['body'] != $memo['desc'] ? Mnemo::getNotePreview($memo) : '') . (strlen($memo['desc']) ? htmlspecialchars($memo['desc']) : '<em>' . _("Empty Note") . '</em>') . '</a> <ul class="horde-tags">';
         foreach ($memo['tags'] as $tag) {
             $html .= '<li>' . htmlspecialchars($tag) . '</li>';
         }
         $html .= '</ul></td></tr>';
     }
     if (!$memos) {
         return '<p><em>' . _("No notes to display") . '</em></p>';
     }
     return '<table cellspacing="0" width="100%" class="linedRow">' . $html . '</table>';
 }
예제 #2
0
파일: Event.php 프로젝트: DSNS-LAB/Dmail
 public function getLink($datetime = null, $icons = true, $from_url = null, $full = false, $encoded = true)
 {
     global $prefs;
     if (is_null($datetime)) {
         $datetime = $this->start;
     }
     if (is_null($from_url)) {
         $from_url = Horde::selfUrl(true, false, true);
     }
     $event_title = $this->getTitle();
     $view_url = $this->getViewUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full, $encoded);
     $read_permission = $this->hasPermission(Horde_Perms::READ);
     $link = '<span' . $this->getCSSColors() . '>';
     if ($read_permission && $view_url) {
         $link .= Horde::linkTooltip($view_url, $event_title, $this->getStatusClass(), '', '', $this->getTooltip(), '', array('style' => $this->getCSSColors(false)));
     }
     $link .= htmlspecialchars($event_title);
     if ($read_permission && $view_url) {
         $link .= '</a>';
     }
     if ($icons && $prefs->getValue('show_icons')) {
         $icon_color = $this->_foregroundColor == '#000' ? '000' : 'fff';
         $status = '';
         if ($this->alarm) {
             if ($this->alarm % 10080 == 0) {
                 $alarm_value = $this->alarm / 10080;
                 $title = sprintf(ngettext("Alarm %d week before", "Alarm %d weeks before", $alarm_value), $alarm_value);
             } elseif ($this->alarm % 1440 == 0) {
                 $alarm_value = $this->alarm / 1440;
                 $title = sprintf(ngettext("Alarm %d day before", "Alarm %d days before", $alarm_value), $alarm_value);
             } elseif ($this->alarm % 60 == 0) {
                 $alarm_value = $this->alarm / 60;
                 $title = sprintf(ngettext("Alarm %d hour before", "Alarm %d hours before", $alarm_value), $alarm_value);
             } else {
                 $alarm_value = $this->alarm;
                 $title = sprintf(ngettext("Alarm %d minute before", "Alarm %d minutes before", $alarm_value), $alarm_value);
             }
             $status .= Horde::fullSrcImg('alarm-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconAlarm')));
         }
         if ($this->recurs()) {
             $title = Kronolith::recurToString($this->recurrence->getRecurType());
             $status .= Horde::fullSrcImg('recur-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconRecur')));
         } elseif ($this->baseid) {
             $title = _("Exception");
             $status .= Horde::fullSrcImg('exception-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconRecur')));
         }
         if ($this->private) {
             $title = _("Private event");
             $status .= Horde::fullSrcImg('private-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconPrivate')));
         }
         if (!empty($this->attendees)) {
             $status .= Horde::fullSrcImg('attendees-' . $icon_color . '.png', array('attr' => array('alt' => _("Meeting"), 'title' => _("Meeting"), 'class' => 'iconPeople')));
         }
         $space = ' ';
         if (!empty($this->icon)) {
             $link = $status . '<img class="kronolithEventIcon" src="' . $this->icon . '" /> ' . $link;
         } elseif (!empty($status)) {
             $link .= ' ' . $status;
             $space = '';
         }
         if ((!$this->private || $this->creator == $GLOBALS['registry']->getAuth()) && Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) {
             $url = $this->getEditUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full);
             if ($url) {
                 $link .= $space . $url->link(array('title' => sprintf(_("Edit %s"), $event_title), 'class' => 'iconEdit')) . Horde::fullSrcImg('edit-' . $icon_color . '.png', array('attr' => array('alt' => _("Edit")))) . '</a>';
                 $space = '';
             }
         }
         if ($this->hasPermission(Horde_Perms::DELETE)) {
             $url = $this->getDeleteUrl(array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url), $full);
             if ($url) {
                 $link .= $space . $url->link(array('title' => sprintf(_("Delete %s"), $event_title), 'class' => 'iconDelete')) . Horde::fullSrcImg('delete-' . $icon_color . '.png', array('attr' => array('alt' => _("Delete")))) . '</a>';
             }
         }
     }
     return $link . '</span>';
 }
예제 #3
0
파일: Driver.php 프로젝트: horde/horde
 /**
  * Constructs message attachments link.
  *
  * @throws Agora_Exception
  */
 public function getAttachmentLink($message_id)
 {
     if (!$this->allowAttachments()) {
         return '';
     }
     $sql = 'SELECT file_id, file_name, file_size, file_type FROM agora_files WHERE message_id = ?';
     try {
         $files = $this->_db->select($sql, array($message_id));
     } catch (Horde_Db_Exception $e) {
         throw new Agora_Exception($e->getMessage());
     }
     if (empty($files)) {
         return $files;
     }
     /* Constuct the link with a tooltip for further info on the download. */
     $html = '<br />';
     $view_url = Horde::url('view.php');
     foreach ($files as $file) {
         $mime_icon = $GLOBALS['injector']->getInstance('Horde_Core_Factory_MimeViewer')->getIcon($file['file_type']);
         $title = _("download") . ': ' . $file['file_name'];
         $tooltip = $title . "\n" . sprintf(_("size: %s"), $this->formatSize($file['file_size'])) . "\n" . sprintf(_("type: %s"), $file['file_type']);
         $url = $view_url->add(array('forum_id' => $this->_forum_id, 'message_id' => $message_id, 'file_id' => $file['file_id'], 'file_name' => $file['file_name'], 'file_type' => $file['file_type']));
         $html .= Horde::linkTooltip($url, $title, '', '', '', $tooltip) . Horde::img($mime_icon, $title, 'align="middle"', '') . '&nbsp;' . $file['file_name'] . '</a>&nbsp;&nbsp;<br />';
     }
     return $html;
 }
예제 #4
0
파일: list.php 프로젝트: DSNS-LAB/Dmail
 $view->headers[] = array('id' => 's' . MNEMO::SORT_MOD_DATE, 'sorted' => $sortby == Mnemo::SORT_MOD_DATE, 'width' => '2%', 'label' => Horde::widget(array('url' => $baseurl->add('sortby', MNEMO::SORT_MOD_DATE), 'class' => 'sortlink', 'title' => _("Date"))));
 foreach ($memos as $memo_id => &$memo) {
     try {
         $share = $mnemo_shares->getShare($memo['memolist_id']);
     } catch (Horde_Share_Exception $e) {
         $notification->push($e);
         continue;
     }
     if ($view->showNotepad) {
         $memo['notepad'] = Mnemo::getLabel($share);
     }
     if ($share->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
         $label = sprintf(_("Edit \"%s\""), $memo['desc']);
         $memo['edit'] = Horde::url('memo.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id'], 'actionID' => 'modify_memo'))->link(array('title' => $label)) . Horde::img('edit.png', $label, '') . '</a>';
     }
     $memo['link'] = Horde::linkTooltip(Horde::url('view.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id'])), '', '', '', '', $memo['body'] != $memo['desc'] ? Mnemo::getNotePreview($memo) : '') . (strlen($memo['desc']) ? htmlspecialchars($memo['desc']) : '<em>' . _("Empty Note") . '</em>') . '</a>';
     // Get memo's most recent modification date or, if nonexistent,
     // the creation (add) date
     if (isset($memo['modified'])) {
         $modified = $memo['modified'];
     } elseif (isset($memo['created'])) {
         $modified = $memo['created'];
     } else {
         $modified = null;
     }
     if ($modified) {
         $memo['modifiedStamp'] = $modified->timestamp();
         $memo['modifiedString'] = $modified->strftime($prefs->getValue('date_format'));
     } else {
         $memo['modifiedStamp'] = $memo['modifiedString'] = '';
     }
예제 #5
0
파일: Filters.php 프로젝트: raz0rsdge/horde
 /**
  */
 protected function _init()
 {
     global $injector, $notification, $page_output, $prefs, $session;
     /* Get the list of filter rules. */
     $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
     /* Load the Ingo_Script factory. */
     $factory = $injector->getInstance('Ingo_Factory_Script');
     /* Get permissions. */
     $edit_allowed = Ingo::hasSharePermission(Horde_Perms::EDIT);
     $delete_allowed = Ingo::hasSharePermission(Horde_Perms::DELETE);
     /* Token checking. */
     $actionID = $this->_checkToken(array('rule_copy', 'rule_delete', 'rule_disable', 'rule_enable'));
     /* Default to no mailbox filtering. */
     $mbox_search = null;
     /* Perform requested actions. */
     switch ($actionID) {
         case 'mbox_search':
             if (isset($this->vars->searchfield)) {
                 $mbox_search = array('exact' => $this->vars->get('searchexact', 1), 'query' => $this->vars->searchfield);
             }
             break;
         case 'rule_copy':
         case 'rule_delete':
         case 'rule_disable':
         case 'rule_enable':
             if (!$edit_allowed) {
                 $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
                 self::url()->redirect();
             }
             $success = false;
             switch ($actionID) {
                 case 'rule_delete':
                     if (!$delete_allowed) {
                         $notification->push(_("You do not have permission to delete filter rules."), 'horde.error');
                         self::url()->redirect();
                     }
                     if (($tmp = $ingo_storage->getRuleByUid($this->vars->uid)) && $ingo_storage->deleteRule($tmp)) {
                         $notification->push(sprintf(_("Rule \"%s\" deleted."), $tmp->name), 'horde.success');
                         $success = true;
                     }
                     break;
                 case 'rule_copy':
                     switch ($ingo_storage->maxRules()) {
                         case Ingo_Storage::MAX_NONE:
                             Horde::permissionDeniedError('ingo', 'max_rules', _("You are not allowed to create or edit custom rules."));
                             break 2;
                         case Ingo_Storage::MAX_OVER:
                             Horde::permissionDeniedError('ingo', 'max_rules', sprintf(_("You are not allowed to create more than %d rules."), $ingo_storage->max_rules));
                             break 2;
                     }
                     if (($tmp = $ingo_storage->getRuleByUid($this->vars->uid)) && $ingo_storage->copyRule($tmp)) {
                         $notification->push(sprintf(_("Rule \"%s\" copied."), $tmp->name), 'horde.success');
                         $success = true;
                     }
                     break;
                 case 'rule_disable':
                 case 'rule_enable':
                     if ($tmp = $ingo_storage->getRuleByUid($this->vars->uid)) {
                         $tmp->disable = $actionID === 'rule_disable';
                         $ingo_storage->updateRule($tmp);
                         $notification->push(sprintf($actionID === 'rule_disable' ? _("Rule \"%s\" disabled.") : _("Rule \"%s\" enabled."), $tmp->name), 'horde.success');
                         $success = true;
                     }
                     break;
             }
             /* Save changes */
             if ($success) {
                 try {
                     $factory->activateAll();
                 } catch (Ingo_Exception $e) {
                     $notification->push($e->getMessage(), 'horde.error');
                 }
             }
             break;
         case 'settings_save':
             if (!$edit_allowed) {
                 $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
                 self::url()->redirect();
             }
             $prefs->setValue('show_filter_msg', $this->vars->show_filter_msg);
             $prefs->setValue('filter_seen', $this->vars->filter_seen);
             $notification->push(_("Settings successfully updated."), 'horde.success');
             break;
         case 'apply_filters':
             $factory->perform();
             break;
     }
     /* Common URLs. */
     $filters_url = $this->_addToken(self::url());
     $rule_url = Ingo_Basic_Rule::url();
     $view = new Horde_View(array('templatePath' => INGO_TEMPLATES . '/basic/filters'));
     $view->addHelper('Horde_Core_View_Helper_Help');
     $view->addHelper('Horde_Core_View_Helper_Image');
     $view->addHelper('Horde_Core_View_Helper_Label');
     $view->addHelper('FormTag');
     $view->addHelper('Tag');
     $view->canapply = $factory->canPerform();
     $view->deleteallowed = $delete_allowed;
     $view->editallowed = $edit_allowed;
     $view->formurl = $filters_url;
     $view->can_copy = $edit_allowed && !$ingo_storage->maxRules();
     $display = array();
     $filters = Ingo_Storage_FilterIterator_Match::create($ingo_storage, $session->get('ingo', 'script_categories'));
     foreach ($filters as $rule) {
         $copyurl = $delurl = $editurl = null;
         $entry = array();
         $url = $filters_url->copy()->add('uid', $rule->uid);
         switch (get_class($rule)) {
             case 'Ingo_Rule_System_Blacklist':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Blacklist::url();
                 $entry['filterimg'] = 'blacklist.png';
                 break;
             case 'Ingo_Rule_System_Whitelist':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Whitelist::url();
                 $entry['filterimg'] = 'whitelist.png';
                 break;
             case 'Ingo_Rule_System_Vacation':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Vacation::url();
                 $entry['filterimg'] = 'vacation.png';
                 break;
             case 'Ingo_Rule_System_Forward':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Forward::url();
                 $entry['filterimg'] = 'forward.png';
                 break;
             case 'Ingo_Rule_System_Spam':
                 if (!is_null($mbox_search)) {
                     continue 2;
                 }
                 $editurl = Ingo_Basic_Spam::url();
                 $entry['filterimg'] = 'spam.png';
                 break;
             default:
                 if (!is_null($mbox_search)) {
                     if ($mbox_search['exact']) {
                         if (strcasecmp($filter['action-value'], $mbox_search['query']) !== 0) {
                             continue 2;
                         }
                     } elseif (stripos($filter['action-value'], $mbox_search['query']) === false) {
                         continue 2;
                     }
                 }
                 $editurl = $rule_url->copy()->add(array('edit' => $rule->uid));
                 $delurl = $url->copy()->add('actionID', 'rule_delete');
                 $copyurl = $url->copy()->add('actionID', 'rule_copy');
                 break;
         }
         /* Create description. */
         if (!$edit_allowed) {
             $entry['descriplink'] = htmlspecialchars($rule->name);
         } elseif (!empty($rule->conditions)) {
             $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $rule->name), null, null, null, $rule->description()) . htmlspecialchars($rule->name) . '</a>';
         } else {
             $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $rule->name)) . htmlspecialchars($rule->name) . '</a>';
         }
         /* Create delete link. */
         if ($delete_allowed && !is_null($delurl)) {
             $entry['dellink'] = Horde::link($delurl, sprintf(_("Delete %s"), $rule->name), null, null, "return window.confirm('" . addslashes(_("Are you sure you want to delete this rule?")) . "');");
         }
         /* Create copy link. */
         if ($view->can_copy && !is_null($copyurl)) {
             $entry['copylink'] = Horde::link($copyurl, sprintf(_("Copy %s"), $rule->name));
         }
         /* Create disable/enable link. */
         if (!$rule->disable) {
             $entry['disabled'] = true;
             if ($edit_allowed) {
                 $entry['disablelink'] = Horde::link($url->copy()->add('actionID', 'rule_disable'), sprintf(_("Disable %s"), $rule->name));
             }
         } elseif ($edit_allowed) {
             $entry['enablelink'] = Horde::link($url->copy()->add('actionID', 'rule_enable'), sprintf(_("Enable %s"), $rule->name));
         }
         $display[$rule->uid] = $entry;
     }
     $view->filter = $display;
     $view->mbox_search = $mbox_search;
     if ($edit_allowed && is_null($mbox_search)) {
         if ($factory->hasFeature('on_demand')) {
             $view->settings = true;
             $view->flags = $prefs->getValue('filter_seen');
             $view->show_filter_msg = $prefs->getValue('show_filter_msg');
         }
         $page_output->addScriptFile('hordecore.js', 'horde');
         $page_output->addScriptPackage('Horde_Core_Script_Package_Sortable');
     }
     $page_output->addScriptFile('stripe.js', 'horde');
     $page_output->addScriptFile('filters.js');
     $page_output->ajax = true;
     $topbar = $injector->getInstance('Horde_View_Topbar');
     $topbar->search = true;
     $topbar->searchAction = self::url();
     $topbar->searchLabel = _("Mailbox Search");
     $topbar->searchParameters = array('actionID' => 'mbox_search', 'searchexact' => 0, 'page' => 'filters');
     $this->header = _("Filter Rules");
     $this->output = $view->render('filters');
 }
예제 #6
0
파일: Mailbox.php 프로젝트: DSNS-LAB/Dmail
 /**
  */
 protected function _init()
 {
     global $injector, $notification, $page_output, $prefs, $registry, $session;
     $mailbox = $this->indices->mailbox;
     /* Call the mailbox redirection hook, if requested. */
     try {
         $redirect = $injector->getInstance('Horde_Core_Hooks')->callHook('mbox_redirect', 'imp', array($mailbox));
         if (!empty($redirect)) {
             Horde::url($redirect, true)->redirect();
         }
     } catch (Horde_Exception_HookNotSet $e) {
     }
     $mailbox_url = Horde::url('basic.php')->add('page', 'mailbox');
     $mailbox_imp_url = $mailbox->url('mailbox')->add('newmail', 1);
     $imp_flags = $injector->getInstance('IMP_Flags');
     $imp_imap = $mailbox->imp_imap;
     $imp_search = $injector->getInstance('IMP_Search');
     /* Run through the action handlers */
     if (($actionID = $this->vars->actionID) && $actionID != 'message_missing') {
         try {
             $session->checkToken($this->vars->token);
         } catch (Horde_Exception $e) {
             $notification->push($e);
             $actionID = null;
         }
     }
     /* We know we are going to be exclusively dealing with this mailbox,
      * so select it on the IMAP server (saves some STATUS calls). Open
      * R/W to clear the RECENT flag. This call will catch invalid
      * mailboxes. */
     $imp_imap->openMailbox($mailbox, Horde_Imap_Client::OPEN_READWRITE);
     $imp_mailbox = $mailbox->list_ob;
     /* Determine if mailbox is readonly. */
     $readonly = $mailbox->readonly;
     switch ($actionID) {
         case 'change_sort':
             $mailbox->setSort($this->vars->sortby, $this->vars->sortdir);
             break;
         case 'blacklist':
             $injector->getInstance('IMP_Filter')->blacklistMessage($this->indices);
             break;
         case 'whitelist':
             $injector->getInstance('IMP_Filter')->whitelistMessage($this->indices);
             break;
         case 'spam_report':
             $injector->getInstance('IMP_Factory_Spam')->create(IMP_Spam::SPAM)->report($this->indices);
             break;
         case 'innocent_report':
             $injector->getInstance('IMP_Factory_Spam')->create(IMP_Spam::INNOCENT)->report($this->indices);
             break;
         case 'message_missing':
             $notification->push(_("Requested message not found."), 'horde.error');
             break;
         case 'fwd_digest':
         case 'redirect_messages':
         case 'template_edit':
             if (count($this->indices)) {
                 $compose_actions = array('fwd_digest' => 'fwd_digest', 'redirect_messages' => 'redirect_compose', 'template_edit' => 'template_edit');
                 $clink = new IMP_Compose_Link($this->vars);
                 $options = array_merge(array('actionID' => $compose_actions[$actionID], 'muid' => strval($this->indices)), $clink->args);
                 if ($prefs->getValue('compose_popup')) {
                     $page_output->addInlineScript(array(Horde::popupJs(IMP_Basic_Compose::url(), array('novoid' => true, 'params' => array_merge(array('popup' => 1), $options)))), true);
                 } else {
                     IMP_Basic_Compose::url()->add($options)->redirect();
                 }
             }
             break;
         case 'delete_messages':
             $injector->getInstance('IMP_Message')->delete($this->indices, array('mailboxob' => $imp_mailbox));
             break;
         case 'undelete_messages':
             $injector->getInstance('IMP_Message')->undelete($this->indices);
             break;
         case 'move_messages':
         case 'copy_messages':
             if (isset($this->vars->targetMbox) && count($this->indices) && (!$readonly || $actionID == 'copy_messages')) {
                 $targetMbox = IMP_Mailbox::formFrom($this->vars->targetMbox);
                 if (!empty($this->vars->newMbox) && $this->vars->newMbox == 1) {
                     $targetMbox = IMP_Mailbox::get($this->vars->targetMbox)->namespace_append;
                     $newMbox = true;
                 } else {
                     $targetMbox = IMP_Mailbox::formFrom($this->vars->targetMbox);
                     $newMbox = false;
                 }
                 $injector->getInstance('IMP_Message')->copy($targetMbox, $actionID == 'move_messages' ? 'move' : 'copy', $this->indices, array('create' => $newMbox, 'mailboxob' => $imp_mailbox));
             }
             break;
         case 'flag_messages':
             if (!$readonly && $this->vars->flag && count($this->indices)) {
                 $flag = $imp_flags->parseFormId($this->vars->flag);
                 $injector->getInstance('IMP_Message')->flag(array($flag['set'] ? 'add' : 'remove' => array($flag['flag'])), $this->indices);
             }
             break;
         case 'filter_messages':
             if (!$readonly) {
                 $filter = IMP_Mailbox::formFrom($this->vars->filter);
                 $q_ob = null;
                 if (strpos($filter, self::FLAG_FILTER_PREFIX) === 0) {
                     /* Flag filtering. */
                     $flag_filter = $imp_flags->parseFormId(substr($filter, strpos($filter, "") + 1));
                     try {
                         $q_ob = $imp_search->createQuery(array(new IMP_Search_Element_Flag($flag_filter['flag'], $flag_filter['set'])), array('mboxes' => array($mailbox), 'type' => IMP_Search::CREATE_QUERY));
                     } catch (InvalidArgumentException $e) {
                     }
                 } else {
                     /* Pre-defined filters. */
                     try {
                         $q_ob = $imp_search->applyFilter($filter, array($mailbox));
                     } catch (InvalidArgumentException $e) {
                     }
                 }
                 if ($q_ob) {
                     IMP_Mailbox::get($q_ob)->url('mailbox')->redirect();
                     exit;
                 }
             }
             break;
         case 'hide_deleted':
             $mailbox->setHideDeletedMsgs(!$prefs->getValue('delhide'));
             break;
         case 'expunge_mailbox':
             $injector->getInstance('IMP_Message')->expungeMailbox(array(strval($mailbox) => 1), array('mailboxob' => $imp_mailbox));
             break;
         case 'filter':
             $mailbox->filter();
             break;
         case 'empty_mailbox':
             $injector->getInstance('IMP_Message')->emptyMailbox(array(strval($mailbox)));
             break;
         case 'view_messages':
             $mailbox->url(IMP_Basic_Thread::url(), null, false)->add(array('mode' => 'msgview', 'muid' => strval($this->indices)))->redirect();
             break;
     }
     /* Token to use in requests. */
     $token = $session->getToken();
     $search_mbox = $mailbox->search;
     /* Deal with filter options. */
     if (!$readonly && IMP_Filter::canApplyFilters() && !$mailbox->filterOnDisplay() && ($mailbox->inbox || $prefs->getValue('filter_any_mailbox') && !$search_mbox)) {
         $filter_url = $mailbox_imp_url->copy()->add(array('actionID' => 'filter', 'token' => $token));
     }
     /* Generate folder options list. */
     if ($imp_imap->access(IMP_Imap::ACCESS_FOLDERS)) {
         $iterator = new IMP_Ftree_IteratorFilter($injector->getInstance('IMP_Ftree'));
         $iterator->add($iterator::NONIMAP);
         $folder_options = new IMP_Ftree_Select(array('heading' => _("Messages to"), 'inc_notepads' => true, 'inc_tasklists' => true, 'iterator' => $iterator, 'new_mbox' => true));
     }
     /* Build the list of messages in the mailbox. */
     $pageOb = $imp_mailbox->buildMailboxPage($this->vars->mpage, $this->vars->start);
     $show_preview = $prefs->getValue('preview_enabled');
     $mbox_info = $imp_mailbox->getMailboxArray(range($pageOb['begin'], $pageOb['end']), array('headers' => true, 'preview' => (int) $show_preview, 'type' => $prefs->getValue('atc_flag')));
     /* Determine sorting preferences. */
     $sortpref = $mailbox->getSort();
     $thread_sort = $sortpref->sortby == Horde_Imap_Client::SORT_THREAD;
     /* Determine if we are going to show the Hide/Purge Deleted Message
      * links. */
     if (!($use_trash = $prefs->getValue('use_trash')) && !$mailbox->vinbox) {
         $showdelete = array('hide' => true, 'purge' => $mailbox->access_expunge);
     } else {
         $showdelete = array('hide' => false, 'purge' => false);
     }
     if ($showdelete['hide'] && !$prefs->isLocked('delhide')) {
         if ($prefs->getValue('delhide')) {
             $deleted_prompt = _("Show Deleted");
         } else {
             $deleted_prompt = _("Hide Deleted");
         }
     }
     /* Generate paging links. */
     if ($pageOb['pagecount']) {
         if ($pageOb['page'] == 1) {
             $url_first = $url_prev = null;
             $pages_first = 'navfirstgreyImg';
             $pages_prev = 'navleftgreyImg';
         } else {
             $url_first = $mailbox_imp_url->copy()->add('mpage', 1);
             $pages_first = 'navfirstImg';
             $url_prev = $mailbox_imp_url->copy()->add('mpage', $pageOb['page'] - 1);
             $pages_prev = 'navleftImg';
         }
         if ($pageOb['page'] == $pageOb['pagecount']) {
             $url_last = $url_next = null;
             $pages_last = 'navlastgreyImg';
             $pages_next = 'navrightgreyImg';
         } else {
             $url_next = $mailbox_imp_url->copy()->add('mpage', $pageOb['page'] + 1);
             $pages_next = 'navrightImg';
             $url_last = $mailbox_imp_url->copy()->add('mpage', $pageOb['pagecount']);
             $pages_last = 'navlastImg';
         }
     }
     /* Generate RSS link. */
     if ($mailbox->inbox) {
         $rss_box = '';
     } else {
         $ns_info = $mailbox->namespace_info;
         if (is_null($ns_info)) {
             $rss_box = null;
         } else {
             $rss_box = str_replace(rawurlencode($ns_info->delimiter), '/', rawurlencode($ns_info->delimiter . ($ns_info->type == $ns_info::NS_PERSONAL ? $ns_info->stripNamespace($mailbox) : $mailbox)));
         }
     }
     if (!is_null($rss_box)) {
         $page_output->addLinkTag(array('href' => Horde::url('rss.php', true, -1) . $rss_box));
     }
     /* If user wants the mailbox to be refreshed, set time here. */
     $refresh_url = $mailbox_imp_url->copy()->add('mpage', $pageOb['page']);
     if (isset($filter_url)) {
         $filter_url->add('mpage', $pageOb['page']);
     }
     /* Determine if we are showing previews. */
     $preview_tooltip = $show_preview ? $prefs->getValue('preview_show_tooltip') : false;
     if (!$preview_tooltip) {
         $strip_preview = $prefs->getValue('preview_strip_nl');
     }
     $unread = $imp_mailbox->unseenMessages(Horde_Imap_Client::SEARCH_RESULTS_COUNT);
     $page_output->addInlineJsVars(array('ImpMailbox.pop3' => intval(!$mailbox->is_imap), 'ImpMailbox.text' => array('delete_messages' => _("Are you sure you wish to PERMANENTLY delete these messages?"), 'delete_all' => _("Are you sure you wish to delete all mail in this mailbox?"), 'delete_vfolder' => _("Are you sure you want to delete this Virtual Folder Definition?"), 'innocent_report' => _("Are you sure you wish to report this message as innocent?"), 'moveconfirm' => _("Are you sure you want to move the message(s)? (Some message information might get lost, like message headers, text formatting or attachments!)"), 'newmbox' => _("You are copying/moving to a new mailbox.") . "\n" . _("Please enter a name for the new mailbox:") . "\n", 'no' => _("No"), 'selectone' => _("You must select at least one message first."), 'selectonlyone' => _("You must select only one message for this action."), 'spam_report' => _("Are you sure you wish to report this message as spam?"), 'submit' => _("You must select at least one message first."), 'target_mbox' => _("You must select a target mailbox first.")), 'ImpMailbox.unread' => intval($unread)));
     $pagetitle = $this->title = $mailbox->label;
     if ($mailbox->editvfolder) {
         $query_text = wordwrap($imp_search[$mailbox]->querytext);
         $pagetitle .= ' [' . Horde::linkTooltip('#', $query_text, '', '', '', $query_text) . _("Virtual Folder") . '</a>]';
         $this->title .= ' [' . _("Virtual Folder") . ']';
     } elseif ($mailbox->editquery) {
         $query_text = wordwrap($imp_search[$mailbox]->querytext);
         $pagetitle = Horde::linkTooltip('#', $query_text, '', '', '', $query_text) . $pagetitle . '</a>';
     } else {
         $pagetitle = $this->title = htmlspecialchars($this->title);
     }
     /* Generate mailbox summary string. */
     $subinfo = new IMP_View_Subinfo(array('mailbox' => $mailbox));
     $subinfo->value = $pagetitle . ' (';
     if (empty($pageOb['end'])) {
         $subinfo->value .= _("No Messages");
     } else {
         $subinfo->value .= $pageOb['pagecount'] > 1 ? sprintf(_("%d Messages"), $pageOb['msgcount']) . ' / ' . sprintf(_("Page %d of %d"), $pageOb['page'], $pageOb['pagecount']) : sprintf(_("%d Messages"), $pageOb['msgcount']);
     }
     $subinfo->value .= ')';
     $injector->getInstance('Horde_View_Topbar')->subinfo = $subinfo->render();
     $page_output->addScriptFile('hordecore.js', 'horde');
     $page_output->addScriptFile('mailbox.js');
     $page_output->addScriptPackage('Horde_Core_Script_Package_Dialog');
     $page_output->metaRefresh($prefs->getValue('refresh_time'), $refresh_url);
     /* Prepare the header template. */
     $view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/basic/mailbox'));
     $view->addHelper('FormTag');
     $view->addHelper('Horde_Core_View_Helper_Accesskey');
     $view->addHelper('Tag');
     $hdr_view = clone $view;
     $hdr_view->readonly = $readonly;
     $hdr_view->refresh_url = $refresh_url;
     if (isset($filter_url)) {
         $hdr_view->filter_url = $filter_url;
     }
     if ($mailbox->access_search) {
         if (!$search_mbox) {
             $hdr_view->search_url = $mailbox->url(IMP_Basic_Searchbasic::url());
         } else {
             if ($mailbox->editvfolder) {
                 $edit_search = _("Edit Virtual Folder");
             } elseif ($mailbox->query) {
                 if ($mailbox->editquery) {
                     $edit_search = _("Edit Search Query");
                 } else {
                     /* Basic search results. */
                     $search_mailbox = IMP_Mailbox::get($imp_search[$mailbox]->mboxes[0]);
                     $hdr_view->search_url = $search_mailbox->url(IMP_Basic_Searchbasic::url());
                     $hdr_view->searchclose = $search_mailbox->url('mailbox');
                 }
             }
             if (isset($edit_search)) {
                 $hdr_view->edit_search_url = $imp_search->editUrl($mailbox);
                 $hdr_view->edit_search_title = $edit_search;
             }
         }
     }
     if ($mailbox->access_empty) {
         $hdr_view->empty = $mailbox_imp_url->copy()->add(array('actionID' => 'empty_mailbox', 'token' => $token));
     }
     $this->output = $hdr_view->render('header');
     /* If no messages, exit immediately. */
     if (empty($pageOb['end'])) {
         if ($pageOb['anymsg'] && isset($deleted_prompt)) {
             /* Show 'Show Deleted' prompt if mailbox has no viewable
              * message but has hidden, deleted messages. */
             $del_view = clone $view;
             $del_view->hide = Horde::widget(array('url' => $refresh_url->copy()->add(array('actionID' => 'hide_deleted', 'token' => $token)), 'class' => 'hideAction', 'title' => $deleted_prompt));
             if ($mailbox->access_expunge) {
                 $del_view->purge = Horde::widget(array('url' => $refresh_url->copy()->add(array('actionID' => 'expunge_mailbox', 'token' => $token)), 'class' => 'purgeAction', 'title' => _("Pur_ge Deleted")));
             }
             $this->output .= $del_view->render('actions_deleted');
         }
         $empty_view = clone $view;
         $empty_view->search_mbox = $search_mbox;
         $this->output .= $empty_view->render('empty_mailbox');
         return;
     }
     $clink_ob = new IMP_Compose_Link();
     $clink = $clink_ob->link();
     /* Display the navbar and actions if there is at least 1 message in
      * mailbox. */
     if ($pageOb['msgcount']) {
         /* Prepare the navbar template. */
         $n_view = clone $view;
         $n_view->id = 1;
         $n_view->readonly = $readonly;
         $filtermsg = false;
         if ($mailbox->access_flags) {
             $args = array('imap' => true, 'mailbox' => $search_mbox ? null : $mailbox);
             $form_set = $form_unset = array();
             foreach ($imp_flags->getList($args) as $val) {
                 if ($val->canset) {
                     $form_set[] = array('f' => $val->form_set, 'l' => $val->label, 'v' => IMP_Mailbox::formTo(self::FLAG_FILTER_PREFIX . $val->form_set));
                     $form_unset[] = array('f' => $val->form_unset, 'l' => $val->label, 'v' => IMP_Mailbox::formTo(self::FLAG_FILTER_PREFIX . $val->form_unset));
                 }
             }
             $n_view->flaglist_set = $form_set;
             $n_view->flaglist_unset = $form_unset;
             if (!$search_mbox && $mailbox->access_search) {
                 $filtermsg = $n_view->flag_filter = true;
             }
         }
         if (!$search_mbox && $mailbox->access_filters) {
             $filters = array();
             $iterator = IMP_Search_IteratorFilter::create(IMP_Search_IteratorFilter::FILTER);
             foreach ($iterator as $val) {
                 $filters[] = array('l' => $val->label, 'v' => IMP_Mailbox::formTo($val));
             }
             if (!empty($filters)) {
                 $filtermsg = true;
                 $n_view->filters = $filters;
             }
         }
         $n_view->filtermsg = $filtermsg;
         if ($imp_imap->access(IMP_Imap::ACCESS_FOLDERS)) {
             $n_view->move = Horde::widget(array('url' => '#', 'class' => 'moveAction', 'title' => _("Move"), 'nocheck' => true));
             $n_view->copy = Horde::widget(array('url' => '#', 'class' => 'copyAction', 'title' => _("Copy"), 'nocheck' => true));
             $n_view->folder_options = $folder_options;
         }
         $n_view->mailbox_url = $mailbox_url;
         $n_view->mailbox = $mailbox->form_to;
         if ($pageOb['pagecount'] > 1) {
             $n_view->multiple_page = true;
             $n_view->pages_first = $pages_first;
             $n_view->url_first = $url_first;
             $n_view->pages_prev = $pages_prev;
             $n_view->url_prev = $url_prev;
             $n_view->pages_next = $pages_next;
             $n_view->url_next = $url_next;
             $n_view->pages_last = $pages_last;
             $n_view->url_last = $url_last;
             $n_view->page_val = $pageOb['page'];
             $n_view->page_size = Horde_String::length($pageOb['pagecount']);
         }
         $this->output .= $n_view->render('navbar');
         /* Prepare the actions template. */
         $a_view = clone $view;
         if ($mailbox->access_deletemsgs) {
             $del_class = $use_trash && $mailbox->trash ? 'permdeleteAction' : 'deleteAction';
             $a_view->delete = Horde::widget(array('url' => '#', 'class' => $del_class, 'title' => _("_Delete")));
         }
         if ($showdelete['purge'] || $mailbox->vtrash) {
             $a_view->undelete = Horde::widget(array('url' => '#', 'class' => 'undeleteAction', 'title' => _("_Undelete")));
         }
         $mboxactions = array();
         if ($showdelete['purge']) {
             $mailbox_link = $mailbox_imp_url->copy()->add('mpage', $pageOb['page']);
             if (isset($deleted_prompt)) {
                 $mboxactions[] = Horde::widget(array('url' => $mailbox_link->copy()->add(array('actionID' => 'hide_deleted', 'token' => $token)), 'class' => 'hideAction', 'title' => $deleted_prompt));
             }
             $mboxactions[] = Horde::widget(array('url' => $mailbox_link->copy()->add(array('actionID' => 'expunge_mailbox', 'token' => $token)), 'class' => 'purgeAction', 'title' => _("Pur_ge Deleted")));
         }
         if (!$sortpref->sortby_locked && $sortpref->sortby != Horde_Imap_Client::SORT_SEQUENCE) {
             $mboxactions[] = Horde::widget(array('url' => $mailbox_imp_url->copy()->add(array('sortby' => Horde_Imap_Client::SORT_SEQUENCE, 'actionID' => 'change_sort', 'token' => $token)), 'title' => _("Clear Sort")));
         }
         if ($mailbox->templates) {
             $a_view->templateedit = Horde::widget(array('url' => '#', 'class' => 'templateeditAction', 'title' => _("Edit Template")));
             $mboxactions[] = Horde::widget(array('url' => $clink->copy()->add(array('actionID' => 'template_new')), 'title' => _("Create New Template")));
         }
         $a_view->mboxactions = $mboxactions;
         if ($registry->hasMethod('mail/blacklistFrom')) {
             $a_view->blacklist = Horde::widget(array('url' => '#', 'class' => 'blacklistAction', 'title' => _("_Blacklist")));
         }
         if ($registry->hasMethod('mail/whitelistFrom')) {
             $a_view->whitelist = Horde::widget(array('url' => '#', 'class' => 'whitelistAction', 'title' => _("_Whitelist")));
         }
         if (IMP_Compose::canCompose()) {
             $a_view->forward = Horde::widget(array('url' => '#', 'class' => 'forwardAction', 'title' => _("Fo_rward")));
             $a_view->redirect = Horde::widget(array('url' => '#', 'class' => 'redirectAction', 'title' => _("Redirect")));
         }
         if ($mailbox->spam_show) {
             $a_view->spam = Horde::widget(array('url' => '#', 'class' => 'spamAction', 'title' => _("Report as Spam")));
         }
         if ($mailbox->innocent_show) {
             $a_view->innocent = Horde::widget(array('url' => '#', 'class' => 'innocentAction', 'title' => _("Report as Innocent")));
         }
         $a_view->view_messages = Horde::widget(array('url' => '#', 'class' => 'viewAction', 'title' => _("View Messages")));
         $this->output .= $a_view->render('actions');
     }
     /* Define some variables now so we don't have to keep redefining in
      * the foreach loop or the templates. */
     $lastMbox = '';
     $mh_count = 0;
     $sortImg = $sortpref->sortdir ? 'sortup' : 'sortdown';
     $headers = array(Horde_Imap_Client::SORT_TO => array('id' => 'mboxto', 'stext' => _("Sort by To Address"), 'text' => _("To")), Horde_Imap_Client::SORT_FROM => array('id' => 'mboxfrom', 'stext' => _("Sort by From Address"), 'text' => _("Fro_m")), Horde_Imap_Client::SORT_THREAD => array('id' => 'mboxthread', 'stext' => _("Sort by Thread"), 'text' => _("_Thread")), Horde_Imap_Client::SORT_SUBJECT => array('id' => 'mboxsubject', 'stext' => _("Sort by Subject"), 'text' => _("Sub_ject")), IMP::IMAP_SORT_DATE => array('id' => 'mboxdate', 'stext' => _("Sort by Date"), 'text' => _("Dat_e")), Horde_Imap_Client::SORT_SIZE => array('id' => 'mboxsize', 'stext' => _("Sort by Message Size"), 'text' => _("Si_ze")));
     /* If this is the Drafts or Sent-Mail mailbox, sort by To instead of
      * From. */
     if ($mailbox->special_outgoing) {
         unset($headers[Horde_Imap_Client::SORT_FROM]);
     } else {
         unset($headers[Horde_Imap_Client::SORT_TO]);
     }
     /* Determine which of Subject/Thread to emphasize. */
     if (!$mailbox->access_sortthread || $sortpref->sortby_locked) {
         unset($headers[Horde_Imap_Client::SORT_THREAD]);
         if ($sortpref->sortby_locked && $thread_sort) {
             $sortpref->sortby = Horde_Imap_Client::SORT_SUBJECT;
         }
     } else {
         if ($thread_sort) {
             $extra = Horde_Imap_Client::SORT_SUBJECT;
             $standard = Horde_Imap_Client::SORT_THREAD;
         } else {
             $extra = Horde_Imap_Client::SORT_THREAD;
             $standard = Horde_Imap_Client::SORT_SUBJECT;
         }
         $headers[$standard]['altsort'] = Horde::widget(array('url' => $mailbox_imp_url->copy()->add(array('actionID' => 'change_sort', 'token' => $token, 'sortby' => $extra)), 'title' => $headers[$extra]['text']));
         unset($headers[$extra]);
     }
     foreach ($headers as $key => $val) {
         $ptr =& $headers[$key];
         if ($sortpref->sortby == $key) {
             $csl_icon = '<span class="iconImg ' . $sortImg . '"></span>';
             if ($sortpref->sortdir_locked) {
                 $ptr['change_sort_link'] = $csl_icon;
                 $ptr['change_sort_widget'] = Horde::stripAccessKey($val['text']);
             } else {
                 $tmp = $mailbox_imp_url->copy()->add(array('sortby' => $key, 'sortdir' => intval(!$sortpref->sortdir), 'actionID' => 'change_sort', 'token' => $token));
                 $ptr['change_sort_link'] = Horde::link($tmp, $val['stext'], null, null, null, $val['stext']) . $csl_icon . '</a>';
                 $ptr['change_sort_widget'] = Horde::widget(array('url' => $tmp, 'title' => $val['text']));
             }
         } else {
             $ptr['change_sort_link'] = null;
             $ptr['change_sort_widget'] = $sortpref->sortby_locked ? Horde::stripAccessKey($val['text']) : Horde::widget(array('url' => $mailbox_imp_url->copy()->add(array('actionID' => 'change_sort', 'token' => $token, 'sortby' => $key)), 'title' => $val['text']));
         }
         $ptr['class'] = 'horde-split-left';
     }
     /* Output the form start. */
     $f_view = clone $view;
     $f_view->mailbox = $mailbox->form_to;
     $f_view->mailbox_url = $mailbox_url;
     $f_view->page = $pageOb['page'];
     $f_view->token = $token;
     $this->output .= $f_view->render('form_start');
     /* Prepare the message headers template. */
     $mh_view = clone $view;
     $mh_view->headers = $headers;
     if (!$search_mbox) {
         $mh_view->show_checkbox = !$mh_count++;
         $this->output .= $mh_view->render('message_headers');
     }
     /* Initialize repetitively used variables. */
     $fromlinkstyle = $prefs->getValue('from_link');
     $imp_ui = new IMP_Mailbox_Ui($mailbox);
     /* Display message information. */
     $msgs = array();
     $search_view = clone $view;
     $summary_view = clone $view;
     while (list(, $ob) = each($mbox_info['overview'])) {
         if ($search_mbox) {
             if (empty($lastMbox) || $ob['mailbox'] != $lastMbox) {
                 if (!empty($lastMbox)) {
                     $this->_outputSummaries($msgs, $summary_view);
                     $msgs = array();
                 }
                 $mbox = IMP_Mailbox::get($ob['mailbox']);
                 $search_view->mbox_link = Horde::link($mbox->url($mailbox_url), sprintf(_("View messages in %s"), $mbox->display), 'smallheader') . $mbox->display_html . '</a>';
                 $this->output .= $search_view->render('searchmbox');
                 $mh_view->show_checkbox = !$mh_count++;
                 $this->output .= $mh_view->render('message_headers');
             }
         }
         $lastMbox = $ob['mailbox'];
         /* Initialize the data fields. */
         $msg = array('bg' => '', 'buid' => $imp_mailbox->getBuid($ob['mailbox'], $ob['uid']), 'class' => '', 'date' => $imp_ui->getDate($ob['envelope']->date), 'preview' => '', 'status' => '', 'size' => IMP::sizeFormat($ob['size']));
         /* Generate the target link. */
         if ($mailbox->drafts || $mailbox->templates) {
             $clink_copy = clone $clink_ob;
             $clink_copy->args['buid'] = $msg['buid'];
             $clink_copy->args['mailbox'] = $mailbox;
             $target = $clink_copy->link()->add(array('actionID' => $mailbox->drafts ? 'draft' : 'template'));
         } else {
             $target = $mailbox->url('message', $msg['buid']);
         }
         /* Get all the flag information. */
         $flag_parse = $imp_flags->parse(array('flags' => $ob['flags'], 'headers' => $ob['headers'], 'runhook' => $ob, 'personal' => $ob['envelope']->to));
         $css_class = $subject_flags = array();
         foreach ($flag_parse as $val) {
             if ($val instanceof IMP_Flag_User) {
                 $subject_flags[] = $val;
             } else {
                 if (!$val->bgdefault) {
                     $msg['bg'] = $val->bgcolor;
                 }
                 $css_class[] = $val->css;
                 $msg['status'] .= $val->span;
             }
         }
         $msg['class'] = implode(' ', $css_class);
         /* Show message preview? */
         if ($show_preview && isset($ob['preview'])) {
             if (empty($ob['preview'])) {
                 $ptext = '[[' . _("No Preview Text") . ']]';
             } else {
                 $ptext = empty($strip_preview) ? str_replace("\r", '', $ob['preview']) : preg_replace(array('/\\n/', '/(\\s)+/'), array(' ', '$1'), str_replace("\r", "\n", $ob['preview']));
                 if (!$preview_tooltip) {
                     $ptext = $injector->getInstance('Horde_Core_Factory_TextFilter')->filter($ptext, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::NOHTML));
                 }
                 $maxlen = $prefs->getValue('preview_maxlen');
                 if (Horde_String::length($ptext) > $maxlen) {
                     $ptext = Horde_String::truncate($ptext, $maxlen);
                 } elseif (empty($ob['previewcut'])) {
                     $ptext .= '[[' . _("END") . ']]';
                 }
             }
             $msg['preview'] = $ptext;
         }
         /* Format the From: Header. */
         $getfrom = $imp_ui->getFrom($ob['envelope']);
         $msg['from'] = htmlspecialchars($getfrom['from'], ENT_QUOTES, 'UTF-8');
         switch ($fromlinkstyle) {
             case 0:
                 $from_tmp = array();
                 foreach ($getfrom['from_list']->base_addresses as $from_ob) {
                     $from_tmp[] = call_user_func_array(array('Horde', $preview_tooltip ? 'linkTooltip' : 'link'), array($clink->copy()->add(array('actionID' => 'mailto_link', 'to' => strval($from_ob))), sprintf(_("New Message to %s"), $from_ob->label))) . htmlspecialchars($from_ob->label, ENT_QUOTES, 'UTF-8') . '</a>';
                 }
                 if (!empty($from_tmp)) {
                     $msg['from'] = implode(', ', $from_tmp);
                 }
                 break;
             default:
                 $from_uri = $mailbox->url('message', $msg['buid']);
                 $msg['from'] = Horde::link($from_uri) . $msg['from'] . '</a>';
                 break;
         }
         /* Format the Subject: Header. */
         $msg['subject'] = $imp_ui->getSubject($ob['envelope']->subject, true);
         $msg['subject'] = $preview_tooltip ? substr(Horde::linkTooltip($target, $msg['preview'], '', '', '', $msg['preview']), 0, -1) . ' class="mboxSubject">' . $msg['subject'] . '</a>' : substr(Horde::link($target, $imp_ui->getSubject($ob['envelope']->subject)), 0, -1) . ' class="mboxSubject">' . $msg['subject'] . '</a>' . (!empty($msg['preview']) ? '<br /><small>' . $msg['preview'] . '</small>' : '');
         /* Add subject flags. */
         foreach ($subject_flags as $val) {
             $flag_label = Horde_String::truncate($val->label, 12);
             $msg['subject'] = '<span class="' . $val->css . '" style="' . ($val->bgdefault ? '' : 'background:' . htmlspecialchars($val->bgcolor) . ';') . 'color:' . htmlspecialchars($val->fgcolor) . '" title="' . htmlspecialchars($val->label) . '">' . htmlspecialchars($flag_label) . '</span>' . $msg['subject'];
         }
         /* Set up threading tree now. */
         if ($thread_sort) {
             $t_ob = $imp_mailbox->getThreadOb($ob['idx']);
             $msg['subject'] = ($sortpref->sortdir ? $t_ob->reverse_img : $t_ob->img) . ' ' . $msg['subject'];
         }
         $msgs[$msg['buid']] = $msg;
     }
     $this->_outputSummaries($msgs, $summary_view);
     $this->output .= '</form>';
     /* If there are 20 messages or less, don't show the actions/navbar
      * again. */
     if ($pageOb['end'] - $pageOb['begin'] >= 20) {
         $this->output .= $a_view->render('actions');
         $n_view->id = 2;
         $this->output .= $n_view->render('navbar');
     }
 }
예제 #7
0
파일: List.php 프로젝트: horde/horde
 /**
  * Renders the view.
  *
  * @param Horde_PageOutput $output  The output object.
  *
  * @return string  The HTML needed to render the view.
  */
 public function render(Horde_PageOutput $output)
 {
     global $prefs, $injector, $registry, $mnemo_shares;
     $output->addScriptFile('tables.js', 'horde');
     $output->addScriptFile('quickfinder.js', 'horde');
     $output->addScriptFile('list.js');
     $output->header(array('title' => $this->_title));
     $view = $injector->createInstance('Horde_View');
     $view->count = count($this->_notes);
     $view->searchImg = Horde::img('search.png', _("Search"), '');
     $view->searchUrl = Horde::url('search.php');
     $view->title = $this->_title;
     $view->browser = $this->_showTagBrowser ? $this->_getRelatedTags() . $this->_getTagTrail() : '';
     if (count($this->_notes)) {
         $sortby = $prefs->getValue('sortby');
         $sortdir = $prefs->getValue('sortdir');
         $output->addInlineJsVars(array('Mnemo_List.ajaxUrl' => $registry->getServiceLink('ajax', 'mnemo')->url . 'setPrefValue'));
         $view->editImg = Horde::img('edit.png', _("Edit Note"), '');
         $view->showNotepad = $prefs->getValue('show_notepad');
         $view->sortdirclass = $sortdir ? 'sortup' : 'sortdown';
         $view->headers = array();
         if ($view->showNotepad) {
             $view->headers[] = array('id' => 's' . Mnemo::SORT_NOTEPAD, 'sorted' => $sortby == Mnemo::SORT_NOTEPAD, 'width' => '2%', 'label' => Horde::widget(array('url' => $this->_baseurl->add('sortby', Mnemo::SORT_NOTEPAD), 'class' => 'sortlink', 'title' => _("Notepad"))));
         }
         $view->headers[] = array('id' => 's' . MNEMO::SORT_DESC, 'sorted' => $sortby == MNEMO::SORT_DESC, 'width' => '80%', 'label' => Horde::widget(array('url' => $this->_baseurl->add('sortby', Mnemo::SORT_DESC), 'class' => 'sortlink', 'title' => _("No_te"))));
         $view->headers[] = array('id' => 's' . MNEMO::SORT_MOD_DATE, 'sorted' => $sortby == Mnemo::SORT_MOD_DATE, 'width' => '2%', 'label' => Horde::widget(array('url' => $this->_baseurl->add('sortby', MNEMO::SORT_MOD_DATE), 'class' => 'sortlink', 'title' => _("Date"))));
         foreach ($this->_notes as $memo_id => &$memo) {
             try {
                 $share = $mnemo_shares->getShare($memo['memolist_id']);
             } catch (Horde_Share_Exception $e) {
                 $notification->push($e);
                 continue;
             }
             if ($view->showNotepad) {
                 $memo['notepad'] = Mnemo::getLabel($share);
             }
             if ($share->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
                 $label = sprintf(_("Edit \"%s\""), $memo['desc']);
                 $memo['edit'] = Horde::url('memo.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id'], 'actionID' => 'modify_memo'))->link(array('title' => $label)) . Horde::img('edit.png', $label, '') . '</a>';
             }
             $memo['link'] = Horde::linkTooltip(Horde::url('view.php')->add(array('memo' => $memo['memo_id'], 'memolist' => $memo['memolist_id'])), '', '', '', '', $memo['body'] != $memo['desc'] ? Mnemo::getNotePreview($memo) : '') . (strlen($memo['desc']) ? htmlspecialchars($memo['desc']) : '<em>' . _("Empty Note") . '</em>') . '</a>';
             // Get memo's most recent modification date or, if nonexistent,
             // the creation (add) date
             if (isset($memo['modified'])) {
                 $modified = $memo['modified'];
             } elseif (isset($memo['created'])) {
                 $modified = $memo['created'];
             } else {
                 $modified = null;
             }
             if ($modified) {
                 $memo['modifiedStamp'] = $modified->timestamp();
                 $memo['modifiedString'] = $modified->strftime($prefs->getValue('date_format'));
             } else {
                 $memo['modifiedStamp'] = $memo['modifiedString'] = '';
             }
         }
     }
     Horde::startBuffer();
     echo $view->render('list/header');
     if (count($this->_notes)) {
         echo $view->render('list/memo_headers');
         echo $view->renderPartial('list/summary', array('collection' => array_values($this->_notes)));
         echo $view->render('list/memo_footers');
     } else {
         echo $view->render('list/empty');
     }
     $output->footer();
     return Horde::endBuffer();
 }
예제 #8
0
파일: Month.php 프로젝트: horde/horde
 /**
  */
 protected function _content()
 {
     global $prefs;
     if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
         $calendars = Kronolith::listCalendars();
         if (!isset($calendars[$this->_params['calendar']])) {
             return _("Calendar not found");
         }
         if (!$calendars[$this->_params['calendar']]->hasPermission(Horde_Perms::READ)) {
             return _("Permission Denied");
         }
     }
     $year = date('Y');
     $month = date('m');
     $startday = new Horde_Date(array('mday' => 1, 'month' => $month, 'year' => $year));
     $startday = $startday->dayOfWeek();
     if (!$prefs->getValue('week_start_monday')) {
         $startOfView = 1 - $startday;
         $endday = new Horde_Date(array('mday' => Horde_Date_Utils::daysInMonth($month, $year), 'month' => $month, 'year' => $year));
     } else {
         if ($startday == Horde_Date::DATE_SUNDAY) {
             $startOfView = -5;
         } else {
             $startOfView = 2 - $startday;
         }
     }
     $startDate = new Horde_Date($year, $month, $startOfView);
     $endDate = new Horde_Date($year, $month, Horde_Date_Utils::daysInMonth($month, $year) + 1);
     $endDate->mday += (7 - ($endDate->format('w') - $prefs->getValue('week_start_monday'))) % 7;
     /* Table start. and current month indicator. */
     $html = '<table cellspacing="1" class="monthgrid" width="100%"><tr>';
     /* Set up the weekdays. */
     $weekdays = array(_("Mo"), _("Tu"), _("We"), _("Th"), _("Fr"), _("Sa"));
     if (!$prefs->getValue('week_start_monday')) {
         array_unshift($weekdays, _("Su"));
     } else {
         $weekdays[] = _("Su");
     }
     foreach ($weekdays as $weekday) {
         $html .= '<th class="item">' . $weekday . '</th>';
     }
     try {
         if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
             list($type, $calendar) = explode('_', $this->_params['calendar'], 2);
             $driver = Kronolith::getDriver($type, $calendar);
             $all_events = $driver->listEvents($startDate, $endDate, array('show_recurrence' => true));
         } else {
             $all_events = Kronolith::listEvents($startDate, $endDate, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS));
         }
     } catch (Exception $e) {
         return '<em>' . $e->getMessage() . '</em>';
     }
     $weekday = 0;
     $week = -1;
     $weekStart = $prefs->getValue('week_start_monday');
     for ($date_ob = new Kronolith_Day($month, $startOfView, $year); $date_ob->compareDate($endDate) < 0; $date_ob->mday++) {
         if ($weekday == 7) {
             $weekday = 0;
         }
         if ($weekday == 0) {
             ++$week;
             $html .= '</tr><tr>';
         }
         if ($date_ob->isToday()) {
             $td_class = 'kronolith-today';
         } elseif ($date_ob->month != $month) {
             $td_class = 'kronolith-othermonth';
         } elseif ($date_ob->dayOfWeek() == 0 || $date_ob->dayOfWeek() == 6) {
             $td_class = 'kronolith-weekend';
         } else {
             $td_class = '';
         }
         $html .= '<td align="center" class="' . $td_class . '">';
         /* Set up the link to the day view. */
         $url = Horde::url('day.php', true)->add('date', $date_ob->dateString());
         if (isset($this->_params['calendar']) && $this->_params['calendar'] != '__all') {
             $url->add('display_cal', $this->_params['calendar']);
         }
         $date_stamp = $date_ob->dateString();
         if (empty($all_events[$date_stamp])) {
             /* No events, plain link to the day. */
             $cell = Horde::linkTooltip($url, _("View Day")) . $date_ob->mday . '</a>';
         } else {
             /* There are events; create a cell with tooltip to
              * list them. */
             $day_events = '';
             foreach ($all_events[$date_stamp] as $event) {
                 if ($event->isAllDay()) {
                     $day_events .= _("All day");
                 } else {
                     $day_events .= $event->start->strftime($prefs->getValue('twentyFour') ? '%R' : '%I:%M%p') . '-' . $event->end->strftime($prefs->getValue('twentyFour') ? '%R' : '%I:%M%p');
                 }
                 $location = $event->getLocation();
                 $day_events .= ':' . ($location ? ' (' . htmlspecialchars($location) . ')' : '') . ' ' . $event->getTitle() . "\n";
             }
             $cell = Horde::linkTooltip($url, _("View Day"), '', '', '', $day_events) . $date_ob->mday . '</a>';
         }
         /* Bold the cell if there are events. */
         if (!empty($all_events[$date_stamp])) {
             $cell = '<strong>' . $cell . '</strong>';
         }
         $html .= $cell . '</td>';
         ++$weekday;
     }
     return $html . '</tr></table>';
 }
예제 #9
0
 /**
  */
 protected function _init()
 {
     global $injector, $notification, $page_output, $prefs, $session;
     /* Get the list of filter rules. */
     $ingo_storage = $injector->getInstance('Ingo_Factory_Storage')->create();
     $filters = $ingo_storage->retrieve(Ingo_Storage::ACTION_FILTERS);
     /* Load the Ingo_Script factory. */
     $factory = $injector->getInstance('Ingo_Factory_Script');
     /* Get permissions. */
     $edit_allowed = Ingo::hasSharePermission(Horde_Perms::EDIT);
     $delete_allowed = Ingo::hasSharePermission(Horde_Perms::DELETE);
     /* Permissions. */
     $perms = $injector->getInstance('Horde_Core_Perms');
     /* Token checking. */
     $actionID = $this->_checkToken(array('rule_copy', 'rule_delete', 'rule_disable', 'rule_enable'));
     /* Default to no mailbox filtering. */
     $mbox_search = null;
     /* Perform requested actions. */
     switch ($actionID) {
         case 'mbox_search':
             if (isset($this->vars->searchfield)) {
                 $mbox_search = array('exact' => $this->vars->get('searchexact', 1), 'query' => $this->vars->searchfield);
             }
             break;
         case 'rule_copy':
         case 'rule_delete':
         case 'rule_disable':
         case 'rule_enable':
             if (!$edit_allowed) {
                 $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
                 self::url()->redirect();
             }
             switch ($actionID) {
                 case 'rule_delete':
                     if (!$delete_allowed) {
                         $notification->push(_("You do not have permission to delete filter rules."), 'horde.error');
                         self::url()->redirect();
                     }
                     $tmp = $filters->getFilter($this->vars->rulenumber);
                     if ($filters->deleteRule($this->vars->rulenumber)) {
                         $notification->push(sprintf(_("Rule \"%s\" deleted."), $tmp['name']), 'horde.success');
                     }
                     break;
                 case 'rule_copy':
                     $max = $perms->hasAppPermission(Ingo_Perms::getPerm('max_rules'));
                     if ($max === 0) {
                         Horde::permissionDeniedError('ingo', 'max_rules', _("You are not allowed to create or edit custom rules."));
                         break 2;
                     } elseif ($max !== true && $max <= count($filters->getFilterList())) {
                         Horde::permissionDeniedError('ingo', 'max_rules', sprintf(_("You are not allowed to create more than %d rules."), $max));
                         break 2;
                     }
                     $tmp = $filters->getFilter($this->vars->rulenumber);
                     if ($filters->copyRule($this->vars->rulenumber)) {
                         $notification->push(sprintf(_("Rule \"%s\" copied."), $tmp['name']), 'horde.success');
                     }
                     break;
                 case 'rule_disable':
                     $tmp = $filters->getFilter($this->vars->rulenumber);
                     $filters->ruleDisable($this->vars->rulenumber);
                     $notification->push(sprintf(_("Rule \"%s\" disabled."), $tmp['name']), 'horde.success');
                     break;
                 case 'rule_enable':
                     $tmp = $filters->getFilter($this->vars->rulenumber);
                     $filters->ruleEnable($this->vars->rulenumber);
                     $notification->push(sprintf(_("Rule \"%s\" enabled."), $tmp['name']), 'horde.success');
                     break;
             }
             /* Save changes */
             $ingo_storage->store($filters);
             try {
                 Ingo_Script_Util::update();
             } catch (Ingo_Exception $e) {
                 $notification->push($e->getMessage(), 'horde.error');
             }
             break;
         case 'settings_save':
             if (!$edit_allowed) {
                 $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
                 self::url()->redirect();
             }
             $prefs->setValue('show_filter_msg', $this->vars->show_filter_msg);
             $prefs->setValue('filter_seen', $this->vars->filter_seen);
             $notification->push(_("Settings successfully updated."), 'horde.success');
             break;
         case 'apply_filters':
             $factory->perform();
             break;
     }
     /* Get the list of rules now. */
     $filter_list = $filters->getFilterList();
     /* Common URLs. */
     $filters_url = $this->_addToken(self::url());
     $rule_url = Ingo_Basic_Rule::url();
     $view = new Horde_View(array('templatePath' => INGO_TEMPLATES . '/basic/filters'));
     $view->addHelper('Horde_Core_View_Helper_Help');
     $view->addHelper('Horde_Core_View_Helper_Image');
     $view->addHelper('Horde_Core_View_Helper_Label');
     $view->addHelper('FormTag');
     $view->addHelper('Tag');
     $view->canapply = $factory->canPerform();
     $view->deleteallowed = $delete_allowed;
     $view->editallowed = $edit_allowed;
     $view->formurl = $filters_url;
     if (count($filter_list)) {
         $display = array();
         $s_categories = $session->get('ingo', 'script_categories');
         $view->can_copy = $edit_allowed && (($max_rules = $perms->hasAppPermission(Ingo_Perms::getPerm('max_rules'))) === true || $max_rules > count($filter_list));
         foreach ($filter_list as $rule_number => $filter) {
             /* Non-display categories. */
             if (!in_array($filter['action'], $s_categories)) {
                 $display[$rule_number] = false;
                 continue;
             }
             $copyurl = $delurl = $editurl = $name = null;
             $entry = array();
             $url = $filters_url->copy()->add('rulenumber', $rule_number);
             switch ($filter['action']) {
                 case Ingo_Storage::ACTION_BLACKLIST:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Blacklist::url();
                     $entry['filterimg'] = 'blacklist.png';
                     $name = _("Blacklist");
                     break;
                 case Ingo_Storage::ACTION_WHITELIST:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Whitelist::url();
                     $entry['filterimg'] = 'whitelist.png';
                     $name = _("Whitelist");
                     break;
                 case Ingo_Storage::ACTION_VACATION:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Vacation::url();
                     $entry['filterimg'] = 'vacation.png';
                     $name = _("Vacation");
                     break;
                 case Ingo_Storage::ACTION_FORWARD:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Forward::url();
                     $entry['filterimg'] = 'forward.png';
                     $name = _("Forward");
                     break;
                 case Ingo_Storage::ACTION_SPAM:
                     if (!is_null($mbox_search)) {
                         continue 2;
                     }
                     $editurl = Ingo_Basic_Spam::url();
                     $entry['filterimg'] = 'spam.png';
                     $name = _("Spam Filter");
                     break;
                 default:
                     if (!is_null($mbox_search)) {
                         if ($mbox_search['exact']) {
                             if (strcasecmp($filter['action-value'], $mbox_search['query']) !== 0) {
                                 continue 2;
                             }
                         } elseif (stripos($filter['action-value'], $mbox_search['query']) === false) {
                             continue 2;
                         }
                     }
                     $editurl = $rule_url->copy()->add(array('edit' => $rule_number));
                     $delurl = $url->copy()->add('actionID', 'rule_delete');
                     $copyurl = $url->copy()->add('actionID', 'rule_copy');
                     $name = $filter['name'];
                     break;
             }
             /* Create description. */
             if (!$edit_allowed) {
                 $entry['descriplink'] = htmlspecialchars($name);
             } elseif (!empty($filter['conditions'])) {
                 $entry['descriplink'] = Horde::linkTooltip($editurl, sprintf(_("Edit %s"), $name), null, null, null, $ingo_storage->ruleDescription($filter)) . htmlspecialchars($name) . '</a>';
             } else {
                 $entry['descriplink'] = Horde::link($editurl, sprintf(_("Edit %s"), $name)) . htmlspecialchars($name) . '</a>';
             }
             /* Create delete link. */
             if ($delete_allowed && !is_null($delurl)) {
                 $entry['dellink'] = Horde::link($delurl, sprintf(_("Delete %s"), $name), null, null, "return window.confirm('" . addslashes(_("Are you sure you want to delete this rule?")) . "');");
             }
             /* Create copy link. */
             if ($view->can_copy && !is_null($copyurl)) {
                 $entry['copylink'] = Horde::link($copyurl, sprintf(_("Copy %s"), $name));
             }
             /* Create disable/enable link. */
             if (empty($filter['disable'])) {
                 $entry['disabled'] = true;
                 if ($edit_allowed) {
                     $entry['disablelink'] = Horde::link($url->copy()->add('actionID', 'rule_disable'), sprintf(_("Disable %s"), $name));
                 }
             } elseif ($edit_allowed) {
                 $entry['enablelink'] = Horde::link($url->copy()->add('actionID', 'rule_enable'), sprintf(_("Enable %s"), $name));
             }
             $display[$rule_number] = $entry;
         }
         $view->filter = $display;
         $view->mbox_search = $mbox_search;
     }
     if ($edit_allowed && is_null($mbox_search)) {
         if ($factory->hasFeature('on_demand')) {
             $view->settings = true;
             $view->flags = $prefs->getValue('filter_seen');
             $view->show_filter_msg = $prefs->getValue('show_filter_msg');
         }
         $page_output->addScriptFile('hordecore.js', 'horde');
         $page_output->addScriptPackage('Horde_Core_Script_Package_Sortable');
     }
     $page_output->addScriptFile('stripe.js', 'horde');
     $page_output->addScriptFile('filters.js');
     $topbar = $injector->getInstance('Horde_View_Topbar');
     $topbar->search = true;
     $topbar->searchAction = self::url();
     $topbar->searchLabel = _("Mailbox Search");
     $topbar->searchParameters = array('actionID' => 'mbox_search', 'searchexact' => 0, 'page' => 'filters');
     $this->header = _("Filter Rules");
     $this->output = $view->render('filters');
 }
예제 #10
0
파일: Year.php 프로젝트: DSNS-LAB/Dmail
 public function html()
 {
     global $prefs;
     $html = '<table id="kronolith-view-year" class="kronolith-minical"><tr>';
     for ($month = 1; $month <= 12; ++$month) {
         $html .= '<td>';
         // Heading for each month.
         $date = new Horde_Date(sprintf('%04d%02d01010101', $this->year, $month));
         $html .= '<table><thead><tr class="kronolith-minical-nav"><th colspan="7">' . Horde::url('month.php')->add('date', $date->dateString())->link() . $date->strftime('%B') . '</a></th></tr><tr><th class="kronolith-minical-empty">&nbsp;</th>';
         if (!$prefs->getValue('week_start_monday')) {
             $html .= '<th>' . _("Su") . '</th>';
         }
         $html .= '<th>' . _("Mo") . '</th>' . '<th>' . _("Tu") . '</th>' . '<th>' . _("We") . '</th>' . '<th>' . _("Th") . '</th>' . '<th>' . _("Fr") . '</th>' . '<th>' . _("Sa") . '</th>';
         if ($prefs->getValue('week_start_monday')) {
             $html .= '<th>' . _("Su") . '</th>';
         }
         $html .= '</tr></thead><tbody><tr><td class="kronolith-minical-week">';
         $startday = new Horde_Date(array('mday' => 1, 'month' => $month, 'year' => $this->year));
         $startday = $startday->dayOfWeek();
         $daysInView = Date_Calc::weeksInMonth($month, $this->year) * 7;
         if (!$prefs->getValue('week_start_monday')) {
             $startOfView = 1 - $startday;
             // We may need to adjust the number of days in the
             // view if we're starting weeks on Sunday.
             if ($startday == Horde_Date::DATE_SUNDAY) {
                 $daysInView -= 7;
             }
             $endday = new Horde_Date(array('mday' => Horde_Date_Utils::daysInMonth($month, $this->year), 'month' => $month, 'year' => $this->year));
             $endday = $endday->dayOfWeek();
             if ($endday == Horde_Date::DATE_SUNDAY) {
                 $daysInView += 7;
             }
         } else {
             if ($startday == Horde_Date::DATE_SUNDAY) {
                 $startOfView = -5;
             } else {
                 $startOfView = 2 - $startday;
             }
         }
         $currentCalendars = array(true);
         foreach ($currentCalendars as $id => $cal) {
             $cell = 0;
             for ($day = $startOfView; $day < $startOfView + $daysInView; ++$day) {
                 $date = new Kronolith_Day($month, $day, $this->year);
                 $date->hour = $prefs->getValue('twentyFour') ? 12 : 6;
                 $week = $date->weekOfYear();
                 if ($cell % 7 == 0) {
                     if ($cell != 0) {
                         $html .= "</tr>\n<tr><td class=\"kronolith-minical-week\">";
                     }
                     $html .= (int) $date->weekOfYear() . '</td>';
                 }
                 if ($date->month != $month) {
                     $style = 'kronolith-other-month';
                 } else {
                     $style = '';
                 }
                 /* Set up the link to the day view. */
                 $url = Horde::url('day.php', true)->add('date', $date->dateString());
                 if ($date->month == $month && !empty($this->_events[$date->dateString()])) {
                     /* There are events; create a cell with tooltip to list
                      * them. */
                     $day_events = '';
                     foreach ($this->_events[$date->dateString()] as $event) {
                         if ($event->status == Kronolith::STATUS_CONFIRMED) {
                             /* Set the background color to distinguish the
                              * day */
                             $style = 'year-event';
                         }
                         if ($event->isAllDay()) {
                             $day_events .= _("All day");
                         } else {
                             $day_events .= $event->start->strftime($prefs->getValue('twentyFour') ? '%R' : '%I:%M%p') . '-' . $event->end->strftime($prefs->getValue('twentyFour') ? '%R' : '%I:%M%p');
                         }
                         $day_events .= ':' . ($event->getLocation() ? ' (' . $event->getLocation() . ')' : '') . ' ' . $event->getTitle() . "\n";
                     }
                     /* Bold the cell if there are events. */
                     $cellday = '<strong>' . Horde::linkTooltip($url, _("View Day"), '', '', '', $day_events) . $date->mday . '</a></strong>';
                 } else {
                     /* No events, plain link to the day. */
                     $cellday = Horde::linkTooltip($url, _("View Day")) . $date->mday . '</a>';
                 }
                 if ($date->isToday() && $date->month == $month) {
                     $style .= ' kronolith-today';
                 }
                 $html .= '<td align="center" class="' . $style . '" height="10" width="5%" valign="top">' . $cellday . '</td>';
                 ++$cell;
             }
         }
         $html .= '</tr></tbody></table></td>';
         if ($month % 3 == 0 && $month != 12) {
             $html .= '</tr><tr>';
         }
     }
     echo $html . '</tr></table>';
 }
예제 #11
0
        $params['list'] = $this->smartShare->getName();
    }
    echo Horde::link($task->edit_link->add($params), $label) . Horde::img('edit.png', $label) . '</a>';
}
?>
  </td>
  <td>
    <?php 
echo $task->treeIcons();
$task_name = strlen($task->name) ? htmlspecialchars($task->name) : _("[none]");
if ($have_read) {
    $params = array('have_search' => $this->haveSearch, 'tab_name' => $this->tab_name, 'url' => Horde::selfUrl(true));
    if ($this->smartShare) {
        $params['list'] = $this->smartShare->getName();
    }
    echo Horde::linkTooltip($task->view_link->add($params), '', '', '', '', $task->desc) . $task_name . '</a>';
} else {
    echo $task_name;
}
?>
    <ul class='horde-tags'>
     <?php 
foreach ($task->tags as $t) {
    ?>
<li><?php 
    echo $this->h($t);
    ?>
</li><?php 
}
?>
    </ul>
예제 #12
0
파일: _task.html.php 프로젝트: Gomez/horde
        $params['list'] = $this->smartShare->getName();
    }
    echo Horde::link($task->edit_link->add($params), $label) . Horde::img('edit-sidebar-' . substr($task->foregroundColor(), 1) . '.png', $label) . '</a>';
}
?>
  </td>
  <td>
    <?php 
echo $task->treeIcons();
$task_name = strlen($task->name) ? htmlspecialchars($task->name) : _("[none]");
if ($have_read) {
    $params = array('have_search' => $this->haveSearch, 'tab_name' => $this->tab_name, 'url' => Horde::selfUrl(true));
    if ($this->smartShare) {
        $params['list'] = $this->smartShare->getName();
    }
    echo Horde::linkTooltip($task->view_link->add($params), '', '', '', '', $task->desc, '', array('style' => 'color:' . $task->foregroundColor())) . $task_name . '</a>';
} else {
    echo $task_name;
}
?>
    <ul class='horde-tags'>
     <?php 
foreach ($task->tags as $t) {
    ?>
<li><?php 
    echo $this->h($t);
    ?>
</li><?php 
}
?>
    </ul>