/** * Constructor * * @param string $caption Caption * @param string $name "name" attribute * @param string $value Initial text * @param int $rows Number of rows * @param int $cols Number of columns * @param string $hiddentext Hidden Text */ public function __construct($caption, $name, $value, $rows = 5, $cols = 50, $hiddentext = "xoopsHiddenText", $options = array()) { parent::__construct($caption, $name, $value, $rows, $cols); $this->_hiddenText = $hiddentext; global $icmsConfig, $icmsModule; $groups = is_object(icms::$user) ? icms::$user->getGroups() : ICMS_GROUP_ANONYMOUS; $moduleid = is_object($icmsModule) && $name != 'com_text' ? $icmsModule->getVar('mid') : 1; if (isset($options['editor']) && $options['editor'] != '' && $options['editor'] != $icmsConfig['editor_default']) { $editor_default = $options['editor']; } else { $editor_default = $icmsConfig['editor_default']; } $gperm_handler = icms::handler('icms_member_groupperm'); if (file_exists(ICMS_EDITOR_PATH . "/" . $editor_default . "/xoops_version.php") && $gperm_handler->checkRight('use_wysiwygeditor', $moduleid, $groups, 1, FALSE)) { include ICMS_EDITOR_PATH . "/" . $editor_default . "/xoops_version.php"; $this->htmlEditor = array($editorversion['class'], ICMS_EDITOR_PATH . "/" . $editorversion['dirname'] . "/" . $editorversion['file']); } if (!empty($this->htmlEditor)) { $options['name'] = $this->_name; $options['value'] = $this->_value; list($class, $path) = $this->htmlEditor; include_once $path; if (class_exists($class)) { $this->htmlEditor = new $class($options); } else { $this->htmlEditor = FALSE; } } }
/** * Renders the editor * @return string the constructed html string for the editor */ public function render() { if ($this->_editor) { return $this->_editor->render(); } else { return parent::render(); } }
$method = "set" . ucfirst($key); $this->{$method}($val); } else { $this->config[$key] = $val; } } } if ($checkCompatible && !$this->isCompatible()) { return false; } parent::__construct("", $this->getName(), $this->getValue()); parent::setExtra("style='width:" . $this->_width . ";height:" . $this->_height . ";'"); } /** * Check if compatible * * @return */ function isCompatible() { return is_readable(ICMS_ROOT_PATH . $this->rootpath . "/codemirror.php"); } function render() { $ret = parent::render(); // take xml for html rendering if ($this->config['syntax'] == 'html') { $this->config['syntax'] = 'xml'; } $css = array(); $js = array(); $this->config['syntax'] = !isset($this->config['syntax']) ? 'php' : $this->config['syntax']; switch ($this->config['syntax']) { case 'php': $js[] = '"../contrib/' . $this->config['syntax'] . '/js/tokenizephp.js"'; case 'lua': case 'python': $css[] = '"' . ICMS_URL . $this->rootpath . '/editor/contrib/' . $this->config['syntax'] . '/css/' . $this->config['syntax'] . 'colors.css"'; $js[] = '"../contrib/' . $this->config['syntax'] . '/js/parse' . $this->config['syntax'] . '.js"'; break; case 'xml': case 'css': case 'javascript': case 'js': case 'sparql': if ($this->config['syntax'] == 'javascript') { $this->config['syntax'] = 'js'; } $js[] = '"parse' . $this->config['syntax'] . '.js"'; $css[] = '"' . ICMS_URL . $this->rootpath . '/editor/css/' . $this->config['syntax'] . 'colors.css"'; break; case 'mixed': $js[] = '"parsexml.js"';
public function render() { $ret = parent::render(); $ret .= ' <script language="javascript" type="text/javascript" src="' . ICMS_URL . $this->rootpath . '/editor/edit_area_compressor.php?plugins"></script> <script language="javascript" type="text/javascript"> editAreaLoader.init({ id: "' . $this->getName() . '_tarea", syntax: "' . (!isset($this->config['syntax']) ? 'php' : $this->config['syntax']) . '", language: "' . (!isset($this->config['language']) ? 'en' : $this->config['language']) . '", start_highlight: ' . (!isset($this->config['start_highlight']) ? 'true' : ($this->config['start_highlight'] ? 'true' : 'false')) . ', allow_resize: ' . (!isset($this->config['allow_resize']) ? 'false' : ($this->config['allow_resize'] ? 'true' : 'false')) . ', allow_toggle: ' . (!isset($this->config['allow_toggle']) ? 'false' : ($this->config['allow_toggle'] ? 'true' : 'false')) . ', fullscreen: ' . (!isset($this->config['fullscreen']) ? 'false' : ($this->config['fullscreen'] ? 'true' : 'false')) . ', is_editable: ' . (!isset($this->config['is_editable']) ? 'true' : ($this->config['is_editable'] ? 'true' : 'false')) . ', autocompletion: ' . (!isset($this->config['autocompletion']) ? 'true' : ($this->config['autocompletion'] ? 'true' : 'false')) . ' }); </script>'; return $ret; }
/** * Constructor * * @param array $configs Editor Options * @param binary $checkCompatible true - return false on failure */ function XoopsFormFckeditor($configs, $checkCompatible = false) { $current_path = __FILE__; if (DIRECTORY_SEPARATOR != "/") { $current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, "/", $current_path); } $this->rootpath = substr(dirname($current_path), strlen(ICMS_ROOT_PATH)); if (is_array($configs)) { $vars = array_keys(get_object_vars($this)); foreach ($configs as $key => $val) { if (in_array("_" . $key, $vars)) { $this->{"_" . $key} = $val; } else { $this->config[$key] = $val; } } } if ($checkCompatible && !$this->isCompatible()) { return false; } parent::__construct("", @$this->_name, @$this->_value); parent::setExtra("style='width: " . $this->_width . "; height: " . $this->_height . ";'"); }
public function render() { global $xoTheme; $ret = parent::render(); $xoTheme->addScript(ICMS_URL . $this->rootpath . '/editor/edit_area_full_with_plugins.js', array('type' => 'text/javascript'),''); // @todo this still has to be added like this - until someone figures it out $ret .= ' <script language="javascript" type="text/javascript" src="' . ICMS_URL . $this->rootpath . '/editor/edit_area_full_with_plugins.js"></script> <script language="javascript" type="text/javascript"> editAreaLoader.init({ id: "' . $this->getName() . '_tarea", syntax: "' . (!isset($this->config['syntax']) ? 'php' : $this->config['syntax']) . '", language: "' . (!isset($this->config['language']) ? 'en' : $this->config['language']) . '", start_highlight: ' . (!isset($this->config['start_highlight']) ? 'true' : ($this->config['start_highlight'] ? 'true' : 'false')) . ', allow_resize: ' . (!isset($this->config['allow_resize']) ? 'false' : ($this->config['allow_resize'] ? 'true' : 'false')) . ', allow_toggle: ' . (!isset($this->config['allow_toggle']) ? 'false' : ($this->config['allow_toggle'] ? 'true' : 'false')) . ', fullscreen: ' . (!isset($this->config['fullscreen']) ? 'false' : ($this->config['fullscreen'] ? 'true' : 'false')) . ', is_editable: ' . (!isset($this->config['is_editable']) ? 'true' : ($this->config['is_editable'] ? 'true' : 'false')) . ', autocompletion: ' . (!isset($this->config['autocompletion']) ? 'true' : ($this->config['autocompletion'] ? 'true' : 'false')) . ' }); </script>'; return $ret; }
/** * Constuctor * * @param string $caption caption * @param string $name name * @param string $value initial content * @param int $rows number of rows * @param int $cols number of columns */ function XoopsFormTextArea($caption, $name, $value = "", $rows = 5, $cols = 50) { parent::__construct($caption, $name, $value, $rows, $cols); $this->_deprecated = icms_core_Debug::setDeprecated('icms_form_elements_Textarea', sprintf(_CORE_REMOVE_IN_VERSION, '1.4')); }
/** * prepare HTML for output * @return string $ret HTML */ function render() { $ret = $this->tinymce->render(); $ret .= parent::render(); $ret .= '<a href="#" id="switchtinymce" title="' . _TOGGLETINY . '" onclick="showMCE(\'' . $this->_name . '_tarea\'); return false;" style="float:' . _GLOBAL_RIGHT . '; display:box; background:#F0F0EE; padding:3px; margin-right:2px; border: 1px solid #ccc; border-top: none;">' . _TOGGLETINY . '</a>'; $ret .= '<br clear="' . _GLOBAL_RIGHT . '" />'; return $ret; }
/** * Gets a control from the targetobject (@todo, which object will be passed here?) * * @param string $controlName name of the control element * @param string $key key of the form variables in the targetobject */ private function getControl($controlName, $key) { switch ($controlName) { case 'color': $control = $this->targetObject->getControl($key); $controlObj = new icms_form_elements_Colorpicker($this->targetObject->vars[$key]['form_caption'], $key, $this->targetObject->getVar($key)); return $controlObj; break; case 'label': return new icms_form_elements_Label($this->targetObject->vars[$key]['form_caption'], $this->targetObject->getVar($key)); break; case 'textarea': $form_rows = isset($this->targetObject->controls[$key]['rows']) ? $this->targetObject->controls[$key]['rows'] : 5; $form_cols = isset($this->targetObject->controls[$key]['cols']) ? $this->targetObject->controls[$key]['cols'] : 60; $editor = new icms_form_elements_Textarea($this->targetObject->vars[$key]['form_caption'], $key, $this->targetObject->getVar($key, 'e'), $form_rows, $form_cols); if ($this->targetObject->vars[$key]['form_dsc']) { $editor->setDescription($this->targetObject->vars[$key]['form_dsc']); } return $editor; break; case 'dhtmltextarea': $editor = new icms_form_elements_Dhtmltextarea($this->targetObject->vars[$key]['form_caption'], $key, $this->targetObject->getVar($key, 'e'), 15, 50); if ($this->targetObject->vars[$key]['form_dsc']) { $editor->setDescription($this->targetObject->vars[$key]['form_dsc']); } return $editor; break; case 'theme': return $this->getThemeSelect($key, $this->targetObject->vars[$key]); break; case 'theme_multi': return $this->getThemeSelect($key, $this->targetObject->vars[$key], TRUE); break; case 'timezone': return new icms_form_elements_select_Timezone($this->targetObject->vars[$key]['form_caption'], $key, $this->targetObject->getVar($key)); break; case 'group': return new icms_form_elements_select_Group($this->targetObject->vars[$key]['form_caption'], $key, FALSE, $this->targetObject->getVar($key, 'e'), 1, FALSE); break; case 'group_multi': return new icms_form_elements_select_Group($this->targetObject->vars[$key]['form_caption'], $key, FALSE, $this->targetObject->getVar($key, 'e'), 5, TRUE); break; case 'user_multi': return new icms_form_elements_select_User($this->targetObject->vars[$key]['form_caption'], $key, FALSE, $this->targetObject->getVar($key, 'e'), 5, TRUE); break; case 'password': return new icms_form_elements_Password($this->targetObject->vars[$key]['form_caption'], $key, 50, 255, $this->targetObject->getVar($key, 'e')); break; case 'country': return new icms_form_elements_select_Country($this->targetObject->vars[$key]['form_caption'], $key, $this->targetObject->getVar($key, 'e')); break; case 'sourceeditor': // leave as last element so that default is executed for sourceeditor as well icms_core_Debug::setDeprecated('icms_ipf_form_elements_Source', sprintf(_CORE_REMOVE_IN_VERSION, '1.4')); $controlName = "source"; default: $classname = "icms_ipf_form_elements_" . ucfirst($controlName); if (!class_exists($classname)) { /** @todo remove in 1.4 or even for 1.3 final */ $classname = "IcmsForm" . ucfirst($controlName) . "Element"; if (!class_exists($classname)) { if (file_exists(ICMS_ROOT_PATH . "/class/icmsform/elements/" . strtolower($classname) . ".php")) { include_once ICMS_ROOT_PATH . "/class/icmsform/elements/" . strtolower($classname) . ".php"; } else { // perhaps this is a control created by the module $moduleName = $this->targetObject->handler->_moduleName; if ($moduleName != 'system') { $moduleFormElementsPath = $this->targetObject->handler->_modulePath . "/class/form/elements/"; } else { $moduleFormElementsPath = $this->targetObject->handler->_modulePath . "/admin/{$name}/class/form/elements/"; } $classname = ucfirst($moduleName) . ucfirst($controlName) . "Element"; $classFileName = strtolower($classname) . ".php"; if (file_exists($moduleFormElementsPath . $classFileName)) { include_once $moduleFormElementsPath . $classFileName; } else { trigger_error($classname . " not found", E_USER_WARNING); return new icms_form_elements_Label(); } } } } return new $classname($this->targetObject, $key); break; } }
/** * Constructor * * @param string $caption Caption * @param string $name "name" attribute * @param string $value Initial text * @param array $configs configures * @param bool $noHtml use non-WYSIWYG eitor onfailure * @param string $OnFailure editor to be used if current one failed */ function icms_form_elements_Editor($caption, $name, $editor_configs = null, $noHtml = false, $OnFailure = "") { parent::__construct($caption, $editor_configs["name"]); $editor_handler = icms_plugins_EditorHandler::getInstance(); $this->editor =& $editor_handler->get($name, $editor_configs, $noHtml, $OnFailure); }