From 2cffacc593b28dd2c7fdb4a6f12e5d457da54f3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Jan 2008 23:23:39 +0000 Subject: [PATCH] Extract from cvs non GPL library --- htdocs/exports/export.php | 43 +++++++++++++++++++----------------- htdocs/lib/viewfiles.lib.php | 21 +++++++++--------- htdocs/master.inc.php | 3 ++- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 4a7a192ebd5..43a76d77ad5 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -86,7 +86,7 @@ if ($action=='selectfield') if ($action=='unselectfield') { unset($array_selected[$_GET["field"]]); - // Renumerote champs de array_selected (de 1 à nb_elements) + // Renumerote champs de array_selected (de 1 � nb_elements) asort($array_selected); $i=0; $array_selected_save=$array_selected; @@ -104,7 +104,7 @@ if ($action=='downfield' || $action=='upfield') $pos=$array_selected[$_GET["field"]]; if ($action=='downfield') $newpos=$pos+1; if ($action=='upfield') $newpos=$pos-1; - // Recherche code avec qui switché + // Recherche code avec qui switch� $newcode=""; foreach($array_selected as $code=>$value) { @@ -115,7 +115,7 @@ if ($action=='downfield' || $action=='upfield') } } //print("Switch pos=$pos (code=".$_GET["field"].") and newpos=$newpos (code=$newcode)"); - if ($newcode) // Si newcode trouvé (prtoection contre resoumission de page + if ($newcode) // Si newcode trouv� (prtoection contre resoumission de page { $array_selected[$_GET["field"]]=$newpos; $array_selected[$newcode]=$pos; @@ -131,7 +131,7 @@ if ($step == 1 || $action == 'cleanselect') if ($action == 'builddoc') { - // Genère le fichier + // Gen�re le fichier $result=$objexport->build_file($user, $_POST['model'], $datatoexport, $array_selected); if ($result < 0) { @@ -293,14 +293,14 @@ if ($step == 2 && $datatoexport) print $objexport->array_export_module[0]->getName(); print ''; - // Lot de données à exporter + // Lot de donn�es � exporter print ''.$langs->trans("DatasetToExport").''; print ''.$objexport->array_export_label[0].''; print ''; print '
'; - // Liste déroulante des modéles d'export + // Liste d�roulante des mod�les d'export print '
'; print ''; print ''; @@ -350,7 +350,7 @@ if ($step == 2 && $datatoexport) print ''.img_object('',$entityicon).' '.$langs->trans($entitylang).''; if ((isset($array_selected[$code]) && $array_selected[$code]) || $modelchoice == 1) { - // Champ sélectionné + // Champ s�lectionn� print ' '; print ''.img_left().''; print ''.$langs->trans($label).' ('.$code.')'; @@ -358,7 +358,7 @@ if ($step == 2 && $datatoexport) } else { - // Champ non sélectionné + // Champ non s�lectionn� print ''.$langs->trans($label).' ('.$code.')'; print ''.img_right().''; print ' '; @@ -425,11 +425,11 @@ if ($step == 3 && $datatoexport) print $objexport->array_export_module[0]->getName(); print ''; - // Lot de données à exporter + // Lot de donn�es � exporter print ''.$langs->trans("DatasetToExport").''; print ''.$objexport->array_export_label[0].''; - // Nbre champs exportés + // Nbre champs export�s print ''.$langs->trans("ExportedFields").''; $list=''; foreach($array_selected as $code=>$value) @@ -568,11 +568,11 @@ if ($step == 4 && $datatoexport) print $objexport->array_export_module[0]->getName(); print ''; - // Lot de données à exporter + // Lot de donn�es � exporter print ''.$langs->trans("DatasetToExport").''; print ''.$objexport->array_export_label[0].''; - // Nbre champs exportés + // Nbre champs export�s print ''.$langs->trans("ExportedFields").''; $list=''; foreach($array_selected as $code=>$label) @@ -619,14 +619,17 @@ if ($step == 4 && $datatoexport) print ' '; print ''; - - // Test d'affichage du tableau excel et csv - //print '
'; - //require_once(DOL_DOCUMENT_ROOT.'/lib/viewfiles.lib.php'); - //viewExcelFileContent($conf->export->dir_temp.'/1/export_member_1.xls',5,3); - //viewCsvFileContent($conf->export->dir_temp.'/1/export_member_1.csv',5); - //print '
'; - + // If external library PHPEXCELREADER is available + // and defined by PHPEXCELREADER constant. + if (file_exists(PHPEXCELREADER.'excelreader.php')) + { + // Test d'affichage du tableau excel et csv + //print '
'; + //require_once(DOL_DOCUMENT_ROOT.'/lib/viewfiles.lib.php'); + //viewExcelFileContent($conf->export->dir_temp.'/1/export_member_1.xls',5,3); + //viewCsvFileContent($conf->export->dir_temp.'/1/export_member_1.csv',5); + //print '
'; + } } diff --git a/htdocs/lib/viewfiles.lib.php b/htdocs/lib/viewfiles.lib.php index 6af5c6a312a..1dbbf2a2ef3 100644 --- a/htdocs/lib/viewfiles.lib.php +++ b/htdocs/lib/viewfiles.lib.php @@ -16,20 +16,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * or see http://www.gnu.org/ - * - * $Id$ */ /** - \file htdocs/lib/excel.lib.php - \brief Ensemble de fonctions de base de dolibarr sous forme d'include + \file htdocs/lib/excel.lib.php + \brief Ensemble de fonctions de base de dolibarr sous forme d'include + \version $Id$ */ -/* +/** * \brief Affiche le contenu d'un fichier CSV sous forme de tableau * \param file_to_include Fichier CSV a afficher - * \param max_rows Nombre max de lignes a afficher (0 = illimité) + * \param max_rows Nombre max de lignes a afficher (0 = illimit�) */ function viewCsvFileContent($file_to_include='',$max_rows=0) { @@ -51,18 +50,18 @@ function viewCsvFileContent($file_to_include='',$max_rows=0) print ''; } -/* +/** * \brief Affiche le contenu d'un fichier Excel (avec les feuilles de calcul) sous forme de tableau * \param file_to_include Fichier Excel a afficher - * \param max_rows Nombre max de lignes a afficher (0 = illimité) - * \param max_cols Nombre max de colonnes a afficher (0 = illimité) + * \param max_rows Nombre max de lignes a afficher (0 = illimite) + * \param max_cols Nombre max de colonnes a afficher (0 = illimite) */ function viewExcelFileContent($file_to_include='',$max_rows=0,$max_cols=0) { - $debug = 0; //1 for on 0 for off + $debug = 0; //1 for on 0 for off $force_nobr = 0; //Force the info in cells not to wrap unless stated explicitly (newline) - require_once(DOL_DOCUMENT_ROOT.'/includes/phpexcelreader/excelreader.php'); + require_once(PHPEXCELREADER.'excelreader.php'); $data = new Spreadsheet_Excel_Reader(); $data->setOutputEncoding('CPa25a'); $data->read($file_to_include); diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 69c351248be..99c3a033898 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -213,10 +213,11 @@ if (! defined('NOREQUIRETRAN')) // Les path racines if (! defined('FPDF_PATH')) { define('FPDF_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdf/'); } if (! defined('FPDFI_PATH')) { define('FPDFI_PATH', DOL_DOCUMENT_ROOT .'/includes/fpdf/fpdfi/'); } -if (! defined('PHP_WRITEEXCEL_PATH')) { define('PHP_WRITEEXCEL_PATH',DOL_DOCUMENT_ROOT .'/includes/php_writeexcel/'); } if (! defined('MAGPIERSS_PATH')) { define('MAGPIERSS_PATH', DOL_DOCUMENT_ROOT .'/includes/magpierss/'); } if (! defined('JPGRAPH_PATH')) { define('JPGRAPH_PATH', DOL_DOCUMENT_ROOT .'/includes/jpgraph/'); } if (! defined('NUSOAP_PATH')) { define('NUSOAP_PATH', DOL_DOCUMENT_ROOT .'/includes/nusoap/lib/'); } +if (! defined('PHP_WRITEEXCEL_PATH')) { define('PHP_WRITEEXCEL_PATH',DOL_DOCUMENT_ROOT .'/includes/php_writeexcel/'); } +if (! defined('PHPEXCELREADER')) { define('PHPEXCELREADER', DOL_DOCUMENT_ROOT .'/includes/phpexcelreader/'); } // Les autres path if (! defined('FPDF_FONTPATH')) { define('FPDF_FONTPATH', FPDF_PATH . 'font/'); } if (! defined('MAGPIE_DIR')) { define('MAGPIE_DIR', MAGPIERSS_PATH); }