Quoting Sebastian Arcus <s...@open-t.co.uk>:

I would like to set a default value for "msgflags" in IMP and lock it for all users. More precisely, I want to reset the colour of all flags to white, except the "Unread" flag. What I've worked out so far using the documentation and help in prefs files:

1. The file to use is imp/config/prefs.local.php (I'm hoping this will still work for setting defaults, although I'm using SQL for preferences storage).


2. I think the section I need to amend is:

// This array contains the list of flags created by the user through the
// flags UI, and any modifications to the built-in system flags.
$_prefs['msgflags'] = array(
    // 'value' = serialize(array())
    'value' => 'a:0:{}'
);


3. To lock it I will modify it like so:

// This array contains the list of flags created by the user through the
// flags UI, and any modifications to the built-in system flags.
$_prefs['msgflags'] = array(
    locked => true,
    // 'value' = serialize(array())
    'value' => 'a:0:{}'
);


What I can't seem to figure out is the syntax to be used in the 'value' field. I've googled, but so far I've drawn a blank in terms of how to assign colours to the individual flags in this array.

'msgflags' contains IMP_Flag_Base objects, but ONLY if they differ from the base objects.

To store using the msgflags preference, you can do something like this (which needs to be run in the IMP environment):

$msgflags = array();
foreach ($GLOBALS['injector']->getInstance('IMP_Flags') as $val) {
    if (!($val instanceof IMP_Flag_Imap_Seen)) {
        $val->bgcolor = '#fff';
        $msgflags[] = $val;
    }
}
$pref_value = serialize($msgflags);

Take the string value of $pref_value and use this as the 'value' field of the locked 'msgflags' preference.

Optionally, you can just directly hack the Flag objects and replace the default bgcolor values with '#fff' instead.

michael

___________________________________
Michael Slusarz [slus...@horde.org]

--
imp mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: imp-unsubscr...@lists.horde.org

Reply via email to