2
0
forked from Wavyzz/dolibarr

New: Ajout du module source dans menus. Ceci permettra aux modules d'ajouter leurs propres entrees aux menus.

This commit is contained in:
Laurent Destailleur
2008-01-14 01:47:06 +00:00
parent 4e7962c6c6
commit 6eb567cdb1
3 changed files with 11 additions and 13 deletions

View File

@@ -51,6 +51,8 @@ class modMyModule extends DolibarrModules
// Id for module (must be unique). // Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used module id). // Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
$this->numero = 10000; $this->numero = 10000;
// Key text used to identify module (for permission, menus, etc...)
$this->rights_class = 'mymodule';
// Family can be 'crm','financial','hr','projects','product','technic','other' // Family can be 'crm','financial','hr','projects','product','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
@@ -73,7 +75,7 @@ class modMyModule extends DolibarrModules
$this->dirs = array(); $this->dirs = array();
// Config pages. Put here list of php page names stored in admmin directory used to setup module // Config pages. Put here list of php page names stored in admmin directory used to setup module
$this->config_page_url = array("webcalendar.php"); $this->config_page_url = array("mymodulesetuppage.php");
// Dependencies // Dependencies
$this->depends = array(); // List of modules id that must be enabled if this module is enabled $this->depends = array(); // List of modules id that must be enabled if this module is enabled
@@ -94,7 +96,6 @@ class modMyModule extends DolibarrModules
//$r++; //$r++;
// Permissions // Permissions
$this->rights_class = 'webcal'; // Permission key
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
// Add here list of permission defined by an id, a label, a boolean and two constant strings. // Add here list of permission defined by an id, a label, a boolean and two constant strings.
@@ -106,26 +107,20 @@ class modMyModule extends DolibarrModules
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights_class = 'webcal'; // Permission key
$this->rights = array(); // Permission array used by this module
// Main menu entries // Main menu entries
$this->menus = array(); // List of menus to add $this->menus = array(); // List of menus to add
$r=0; $r=0;
// Example: // Example:
// $r++; // $r++;
// insert into `llx_menu` (
// menu_handler 'all' // Menu handler name (all to add with all menu handlers)
// type 'top' // Menu top or left // type 'top' // Menu top or left
// `mainmenu`, 'webcal' // Name family/module (home, companies, ...) // `mainmenu`, 'mymodule' // Name family/module (home, companies, ...)
// `fk_menu`, 0 // 0 or Id of mother menu line // `fk_menu`, 0 // 0 or Id of mother menu line
// `order` 10 // Order of entry // `position` 100 // Order of entry
// `url`, '/webcal/webcal.php?mainmenu=webcal&leftmenu=' // Relative (or absolute) url to go // `url`, '/myurl' // Relative (or absolute) url to go
// `target`, '' // Target of Url link // `target`, '' // Target of Url link
// `titre`, 'Calendar' // Key for menu translation // `titre`, 'MyMenu' // Key for menu translation
// `langs`, other // Lang file to load for translation // `langs`, 'other' // Lang file to load for translation
// `level`, -1 // deprecated
// `leftmenu`, '' // Condition to compare to $_REQUEST["leftmenu"] to show or hide menu entry // `leftmenu`, '' // Condition to compare to $_REQUEST["leftmenu"] to show or hide menu entry
// `right`, '' // Condition to show enabled or disabled menu entry // `right`, '' // Condition to show enabled or disabled menu entry
// `user`, 0 // 0 if menu for all users, 1 for external only, 2 for internal only // `user`, 0 // 0 if menu for all users, 1 for external only, 2 for internal only

View File

@@ -34,4 +34,5 @@ ALTER TABLE llx_menu_const ADD CONSTRAINT fk_menu_const_fk_menu FOREIGN KEY (fk_
alter table llx_menu modify user integer NOT NULL default '0'; alter table llx_menu modify user integer NOT NULL default '0';
alter table llx_menu change `order` position integer NOT NULL; alter table llx_menu change `order` position integer NOT NULL;
alter table llx_menu change `right` perms varchar(255); alter table llx_menu change `right` perms varchar(255);
alter table llx_menu add column module varchar(64) after menu_handler;
alter table llx_menu add column tms timestamp; alter table llx_menu add column tms timestamp;

View File

@@ -24,6 +24,7 @@ CREATE TABLE `llx_menu` (
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
menu_handler varchar(16) NOT NULL, -- Menu handler name menu_handler varchar(16) NOT NULL, -- Menu handler name
module varchar(64), -- Module name if record is added by a module
type enum('top','left') NOT NULL, -- Menu top or left type enum('top','left') NOT NULL, -- Menu top or left
mainmenu varchar(100) NOT NULL, -- Name family/module (home, companies, ...) mainmenu varchar(100) NOT NULL, -- Name family/module (home, companies, ...)
@@ -41,5 +42,6 @@ CREATE TABLE `llx_menu` (
leftmenu varchar(100) NULL, -- Condition to show or hide leftmenu varchar(100) NULL, -- Condition to show or hide
perms varchar(255), -- Condition to show enabled or disabled perms varchar(255), -- Condition to show enabled or disabled
user integer NOT NULL default '0', -- 0 if menu for all users, 1 for external only, 2 for internal only user integer NOT NULL default '0', -- 0 if menu for all users, 1 for external only, 2 for internal only
tms timestamp tms timestamp
) type=innodb; ) type=innodb;