".$msg["ontology_skos_admin_import_info"]."
";
switch ($action) {
case 'beforeupload':
if(is_array($_FILES['userfile']['tmp_name']) && count($_FILES['userfile']['tmp_name']) && trim($_FILES['userfile']['tmp_name'][0])){
$files=array();
foreach ( $_FILES['userfile']['tmp_name'] as $key => $tmp_file ) {
$to_file = $base_path.'/temp/'.basename($tmp_file);
$from_file = $_FILES['userfile']['name'][$key];
if ($to_file=="") {
printf ($msg[503],$from_file); /* wrong permissions to copy the file %s ... Contact your admin... */
break;
}
if (!@move_uploaded_file($tmp_file,$to_file)) {
printf ($msg[504],$from_file); /* Fail to copy %s, Contact your admin... */
break;
}
$files[]=array("name"=>$from_file,"location"=>$to_file);
}
echo "
".$msg["ontology_skos_admin_import_beforeupload_files"]."
"; /* File transfered, Loading is about to go on */
print "";
print "";
break;
}
//Si rien n'a été sélectionné on réafiche la page de chargement
print $form_download_files;
case 'afterupload':
$files=unserialize(urldecode($files_post));
if($logs_serialize){
$logs_imports=unserialize(urldecode($logs_serialize));
}else{
$logs_imports=array();
}
$file=array_shift($files);
$p = new sparql();
$res=$p->load_file($file["location"]);
if(!$res){
$logs_imports[]=array("result" => "ko", "msg" => $msg["ontology_skos_admin_import_error"].$file["name"]);
}else{
$logs_imports[]=array("result" => "ok", "msg" => $res.$msg["ontology_skos_admin_import_ok"].$file["name"]);
}
unlink($file["location"]);
if(count($files)){
echo "
";
printf ($msg["ontology_skos_admin_import_afterupload_files"], count($files), $count_files);
echo "
";
print "";
print "";
break;
}else{
print "";
print "";
break;
}
break;
case "load":
$logs_imports=unserialize(urldecode($logs_serialize));
echo "
";
printf ($msg["ontology_skos_admin_import_load_files"],$count_files);
echo "
";
foreach ( $logs_imports as $key => $value ) {
if($value["result"] == "ok"){
echo "
".htmlentities($value["msg"],ENT_QUOTES,$charset)."
";
unset($logs_imports[$key]);
}
}
if(count($logs_imports)){
echo "
";
foreach ( $logs_imports as $value ) {
echo "".htmlentities($value["msg"],ENT_QUOTES,$charset)."
";
}
}
break;
default:
print $form_download_files;
break;
}
?>