File modules/cms/action/PageAction.class.php

Last commit: Sat Mar 19 00:24:33 2022 +0100	dankert	Fix: Using the correct PageContext for generating the page source.
1 <?php 2 3 namespace cms\action; 4 5 use cms\base\Configuration; 6 use cms\generator\PageContext; 7 use cms\generator\PageGenerator; 8 use cms\generator\Producer; 9 use cms\generator\Publisher; 10 use cms\generator\PublishOrder; 11 use cms\model\Permission; 12 use cms\model\BaseObject; 13 use cms\model\Element; 14 use cms\model\Folder; 15 use cms\model\Language; 16 use cms\model\Page; 17 use cms\model\Project; 18 use cms\model\Template; 19 use cms\model\Value; 20 use configuration\Config; 21 use logger\Logger; 22 use util\Html; 23 use util\Session; 24 25 26 /** 27 * Action-Klasse zum Bearbeiten einer Seite 28 * @author $Author$ 29 * @version $Revision$ 30 * @package openrat.actions 31 */ 32 33 class PageAction extends ObjectAction 34 { 35 /** 36 * @var Page 37 */ 38 protected $page; 39 40 41 function __construct() 42 { 43 parent::__construct(); 44 45 } 46 47 48 public function init() 49 { 50 $page = new Page( $this->request->getId() ); 51 //$context = new PageContext(); 52 //$context->sourceObjectId = $page->objectid; 53 54 // if ( $this->request->hasLanguageId()) 55 // $context->languageId = $this->request->getLanguageId(); 56 // 57 // if ( $this->request->hasModelId()) 58 // $context->modelId = $this->request->getModelId(); 59 60 $page->load(); 61 // 62 // if ( !$context->languageId ) 63 // $context->languageId = $page->getProject()->getDefaultLanguageId(); 64 // 65 // if ( !$context->modelId ) 66 // $context->modelId = $page->getProject()->getDefaultModelId(); 67 68 // $page->languageid = $context->languageId; 69 // $page->modelid = $context->modelId 70 // $page->context = $context; 71 72 // Hier kann leider nicht das Datum der letzten Änderung verwendet werden, 73 // da sich die Seite auch danach ändern kann, z.B. durch Includes anderer 74 // Seiten oder Änderung einer Vorlage oder Änderung des Dateinamens einer 75 // verlinkten Datei. 76 $this->lastModified( time() ); 77 78 $this->setBaseObject($page); 79 } 80 81 82 83 protected function setBaseObject($folder ) { 84 85 $this->page = $folder; 86 87 parent::setBaseObject( $folder ); 88 } 89 90 91 92 protected function setModelAndLanguage() 93 { 94 $this->setTemplateVar('languages' ,$this->page->getProject()->getLanguages()); 95 $this->setTemplateVar('languageid',$this->request->getLanguageId() ?: $this->page->getProject()->getDefaultLanguageId() ); 96 97 $this->setTemplateVar('models' ,$this->page->getProject()->getModels() ); 98 $this->setTemplateVar('modelid' ,$this->request->getModelId() ?: $this->page->getProject()->getDefaultModelId() ); 99 } 100 101 102 103 protected function createPageContext( $scheme ) { 104 105 $context = new PageContext( $this->page->objectid,$scheme ); 106 107 if ( $languageId = $this->request->getLanguageId()) 108 $context->languageId = $languageId; 109 else 110 $context->languageId = $this->page->getProject()->getDefaultLanguageId(); 111 112 if ( $modelId = $this->request->getModelId()) 113 $context->modelId = $modelId; 114 else 115 $context->modelId = $this->page->getProject()->getDefaultModelId(); 116 117 return $context; 118 } 119 120 }
Download modules/cms/action/PageAction.class.php
History Sat, 19 Mar 2022 00:24:33 +0100 dankert Fix: Using the correct PageContext for generating the page source. Fri, 18 Mar 2022 22:38:42 +0100 dankert Refactoring: Extracted the TemplateGenerator out of the PageGenerator. Wed, 9 Mar 2022 13:28:52 +0100 dankert Refactoring: Checkbox values are always sent to the server. In the actions we must test the value with 'isTrue()' Sat, 6 Mar 2021 02:50:20 +0100 Jan Dankert New: Enable actions for guest users. Sat, 27 Feb 2021 02:40:09 +0100 Jan Dankert Fix: Use the sourceObjectId from the pageContext for links. Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. 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. Wed, 18 Nov 2020 00:18:10 +0100 Jan Dankert Refactoring Part 2: Removing all unnecessary methods in the action base classes. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class. Sun, 15 Nov 2020 00:00:33 +0100 Jan Dankert Fix: Editing of names and descriptions for pages and other objects. Sun, 1 Nov 2020 00:36:50 +0100 Jan Dankert Refactoring: Only using the configuration object. Sat, 31 Oct 2020 13:54:19 +0100 Jan Dankert Cleanup: Use constants for session keys. Wed, 14 Oct 2020 23:49:54 +0200 Jan Dankert Refactoring: Creating the target instance with a Factory (Java style); Asynchronous publishing of files. Wed, 7 Oct 2020 23:01:31 +0200 Jan Dankert Cleanup: Refactored file seperator char with an unicode char. Fri, 2 Oct 2020 23:11:48 +0200 Jan Dankert Cleanup: No '.inputholder' any more, notices with links to objects. Tue, 29 Sep 2020 22:17:11 +0200 Jan Dankert Refactoring: Do not use global constants. Tue, 29 Sep 2020 20:25:22 +0200 Jan Dankert Cleanup: using the parent infoView() Tue, 29 Sep 2020 01:14:45 +0200 Jan Dankert New: The settings are a useful information for a client. Sat, 26 Sep 2020 12:20:43 +0200 Jan Dankert Refactoring: No global variables like $SESS any more. All constants are capsulated by classes. Sat, 26 Sep 2020 04:26:55 +0200 Jan Dankert Refactoring: read configuration values with a class. Sat, 26 Sep 2020 04:03:53 +0200 Jan Dankert Refactoring: read language keys with a class. Thu, 24 Sep 2020 21:31:07 +0200 Jan Dankert Fi: Page::template ist not set. Wed, 23 Sep 2020 01:04:05 +0200 Jan Dankert Cleanup of deprecated methods and deprecated class attributes. Mon, 21 Sep 2020 22:48:59 +0200 Jan Dankert Complexe refactoring: Moving all generation logic from the model (Value,Page,File) to generators classes. Fri, 18 Sep 2020 23:04:13 +0200 Jan Dankert Refactoring: Renaming module "cms/publish" to "cms/generator" Sat, 29 Aug 2020 03:23:06 +0200 Jan Dankert Refactoring: Improved Exception-Handling; New: Generating pages using a page context which considers page aliases. Thu, 27 Aug 2020 00:32:27 +0200 Jan Dankert Cleanup: Remove unused template components page,tree; remove unused action method 'structure'. Mon, 17 Aug 2020 22:52:37 +0200 Jan Dankert Cleanup: Killing the old odd 'GLOBAL_' message prefixes. Sun, 23 Feb 2020 04:01:30 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 1: moving.