Changeset 3957
- Timestamp:
- 05/08/07 13:11:54 (6 years ago)
- Files:
-
- plugins/sfOpenOfficePlugin/config/app.yml (modified) (2 diffs)
- plugins/sfOpenOfficePlugin/config/ooffice-unix.sh (modified) (3 diffs)
- plugins/sfOpenOfficePlugin/data/tasks/sfPakeOpenOffice.php (modified) (5 diffs)
- plugins/sfOpenOfficePlugin/lib/sfOpenOfficeDocumentView.class.php (modified) (1 diff)
- plugins/sfOpenOfficePlugin/modules/sfOpenOfficeSetup/templates/secondSuccess.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfOpenOfficePlugin/config/app.yml
r3901 r3957 10 10 odt: 11 11 pdf: { name: writer_pdf_Export } 12 doc: { name: M sWord 97 }12 doc: { name: MS Word 97 } 13 13 14 14 … … 23 23 xls: { content-type: application/vnd.ms-excel } 24 24 doc: { content-type: application/vnd.ms-word } 25 26 plugins/sfOpenOfficePlugin/config/ooffice-unix.sh
r3930 r3957 1 1 #!/bin/bash 2 2 3 echo "Running OO.o ($1 - $2 - $3 - $4)" 3 # $1 = plugin config path 4 # $2 = execution mode (setup, debug, release) 4 5 6 ### SETUP ### 7 # $3 = document with convertion macros 8 9 ### DEBUG and RELEASE ### 10 # $3 = input document 11 # $4 = output document 12 # $5 = filter for convertion 13 14 15 # load plugin environment 5 16 source $1/ooffice-unix-env.sh 6 17 18 # load plugin environment 7 19 if [ -x $1/../../../config/ooffice-unix-env.sh ] 8 20 then … … 10 22 fi 11 23 12 if [ $2 = "true" ] 24 25 if [ $2 = "setup" ] 13 26 then 14 27 … … 17 30 else 18 31 32 if [ $2 = "debug" ] 33 then 34 35 ${SOFFICE} -display :0.0 -norestore -invisible -headless -nologo "macro:///Standard.Convert.ConvertTo(\"$3\",\"$4\",\"$5\")" 19 36 20 echo ${XVFBRUN} -a ${SOFFICE} -norestore -invisible -headless -nologo "macro:///Standard.Convert.ConvertTo(\"$3\",\"$4\",\"$5\")" 21 #${XVFBRUN} -a ${SOFFICE} -norestore -invisible -headless -nologo "macro:///Standard.Convert.ConvertTo(\"$3\",\"$4\",\"$5\")" 22 ${SOFFICE} -display :0.0 -norestore -invisible -headless -nologo "macro:///Standard.Convert.ConvertTo(\"$3\",\"$4\",\"$5\")" 37 else 38 # release 39 ${XVFBRUN} -a ${SOFFICE} -norestore -invisible -headless -nologo "macro:///Standard.Convert.ConvertTo(\"$3\",\"$4\",\"$5\")" 40 fi 23 41 24 42 fi plugins/sfOpenOfficePlugin/data/tasks/sfPakeOpenOffice.php
r3931 r3957 32 32 } 33 33 34 if (is_dir(sfConfig::get('sf_apps_dir') . DIRECTORY_SEPARATOR . $app))35 {36 $app_dir = sfConfig::get('sf_apps_dir') . DIRECTORY_SEPARATOR . $app; 37 }38 elseif (is_dir(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . $app))39 {34 // Assume the document is in an application 35 $app_dir = sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . sfConfig::get('sf_apps_dir_name') . DIRECTORY_SEPARATOR . $app; 36 37 if (!is_dir($app_dir)) 38 { 39 // Maybe its in a plugin 40 40 $app_dir = sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . $app; 41 } 42 else43 {44 throw new Exception("The application or plugin $app doesn't exists");45 }46 47 if (is_dir($app_dir . DIRECTORY_SEPARATOR . sfConfig::get('sf_app_module_dir_name') . DIRECTORY_SEPARATOR . $module))48 { 49 $moduleDir = $app_dir . DIRECTORY_SEPARATOR . sfConfig::get('sf_app_module_dir_name') . DIRECTORY_SEPARATOR . $module;50 } 51 else41 42 if(!is_dir($app_dir)) 43 { 44 // something failed 45 throw new Exception("The application or plugin $app doesn't exists"); 46 } 47 } 48 49 $moduleDir = $app_dir . DIRECTORY_SEPARATOR . sfConfig::get('sf_app_module_dir_name') . DIRECTORY_SEPARATOR . $module; 50 51 if (!is_dir($moduleDir)) 52 52 { 53 53 throw new Exception("The module $module doesn't exists"); 54 54 } 55 56 // load plugin config (sfLoad::loadPluginConfig fails for some reason. maybe because there is no environment or application defined) 57 include(sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . 'sfOpenOfficePlugin' . DIRECTORY_SEPARATOR . sfConfig::get('sf_config_dir_name') . DIRECTORY_SEPARATOR . 'config.php'); 55 58 56 59 $name = $matches[1]; … … 60 63 $viewsPath = $modulePath . sfConfig::get('sf_app_module_view_dir_name') . DIRECTORY_SEPARATOR; 61 64 $documentsPath = $modulePath . sfConfig::get('sf_app_module_document_dir_name') . DIRECTORY_SEPARATOR; 65 $documentDir = $documentsPath . $matches[1]; 62 66 $documentPath = $documentsPath . $matches[0]; 63 67 … … 72 76 73 77 // lets clear things up like unupdated files 74 pake_remove( $documentPath);78 pake_remove(pakeFinder::type('any')->in($documentDir), ''); 75 79 76 80 // OpenOffice documents are zip files … … 90 94 // as such if the replacement is removed then we are "forcing" a render of the object 91 95 //pake_remove($documentPath, ''); 96 if(file_exists($documentDir . DIRECTORY_SEPARATOR . 'ObjectReplacements')) 97 { 98 pake_echo('Removing Object Replacements'); 99 pake_remove(pakeFinder::type('any')->in($documentDir . DIRECTORY_SEPARATOR . 'ObjectReplacements'), ''); 100 unlink($documentDir . DIRECTORY_SEPARATOR . 'ObjectReplacements'); 101 } 92 102 93 103 // This is to avoid anoying warnings of DomDocument::load … … 146 156 $documentClass = $name. 'SuccessView'; 147 157 148 file_put_contents($viewFile, "<?php\n\nclass $documentClass extends sfOpenOfficeDocumentView\n{\n public function getFileExtension() {\n return '$extension';\n }\n}\n"); 158 if (!file_exists($viewFile)) { 159 file_put_contents($viewFile, "<?php\n\nclass $documentClass extends sfOpenOfficeDocumentView\n{\n public function getFileExtension() {\n return '$extension';\n }\n}\n"); 160 } 149 161 150 162 pake_echo_action('chmod 0777', $documentsPath); plugins/sfOpenOfficePlugin/lib/sfOpenOfficeDocumentView.class.php
r3902 r3957 147 147 148 148 $ret = shell_exec(sfConfig::get('sf_plugin_ooffice_script') . ' ' . 149 sfConfig::get('sf_plugin_ooffice_config_dir') . " false \"$generatedPath\" \"$outputPath\" \"$filter\"");149 sfConfig::get('sf_plugin_ooffice_config_dir') . " release \"$generatedPath\" \"$outputPath\" \"$filter\""); 150 150 151 151 if ( file_exists($outputPath) ) plugins/sfOpenOfficePlugin/modules/sfOpenOfficeSetup/templates/secondSuccess.php
r3891 r3957 13 13 <dd> 14 14 <code> 15 <?php shell_exec(sfConfig::get('sf_plugin_ooffice_script').' '.sfConfig::get('sf_plugin_ooffice_config_dir').' true'.sfConfig::get('sf_plugin_ooffice_macros').' 2>&1') ?>15 <?php shell_exec(sfConfig::get('sf_plugin_ooffice_script').' '.sfConfig::get('sf_plugin_ooffice_config_dir').' setup '.sfConfig::get('sf_plugin_ooffice_macros').' 2>&1') ?> 16 16 </code> 17 17 </dd>