New: L'entre de menu des modules phenix, webcalendar et mantis sont embarques avec le module.

This commit is contained in:
Laurent Destailleur 2008-01-17 21:25:46 +00:00
parent 574ab4601a
commit fe71b83b4b
11 changed files with 63 additions and 258 deletions

View File

@ -175,7 +175,7 @@ $varprop="\n";
$cleanparam='';
foreach($property as $key => $prop)
{
if (! $prop['istime'])
if ($prop['field'] != 'rowid' && ! $prop['istime'])
{
$varprop.="\t\t\$this->".$prop['field']."=trim(\$this->".$prop['field'].");";
$varprop.="\n";

View File

@ -361,65 +361,7 @@ class MenuTop {
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Members").'</a></td>';
}
// Webcal
if ($conf->webcal->enabled)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "webcal")
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/webcal/webcal.php?mainmenu=webcal&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").'</a></td>';
}
// Phenix
if ($conf->phenix->enabled)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "phenix")
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/phenix/phenix.php?mainmenu=phenix&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").'</a></td>';
}
// Mantis
if ($conf->mantis->enabled)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mantis")
{
$class='class="tmenu" id="sel"';
}
elseif (ereg("^".DOL_URL_ROOT.".*\/mantis",$_SERVER["PHP_SELF"]) || ereg("^".DOL_URL_ROOT."\/mantis\/",$_SERVER["PHP_SELF"]))
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/mantis/mantis.php?mainmenu=mantis"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("BugTracker").'</a></td>';
}
// Affichage des menus personnalises
require_once(DOL_DOCUMENT_ROOT."/lib/menubase.class.php");

View File

@ -307,65 +307,7 @@ class MenuTop {
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Members").'</a></td>';
}
// Webcal
if ($conf->webcal->enabled)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "webcal")
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
// print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/webcal/webcal.php?mainmenu=webcal&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").'</a></td>';
}
// Phenix
if ($conf->phenix->enabled)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "phenix")
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
// print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/phenix/phenix.php?mainmenu=phenix&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").'</a></td>';
}
// Mantis
if ($conf->mantis->enabled)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mantis")
{
$class='class="tmenu" id="sel"';
}
elseif (ereg("^".DOL_URL_ROOT.".*\/mantis",$_SERVER["PHP_SELF"]) || ereg("^".DOL_URL_ROOT."\/mantis\/",$_SERVER["PHP_SELF"]))
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/mantis/mantis.php?mainmenu=mantis"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("BugTracker").'</a></td>';
}
// Affichage des menus personnalises
require_once(DOL_DOCUMENT_ROOT."/lib/menubase.class.php");

View File

@ -300,72 +300,6 @@ class MenuTop {
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/oscommerce_ws/index.php?mainmenu=oscommerce2"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("OSCommerce").'</a></td>';
}
// Webcal
if ($conf->webcal->enabled)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "webcalendar")
{
$class='class="tmenu" id="sel"';
}
elseif (ereg("^".DOL_URL_ROOT.".*\/webcal",$_SERVER["PHP_SELF"]) || ereg("^".DOL_URL_ROOT."\/webcalendar\/",$_SERVER["PHP_SELF"]))
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/webcal/webcal.php?mainmenu=webcal"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").'</a></td>';
}
// Phenix
if ($conf->phenix->enabled)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "phenix")
{
$class='class="tmenu" id="sel"';
}
elseif (ereg("^".DOL_URL_ROOT.".*\/phenix",$_SERVER["PHP_SELF"]))
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/phenix/phenix.php?mainmenu=phenix"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Calendar").'</a></td>';
}
// Mantis
if ($conf->mantis->enabled)
{
$langs->load("other");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mantis")
{
$class='class="tmenu" id="sel"';
}
elseif (ereg("^".DOL_URL_ROOT.".*\/mantis",$_SERVER["PHP_SELF"]) || ereg("^".DOL_URL_ROOT."\/mantis\/",$_SERVER["PHP_SELF"]))
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/mantis/mantis.php?mainmenu=mantis"'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("BugTracker").'</a></td>';
}
// Affichage des menus personnalises
require_once(DOL_DOCUMENT_ROOT."/lib/menubase.class.php");

View File

@ -25,10 +25,7 @@ insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`,
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 10, 'energy', '', 0, '/energie/index.php?mainmenu=energy&amp;leftmenu=', 'Energy', -1, 'energy', '', '', 2, 10);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 11, 'shop', '', 0, '/boutique/index.php?mainmenu=shop&amp;leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 11);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 12, 'shop', '', 0, '/oscommerce_ws/index.php?mainmenu=shop&amp;leftmenu=', 'OSCommerce', -1, 'shop', '', '', 0, 12);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 13, 'webcal', '', 0, '/webcal/webcal.php?mainmenu=webcal&amp;leftmenu=', 'Calendar', -1, 'other', '', '', 0, 13);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 14, 'mantis', '', 0, '/mantis/mantis.php?mainmenu=mantis', 'BugTracker', -1, 'other', '', '', 2, 14);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 15, 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '', '', 2, 15);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'top', 16, 'phenix', '', 0, '/phenix/phenix.php?mainmenu=phenix&amp;leftmenu=', 'Calendar', -1, 'other', '', '', 0, 16);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 100, 'home', '', 1, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 101, 'home', '$leftmenu=="setup"', 100, '/admin/company.php', 'MenuCompanySetup', 1, 'admin', '', '', 2, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 102, 'home', '$leftmenu=="setup"', 100, '/admin/ihm.php', 'GUISetup', 1, 'admin', '', '', 2, 1);

View File

@ -405,8 +405,8 @@ class DolibarrModules
foreach ($this->boxes as $key => $value)
{
//$titre = $this->boxes[$key][0];
$file = $this->boxes[$key][1];
$note = $this->boxes[$key][2];
$file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:'';
$note = isset($this->boxes[$key][2])?$this->boxes[$key][2]:'';
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."boxes_def";
$sql.= " WHERE file ='".$file."'";

View File

@ -86,13 +86,14 @@ class modMantis extends DolibarrModules
// Permissions
$this->rights_class = 'mantis'; // Permission key
$this->rights = array(); // Permission array used by this module
// Example
// $r++;
// $this->rights[$r][0] = 1200; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1)
// $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)
// Menus
//------
$r=0;
$this->menu[$r]=array('fk_menu'=>0,'type'=>'top','titre'=>'BugTracker','mainmenu'=>'mantis','leftmenu'=>'','url'=>'/mantis/mantis.php','langs'=>'other','position'=>100,'perms'=>'','target'=>'','user'=>0);
$r++;
}
/**

View File

@ -92,42 +92,15 @@ class modPhenix extends DolibarrModules
//$r++;
// Permissions
$this->rights_class = 'webcal'; // Permission key
$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.
// Example:
// $r++;
// $this->rights[$r][0] = 2000; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1)
// $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_class = 'phenix'; // Permission key
$this->rights = array(); // Permission array used by this module
// Main menu entries
$this->menus = array(); // List of menus to add
// Menus
//------
$r=0;
// Example:
// $r++;
// insert into `llx_menu` (
// menu_handler 'all' // Menu handler name (all to add with all menu handlers)
// type 'top' // Menu top or left
// `mainmenu`, 'webcal' // Name family/module (home, companies, ...)
// `fk_menu`, 0 // 0 or Id of mother menu line
// `order` 10 // Order of entry
// `url`, '/webcal/webcal.php?mainmenu=webcal&amp;leftmenu=' // Relative (or absolute) url to go
// `target`, '' // Target of Url link
// `titre`, 'Calendar' // Key for menu 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
// `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
$this->menu[$r]=array('fk_menu'=>0,'type'=>'top','titre'=>'Calendar','mainmenu'=>'phenix','leftmenu'=>'','url'=>'/phenix/phenix.php','langs'=>'other','position'=>100,'perms'=>'','target'=>'','user'=>0);
$r++;
}
/**

View File

@ -96,19 +96,13 @@ class modWebcalendar extends DolibarrModules
$this->rights_class = 'webcal'; // Permission key
$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.
// Example:
// $r++;
// $this->rights[$r][0] = 2000; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1)
// $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)
// Main menu entries
$this->menus = array(); // List of menus to add
// Menus
//------
$r=0;
$this->menu[$r]=array('fk_menu'=>0,'type'=>'top','titre'=>'Calendar','mainmenu'=>'webcal','leftmenu'=>'','url'=>'/webcal/webcal.php','langs'=>'other','position'=>100,'perms'=>'','target'=>'','user'=>0);
$r++;
}
/**

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -137,24 +137,25 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade')
$db->begin();
// Chaque action de migration doit renvoyer une ligne sur 4 colonnes avec
// dans la 1ere colonne, la description de l'action a faire
// dans la 4eme colonne, le texte 'OK' si fait ou 'AlreadyDone' si rien n'est fait ou 'Error'
// Chaque action de migration doit renvoyer une ligne sur 4 colonnes avec
// dans la 1ere colonne, la description de l'action a faire
// dans la 4eme colonne, le texte 'OK' si fait ou 'AlreadyDone' si rien n'est fait ou 'Error'
// Script pour V2 -> V2.1
migrate_paiements($db,$langs,$conf);
migrate_paiements($db,$langs,$conf);
migrate_contracts_det($db,$langs,$conf);
migrate_contracts_det($db,$langs,$conf);
migrate_contracts_date1($db,$langs,$conf);
migrate_contracts_date1($db,$langs,$conf);
migrate_contracts_date2($db,$langs,$conf);
migrate_contracts_date2($db,$langs,$conf);
migrate_contracts_date3($db,$langs,$conf);
migrate_contracts_date3($db,$langs,$conf);
migrate_contracts_open($db,$langs,$conf);
migrate_contracts_open($db,$langs,$conf);
migrate_modeles($db,$langs,$conf);
migrate_modeles($db,$langs,$conf);
migrate_price_propal($db,$langs,$conf);
@ -164,8 +165,9 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade')
migrate_price_contrat($db,$langs,$conf);
migrate_paiementfourn_facturefourn($db,$langs,$conf);
migrate_paiementfourn_facturefourn($db,$langs,$conf);
// Script pour V2.1 -> V2.2
migrate_paiements_orphelins_1($db,$langs,$conf);
@ -175,14 +177,17 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade')
migrate_delete_old_files($db,$langs,$conf);
// Script pour V2.2 -> V2.4
migrate_commande_expedition($db,$langs,$conf);
// On commit dans tous les cas.
// La procedure etant concue pour pouvoir passer plusieurs fois quelquesoit la situation.
$db->commit();
$db->close();
migrate_module_menus($db,$langs,$conf);
// On commit dans tous les cas.
// La procedure etant concue pour pouvoir passer plusieurs fois quelquesoit la situation.
$db->commit();
$db->close();
}
print '</table>';
@ -1450,12 +1455,30 @@ function migrate_delete_old_files($db,$langs,$conf)
*/
function migrate_module_menus($db,$langs,$conf)
{
if ($conf->global->MAIN_MODULE_AGENDA)
if (! empty($conf->global->MAIN_MODULE_AGENDA))
{
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modAgenda.class.php');
$mod=new modAgenda($db);
$mod->init();
}
if (! empty($conf->global->MAIN_MODULE_PHENIX))
{
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modPhenix.class.php');
$mod=new modPhenix($db);
$mod->init();
}
if (! empty($conf->global->MAIN_MODULE_WEBCALENDAR))
{
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modWebcalendar.class.php');
$mod=new modWebcalendar($db);
$mod->init();
}
if (! empty($conf->global->MAIN_MODULE_MANTIS))
{
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modMantis.class.php');
$mod=new modMantis($db);
$mod->init();
}
}
/*

View File

@ -78,7 +78,6 @@ class Menubase
global $conf, $langs;
// Clean parameters
$this->rowid=trim($this->rowid);
$this->menu_handler=trim($this->menu_handler);
$this->module=trim($this->module);
$this->type=trim($this->type);