/** * Convert <textarea class="html-edit"> fields to CKEditor fields * * This function needs to be called *after* we have sent the page header and * before we have sent the page footer. * * @param BaseController $controller */ public static function enableEditor($controller) { $controller->addExternalJavascript(WT_CKEDITOR_BASE_URL . 'ckeditor.js')->addExternalJavascript(WT_CKEDITOR_BASE_URL . 'adapters/jquery.js')->addInlineJavascript('var CKEDITOR_BASEPATH="' . WT_CKEDITOR_BASE_URL . '";', BaseController::JS_PRIORITY_HIGH)->addInlineJavascript('CKEDITOR.env.isCompatible = true;')->addInlineJavascript('CKEDITOR.config.removePlugins = "forms,newpage,preview,print,save,templates";')->addInlineJavascript('CKEDITOR.config.extraAllowedContent = "area[shape,coords,href,target,alt,title];map[name];img[usemap];*[class,style]";')->addInlineJavascript('CKEDITOR.config.allowedContent = true;')->addInlineJavascript('jQuery(".html-edit").ckeditor(function(config){config.removePlugins = "forms";}, { language: "' . strtolower(WT_LOCALE) . '" });'); }
/** * Render the view to the page, including header. * * @throws \Exception */ public function render() { global $controller; if (!$this->ctrl) { throw new \Exception('Controller not initialised'); } $controller = $this->ctrl; $this->ctrl->pageHeader(); echo $this->renderContent(); }
/** * Saves Sosa's user preferences (root individual for the user). * * @param BaseController $controller * @return bool True is saving successfull */ protected function update(BaseController $controller) { global $WT_TREE; if ($this->canUpdate() && Filter::checkCsrf()) { $indi = Individual::getInstance(Filter::post('rootid'), $WT_TREE); $user = User::find(Filter::postInteger('userid', -1)); if ($user && $indi) { $WT_TREE->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref()); $controller->addInlineJavascript(' $( document ).ready(function() { majComputeSosa(' . $user->getUserId() . '); });'); FlashMessages::addMessage(I18N::translate('The preferences have been updated.')); return true; } } FlashMessages::addMessage(I18N::translate('An error occurred while saving data...'), 'danger'); return false; }
/** * Convert <textarea class="html-edit"> fields to CKEditor fields * * This function needs to be called *after* we have sent the page header and * before we have sent the page footer. * * @param BaseController $controller */ public static function enableEditor($controller) { $controller->addExternalJavascript(WT_CKEDITOR_BASE_URL . 'ckeditor.js')->addExternalJavascript(WT_CKEDITOR_BASE_URL . 'adapters/jquery.js')->addInlineJavascript('var CKEDITOR_BASEPATH="' . WT_CKEDITOR_BASE_URL . '";', BaseController::JS_PRIORITY_HIGH)->addInlineJavascript('CKEDITOR.env.isCompatible = true;')->addInlineJavascript('CKEDITOR.config.removePlugins = "forms,newpage,preview,print,save,templates";')->addInlineJavascript('jQuery(".html-edit").ckeditor(function(){config.removePlugins = "forms";}, { language: "' . strtolower(WT_LOCALE) . '" });'); }
/** * Convert <textarea class="html-edit"> fields to CKEditor fields * * This function needs to be called *after* we have sent the page header and * before we have sent the page footer. * * @param BaseController $controller */ public static function enableEditor($controller) { $controller->addExternalJavascript(WT_CKEDITOR_BASE_URL . 'ckeditor.js')->addExternalJavascript(WT_CKEDITOR_BASE_URL . 'adapters/jquery.js')->addInlineJavascript('var CKEDITOR_BASEPATH="' . WT_CKEDITOR_BASE_URL . '";', BaseController::JS_PRIORITY_HIGH)->addInlineJavascript('jQuery(".html-edit").ckeditor(function(){}, { language: "' . str_replace('_', '-', strtolower(WT_LOCALE)) . '" });'); }