public function __construct($aObject, $oTemplate) { parent::__construct($aObject); if ($oTemplate) { $this->_oTemplate = $oTemplate; } else { $this->_oTemplate = BxDolTemplate::getInstance(); } }
public function __construct($aObject, $oTemplate) { parent::__construct($aObject); if ($oTemplate) { $this->_oTemplate = $oTemplate; } else { $this->_oTemplate = $GLOBALS['oSysTemplate']; } }
/** * page code function */ function PageCompMainCode() { ob_start(); if (bx_get('my_textarea')) { echo 'Submitted data:<hr class="bx-def-hr" />' . bx_process_output(bx_get('my_textarea')) . '<hr class="bx-def-hr" />'; } echo '<form method="post" id="my_form">'; // form must have id echo '<textarea id="my_textarea" name="my_textarea" rows="20" cols="80">some text here</textarea>'; // print text area element echo '<input type="submit" value="Submit" class="bx-btn bx-def-margin-sec-top" style="float:none;" />'; echo '</form>'; bx_import('BxDolEditor'); // import editor class $oEditor = BxDolEditor::getObjectInstance(); // get default editor object instance if ($oEditor) { // check if editor is available for using echo $oEditor->attachEditor('#my_textarea'); } // output HTML which will automatically apply editor to textarea element by its id // print all available editors and editors view modes below echo '<hr class="bx-def-hr" />'; $aEditors = array('sys_tinymce'); $aViewModes = array(BX_EDITOR_MINI => 'Mini', BX_EDITOR_STANDARD => 'Standard', BX_EDITOR_FULL => 'Full'); foreach ($aViewModes as $iViewMode => $sViewModeHeader) { echo "<h1>{$sViewModeHeader}</h1>"; foreach ($aEditors as $sEditor) { $sId = 'textarea_' . $sEditor . '_' . $iViewMode; echo '<textarea id="' . $sId . '" name="' . $sId . '" rows="20" cols="80">some text here</textarea>'; $oEditor = BxDolEditor::getObjectInstance($sEditor); if (!$oEditor) { continue; } echo $oEditor->attachEditor('#' . $sId, $iViewMode); echo '<hr class="bx-def-hr" />'; } } return DesignBoxContent("Visual editor", ob_get_clean(), BX_DB_PADDING_DEF); }
function addHtmlEditor($iViewMode, &$aInput) { bx_import('BxDolEditor'); $oEditor = BxDolEditor::getObjectInstance(); if (!$oEditor) { return false; } $this->_sCodeAdd .= $oEditor->attachEditor((!empty($this->aFormAttrs['id']) ? '#' . $this->aFormAttrs['id'] . ' ' : '') . '[name="' . $aInput['name'] . '"]', $iViewMode, isset($aInput['html_dynamic']) ? $aInput['html_dynamic'] : false); if (!isset($aInput['attrs_wrapper']['style'])) { $aInput['attrs_wrapper']['style'] = ''; } $aInput['attrs_wrapper']['style'] = 'width:' . $oEditor->getWidth($iViewMode) . $aInput['attrs_wrapper']['style']; return true; }
/** * Function will generate window with reply message or new compose message; * * @param : $iRecipientID (integer) - recipient's ID ; * @param : $iMessageID (integer) - message ID (optional parameter); * @return : Html presentation data; */ function genReplayMessage($iRecipientID, $iMessageID = 0) { global $oSysTemplate; $iMessageID = (int) $iMessageID; $iRecipientID = (int) $iRecipientID; // check if send message is allowed $aComposeSettings = array(); $sErrMsg = $this->sendMessage('', '', $iRecipientID, $aComposeSettings, true); if ($sErrMsg) { return $sErrMsg; } // init some needed variables ; $sOutputHtml = ''; $aMemberInfo = getProfileInfo($this->aMailBoxSettings['member_id']); $aRecipientInfo = getProfileInfo($iRecipientID); $aLanguageKeys = array('information' => $iMessageID ? _t('_Reply') : _t('_COMPOSE_H1'), 'cancel' => bx_js_string(_t('_Cancel')), 'send' => bx_js_string(_t('_Send')), 'send_copy' => _t('_Send copy to personal email', $aRecipientInfo['NickName']), 'send_copy_my' => _t('_Send copy to my personal email'), 'notify' => _t('_Notify by e-mail', $aRecipientInfo['NickName']), 'error_message' => bx_js_string(_t('_please_fill_next_fields_first'))); if (!empty($aMemberInfo) && !empty($aRecipientInfo)) { // ** generate recipient's information ; $sMemberIcon = get_member_thumbnail($this->aMailBoxSettings['member_id'], 'none'); $sMemberNickName = getNickName($aMemberInfo['ID']); $sMemberLocation = getProfileLink($aMemberInfo['ID']); $sClockImgPath = getTemplateIcon('clock.png'); $sCurrentDate = date('d.m.Y G:i'); $sMessageSubject = $iMessageID ? $this->addReToSubject(db_value("\n SELECT\n `Subject`\n FROM\n `sys_messages`\n WHERE\n `ID` = {$iMessageID}\n AND\n (\n `Sender` = {$this->aMailBoxSettings['member_id']}\n OR\n `Recipient` = {$this->aMailBoxSettings['member_id']}\n )\n ")) : null; $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['send'], 'attrs' => array('onclick' => 'if(typeof oMailBoxReplayMessage != \'undefined\') oMailBoxReplayMessage.sendMessage(' . $iRecipientID . ')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['cancel'], 'attrs' => array('onclick' => 'if(typeof oMailBoxReplayMessage != \'undefined\') oMailBoxReplayMessage.cancelReplay()'))))); $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); $aTemplateKeys = array('error_message' => $aLanguageKeys['error_message'], 'current_page' => 'mail.php', 'information' => $aLanguageKeys['information'], 'member_thumbnail' => $sMemberIcon, 'member_nick_name' => $sMemberNickName, 'member_location' => $sMemberLocation, 'clock_img' => $sClockImgPath, 'date_create' => $sCurrentDate, 'message_subject' => $sMessageSubject, 'send_copy_my' => $aLanguageKeys['send_copy_my'], 'send_copy_to' => $aLanguageKeys['send_copy'], 'notify' => $aLanguageKeys['notify'], 'action_buttons' => $sMessageBoxActions); $sOutputHtml = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['message_replay'], $aTemplateKeys); } bx_import('BxDolEditor'); $oEditor = BxDolEditor::getObjectInstance(); $sEditor = $oEditor ? $oEditor->attachEditor('#compose_message', BX_EDITOR_FULL, true) : ''; return $sEditor . $sOutputHtml; }
function addHtmlEditor($iViewMode, &$aInput) { bx_import('BxDolEditor'); $oEditor = BxDolEditor::getObjectInstance(); if (!$oEditor) { return false; } $this->_sCodeAdd .= $oEditor->attachEditor('#' . $this->aFormAttrs['id'] . ' [name=' . $aInput['name'] . ']', $iViewMode, $this->_bDynamicMode); return true; }
$_page_cont[$_ni]['page_main_code'] = '-=++=-'; global $gConf; $sCssPathUrl = bx_ltrim_str($gConf['url']['css'], BX_DOL_URL_ROOT); $sCssPathDir = bx_ltrim_str("{$gConf['dir']['layouts']}{$gConf['skin']}/css/", BX_DIRECTORY_PATH_ROOT); $GLOBALS['oSysTemplate']->addCss("{$sCssPathDir}|{$sCssPathUrl}|main.css"); $sJsPathUrl = bx_ltrim_str($gConf['url']['js'], BX_DOL_URL_ROOT); $sJsPathDir = bx_ltrim_str($gConf['dir']['js'], BX_DIRECTORY_PATH_ROOT); $GLOBALS['oSysTemplate']->addJs(array('history.js', "{$sJsPathDir}|{$sJsPathUrl}|util.js", "{$sJsPathDir}|{$sJsPathUrl}|BxError.js", "{$sJsPathDir}|{$sJsPathUrl}|BxXmlRequest.js", "{$sJsPathDir}|{$sJsPathUrl}|BxXslTransform.js", "{$sJsPathDir}|{$sJsPathUrl}|BxForum.js", "{$sJsPathDir}|{$sJsPathUrl}|BxHistory.js", "{$sJsPathDir}|{$sJsPathUrl}|BxLogin.js", "{$sJsPathDir}|{$sJsPathUrl}|BxAdmin.js")); $GLOBALS['BxDolTemplateInjections']['page_' . $_ni]['injection_body'][] = array('type' => 'text', 'data' => 'id="body" onload="if(!document.body) { document.body = document.getElementById(\'body\'); }; h = new BxHistory(\'' . $gConf['url']['base'] . '\'); document.h = h; return h.init(\'h\'); "'); if (BX_ORCA_INTEGRATION == 'dolphin') { $aVars = array('ForumBaseUrl' => $gConf['url']['base']); $GLOBALS['oTopMenu']->setCustomSubActions($aVars, 'bx_forum_title', false); } if (isLogged()) { bx_import('BxDolEditor'); $oEditor = BxDolEditor::getObjectInstance(); $sEditorId = isset($_REQUEST['new_topic']) ? '#tinyEditor' : '#fakeEditor'; if ($oEditor) { if ('sys_tinymce' == $oEditor->getObjectName()) { $oEditor->setCustomConf('setup : function(ed) { ed.on("init", function(e) { if ("undefined" === typeof(glOrcaSettings)) glOrcaSettings = tinyMCE.activeEditor["settings"]; orcaInitInstance(ed); }); },'); } $sEditor .= $oEditor->attachEditor($sEditorId, BX_EDITOR_FULL) . '<div id="fakeEditor" style="display:none;"></div>'; } }
function showBuildZone() { $sEditorId = $sEditorCode = ''; bx_import('BxDolEditor'); $oEditor = BxDolEditor::getObjectInstance(); if ($oEditor) { $sEditorId = 'buildZoneEditor'; $sEditorCode = $oEditor->attachEditor('#' . $sEditorId, BX_EDITOR_FULL); } return $sInitEditor . $GLOBALS['oAdmTemplate']->parseHtmlByName('pbuilder_content.html', array('top_controls' => $this->getPageSelector(), 'bx_if:page' => array('condition' => (bool) $this->oPage, 'content' => array('bx_if:delete_link' => array('condition' => !$this->oPage->isSystem, 'content' => array()), 'bx_if:view_link' => array('condition' => !$this->oPage->isSystem, 'content' => array('site_url' => $GLOBALS['site']['url'], 'page_name' => htmlspecialchars($this->oPage->sName))), 'parser_url' => bx_html_attribute($_SERVER['PHP_SELF']), 'page_name' => addslashes($this->oPage->sName), 'page_width_min' => getParam('sys_template_page_width_min'), 'page_width_max' => getParam('sys_template_page_width_max'), 'page_width' => $this->oPage->iPageWidth, 'main_width' => getParam('main_div_width'))), 'bx_if:empty' => array('condition' => !(bool) $this->oPage, 'content' => array('content' => MsgBox(_t('_Empty')))), 'bx_if:editor' => array('condition' => !empty($sEditorCode), 'content' => array('editor_id' => $sEditorId, 'editor_code' => $sEditorCode)))); }
function addHtmlEditor($iViewMode, &$aInput) { bx_import('BxDolEditor'); $oEditor = BxDolEditor::getObjectInstance(); if (!$oEditor) { return false; } if (isset($aInput['html_no_link_conversion']) && $aInput['html_no_link_conversion']) { $oEditor->setCustomConf("remove_script_host: false,\nrelative_urls: false,\n"); } $this->_sCodeAdd .= $oEditor->attachEditor((!empty($this->aFormAttrs['id']) ? '#' . $this->aFormAttrs['id'] . ' ' : '') . '[name="' . $aInput['name'] . '"]', $iViewMode, isset($aInput['dynamic']) ? $aInput['dynamic'] : false); if (!isset($aInput['attrs_wrapper']['style'])) { $aInput['attrs_wrapper']['style'] = ''; } $aInput['attrs_wrapper']['style'] = 'width:' . $oEditor->getWidth($iViewMode) . $aInput['attrs_wrapper']['style']; return true; }
function _getFormBox($sType, $aCmt = array()) { $iCmtId = !empty($aCmt['id']) ? (int) $aCmt['id'] : 0; $iCmtParentId = !empty($aCmt['parent_id']) ? (int) $aCmt['parent_id'] : 0; $sCmtText = !empty($aCmt['text']) ? $this->_prepareTextForEdit($aCmt['text']) : ''; $sTextareaId = "cmt" . bx_gen_method_name($this->_sSystem . "_" . $sType) . "TextArea"; switch ($sType) { case 'post': $sFunction = "submitComment(this)"; $sTextareaId .= $iCmtParentId; break; case 'edit': $sFunction = "updateComment(this, '" . $iCmtId . "')"; $sTextareaId .= $iCmtId; break; } if ($this->_aSystem['is_mood']) { $sMood = ' <div class="cmt-post-reply-mood"> <div class="cmt-post-mood-ctl"><input type="radio" name="CmtMood" value="1" id="' . $this->_sSystem . '-mood-positive" /></div> <div class="cmt-post-mood-lbl"><label for="' . $this->_sSystem . '-mood-positive">' . _t('_Comment Positive') . '</label></div> <div class="cmt-post-mood-ctl"><input type="radio" name="CmtMood" value="-1" id="' . $this->_sSystem . '-mood-negative" /></div> <div class="cmt-post-mood-lbl"><label for="' . $this->_sSystem . '-mood-negative">' . _t('_Comment Negative') . '</label></div> <div class="cmt-post-mood-ctl"><input type="radio" name="CmtMood" value="0" id="' . $this->_sSystem . '-mood-neutral" checked="checked" /></div> <div class="cmt-post-mood-lbl"><label for="' . $this->_sSystem . '-mood-neutral">' . _t('_Comment Neutral') . '</label></div> <div class="clear_both"> </div> </div>'; } $sContent = ' <form name="cmt-post-reply" onsubmit="' . $this->_sJsObjName . '.' . $sFunction . '; return false;"> <input type="hidden" name="CmtParent" value="' . $iCmtParentId . '" /> <input type="hidden" name="CmtType" value="text" /> <div class="cmt-post-reply-text"> <textarea class="cmt-text-' . $sType . ' bx-def-round-corners-with-border" id="' . $sTextareaId . '" name="CmtText">' . $sCmtText . '</textarea> </div> <div class="cmt-post-reply-video">' . getApplicationContent('video_comments', 'recorder', array('user' => $this->_getAuthorId(), 'password' => $this->_getAuthorPassword(), 'extra' => implode('_', array($this->_sSystem . '-' . $this->getId(), $iCmtParentId))), true) . '</div> <div class="cmt-post-reply-post"><button class="bx-btn bx-btn-small" type="submit">' . _t('_Submit Comment') . '</button></div> ' . $sMood . ' </form>'; if ($this->iGlobAllowHtml == 1) { bx_import('BxDolEditor'); $oEditor = BxDolEditor::getObjectInstance(); $sContent .= $oEditor ? $oEditor->attachEditor('#' . $sTextareaId, BX_EDITOR_MINI, $this->bDynamic) : ''; } return $sContent; }
/** * Get initialization section of comments box * * @return string */ function getCmtsInit() { global $site; $sToggleAdd = ''; $sUseHtmlAdd = ''; $ret = ''; if ($this->iGlobAllowHtml == 1 && $this->iGlobUseTinyMCE == 1 && ($this->isEditAllowed() || $this->isPostReplyAllowed() || $this->isEditAllowedAll())) { bx_import('BxDolEditor'); $oEditor = BxDolEditor::getObjectInstance(); $ret .= $oEditor ? $oEditor->attachEditor('textarea[name=CmtText]', BX_EDITOR_MINI) : ''; } $ret .= $sToggleAdd . "\n <script type=\"text/javascript\">\n var " . $this->_sJsObjName . " = new BxDolCmts({\n sObjName : '" . $this->_sJsObjName . "',\n sBaseUrl : '" . $site['url'] . "',\n sSystem : '" . $this->getSystemName() . "',\n sSystemTable: '" . $this->_aSystem['table_cmts'] . "',\n iAuthorId: '" . $this->_getAuthorId() . "',\n iObjId : '" . $this->getId() . "',\n sOrder : '" . $this->getOrder() . "',\n sDefaultErrMsg : '" . _t('_Error occured') . "',\n sConfirmMsg : '" . _t('_Are you sure?') . "',\n sAnimationEffect : '" . $this->_aSystem['animation_effect'] . "',\n sAnimationSpeed : '" . $this->_aSystem['animation_speed'] . "',\n isEditAllowed : " . ($this->isEditAllowed() || $this->isEditAllowedAll() ? 1 : 0) . ",\n isRemoveAllowed : " . ($this->isRemoveAllowed() || $this->isRemoveAllowedAll() ? 1 : 0) . ",\n sTextAreaId: '" . $this->sTextAreaId . "',\n iGlobAllowHtml: " . ($this->iGlobAllowHtml == 1 && $this->iGlobUseTinyMCE == 1 ? 1 : 0) . ",\n iSecsToEdit : " . (int) $this->getAllowedEditTime() . "});\n " . $this->_sJsObjName . ".oCmtElements = {"; for (reset($this->_aCmtElements); list($k, $r) = each($this->_aCmtElements);) { $ret .= "\n'{$k}' : { 'reg' : '{$r['reg']}', 'msg' : \"{$r['msg']}\" },"; } $ret = substr($ret, 0, -1); $ret .= "\n};\n"; if ($this->iGlobAllowHtml == 1 && $this->iGlobUseTinyMCE == 1) { $ret .= $this->_sJsObjName . ".createEditor(0, \$('#cmts-box-" . $this->_sSystem . "-" . $this->_iId . "> .cmt-post-reply form [name=CmtText][tinypossible=true]'), true);\n"; } $ret .= "</script>"; $this->getExtraJs(); $this->getExtraCss(); return $ret; }
/** * Get initialization section of comments box * * @return string */ function getCmtsInit() { global $site; $sReturn = $sToggleAdd = $sUseHtmlAdd = ''; if ($this->iGlobAllowHtml == 1 && $this->iGlobUseTinyMCE == 1 && ($this->isEditAllowed() || $this->isPostReplyAllowed() || $this->isEditAllowedAll()) && !isset($GLOBALS['glBxDolCommentsEditorInitialized'])) { bx_import('BxDolEditor'); $oEditor = BxDolEditor::getObjectInstance(); $sReturn .= $oEditor ? $oEditor->attachEditor('textarea[name=CmtText]', BX_EDITOR_MINI) : ''; $GLOBALS['glBxDolCommentsEditorInitialized'] = 1; } $aParams = array('sObjName' => $this->_sJsObjName, 'sBaseUrl' => $site['url'], 'sSystem' => $this->getSystemName(), 'sSystemTable' => $this->_aSystem['table_cmts'], 'iAuthorId' => $this->_getAuthorId(), 'iObjId' => $this->getId(), 'sOrder' => $this->getOrder(), 'sDefaultErrMsg' => _t('_Error occured'), 'sConfirmMsg' => _t('_Are_you_sure'), 'sAnimationEffect' => $this->_aSystem['animation_effect'], 'sAnimationSpeed' => $this->_aSystem['animation_speed'], 'isEditAllowed' => $this->isEditAllowed() || $this->isEditAllowedAll() ? 1 : 0, 'isRemoveAllowed' => $this->isRemoveAllowed() || $this->isRemoveAllowedAll() ? 1 : 0, 'iAutoHideRootPostForm' => $this->iAutoHideRootPostForm, 'sTextAreaId' => $this->sTextAreaId, 'iGlobAllowHtml' => $this->iGlobAllowHtml == 1 && $this->iGlobUseTinyMCE == 1 ? 1 : 0, 'iSecsToEdit' => (int) $this->getAllowedEditTime(), 'oCmtElements' => $this->_aCmtElements); $this->getExtraJs(); $this->getExtraCss(); return $sReturn . $sToggleAdd . $GLOBALS['oSysTemplate']->_wrapInTagJsCode("var " . $this->_sJsObjName . " = new BxDolCmts(" . json_encode($aParams) . ");" . ($this->iGlobAllowHtml == 1 && $this->iGlobUseTinyMCE == 1 ? $this->_sJsObjName . ".createEditor(0, \$('#cmts-box-" . $this->_sSystem . "-" . $this->_iId . "> .cmt-post-reply form [name=CmtText][tinypossible=true]'), true);" : "")); }