1
Feneex
how to "install" WYSIWYG editor for custom blocks?
  • 2005/3/14 11:07

  • Feneex

  • Just popping in

  • Posts: 98

  • Since: 2004/12/25


Hi,

Using koivi with news module, bet don't understand how to make it on custom block form in "Blocks" section

Any help?

2
silver74
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2005/3/14 11:26

  • silver74

  • Just popping in

  • Posts: 21

  • Since: 2004/4/2 2


edidit the file blockform.php (modules/system/admin/blocksadmin)

with that:
Quote:
<?php
// $Id: blockform.php,v 1.8 2003/03/10 13:32:05 okazu Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <https://xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //

include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
include_once XOOPS_ROOT_PATH."/class/wysiwyg/formwysiwygtextarea.php";
$form = new XoopsThemeForm($block['form_title'], 'blockform', 'admin.php');
if (isset($block['name'])) {
$form->addElement(new XoopsFormLabel(_AM_NAME, $block['name']));
}
$side_select = new XoopsFormSelect(_AM_BLKTYPE, "bside", $block['side']);
$side_select->addOptionArray(array(0 => _AM_SBLEFT, 1 => _AM_SBRIGHT, 3 => _AM_CBLEFT, 4 => _AM_CBRIGHT, 5 => _AM_CBCENTER, ));
$form->addElement($side_select);
$form->addElement(new XoopsFormText(_AM_WEIGHT, "bweight", 2, 5, $block['weight']));
$form->addElement(new XoopsFormRadioYN(_AM_VISIBLE, 'bvisible', $block['visible']));
$mod_select = new XoopsFormSelect(_AM_VISIBLEIN, "bmodule", $block['modules'], 5, true);
$module_handler =& xoops_gethandler('module');
$criteria = new CriteriaCompo(new Criteria('hasmain', 1));
$criteria->add(new Criteria('isactive', 1));
$module_list =& $module_handler->getList($criteria);
$module_list[-1] = _AM_TOPPAGE;
$module_list[0] = _AM_ALLPAGES;
ksort($module_list);
$mod_select->addOptionArray($module_list);
$form->addElement($mod_select);
$form->addElement(new XoopsFormText(_AM_TITLE, 'btitle', 50, 255, $block['title']), false);
if ( $block['is_custom'] ) {
$textarea = new XoopsFormWysiwygTextArea(_AM_CONTENT, 'bcontent', $block['content'], 15, 70);
$textarea->setDescription('<span style="font-size:x-small;font-weight:bold;">'._AM_USEFULTAGS.'</span><br /><span style="font-size:x-small;font-weight:normal;">'.sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL.'/').'</span>');
$form->addElement($textarea, true);
$ctype_select = new XoopsFormSelect(_AM_CTYPE, 'bctype', $block['ctype']);
$ctype_select->addOptionArray(array('H' => _AM_HTML, 'P' => _AM_PHP, 'S' => _AM_AFWSMILE, 'T' => _AM_AFNOSMILE));
$form->addElement($ctype_select);
} else {
if ($block['template'] != '') {
$tplfile_handler =& xoops_gethandler('tplfile');
$btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block['bid']);
if (count($btemplate) > 0) {
$form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="'.XOOPS_URL.'/modules/system/admin.php?fct=tplsets&op=edittpl&id='.$btemplate[0]->getVar('tpl_id').'">'._AM_EDITTPL.'</a>'));
} else {
$btemplate2 =& $tplfile_handler->find('default', 'block', $block['bid']);
if (count($btemplate2) > 0) {
$form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="'.XOOPS_URL.'/modules/system/admin.php?fct=tplsets&op=edittpl&id='.$btemplate2[0]->getVar('tpl_id').'" target="_blank">'._AM_EDITTPL.'</a>'));
}
}
}
if ($block['edit_form'] != false) {
$form->addElement(new XoopsFormLabel(_AM_OPTIONS, $block['edit_form']));
}
}
$cache_select = new XoopsFormSelect(_AM_BCACHETIME, 'bcachetime', $block['cachetime']);
$cache_select->addOptionArray(array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK, '2592000' => _MONTH));
$form->addElement($cache_select);
if (isset($block['bid'])) {
$form->addElement(new XoopsFormHidden('bid', $block['bid']));
}
$form->addElement(new XoopsFormHidden('op', $block['op']));
$form->addElement(new XoopsFormHidden('fct', 'blocksadmin'));
$button_tray = new XoopsFormElementTray('', '&nbsp;');
if ($block['is_custom']) {
$button_tray->addElement(new XoopsFormButton('', 'previewblock', _PREVIEW, "submit"));
}
$button_tray->addElement(new XoopsFormButton('', 'submitblock', _SUBMIT, "submit"));
$form->addElement($button_tray);
?>

3
Feneex
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2005/3/14 14:51

  • Feneex

  • Just popping in

  • Posts: 98

  • Since: 2004/12/25


thanx, will check that

4
Feneex
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2005/3/14 14:59

  • Feneex

  • Just popping in

  • Posts: 98

  • Since: 2004/12/25


it's workin' great!


5
abbey
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2005/3/25 17:33

  • abbey

  • Just popping in

  • Posts: 50

  • Since: 2005/3/17


i have tried out what u suggested but it did not work out for me, what shd i do next?

6
sceilig
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2006/3/20 11:12

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I had success in getting the FCKeditor to show up for editing custom blocks, for version 2.2.3 at least. The code given by silver74 above must be for a previous version of Xoops?

I replaced roughly line 85 to line 93
Quote:

if ($instance->isNew()) {
$editelements = $instance->block->getOptions();
}
else {
$editelements = $instance->getOptions();
}
if ($editelements != false) {
$form->addElement(new XoopsFormLabel(_AM_OPTIONS, $editelements));
}


with this

Quote:

include_once XOOPS_ROOT_PATH."/class/xoopseditor/fckeditor/formfckeditor.php";
$content = $instance->getVar('options');
$options['caption'] = "Options";
$options['name'] ='options[0]';
$options['value'] = $content[0];
$options['rows'] = 8;
$options['cols'] = 60;
$options['width'] = '600px';
$options['height'] = '400px';
$t_area = new XoopsFormFckeditor($options,true);
$form->addElement(new XoopsFormLabel(_AM_OPTIONS, $t_area->render()));


The problem I have now though is how to include the XOOPS_URL for paths to images and links in my custom block. I tried using <{$xoops_url}> and <?=XOOPS_URL?> but neither of them get interpreted. Its as if the "Options" field for a custom block has to be just straight html. Any ideas?

7
snow77
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2006/10/15 18:44

  • snow77

  • Just can't stay away

  • Posts: 864

  • Since: 2003/7/23


what silver said works perfect (am using XOOPS 2015)
www.polymorphee.com
www.xoopsdesign.com

8
snow77
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2006/10/18 2:18

  • snow77

  • Just can't stay away

  • Posts: 864

  • Since: 2003/7/23


Sorry, no. It doesn't work, It seemed to, but I am just getting a "taking you back to where you were" message everytime I try to save.

[edit] well, I am comparing the XOOPS 2015 and this old code with the wyswiwyg in it and it definitely needs updating (the old one), with some changes now it does seem to work... so I think it'll be easier to make a 2015 version than fix the other one.
www.polymorphee.com
www.xoopsdesign.com

9
snow77
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2006/10/18 3:06

  • snow77

  • Just can't stay away

  • Posts: 864

  • Since: 2003/7/23


Here is a new version of blockform.php with the koivi to it using Silver's example but this time using the XOOPS 2.0.15 version, the old one lacked a post true code and the new block positioning besides I don't know what else. I did a comparison and just added 1 line and edited another...it is commented. It's actually working now it seems.

Quote:

<?php
// $Id: blockform.php 507 2006-05-26 23:39:35Z skalpa $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <https://xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //

include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
//ADDING KOIVI
include_once XOOPS_ROOT_PATH."/class/wysiwyg/formwysiwygtextarea.php";

$form = new XoopsThemeForm($block['form_title'], 'blockform', 'admin.php', "post", true);
if (isset($block['name'])) {
$form->addElement(new XoopsFormLabel(_AM_NAME, $block['name']));
}
$side_select = new XoopsFormSelect(_AM_BLKTYPE, "bside", $block['side']);
$side_select->addOptionArray(array(0 => _AM_SBLEFT, 1 => _AM_SBRIGHT, 3 => _AM_CBLEFT, 4 => _AM_CBRIGHT, 5 => _AM_CBCENTER, 7 => _AM_CBBOTTOMLEFT, 8 => _AM_CBBOTTOMRIGHT, 9 => _AM_CBBOTTOM, ));
$form->addElement($side_select);
$form->addElement(new XoopsFormText(_AM_WEIGHT, "bweight", 2, 5, $block['weight']));
$form->addElement(new XoopsFormRadioYN(_AM_VISIBLE, 'bvisible', $block['visible']));
$mod_select = new XoopsFormSelect(_AM_VISIBLEIN, "bmodule", $block['modules'], 5, true);
$module_handler =& xoops_gethandler('module');
$criteria = new CriteriaCompo(new Criteria('hasmain', 1));
$criteria->add(new Criteria('isactive', 1));
$module_list =& $module_handler->getList($criteria);
$module_list[-1] = _AM_TOPPAGE;
$module_list[0] = _AM_ALLPAGES;
ksort($module_list);
$mod_select->addOptionArray($module_list);
$form->addElement($mod_select);
$form->addElement(new XoopsFormText(_AM_TITLE, 'btitle', 50, 255, $block['title']), false);
if ( $block['is_custom'] ) {
// $textarea = new XoopsFormDhtmlTextArea(_AM_CONTENT, 'bcontent', $block['content'], 15, 70);
//CHANGED FOR LINE BELOW ADDING KOIVI
$textarea = new XoopsFormWysiwygTextArea(_AM_CONTENT, 'bcontent', $block['content'], 15, 70);
$textarea->setDescription('<span style="font-size:x-small;font-weight:bold;">'._AM_USEFULTAGS.'</span><br /><span style="font-size:x-small;font-weight:normal;">'.sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL.'/').'</span>');
$form->addElement($textarea, true);
$ctype_select = new XoopsFormSelect(_AM_CTYPE, 'bctype', $block['ctype']);
$ctype_select->addOptionArray(array('H' => _AM_HTML, 'P' => _AM_PHP, 'S' => _AM_AFWSMILE, 'T' => _AM_AFNOSMILE));
$form->addElement($ctype_select);
} else {
if ($block['template'] != '') {
$tplfile_handler =& xoops_gethandler('tplfile');
$btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block['bid']);
if (count($btemplate) > 0) {
$form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="'.XOOPS_URL.'/modules/system/admin.php?fct=tplsets&op=edittpl&id='.$btemplate[0]->getVar('tpl_id').'">'._AM_EDITTPL.'</a>'));
} else {
$btemplate2 =& $tplfile_handler->find('default', 'block', $block['bid']);
if (count($btemplate2) > 0) {
$form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="'.XOOPS_URL.'/modules/system/admin.php?fct=tplsets&op=edittpl&id='.$btemplate2[0]->getVar('tpl_id').'" target="_blank">'._AM_EDITTPL.'</a>'));
}
}
}
if ($block['edit_form'] != false) {
$form->addElement(new XoopsFormLabel(_AM_OPTIONS, $block['edit_form']));
}
}
$cache_select = new XoopsFormSelect(_AM_BCACHETIME, 'bcachetime', $block['cachetime']);
$cache_select->addOptionArray(array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK, '2592000' => _MONTH));
$form->addElement($cache_select);
if (isset($block['bid'])) {
$form->addElement(new XoopsFormHidden('bid', $block['bid']));
}
$form->addElement(new XoopsFormHidden('op', $block['op']));
$form->addElement(new XoopsFormHidden('fct', 'blocksadmin'));
$button_tray = new XoopsFormElementTray('', '&nbsp;');
if ($block['is_custom']) {
$button_tray->addElement(new XoopsFormButton('', 'previewblock', _PREVIEW, "submit"));
}
$button_tray->addElement(new XoopsFormButton('', 'submitblock', _SUBMIT, "submit"));
$form->addElement($button_tray);
?>

www.polymorphee.com
www.xoopsdesign.com

10
bnations
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2007/3/30 22:29

  • bnations

  • Just popping in

  • Posts: 7

  • Since: 2007/3/30


It almost worked for me in XOOPS 2.0.16, kiovi shows up but anything I submit is erased and it's like I didn't type anything. Also for some reason I'm getting strange characters in the font selection bars like "_XK_FONT", "_XK_FONT_HEADING1", anyone know how to get rid of that??

Thanks

Login

Who's Online

162 user(s) are online (112 user(s) are browsing Support Forums)


Members: 0


Guests: 162


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits