Modif doxygen pour preparer ajout entree menu depuis module

This commit is contained in:
Laurent Destailleur 2007-05-27 03:55:11 +00:00
parent add074c913
commit e1c27d54a6
7 changed files with 137 additions and 72 deletions

View File

@ -497,28 +497,55 @@ class Form
*/
function select_menu($selected='',$htmlname,$dirmenu)
{
global $langs;
global $langs,$conf;
if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // Pour compatibilité
print '<select class="flat" name="'.$htmlname.'">';
$menuarray=array();
$handle=opendir($dirmenu);
while (($file = readdir($handle))!==false)
{
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$filelib=eregi_replace('\.php$','',$file);
$prefix='';
if (eregi('^eldy',$file)) $prefix='0'; // Recommanded
else if (eregi('^default',$file)) $prefix='2'; // Other
else if (eregi('^empty',$file)) $prefix='2'; // Other
else $prefix='1'; // Experimental
if ($file == $selected)
{
print '<option value="'.$file.'" selected="true">'.$filelib.'</option>';
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="true">'.$filelib.'</option>';
}
else
{
print '<option value="'.$file.'">'.$filelib.'</option>';
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
}
}
}
print '</select>';
ksort($menuarray);
// Affichage liste deroulante des menus
print '<select class="flat" name="'.$htmlname.'">';
$oldprefix='';
foreach ($menuarray as $key => $val)
{
$tab=split('_',$key);
$newprefix=$tab[0];
if ($conf->browser->firefox && $newprefix != $oldprefix)
{
// Affiche titre
print '<option value="-1" disabled="disabled">';
if ($newprefix=='0') print '-- '.$langs->trans("VersionRecommanded").' --';
if ($newprefix=='1') print '-- '.$langs->trans("VersionExperimental").' --';
if ($newprefix=='2') print '-- '.$langs->trans("Other").' --';
print '</option>';
$oldprefix=$newprefix;
}
print $val."\n";
}
print '</select>';
}
/**

View File

@ -325,7 +325,25 @@ class MenuTop {
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/oscommerce_ws/index.php?mainmenu=shop&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("OSCommerce").'</a></td>';
}
// Webcal
// Members
if ($conf->adherent->enabled)
{
$langs->load("members");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members")
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
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");
@ -364,24 +382,6 @@ class MenuTop {
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>';
}
// Members
if ($conf->adherent->enabled)
{
$langs->load("members");
$class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members")
{
$class='class="tmenu" id="sel"';
}
else
{
$class = 'class="tmenu"';
}
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>';
}
print '</tr></table>';

View File

@ -239,47 +239,7 @@ class MenuTop {
print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/index.php?mainmenu=tools&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Tools").'</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>';
}
// 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>';
}
// Telephonie
// Telephonie
if ($conf->telephonie->enabled && $user->rights->telephonie->lire)
{
$class="";
@ -330,6 +290,47 @@ 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>';
}
// 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>';
}
print '</tr></table>';
}

View File

@ -74,11 +74,11 @@ class modWebcalendar extends DolibarrModules
// Data directories to create when module is enabled
$this->dirs = array();
// Config pages
// Config pages. Put here list of php page names stored in admmin directory used to setup module
$this->config_page_url = array("webcalendar.php");
// Dependencies
$this->depends = array(); // List of modules id that must be enabled
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
// Constants
@ -86,22 +86,57 @@ class modWebcalendar extends DolibarrModules
// Boxes
$this->boxes = array(); // List of boxes
$r=0;
// Add here list of default box name and php file stored in includes/boxes that
// contains class to show a box.
// Example:
//$this->boxes[$r][0] = "My box";
//$this->boxes[$r][1] = "mybox.php";
//$r++;
// Permissions
$this->rights_class = 'webcal'; // Permission key
$this->rights = array(); // Permission array used by this module
// Example
// 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 = 'webcal'; // Permission key
$this->rights = array(); // Permission array used by this module
// Main menu entries
$this->menus = array(); // List of menus to add
$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
}
/**
* \brief Function called when module is enabled.
* Add constants, boxes and permissions into Dolibarr database.
* The init function add previous constants, boxes and permissions into Dolibarr database.
* It also creates data directories.
*/
function init()

View File

@ -3,6 +3,7 @@ Version=Version
VersionExperimental=Experimental
VersionDevelopment=Development
VersionUnknown=Unknown
VersionRecommanded=Recommanded
WarningModuleNotActive=Module <b>%s</b> must be enabled
DolibarrSetup=Dolibarr setup
DolibarrUser=Dolibarr user

View File

@ -3,6 +3,7 @@ Version=Version
VersionExperimental=Expérimental
VersionDevelopment=Développement
VersionUnknown=Inconnue
VersionRecommanded=Recommandé
WarningModuleNotActive=Module <b>%s</b> non actif
DolibarrSetup=Installation de Dolibarr
DolibarrUser=Utilisateur Dolibarr

View File

@ -31,7 +31,7 @@ CREATE TABLE `llx_menu` (
`fk_menu` int(11) NOT NULL, -- 0 or Id of mother menu line
`order` tinyint(4) NOT NULL, -- Order of entry
`url` varchar(255) NOT NULL, -- Url to go
`url` varchar(255) NOT NULL, -- Relative (or absolute) url to go
`target` varchar(100) NULL, -- Target of Url link
`titre` varchar(255) NOT NULL, -- Key for menu translation
@ -41,6 +41,6 @@ CREATE TABLE `llx_menu` (
`leftmenu` varchar(100) NULL, -- Condition to show or hide
`right` varchar(255), -- Condition to show enabled or disabled
`user` tinyint(4) NOT NULL default '0', -- 0 if menu for all users
`user` tinyint(4) NOT NULL default '0', -- 0 if menu for all users, 1 for external only, 2 for internal only
PRIMARY KEY (`rowid`)
) type=innodb;