1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-16 14:50:48 +03:00

Доработка предпросмотра fix #753

This commit is contained in:
Mzhelskiy Maxim 2016-04-27 18:58:05 +07:00
parent a8f935fa5f
commit 52797e903b
4 changed files with 32 additions and 5 deletions

View file

@ -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);
/**

View file

@ -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;
}

View file

@ -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');

@ -1 +1 @@
Subproject commit 8410a744b062f67347e67b1fff81e29b0a4bbff3
Subproject commit 6356bef5db69816a14b694584a22734b41d04628