|
|
@@ -18,22 +18,61 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
|
|
|
protected $_bPublicMode;
|
|
|
protected $_bProfileMode;
|
|
|
|
|
|
+ protected $_bVisibilityAutoselect;
|
|
|
+
|
|
|
public function __construct($aInfo, $oTemplate = false)
|
|
|
{
|
|
|
$this->MODULE = 'bx_timeline';
|
|
|
|
|
|
parent::__construct($aInfo, $oTemplate);
|
|
|
|
|
|
- $iUserId = $this->_oModule->getUserId();
|
|
|
- $iOwnerId = $this->_oModule->getOwnerId();
|
|
|
-
|
|
|
$this->_bAccountMode = isset($this->aParams['display']) && $this->aParams['display'] == $this->_oModule->_oConfig->getObject('form_display_post_add');
|
|
|
$this->_bPublicMode = isset($this->aParams['display']) && $this->aParams['display'] == $this->_oModule->_oConfig->getObject('form_display_post_add_public');
|
|
|
$this->_bProfileMode = isset($this->aParams['display']) && $this->aParams['display'] == $this->_oModule->_oConfig->getObject('form_display_post_add_profile');
|
|
|
|
|
|
- $this->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . 'post/';
|
|
|
-
|
|
|
- $this->aInputs['owner_id']['value'] = $iOwnerId;
|
|
|
+ $this->_bVisibilityAutoselect = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getCode($bDynamicMode = false)
|
|
|
+ {
|
|
|
+ $sResult = parent::getCode($bDynamicMode);
|
|
|
+
|
|
|
+ return $this->_oModule->_oTemplate->parseHtmlByContent($sResult, array(
|
|
|
+ 'attachments_menu' => $this->_oModule->getAttachmentsMenuObject()->getCode()
|
|
|
+ ));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function addHtmlEditor($iViewMode, &$aInput)
|
|
|
+ {
|
|
|
+ $CNF = &$this->_oModule->_oConfig->CNF;
|
|
|
+
|
|
|
+ $oEditor = BxDolEditor::getObjectInstance(false, $this->oTemplate);
|
|
|
+ if (!$oEditor)
|
|
|
+ return false;
|
|
|
+
|
|
|
+
|
|
|
+ if(in_array($this->aParams['display'], array($this->_oModule->_oConfig->getObject('form_display_post_add'), $this->_oModule->_oConfig->getObject('form_display_post_add_public'))))
|
|
|
+ $oEditor->setCustomConf("
|
|
|
+ placeholderText: '" . _t('_bx_timeline_txt_some_text_here') . "',
|
|
|
+ initOnClick: false,
|
|
|
+ ");
|
|
|
+
|
|
|
+ if(!$this->_oModule->_oConfig->isEditorToolbar())
|
|
|
+ $oEditor->setCustomToolbarButtons('');
|
|
|
+
|
|
|
+ $this->_sCodeAdd .= $oEditor->attachEditor ('#' . $this->aFormAttrs['id'] . ' [name='.$aInput['name'].']', $iViewMode, $this->_bDynamicMode);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function init()
|
|
|
+ {
|
|
|
+ $iUserId = $this->_oModule->getUserId();
|
|
|
+ $iOwnerId = $this->_oModule->getOwnerId();
|
|
|
+
|
|
|
+ $this->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . 'post/';
|
|
|
+
|
|
|
+ $this->aInputs['owner_id']['value'] = $iOwnerId;
|
|
|
|
|
|
if(isset($this->aInputs['text'])) {
|
|
|
if(empty($this->aInputs['text']['attrs']) || !is_array($this->aInputs['text']['attrs']))
|
|
|
@@ -66,7 +105,7 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
|
|
|
$this->aInputs['photo']['ghost_template'] = $oFormNested;
|
|
|
}
|
|
|
|
|
|
- if(isset($this->aInputs['video'])) {
|
|
|
+ if(isset($this->aInputs['video'])) {
|
|
|
$aFormNested = array(
|
|
|
'params' =>array(
|
|
|
'nested_form_template' => 'uploader_nfw.html'
|
|
|
@@ -91,36 +130,9 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
|
|
|
$this->aInputs[$this->_oModule->_oConfig->CNF['FIELD_LOCATION_PREFIX']]['manual_input'] = false;
|
|
|
}
|
|
|
|
|
|
- public function getCode($bDynamicMode = false)
|
|
|
+ public function setVisibilityAutoselect($bVisibilityAutoselect)
|
|
|
{
|
|
|
- $sResult = parent::getCode($bDynamicMode);
|
|
|
-
|
|
|
- return $this->_oModule->_oTemplate->parseHtmlByContent($sResult, array(
|
|
|
- 'attachments_menu' => $this->_oModule->getAttachmentsMenuObject()->getCode()
|
|
|
- ));
|
|
|
- }
|
|
|
-
|
|
|
- public function addHtmlEditor($iViewMode, &$aInput)
|
|
|
- {
|
|
|
- $CNF = &$this->_oModule->_oConfig->CNF;
|
|
|
-
|
|
|
- $oEditor = BxDolEditor::getObjectInstance(false, $this->oTemplate);
|
|
|
- if (!$oEditor)
|
|
|
- return false;
|
|
|
-
|
|
|
-
|
|
|
- if(in_array($this->aParams['display'], array($this->_oModule->_oConfig->getObject('form_display_post_add'), $this->_oModule->_oConfig->getObject('form_display_post_add_public'))))
|
|
|
- $oEditor->setCustomConf("
|
|
|
- placeholderText: '" . _t('_bx_timeline_txt_some_text_here') . "',
|
|
|
- initOnClick: false,
|
|
|
- ");
|
|
|
-
|
|
|
- if(!$this->_oModule->_oConfig->isEditorToolbar())
|
|
|
- $oEditor->setCustomToolbarButtons('');
|
|
|
-
|
|
|
- $this->_sCodeAdd .= $oEditor->attachEditor ('#' . $this->aFormAttrs['id'] . ' [name='.$aInput['name'].']', $iViewMode, $this->_bDynamicMode);
|
|
|
-
|
|
|
- return true;
|
|
|
+ $this->_bVisibilityAutoselect = $bVisibilityAutoselect;
|
|
|
}
|
|
|
|
|
|
protected function _updateFieldObjectPrivacyView($aInput)
|
|
|
@@ -132,6 +144,10 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
|
|
|
'title' => _t('_bx_timeline_form_post_input_object_privacy_view')
|
|
|
)));
|
|
|
|
|
|
+ //--- Show field as is when 'Autoselect' is disabled.
|
|
|
+ if(!$this->_bVisibilityAutoselect)
|
|
|
+ return $aInput;
|
|
|
+
|
|
|
//--- Show default privacy groups and followed contexts on Account (Profile + Connections) post form.
|
|
|
if($this->_bAccountMode)
|
|
|
return $aInput;
|