Allows for dynamic addition of flags in the future.
Also allows storage of IMAP flag name in metadata rather than hackish
parameter storage.
$('ctx_message_setflag', 'oa_setflag').invoke('up').invoke(flags.size() ? 'show' : 'hide');
if (flags.size()) {
$('ctx_flag').childElements().each(function(c) {
- [ c ].invoke(flags.include(c.readAttribute('flag')) ? 'show' : 'hide');
+ [ c ].invoke(flags.include(c.retrieve('flag')) ? 'show' : 'hide');
});
}
}.bindAsEventListener(this));
default:
if (menu.endsWith('_setflag') || menu.endsWith('_unsetflag')) {
- flag = elt.readAttribute('flag');
+ flag = elt.retrieve('flag');
this.flag(flag, this.convertFlag(flag, menu.endsWith('_setflag')));
} else if (menu.endsWith('_filter') || menu.endsWith('_filternot')) {
this.search = {
- flag: elt.readAttribute('flag'),
+ flag: elt.retrieve('flag'),
label: this.viewport.getMetaData('label'),
mbox: this.folder,
not: menu.endsWith('_filternot')
}
},
+ contextAddFlag: function(flag, f)
+ {
+ var a = new Element('A'),
+ style = {};
+
+ if (f.p) {
+ style.backgroundColor = f.b.escapeHTML();
+ }
+
+ $('ctx_flag').insert(
+ a.insert(
+ new Element('SPAN', { className: 'contextImg' }).addClassName(f.c.escapeHTML()).setStyle(style)
+ ).insert(
+ f.l.escapeHTML()
+ )
+ );
+
+ a.store('flag', flag);
+ },
+
// nodefer - (boolean) If true, don't defer updating if folder element
// does not exist.
updateTitle: function(nodefer)
});
DM.addSubMenu('ctx_folder_setflag', 'ctx_folder_flag');
+ /* Create flag entries. */
+ DIMP.conf.flags_o.each(function(f) {
+ if (DIMP.conf.flags[f].s) {
+ this.contextAddFlag(f, DIMP.conf.flags[f]);
+ }
+ }, this);
+
if (DIMP.conf.disable_compose) {
$('button_reply', 'button_forward').compact().invoke('up', 'SPAN').concat($('button_compose', 'composelink', 'ctx_contacts_new')).compact().invoke('remove');
} else {
// Quota information
$show_quota = (isset($_SESSION['imp']['imap']['quota']) && is_array($_SESSION['imp']['imap']['quota']));
-// Get the list of available IMAP flags
-$flag_list = $injector->getInstance('IMP_Imap_Flags')->getList(array('imap' => true));
-
// Get application folders list.
$application_folders = array();
foreach (IMP_Dimp::menuList() as $app) {
<a id="ctx_message_resume" style="display:none"><span class="contextImg"></span><?php echo _("Resume Draft") ?></a>
<a id="ctx_message_reply"><span class="contextImg"></span><?php echo _("Reply") ?></a>
<a id="ctx_message_forward"><span class="contextImg"></span><?php echo _("Forward") ?></a>
-<?php if (!empty($flag_list)): ?>
- <div>
+ <div id="ctx_message_flagopts" style="display:none">
<div class="sep"></div>
<a id="ctx_message_setflag"><span class="contextImg"></span><?php echo _("Mark as") ?>...</a>
<a id="ctx_message_unsetflag"><span class="contextImg"></span><?php echo _("Unmark as") ?>...</a>
</div>
-<?php endif; ?>
<div class="sep"></div>
<?php if (!empty($conf['spam']['reporting'])): ?>
<a id="ctx_message_spam"><span class="contextImg"></span><?php echo _("Report as Spam") ?></a>
<a id="oa_preview_show"><span class="contextImg"></span><?php echo _("Show Preview") ?></a>
<a id="oa_layout_horiz"><span class="contextImg"></span><?php echo _("Horizontal Layout") ?></a>
<a id="oa_layout_vert"><span class="contextImg"></span><?php echo _("Vertical Layout") ?></a>
-<?php if (!empty($flag_list)): ?>
- <div>
+ <div id="oa_flagopts" style="display:none">
<div class="sep"></div>
<a id="oa_setflag"><span class="contextImg"></span><?php echo _("Mark as") ?>...</a>
<a id="oa_unsetflag"><span class="contextImg"></span><?php echo _("Unmark as") ?>...</a>
</div>
-<?php endif; ?>
<?php if ($has_blacklist || $has_whitelist): ?>
<?php if ($has_blacklist): ?>
<div>
<?php endif; ?>
</div>
-<?php if (!empty($flag_list)): ?>
<div class="context" id="ctx_flag" style="display:none">
-<?php foreach ($flag_list as $key => $val): ?>
- <a flag="<?php echo htmlspecialchars($key) ?>"><span class="contextImg <?php echo htmlspecialchars($val['c']) ?>"<?php echo ($val['t'] == 'imapp') ? ' style="background:' . htmlspecialchars($val['b']) . '"' : '' ?>></span><?php echo htmlspecialchars($val['l']) ?></a>
-<?php endforeach; ?>
</div>
-<?php endif; ?>
<div class="context" id="ctx_contacts" style="display:none">
<a id="ctx_contacts_new"><span class="contextImg"></span><?php echo _("New Message") ?></a>
'l' => $val['l'],
'n' => isset($val['n']) ? $val['n'] : null,
// Indicate if this is a user *P*ref flag
- 'p' => intval($val['t'] == 'imapp')
+ 'p' => intval($val['t'] == 'imapp'),
+ // Indicate if this is a flag that can be *S*earched for
+ 's' => intval(in_array($val['t'], array('imapp', 'imapu')))
));
}
? array()
: array_map(array('IMP_Dimp', 'appendedFolderPref'), $GLOBALS['conf']['server']['fixed_folders']),
'flags' => $flags,
+ /* Needed to maintain flag ordering. */
+ 'flags_o' => array_keys($flags),
'fsearchid' => IMP_Search::MBOX_PREFIX . IMP_Search::DIMP_FILTERSEARCH,
'ham_spammbox' => intval(!empty($GLOBALS['conf']['notspam']['spamfolder'])),
'login_view' => $GLOBALS['prefs']->getValue('dimp_login_view'),