Development

Changeset 3957

You must first sign up to be able to contribute.

Changeset 3957

Show
Ignore:
Timestamp:
05/08/07 13:11:54 (6 years ago)
Author:
promag
Message:

adding support for debug. task improvement (detected strange bug on macro install)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfOpenOfficePlugin/config/app.yml

    r3901 r3957  
    1010      odt:  
    1111        pdf:    { name: writer_pdf_Export } 
    12         doc:    { name: Ms Word 97 } 
     12        doc:    { name: MS Word 97 } 
    1313 
    1414     
     
    2323      xls:      { content-type: application/vnd.ms-excel } 
    2424      doc:      { content-type: application/vnd.ms-word } 
    25  
    26  
  • plugins/sfOpenOfficePlugin/config/ooffice-unix.sh

    r3930 r3957  
    11#!/bin/bash 
    22 
    3 echo "Running OO.o ($1 - $2 - $3 - $4)" 
     3# $1 = plugin config path 
     4# $2 = execution mode (setup, debug, release) 
    45 
     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  
    516source $1/ooffice-unix-env.sh 
    617 
     18# load plugin environment  
    719if [ -x $1/../../../config/ooffice-unix-env.sh ] 
    820then 
     
    1022fi 
    1123 
    12 if [ $2 = "true" ] 
     24 
     25if [ $2 = "setup" ] 
    1326then 
    1427 
     
    1730else 
    1831 
     32if [ $2 = "debug" ] 
     33then 
     34 
     35  ${SOFFICE} -display :0.0 -norestore -invisible -headless -nologo "macro:///Standard.Convert.ConvertTo(\"$3\",\"$4\",\"$5\")" 
    1936   
    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\")" 
     37else 
     38  # release 
     39  ${XVFBRUN} -a ${SOFFICE} -norestore -invisible -headless -nologo "macro:///Standard.Convert.ConvertTo(\"$3\",\"$4\",\"$5\")" 
     40fi 
    2341 
    2442fi 
  • plugins/sfOpenOfficePlugin/data/tasks/sfPakeOpenOffice.php

    r3931 r3957  
    3232  } 
    3333 
    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 
    4040    $app_dir = sfConfig::get('sf_plugins_dir') . DIRECTORY_SEPARATOR . $app; 
    41   } 
    42   else 
    43  
    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   else 
     41 
     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)) 
    5252  { 
    5353    throw new Exception("The module $module doesn't exists"); 
    5454  } 
     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'); 
    5558 
    5659  $name      = $matches[1]; 
     
    6063  $viewsPath     = $modulePath    . sfConfig::get('sf_app_module_view_dir_name') . DIRECTORY_SEPARATOR; 
    6164  $documentsPath = $modulePath    . sfConfig::get('sf_app_module_document_dir_name') . DIRECTORY_SEPARATOR; 
     65  $documentDir  = $documentsPath . $matches[1]; 
    6266  $documentPath  = $documentsPath . $matches[0]; 
    6367 
     
    7276 
    7377  // lets clear things up like unupdated files 
    74   pake_remove($documentPath); 
     78  pake_remove(pakeFinder::type('any')->in($documentDir), ''); 
    7579 
    7680  // OpenOffice documents are zip files 
     
    9094  // as such if the replacement is removed then we are "forcing" a render of the object 
    9195  //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  } 
    92102 
    93103  // This is to avoid anoying warnings of DomDocument::load 
     
    146156  $documentClass = $name. 'SuccessView'; 
    147157 
    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  } 
    149161 
    150162  pake_echo_action('chmod 0777', $documentsPath); 
  • plugins/sfOpenOfficePlugin/lib/sfOpenOfficeDocumentView.class.php

    r3902 r3957  
    147147     
    148148    $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\""); 
    150150 
    151151    if ( file_exists($outputPath) ) 
  • plugins/sfOpenOfficePlugin/modules/sfOpenOfficeSetup/templates/secondSuccess.php

    r3891 r3957  
    1313  <dd> 
    1414    <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') ?> 
    1616    </code> 
    1717  </dd>