openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 9bc80c89f6499f2c04570c1461af0a3f3fb5d15f
parent d1870286c5e4cd4ded027185efda77a5ba8c9951
Author: Jan Dankert <devnull@localhost>
Date:   Mon, 24 Sep 2018 22:01:40 +0200

Bessere Erkennung, ob Benutzer Projektadmin ist.

Diffstat:
modules/cms-core/action/ObjectAction.class.php | 17+++++++++++++++++
modules/cms-core/action/PageAction.class.php | 11+++++++----
modules/cms-ui/themes/default/html/views/page/info.php | 20+++++++++++---------
modules/cms-ui/themes/default/html/views/page/info.tpl.src.xml | 18++++++++++--------
4 files changed, 45 insertions(+), 21 deletions(-)

diff --git a/modules/cms-core/action/ObjectAction.class.php b/modules/cms-core/action/ObjectAction.class.php @@ -47,6 +47,9 @@ class ObjectAction extends Action private $objectid; + /** + * @var BaseObject + */ protected $baseObject; public function __construct() @@ -538,4 +541,18 @@ class ObjectAction extends Action $this->baseObject->objectSave(false); $this->addNotice($this->baseObject->getType(),$this->baseObject->filename,'SAVED',OR_NOTICE_OK); } + + + /** + * Stellt fest, ob der angemeldete Benutzer Projekt-Admin ist. + * Dies ist der Fall, wenn der Benutzer PROP-Rechte im Root-Folder hat. + * @return bool|int + */ + protected function userIsProjectAdmin() { + + $project = new Project( $this->baseObject->projectid ); + $rootFolder = new Folder( $project->getRootObjectId() ); + + return $rootFolder->hasRight(ACL_PROP); + } } \ No newline at end of file diff --git a/modules/cms-core/action/PageAction.class.php b/modules/cms-core/action/PageAction.class.php @@ -28,8 +28,10 @@ class PageAction extends ObjectAction { public $security = SECURITY_USER; - var $page; - var $defaultSubAction = 'show'; + /** + * @var Page + */ + private $page; function __construct() @@ -402,9 +404,10 @@ class PageAction extends ObjectAction $this->setTemplateVars( $this->page->getProperties() ); - if ( $this->userIsAdmin() ) + if ( $this->userIsProjectAdmin() ) { - $this->setTemplateVar('template_url',Html::url('main','template',$this->page->templateid,array(REQ_PARAM_MODEL_ID=>$this->page->modelid))); + $this->setTemplateVar('templateid',$this->page->templateid); + $this->setTemplateVar('modelid',$this->page->modelid); } $template = new Template( $this->page->templateid ); diff --git a/modules/cms-ui/themes/default/html/views/page/info.php b/modules/cms-ui/themes/default/html/views/page/info.php @@ -56,17 +56,19 @@ </label> </div> <div class="input"> - <?php $if6=(isset($template_url)); if($if6){?> - <a target="_self" data-url="<?php echo $template_url ?>" data-action="" data-method="info" data-id="<?php echo OR_ID ?>" data-extra="[]" href="<?php echo Html::url('','','',array()) ?>"> - <img class="" title="" src="./modules/cms-ui/themes/default/images/icon/template.png" /> - - <span class="text"><?php echo nl2br(encodeHtml(htmlentities($template_name))); ?></span> - - </a> + <?php $if6=(isset($templateid)); if($if6){?> + <div class="clickable"> + <a target="_self" data-type="open" data-action="template" data-method="info" data-id="<?php echo $templateid ?>" data-extra="[]" href="<?php echo Html::url('template','',$templateid,array()) ?>"> + <img class="image-icon image-icon--action" title="" src="./modules/cms-ui/themes/default/images/icon/action/template.svg" /> + + <span class="text"><?php echo nl2br(encodeHtml(htmlentities($template_name))); ?></span> + + </a> + </div> <?php } ?> - <?php $if6=(($template_url)==FALSE); if($if6){?> - <img class="" title="" src="./modules/cms-ui/themes/default/images/icon/icon_template.png" /> + <?php if(!$if6){?> + <img class="image-icon image-icon--action" title="" src="./modules/cms-ui/themes/default/images/icon/action/template.svg" /> <span class="text"><?php echo nl2br(encodeHtml(htmlentities($template_name))); ?></span> diff --git a/modules/cms-ui/themes/default/html/views/page/info.tpl.src.xml b/modules/cms-ui/themes/default/html/views/page/info.tpl.src.xml @@ -46,16 +46,18 @@ </label> </part> <part class="input"> - <if present="template_url"> - <link url="var:template_url" target="cms_main"> - <image icon="template"></image> - <text var="template_name"></text> - </link> + <if present="templateid"> + <part class="clickable"> + <link action="template" id="var:templateid" type="open"> + <image action="template"></image> + <text var="template_name"></text> + </link> + </part> </if> - <if empty="template_url"> - <image file="icon_template"></image> + <else> + <image action="template"></image> <text var="template_name"></text> - </if> + </else> </part> </part> <part class="line">