New: parametre de config des repertoires dans les proprietes de la classe du module

avec un répertoire parent en fonction de l'entité
This commit is contained in:
Regis Houssin 2009-04-28 21:18:28 +00:00
parent 13e9ff24a7
commit 119604703a
4 changed files with 16 additions and 11 deletions

View File

@ -146,9 +146,6 @@ class Conf
// Load translation object with current language // Load translation object with current language
if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US"; if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US";
// Other global parameters
$this->users->dir_output=DOL_DATA_ROOT."/users";
// For backward compatibility // For backward compatibility
$this->comptaexpert->enabled=defined("MAIN_MODULE_COMPTABILITE_EXPERT")?MAIN_MODULE_COMPTABILITE_EXPERT:0; $this->comptaexpert->enabled=defined("MAIN_MODULE_COMPTABILITE_EXPERT")?MAIN_MODULE_COMPTABILITE_EXPERT:0;
$this->compta->enabled=defined("MAIN_MODULE_COMPTABILITE")?MAIN_MODULE_COMPTABILITE:0; $this->compta->enabled=defined("MAIN_MODULE_COMPTABILITE")?MAIN_MODULE_COMPTABILITE:0;

View File

@ -62,8 +62,16 @@ class modUser extends DolibarrModules
$this->special = 0; $this->special = 0;
$this->picto='group'; $this->picto='group';
// Dir // Data directories to create when module is enabled
$this->dirs = array(); $this->dirs = array();
$r=0;
$this->dirs[$r][0] = "output";
$this->dirs[$r][1] = "/users";
$r++;
$this->dirs[$r][0] = "temp";
$this->dirs[$r][1] = "/users/temp";
// Config pages // Config pages
// $this->config_page_url = array("/user/admin/index.php"); // $this->config_page_url = array("/user/admin/index.php");

View File

@ -272,13 +272,13 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $caneditfield)
if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name']))
{ {
// If photo is provided // If photo is provided
if (! is_dir($conf->users->dir_output)) if (! is_dir($conf->user->dir_output))
{ {
create_exdir($conf->users->dir_output); create_exdir($conf->user->dir_output);
} }
if (is_dir($conf->users->dir_output)) if (is_dir($conf->user->dir_output))
{ {
$newfile=$conf->users->dir_output . "/" . $edituser->id . ".jpg"; $newfile=$conf->user->dir_output . "/" . $edituser->id . ".jpg";
if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1) > 0) if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1) > 0)
{ {
$message .= '<div class="error">'.$langs->trans("ErrorFailedToSaveFile").'</div>'; $message .= '<div class="error">'.$langs->trans("ErrorFailedToSaveFile").'</div>';
@ -839,7 +839,7 @@ else
print '<td width="50%">'.$fuser->login.'</td>'; print '<td width="50%">'.$fuser->login.'</td>';
} }
print '<td align="center" valign="middle" width="25%" rowspan="'.$rowspan.'">'; print '<td align="center" valign="middle" width="25%" rowspan="'.$rowspan.'">';
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) if (file_exists($conf->user->dir_output."/".$fuser->id.".jpg"))
{ {
print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">'; print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">';
} }
@ -1245,7 +1245,7 @@ else
} }
print '</td>'; print '</td>';
print '<td align="center" valign="middle" width="25%" rowspan="'.$rowspan.'">'; print '<td align="center" valign="middle" width="25%" rowspan="'.$rowspan.'">';
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) if (file_exists($conf->user->dir_output."/".$fuser->id.".jpg"))
{ {
print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">'; print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">';
} }

View File

@ -81,7 +81,7 @@ if ($modulepart)
elseif ($modulepart == 'userphoto') elseif ($modulepart == 'userphoto')
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->users->dir_output.'/'.$original_file; $original_file=$conf->user->dir_output.'/'.$original_file;
} }
// Wrapping pour les photos adherents // Wrapping pour les photos adherents