}.bindAsEventListener(this));
container.observe('ViewPort:contentComplete', function(e) {
- var ssc, tmp,
+ var flags, ssc, tmp,
ham = spam = 'show',
l = this.viewport.getMetaData('label');
}
this.setSortColumns(ssc);
+
+ /* Context menu: generate the list of settable flags for this
+ * mailbox. */
+ flags = this.viewport.getMetaData('flags');
+ $('ctx_flag').childElements().each(function(c) {
+ [ c ].invoke(flags.include(c.readAttribute('flag')) ? 'show' : 'hide');
+ });
}.bindAsEventListener(this));
container.observe('ViewPort:deselect', function(e) {
if ($args['initial'] || !is_null($args['sortdir'])) {
$md->sortdir = intval($sortpref['dir']);
}
- if ($args['initial'] && IMP::isSpecialFolder($mbox)) {
- $md->special = 1;
- }
- if ($args['initial'] && $is_search) {
- $md->search = 1;
+
+ /* Actions only done on 'initial' request. */
+ if ($args['initial']) {
+ if (IMP::isSpecialFolder($mbox)) {
+ $md->special = 1;
+ }
+ if ($is_search) {
+ $md->search = 1;
+ }
+
+ /* Generate flag array. */
+ $md->flags = array_keys($GLOBALS['injector']->getInstance('IMP_Imap_Flags')->getList(array('imap' => true, 'mailbox' => $is_search ? null : $mbox)));
}
/* These entries may change during a session, so always need to