New: External modules can force skin directory

This commit is contained in:
Laurent Destailleur 2011-03-26 12:51:48 +00:00
parent 82d15ea8ae
commit 900ed92e3a
6 changed files with 20 additions and 8 deletions

View File

@ -31,6 +31,7 @@ For users:
- Fix: Better Postgresql compatibility.
For developers:
- New: External modules can force skin directory so force their own skins.
- New: External modules can add their own menu manager.
- New: External modules can remove tabs.
- New: External modules can force menu manager.

View File

@ -44,8 +44,6 @@ if (!$user->admin)
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
$dirtheme = "../theme";
// List of supported permanent search area
$searchform=array( "MAIN_SEARCHFORM_SOCIETE","MAIN_SEARCHFORM_CONTACT",
"MAIN_SEARCHFORM_PRODUITSERVICE","MAIN_SEARCHFORM_ADHERENT");

View File

@ -297,6 +297,7 @@ DescWeather=The following pictures will be shown on dashboard when number of lat
KeyForWebServicesAccess=Key to use Web Services (parameter "dolibarrkey" in webservices)
TestSubmitForm=Input test form
ThisForceAlsoTheme=Using this menu manager will also use its own theme whatever is user choice. Also this menu manager specialized for smartphones does not works on all smartphone. Use another menu manager if you epxerience problems on yours.
ThemeDir=Skins directory
# Modules
Module0Name=Users & groups

View File

@ -298,6 +298,7 @@ DescWeather=Les graphiques suivant seront affichées sur le tableau de bord si l
KeyForWebServicesAccess=Clé pour utiliser les Web Services (paramètre "dolibarrkey" dans les webservices)
TestSubmitForm=Formulaire de test de saisie
ThisForceAlsoTheme=Utiliser ce gestionnaire de menu force aussi le theme quelquesoit le choix de theme de l'utilisateur. De plus, ce gestionnaire de menu, spécialisé pour smartphone, ne fonctionne que sur certains téléphones. Utiliser un autre gestionnaire si vous constatez des problèmes.
ThemeDir=Répertoire des thèmes
# Modules= undefined
Module0Name= Utilisateurs & groupes

View File

@ -149,9 +149,12 @@ function group_prepare_head($object)
*/
function show_theme($fuser,$edit=0,$foruserprofile=false)
{
global $conf,$langs,$dirtheme,$bc;
global $conf,$langs,$bc;
$dirtheme=dol_buildpath($conf->global->MAIN_FORCETHEMEDIR.'/theme',0);
$urltheme=dol_buildpath($conf->global->MAIN_FORCETHEMEDIR.'/theme',1);
$selected_theme=$conf->global->MAIN_THEME;
if (! empty($fuser)) $selected_theme=$fuser->conf->MAIN_THEME;
@ -170,7 +173,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
}
else
{
print '<tr class="liste_titre"><td>'.$langs->trans("DefaultSkin").'</td>';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("DefaultSkin").'</td>';
print '<td align="right">';
$url='http://www.dolistore.com/lang-en/4-skins';
if (preg_match('/fr/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-fr/4-themes';
@ -192,6 +195,14 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '</tr>';
}
if (! $foruserprofile)
{
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ThemeDir").'</td>';
print '<td'.($foruserprofile?' colspan="3"':'').'>'.$dirtheme.'</td>';
print '</tr>';
}
if ($edit)
{
if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
@ -219,12 +230,13 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '<td align="center">';
$file=$dirtheme."/".$subdir."/thumb.png";
if (! file_exists($file)) $file=$dirtheme."/common/nophoto.jpg";
$url=$urltheme."/".$subdir."/thumb.png";
if (! file_exists($file)) $url=$urltheme."/common/nophoto.jpg";
print '<table><tr><td>';
print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(! empty($_GET["optioncss"])?'&optioncss='.$_GET["optioncss"]:'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
else $title=$langs->trans("ShowPreview");
print '<img src="'.$file.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'">';
print '<img src="'.$url.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'">';
print '</a>';
print '</td></tr><tr><td align="center">';
if ($subdir == $selected_theme)

View File

@ -60,7 +60,6 @@ if ($user->id <> $_REQUEST["id"] && ! $canreaduser) accessforbidden();
$id=! empty($_GET["id"])?$_GET["id"]:$_POST["id"];
$dirtop = "../includes/menus/standard";
$dirleft = "../includes/menus/standard";
$dirtheme = "../theme";
// Charge utilisateur edite
$fuser = new User($db);