File modules/cms/action/folder/FolderCreatescriptAction.class.php
Last commit: Sun Jan 29 00:20:21 2023 +0100 Jan Dankert New node type "Script".
1 <?php 2 namespace cms\action\folder; 3 use cms\action\FolderAction; 4 use cms\action\Method; 5 use cms\model\BaseObject; 6 use cms\model\Permission; 7 use cms\model\Script; 8 use cms\model\Text; 9 use language\Messages; 10 use util\exception\ValidationException; 11 use util\Http; 12 use util\Upload; 13 14 15 class FolderCreatescriptAction extends FolderAction implements Method { 16 public function getRequiredPermission() { 17 return Permission::ACL_CREATE_FILE; 18 } 19 20 public function view() { 21 // Maximale Dateigroesse. 22 $maxSizeBytes = $this->maxFileSize(); 23 $this->setTemplateVar('max_size' ,($maxSizeBytes/1024).' KB' ); 24 $this->setTemplateVar('maxlength',$maxSizeBytes ); 25 26 $this->setTemplateVar('objectid',$this->folder->objectid ); 27 } 28 29 30 public function post() { 31 32 $name = $this->request->getText('name' ); 33 $description = $this->request->getText('description'); 34 35 $script = new Script(); 36 $script->parentid = $this->folder->objectid; 37 $script->projectid = $this->folder->projectid; 38 39 $this->request->handleText('text',function($value) use ($script) { 40 $script->filename = $this->request->getRequiredText('filename' ); 41 $script->extension = $this->request->getRequiredText('extension'); 42 $script->value = $this->request->getRequiredText('text' ); 43 $script->size = strlen( $script->value ); 44 }); 45 46 47 $script->persist(); // Datei hinzufuegen 48 $script->setNameForAllLanguages( $name,$description ); 49 50 $this->addNoticeFor($script, Messages::ADDED); 51 $this->setTemplateVar('objectid',$script->objectid); 52 53 $this->folder->setTimestamp(); 54 } 55 }
Downloadmodules/cms/action/folder/FolderCreatescriptAction.class.php
History Sun, 29 Jan 2023 00:20:21 +0100 Jan Dankert New node type "Script".