[RCD] Persistent messages

Marcus Don mdon at names.co.uk
Mon Jun 28 17:04:01 CEST 2010


Hi

I¹ve just taken a look at app.js and realised the alternative fix I
mentioned in my previous email below (ie to always use the first value
passed to display_message) is much easier. All we need to do is modify line
4321 like this:

Replace this...

    if (!this.loaded) {
...with this...

    if (!this.loaded && this.pending_message instanceof Array == false) {
Does anyone have any objection to this? If not, please could someone update
the repository?

Thanks

Marcus


> Hi
> 
> I've got another small modification request...
> 
> When using hooks to modify the behaviour of an existing action, there is
> currently no way to generate an error message other than the default "An error
> occurred while saving", which is shown if you set the abort flag. This is a
> problem for us because we need to perform additional validation, such as
> ensuring the user owns the domain for which he is trying to create an email
> address (ie in create_identity).
> 
> My suggestion is simply to add an "abort_message" element to the $args array,
> which can be checked by each of the action scripts. For example, in
> save_identity.inc we just need to replace each occurrence of this...
> 
> else if ($plugin['abort'] || $DB->is_error())
>     $OUTPUT->show_message('errorsaving', 'error', null, false);
> 
> ...with this...
> 
> } else if ($plugin['abort'] || $DB->is_error()) {
>     if (isset($plugin['abort_message']) && $plugin['abort_message'] != '') {
>         $OUTPUT->command('display_message', $plugin['abort_message'], 'error',
> false);
>     } else {
>         $OUTPUT->show_message('errorsaving', 'error', null, false);
>     }
> }
> 
> However, this still has the problem that error messages can¹t be made
> persistent (which I don¹t need, but which should be included for consistency).
> So, a better method would be to only display the default message if the
> messages array is empty - but I haven¹t looked into this yet.
> 
> If there¹s another way to achieve this, I¹d be very grateful if someone could
> let me know. I¹d also be grateful if someone could make the change to the
> javascript functions requested in my previous email below.
> 
> Thanks
> 
> Marcus
> 
>   
> 
>> Hi
>> 
>> I'd like to suggest a small alteration to app.js in order to allow persistent
>> messages to be generated when using rcmail::output::command() within a
>> page-generating callback function.
>> 
>> The rcube_webmail::display_message() function already accepts a "hold"
>> parameter, but this doesn't get stored in $pending_message if the page hasn't
>> yet loaded, so it gets lost. My suggestion is simply to add this extra
>> parameter to $pending_message and then pass it back to display_message()
>> within init().
>> 
>> So, on line 4323, I'd like to replace this...
>> 
>> this.pending_message = new Array(msg, type);
>> 
>> ...with this...
>> 
>> this.pending_message = new Array(msg, type, hold);
>> 
>> And, on line 385, I'd like to replace this...
>> 
>> this.display_message(this.pending_message[0], this.pending_message[1]);
>> 
>> ..with this...
>> 
>> this.display_message(this.pending_message[0], this.pending_message[1],
>> this.pending_message[2]);
>> 
>> As a result of this change, I can now make messages persistent by calling
>> rcmail::output::command() like this:
>> 
>> $this->rcmail->output->command(
>>     'display_message',
>>     '[message_text]',
>>     '[message_type]',
>>     true
>> );
>> 
>> Thanks
>> 
>> Marcus
>> --
>> Marcus Don
>> Senior Manager
>> Research and Development
>> DadaPro
>> 
>> Main Line:     +44 (0)845 363 3630
>> Main Fax:      +44 (0)845 363 3631
>> Tech Support:  +44 (0)845 363 3634
>> Email:         mdon at names.co.uk
>> Website:       http://www.names.co.uk
>> Address:       Acton House, Perdiswell Park, Worcester WR3 7GD
>> 
>> This email and any files transmitted with it are confidential and intended
>> solely for the use of the individual or entity to whom they are addressed.
>> 
>> If you have received this email in error please notify the sender
>> immediately.  If you are not the intended recipient you are notified that
>> disclosing, copying, distributing or taking any action in reliance on the
>> contents of this information is strictly prohibited. Please note that any
>> views or opinions presented in this email are solely those of the author and
>> do not necessarily represent those of the company.
>> 
>> Finally, the recipient should check this email and any attachments for the
>> presence of viruses.  The company accepts no liability for any damage caused
>> by any virus transmitted by this email.
>>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.roundcube.net/pipermail/dev/attachments/20100628/911c0d9b/attachment-0001.html>
-------------- next part --------------
_______________________________________________
List info: http://lists.roundcube.net/dev/


More information about the Dev mailing list