From 52797e903bbb813960c16594ade5959003ad6c9b Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Wed, 27 Apr 2016 18:58:05 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BF=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D0=BC=D0=BE=D1=82=D1=80=D0=B0=20fix=20#753?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classes/actions/ActionContent.class.php | 31 +++++++++++++++++-- .../blocks/BlockPollFormItems.class.php | 2 +- .../topic/entity/Topic.entity.class.php | 2 +- framework | 2 +- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/application/classes/actions/ActionContent.class.php b/application/classes/actions/ActionContent.class.php index 05be6fbc..3ff948ea 100644 --- a/application/classes/actions/ActionContent.class.php +++ b/application/classes/actions/ActionContent.class.php @@ -623,6 +623,12 @@ class ActionContent extends Action if ($iId and !($oTopicOriginal = $this->Topic_GetTopicById($iId))) { return $this->EventErrorDebug(); } + /** + * Если права на редактирование + */ + if ($iId and !$this->ACL_IsAllowEditTopic($oTopicOriginal, $this->oUserCurrent)) { + return parent::EventNotFound(); + } /** * Создаем объект топика для валидации данных */ @@ -651,6 +657,20 @@ class ActionContent extends Action $this->Message_AddErrorSingle($oTopic->_getValidateError()); return false; } + /** + * Аттачим опросы + */ + if (!$oTopic->getId()) { + $aPolls = array(); + if ($sPollTargetTmp = $this->Session_GetCookie('poll_target_tmp_topic')) { + $aPolls = $this->Poll_GetPollItemsByFilter(array( + 'target_type' => 'topic', + 'target_tmp' => $sPollTargetTmp, + '#order' => array('id' => 'asc') + )); + } + $oTopic->setPolls($aPolls); + } /** * Аттачим дополнительные поля к топику */ @@ -666,8 +686,15 @@ class ActionContent extends Action * Рендерим шаблон для предпросмотра топика */ $oViewer = $this->Viewer_GetLocalViewer(); - $oViewer->Assign('isPreview', true, true); - $oViewer->Assign('topic', $oTopic, true); + $aParams = array( + 'isPreview' => true, + 'topic' => $oTopic, + ); + foreach ($aParams as $sName => $mValue) { + $oViewer->Assign($sName, $mValue, true); + } + $oViewer->Assign('params', $aParams); // fix для корректной работы подключения внутренних шаблонов компонента + $sTemplate = 'component@topic.type'; $sTextResult = $oViewer->Fetch($sTemplate); /** diff --git a/application/classes/blocks/BlockPollFormItems.class.php b/application/classes/blocks/BlockPollFormItems.class.php index 335298f5..be7c427d 100644 --- a/application/classes/blocks/BlockPollFormItems.class.php +++ b/application/classes/blocks/BlockPollFormItems.class.php @@ -48,7 +48,7 @@ class BlockPollFormItems extends Block } else { $sTargetId = null; if (!$sTargetTmp or !$this->Poll_IsAllowTargetType($sTargetType)) { - return false; + return true; // показываем список, но пустой } $aFilter['target_tmp'] = $sTargetTmp; } diff --git a/application/classes/modules/topic/entity/Topic.entity.class.php b/application/classes/modules/topic/entity/Topic.entity.class.php index c8258fa9..05e1f65e 100644 --- a/application/classes/modules/topic/entity/Topic.entity.class.php +++ b/application/classes/modules/topic/entity/Topic.entity.class.php @@ -863,7 +863,7 @@ class ModuleTopic_EntityTopic extends Entity */ public function getPolls() { - if (!$this->_getDataOne('polls')) { + if (is_null($this->_getDataOne('polls'))) { $this->_aData['polls'] = $this->Poll_GetPollItemsByTarget('topic', $this->getId()); } return $this->_getDataOne('polls'); diff --git a/framework b/framework index 8410a744..6356bef5 160000 --- a/framework +++ b/framework @@ -1 +1 @@ -Subproject commit 8410a744b062f67347e67b1fff81e29b0a4bbff3 +Subproject commit 6356bef5db69816a14b694584a22734b41d04628