示例#1
0
 public function renderInput($params = null)
 {
     OW::getDocument()->addOnloadScript('
         var _a = $("<a>", {class: "ow_hidden ow_content a"}).appendTo(document.body);
         OW.addCss(".cm-hashtag{cursor:pointer;color:" + _a.css("color") + "}");
         _a.remove();
     ');
     return parent::renderInput($params);
 }
示例#2
0
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     if ($this->textarea !== null) {
         return $this->textarea->renderInput();
     }
     if (OW::getRegistry()->get('baseWsInit') === null) {
         $language = OW::getLanguage();
         $languageDto = BOL_LanguageService::getInstance()->getCurrent();
         $array = array('editorCss' => OW::getPluginManager()->getPlugin('base')->getStaticCssUrl() . 'htmlarea_editor.css', 'themeImagesUrl' => OW::getThemeManager()->getCurrentTheme()->getStaticImagesUrl(), 'imagesUrl' => OW::getRouter()->urlFor('BASE_CTRL_MediaPanel', 'index', array('pluginKey' => 'blog', 'id' => '__id__')), 'labels' => array('buttons' => array('bold' => $language->text('base', 'ws_button_label_bold'), 'italic' => $language->text('base', 'ws_button_label_italic'), 'underline' => $language->text('base', 'ws_button_label_underline'), 'orderedlist' => $language->text('base', 'ws_button_label_orderedlist'), 'unorderedlist' => $language->text('base', 'ws_button_label_unorderedlist'), 'link' => $language->text('base', 'ws_button_label_link'), 'image' => $language->text('base', 'ws_button_label_image'), 'video' => $language->text('base', 'ws_button_label_video'), 'html' => $language->text('base', 'ws_button_label_html'), 'more' => $language->text('base', 'ws_button_label_more'), 'switchHtml' => $language->text('base', 'ws_button_label_switch_html')), 'common' => array('buttonAdd' => $language->text('base', 'ws_add_label'), 'buttonInsert' => $language->text('base', 'ws_insert_label'), 'videoHeadLabel' => $language->text('base', 'ws_video_head_label'), 'htmlHeadLabel' => $language->text('base', 'ws_html_head_label'), 'htmlTextareaLabel' => $language->text('base', 'ws_html_textarea_label'), 'videoTextareaLabel' => $language->text('base', 'ws_video_textarea_label'), 'linkTextLabel' => $language->text('base', 'ws_link_text_label'), 'linkUrlLabel' => $language->text('base', 'ws_link_url_label'), 'linkNewWindowLabel' => $language->text('base', 'ws_link_new_window_label')), 'messages' => array('imagesEmptyFields' => $language->text('base', 'ws_image_empty_fields'), 'linkEmptyFields' => $language->text('base', 'ws_link_empty_fields'), 'videoEmptyField' => $language->text('base', 'ws_video_empty_field'))), 'buttonCode' => OW::getThemeManager()->processDecorator('button', array('label' => '#label#', 'class' => 'ow_ic_add mn_submit')), 'rtl' => $languageDto !== null && (bool) $languageDto->getRtl() ? true : false);
         $script = "window.htmlAreaData = " . json_encode($array);
         OW::getDocument()->addScriptDeclarationBeforeIncludes($script);
         OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'htmlarea.js');
         OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('base')->getStaticCssUrl() . 'htmlarea.css');
         OW::getRegistry()->set('baseWsInit', true);
     }
     $params = array('toolbar' => $this->buttons, 'size' => $this->size);
     if (!empty($this->customBodyClass)) {
         $params["customClass"] = $this->customBodyClass;
     }
     OW::getDocument()->addOnloadScript("\r\n            \$('#{$this->getId()}').get(0).htmlarea = function(){ \$(this).htmlarea( " . json_encode($params) . " );};\r\n            \$('#{$this->getId()}').get(0).htmlareaFocus = function(){this.jhtmlareaObject.iframe[0].contentWindow.focus();};\r\n            \$('#{$this->getId()}').get(0).htmlareaRefresh = function(){if(this.jhtmlareaObject){this.jhtmlareaObject.dispose();\$(this).htmlarea( " . json_encode($params) . " );}};\r\n        ");
     if ($this->value === null && $this->getHasInvitation()) {
         $this->addAttribute('value', $this->getInvitation());
         $this->addAttribute('class', 'invitation');
     }
     if ($this->init) {
         OW::getDocument()->addOnloadScript("\$('#{$this->getId()}').htmlarea( " . json_encode($params) . " );");
     }
     $this->removeAttribute('value');
     if ($this->value === null && $this->getHasInvitation()) {
         $markup = UTIL_HtmlTag::generateTag('textarea', $this->attributes, true, $this->getInvitation());
     } else {
         $markup = UTIL_HtmlTag::generateTag('textarea', $this->attributes, true, htmlspecialchars(BOL_TextFormatService::getInstance()->processWsForInput($this->value, array('buttons' => $this->buttons))));
     }
     return $markup;
 }