I am hitting my head against a brick wall and cannot get MODx to trigger the correct processor.
I have created successfully a number of normal MODx.window triggered from grids that update correctly with processers.
But this time I have trouble getting a FormPanel to trigger the correct processor.
It seems that baseParams do not trigger correctly.
The formpanel to update, is correctly triggered with the following controller:
<?php
if (!$modx->user->isAuthenticated('mgr')) return $modx->error->failure($modx->lexicon('liteauction.security_not_auth_manager'));
// Get all mandatory data
if (empty($_REQUEST['id'])) return $modx->error->failure($modx->lexicon('liteauction.default_item_error_ns'));
$id = $_REQUEST['id'];
// Get the data
$item = $modx->getObject('laAuctionGroup', $id);
if ($item == null) return $modx->error->failure($modx->lexicon('liteauction.default_item_error_nf'));
$itemArray = $item->toArray();
// Register all JS files
$modx->regClientStartupScript($liteauction->config['jsUrl'].'mgr/widgets/stores.js');
$modx->regClientStartupScript($liteauction->config['jsUrl'].'mgr/widgets/panel_auctiongroup.js');
$modx->regClientStartupScript($liteauction->config['jsUrl'].'mgr/sections/index_auctiongroup.js');
$modx->regClientStartupHTMLBlock('
<script type="text/javascript">
// <![CDATA[
Ext.onReady(function() {
MODx.load({
xtype: "liteauction-page-home"
,auctiongroup: "'.$item->get('id').'"
,record: '.$modx->toJSON($itemArray).'
});
});
// ]]>
</script>');
return '<div id="liteauction-panel-home-div"></div>';
The index file is as follows:
Liteauction.page.Home = function(config) {
config = config || {};
Ext.applyIf(config,{
formpanel: 'liteauction-panel-home'
,url: Liteauction.config.connectorUrl
,baseParams: { action: 'mgr/auctiongroup/update' }
,buttons: [{
process: 'update'
,url: Liteauction.config.connectorUrl
,baseParams: { action: 'mgr/auctiongroup/update' }
,text: _('save')
,method: 'remote'
,checkDirty: true
,keys: [{
key: MODx.config.keymap_save || 's'
,alt: true
,ctrl: true
}]
},'-',{
process: 'cancel'
,text: _('liteauction.default_back')
,params: { a:MODx.action['controllers/index'] }
}]
,components: [{
xtype: 'liteauction-panel-home'
,renderTo: 'liteauction-panel-home-div'
,auctiongroup: config.auctiongroup
,record: config.record || {}
}]
});
Liteauction.page.Home.superclass.constructor.call(this,config);
};
Ext.extend(Liteauction.page.Home, MODx.Component);
Ext.reg('liteauction-page-home', Liteauction.page.Home);
The panel is as follows:
Liteauction.panel.Home = function(config) {
config = config || {};
Ext.apply(config,{
id: 'liteauction-panel-home'
,url: Liteauction.config.connectorUrl
,baseParams: { action: 'mgr/auctiongroup/update' }
,border: false
,baseCls: 'modx-formpanel'
,listeners: {
'setup': {fn:this.setup, scope:this}
,'success': {fn:this.success, scope:this}
,'beforeSubmit': {fn:this.beforeSubmit, scope:this}
,'fieldChange': {fn:this.fieldChange, scope:this}
}
,items: [{
html: '<h2>'+_('liteauction.auctiongroup_tabname')+'</h2>'
,border: false
,cls: 'modx-page-header'
}, {
xtype: 'modx-tabs'
,bodyStyle: 'padding: 10px'
,defaults: { border: false ,autoHeight: true }
,border: true
,items: [{
title: _('liteauction.auctiongroup_tabname_core')
,defaults: { autoHeight: true }
,layout: 'form'
,items: [{
xtype: 'hidden'
,name: 'id'
,value: config.auctiongroup
}, {
name: 'name_sv'
,xtype: 'textfield'
,fieldLabel: _('liteauction.auctiongroup_name_sv_mandatory')
,minLength: 1
,maxLength: 255
,labelWidth: 250
,width: 300
,description: _('liteauction.auctiongroup_name_sv_info')
,allowBlank: false
}, {
name: 'name_en'
,xtype: 'textfield'
,fieldLabel: _('liteauction.auctiongroup_name_en_mandatory')
,minLength: 1
,maxLength: 255
,labelWidth: 250
,width: 300
,description: _('liteauction.auctiongroup_name_en_info')
,allowBlank: false
}]
}]
}]
});
Liteauction.panel.Home.superclass.constructor.call(this,config);
};
Ext.extend(Liteauction.panel.Home, MODx.FormPanel, {
initialized: false
,setup: function() {
if (this.config.auctiongroup === '' || this.config.auctiongroup === 0) {
this.fireEvent('ready');
return false;
}
if (!this.initialized) {
var r = this.config.record;
this.getForm().setValues(r);
this.fieldChange();
this.fireEvent('ready');
MODx.fireEvent('ready');
this.initialized = true;
}
}
,beforeSubmit: function(o) {
alert(this.config.auctiongroup);
alert(this.config.url);
alert(this.config.baseParams);
}
,success: function(o) {
alert('Success');
}
,fieldChange: function() {
if (Ext.getCmp('liteauction-auctiongroup-partnerowned').checked == true) {
Ext.getCmp('liteauction-auctiongroup-clientid').hide();
} else {
Ext.getCmp('liteauction-auctiongroup-clientid').show();
}
}
});
Ext.reg('liteauction-panel-home', Liteauction.panel.Home);
When I press the update button, MODx displays the following message:
Processor not found and path is to base path to processor directory with added ’update.php’.
It should instead be base path with ’mgr/auctiongroup/update.php’ added.
It seems that baseParams and action is not transferred to MODx engine.
What am I doing wrong?
Regards
Sven