New: Ajout module ECM

This commit is contained in:
Laurent Destailleur 2008-02-19 21:04:23 +00:00
parent 1042bcfb44
commit 8dfcdf8632
25 changed files with 733 additions and 98 deletions

View File

@ -53,7 +53,7 @@ class modMyModule extends DolibarrModules
// Key text used to identify module (for permission, menus, etc...) // Key text used to identify module (for permission, menus, etc...)
$this->rights_class = 'mymodule'; $this->rights_class = 'mymodule';
// Family can be 'crm','financial','hr','projects','product','technic','other' // Family can be 'crm','financial','hr','projects','product','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "projects"; $this->family = "projects";
// Module title used if translation string 'ModuleXXXName' not found (XXX is value MyModule) // Module title used if translation string 'ModuleXXXName' not found (XXX is value MyModule)

View File

@ -294,9 +294,10 @@ $familylib=array(
'products'=>$langs->trans("ModuleFamilyProducts"), 'products'=>$langs->trans("ModuleFamilyProducts"),
'hr'=>$langs->trans("ModuleFamilyHr"), 'hr'=>$langs->trans("ModuleFamilyHr"),
'projects'=>$langs->trans("ModuleFamilyProjects"), 'projects'=>$langs->trans("ModuleFamilyProjects"),
'other'=>$langs->trans("ModuleFamilyOther"),
'technic'=>$langs->trans("ModuleFamilyTechnic"),
'financial'=>$langs->trans("ModuleFamilyFinancial"), 'financial'=>$langs->trans("ModuleFamilyFinancial"),
'ecm'=>$langs->trans("ModuleFamilyECM"),
'technic'=>$langs->trans("ModuleFamilyTechnic"),
'other'=>$langs->trans("ModuleFamilyOther")
); );
foreach ($orders as $key => $value) foreach ($orders as $key => $value)
{ {

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -15,15 +15,12 @@
* 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/system/dolibarr.php \file htdocs/admin/system/dolibarr.php
\brief Fichier page info systemes Dolibarr \brief Fichier page info systemes Dolibarr
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -93,6 +90,8 @@ $db->begin();
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/";
$handle=opendir($dir); $handle=opendir($dir);
$modules = array(); $modules = array();
$modules_names = array();
$modules_files = array();
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php') if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
@ -101,12 +100,12 @@ while (($file = readdir($handle))!==false)
if ($modName) if ($modName)
{ {
include_once("../../includes/modules/$file"); include_once(DOL_DOCUMENT_ROOT."/includes/modules/".$file);
$objMod = new $modName($db); $objMod = new $modName($db);
$modules[$objMod->numero]=$objMod; $modules[$objMod->numero]=$objMod;
$modules_names[$objMod->numero]=$objMod->name; $modules_names[$objMod->numero]=$objMod->name;
$modules_files[$objMod->numero]=$file;
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic'; $picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
} }
} }
@ -127,7 +126,10 @@ foreach($sortorder as $numero=>$name)
$idperms=""; $idperms="";
$var=!$var; $var=!$var;
// Module // Module
print "<tr $bc[$var]><td width=\"300\" nowrap=\"nowrap\">".img_object("",$picto[$numero]).' '.$modules[$numero]->getName()."</td>"; print "<tr $bc[$var]><td width=\"300\" nowrap=\"nowrap\">";
$alt=$name.' - '.$modules_files[$numero];
print img_object($alt,$picto[$numero]).' '.$modules[$numero]->getName();
print "</td>";
// Version // Version
print '<td>'.$modules[$numero]->getVersion().'</td>'; print '<td>'.$modules[$numero]->getVersion().'</td>';
// Id // Id

View File

@ -15,22 +15,18 @@
* 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/compta/param/index.php \file htdocs/compta/param/index.php
\ingroup compta \ingroup compta
\brief Page acceuil zone paramétrage comptabilité \brief Page acceuil zone paramétrage comptabilité
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
$langs->load("compta"); $langs->load("compta");
$langs->load("admin");
$langs->load("bills"); $langs->load("bills");
/* /*

View File

@ -31,7 +31,6 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
if (!$user->rights->prelevement->bons->lire) if (!$user->rights->prelevement->bons->lire)
accessforbidden(); accessforbidden();
$langs->load("admin");
if ($_GET["action"] == "set" && $user->rights->prelevement->bons->configurer) if ($_GET["action"] == "set" && $user->rights->prelevement->bons->configurer)
{ {

View File

@ -338,7 +338,9 @@ class Conf
$this->fckeditor->dir_output=DOL_DATA_ROOT."/fckeditor"; $this->fckeditor->dir_output=DOL_DATA_ROOT."/fckeditor";
// Module etiquette // Module etiquette
$this->label->enabled=defined("MAIN_MODULE_LABEL")?MAIN_MODULE_LABEL:0; $this->label->enabled=defined("MAIN_MODULE_LABEL")?MAIN_MODULE_LABEL:0;
// Module ECM
$this->ecm->enabled=defined("MAIN_MODULE_ECM")?MAIN_MODULE_ECM:0;
$this->ecm->dir_output=DOL_DATA_ROOT."/ecm";
/* /*
* Modification de quelques variable de conf en fonction des Constantes * Modification de quelques variable de conf en fonction des Constantes

288
htdocs/ecm/docmine.php Normal file
View File

@ -0,0 +1,288 @@
<?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
*/
/**
\file htdoc/google/index.php
\ingroup google
\brief Main google area page
\version $Id$
\author Laurent Destailleur
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
// Load traductions files
$langs->load("ecm");
$langs->load("companies");
$langs->load("other");
// Load permissions
$user->getrights('ecm');
// Get parameters
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
// Permissions
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
$section=$_GET["section"];
if (! $section) $section='misc';
$upload_dir = $conf->ecm->dir_output.'/'.$section;
/*******************************************************************
* ACTIONS
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
// Envoie fichier
if ( $_POST["sendit"] && $conf->upload != 0)
{
if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir))
{
$result = doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name']);
if ($result == 1)
{
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
//print_r($_FILES);
}
else if (!$result)
{
// Echec transfert (fichier d?passant la limite ?)
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
// print_r($_FILES);
}
else
{
// Fichier infect? par un virus
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWith",$result).'</div>';
}
}
}
// Suppression fichier
if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
{
$file = $upload_dir . "/" . urldecode($_GET["urlfile"]);
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
}
/*******************************************************************
* PAGE
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
llxHeader();
$form=new Form($db);
print_fiche_titre($langs->trans("DocsMine"));
print "<br>";
//$head = societe_prepare_head($societe);
//dolibarr_fiche_head($head, 'document', $societe->nom);
/*
* Confirmation de la suppression d'une ligne produit
*/
if ($_GET['action'] == 'delete_file')
{
$form->form_confirm($_SERVER["PHP_SELF"].'?socid='.$socid.'&amp;urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
print '<br>';
}
// Construit liste des fichiers
clearstatcache();
$totalsize=0;
$filearray=array();
$errorlevel=error_reporting();
error_reporting(0);
$handle=opendir($upload_dir);
error_reporting($errorlevel);
if ($handle)
{
$i=0;
while (($file = readdir($handle))!==false)
{
if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$filearray[$i]->name=$file;
$filearray[$i]->size=filesize($upload_dir."/".$file);
$filearray[$i]->date=filemtime($upload_dir."/".$file);
$totalsize+=$filearray[$i]->size;
$i++;
}
}
closedir($handle);
}
else
{
// print '<div class="error">'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'</div>';
}
/*
print '<table class="border"width="100%">';
// Nbre fichiers
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
//Total taille
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
*/
if ($mesg) { print $mesg."<br>"; }
// Affiche formulaire upload
$formfile=new FormFile($db);
$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/docmine.php');
// Affiche liste des documents existant
print_titre($langs->trans("AttachedFiles"));
/**
* TODO Mettre cette section dans une zone AJAX
*/
$modulepart='ecm';
$url=$_SERVER["PHP_SELF"];
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
$param='&amp;socid='.$socid;
print_liste_field_titre($langs->trans("Document"),$_SERVER["PHP_SELF"],"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Size"),$_SERVER["PHP_SELF"],"size","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"date","",$param,'align="center"',$sortfield,$sortorder);
print '<td>&nbsp;</td>';
print '</tr>';
function compare_file($a, $b)
{
global $sortorder;
global $sortfield;
$sortorder=strtoupper($sortorder);
if ($sortorder == 'ASC') { $retup=-1; $retdown=1; }
else { $retup=1; $retdown=-1; }
if ($sortfield == 'name')
{
if ($a->name == $b->name) return 0;
return ($a->name < $b->name) ? $retup : $retdown;
}
if ($sortfield == 'date')
{
if ($a->date == $b->date) return 0;
return ($a->date < $b->date) ? $retup : $retdown;
}
if ($sortfield == 'size')
{
if ($a->size == $b->size) return 0;
return ($a->size < $b->size) ? $retup : $retdown;
}
}
usort($filearray,"compare_file");
$var=true;
foreach($filearray as $key => $file)
{
if (!is_dir($dir.$file->name) && substr($file->name, 0, 1) <> '.' && substr($file->name, 0, 3) <> 'CVS')
{
$var=!$var;
print "<tr $bc[$var]><td>";
echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&type=application/binary&file='.urlencode($prefix.$file->name).'">'.$file->name.'</a>';
print "</td>\n";
print '<td align="right">'.$file->size.' '.$langs->trans("bytes").'</td>';
print '<td align="center">'.dolibarr_print_date($file->date,"dayhour").'</td>';
print '<td align="center">';
echo '<a href="'.$url.'?socid='.$socid.'&amp;action=delete_file&urlfile='.urlencode($file->name).'">'.img_delete().'</a>';
print "</td></tr>\n";
}
}
print "</table>";
// Fin de zone Ajax
print "<br><br>";
// Courriers
// Les courriers sont des documents speciaux generes par des scripts
// situes dans scripts/courrier.
// Voir Rodo
if ($conf->global->MAIN_MODULE_EDITEUR)
{
$filearray=array();
$errorlevel=error_reporting();
error_reporting(0);
$handle=opendir($courrier_dir);
error_reporting($errorlevel);
if ($handle)
{
$i=0;
while (($file = readdir($handle))!==false)
{
if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$filearray[$i]=$file;
$i++;
}
}
closedir($handle);
}
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre"><td>'.$langs->trans("Courriers").'</td><td align="right">'.$langs->trans("Size").'</td><td align="center">'.$langs->trans("Date").'</td></tr>';
$var=true;
foreach($filearray as $key => $file)
{
if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$var=!$var;
print "<tr $bc[$var]><td>";
$loc = "courrier/".get_exdir($socid);
echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=societe&type=application/binary&file='.urlencode($loc.'/'.$file).'">'.$file.'</a>';
print "</td>\n";
print '<td align="right">'.filesize($courrier_dir."/".$file). ' '.$langs->trans("bytes").'</td>';
print '<td align="center">'.dolibarr_print_date(filemtime($courrier_dir."/".$file),"dayhour").'</td>';
print "</tr>\n";
}
}
print "</table>";
}
// End of page
$db->close();
llxFooter('$Date$ - $Revision$');
?>

168
htdocs/ecm/docother.php Normal file
View File

@ -0,0 +1,168 @@
<?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
*/
/**
\file htdoc/google/index.php
\ingroup google
\brief Main google area page
\version $Id$
\author Laurent Destailleur
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
// Load traductions files
$langs->load("ecm");
$langs->load("companies");
$langs->load("other");
// Load permissions
$user->getrights('ecm');
// Get parameters
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
// Permissions
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
$section=$_GET["section"];
if (! $section) $section='misc';
$upload_dir = $conf->ecm->dir_output.'/'.$section;
/*******************************************************************
* ACTIONS
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
// Envoie fichier
if ( $_POST["sendit"] && $conf->upload != 0)
{
if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir))
{
$result = doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name']);
if ($result == 1)
{
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
//print_r($_FILES);
}
else if (!$result)
{
// Echec transfert (fichier d?passant la limite ?)
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
// print_r($_FILES);
}
else
{
// Fichier infect? par un virus
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWith",$result).'</div>';
}
}
}
// Suppression fichier
if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
{
$file = $upload_dir . "/" . urldecode($_GET["urlfile"]);
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
}
/*******************************************************************
* PAGE
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
llxHeader();
$form=new Form($db);
print_fiche_titre($langs->trans("Documents"));
//$head = societe_prepare_head($societe);
//dolibarr_fiche_head($head, 'document', $societe->nom);
/*
* Confirmation de la suppression d'une ligne produit
*/
if ($_GET['action'] == 'delete_file')
{
$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$socid.'&amp;urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile');
print '<br>';
}
// Construit liste des fichiers
clearstatcache();
$totalsize=0;
$filearray=array();
$errorlevel=error_reporting();
error_reporting(0);
$handle=opendir($upload_dir);
error_reporting($errorlevel);
if ($handle)
{
$i=0;
while (($file = readdir($handle))!==false)
{
if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
$filearray[$i]->name=$file;
$filearray[$i]->size=filesize($upload_dir."/".$file);
$filearray[$i]->date=filemtime($upload_dir."/".$file);
$totalsize+=$filearray[$i]->size;
$i++;
}
}
closedir($handle);
}
else
{
// print '<div class="error">'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'</div>';
}
/*
print '<table class="border"width="100%">';
// Nbre fichiers
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
//Total taille
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
*/
if ($mesg) { print $mesg."<br>"; }
print $langs->trans("FeatureNotYetAvailable");
// End of page
$db->close();
llxFooter('$Date$ - $Revision$');
?>

104
htdocs/ecm/index.php Normal file
View File

@ -0,0 +1,104 @@
<?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
*/
/**
\file htdoc/google/index.php
\ingroup google
\brief Main google area page
\version $Id$
\author Laurent Destailleur
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
// Load traductions files
$langs->load("ecm");
$langs->load("companies");
$langs->load("other");
// Load permissions
$user->getrights('ecm');
// Get parameters
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
// Permissions
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
$section=$_GET["section"];
if (! $section) $section='misc';
$upload_dir = $conf->ecm->dir_output.'/'.$section;
/*******************************************************************
* ACTIONS
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
// Envoie fichier
if ( $_POST["sendit"] && $conf->upload != 0)
{
if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir))
{
$result = doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name']);
if ($result == 1)
{
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
//print_r($_FILES);
}
else if (!$result)
{
// Echec transfert (fichier d?passant la limite ?)
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
// print_r($_FILES);
}
else
{
// Fichier infect? par un virus
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWith",$result).'</div>';
}
}
}
// Suppression fichier
if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
{
$file = $upload_dir . "/" . urldecode($_GET["urlfile"]);
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
}
/*******************************************************************
* PAGE
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
llxHeader();
$form=new Form($db);
print_fiche_titre($langs->trans("ECMArea"));
// End of page
$db->close();
llxFooter('$Date$ - $Revision$');
?>

35
htdocs/ecm/pre.inc.php Normal file
View File

@ -0,0 +1,35 @@
<?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
*/
/**
\file htdocs/ecm/pre.inc.php
\ingroup ecm
\brief File to manage left menu for ecm module
\version $Id$
*/
require ("../main.inc.php");
$user->getrights('ecm');
function llxHeader($head = "", $title="", $help_url='')
{
global $conf,$langs;
$langs->load("ecm");
$langs->load("bills");
$langs->load("propal");
top_menu($head, $title);
$menu = new Menu();
$menu->add(DOL_URL_ROOT."/ecm/index.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("MenuECM"));
$menu->add_submenu(DOL_URL_ROOT."/ecm/docmine.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsMine"));
$menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsThirdParties"));
$menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsInvoices"));
$menu->add_submenu(DOL_URL_ROOT."/ecm/docother.php?mainmenu=ecm&idmenu=".$_SESSION["idmenu"], $langs->trans("DocsProposals"));
left_menu($menu->liste, $help_url);
}
?>

View File

@ -116,7 +116,7 @@ class MenuLeft {
{ {
$langs->load("users"); $langs->load("users");
if($user->admin) if ($user->admin)
{ {
$langs->load("admin"); $langs->load("admin");
@ -707,7 +707,6 @@ class MenuLeft {
{ {
if ($conf->projet->enabled) if ($conf->projet->enabled)
{ {
$langs->load("admin");
$langs->load("projects"); $langs->load("projects");
$newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire); $newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/comm/clients.php?leftmenu=projects", $langs->trans("NewProject"), 1, $user->rights->projet->creer); $newmenu->add_submenu(DOL_URL_ROOT."/comm/clients.php?leftmenu=projects", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
@ -730,7 +729,6 @@ class MenuLeft {
if ($conf->mailing->enabled) if ($conf->mailing->enabled)
{ {
$langs->load("admin");
$langs->load("mails"); $langs->load("mails");
$newmenu->add(DOL_URL_ROOT."/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire); $newmenu->add(DOL_URL_ROOT."/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire);

View File

@ -708,7 +708,6 @@ class MenuLeft {
if ($conf->mailing->enabled) if ($conf->mailing->enabled)
{ {
$langs->load("admin");
$langs->load("mails"); $langs->load("mails");
/* /*
$newmenu->add(DOL_URL_ROOT."/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire); $newmenu->add(DOL_URL_ROOT."/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire);

View File

@ -320,7 +320,7 @@ class MenuTop {
// Members // Members
if ($conf->adherent->enabled) if ($conf->adherent->enabled)
{ {
$langs->load("members"); // $langs->load("members"); Added in main file to increase
$class=""; $class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members")
@ -353,7 +353,9 @@ class MenuTop {
// Define idsel // Define idsel
if (! empty($_SESSION['idmenu']) && $tabMenu[$i]['rowid'] == $_SESSION['idmenu']) $idsel='id="sel" '; if (! empty($_SESSION['idmenu']) && $tabMenu[$i]['rowid'] == $_SESSION['idmenu']) $idsel='id="sel" ';
else $idsel=''; else $idsel='';
print '<td class="tmenu"><a class="tmenu" '.$idsel.'href="'.$url.'"'.($this->atarget?" target=$this->atarget":"").'>'.$tabMenu[$i]['titre'].'</a></td>'; print '<td class="tmenu"><a class="tmenu" '.$idsel.'href="'.$url.'"'.($this->atarget?" target=$this->atarget":"").'>';
print $tabMenu[$i]['titre'];
print '</a></td>';
} }
else else
{ {

View File

@ -288,7 +288,7 @@ class MenuTop {
// Members // Members
if ($conf->adherent->enabled) if ($conf->adherent->enabled)
{ {
$langs->load("members"); // $langs->load("members"); Added in main file to increase
$class=""; $class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members")

View File

@ -200,70 +200,70 @@ class DolibarrModules
} }
/** /**
\brief Retourne le nom traduit du module si la traduction existe dans admin.lang, \brief Retourne le nom traduit du module si la traduction existe dans admin.lang,
sinon le nom defini par defaut dans le module. sinon le nom defini par defaut dans le module.
\return string Nom du module traduit \return string Nom du module traduit
*/ */
function getName() function getName()
{ {
global $langs; global $langs;
$langs->load("admin"); $langs->load("admin");
if ($langs->trans("Module".$this->numero."Name") != ("Module".$this->numero."Name")) if ($langs->trans("Module".$this->numero."Name") != ("Module".$this->numero."Name"))
{ {
// Si traduction du nom du module existe // Si traduction du nom du module existe
return $langs->trans("Module".$this->numero."Name"); return $langs->trans("Module".$this->numero."Name");
} }
else else
{ {
// Si traduction du nom du module n'existe pas, on prend definition en dur dans module // Si traduction du nom du module n'existe pas, on prend definition en dur dans module
return $this->name; return $this->name;
} }
} }
/** /**
\brief Retourne la description traduite du module si la traduction existe dans admin.lang, \brief Retourne la description traduite du module si la traduction existe dans admin.lang,
sinon la description definie par defaut dans le module. sinon la description definie par defaut dans le module.
\return string Nom du module traduit \return string Nom du module traduit
*/ */
function getDesc() function getDesc()
{ {
global $langs; global $langs;
$langs->load("admin"); $langs->load("admin");
if ($langs->trans("Module".$this->numero."Desc") != ("Module".$this->numero."Desc")) if ($langs->trans("Module".$this->numero."Desc") != ("Module".$this->numero."Desc"))
{ {
// Si traduction de la description du module existe // Si traduction de la description du module existe
return $langs->trans("Module".$this->numero."Desc"); return $langs->trans("Module".$this->numero."Desc");
} }
else else
{ {
// Si traduction de la description du module n'existe pas, on prend definition en dur dans module // Si traduction de la description du module n'existe pas, on prend definition en dur dans module
return $this->description; return $this->description;
} }
} }
/** /**
\brief Retourne la version du module. \brief Retourne la version du module.
Pour les modules a l'etat 'experimental', retourne la traduction de 'experimental' Pour les modules a l'etat 'experimental', retourne la traduction de 'experimental'
Pour les modules 'dolibarr', retourne la version de Dolibarr Pour les modules 'dolibarr', retourne la version de Dolibarr
Pour les autres modules, retourne la version du module Pour les autres modules, retourne la version du module
\return string Version du module \return string Version du module
*/ */
function getVersion() function getVersion()
{ {
global $langs; global $langs;
$langs->load("admin"); $langs->load("admin");
if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
elseif ($this->version == 'development') return $langs->trans("VersionDevelopment"); elseif ($this->version == 'development') return $langs->trans("VersionDevelopment");
elseif ($this->version == 'dolibarr') return DOL_VERSION; elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version; elseif ($this->version) return $this->version;
else return $langs->trans("VersionUnknown"); else return $langs->trans("VersionUnknown");
} }
/** /**
@ -279,7 +279,6 @@ class DolibarrModules
$sql .= " WHERE numero=".$this->numero." AND active = 1"; $sql .= " WHERE numero=".$this->numero." AND active = 1";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
@ -294,7 +293,6 @@ class DolibarrModules
$this->db->free($resql); $this->db->free($resql);
} }
if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
elseif ($this->version == 'development') return $langs->trans("VersionDevelopment"); elseif ($this->version == 'development') return $langs->trans("VersionDevelopment");
elseif ($this->version == 'dolibarr') return DOL_VERSION; elseif ($this->version == 'dolibarr') return DOL_VERSION;

View File

@ -101,7 +101,7 @@ class modECM extends DolibarrModules
$this->menu[$r]=array('fk_menu'=>0, $this->menu[$r]=array('fk_menu'=>0,
'type'=>'top', 'type'=>'top',
'titre'=>'ECM', 'titre'=>'MenuECM(dotnoloadlang)',
'mainmenu'=>'ecm', 'mainmenu'=>'ecm',
'leftmenu'=>'', 'leftmenu'=>'',
'url'=>'/ecm/index.php', 'url'=>'/ecm/index.php',

View File

@ -174,6 +174,7 @@ ModuleFamilyOther=Other
ModuleFamilyTechnic=Tools or System Modules ModuleFamilyTechnic=Tools or System Modules
ModuleFamilyExperimental=Experimental modules ModuleFamilyExperimental=Experimental modules
ModuleFamilyFinancial=Financial Modules (Accountancy/Treasury) ModuleFamilyFinancial=Financial Modules (Accountancy/Treasury)
ModuleFamilyECM=ECM
MenuHandlers=Menu handlers MenuHandlers=Menu handlers
MenuAdmin=Menu editor MenuAdmin=Menu editor
ThisIsProcessToFollow=This is setup to process: ThisIsProcessToFollow=This is setup to process:
@ -271,6 +272,10 @@ Module2200Name=Droit de pr
Module2200Desc=Gestion du droit de prêts Module2200Desc=Gestion du droit de prêts
Module2300Name=Menus Module2300Name=Menus
Module2300Desc=Menus' management Module2300Desc=Menus' management
Module2400Name=Agenda
Module2400Desc=Agenda and actions management
Module2500Name=Electronic Content Management
Module2500Desc=Save and share documents
Permission11=Read invoices Permission11=Read invoices
Permission12=Create invoices Permission12=Create invoices
Permission13=Modify invoices Permission13=Modify invoices

View File

@ -0,0 +1,7 @@
# Dolibarr language file - en_US - ecm
MenuECM=Documents
DocsMine=My documents
DocsThirdParties=Documents third parties
DocsInvoices=Documents invoices
DocsProposals=Documents proposals
ECMArea=Electronic Content Management area

View File

@ -411,6 +411,7 @@ TotalWoman=Total
TotalMan=Total TotalMan=Total
YouCanChangeValuesForThisListFromDictionnarySetup=You can change values for this list from menu setup - dictionnary YouCanChangeValuesForThisListFromDictionnarySetup=You can change values for this list from menu setup - dictionnary
Color=Color Color=Color
MenuECM=Documents
# Week day # Week day
Monday=Monday Monday=Monday
Tuesday=Tuesday Tuesday=Tuesday

View File

@ -173,6 +173,7 @@ ModuleFamilyOther=Autre
ModuleFamilyTechnic=Modules outils ou système ModuleFamilyTechnic=Modules outils ou système
ModuleFamilyExperimental=Modules expérimentaux (ne pas utiliser en production) ModuleFamilyExperimental=Modules expérimentaux (ne pas utiliser en production)
ModuleFamilyFinancial=Modules financiers (Compta/trésorerie) ModuleFamilyFinancial=Modules financiers (Compta/trésorerie)
ModuleFamilyECM=GED
MenuHandlers=Gestionnaires menu MenuHandlers=Gestionnaires menu
MenuAdmin=Edition menu MenuAdmin=Edition menu
ThisIsProcessToFollow=Voici la procédure à suivre: ThisIsProcessToFollow=Voici la procédure à suivre:
@ -270,6 +271,10 @@ Module2200Name=Droit de pr
Module2200Desc=Gestion du droit de prêts Module2200Desc=Gestion du droit de prêts
Module2300Name=Menus Module2300Name=Menus
Module2300Desc=Administration des menus par base de données Module2300Desc=Administration des menus par base de données
Module2400Name=Agenda
Module2400Desc=Gestion de l'agenda et des actions
Module2500Name=Gestion Electronique de Document
Module2500Desc=Permet de stocker et administrer une base de documents
Permission11=Consulter les factures Permission11=Consulter les factures
Permission12=Créer les factures Permission12=Créer les factures
Permission13=Modifier les factures Permission13=Modifier les factures

View File

@ -0,0 +1,7 @@
# Dolibarr language file - fr_FR - ecm
MenuECM=Documents
DocsMine=Mes documents
DocsThirdParties=Documents tiers
DocsInvoices=Documents factures
DocsProposals=Documents propositions
ECMArea=Espace Gestion de documents

View File

@ -413,6 +413,7 @@ TotalWoman=Totale
TotalMan=Total TotalMan=Total
YouCanChangeValuesForThisListFromDictionnarySetup=Vous pouvez changer ces valeurs depuis le menu configuration - dictionnaires YouCanChangeValuesForThisListFromDictionnarySetup=Vous pouvez changer ces valeurs depuis le menu configuration - dictionnaires
Color=Couleur Color=Couleur
MenuECM=Documents
# Week day # Week day
Monday=Lundi Monday=Lundi
Tuesday=Mardi Tuesday=Mardi

View File

@ -523,7 +523,15 @@ class Menubase
if ($this->verifConstraint($objm->rowid)) if ($this->verifConstraint($objm->rowid))
{ {
$langs->load($objm->langs); $title=$objm->titre;
if (! eregi('\(dotnoloadlang\)$',$title))
{
if (! empty($objm->langs)) $langs->load($objm->langs);
}
else
{
$title=eregi_replace('\(dotnoloadlang\)$','',$title);
}
$class=""; $class="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == $objm->mainmenu) if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == $objm->mainmenu)
@ -540,14 +548,14 @@ class Menubase
eval($str); eval($str);
} }
if(eregi("/",$objm->titre)) if(eregi("/",$title))
{ {
$tab_titre = explode("/",$objm->titre); $tab_titre = explode("/",$title);
$chaine = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]); $chaine = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
} }
else else
{ {
$chaine = $langs->trans($objm->titre); $chaine = $langs->trans($title);
} }
$tabMenu[$b]['rowid'] = $objm->rowid; $tabMenu[$b]['rowid'] = $objm->rowid;

View File

@ -751,7 +751,7 @@ function top_menu($head, $title="", $target="")
* Si la constante MAIN_NEED_UPDATE est definie (par le script de migration sql en general), c'est que * Si la constante MAIN_NEED_UPDATE est definie (par le script de migration sql en general), c'est que
* les donnees ont besoin d'un remaniement. Il faut passer le update.php * les donnees ont besoin d'un remaniement. Il faut passer le update.php
*/ */
if (isset($conf->global->MAIN_NEED_UPDATE) && $conf->global->MAIN_NEED_UPDATE) if (! empty($conf->global->MAIN_NEED_UPDATE))
{ {
$langs->load("admin"); $langs->load("admin");
print '<div class="fiche">'."\n"; print '<div class="fiche">'."\n";

View File

@ -1,7 +1,7 @@
<?php <?php
/* *************************************************************************** /* ***************************************************************************
* Copyright (C) 2001 Eric Seigne <erics@rycks.com> * Copyright (C) 2001 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2005 Destailleur Laurent <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Destailleur Laurent <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,6 +21,7 @@
/** /**
\file htdocs/translate.class.php \file htdocs/translate.class.php
\brief Fichier de la classe de traduction \brief Fichier de la classe de traduction
\author Eric Seigne
\author Laurent Destailleur \author Laurent Destailleur
\version $Id$ \version $Id$
*/ */
@ -153,7 +154,15 @@ class Translate {
*/ */
function Load($domain,$alt=0) function Load($domain,$alt=0)
{ {
if (! empty($this->tab_loaded[$domain])) { return; } // Le fichier de ce domaine est deja charge // Check parameters
if (empty($domain))
{
dolibarr_syslog("Tranlsate::Load ErrorWrongParameters",LOG_WARNING);
return;
}
// Check cache
if (! empty($this->tab_loaded[$domain])) { return; } // Le fichier de ce domaine est deja charge
// Repertoire de traduction // Repertoire de traduction
$scandir = $this->dir."/".$this->defaultlang; $scandir = $this->dir."/".$this->defaultlang;
@ -168,15 +177,15 @@ class Translate {
elseif (eregi('^en',$this->defaultlang) && $this->defaultlang != 'en_US') $scandiralt = $this->dir."/en_US"; elseif (eregi('^en',$this->defaultlang) && $this->defaultlang != 'en_US') $scandiralt = $this->dir."/en_US";
else $scandiralt = $this->dir."/en_US"; else $scandiralt = $this->dir."/en_US";
$file_lang = $scandiralt . "/$domain.lang"; $file_lang = $scandiralt . "/".$domain.".lang";
$filelangexists=is_file($file_lang); $filelangexists=is_file($file_lang);
$alt=1; $alt=1;
} }
dolibarr_syslog("Translate::Load read file ".$file_lang);
if ($filelangexists) if ($filelangexists)
{ {
//dolibarr_syslog("Translate::Load read file ".$file_lang);
// Enable cache of lang file in session (faster but need more memory) // Enable cache of lang file in session (faster but need more memory)
// Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) // Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
$enablelangcacheinsession=false; $enablelangcacheinsession=false;