Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend MODx.msg.confirm to allow for other statuses #1

Closed
rthrash opened this issue Jun 18, 2013 · 0 comments
Closed

Extend MODx.msg.confirm to allow for other statuses #1

rthrash opened this issue Jun 18, 2013 · 0 comments
Labels

Comments

@rthrash
Copy link
Member

rthrash commented Jun 18, 2013

MODx.msg.confirm (http://rtfm.modx.com/display/revolution20/MODx.msg) only allows for success, failure, and cancel events, but that greatly restricts the type of messaging that is possible using Ext JS MessageBoxes. In particular, it would be helpful to implement some other messaging vectors for plugins that fire on various system events, e.g. OnBeforeDocFormSave could pop up a warning window or an info window, or a confirmation window.

See /manager/assets/modext/core/modx.js around line 520:

   showError: function(e) {
         if (e === '') {
             MODx.msg.hide();
         } else {
             MODx.msg.alert(_('error'),e,Ext.emptyFn);
         }
     }

This would require that the values returned from the OnBeforeDocFormSave and similar events be allowed to set a status when they set a message to $modx->event->output(). E.g. maybe add an argument to core/model/modx/modx.class.php:

    public function output($output, $status=null) {
        $this->_output .= $output;
    }

Then this would have to trickle down into fireBeforeSaveEvent() function inside the modprocessor.class.php -- it'd be a lot of work to change this. It looks like in some cases, event output is expected to be an array (e.g. an array of error messages), so it might not be a stretch to make it an array of hashes, where each message could include some meta data about it (primarily what kind of message it is: error, warning, etc).

h2. See Also

Originally by everettg_99 on 2013-06-18T14:50:34Z
Redmine ID: 9982

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant