diff --git a/src/css/default/LSimport.css b/src/css/default/LSio.css similarity index 64% rename from src/css/default/LSimport.css rename to src/css/default/LSio.css index c9d82aba..652534fe 100644 --- a/src/css/default/LSimport.css +++ b/src/css/default/LSio.css @@ -1,28 +1,28 @@ -h3.LSimport { +h3.LSio { margin-left: 1.5em; border-bottom: 1px solid; } -div.LSimport_error { +div.LSio_error { padding: 0 2em; } -ul.LSimport_global_errors { +ul.LSio_global_errors { background-color: #F56A6A; list-style-type: none; padding: 1em; text-align: center; } -ul.LSimport_data_errors { +ul.LSio_data_errors { font-style: italic; font-size: 0.8em; } -ul.LSimport_attr_errors { +ul.LSio_attr_errors { padding-left: 1.5em; } -ul.LSimport_attr_errors li { +ul.LSio_attr_errors li { color: #f00; } diff --git a/src/includes/class/class.LSexport.php b/src/includes/class/class.LSexport.php deleted file mode 100644 index 43909cc9..00000000 --- a/src/includes/class/class.LSexport.php +++ /dev/null @@ -1,230 +0,0 @@ - - */ -class LSexport extends LSlog_staticLoggerClass { - - /** - * Export objects - * - * @param[in] $LSobject LSldapObject An instance of the object type - * @param[in] $ioFormat string The LSioFormat name - * @param[in] $stream resource|null The output stream (optional, default: STDOUT) - * - * @author Benjamin Renard - * - * @retval boolean True on success, False otherwise - */ - public static function export($object, $ioFormat, $stream=null) { - // Load LSobject - if (is_string($object)) { - if (!LSsession::loadLSobject($object, true)) { // Load with warning - return false; - } - $object = new $object(); - } - - // Validate ioFormat - if(!$object -> isValidIOformat($ioFormat)) { - LSerror :: addErrorCode('LSexport_01', $ioFormat); - return false; - } - - // Create LSioFormat object - $ioFormat = new LSioFormat($object -> type, $ioFormat); - if (!$ioFormat -> ready()) { - LSerror :: addErrorCode('LSexport_02'); - return false; - } - - // Load LSsearch class (with warning) - if (!LSsession :: loadLSclass('LSsearch', null, true)) { - return false; - } - - // Search objects - $search = new LSsearch($object -> type, 'LSexport'); - $search -> run(); - - // Retreive objets - $objects = $search -> listObjects(); - if (!is_array($objects)) { - LSerror :: addErrorCode('LSexport_03'); - return false; - } - self :: log_debug(count($objects)." object(s) found to export"); - - // Export objects using LSioFormat object - if (!$ioFormat -> exportObjects($objects, $stream)) { - LSerror :: addErrorCode('LSexport_04'); - return false; - } - self :: log_debug("export(): objects exported"); - return true; - } - - /** - * CLI export command - * - * @param[in] $command_args array Command arguments: - * - Positional arguments: - * - LSobject type - * - LSioFormat name - * - Optional arguments: - * - -o|--output: Output path ("-" == stdout, default: "-") - * - * @retval boolean True on succes, false otherwise - **/ - public static function cli_export($command_args) { - $objType = null; - $ioFormat = null; - $output = '-'; - for ($i=0; $i < count($command_args); $i++) { - switch ($command_args[$i]) { - case '-o': - case '--output': - $output = $command_args[++$i]; - break; - default: - if (is_null($objType)) { - $objType = $command_args[$i]; - } - elseif (is_null($ioFormat)) { - $ioFormat = $command_args[$i]; - } - else - LScli :: usage("Invalid $arg parameter."); - } - } - - if (is_null($objType) || is_null($ioFormat)) - LScli :: usage('You must provide LSobject type, ioFormat.'); - - // Check output - if ($output != '-' && file_exists($output)) - LScli :: usage("Output file '$output' already exists."); - - // Open output stream - $stream = fopen(($output=='-'?'php://stdout':$output), "w"); - if ($stream === false) - LSlog :: fatal("Fail to open output file '$output'."); - - // Run export - return self :: export($objType, $ioFormat, $stream); - } - - /** - * Args autocompleter for CLI export command - * - * @param[in] $command_args array List of already typed words of the command - * @param[in] $comp_word_num int The command word number to autocomplete - * @param[in] $comp_word string The command word to autocomplete - * @param[in] $opts array List of global available options - * - * @retval array List of available options for the word to autocomplete - **/ - public static function cli_export_args_autocompleter($command_args, $comp_word_num, $comp_word, $opts) { - $opts = array_merge($opts, array ('-o', '--output')); - - // Handle positional args - $objType = null; - $objType_arg_num = null; - $ioFormat = null; - $ioFormat_arg_num = null; - for ($i=0; $i < count($command_args); $i++) { - if (!in_array($command_args[$i], $opts)) { - // If object type not defined - if (is_null($objType)) { - // Defined it - $objType = $command_args[$i]; - LScli :: unquote_word($objType); - $objType_arg_num = $i; - - // Check object type exists - $objTypes = LScli :: autocomplete_LSobject_types($objType); - - // Load it if exist and not trying to complete it - if (in_array($objType, $objTypes) && $i != $comp_word_num) { - LSsession :: loadLSobject($objType, false); - } - } - elseif (is_null($ioFormat)) { - $ioFormat = $command_args[$i]; - LScli :: unquote_word($ioFormat); - $ioFormat_arg_num = $i; - } - } - } - - // If objType not already choiced (or currently autocomplete), add LSobject types to available options - if (!$objType || $objType_arg_num == $comp_word_num) - $opts = array_merge($opts, LScli :: autocomplete_LSobject_types($comp_word)); - - // If dn not alreay choiced (or currently autocomplete), try autocomplete it - elseif (!$ioFormat || $ioFormat_arg_num == $comp_word_num) - $opts = array_merge($opts, LScli :: autocomplete_LSobject_ioFormat($objType, $comp_word)); - - return LScli :: autocomplete_opts($opts, $comp_word); - } - -} -LSerror :: defineError('LSexport_01', -___("LSexport: input/output format %{format} invalid.") -); -LSerror :: defineError('LSexport_02', -___("LSexport: Fail to initialize input/output driver.") -); -LSerror :: defineError('LSexport_03', -___("LSexport: Fail to load objects's data to export from LDAP directory.") -); -LSerror :: defineError('LSexport_04', -___("LSexport: Fail to export objects's data.") -); - -// Defined CLI commands functions only on CLI context -if (php_sapi_name() != 'cli') - return true; // Always return true to avoid some warning in log - -// LScli -LScli :: add_command( - 'export', - array('LSexport', 'cli_export'), - 'Export LSobject', - '[object type] [ioFormat name] -o /path/to/output.file', - array( - ' - Positional arguments :', - ' - LSobject type', - ' - LSioFormat name', - '', - ' - Optional arguments :', - ' - -o|--output: The output file path. Use "-" for STDOUT (optional, default: "-")', - ), - true, - array('LSexport', 'cli_export_args_autocompleter') -); diff --git a/src/includes/class/class.LSimport.php b/src/includes/class/class.LSio.php similarity index 72% rename from src/includes/class/class.LSimport.php rename to src/includes/class/class.LSio.php index 3faecc46..0df01527 100644 --- a/src/includes/class/class.LSimport.php +++ b/src/includes/class/class.LSio.php @@ -28,17 +28,19 @@ LSsession::loadLSclass('LSioFormat'); * * @author Benjamin Renard */ -class LSimport extends LSlog_staticLoggerClass { +class LSio extends LSlog_staticLoggerClass { /** * Check if the form was posted by check POST data * + * @param[in] $action string The action name used as POST validate flag value + * * @author Benjamin Renard * * @retval boolean true if the form was posted, false otherwise */ - public static function isSubmit() { - if (isset($_POST['validate']) && ($_POST['validate']=='LSimport')) + public static function isSubmit($action) { + if (isset($_POST['validate']) && ($_POST['validate']==$action)) return true; return; } @@ -111,7 +113,7 @@ class LSimport extends LSlog_staticLoggerClass { // Get data from $_POST $data = self::getPostData(); if (!is_array($data)) { - LSerror :: addErrorCode('LSimport_01'); + LSerror :: addErrorCode('LSio_01'); return array( 'success' => false, 'imported' => array(), @@ -195,27 +197,27 @@ class LSimport extends LSlog_staticLoggerClass { // Load LSobject if (!isset($LSobject) || !LSsession::loadLSobject($LSobject)) { - LSerror :: addErrorCode('LSimport_02'); + LSerror :: addErrorCode('LSio_02'); return $return; } // Validate ioFormat $object = new $LSobject(); if(!$object -> isValidIOformat($ioFormat)) { - LSerror :: addErrorCode('LSimport_03',$ioFormat); + LSerror :: addErrorCode('LSio_03',$ioFormat); return $return; } // Create LSioFormat object $ioFormat = new LSioFormat($LSobject,$ioFormat); if (!$ioFormat -> ready()) { - LSerror :: addErrorCode('LSimport_04'); + LSerror :: addErrorCode('LSio_04'); return $return; } // Load data in LSioFormat object if (!$ioFormat -> loadFile($input_file)) { - LSerror :: addErrorCode('LSimport_05'); + LSerror :: addErrorCode('LSio_05'); return $return; } self :: log_debug("import(): file loaded"); @@ -327,6 +329,65 @@ class LSimport extends LSlog_staticLoggerClass { return $return; } + /** + * Export objects + * + * @param[in] $LSobject LSldapObject An instance of the object type + * @param[in] $ioFormat string The LSioFormat name + * @param[in] $stream resource|null The output stream (optional, default: STDOUT) + * + * @author Benjamin Renard + * + * @retval boolean True on success, False otherwise + */ + public static function export($object, $ioFormat, $stream=null) { + // Load LSobject + if (is_string($object)) { + if (!LSsession::loadLSobject($object, true)) { // Load with warning + return false; + } + $object = new $object(); + } + + // Validate ioFormat + if(!$object -> isValidIOformat($ioFormat)) { + LSerror :: addErrorCode('LSio_03', $ioFormat); + return false; + } + + // Create LSioFormat object + $ioFormat = new LSioFormat($object -> type, $ioFormat); + if (!$ioFormat -> ready()) { + LSerror :: addErrorCode('LSio_04'); + return false; + } + + // Load LSsearch class (with warning) + if (!LSsession :: loadLSclass('LSsearch', null, true)) { + return false; + } + + // Search objects + $search = new LSsearch($object -> type, 'LSio'); + $search -> run(); + + // Retreive objets + $objects = $search -> listObjects(); + if (!is_array($objects)) { + LSerror :: addErrorCode('LSio_06'); + return false; + } + self :: log_debug(count($objects)." object(s) found to export"); + + // Export objects using LSioFormat object + if (!$ioFormat -> exportObjects($objects, $stream)) { + LSerror :: addErrorCode('LSio_07'); + return false; + } + self :: log_debug("export(): objects exported"); + return true; + } + /** * CLI import command * @@ -486,11 +547,115 @@ class LSimport extends LSlog_staticLoggerClass { return LScli :: autocomplete_opts($opts, $comp_word); } + /** + * CLI export command + * + * @param[in] $command_args array Command arguments: + * - Positional arguments: + * - LSobject type + * - LSioFormat name + * - Optional arguments: + * - -o|--output: Output path ("-" == stdout, default: "-") + * + * @retval boolean True on succes, false otherwise + **/ + public static function cli_export($command_args) { + $objType = null; + $ioFormat = null; + $output = '-'; + for ($i=0; $i < count($command_args); $i++) { + switch ($command_args[$i]) { + case '-o': + case '--output': + $output = $command_args[++$i]; + break; + default: + if (is_null($objType)) { + $objType = $command_args[$i]; + } + elseif (is_null($ioFormat)) { + $ioFormat = $command_args[$i]; + } + else + LScli :: usage("Invalid $arg parameter."); + } + } + + if (is_null($objType) || is_null($ioFormat)) + LScli :: usage('You must provide LSobject type, ioFormat.'); + + // Check output + if ($output != '-' && file_exists($output)) + LScli :: usage("Output file '$output' already exists."); + + // Open output stream + $stream = fopen(($output=='-'?'php://stdout':$output), "w"); + if ($stream === false) + LSlog :: fatal("Fail to open output file '$output'."); + + // Run export + return self :: export($objType, $ioFormat, $stream); + } + + /** + * Args autocompleter for CLI export command + * + * @param[in] $command_args array List of already typed words of the command + * @param[in] $comp_word_num int The command word number to autocomplete + * @param[in] $comp_word string The command word to autocomplete + * @param[in] $opts array List of global available options + * + * @retval array List of available options for the word to autocomplete + **/ + public static function cli_export_args_autocompleter($command_args, $comp_word_num, $comp_word, $opts) { + $opts = array_merge($opts, array ('-o', '--output')); + + // Handle positional args + $objType = null; + $objType_arg_num = null; + $ioFormat = null; + $ioFormat_arg_num = null; + for ($i=0; $i < count($command_args); $i++) { + if (!in_array($command_args[$i], $opts)) { + // If object type not defined + if (is_null($objType)) { + // Defined it + $objType = $command_args[$i]; + LScli :: unquote_word($objType); + $objType_arg_num = $i; + + // Check object type exists + $objTypes = LScli :: autocomplete_LSobject_types($objType); + + // Load it if exist and not trying to complete it + if (in_array($objType, $objTypes) && $i != $comp_word_num) { + LSsession :: loadLSobject($objType, false); + } + } + elseif (is_null($ioFormat)) { + $ioFormat = $command_args[$i]; + LScli :: unquote_word($ioFormat); + $ioFormat_arg_num = $i; + } + } + } + + // If objType not already choiced (or currently autocomplete), add LSobject types to available options + if (!$objType || $objType_arg_num == $comp_word_num) + $opts = array_merge($opts, LScli :: autocomplete_LSobject_types($comp_word)); + + // If dn not alreay choiced (or currently autocomplete), try autocomplete it + elseif (!$ioFormat || $ioFormat_arg_num == $comp_word_num) + $opts = array_merge($opts, LScli :: autocomplete_LSobject_ioFormat($objType, $comp_word)); + + return LScli :: autocomplete_opts($opts, $comp_word); + } + } /* - * LSimport_implodeValues template function + * LSio_implodeValues template function * * This function permit to implode field values during * template processing. This function take as parameters @@ -502,30 +667,36 @@ class LSimport extends LSlog_staticLoggerClass { * * @retval void **/ -function LSimport_implodeValues($params, $template) { +function LSio_implodeValues($params, $template) { extract($params); if (isset($values) && is_array($values)) { echo implode(',',$values); } } -LStemplate :: registerFunction('LSimport_implodeValues','LSimport_implodeValues'); +LStemplate :: registerFunction('LSio_implodeValues','LSio_implodeValues'); -LSerror :: defineError('LSimport_01', -___("LSimport: Post data not found or not completed.") +LSerror :: defineError('LSio_01', +___("LSio: Post data not found or not completed.") ); -LSerror :: defineError('LSimport_02', -___("LSimport: object type invalid.") +LSerror :: defineError('LSio_02', +___("LSio: object type invalid.") ); -LSerror :: defineError('LSimport_03', -___("LSimport: input/output format %{format} invalid.") +LSerror :: defineError('LSio_03', +___("LSio: input/output format %{format} invalid.") ); -LSerror :: defineError('LSimport_04', -___("LSimport: Fail to initialize input/output driver.") +LSerror :: defineError('LSio_04', +___("LSio: Fail to initialize input/output driver.") ); -LSerror :: defineError('LSimport_05', -___("LSimport: Fail to load objects's data from input file.") +LSerror :: defineError('LSio_05', +___("LSio: Fail to load objects's data from input file.") +); +LSerror :: defineError('LSio_06', +___("LSio: Fail to load objects's data to export from LDAP directory.") +); +LSerror :: defineError('LSio_07', +___("LSio: Fail to export objects's data.") ); // Defined CLI commands functions only on CLI context @@ -535,7 +706,7 @@ if (php_sapi_name() != 'cli') // LScli LScli :: add_command( 'import', - array('LSimport', 'cli_import'), + array('LSio', 'cli_import'), 'Import LSobject', '[object type] [ioFormat name] -i /path/to/input.file', array( @@ -549,5 +720,23 @@ LScli :: add_command( ' - -j|--just-try Enable just-try mode', ), true, - array('LSimport', 'cli_import_args_autocompleter') + array('LSio', 'cli_import_args_autocompleter') +); + +// LScli +LScli :: add_command( + 'export', + array('LSio', 'cli_export'), + 'Export LSobject', + '[object type] [ioFormat name] -o /path/to/output.file', + array( + ' - Positional arguments :', + ' - LSobject type', + ' - LSioFormat name', + '', + ' - Optional arguments :', + ' - -o|--output: The output file path. Use "-" for STDOUT (optional, default: "-")', + ), + true, + array('LSio', 'cli_export_args_autocompleter') ); diff --git a/src/includes/routes.php b/src/includes/routes.php index d84e5023..6fbf5011 100644 --- a/src/includes/routes.php +++ b/src/includes/routes.php @@ -787,15 +787,15 @@ function handle_LSobject_import($request) { $ioFormats = array(); $result = array(); - if ( LSsession :: loadLSclass('LSimport', null, true)) { // import class with warning + if ( LSsession :: loadLSclass('LSio', null, true)) { // import class with warning $ioFormats = $object->listValidIOformats(); if (!is_array($ioFormats) || empty($ioFormats)) { $ioFormats = array(); LSerror :: addErrorCode('LSsession_16'); } - else if (LSimport::isSubmit()) { - $result = LSimport::importFromPostData(); - LSlog :: debug("LSimport::importFromPostData(): result = ".varDump($result)); + else if (LSio::isSubmit('import')) { + $result = LSio::importFromPostData(); + LSlog :: debug("LSio::importFromPostData(): result = ".varDump($result)); } } @@ -808,7 +808,7 @@ function handle_LSobject_import($request) { // Set & display template LSsession :: setTemplate('import.tpl'); LStemplate :: addCssFile('LSform.css'); - LStemplate :: addCssFile('LSimport.css'); + LStemplate :: addCssFile('LSio.css'); LSsession :: displayTemplate(); } LSurl :: add_handler('#^object/(?P[^/]+)/import/?$#', 'handle_LSobject_import'); @@ -855,14 +855,14 @@ function handle_LSobject_export($request) { $ioFormats = array(); $result = null; - if ( LSsession :: loadLSclass('LSexport', null, true)) { // Load class with warning + if ( LSsession :: loadLSclass('LSio', null, true)) { // Load class with warning $ioFormats = $object->listValidIOformats(); if (!is_array($ioFormats) || empty($ioFormats)) { $ioFormats = array(); LSerror :: addErrorCode('LSsession_16'); } - else if (isset($_REQUEST['ioFormat'])) { - if (!LSexport::export($object, $_REQUEST['ioFormat'])) + else if (LSio::isSubmit('export') && isset($_REQUEST['ioFormat'])) { + if (!LSio::export($object, $_REQUEST['ioFormat'])) LSlog :: error("An error occurred exporting ".$object -> type); } } diff --git a/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo b/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo index 710ae162..4f6340d4 100644 Binary files a/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo and b/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo differ diff --git a/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po b/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po index 652392c0..881cf083 100644 --- a/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po +++ b/src/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: LdapSaisie\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-02-05 10:32+0100\n" +"PO-Revision-Date: 2021-02-05 18:27+0100\n" "Last-Translator: Benjamin Renard \n" "Language-Team: LdapSaisie \n" @@ -437,72 +437,82 @@ msgstr "LSformRule_%{type} : Le paramètre %{param} n'est pas défini." msgid "LSformRule: Unknown rule type %{type}." msgstr "LSformRule : Type de règle %{type} inconnu." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:208 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:240 msgid "Failed to set post data on creation form." msgstr "Impossible de définir les données dans le formulaire de création." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:214 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:246 msgid "Error validating creation form." msgstr "Une erreur est survenue en validant le formulaire de création." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:219 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:251 msgid "Failed to validate object data." msgstr "Impossible de valider les données de l'objet." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:226 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:258 msgid "Failed to generate DN for this object." msgstr "Impossible de générer le DN de cet objet." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:240 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:272 msgid "Error creating object on LDAP server." msgstr "Une erreur est survenue en création cet objet dans l'annuaire LDAP." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:246 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:278 msgid "An object already exist on LDAP server with DN %{dn}." msgstr "Un objet existe déjà dans l'annuaire LDAP avec le DN %{dn}." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:257 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:289 msgid "" "Failed to load existing object %{dn} from LDAP server. Can't update object." msgstr "" "Impossible de charger l'objet existant %{dn} depuis l'annuaire LDAP. " "Impossible de mettre à jour cet objet." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:265 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:297 msgid "Failed to set post data on update form." msgstr "Impossible de définir les données dans le formulaire de mise à jours." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:271 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:303 msgid "Error validating update form." msgstr "Une erreur est survenue en validant le formulaire de mise à jour." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:281 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:313 msgid "Error updating object on LDAP server." msgstr "" "Une erreur est survenue en mettant à jour cet objet dans l'annuaire LDAP." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:327 -msgid "LSimport: Post data not found or not completed." -msgstr "LSimport : les données transmises sont introuvables ou incomplètes." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:681 +msgid "LSio: Post data not found or not completed." +msgstr "LSio : les données transmises sont introuvables ou incomplètes." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:330 -msgid "LSimport: object type invalid." -msgstr "LSimport : type d'objet invalide." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:684 +msgid "LSio: object type invalid." +msgstr "LSio : type d'objet invalide." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:333 -msgid "LSimport: input/output format %{format} invalid." -msgstr "LSimport : Le format d'entrée/sortie %{format} est invalide." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:687 +msgid "LSio: input/output format %{format} invalid." +msgstr "LSio : Le format d'entrée/sortie %{format} est invalide." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:336 -msgid "LSimport: Fail to initialize input/output driver." -msgstr "LSimport : Impossible d'initialiser le pilote d'entrée/sortie." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:690 +msgid "LSio: Fail to initialize input/output driver." +msgstr "LSio : Impossible d'initialiser le pilote d'entrée/sortie." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:339 -msgid "LSimport: Fail to load objects's data from input file." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:693 +msgid "LSio: Fail to load objects's data from input file." msgstr "" -"LSimport: Impossible de charger les données des objets depuis le fichier " +"LSio: Impossible de charger les données des objets depuis le fichier " "d'import." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:696 +msgid "LSio: Fail to load objects's data to export from LDAP directory." +msgstr "" +"LSio: Impossible de charger les données des objets à exporter depuis " +"l'annuaire LDAP." + +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:699 +msgid "LSio: Fail to export objects's data." +msgstr "LSio: Impossible d'exporter les données des objets." + #: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_pwdHistory.php:76 msgid "Unknown (%{raw_value})" msgstr "Inconnue (%{raw_value})" @@ -541,15 +551,15 @@ msgstr "" msgid "Attribute" msgstr "Attribut" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_mailQuota.php:98 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_valueWithUnit.php:108 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_quota.php:100 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_mailQuota.php:101 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_valueWithUnit.php:126 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_quota.php:102 #: templates/default/LSformElement_mailQuota_field.tpl:17 msgid "Incorrect value" msgstr "Valeur incorrecte" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_mailQuota.php:168 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_labeledValue.php:135 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_mailQuota.php:171 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_labeledValue.php:138 msgid "Invalid value : \"%{value}\"." msgstr "Valeur invalide : \"%{value}\"." @@ -629,15 +639,15 @@ msgstr "" "LSattr_ldap_sambaAcctFlags : drapeau '%{flag}' invalide. Impossible de " "formater la valeur de l'attribut LDAP." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:57 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:83 msgid "Display the full key." msgstr "Affichier la clé en entier." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:79 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:94 msgid "Unknown type" msgstr "Type inconnu" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_valueWithUnit.php:230 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_valueWithUnit.php:234 msgid "" "LSformElement_valueWithUnit : Units configuration data are missing for the " "attribute %{attr}." @@ -846,24 +856,6 @@ msgstr "" "LSattr_html_select_objet : l'objet sélectionné %{name} n'a pas de valeur " "dans son attribut %{attr}, vous ne pouvez pas le sélectionner." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSexport.php:93 -msgid "LSexport: input/output format %{format} invalid." -msgstr "LSimport : Le format d'entrée/sortie %{format} est invalide." - -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSexport.php:96 -msgid "LSexport: Fail to initialize input/output driver." -msgstr "LSexport : Impossible d'initialiser le pilote d'entrée/sortie." - -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSexport.php:99 -msgid "LSexport: Fail to load objects's data to export from LDAP directory." -msgstr "" -"LSexport: Impossible de charger les données des objets à exporter depuis " -"l'annuaire LDAP." - -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSexport.php:102 -msgid "LSexport: Fail to export objects's data." -msgstr "LSexport: Impossible d'exporter les données des objets." - #: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformRule_differentPassword.php:90 msgid "" "LSformRule_differentPassword : Other password attribute is not configured." @@ -2257,17 +2249,17 @@ msgstr "" "Note: Les paramètres/arguments de la commande doivent être placés après " "celle-ci." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LScli.php:779 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LScli.php:804 msgid "LScli : The CLI command '%{command}' already exists." msgstr "LScli : La commande CLI '%{command}' existe déjà." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LScli.php:782 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LScli.php:807 msgid "LScli : The CLI command '%{command}' handler is not callable." msgstr "" "LScli : La fonction de prise en charge de la commande CLI '%{command}' n'est " "pas exécutable." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSioFormatCSV.php:236 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSioFormatCSV.php:247 msgid "LSioFormatCSV: function fputcsv is not available." msgstr "LSioFormatCSV : la fonction fputcsv n'est pas disponible." @@ -2316,7 +2308,7 @@ msgstr "" "LSsearchEntry : formaterFunction %{func} invalide utilisé pour " "l'extraDisplayedColumns %{column}." -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSioFormat.php:144 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSioFormat.php:145 msgid "LSioFormat : IOformat driver %{driver} invalid or unavailable." msgstr "" "LSioFormat : Le pilote d'IOformat %{driver} est invalide ou n'est pas " @@ -2380,17 +2372,17 @@ msgid "My account" msgstr "Mon compte" #: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1149 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1755 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1756 msgid "The object has been partially modified." msgstr "L'objet a été partiellement modifié." #: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1152 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1758 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1759 msgid "The object has been modified successfully." msgstr "L'objet a bien été modifié." #: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1267 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1799 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1800 msgid "%{objectname} has been successfully deleted." msgstr "%{objectname} a bien été supprimé." @@ -2693,6 +2685,12 @@ msgstr "non" msgid "yes" msgstr "oui" +#~ msgid "LSexport: input/output format %{format} invalid." +#~ msgstr "LSimport : Le format d'entrée/sortie %{format} est invalide." + +#~ msgid "LSexport: Fail to initialize input/output driver." +#~ msgstr "LSexport : Impossible d'initialiser le pilote d'entrée/sortie." + #~ msgid "" #~ "LSsession : call function %{func} do not provided from LSaddon %{addon}." #~ msgstr "" diff --git a/src/lang/ldapsaisie.pot b/src/lang/ldapsaisie.pot index dd63e54c..d993c808 100644 --- a/src/lang/ldapsaisie.pot +++ b/src/lang/ldapsaisie.pot @@ -360,65 +360,73 @@ msgstr "" msgid "LSformRule: Unknown rule type %{type}." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:208 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:240 msgid "Failed to set post data on creation form." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:214 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:246 msgid "Error validating creation form." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:219 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:251 msgid "Failed to validate object data." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:226 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:258 msgid "Failed to generate DN for this object." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:240 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:272 msgid "Error creating object on LDAP server." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:246 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:278 msgid "An object already exist on LDAP server with DN %{dn}." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:257 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:289 msgid "" "Failed to load existing object %{dn} from LDAP server. Can't update object." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:265 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:297 msgid "Failed to set post data on update form." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:271 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:303 msgid "Error validating update form." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:281 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:313 msgid "Error updating object on LDAP server." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:327 -msgid "LSimport: Post data not found or not completed." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:681 +msgid "LSio: Post data not found or not completed." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:330 -msgid "LSimport: object type invalid." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:684 +msgid "LSio: object type invalid." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:333 -msgid "LSimport: input/output format %{format} invalid." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:687 +msgid "LSio: input/output format %{format} invalid." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:336 -msgid "LSimport: Fail to initialize input/output driver." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:690 +msgid "LSio: Fail to initialize input/output driver." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSimport.php:339 -msgid "LSimport: Fail to load objects's data from input file." +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:693 +msgid "LSio: Fail to load objects's data from input file." +msgstr "" + +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:696 +msgid "LSio: Fail to load objects's data to export from LDAP directory." +msgstr "" + +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSio.php:699 +msgid "LSio: Fail to export objects's data." msgstr "" #: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSattr_ldap_pwdHistory.php:76 @@ -457,15 +465,15 @@ msgstr "" msgid "Attribute" msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_mailQuota.php:98 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_valueWithUnit.php:108 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_quota.php:100 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_mailQuota.php:101 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_valueWithUnit.php:126 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_quota.php:102 #: templates/default/LSformElement_mailQuota_field.tpl:17 msgid "Incorrect value" msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_mailQuota.php:168 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_labeledValue.php:135 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_mailQuota.php:171 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_labeledValue.php:138 msgid "Invalid value : \"%{value}\"." msgstr "" @@ -539,15 +547,15 @@ msgid "" "attribute value." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:57 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:83 msgid "Display the full key." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:79 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_ssh_key.php:94 msgid "Unknown type" msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_valueWithUnit.php:230 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformElement_valueWithUnit.php:234 msgid "" "LSformElement_valueWithUnit : Units configuration data are missing for the " "attribute %{attr}." @@ -725,22 +733,6 @@ msgid "" "value, you can't select it." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSexport.php:93 -msgid "LSexport: input/output format %{format} invalid." -msgstr "" - -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSexport.php:96 -msgid "LSexport: Fail to initialize input/output driver." -msgstr "" - -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSexport.php:99 -msgid "LSexport: Fail to load objects's data to export from LDAP directory." -msgstr "" - -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSexport.php:102 -msgid "LSexport: Fail to export objects's data." -msgstr "" - #: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSformRule_differentPassword.php:90 msgid "" "LSformRule_differentPassword : Other password attribute is not configured." @@ -1914,15 +1906,15 @@ msgid "" "Note: Command's parameter/argument must be place after the command." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LScli.php:779 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LScli.php:804 msgid "LScli : The CLI command '%{command}' already exists." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LScli.php:782 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LScli.php:807 msgid "LScli : The CLI command '%{command}' handler is not callable." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSioFormatCSV.php:236 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSioFormatCSV.php:247 msgid "LSioFormatCSV: function fputcsv is not available." msgstr "" @@ -1969,7 +1961,7 @@ msgid "" "%{column}." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSioFormat.php:144 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/class/class.LSioFormat.php:145 msgid "LSioFormat : IOformat driver %{driver} invalid or unavailable." msgstr "" @@ -2029,17 +2021,17 @@ msgid "My account" msgstr "" #: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1149 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1755 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1756 msgid "The object has been partially modified." msgstr "" #: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1152 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1758 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1759 msgid "The object has been modified successfully." msgstr "" #: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1267 -#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1799 +#: /home/brenard/dev/ldapsaisie_clean3/src/includes/routes.php:1800 msgid "%{objectname} has been successfully deleted." msgstr "" diff --git a/src/templates/default/export.tpl b/src/templates/default/export.tpl index 928548b4..5200f339 100644 --- a/src/templates/default/export.tpl +++ b/src/templates/default/export.tpl @@ -4,6 +4,7 @@
+
diff --git a/src/templates/default/import.tpl b/src/templates/default/import.tpl index 8759285a..53d303a1 100644 --- a/src/templates/default/import.tpl +++ b/src/templates/default/import.tpl @@ -5,7 +5,7 @@
- +
@@ -42,22 +42,22 @@ {if !empty($result.errors)}

{tr msg='Errors'}

{foreach $result.errors as $error} -

Object {$error@iteration}

-
+

Object {$error@iteration}

+
{if !empty($error.errors.globals)} -
    +
      {foreach $error.errors.globals as $e}
    • {$e}
    • {/foreach}
    {/if} -
      +
        {foreach $error.data as $key => $val}
      • {$key|escape:"htmlall"} : - {if empty($val)}{tr msg='No value'}{else}{LSimport_implodeValues values=$val}{/if} + {if empty($val)}{tr msg='No value'}{else}{LSio_implodeValues values=$val}{/if} {if isset($error.errors.attrs[$key])} -
          +
            {foreach $error.errors.attrs.$key as $e}
          • {$e|escape:"htmlall"}
          • {/foreach} @@ -69,7 +69,7 @@ {if !in_array($a,$error.data)}
          • {$a|escape:"htmlall"} : -
              +
                {foreach $es as $e}
              • {$e|escape:"htmlall"}
              • {/foreach} @@ -82,8 +82,8 @@ {/foreach} {/if} -

                {tr msg='Imported objects'} ({count($result.imported)})

                -
                  +

                  {tr msg='Imported objects'} ({count($result.imported)})

                  + {if !empty($result.updated)} -

                  {tr msg='Updated objects'} ({count($result.updated)})

                  -
                    +

                    {tr msg='Updated objects'} ({count($result.updated)})

                    +