[svn r14979] oogie : accents are now displayed in slide name (FS#2477)

skala
Eric Marguin 17 years ago
parent 1b003b05ef
commit c5b8844ba6
  1. BIN
      main/inc/lib/ppt2png/OogieDocumentConverter.class
  2. 8
      main/inc/lib/ppt2png/OogieDocumentConverter.java
  3. 5
      main/newscorm/openoffice_document.class.php
  4. 36
      main/newscorm/openoffice_presentation.class.php
  5. 2
      main/newscorm/openoffice_text_document.class.php

@ -142,13 +142,13 @@ public class OogieDocumentConverter extends AbstractDokeosDocumentConverter {
slidename = slidename.replaceAll(" ", "_");
slidename = slidename.replaceAll("\n", "_");
slidename = slidename.replaceAll("__", "_");
slidename = slidename.replaceAll("\\W", "_");
slidename = slidename.replaceAll("__", "_");
//slidename = slidename.replaceAll("\\W", "_");
//slidename = slidename.replaceAll("__", "_");
for(int j=0 ; j<slidename.length() ; j++)
{
char currentChar = slidename.charAt(j);
if(currentChar==' ')
if(currentChar=='_')
{
nbSpaces++;
}
@ -159,7 +159,7 @@ public class OogieDocumentConverter extends AbstractDokeosDocumentConverter {
formatedSlidename += slidename.charAt(j);
}
slidename = formatedSlidename.toLowerCase();
slidename = StringOperation.sansAccent(slidename);
//slidename = StringOperation.sansAccent(slidename);
}
int j=1;
String slidenamebackup = slidename;

@ -84,6 +84,7 @@ abstract class OpenofficeDocument extends learnpath {
$shell = exec($cmd, $files, $return);
if($return != 0) { //if the java application returns an error code
DocumentManager::delete_document($_course, $dir_name, $this->base_work_dir);
return false;
@ -96,9 +97,9 @@ abstract class OpenofficeDocument extends learnpath {
// call to the function implemented by child following action_after_conversion parameter
switch ($action_after_conversion)
{
case 'make_lp':$this -> make_lp($files);
case 'make_lp':$this -> make_lp();
break;
case 'add_docs_to_visio':$this -> add_docs_to_visio($files);
case 'add_docs_to_visio':$this -> add_docs_to_visio();
break;
}

@ -23,17 +23,28 @@ class OpenofficePresentation extends OpenofficeDocument {
}
function make_lp($files = array()) {
function make_lp() {
global $_course;
$previous = 0;
$i = 0;
if(!is_dir($this->base_work_dir.$this->created_dir))
return false;
$files = scandir($this->base_work_dir.$this->created_dir);
foreach($files as $file){
$i++;
if($file=='.' || $file=='..')
continue;
$i++;
$file = utf8_decode($file); //filename has been written in java, so unicode
// add the png to documents
$document_id = add_document($_course,$this->created_dir.'/'.$file,'file',filesize($this->base_work_dir.$this->created_dir.'/'.$file),$file);
$document_id = add_document($_course,$this->created_dir.'/'.urlencode($file),'file',filesize($this->base_work_dir.$this->created_dir.'/'.$file),$file);
api_item_property_update($_course,TOOL_DOCUMENT,$document_id,'DocumentAdded',$_SESSION['_uid'],0,0);
@ -45,11 +56,11 @@ class OpenofficePresentation extends OpenofficeDocument {
'<html>
<head></head>
<body>
<img src="'.api_get_path(REL_COURSE_PATH).$_course['path'].'/document/'.$this->created_dir.'/'.$file.'" />
<img src="'.api_get_path(REL_COURSE_PATH).$_course['path'].'/document/'.$this->created_dir.'/'.utf8_encode($file).'" />
</body>
</html>');
fclose($fp);
$document_id = add_document($_course,$this->created_dir.'/'.$html_file,'file',filesize($this->base_work_dir.$this->created_dir.'/'.$html_file),$html_file);
$document_id = add_document($_course,$this->created_dir.'/'.urlencode($html_file),'file',filesize($this->base_work_dir.$this->created_dir.'/'.$html_file),$html_file);
if ($document_id){
//put the document in item_property update
@ -60,6 +71,7 @@ class OpenofficePresentation extends OpenofficeDocument {
{
$slide_name = substr($infos['basename'],0,strrpos($infos['basename'],'.'));
$slide_name = str_replace('_',' ',$slide_name);
$slide_name = ucfirst($slide_name);
}
else
{
@ -92,11 +104,19 @@ class OpenofficePresentation extends OpenofficeDocument {
global $_course;
/* Add Files */
foreach($files as $f)
{
$did = add_document($_course, $this->created_dir.'/'.$f, 'file', filesize($this->base_work_dir.$this->created_dir.'/'.$f), $f);
$files = scandir($this->base_work_dir.$this->created_dir);
foreach($files as $file){
if($file=='.' || $file=='..')
continue;
$file = utf8_decode($file);
$did = add_document($_course, $this->created_dir.'/'.urlencode($file), 'file', filesize($this->base_work_dir.$this->created_dir.'/'.$file), $file);
if ($did)
api_item_property_update($_course, TOOL_DOCUMENT, $did, 'DocumentAdded', $_SESSION['_uid'], 0, NULL);
}
}

@ -37,7 +37,7 @@ class OpenOfficeTextDocument extends OpenofficeDocument {
* @param array The files that will compose the generated learning path. Unused so far.
* @return boolean False if file does not exit. Nothing otherwise.
*/
function make_lp($files=array())
function make_lp()
{
global $_course;

Loading…
Cancel
Save