Change to add possibility to have two root directory (for dev of modules)

This commit is contained in:
Laurent Destailleur 2008-03-09 23:14:08 +00:00
parent 920c059688
commit de16e35554
4 changed files with 63 additions and 51 deletions

View File

@ -103,7 +103,7 @@ if (-d "/usr/src/RPM") {
$RPMDIR="/usr/src/RPM"; $RPMDIR="/usr/src/RPM";
} }
$SOURCE="$DIR/../../dolibarr"; $SOURCE="$DIR/..";
$DESTI="$SOURCE/build"; $DESTI="$SOURCE/build";

View File

@ -161,63 +161,72 @@ llxHeader("","");
print_fiche_titre($langs->trans("ModulesSetup"),'','setup'); print_fiche_titre($langs->trans("ModulesSetup"),'','setup');
// Recherche les modules // Search modules
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/"; $dirlist=array();
$dirlist[]=DOL_DOCUMENT_ROOT;
if (defined('DOL_DOCUMENT_ROOT_BIS')) $dirlist[]=DOL_DOCUMENT_ROOT_BIS;
// Charge tableaux modules, nom, numero, orders depuis r<>pertoire dir
$handle=opendir($dir);
$filename = array(); $filename = array();
$modules = array(); $modules = array();
$orders = array(); $orders = array();
$categ = array(); $categ = array();
$i = 0; $dirmod = array();
$j = 0; foreach ($dirlist as $dirroot)
while (($file = readdir($handle))!==false)
{ {
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') $dir = $dirroot . "/includes/modules/";
{
$modName = substr($file, 0, strlen($file) - 10);
if ($modName) // Charge tableaux modules, nom, numero, orders depuis r<>pertoire dir
{ $handle=opendir($dir);
include_once($dir.$file); $i = 0;
$objMod = new $modName($db); $j = 0;
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, strlen($file) - 10);
if ($objMod->numero > 0) if ($modName)
{ {
$j = $objMod->numero; include_once($dir.$file);
} $objMod = new $modName($db);
else
{
$j = 1000 + $i;
}
$modulequalified=1; if ($objMod->numero > 0)
{
$j = $objMod->numero;
}
else
{
$j = 1000 + $i;
}
// We discard modules that does not respect constraint on menu handlers $modulequalified=1;
if ($objMod->needleftmenu && sizeof($objMod->needleftmenu) && ! in_array($conf->left_menu,$objMod->needleftmenu)) $modulequalified=0;
if ($objMod->needtopmenu && sizeof($objMod->needtopmenu) && ! in_array($conf->top_menu,$objMod->needtopmenu)) $modulequalified=0;
// We dsicard modules according to features level (if active we always show them) // We discard modules that does not respect constraint on menu handlers
$const_name = $objMod->const_name; if ($objMod->needleftmenu && sizeof($objMod->needleftmenu) && ! in_array($conf->left_menu,$objMod->needleftmenu)) $modulequalified=0;
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; if ($objMod->needtopmenu && sizeof($objMod->needtopmenu) && ! in_array($conf->top_menu,$objMod->needtopmenu)) $modulequalified=0;
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
if ($modulequalified) // We dsicard modules according to features level (if active we always show them)
{ $const_name = $objMod->const_name;
$modules[$i] = $objMod; if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
$filename[$i]= $modName; if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
$orders[$i] = "$objMod->family"."_".$j; // Tri par famille puis numero module
$categ[$objMod->special]++; // Array of all different modules categories if ($modulequalified)
$j++; {
$i++; $modules[$i] = $objMod;
} $filename[$i]= $modName;
} $orders[$i] = "$objMod->family"."_".$j; // Tri par famille puis numero module
} $categ[$objMod->special]++; // Array of all different modules categories
$dirmod[$i] = $dirroot;
$j++;
$i++;
}
}
}
}
} }
asort($orders);
asort($orders);
// Affichage debut page // Affichage debut page
@ -368,15 +377,16 @@ foreach ($orders as $key => $value)
$i=0; $i=0;
foreach ($objMod->config_page_url as $page) foreach ($objMod->config_page_url as $page)
{ {
$urlpage=$page;
if ($i++) if ($i++)
{ {
print '<a href="'.$page.'" alt="'.$langs->trans($page).'">'.img_picto(ucfirst($page),"setup").'</a>&nbsp;'; print '<a href="'.$urlpage.'" alt="'.$langs->trans($page).'">'.img_picto(ucfirst($page),"setup").'</a>&nbsp;';
// print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;'; // print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
} }
else else
{ {
//print '<a href="'.$page.'">'.$langs->trans("Setup").'</a>&nbsp;'; //print '<a href="'.$page.'">'.$langs->trans("Setup").'</a>&nbsp;';
print '<a href="'.$page.'" alt="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>&nbsp;'; print '<a href="'.$urlpage.'" alt="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>&nbsp;';
} }
} }
print "</td>\n"; print "</td>\n";

View File

@ -16,18 +16,17 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/admin/pre.inc.php \file htdocs/admin/pre.inc.php
\brief Fichier gestionnaire du menu de gauche de l'espace configuration \brief Fichier gestionnaire du menu de gauche de l'espace configuration
\version $Revision$ \version $Id$
*/ */
require("../main.inc.php"); $res=@include("../main.inc.php");
if (! $res) include("../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only
$langs->load("admin"); $langs->load("admin");

View File

@ -78,7 +78,7 @@ if (! isset($dolibarr_main_db_type))
{ {
$dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql' $dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql'
} }
if (! $dolibarr_main_data_root) { if (empty($dolibarr_main_data_root)) {
// Si repertoire documents non defini, on utilise celui par defaut // Si repertoire documents non defini, on utilise celui par defaut
$dolibarr_main_data_root=ereg_replace("/htdocs","",$dolibarr_main_document_root); $dolibarr_main_data_root=ereg_replace("/htdocs","",$dolibarr_main_document_root);
$dolibarr_main_data_root.="/documents"; $dolibarr_main_data_root.="/documents";
@ -91,6 +91,9 @@ $pos = strstr ($uri, '/'); // $pos contient alors url sans nom domaine
if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a '' if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a ''
define('DOL_URL_ROOT', $pos); // URL racine relative define('DOL_URL_ROOT', $pos); // URL racine relative
// Special code for alternate dev directories (Used on dev env only)
if (! empty($dolibarr_main_document_root_bis)) define('DOL_DOCUMENT_ROOT_BIS', $dolibarr_main_document_root_bis);
/* /*
* Controle validite fichier conf * Controle validite fichier conf