mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
Доработка предпросмотра fix #753
This commit is contained in:
parent
a8f935fa5f
commit
52797e903b
|
@ -623,6 +623,12 @@ class ActionContent extends Action
|
||||||
if ($iId and !($oTopicOriginal = $this->Topic_GetTopicById($iId))) {
|
if ($iId and !($oTopicOriginal = $this->Topic_GetTopicById($iId))) {
|
||||||
return $this->EventErrorDebug();
|
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());
|
$this->Message_AddErrorSingle($oTopic->_getValidateError());
|
||||||
return false;
|
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 = $this->Viewer_GetLocalViewer();
|
||||||
$oViewer->Assign('isPreview', true, true);
|
$aParams = array(
|
||||||
$oViewer->Assign('topic', $oTopic, true);
|
'isPreview' => true,
|
||||||
|
'topic' => $oTopic,
|
||||||
|
);
|
||||||
|
foreach ($aParams as $sName => $mValue) {
|
||||||
|
$oViewer->Assign($sName, $mValue, true);
|
||||||
|
}
|
||||||
|
$oViewer->Assign('params', $aParams); // fix для корректной работы подключения внутренних шаблонов компонента
|
||||||
|
|
||||||
$sTemplate = 'component@topic.type';
|
$sTemplate = 'component@topic.type';
|
||||||
$sTextResult = $oViewer->Fetch($sTemplate);
|
$sTextResult = $oViewer->Fetch($sTemplate);
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,7 +48,7 @@ class BlockPollFormItems extends Block
|
||||||
} else {
|
} else {
|
||||||
$sTargetId = null;
|
$sTargetId = null;
|
||||||
if (!$sTargetTmp or !$this->Poll_IsAllowTargetType($sTargetType)) {
|
if (!$sTargetTmp or !$this->Poll_IsAllowTargetType($sTargetType)) {
|
||||||
return false;
|
return true; // показываем список, но пустой
|
||||||
}
|
}
|
||||||
$aFilter['target_tmp'] = $sTargetTmp;
|
$aFilter['target_tmp'] = $sTargetTmp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -863,7 +863,7 @@ class ModuleTopic_EntityTopic extends Entity
|
||||||
*/
|
*/
|
||||||
public function getPolls()
|
public function getPolls()
|
||||||
{
|
{
|
||||||
if (!$this->_getDataOne('polls')) {
|
if (is_null($this->_getDataOne('polls'))) {
|
||||||
$this->_aData['polls'] = $this->Poll_GetPollItemsByTarget('topic', $this->getId());
|
$this->_aData['polls'] = $this->Poll_GetPollItemsByTarget('topic', $this->getId());
|
||||||
}
|
}
|
||||||
return $this->_getDataOne('polls');
|
return $this->_getDataOne('polls');
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8410a744b062f67347e67b1fff81e29b0a4bbff3
|
Subproject commit 6356bef5db69816a14b694584a22734b41d04628
|
Loading…
Reference in a new issue