diff --git a/main/admin/configure_extensions.php b/main/admin/configure_extensions.php index 4087e12649..30247db465 100644 --- a/main/admin/configure_extensions.php +++ b/main/admin/configure_extensions.php @@ -153,6 +153,12 @@ if(isset($_POST['activeExtension'])){ WHERE variable="service_ppt2lp" AND subkey="path_to_lzx"'; api_sql_query($sql, __FILE__, __LINE__); + + $sql = 'UPDATE '.$tbl_settings_current.' SET + selected_value="'.addslashes($_POST['size']).'" + WHERE variable="service_ppt2lp" + AND subkey="size"'; + api_sql_query($sql, __FILE__, __LINE__); break; } @@ -325,6 +331,14 @@ Display::display_header($nameTool); $form -> addElement('text', 'ftp_password', get_lang('FtpPassword')); $form -> addElement('html','

'); $form -> addElement('text', 'path_to_lzx', get_lang('PathToLzx')); + $form -> addElement('html','

'); + $options = array( + '540x405'=>'540x405', + '640x480'=>'640x480', + '800x600'=>'800x600', + '1000x750'=>'1000x750' + ); + $form -> addElement('select', 'size', get_lang('SlideSize'), $options); $form -> addElement('hidden', 'extension_code', 'ppt2lp'); $defaults = array(); diff --git a/main/inc/lib/ppt2png/DocumentConverter.class b/main/inc/lib/ppt2png/DocumentConverter.class index b546242542..e4d41a4a0f 100644 Binary files a/main/inc/lib/ppt2png/DocumentConverter.class and b/main/inc/lib/ppt2png/DocumentConverter.class differ diff --git a/main/inc/lib/ppt2png/DocumentConverter.java b/main/inc/lib/ppt2png/DocumentConverter.java index 9b6b494c7b..33b6949620 100755 --- a/main/inc/lib/ppt2png/DocumentConverter.java +++ b/main/inc/lib/ppt2png/DocumentConverter.java @@ -49,20 +49,25 @@ public class DocumentConverter { public static void main(String args[]) { String cnx, ftpuser, host, port, url, ftpPasswd, destinationFolder, remoteFolderFullPath, remoteFolder; + int width, height; - try { + try { host = args[0]; port = args[1]; url = args[2]; destinationFolder = args[3]; - if(args.length == 6){ - ftpuser = args[4]; - ftpPasswd = args[5]; + width = Integer.parseInt(args[4]); + height = Integer.parseInt(args[5]); + if(args.length == 8){ + ftpuser = args[6]; + ftpPasswd = args[7]; } else{ ftpuser = ""; ftpPasswd = ""; } + + if(host.equals("localhost")){ String prefix = "file://"; if(url.charAt(0)!='/') @@ -185,9 +190,9 @@ public class DocumentConverter { } filterDatas[0].Name = "PixelWidth"; - filterDatas[0].Value = new Integer(540); + filterDatas[0].Value = new Integer(width); filterDatas[1].Name = "PixelHeight"; - filterDatas[1].Value = new Integer(405); + filterDatas[1].Value = new Integer(height); filterDatas[2].Name = "LogicalWidth"; filterDatas[2].Value = new Integer(2000); filterDatas[3].Name = "LogicalHeight"; diff --git a/main/install/dokeos_main.sql b/main/install/dokeos_main.sql index cfcde9b795..be98529862 100644 --- a/main/install/dokeos_main.sql +++ b/main/install/dokeos_main.sql @@ -491,7 +491,8 @@ INSERT INTO `settings_current` VALUES (80, 'service_ppt2lp', 'user', 'textfield', NULL, NULL, 'UserOnHost', NULL, NULL, NULL), (81, 'service_ppt2lp', 'ftp_password', 'textfield', NULL, NULL, 'FtpPassword', NULL, NULL, NULL), (82, 'service_ppt2lp', 'path_to_lzx', 'textfield', NULL, NULL, '', NULL, NULL, NULL), -(83, 'wcag_anysurfer_public_pages', NULL, 'radio','Platform','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL); +(84, 'service_ppt2lp', 'size', 'radio', '540x405', NULL, '', NULL, NULL, NULL), +(85, 'wcag_anysurfer_public_pages', NULL, 'radio','Platform','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL); UNLOCK TABLES; diff --git a/main/newscorm/presentation.class.php b/main/newscorm/presentation.class.php index 8417e3291c..53962d52ce 100644 --- a/main/newscorm/presentation.class.php +++ b/main/newscorm/presentation.class.php @@ -78,15 +78,15 @@ class presentation extends learnpath { { $classpath = str_replace(':',';',$classpath); } - + list($slide_width, $slide_height) = explode('x',api_get_setting('service_ppt2lp','size')); if(strpos($_ENV['OS'],'Windows') !== false) - { - $cmd = 'cd '.str_replace('/','\\',api_get_path(SYS_PATH)).'main/inc/lib/ppt2png && java '.$classpath.' DocumentConverter '.api_get_setting('service_ppt2lp','host').' 2002'.' "'.$file.'" "'.$base_work_dir.$created_dir.'"'.' '.api_get_setting('service_ppt2lp','user').' '.api_get_setting('service_ppt2lp','ftp_password'); + { + $cmd = 'cd '.str_replace('/','\\',api_get_path(SYS_PATH)).'main/inc/lib/ppt2png && java '.$classpath.' DocumentConverter '.api_get_setting('service_ppt2lp','host').' 2002'.' "'.$file.'" "'.$base_work_dir.$created_dir.'"'.' '.$slide_width.' '.$slide_height.' '.api_get_setting('service_ppt2lp','user').' '.api_get_setting('service_ppt2lp','ftp_password'); } else { - $cmd = 'cd '.api_get_path(SYS_PATH).'main/inc/lib/ppt2png && java '.$classpath.' DocumentConverter '.api_get_setting('service_ppt2lp','host').' 2002'.' "'.$file.'" "'.$base_work_dir.$created_dir.'"'.' '.api_get_setting('service_ppt2lp','user').' '.api_get_setting('service_ppt2lp','ftp_password'); + $cmd = 'cd '.api_get_path(SYS_PATH).'main/inc/lib/ppt2png && java '.$classpath.' DocumentConverter '.api_get_setting('service_ppt2lp','host').' 2002'.' "'.$file.'" "'.$base_work_dir.$created_dir.'"'.' '.$slide_width.' '.$slide_height.' '.api_get_setting('service_ppt2lp','user').' '.api_get_setting('service_ppt2lp','ftp_password'); } chmod ($base_work_dir.$created_dir,0777); @@ -108,16 +108,27 @@ class presentation extends learnpath { $first_item = 0; foreach($files as $file){ $i++; - $document_id = add_document($_course,$created_dir.'/'.$file,'file',filesize($base_work_dir.$created_dir.'/'.$file),$file); - if ($document_id){ + + // create an html file + $html_file = $file.'.html'; + $fp = fopen($base_work_dir.$created_dir.'/'.$html_file, 'w+'); + + fwrite($fp, + ' + + + + + '); + fclose($fp); + $document_id = add_document($_course,$created_dir.'/'.$html_file,'file',filesize($base_work_dir.$created_dir.'/'.$html_file),$html_file); + if ($document_id){ + //put the document in item_property update api_item_property_update($_course,TOOL_DOCUMENT,$document_id,'DocumentAdded',$_SESSION['_uid'],$to_group_id,$to_user_id); $infos = pathinfo($file); - //$slide_name = substr($infos['basename'],0,strpos($infos['basename'],'.')); - $slide_name = 'slide'.str_repeat('0',2-strlen($i)).$i; - $previous = learnpath::add_item(0, $previous, 'document', $document_id, $slide_name, ''); if($first_item == 0){ $first_item = $previous;