/** * Add an editor field * * @return SpoonFormTextarea * @param string $name The name of the element. * @param string[optional] $value The value inside the element. * @param string[optional] $class Class(es) that will be applied on the element. * @param string[optional] $classError Class(es) that will be applied on the element when an error occurs. * @param bool[optional] $HTML Will the field contain HTML? */ public function addEditor($name, $value = null, $class = null, $classError = null, $HTML = true) { // redefine $name = (string) $name; $value = $value !== null ? (string) $value : null; $class = 'inputEditor ' . (string) $class; $classError = 'inputEditorError ' . (string) $classError; $HTML = (bool) $HTML; // we add JS because we need TinyMCE $this->header->addJS('tiny_mce/tiny_mce.js', 'core'); $this->header->addJS('tiny_mce/tiny_mce_config.js', 'core', true); // create and return a textarea for TinyMCE return $this->addTextArea($name, $value, $class, $classError, $HTML); }
/** * Add an editor field * * @param string $name The name of the element. * @param string[optional] $value The value inside the element. * @param string[optional] $class Class(es) that will be applied on the element. * @param string[optional] $classError Class(es) that will be applied on the element when an error occurs. * @param bool[optional] $HTML Will the field contain HTML? * @return SpoonFormTextarea */ public function addEditor($name, $value = null, $class = null, $classError = null, $HTML = true) { $name = (string) $name; $value = $value !== null ? (string) $value : null; $class = 'inputEditor ' . (string) $class; $classError = 'inputEditorError ' . (string) $classError; $HTML = (bool) $HTML; // we add JS because we need CKEditor $this->header->addJS('ckeditor/ckeditor.js', 'core', false); $this->header->addJS('ckeditor/adapters/jquery.js', 'core', false); $this->header->addJS('ckfinder/ckfinder.js', 'core', false); // add the internal link lists-file if (SpoonFile::exists(FRONTEND_CACHE_PATH . '/navigation/editor_link_list_' . BL::getWorkingLanguage() . '.js')) { $this->header->addJS('/frontend/cache/navigation/editor_link_list_' . BL::getWorkingLanguage() . '.js', null, null, true); } // create and return a textarea for the editor return $this->addTextArea($name, $value, $class, $classError, $HTML); }
/** * Execute the action * * @return void */ public function execute() { // if not in debug-mode we should include the minified versions if (!SPOON_DEBUG && SpoonFile::exists(BACKEND_CORE_PATH . '/js/minified.js')) { // include the minified JS-file $this->header->addJS('minified.js', 'core', false); } else { // add jquery, we will need this in every action, so add it globally $this->header->addJS('jquery/jquery.js', 'core'); $this->header->addJS('jquery/jquery.ui.js', 'core'); $this->header->addJS('jquery/jquery.tools.js', 'core'); $this->header->addJS('jquery/jquery.backend.js', 'core'); } // add items that always need to be loaded $this->header->addJS('utils.js', 'core', true); $this->header->addJS('backend.js', 'core', true); // add default js file (if the file exists) if (SpoonFile::exists(BACKEND_MODULE_PATH . '/js/' . $this->getModule() . '.js')) { $this->header->addJS($this->getModule() . '.js', null, true); } if (SpoonFile::exists(BACKEND_MODULE_PATH . '/js/' . $this->getAction() . '.js')) { $this->header->addJS($this->getAction() . '.js', null, true); } // if not in debug-mode we should include the minified version if (!SPOON_DEBUG && SpoonFile::exists(BACKEND_CORE_PATH . '/layout/css/minified.css')) { // include the minified CSS-file $this->header->addCSS('minified.css', 'core'); } else { // add css $this->header->addCSS('reset.css', 'core'); $this->header->addCSS('jquery_ui/fork/jquery_ui.css', 'core'); $this->header->addCSS('debug.css', 'core'); $this->header->addCSS('screen.css', 'core'); } // add module specific css if (SpoonFile::exists(BACKEND_MODULE_PATH . '/layout/css/' . $this->getModule() . '.css')) { $this->header->addCSS($this->getModule() . '.css', null); } // store var so we don't have to call this function twice $var = $this->getParameter('var', 'array'); // is there a report to show? if ($this->getParameter('report') !== null) { // show the report $this->tpl->assign('report', true); // camelcase the string $messageName = SpoonFilter::toCamelCase($this->getParameter('report'), '-'); // if we have data to use it will be passed as the var parameter if (!empty($var)) { $this->tpl->assign('reportMessage', vsprintf(BL::msg($messageName), $var)); } else { $this->tpl->assign('reportMessage', BL::msg($messageName)); } // highlight an element with the given id if needed if ($this->getParameter('highlight')) { $this->tpl->assign('highlight', $this->getParameter('highlight')); } } // is there an error to show? if ($this->getParameter('error') !== null) { // camelcase the string $errorName = SpoonFilter::toCamelCase($this->getParameter('error'), '-'); // if we have data to use it will be passed as the var parameter if (!empty($var)) { $this->tpl->assign('errorMessage', vsprintf(BL::err($errorName), $var)); } else { $this->tpl->assign('errorMessage', BL::err($errorName)); } } }
/** * Execute the action */ public function execute() { // add jquery, we will need this in every action, so add it globally $this->header->addJS('jquery/jquery.js', 'core', false); $this->header->addJS('jquery/jquery.ui.js', 'core', false); $this->header->addJS('jquery/jquery.ui.dialog.patch.js', 'core'); $this->header->addJS('jquery/jquery.tools.js', 'core', false); $this->header->addJS('jquery/jquery.backend.js', 'core'); // add items that always need to be loaded $this->header->addJS('utils.js', 'core'); $this->header->addJS('backend.js', 'core', false, true); // add module js if (SpoonFile::exists(BACKEND_MODULE_PATH . '/js/' . $this->getModule() . '.js')) { $this->header->addJS($this->getModule() . '.js', null, false, true); } // add action js if (SpoonFile::exists(BACKEND_MODULE_PATH . '/js/' . $this->getAction() . '.js')) { $this->header->addJS($this->getAction() . '.js', null, false, true); } // add core css files $this->header->addCSS('reset.css', 'core'); $this->header->addCSS('jquery_ui/fork/jquery_ui.css', 'core', false, false); $this->header->addCSS('screen.css', 'core'); $this->header->addCSS('debug.css', 'core'); // add module specific css if (SpoonFile::exists(BACKEND_MODULE_PATH . '/layout/css/' . $this->getModule() . '.css')) { $this->header->addCSS($this->getModule() . '.css'); } // store var so we don't have to call this function twice $var = array_map('strip_tags', $this->getParameter('var', 'array', array())); // is there a report to show? if ($this->getParameter('report') !== null) { // show the report $this->tpl->assign('report', true); // camelcase the string $messageName = strip_tags(SpoonFilter::toCamelCase($this->getParameter('report'), '-')); // if we have data to use it will be passed as the var parameter if (!empty($var)) { $this->tpl->assign('reportMessage', vsprintf(BL::msg($messageName), $var)); } else { $this->tpl->assign('reportMessage', BL::msg($messageName)); } // highlight an element with the given id if needed if ($this->getParameter('highlight')) { $this->tpl->assign('highlight', strip_tags($this->getParameter('highlight'))); } } // is there an error to show? if ($this->getParameter('error') !== null) { // camelcase the string $errorName = strip_tags(SpoonFilter::toCamelCase($this->getParameter('error'), '-')); // if we have data to use it will be passed as the var parameter if (!empty($var)) { $this->tpl->assign('errorMessage', vsprintf(BL::err($errorName), $var)); } else { $this->tpl->assign('errorMessage', BL::err($errorName)); } } }