Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

SC_file_edit Class Reference

List of all members.

Public Member Functions

 init ()
 Initialize script class.
 main ()
 Main function, redering the actual content of the editing page.
 printContent ()
 Outputting the accumulated content to screen.

Public Attributes

 $content
 $basicff
 $shortPath
 $title
 $icon
 $doc
 $origTarget
 $target
 $returnUrl

Member Function Documentation

SC_file_edit::init  ) 
 

Initialize script class.

Returns:
void

Definition at line 93 of file file_edit.php.

References $key, and exit.

00093                      {
00094       global $BACK_PATH,$TYPO3_CONF_VARS;
00095 
00096          // Setting target, which must be a file reference to a file within the mounts.
00097       $this->target = $this->origTarget = t3lib_div::_GP('target');
00098       $this->returnUrl = t3lib_div::_GP('returnUrl');
00099 
00100          // Creating file management object:
00101       $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00102       $this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
00103 
00104 
00105       if (@file_exists($this->target)) {
00106          $this->target=$this->basicff->cleanDirectoryName($this->target);     // Cleaning and checking target (file or dir)
00107       } else {
00108          $this->target='';
00109       }
00110       $key=$this->basicff->checkPathAgainstMounts($this->target.'/');
00111       if (!$this->target || !$key)  {
00112          t3lib_BEfunc::typo3PrintError ('Parameter Error','Target was not a directory!','');
00113          exit;
00114       }
00115          // Finding the icon
00116       switch($GLOBALS['FILEMOUNTS'][$key]['type']) {
00117          case 'user':   $this->icon = 'gfx/i/_icon_ftp_user.gif'; break;
00118          case 'group':  $this->icon = 'gfx/i/_icon_ftp_group.gif';   break;
00119          default:    $this->icon = 'gfx/i/_icon_ftp.gif';   break;
00120       }
00121       $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
00122       $this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
00123 
00124       // ***************************
00125       // Setting template object
00126       // ***************************
00127       $this->doc = t3lib_div::makeInstance('template');
00128       $this->doc->docType = 'xhtml_trans';
00129       $this->doc->backPath = $BACK_PATH;
00130       $this->doc->JScode=$this->doc->wrapScriptTags('
00131          function backToList()   {  //
00132             top.goToModule("file_list");
00133          }
00134       ');
00135       $this->doc->form='<form action="tce_file.php" method="post" name="editform">';
00136    }

SC_file_edit::main  ) 
 

Main function, redering the actual content of the editing page.

Returns:
void

Definition at line 143 of file file_edit.php.

References $TYPO3_CONF_VARS, and t3lib_BEfunc::cshItem().

00143                      {
00144       global $BE_USER, $LANG, $TYPO3_CONF_VARS;
00145 
00146       $this->content='';
00147       $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
00148       $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.pagetitle'));
00149       $this->content.=$this->doc->spacer(5);
00150       $this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
00151       $this->content.=$this->doc->divider(5);
00152 
00153       $fI = pathinfo($this->target);
00154       $extList=$TYPO3_CONF_VARS['SYS']['textfile_ext'];
00155 
00156       if ($extList && t3lib_div::inList($extList,strtolower($fI['extension'])))     {
00157             // Read file content to edit:
00158          $fileContent = t3lib_div::getUrl($this->target);
00159 
00160             // making the formfields
00161          $hValue = 'file_edit.php?target='.rawurlencode($this->origTarget).'&returnUrl='.rawurlencode($this->returnUrl);
00162          $code = '';
00163          $code.='
00164             <div id="c-submit">
00165                <input type="hidden" name="redirect" value="'.htmlspecialchars($hValue).'" />
00166                <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.submit',1).'" />
00167                <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.saveAndClose',1).'" onclick="document.editform.redirect.value=\''.htmlspecialchars($this->returnUrl).'\';" />
00168                <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
00169             </div>
00170             ';
00171 
00172             // Edit textarea:
00173          $code.='
00174             <div id="c-edit">
00175                <textarea rows="30" name="file[editfile][0][data]" wrap="off"'.$this->doc->formWidthText(48,'width:98%;height:80%','off').'>'.
00176                t3lib_div::formatForTextarea($fileContent).
00177                '</textarea>
00178                <input type="hidden" name="file[editfile][0][target]" value="'.$this->target.'" />
00179             </div>
00180             <br />';
00181 
00182             // CSH:
00183          $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_edit', $GLOBALS['BACK_PATH'],'|<br/>');
00184 
00185             // Make shortcut:
00186          if ($BE_USER->mayMakeShortcut()) {
00187             $this->MCONF['name']='xMOD_file_edit.php';
00188             $code.= '<br />'.$this->doc->makeShortcutIcon('target','',$this->MCONF['name'],1);
00189          }
00190       } else {
00191          $code.=sprintf($LANG->sL('LLL:EXT:lang/locallang_core.php:file_edit.php.coundNot'), $extList);
00192       }
00193 
00194          // Ending of section and outputting editing form:
00195       $this->content.= $this->doc->sectionEnd();
00196       $this->content.=$code;
00197 
00198       $this->content.=$this->doc->endPage();
00199    }

SC_file_edit::printContent  ) 
 

Outputting the accumulated content to screen.

Returns:
void

Definition at line 206 of file file_edit.php.

00206                            {
00207       echo $this->content;
00208    }


Member Data Documentation

SC_file_edit::$basicff
 

Definition at line 76 of file file_edit.php.

SC_file_edit::$content
 

Definition at line 75 of file file_edit.php.

SC_file_edit::$doc
 

Definition at line 80 of file file_edit.php.

SC_file_edit::$icon
 

Definition at line 79 of file file_edit.php.

SC_file_edit::$origTarget
 

Definition at line 83 of file file_edit.php.

SC_file_edit::$returnUrl
 

Definition at line 85 of file file_edit.php.

SC_file_edit::$shortPath
 

Definition at line 77 of file file_edit.php.

SC_file_edit::$target
 

Definition at line 84 of file file_edit.php.

SC_file_edit::$title
 

Definition at line 78 of file file_edit.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:06:28 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913