File modules/cms/action/folder/FolderShowAction.class.php
Last commit: Sat Mar 19 00:09:47 2022 +0100 dankert Refactoring: Outputs are setting their content-type themself.
1 <?php 2 namespace cms\action\folder; 3 use cms\action\FolderAction; 4 use cms\action\Method; 5 use cms\generator\FileContext; 6 use cms\generator\FileGenerator; 7 use cms\generator\PageContext; 8 use cms\generator\PageGenerator; 9 use cms\generator\Producer; 10 use cms\model\Element; 11 use cms\model\Folder; 12 use cms\model\Permission; 13 use cms\model\BaseObject; 14 use util\Html; 15 16 17 class FolderShowAction extends FolderAction implements Method { 18 public function view() { 19 20 // Angabe Content-Type 21 $this->setContentType('text/html' ); 22 23 $this->addHeader('X-Folder-Id' ,$this->folder->folderid ); 24 $this->addHeader('X-Id' ,$this->folder->objectid ); 25 $this->addHeader('Content-Description',$this->folder->filename() ); 26 27 echo '<html><body>'; 28 echo '<h1>'.$this->folder->filename.'</h1>'; 29 echo '<ul>'; 30 31 32 if ( $this->folder->parentid ) { 33 echo '<li><a href="'. Html::url('folder','show',$this->folder->parentid).'">..</a></li>'; 34 } 35 36 37 // Schleife ueber alle Objekte in diesem Ordner 38 foreach( $this->folder->getObjects() as $o ) 39 { 40 /* @var $o BaseObject */ 41 $id = $o->objectid; 42 $o->load(); 43 44 if ( $o->hasRight(Permission::ACL_READ) ) 45 { 46 switch( $o->typeid ) { 47 case BaseObject::TYPEID_PAGE: 48 foreach( $this->folder->getProject()->getModelIds() as $modelId ) { 49 foreach( $this->folder->getProject()->getLanguageIds() as $languageId ) { 50 $previewContext = new PageContext( $o->objectid, Producer::SCHEME_PREVIEW ); 51 $previewContext->languageId = $languageId; 52 $previewContext->modelId = $modelId; 53 $context = new PageContext( $o->objectid, Producer::SCHEME_PUBLIC ); 54 $context->languageId = $languageId; 55 $context->modelId = $modelId; 56 $generator = new PageGenerator( $context ); 57 echo '<li><a href="'. $previewContext->getLinkScheme()->linkToObject($o,$o).'">'.basename($generator->getPublicFilename()).'</a></li>'; 58 } 59 } 60 break; 61 default: 62 echo '<li><a href="'. Html::url($o->getType(),'show',$o->objectid).'">'.$o->filename().'</a></li>'; 63 } 64 65 //echo date( \cms\base\Language::lang('DATE_FORMAT'),$o->lastchangeDate ); 66 //echo $o->lastchangeUser; 67 } else { 68 // do not show anything. 69 // the existence of the unreadable ojbect should be not visible. 70 } 71 } 72 73 echo '</ul>'; 74 echo '</body></html>'; 75 76 exit; 77 } 78 public function post() { 79 } 80 }
Downloadmodules/cms/action/folder/FolderShowAction.class.php
History Sat, 19 Mar 2022 00:09:47 +0100 dankert Refactoring: Outputs are setting their content-type themself. Fri, 18 Mar 2022 14:02:20 +0100 dankert New: Show all page links in the folder preview. Sun, 13 Feb 2022 23:35:26 +0100 dankert Refactoring: New class "Response" which stores all output information. Sun, 5 Dec 2021 20:33:24 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'. Mon, 4 Jan 2021 19:03:18 +0100 Jan Dankert Refactoring: ACL class is renamed to Permission, because most RBAC/DMAC concepts are calling it a permission. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.