Example #1
0
function rd_show_page()
{
    RMTemplate::get()->assign('xoops_pagetitle', __('Home Page', 'docs'));
    xoops_cp_header();
    include_once RMCPATH . '/class/form.class.php';
    $content = @file_get_contents(XOOPS_CACHE_PATH . '/rd_homepage.html');
    $content = TextCleaner::getInstance()->to_display($content);
    $editor = new RMFormEditor('', 'homepage', '100%', '450px', $content);
    $rmc_config = RMFunctions::configs();
    if ($rmc_config['editor_type'] == 'tiny') {
        $tiny = TinyEditor::getInstance();
        $tiny->add_config('theme_advanced_buttons1', 'res_index');
    }
    include RMEvents::get()->run_event('docs.get.homepage.template', RMTemplate::get()->get_template('admin/rd_homepage.php', 'module', 'docs'));
    xoops_cp_footer();
}
Example #2
0
/**
 * Muestra el formulario para la creación de un nuevo artículo
 */
function newForm($edit = 0)
{
    global $db, $xoopsModule, $myts, $util, $xoopsConfig, $tpl, $xoopsSecurity, $cuSettings;
    define('RMCSUBLOCATION', 'new_post');
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirectMsg('posts.php', __('Please, specify a valid post ID', 'mywords'), 1);
            die;
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            redirectMsg('posts.php', __('Specified post does not exists!', 'mywords'), 1);
            die;
        }
    }
    // Context help
    $tpl->add_help(__('Publish articles', 'mywords'), 'http://www.xoopsmexico.net/docs/mywords/publicar-entradas/');
    MWFunctions::include_required_files(false);
    RMBreadCrumb::get()->add_crumb(__('Posts', 'mywords'), 'posts.php');
    RMBreadCrumb::get()->add_crumb(__('Write post', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Write post', 'mywords'));
    $head = '<script type="text/javascript" src="' . MW_URL . '/include/forms_post.js"></script>';
    xoops_cp_header($head);
    include RMCPATH . '/class/form.class.php';
    /*include RMCPATH.'/class/fields/formelement.class.php';
      include RMCPATH.'/class/fields/editor.class.php';*/
    TinyEditor::getInstance()->add_config('elements', 'content_editor');
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons1', 'bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,|,spellchecker,fullscreen,|,exm_more,exm_adv', true);
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons2','formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,media,charmap,|,outdent,indent,|,undo,redo,|,exm_img,exm_icons,exm_page', true);
    //echo $post->getVar('content'); die();
    $editor = new RMFormEditor('', 'content', '100%', '350px', $edit ? $post->getVar('content', $cuSettings->editor_type == 'tiny' ? 's' : 'e') : '');
    // Get current metas
    $meta_names = MWFunctions::get()->get_metas();
    //RMTemplate::get()->add_script(RMCURL.'/include/js/jquery.validate.min.js');
    //RMTemplate::get()->add_script(RMCURL.'/include/js/forms.js');
    //RMTemplate::get()->add_head('<script type="text/javascript">$("form#mw-form-posts").validate();</script>');
    include '../templates/admin/mywords-formposts.php';
    xoops_cp_footer();
}
Example #3
0
 public function tinyTags()
 {
     $tiny = TinyEditor::getInstance();
     return $tiny->configuration['extended_valid_elements'];
 }
Example #4
0
/**
* @desc Formulario para crear nueva sección
**/
function formSection($edit = 0)
{
    global $xoopsConfig, $xoopsUser, $xoopsModuleConfig, $id, $res;
    $res = rmc_server_var($_GET, 'id', $res);
    //Verifica si se proporcionó una publicación para la sección
    if ($res <= 0) {
        RDFunctions::error_404();
    }
    $res = new RDResource($res);
    if ($res->isNew()) {
        RDFunctions::error_404();
    }
    //Verificamos si es una publicación aprobada
    if (!$res->getVar('approved')) {
        redirect_header(RDURL, 2, __('Specified section does not exists!', 'docs'));
        die;
    }
    //Verificamos si el usuario tiene permisos de edicion
    if (!$xoopsUser->uid() == $res->getVar('owner') && !$res->isEditor($xoopsUser->uid()) && !$xoopsUser->isAdmin()) {
        redirect_header($section->permalink(), 1, __('Operation not allowed!', 'docs'));
        die;
    }
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', $id);
        //Verifica si la sección es válida
        if ($id == '') {
            RDfunctions::error_404();
        }
        //Comprueba si la sección es existente
        $section = new RDSection($id);
        if ($section->isNew()) {
            RDFunctions::error_404();
        }
    }
    include 'header.php';
    include_once RMCPATH . '/class/form.class.php';
    define('RD_NO_FIGURES', 1);
    $rmc_config = RMFunctions::configs();
    $editor = new RMFormEditor('', 'content', '100%', '300px', $edit ? $section->getVar('content', $rmc_config['editor_type'] == 'tiny' ? 's' : 'e') : '', '', false);
    if ($rmc_config['editor_type'] == 'tiny') {
        $tiny = TinyEditor::getInstance();
        $tiny->configuration['content_css'] .= ',' . XOOPS_URL . '/modules/docs/css/figures.css';
        $tiny->add_config('theme_advanced_buttons1', 'rd_refs');
        $tiny->add_config('theme_advanced_buttons1', 'rd_figures');
        $tiny->add_config('theme_advanced_buttons1', 'rd_toc');
    }
    // Arbol de Secciones
    $sections = array();
    RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $sections, false);
    // Breadcrumb
    RDFunctions::breadcrumb();
    $res_edit = RDFunctions::url() . ($xoopsModuleConfig['permalinks'] ? '/list/' . $res->id() . '/' : '?action=list&id=' . $res->id());
    RMBreadCrumb::get()->add_crumb($res->getVar('title'), $res_edit);
    if ($edit) {
        RMBreadCrumb::get()->add_crumb(sprintf(__('Editing "%s"', 'docs'), $section->getVar('title')));
    } else {
        RMBreadCrumb::get()->add_crumb(__('Create new section', 'docs'));
    }
    RMTemplate::get()->add_jquery(true);
    RMTemplate::get()->add_style('forms.css', 'docs');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/docs/include/js/scripts.php?file=metas.js');
    include RMEvents::get()->run_event('docs.template.formsections.front', RMTemplate::get()->get_template('rd_sec.php', 'module', 'docs'));
    include 'footer.php';
}
Example #5
0
 /**
  * Genera el cdigo HTML para el editor TINY
  * @return string
  */
 private function renderTiny()
 {
     global $rmc_config, $xoopsUser;
     TinyEditor::getInstance()->add_config('elements', $this->getName(), true);
     RMTemplate::get()->add_xoops_style('mce_editor.css', 'rmcommon');
     RMTemplate::get()->add_script(RMCURL . "/include/js/editor.js");
     RMTemplate::get()->add_script(RMCURL . "/include/js/quicktags.js");
     RMTemplate::get()->add_head(TinyEditor::getInstance()->get_js());
     $rtn = "\n\n\t\t<div id=\"ed-container\" style=\"width: {$this->_width}\">\n        <div id=\"es-editor\" style=\"width: {$this->_width};\">\n        <a id=\"edButtonHTML\" class=\"\" onclick=\"switchEditors.go('" . $this->getName() . "', 'html');\">HTML</a>\n        <a id=\"edButtonPreview\" class=\"active\" onclick=\"switchEditors.go('" . $this->getName() . "', 'tinymce');\">Visual</a>\n        </div>\n        <div id=\"quicktags\"><script type=\"text/javascript\">edToolbar('" . $this->getName() . "')</script></div>\n        <textarea id='" . $this->getName() . "' name='" . $this->getName() . "' style='width: 99%; height: " . $this->_height . ";' class='" . $this->getClass() . "'>" . $this->_default . "</textarea></div>";
     return $rtn;
 }
Example #6
0
/**
* @desc Formulario de creación y edición de sección
**/
function rd_show_form($edit = 0)
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity, $xoopsUser, $xoopsModuleConfig, $rmc_config;
    define('RMCSUBLOCATION', 'newresource');
    $id = rmc_server_var($_GET, 'id', 0);
    $parent = rmc_server_var($_GET, 'parent', 0);
    if ($id <= 0) {
        redirectMsg('sections.php?id=' . $id, __('You must select a Document in order to create a new section', 'docs'), 1);
        die;
    }
    // Check if provided Document exists
    global $res;
    $res = new RDResource($id);
    if ($res->isNew()) {
        redirectMsg('sections.php?id=' . $id, __('Specified Document does not exists!', 'docs'), 1);
        die;
    }
    if ($edit) {
        $id_sec = rmc_server_var($_GET, 'sec', 0);
        //Verifica si la sección es válida
        if ($id_sec <= 0) {
            redirectMsg('sections.php?id=' . $id, __('Specify a section to edit', 'docs'), 1);
            die;
        }
        //Comprueba si la sección es existente
        $sec = new RDSection($id_sec);
        if ($sec->isNew()) {
            redirectMsg('sections.php?id=' . $id, __('Specified section does not exists', 'docs'), 1);
            die;
        }
    }
    // Get order
    $order = RDFunctions::order('MAX', $parent, $res->id());
    $order++;
    $rmc_config = RMFunctions::configs();
    $form = new RMForm('', 'frmsec', 'sections.php');
    if ($rmc_config['editor_type'] == 'tiny') {
        $tiny = TinyEditor::getInstance();
        $tiny->add_config('theme_advanced_buttons1', 'rd_refs');
        $tiny->add_config('theme_advanced_buttons1', 'rd_figures');
        $tiny->add_config('theme_advanced_buttons1', 'rd_toc');
    }
    $editor = new RMFormEditor('', 'content', '100%', '300px', $edit ? $rmc_config['editor_type'] == 'tiny' ? $sec->getVar('content') : $sec->getVar('content', 'e') : '', '', 0);
    $usrfield = new RMFormUser('', 'uid', false, $edit ? array($sec->getVar('uid')) : $xoopsUser->getVar('uid'));
    RMTemplate::get()->add_style('admin.css', 'docs');
    RMTemplate::get()->add_script('../include/js/scripts.php?file=metas.js');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.validate.min.js');
    RMTemplate::get()->add_head('<script type="text/javascript">var docsurl = "' . XOOPS_URL . '/modules/docs";</script>');
    RDFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Edit Section', 'docs') : __('Create Section', 'docs')));
    RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Section', 'docs') : __('Create Section', 'docs'));
    xoops_cp_header();
    $sections = array();
    RDFunctions::getSectionTree($sections, 0, 0, $id, 'id_sec, title', isset($sec) ? $sec->id() : 0);
    include RMEvents::get()->run_event('docs.get.secform.template', RMTemplate::get()->get_template('admin/rd_sections_form.php', 'module', 'docs'));
    xoops_cp_footer();
}
Example #7
0
function configure_rm_plugin()
{
    $name = rmc_server_var($_GET, 'plugin', '');
    if ($name == '') {
        redirectMsg('plugins.php', __('You must specify a existing plugin', 'rmcommon'), 1);
        die;
    }
    $plugin = new RMPlugin($name);
    if ($plugin->isNew()) {
        redirectMsg('plugins.php', __('Specified plugin is not installed yet!', 'rmcommon'), 1);
        die;
    }
    if (!$plugin->getVar('status')) {
        redirectMsg('plugins.php', __('Specified plugin is not active!', 'rmcommon'), 1);
        die;
    }
    $rmc_config = RMFunctions::configs();
    $settings = RMFunctions::get()->plugin_settings($name, true);
    $form = new RMForm(sprintf(__('%s configuration', 'rmcommon'), $plugin->getVar('name')), 'frmconfig', 'plugins.php');
    $form->addElement(new RMFormHidden('plugin', $plugin->getVar('dir')));
    $form->addElement(new RMFormHidden('action', 'savesettings'));
    foreach ($plugin->options() as $config => $option) {
        if (isset($settings[$config])) {
            $option['value'] = $settings[$config];
        }
        if (isset($option['separator']) && !empty($option['separator'])) {
            $form->addElement(new RMFormSubTitle($option['separator']['title'], 1, '', $option['separator']['desc']));
            continue;
        }
        switch ($option['fieldtype']) {
            case 'checkbox_groups':
            case 'group_multi':
                $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 1, 1, 3, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'radio_groups':
                $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 0, 1, 3, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'group':
            case 'select_groups':
                $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 0, 0, 3, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_groups_multi':
                $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 1, 0, 3, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'editor':
                if ($rmc_config['editor_type'] == 'tiny') {
                    $tiny = TinyEditor::getInstance();
                    $tiny->add_config('elements', 'conf_' . $config);
                }
                $ele = new RMFormEditor($option['caption'], 'conf_' . $config, is_numeric($option['size']) ? '90%' : $option['size'], '300px', $option['value'], '', 1, array('op'));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'theme':
            case 'select_theme':
                $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'theme_multi':
            case 'select_theme_multi':
                $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'checkbox_theme':
                $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 4);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_theme_admin':
                $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3, 'GUI');
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'yesno':
                $ele = new RMFormYesNo($option['caption'], 'conf_' . $config, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'email':
                $ele = new RMFormText($option['caption'], 'conf_' . $config, $option['size'] > 0 ? $option['size'] : 50, null, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele, false, 'email');
                break;
            case 'select':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                foreach ($option['options'] as $op => $opvalue) {
                    $ele->addOption($opvalue, $op, $opvalue == $option['value'] ? 1 : 0);
                }
                $form->addElement($ele);
                break;
            case 'select_multi':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config . '[]', 1, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                foreach ($option['options'] as $op => $opvalue) {
                    $ele->addOption($opvalue, $op);
                }
                $form->addElement($ele);
                break;
            case 'language':
            case 'select_language':
                $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_language_multi':
                $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'checkbox_language':
                $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'startpage':
            case 'select_modules':
                $ele = new RMFormModules($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3);
                $ele->setInserted(array('--' => __('None', 'rmcommon')));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_modules_multi':
                $ele = new RMFormModules($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3);
                $ele->setInserted(array('--' => __('None', 'rmcommon')));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'checkbox_modules':
                $ele = new RMFormModules($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3);
                $ele->setInserted(array('--' => __('None', 'rmcommon')));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'radio_modules':
                $ele = new RMFormModules($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3);
                $ele->setInserted(array('--' => __('None', 'rmcommon')));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'timezone':
            case 'select_timezone':
                $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'select_timezone_multi':
                $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'checkbox_timezone':
                $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'radio_timezone':
                $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'tplset':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config);
                $tplset_handler =& exm_gethandler('tplset');
                $tplsetlist =& $tplset_handler->getList();
                asort($tplsetlist);
                foreach ($tplsetlist as $key => $name) {
                    $ele->addOption($key, $name, $option['value'] == $key ? 1 : 0);
                }
                $form->addElement($ele);
                break;
            case 'textarea':
                $ele = new RMFormTextArea($option['caption'], 'conf_' . $config, 5, $option['size'] > 0 ? $option['size'] : 50, $option['valuetype'] == 'array' ? $cleaner->htmlspecialchars(implode('|', $option['value'])) : $cleaner->htmlspecialchars($option['value']));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'module_cache':
                $ele = new RMFormCacheModuleField($option['caption'], 'conf_' . $config, $option['value']);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'user_select':
                $ele = new RMFormUser($option['caption'], 'conf_' . $config, $form->getName(), $option['value'], 'select', $limit = '300', '');
                $ele->setOnPage("document.forms[0].op.value='config';");
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele);
                break;
            case 'radio':
                $ele = new RMFormRadio($option['caption'], 'conf_' . $config, 1);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                foreach ($option['options'] as $op => $opvalue) {
                    $ele->addOption($op, $opvalue, $opvalue == $option['value'] ? 1 : 0);
                }
                $form->addElement($ele);
                break;
            case 'font_select':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config, 0, array($option['value']));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $fonts = EXMLists::getFileListAsArray(ABSPATH . '/rmcommon/fonts/');
                foreach ($fonts as $font) {
                    $info = pathinfo(ABSPATH . '/rmcommon/fonts/' . $font);
                    if (strtoupper($info['extension']) != 'TTF') {
                        continue;
                    }
                    $ele->addOption($font, $font);
                }
                $form->addElement($ele);
                break;
            case 'select_editor':
                $ele = new RMFormSelect($option['caption'], 'conf_' . $config, 0, array($option['value']));
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $ele->addOption('tiny', __('Visual Editor', 'rmcommon'));
                $ele->addOption('code', __('EXMCode Editor', 'rmcommon'));
                $ele->addOption('textarea', __('Simple Editor', 'rmcommon'));
                $ele->addOption('html', __('HTML Editor', 'rmcommon'));
                $form->addElement($ele);
                break;
            case 'textbox':
            case 'password':
            default:
                $ele = new RMFormText($option['caption'], 'conf_' . $config, $option['size'] > 0 ? $option['size'] : 50, null, $option['valuetype'] == 'array' ? implode('|', $option['value']) : $option['value'], $option['fieldtype'] == 'password' ? 1 : 0);
                if ($option['desc'] != '') {
                    $ele->setDescription($option['desc']);
                }
                $form->addElement($ele, false, $option['valuetype'] == 'int' || $option['valuetype'] == 'float' ? 'num' : '');
                break;
        }
    }
    $ele = new RMFormButtonGroup();
    $ele->addButton('', __('Save Settings', 'rmcommon'), 'submit');
    $ele->addButton('', __('Cancel', 'rmcommon'), 'button', 'onclick="history.go(-1);"');
    $form->addElement($ele);
    // Other components can add items to database
    $form = RMEvents::get()->run_event("rmcommon.settings.form", $form, $plugin);
    RMFunctions::create_toolbar();
    xoops_cp_header();
    $form->display();
    xoops_cp_footer();
}
Example #8
0
    /**
     * Genera el cdigo HTML para el editor TINY
     * @return string
     */
    private function renderTiny()
    {
        global $rmc_config, $xoopsUser;
        $this->renderAttributeString();
        TinyEditor::getInstance()->add_config('elements', $this->get('id'), true);
        RMTemplate::get()->add_style('editor-tiny.min.css', 'rmcommon');
        RMTemplate::get()->add_script('editor.js', 'rmcommon');
        RMTemplate::get()->add_script('quicktags.min.js', 'rmcommon');
        RMTemplate::get()->add_script(RMCURL . '/api/editors/tinymce/tiny_mce.js');
        RMTemplate::get()->add_inline_script(TinyEditor::getInstance()->get_js());
        RMTemplate::get()->add_inline_script('edToolbar("' . $this->get('id') . '");', 1);
        $plugins = array();
        $plugins = RMEvents::get()->run_event('rmcommon.editor.top.plugins', $plugins, 'tiny', $this->get('id'));
        $rtn = '
		<div class="ed-container" id="ed-cont-' . $this->get('id') . '" style="width: 100%;">
        <div class="es-editor" style="width: 100%;">
        <div class="es-plugins">
            <span class="plugin">' . implode('</span><span class="plugin">', $plugins) . '</span>
        </div>
        <a class="edButtonHTML' . (isset($_COOKIE['editor']) && $_COOKIE['editor'] == 'html' ? ' active' : '') . '" onclick="switchEditors.go(\'' . $this->get('id') . '\', \'html\'); return false;"><span class="fa fa-code"></span> HTML</a>
        <a class="edButtonPreview' . (isset($_COOKIE['editor']) && $_COOKIE['editor'] == 'tinymce' ? ' active' : '') . '" onclick="switchEditors.go(\'' . $this->get('id') . '\', \'tinymce\'); return false;"><span class="fa fa-eye"></span> Visual</a>
        </div>
        <div' . (isset($_COOKIE['editor']) && $_COOKIE['editor'] == 'html' ? ' class="showing"' : '') . '>
        <div class="quicktags"><div id="ed_toolbar_' . $this->get('id') . '"></div></div>
        <textarea onchange="tinyMCE.activeEditor.save();" id="' . $this->get('id') . '" name="' . $this->get('name') . '" style="width: 100%; height: ' . $this->get('height') . ';" class="' . $this->getClass() . '">' . $this->get('default') . '</textarea></div>
        </div>';
        return $rtn;
    }
Example #9
0
/**
 * Muestra el formulario para la creación de un nuevo artículo
 */
function newForm($edit = 0)
{
    global $db, $xoopsModule, $myts, $util, $xoopsConfig, $tpl, $xoopsSecurity;
    define('RMCSUBLOCATION', 'new_post');
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirectMsg('posts.php', __('Please, specify a valid post ID', 'mywords'), 1);
            die;
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            redirectMsg('posts.php', __('Specified post does not exists!', 'mywords'), 1);
            die;
        }
    }
    MWFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . ($edit ? __('Editing post', 'mywords') : __('Creating a new post', 'mywords')));
    $head = '<script type="text/javascript" src="' . MW_URL . '/include/forms_post.js"></script>';
    xoops_cp_header($head);
    include RMCPATH . '/class/form.class.php';
    /*include RMCPATH.'/class/fields/formelement.class.php';
      include RMCPATH.'/class/fields/editor.class.php';*/
    TinyEditor::getInstance()->add_config('elements', 'content_editor');
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons1', 'bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,|,spellchecker,fullscreen,|,exm_more,exm_adv', true);
    //TinyEditor::getInstance()->add_config('theme_advanced_buttons2','formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,media,charmap,|,outdent,indent,|,undo,redo,|,exm_img,exm_icons,exm_page', true);
    //echo $post->getVar('content'); die();
    $editor = new RMFormEditor('', 'content', '99%', '300px', $edit ? $post->getVar('content', $rmc_config['editor_type'] != 'tiny' ? 'e' : 's') : '');
    // Get current metas
    $meta_names = MWFunctions::get()->get_metas();
    //RMTemplate::get()->add_script(RMCURL.'/include/js/jquery.validate.min.js');
    //RMTemplate::get()->add_script(RMCURL.'/include/js/forms.js');
    //RMTemplate::get()->add_head('<script type="text/javascript">$("form#mw-form-posts").validate();</script>');
    include '../templates/admin/mywords_formposts.php';
    xoops_cp_footer();
}