diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index b8001f874d1..af0a25f11c9 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -143,7 +143,7 @@ CurrentInformationOnImage=This tool was designed to help you to resize or crop a ImageEditor=Image editor YouReceiveMailBecauseOfNotification=You receive this message because your email has been added to list of targets to be informed of particular events into %s software of %s. YouReceiveMailBecauseOfNotification2=This event is the following: -ThisIsListOfModules=This is list of standard modules preselected by this demo profile. Edit this to have a more personalized demo and click on "Start". +ThisIsListOfModules=This is a list of modules preselected by this demo profile (only most common modules are visible in this demo). Edit this to have a more personalized demo and click on "Start". ##### Bookmark ##### Bookmark=Bookmark diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index d06bb307593..b15dbb666ba 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -143,7 +143,7 @@ CurrentInformationOnImage=Cette page permet de redimensionner ou recadrer un ima ImageEditor=Editeur d'image YouReceiveMailBecauseOfNotification=Vous recevez ce message car votre email a été abonnée à certaines notifications automatiques pour vous informer d'évenements particuliers issus du logiciel %s de %s. YouReceiveMailBecauseOfNotification2=L'événement en question est le suivant: -ThisIsListOfModules=Voici la liste des modules standards présélectionnés par ce profil de démo. Affinez encore vos préférences et cliquez sur "Démarrer". +ThisIsListOfModules=Voici une liste de modules présélectionnés par ce profil de démo (seuls les plus courants sont accessibles dans cette demo). Affinez encore vos préférences et cliquez sur "Démarrer". ##### Bookmark ##### Bookmark=Marque-page diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index deb0be59704..12d2ee20069 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -60,45 +60,78 @@ $demoprofiles=array( 'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png'), ); -$alwaysdisabledmodules=array('memcached'); -//$alwaysdisabledmodules=array('boutique','clicktodial','externalsite','ftp','gravatar','ldap','memcached','webcalendar'); +$alwayscheckedmodules=array('barcode','bookmark','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want +$alwaysuncheckedmodules=array('paybox','filemanager'); // Module we never want +$alwayshiddenmodules=array('barcode','bookmark','boutique','clicktodial','externalrss','externalsite','fckeditor','ftp','geoipmaxmind','gravatar','ldap','memcached','notification','syslog','user','webcalendar','webservices'); -function llxHeaderVierge($title, $head = "") +// Search modules +$dirlist=$conf->file->dol_document_root; + +$filename = array(); +$modules = array(); +$orders = array(); +$categ = array(); +$dirmod = array(); +$i = 0; // is a sequencer of modules found +$j = 0; // j is module number. Automatically affeted if module number not defined. +foreach ($dirlist as $dirroot) { - global $user, $conf, $langs; + $dir = $dirroot . "/includes/modules/"; - header("Content-type: text/html; charset=".$conf->file->character_set_client); + // Charge tableaux modules, nom, numero, orders depuis r�pertoire dir + $handle=opendir($dir); + while (($file = readdir($handle))!==false) + { + //print "$i ".$file."\n
"; + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') + { + $modName = substr($file, 0, dol_strlen($file) - 10); + + if ($modName) + { + include_once($dir.$file); + $objMod = new $modName($db); + + if ($objMod->numero > 0) + { + $j = $objMod->numero; + } + else + { + $j = 1000 + $i; + } + + $modulequalified=1; + + // We discard modules that does not respect constraint on menu handlers + 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 discard modules according to features level (PS: if module is activated we always show it) + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); + if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; + if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; + + if ($modulequalified) + { + $modules[$i] = $objMod; + $filename[$i]= $modName; + $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module + //print "x".$modName." ".$orders[$i]."\n
"; + $categ[$objMod->special]++; // Array of all different modules categories + $dirmod[$i] = $dirroot; + $j++; + $i++; + } + } + } + } - print ''; - //print ''; - print "\n"; - print "\n"; - print "\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print "".$title."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - if ($head) print $head."\n"; - print ''; - print "\n"; - print ''."\n"; } -function llxFooterVierge() -{ - print "\n"; - print "\n"; - print "\n"; -} +asort($orders); +//var_dump($orders); /* @@ -121,16 +154,17 @@ if (GETPOST("action") == 'gotodemo') } } } - // If we disable modules using list - foreach($_POST as $key => $val) + // If we disable modules using personalized list + foreach($modules as $val) { - if ($val == '1') + $modulekeyname=strtolower($val->name); + if (empty($_POST[$modulekeyname]) && empty($val->always_enabled) && ! in_array($modulekeyname,$alwayscheckedmodules)) { - $disablestring.=$key.','; + $disablestring.=$modulekeyname.','; } } - + // Do redirect to login page if ($disablestring) { $url=DOL_URL_ROOT.'/index.php?disablemodules='.$disablestring; @@ -147,83 +181,13 @@ if (GETPOST("action") == 'gotodemo') llxHeaderVierge($langs->trans("DolibarrDemo")); - -// Search modules -$dirlist=$conf->file->dol_document_root; - -$filename = array(); -$modules = array(); -$orders = array(); -$categ = array(); -$dirmod = array(); -$i = 0; // is a sequencer of modules found -$j = 0; // j is module number. Automatically affeted if module number not defined. -foreach ($dirlist as $dirroot) -{ - $dir = $dirroot . "/includes/modules/"; - - // Charge tableaux modules, nom, numero, orders depuis r�pertoire dir - $handle=opendir($dir); - while (($file = readdir($handle))!==false) - { - //print "$i ".$file."\n
"; - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') - { - $modName = substr($file, 0, dol_strlen($file) - 10); - - if ($modName) - { - include_once($dir.$file); - $objMod = new $modName($db); - - if ($objMod->numero > 0) - { - $j = $objMod->numero; - } - else - { - $j = 1000 + $i; - } - - $modulequalified=1; - - // We discard modules that does not respect constraint on menu handlers - 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 discard modules according to features level (PS: if module is activated we always show it) - $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); - if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; - if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; - - if ($modulequalified) - { - $modules[$i] = $objMod; - $filename[$i]= $modName; - $orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module - //print "x".$modName." ".$orders[$i]."\n
"; - $categ[$objMod->special]++; // Array of all different modules categories - $dirmod[$i] = $dirroot; - $j++; - $i++; - } - } - } - } - -} - -asort($orders); -//var_dump($orders); - - ?> '; -print ''; -print ''; print "\n"; print ''; @@ -274,7 +234,9 @@ foreach ($demoprofiles as $profilarray) print ''; print ''; print ''; - print '
'."\n"; + print ''; + print ''; + print '
'."\n"; print ''; print ''; //print '
Demo '.$profilarray['label'].''; print ''; print $langs->trans("ThisIsListOfModules").'
'; - print ''; + print '
'; $listofdisabledmodules=explode(',',$profilarray['disablemodules']); $j=0;$nbcolsmod=4; foreach($modules as $val) // Loop on qualified (enabled) modules { $modulekeyname=strtolower($val->name); - $modulo=($j % $nbcolsmod); + + $modulequalified=1; + if (! empty($val->always_enabled) || in_array($modulekeyname,$alwayshiddenmodules)) $modulequalified=0; + if ($val->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; + if ($val->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; + if (! $modulequalified) continue; + + $modulo=($j % $nbcolsmod); if ($modulo == 0) print ''; print ''; if ($modulo == ($nbcolsmod - 1)) print ''; $j++; @@ -334,8 +303,6 @@ print ''; print '
always_enabled) || in_array($modulekeyname,$alwaysdisabledmodules)) print ' disabled="true"'; + if (in_array($modulekeyname,$alwaysuncheckedmodules)) print ' disabled="true"'; + if (! in_array($modulekeyname,$alwaysuncheckedmodules) && (! in_array($modulekeyname,$listofdisabledmodules) || in_array($modulekeyname,$alwayscheckedmodules))) print ' checked="true"'; print '>'.$val->getName().'  
'; -print ''; - $db->close(); // Google Adsense (ex: demo mode) @@ -357,4 +324,44 @@ if (! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN } llxFooterVierge('$Date$ - $Revision$'); + + + + +function llxHeaderVierge($title, $head = "") +{ + global $user, $conf, $langs; + + header("Content-type: text/html; charset=".$conf->file->character_set_client); + + print ''; + //print ''; + print "\n"; + print "\n"; + print "\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print "".$title."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + if ($head) print $head."\n"; + print ''; + print "\n"; + print ''."\n"; +} + +function llxFooterVierge() +{ + print "\n"; + print "\n"; + print "\n"; +} + ?>