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

SC_file_upload Class Reference

List of all members.

Public Member Functions

 init ()
 Constructor for initializing the class.
 main ()
 Main function, rendering the upload file form fields.
 printContent ()
 Outputting the accumulated content to screen.

Public Attributes

 $uploadNumber = 10
 $doc
 $basicff
 $icon
 $shortPath
 $title
 $number
 $target
 $returnUrl
 $content

Member Function Documentation

SC_file_upload::init  ) 
 

Constructor for initializing the class.

Returns:
void

Definition at line 103 of file file_upload.php.

References $key, and exit.

00103                      {
00104       global $LANG,$BACK_PATH,$TYPO3_CONF_VARS;
00105 
00106          // Initialize GPvars:
00107       $this->number = t3lib_div::_GP('number');
00108       $this->target = t3lib_div::_GP('target');
00109       $this->returnUrl = t3lib_div::_GP('returnUrl');
00110 
00111          // Init basic-file-functions object:
00112       $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00113       $this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
00114 
00115          // Cleaning and checking target
00116       $this->target=$this->basicff->is_directory($this->target);     // Cleaning and checking target
00117       $key=$this->basicff->checkPathAgainstMounts($this->target.'/');
00118       if (!$this->target || !$key)  {
00119          t3lib_BEfunc::typo3PrintError ('Parameter Error','Target was not a directory!','');
00120          exit;
00121       }
00122 
00123          // Finding the icon
00124       switch($GLOBALS['FILEMOUNTS'][$key]['type']) {
00125          case 'user':   $this->icon = 'gfx/i/_icon_ftp_user.gif'; break;
00126          case 'group':  $this->icon = 'gfx/i/_icon_ftp_group.gif';   break;
00127          default:    $this->icon = 'gfx/i/_icon_ftp.gif';   break;
00128       }
00129 
00130          // Relative path to filemount, $key:
00131       $this->shortPath = substr($this->target,strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
00132 
00133          // Setting title:
00134       $this->title = $GLOBALS['FILEMOUNTS'][$key]['name'].': '.$this->shortPath;
00135 
00136          // Setting template object
00137       $this->doc = t3lib_div::makeInstance('smallDoc');
00138       $this->doc->docType = 'xhtml_trans';
00139       $this->doc->backPath = $BACK_PATH;
00140       $this->doc->form='<form action="tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">';
00141       $this->doc->JScode=$this->doc->wrapScriptTags('
00142          var path = "'.$this->target.'";
00143 
00144          function reload(a)   {  //
00145             if (!changed || (changed && confirm('.$LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')).')))  {
00146                var params = "&target="+escape(path)+"&number="+a;
00147                document.location = "file_upload.php?"+params;
00148             }
00149          }
00150          function backToList()   {  //
00151             top.goToModule("file_list");
00152          }
00153          var changed = 0;
00154       ');
00155    }

SC_file_upload::main  ) 
 

Main function, rendering the upload file form fields.

Returns:
void

Definition at line 162 of file file_upload.php.

References $a, $LANG, and t3lib_BEfunc::cshItem().

00162                      {
00163       global $LANG;
00164 
00165          // Make page header:
00166       $this->content='';
00167       $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle'));
00168       $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle'));
00169       $this->content.=$this->doc->spacer(5);
00170       $this->content.=$this->doc->section('',$this->doc->getFileheader($this->title,$this->shortPath,$this->icon));
00171       $this->content.=$this->doc->divider(5);
00172 
00173 
00174          // Making the selector box for the number of concurrent uploads
00175       $this->number = t3lib_div::intInRange($this->number,1,10);
00176       $code='
00177          <div id="c-select">
00178             <select name="number" onchange="reload(this.options[this.selectedIndex].value);">';
00179       for ($a=1;$a<=$this->uploadNumber;$a++)   {
00180          $code.='
00181                <option value="'.$a.'"'.($this->number==$a?' selected="selected"':'').'>'.$a.' '.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.files',1).'</option>';
00182       }
00183       $code.='
00184             </select>
00185          </div>
00186          ';
00187 
00188          // Make checkbox for "overwrite"
00189       $code.='
00190          <div id="c-override">
00191             <input type="checkbox" name="overwriteExistingFiles" value="1" /> '.$LANG->getLL('overwriteExistingFiles',1).'
00192          </div>
00193          ';
00194 
00195          // Produce the number of upload-fields needed:
00196       $code.='
00197          <div id="c-upload">
00198       ';
00199       for ($a=0;$a<$this->number;$a++) {
00200             // Adding 'size="50" ' for the sake of Mozilla!
00201          $code.='
00202             <input type="file" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50" onclick="changed=1;" />
00203             <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($this->target).'" />
00204             <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />
00205          ';
00206       }
00207       $code.='
00208          </div>
00209       ';
00210 
00211          // Submit button:
00212       $code.='
00213          <div id="c-submit">
00214             <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />
00215             <input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.cancel',1).'" onclick="backToList(); return false;" />
00216             <input type="hidden" name="redirect" value="'.htmlspecialchars($this->returnUrl).'" />
00217          </div>
00218       ';
00219 
00220          // CSH:
00221       $code.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_upload', $GLOBALS['BACK_PATH'],'<br/>');
00222 
00223          // Add the HTML as a section:
00224       $this->content.= $this->doc->section('',$code);
00225 
00226          // Ending page
00227       $this->content.= $this->doc->endPage();
00228    }

SC_file_upload::printContent  ) 
 

Outputting the accumulated content to screen.

Returns:
void

Definition at line 235 of file file_upload.php.

00235                            {
00236 
00237       echo $this->content;
00238    }


Member Data Documentation

SC_file_upload::$basicff
 

Definition at line 84 of file file_upload.php.

SC_file_upload::$content
 

Definition at line 95 of file file_upload.php.

SC_file_upload::$doc
 

Definition at line 83 of file file_upload.php.

SC_file_upload::$icon
 

Definition at line 85 of file file_upload.php.

SC_file_upload::$number
 

Definition at line 90 of file file_upload.php.

SC_file_upload::$returnUrl
 

Definition at line 92 of file file_upload.php.

SC_file_upload::$shortPath
 

Definition at line 86 of file file_upload.php.

SC_file_upload::$target
 

Definition at line 91 of file file_upload.php.

SC_file_upload::$title
 

Definition at line 87 of file file_upload.php.

SC_file_upload::$uploadNumber = 10
 

Definition at line 80 of file file_upload.php.


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