Forums / Developer / Trouble with multiple modules on one extension

Trouble with multiple modules on one extension

Author Message

Erik Weinmaster

Thursday 11 February 2010 10:40:20 am

I have two modules setup in ezp as the following:

extension/mycompany/modules/module1

extension/mycompany/modules/module2

my extension/mycompany/settings/module.ini.append.php is the following:

[ModuleSettings]
ModuleRepositories[]=kernel
ModuleRepositories[]=kernel/private/modules
ExtensionRepositories[]=mycompany
ModuleList[]
ModuleList[]=class
ModuleList[]=collaboration
ModuleList[]=content
ModuleList[]=error
ModuleList[]=ezinfo
ModuleList[]=infocollector
ModuleList[]=layout
ModuleList[]=notification
ModuleList[]=package
ModuleList[]=pdf
ModuleList[]=role
ModuleList[]=rss
ModuleList[]=search
ModuleList[]=section
ModuleList[]=settings
ModuleList[]=setup
ModuleList[]=shop
ModuleList[]=state
ModuleList[]=trigger
ModuleList[]=url
ModuleList[]=user
ModuleList[]=visual
ModuleList[]=workflow
ModuleList[]=switchlanguage
#custom modules here
ModuleList[]=module1
ModuleList[]=module2

I have to list the kernel modules otherwise the whole system doesn't work. Anyway, I have no trouble using module1, however I can't access module2. I keep getting this:

Function required:
 Module : module2
 Function : 
 ClassID : 
 MainNodeID : 
Policies that didn't match:

And my module.php file for module2 consists of the following:

$Module = array( 'name' => 'module2',
'variable_params' => true );
$ViewList = array();
$ViewList['test'] = array(
'function' => array( 'public' ),
'script' => 'test.php',
'ui_context' => 'administration',
'default_navigation_part' => 'ezcontentnavigationpart',
'params' => array( 'node_id' ) );
$FunctionList['public'] = array();

Is there something I'm missing to get that second module to work? I realize there are a couple of files I left out like site.ini.append.php, but if I can get the first one to work why would the second give me trouble?

-thanks

Bruce Morrison

Thursday 11 February 2010 4:30:27 pm

Hi Erik

Try replacing your extension module.ini with the following:

[ModuleSettings]
ExtensionRepositories[]=mycompany
ModuleList[]=module1
ModuleList[]=module2

The ModuleList[] line clears any previous setting and in not required, thats why you have to include the kernel entries.

See if that fixes things. There may be a policy/permissions issue, so if you still have issues can you post module.php from module1 for comparison.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Erik Weinmaster

Friday 12 February 2010 6:53:45 am

Bruce,

Thanks for the first piece of advice of eliminating the ModuleList[] line. Worked great. However, I'm still having trouble with module2. I'll try to list the contents of module.php for both in this post, but they may get a little lengthy.

Anyway, here is what my extension/mycompany/modules/module1/module.php file looks like:

<?php
$Module = array( 'name' => 'Module 1',
'variable_params' => true );
$ViewList = array();
//*********** All items that deal with viewing data ***********
$ViewList['dart_local_content_view'] = array(
'functions' => array( 'public' ),
'script' => 'dart_local_content_view.php',
'ui_context' => 'view',
'default_navigation_part' => 'ezcontentnavigationpart',
'params' => array( 'node_id' ),
'unordered_params' => array( 'dart_id' => 'dart_id' ) );

//*********** All items that deal with processing data ***********

$ViewList['process_dart_local_content'] = array(
'functions' => array( 'public' ),
'script' => 'process_dart_local_content.php',
'params' => array( 'node_id', 'corporate_id' ) );

$FunctionList['public'] = array();
$FunctionList['private'] = array();
$FunctionList['admin'] = array();
?>

The process file just processes the results of the view file and returns back to the view file, which works fine.

Now for module2/module.php:

<?php
$Module = array( 'name' => 'Module 2',
'variable_params' => true );
$ViewList = array();
$ViewList['update_list_item_locations'] = array(
'function' => array( 'public' ),
'script' => 'update_list_item_locations.php',
'ui_context' => 'administration',
'default_navigation_part' => 'ezcontentnavigationpart',
'params' => array( 'node_id' ) );
$FunctionList['public'] = array();
$FunctionList['private'] = array();
$FunctionList['admin'] = array();
?>

The primary difference in how I access the modules is that module1 has a node that directly links over to the module. Thus there is a 'view' phase before the 'process' steps. As for module2, there is no 'view' phase so an overloaded template provides the 'process'.

Hope this is somewhat clear, and thanks for the help so far,

-erik

Erik Weinmaster

Friday 12 February 2010 7:17:22 am

Bruce,

Also, here is the debug output that I'm getting when I try to access module2

Debug: eZMySQLDB::query(0.000 ms) query number per page:0 Feb 12 2010 10:13:43
SET NAMES 'utf8'
Timing: Feb 12 2010 10:13:43
Module start 'module2'
Error: error/view.php Feb 12 2010 10:13:43
Error ocurred using URI: /cccms/index.php/manage/module2/update_list_item_locations/8703
Warning: Insufficient permissions Feb 12 2010 10:13:43
Function required:
 Module : module2
 Function : 
 ClassID : 
 MainNodeID : 
Policies that didn't match:
Timing: Feb 12 2010 10:13:43
Module end 'error'

Erik Weinmaster

Wednesday 17 February 2010 10:11:46 am

In case anyone gets this far on the thread (which I doubt), the answer to this problem is a little concept called 'proof read.' The module2/module.php file that is shown above has the error. The 'function' index for 'update_list_item_locations' view array is wrong, it should be 'functions'.