Thank you insomnia.
case 'ListFolders':
$imptree = IMP_Imap_Tree::singleton();
- $result = DIMP::getFolderResponse($imptree, array('a' => $imptree->folderList(IMP_Imap_Tree::FLIST_CONTAINER | IMP_Imap_Tree::FLIST_VFOLDER), 'c' => array(), 'd' => array()));
+ $mask = IMP_Imap_Tree::FLIST_CONTAINER | IMP_Imap_Tree::FLIST_VFOLDER | IMP_Imap_Tree::FLIST_ELT;
+ if (Horde_Util::getPost('unsub')) {
+ $mask |= IMP_Imap_Tree::FLIST_UNSUB;
+ }
+ $result = DIMP::getFolderResponse($imptree, array('a' => $imptree->folderList($mask), 'c' => array(), 'd' => array()));
$quota = _getQuota();
if (!is_null($quota)) {
v5.0-git
--------
+[mms] Add display of unsubscribed folders to DIMP.
[mms] Add message information to preview screen (DIMP).
[mms] Add Alt + PGUP/PGDN shortcut to scroll through preview message (DIMP).
[jan] Show possible event conflicts in iTip viewer (Request #3991, Gonçalo
var DimpBase = {
// Vars used and defaulting to null/false:
// cfolderaction, folder, folderswitch, offset, pollPE, pp, sfolder,
- // uid, viewport
+ // showunsub, uid, viewport
// message_list_template set via templates/javascript/mailbox.js
bcache: $H(),
cacheids: {},
this.togglePreviewPane();
break;
+ case 'mboxsubtoggle':
+ this.toggleSubscribed();
+ break;
+
case 'oa_blacklist':
case 'oa_whitelist':
this.blacklist(id == 'oa_blacklist');
ftype = ob.s ? 'special' : 'folder';
}
+ if (ob.un) {
+ cname += ' unsubFolder';
+ }
+
div = new Element('DIV', { className: 'iconDiv' });
if (ob.i) {
div.setStyle({ backgroundImage: 'url("' + ob.i + '")' });
nf.setStyle({ height: (document.viewport.getHeight() - nf.cumulativeOffset()[1]) + 'px' });
},
+ toggleSubscribed: function()
+ {
+ this.showunsub = !this.showunsub;
+ $('mboxsubtoggle').setText(this.showunsub ? DIMP.text.hide_unsub : DIMP.text.show_unsub);
+ $('foldersLoading').show();
+ $('foldersSidebar').hide();
+
+ // TODO - Only do for unsub -> sub switch
+ [ $('specialfolders').childElements(), $('dropbase').nextSiblings() ].flatten().each(function(elt) {
+ this.deleteFolderElt(elt.readAttribute('id'), true);
+ }, this);
+
+ DimpCore.doAction('ListFolders', { unsub: Number(this.showunsub) }, null, this._folderLoadCallback.bind(this));
+ },
+
/* Flag actions for message list. */
_getFlagSelection: function(opts)
{
"<head>\n";
// TODO: Make dimp work with IE 8 standards mode
+ // Needs prototypejs 1.6.0.4
if ($GLOBALS['browser']->isBrowser('msie') &&
($GLOBALS['browser']->getMajor() == 8)) {
echo '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />' . "\n";
'empty_folder' => _("Permanently delete all messages in %s?"),
'getmail' => Horde::highlightAccessKey(addslashes(_("_Get Mail")), Horde::getAccessKey(_("_Get Mail"), true)),
'hide_preview' => _("Hide Preview"),
+ 'hide_unsub' => _("Hide Unsubscribed"),
'hidealog' => _("Hide Alerts Log"),
'listmsg_wait' => _("The server is still generating the message list."),
'listmsg_timeout' => _("The server was unable to generate the message list."),
'rename_prompt' => _("Rename folder to:"),
'search' => _("Search"),
'show_preview' => _("Show Preview"),
+ 'show_unsub' => _("Show Unsubscribed"),
'showalog' => Horde::highlightAccessKey(addslashes(_("_Alerts Log")), Horde::getAccessKey(_("_Alerts Log"), true)),
'verify' => _("Verifying..."),
'vp_empty' => _("There are no messages in this mailbox."),
{
$GLOBALS['notification']->notify(array('listeners' => 'status'));
$msgs = $GLOBALS['imp_notify']->getStack(true);
- if (!count($msgs)) {
- return '';
- }
- return 'DimpCore.showNotifications(' . Horde_Serialize::serialize($msgs, Horde_Serialize::JSON) . ')';
+ return count($msgs)
+ ? 'DimpCore.showNotifications(' . Horde_Serialize::serialize($msgs, Horde_Serialize::JSON) . ')'
+ : '';
}
/**
* @param array $changes An array with three sub arrays - to be used
* instead of the return from
* $imptree->eltDiff():
- * 'a' - a list of folders to add
+ * 'a' - a list of folders/objects to add
* 'c' - a list of changed folders
* 'd' - a list of folders to delete
*
if (!empty($changes['a'])) {
$result['a'] = array();
foreach ($changes['a'] as $val) {
- $result['a'][] = DIMP::_createFolderElt($imptree->element($val));
+ $result['a'][] = DIMP::_createFolderElt(is_array($val) ? $val : $imptree->element($val));
}
}
* 's' (special) = Is this a "special" element? [boolean] [DEFAULT: no]
* 't' (title) = The title value. [string] [DEFAULT: 'm' val]
* 'u' (unseen) = The number of unseen messages. [integer]
+ * 'un' (unsubscribed) = Is this folder unsubscribed? [boolean]
+ * [DEFAULT: no]
* 'v' (virtual) = Is this a virtual folder? [boolean] [DEFAULT: no]
* </pre>
*/
if ($elt['vfolder']) {
$ob->v = 1;
}
+ if (!$elt['sub']) {
+ $ob->un = 1;
+ }
$tmp = IMP::getLabel($ob->m);
if ($tmp != $ob->m) {
/* Defines used with folderList(). */
const FLIST_CONTAINER = 1;
const FLIST_UNSUB = 2;
- const FLIST_OB = 4;
- const FLIST_VFOLDER = 8;
+ const FLIST_VFOLDER = 4;
+ const FLIST_OB = 8;
+ const FLIST_ELT = 16;
/* Add a percent to folder key since it allows us to sort by name but
* never conflict with an IMAP mailbox of the same name (since '%' is an
* <pre>
* IMP_Imap_Tree::FLIST_CONTAINER - Show container elements.
* IMP_Imap_Tree::FLIST_UNSUB - Show unsubscribed elements.
- * IMP_Imap_Tree::FLIST_OB - Return full tree object.
* IMP_Imap_Tree::FLIST_VFOLDER - Show Virtual Folders.
+ * IMP_Imap_Tree::FLIST_OB - Return full tree object.
+ * IMP_Imap_Tree::FLIST_ELT - Return element object.
* </pre>
* @param string $base Return all mailboxes below this element.
*
- * @return array An array of IMAP mailbox names.
+ * @return array Either an array of IMAP mailbox names or an array of
+ * objects (if FLIST_OB ot FLIST_ELT is specified).
*/
public function folderList($mask = 0, $base = null)
{
!$this->isContainer($mailbox)) &&
(($mask & self::FLIST_VFOLDER) ||
!$this->isVFolder($mailbox))) {
- $ret_array[] = ($mask & self::FLIST_OB) ? $mailbox : $mailbox['v'];
+ $ret_array[] = ($mask & self::FLIST_OB)
+ ? $mailbox
+ : (($mask & self::FLIST_ELT) ? $this->element($mailbox['v']) : $mailbox['v']);
}
} while (($mailbox = $this->next(self::NEXT_SHOWCLOSED)));
}
/**
* Return extended information on an element.
*
- * @param string $name The name of the tree element.
+ * @param mixed $name The name of the tree element or a tree element.
*
* @return array Returns the element with extended information, or false
* if not found. The information returned is as follows:
* 'polled' - (boolean) Show polled information?
* 'recent' - (integer) The number of new messages in the element (if
* polled).
+ * 'sub' - (boolean) Is folder subscribed to?
* 'special' - (integer) A mask indicating if this is a "special" element.
* 'specialvfolder' - (boolean) Is this a "special" virtual folder?
* 'unseen' - (integer) The number of unseen messages in the element (if
{
static $elt;
- $mailbox = $this->get($mailbox);
+ if (!is_array($mailbox)) {
+ $mailbox = $this->get($mailbox);
+ }
if (!$mailbox) {
return false;
}
'recent' => 0,
'special' => 0,
'specialvfolder' => false,
+ 'sub' => $this->isSubscribed($mailbox),
'user_icon' => false,
'value' => $mailbox['v'],
'vfolder' => false,
<div class="context" id="ctx_otheractions" style="display:none">
<a id="previewtoggle" class="sep"><span class="contextImg"></span><?php echo ($prefs->getValue('dimp_show_preview') ? _("Hide Preview") : _("Show Preview")); ?></a>
+<?php if ($conf['user']['allow_folders']): ?>
+ <a id="mboxsubtoggle" class="sep"><span class="contextImg"></span><?php echo _("Show Unsubscribed") ?></a>
+<?php endif; ?>
<?php if (!empty($flag_list)): ?>
<a id="oa_setflag"><span class="contextImg"></span><?php echo _("Mark as") ?></a>
<a id="oa_unsetflag" class="sep"><span class="contextImg"></span><?php echo _("Unmark as") ?></a>
height: 100%;
background-repeat: no-repeat;
}
-#sidebarPanel div.base {
+#sidebarPanel div.base, #mboxsubtoggle span.contextImg {
background-image: url("graphics/folder.png");
}
#sidebarPanel div.col {
#sidebarPanel div.trash {
background-image: url("graphics/folder_trash.png");
}
-#sidebarPanel #normalfolders {
+#normalfolders {
overflow-x: hidden;
}
-#sidebarPanel #myfolders {
+#normalfolders li.unsubFolder {
+ font-style: italic;
+}
+#myfolders {
display: none;
}
#sidebarPanel .over a, #sidebarPanel li.folder:hover, #sidebarPanel li.custom:hover, #sidebarPanel li.servicelink:hover {
-#sidebarPanel div.base {
+#sidebarPanel div.base, #mboxsubtoggle span.contextImg {
background-image: url("graphics/folder.png");
}
#sidebarPanel div.col {