Documentation TYPO3 par Ameos

class.tx_kickstarter_section_sv.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2001-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00031 require_once(t3lib_extMgm::extPath("kickstarter")."class.tx_kickstarter_sectionbase.php");
00032  
00033 class tx_kickstarter_section_sv extends tx_kickstarter_sectionbase {
00034   var $sectionID = 'sv';
00035   
00039         function render_wizard() {
00040                 $lines=array();
00041 
00042                 $action = explode(':',$this->wizard->modData['wizAction']);
00043                 if ($action[0]=='edit') {
00044                         $this->regNewEntry($this->sectionID,$action[1]);
00045 
00046                         $lines = $this->catHeaderLines($lines,$this->sectionID,$this->wizard->options[$this->sectionID],'<strong>Edit Service #'.$action[1].'</strong>',$action[1]);
00047                         $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]];
00048                         $ffPrefix='['.$this->sectionID.']['.$action[1].']';
00049 
00050                         if (!$this->wizard->EMmode && $this->wizard->saveKey)   {
00051                                 $extKeyRec = $this->wizard->pObj->getExtKeyRecord($this->saveKey);
00052                         }
00053 
00054                                 // Title
00055                         $subContent='<strong>Title:</strong><br />'.
00056                                 $this->renderStringBox($ffPrefix.'[title]',$piConf['title']?$piConf['title']:$extKeyRec['title']);
00057                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00058 
00059                                 // Description
00060                         $subContent='<strong>Description:</strong><br />'.
00061                                 $this->renderStringBox($ffPrefix.'[description]',$piConf['description']?$piConf['description']:$extKeyRec['description']);
00062                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00063 
00064                         $lines[]='<tr><td>&nbsp;</td><td></td></tr>';
00065 
00066                                 // Type
00067                         $subContent='<strong>Service type:</strong><br />'.
00068                                 $this->renderStringBox($ffPrefix.'[type]',$piConf['type']?$piConf['type']:$extKeyRec['type']).'<br />'.
00069                                 'Enter here the key to define which type of service this should be.<br />Examples: "textExtract", "metaExtract".';
00070                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00071 
00072                                 // SubType
00073                         $subContent='<strong>Sub type(s) (comma list):</strong><br />'.
00074                                 $this->renderStringBox($ffPrefix.'[subtype]',$piConf['subtype']?$piConf['subtype']:$extKeyRec['subtype']).'<br />'.
00075                                 'Possible subtypes are defined by the service type.<br />You have read the service type documentation.<br />Example: using subtypes for file types (doc, txt, pdf, ...) the service might work for.';
00076                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00077 
00078                         $lines[]='<tr><td>&nbsp;</td><td></td></tr>';
00079 
00080                                 // Priority
00081                         $optValues = Array(
00082                                 '50' => 'default (50)',
00083                                 '10' => 'very low (10)',
00084                                 '20' => 'low (20)',
00085                                 '40' => 'bit lower (40)',
00086                                 '60' => 'bit higher (60)',
00087                                 '80' => 'high (80)',
00088                                 '100' => 'Very high (100)',
00089                         );
00090                         $subContent='<strong>Priority:</strong><br />'.
00091                                 $this->renderSelectBox($ffPrefix.'[priority]',$piConf['priority'],$optValues).'<br />'.
00092                                 '50 = medium priority. <br />The priority of services can be changed by admin configuration.';
00093                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00094 
00095                                 // Quality
00096                         $quality = $piConf['quality']?$piConf['quality']:$extKeyRec['quality'];
00097                         $quality = $quality ? $quality : '50';
00098                         $subContent='<strong>Quality:</strong><br />'.
00099                                 $this->renderStringBox($ffPrefix.'[quality]',$quality).'<br />'.
00100                                 'The numbering of the quality is defined by the service type.<br />You have read the service type documentation.<br />The default quality range is 0-100.';
00101                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00102 
00103 
00104                                 // OS Dependencies
00105                         $optValues = Array(
00106                                 '' => 'no special dependency',
00107                                 'unix' => 'Unix only',
00108                                 'win' => 'Windows only',
00109 //                              'unix,win' => 'Unix or Windows',
00110                         );
00111 
00112                         $lines[]='<tr><td>&nbsp;</td><td></td></tr>';
00113 
00114                         $subContent='<strong>Operating System dependency:</strong><br />'.
00115                                 $this->renderSelectBox($ffPrefix.'[os]',$piConf['os'],$optValues);
00116                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00117 
00118                                 // Exec dependencies
00119                         $subContent='<strong>External program(s) (comma list):</strong><br />'.
00120                                 $this->renderStringBox($ffPrefix.'[exec]',$piConf['exec']).'<br />'.
00121                                 'Program(s) needed to run this service (eg. "perl").';
00122                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00123                 }
00124 
00125                 /* HOOK: Place a hook here, so additional output can be integrated */
00126                 if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_services'])) {
00127                   foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_services'] as $_funcRef) {
00128                     $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this);
00129                   }
00130                 }
00131 
00132                 $content = '<table border="0" cellpadding="2" cellspacing="2">'.implode('',$lines).'</table>';
00133                 return $content;
00134         }
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00146         function render_extPart($k,$config,$extKey) {
00147                 $WOP='[sv]['.$k.']';
00148                 $cN = $this->returnName($extKey,'class','sv'.$k);
00149                 $pathSuffix = 'sv'.$k.'/';
00150 
00151                 $this->wizard->ext_tables[]=$this->sPS('
00152                         '.$this->WOPcomment('WOP:'.$WOP.'[type]').'
00153                         t3lib_extMgm::addService($_EXTKEY,  \''.$config['type'].'\' /* sv type */,  \''.$cN.'\' /* sv key */,
00154                                         array(
00155 
00156                                                 \'title\' => \''.addslashes($config['title']).'\','.$this->WOPcomment(' WOP:'.$WOP.'[title]').'
00157                                                 \'description\' => \''.addslashes($config['description']).'\','.$this->WOPcomment('     WOP:'.$WOP.'[description]').'
00158 
00159                                                 \'subtype\' => \''.$config['subtype'].'\','.$this->WOPcomment(' WOP:'.$WOP.'[subtype]').'
00160 
00161                                                 \'available\' => TRUE,
00162                                                 \'priority\' => '.$config['priority'].','.$this->WOPcomment('   WOP:'.$WOP.'[priority]').'
00163                                                 \'quality\' => '.$config['quality'].','.$this->WOPcomment('     WOP:'.$WOP.'[quality]').'
00164 
00165                                                 \'os\' => \''.$config['os'].'\','.$this->WOPcomment('   WOP:'.$WOP.'[os]').'
00166                                                 \'exec\' => \''.$config['exec'].'\','.$this->WOPcomment('       WOP:'.$WOP.'[exec]').'
00167 
00168                                                 \'classFile\' => t3lib_extMgm::extPath($_EXTKEY).\'sv'.$k.'/class.'.$cN.'.php\',
00169                                                 \'className\' => \''.$cN.'\',
00170                                         )
00171                                 );
00172                 ');
00173 
00174                 $innerMainContent = $this->sPS('
00175 
00179                         function init() {
00180                                 $available = parent::init();
00181 
00182                                 // Here you can initialize your class.
00183 
00184                                 // The class have to do a strict check if the service is available.
00185                                 // The needed external programs are already checked in the parent class.
00186 
00187                                 // If there\'s no reason for initialization you can remove this function.
00188 
00189                                 return $available;
00190                         }
00191 
00201                         function process($content=\'\', $type=\'\', $conf=array())      {
00202 
00203                                 // Depending on the service type there\'s not a process() function.
00204                                 // You have to implement the API of that service type.
00205 
00206                                 return FALSE;
00207                         }
00208                 ');
00209 
00210                 $indexContent= $this->wrapBody('
00211                         require_once(PATH_t3lib.\'class.t3lib_svbase.php\');
00212 
00213                         class '.$cN.' extends t3lib_svbase {
00214                                 var $prefixId = \''.$cN.'\';            // Same as class name
00215                                 var $scriptRelPath = \''.($pathSuffix.'class.'.$cN.'.php').'\'; // Path to this script relative to the extension dir.
00216                                 var $extKey = \''.$extKey.'\';  // The extension key.
00217 
00218                                 ',$innerMainContent,'
00219                         }
00220                 ');
00221                 $this->addFileToFileArray($pathSuffix."class.".$cN.".php",$this->PHPclassFile($extKey,$pathSuffix."class.".$cN.".php",$indexContent,"Service '".$config['title']."' for the '".$extKey."' extension."));
00222 
00223         }
00224 
00225 }
00226 
00227 
00228 // Include ux_class extension?
00229 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_sv.php']) {
00230         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_sv.php']);
00231 }
00232 
00233 
00234 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6