Hi all,
I'm working on a component to force a user to change the password before they can continue. The way I want to do is to load up a extjs window and disable all the functions to close or cancel the operation (this is all possible with the boolean options inside the window object, so far so good).
To arrange this I have created a plugin which is linked to the "OnManagerPageInit" (also tested the "OnHandleRequest"). The plugin adds some javascripts to the head and here starts te problem. This is my plugin code;
if($modx->context->get('key') != 'mgr') { return ''; }
$fpc = $modx->getService('forcedpasswdchange','FPC',$modx->getOption('forcedpasswdchange.core_path',null,$modx->getOption('core_path').'components/forcedpasswdchange/').'model/forcedpasswdchange/',$scriptProperties);
if (!($fpc instanceof FPC)) return '';
$eventName = $modx->event->name;
switch($eventName) {
case 'OnManagerPageInit':
$user =& $modx->user;
if(empty($user) || !is_object($user)) { return ''; }
$pwdch = $modx->getObject('forcedPasswdChange', array('user' => $user->get('id')));
if(empty($pwdch) || !is_object($pwdch) || (is_object($pwdch) && $pwdch->get('changed') === true)) { return ''; }
$modx->lexicon->load('forcedpasswdchange:default');
$lexicons = $modx->lexicon->fetch('fpc');
$modx->regClientStartupScript($fpc->config['jsUrl'].'mgr/forcedpasswdchange.js');
$modx->regClientStartupHTMLBlock('<script type="text/javascript">
Ext.onReady(function() {
ForcedPasswdChange.config = '.$modx->toJSON($fpc->config).';
ForcedPasswdChange.config.connector_url = "'.$fpc->config['connectorUrl'].'";
ForcedPasswdChange.request = '.$modx->toJSON($_GET).';
ForcedPasswdChange.lang = '.$modx->toJSON($lexicons).';
});
</script>');
$modx->regClientStartupScript($fpc->config['jsUrl'].'mgr/widgets/forcedpasswdchange.window.js');
break;
}
The first javascript file that is being loaded, contains
var ForcedPasswdChange = function(config) {
config = config || {};
ForcedPasswdChange.superclass.constructor.call(this, config);
};
Ext.extend(ForcedPasswdChange, Ext.Component,{
page:{}, window:{}, grid:{}, tree:{}, panel:{}, combo:{}, config:{}
});
Ext.reg('forcedpasswdchange', ForcedPasswdChange);
ForcedPasswdChange = new ForcedPasswdChange();
And the window javascript file contains
Ext.onReady(function() {
var ForcedPasswdChangeWindow = new MODx.Window({..options..});
ForcedPasswdChangeWindow.show(Ext.getBody());
});
As you can see I generate a own lexicon javascript (json) object because my lexicons are not loaded because I dont have a own manager page and only when you have that it is possible to load lexicons and use _('lexicon') in your files. Alright; I would like to use the default ways but it works.
The window shows up, lexicons are successfully loaded and shown. But I want to use the Ext.extend(MODx.window, ...); method, becuase the window now contains no form and I cannot access the field values otherwise then using id's on the fields and do a custom ajax request.
Why I dont can use the extend method is because my javascripts are loaded just before the MODX javascripts are loaded. I tried a lot to change the order of loading, even tried the non-Startup methods of regClientScript() without any luck.
Does anyone have an idea?

Thanks in advance!
Regards, Bert