File modules/cms/action/object/ObjectPropAction.class.php
Last commit: Thu Oct 15 01:39:59 2026 +0200 Jan Dankert New: A much better generation of the OpenAPI Interface documents, supports now the UI API Objects.
1 <?php 2 namespace cms\action\object; 3 use cms\action\Method; 4 use cms\action\ObjectAction; 5 use cms\action\RequestParams; 6 use cms\model\BaseObject; 7 use cms\model\Permission; 8 use cms\model\Project; 9 use language\Messages; 10 use util\exception\ValidationException; 11 12 13 class ObjectPropAction extends ObjectAction implements Method { 14 15 public function getRequiredPermission(): int 16 { 17 return Permission::ACL_PROP; 18 } 19 20 public function view() { 21 $this->setTemplateVar( 'filename', $this->baseObject->filename ); 22 $alias = $this->baseObject->getAliasForLanguage(null ); 23 $this->setTemplateVar( 'alias_filename', $alias->filename ); 24 $this->setTemplateVar( 'alias_folderid', $alias->parentid ); 25 26 $project = Project::create( $this->baseObject->projectid ); 27 $this->setTemplateVar( 'folders' , $project->getAllFlatFolders() ); 28 } 29 30 31 /** 32 * Saves object properties. 33 * @api filename*|string|name of file 34 * @api alias_filename|string|name of file 35 * @api alias_folderid|number|name of file 36 */ 37 public function post() { 38 39 $this->baseObject->filename = BaseObject::urlify( $this->request->getRequiredText('filename') ); 40 $this->baseObject->save(); 41 42 $alias = $this->baseObject->getAliasForLanguage(null); 43 $alias->filename = BaseObject::urlify( $this->request->getText( 'alias_filename') ); 44 $alias->parentid = $this->request->getNumber('alias_folderid'); 45 46 // If no alias, remove the alias 47 if ( ! $alias->filename ) 48 $alias->delete(); 49 else 50 $alias->persist(); 51 52 53 // Should we do this? 54 if ( $this->userIsAdmin() ) 55 $this->request->handleNumber('creationTimestamp',function($value) { 56 $this->baseObject->createDate = $value; 57 $this->baseObject->setCreationTimestamp(); 58 }); 59 60 61 $this->addNoticeFor( $this->baseObject,Messages::PROP_SAVED); 62 } 63 }
Downloadmodules/cms/action/object/ObjectPropAction.class.php
History Thu, 15 Oct 2026 01:39:59 +0200 Jan Dankert New: A much better generation of the OpenAPI Interface documents, supports now the UI API Objects. Thu, 24 Apr 2025 00:13:35 +0200 Jan Dankert New: OpenAPI with REST interface for all actions and methods 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()' Wed, 10 Mar 2021 23:51:22 +0100 Jan Dankert Refactoring: Cleaned the Request params. Sat, 6 Mar 2021 03:42:38 +0100 Jan Dankert New: Better permission checks. Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. Thu, 19 Nov 2020 14:49:58 +0100 Jan Dankert Fix: Action::addNotice() is replaced by Action::addNoticeFor() Wed, 18 Nov 2020 01:46:36 +0100 Jan Dankert Refactoring of model classes: New method persist() and some other cleanups. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.