Fork me on GitHub

Rapport de message :*
 

Intégration facile de InBetween dans Xoops

Titre du sujet : Intégration facile de InBetween dans Xoops
par Darsh sur 17/03/2006 02:14:44

Bonsoir,

Après avoir galéré pendant un bon moment avec InBetween pour les intégrations, j'y suis arrivé, mais j'ai alors cherché un moyen de simplifier la tâche pour tous, et j'ai eu l'idée de remplacer nativement les zones DHTML par InBetween, comme certains l'avaient fait avec koivi, mais l'avantage, c'est qu'au contraire de Koivi, il n'y aura pas de problème de redéclaration générant des erreurs étant donné que si vous faîtes uniquement cette opération, toutes les zones d'édition DHTML seront remplacées par InBetween. Je vous livre ici les modifications à faire, je vous propose de les tester et si ça marche, j'écrirai un article pour que la méthode ne se perde pas dans les messages du forum. Perso, chez moi ça marche du feu de Dieu, sans le moindre bug.

OUVRIR /class/xoopseditor/inbetween/forminbetweentextarea.php

CHERCHER
function render()


REMPLACER PAR
function _render()


OUVRIR /xoops/class/xoopsform/formdhtmltextarea.php

CHERCHER
include_once XOOPS_ROOT_PATH."/class/xoopsform/formtextarea.php";


AJOUTER APRES
include_once(XOOPS_ROOT_PATH "/class/xoopseditor/inbetween/forminbetweentextarea.php");


CHERCHER
class XoopsFormDhtmlTextArea extends XoopsFormTextArea


REMPLACER PAR
class XoopsFormDhtmlTextArea extends XoopsFormInbetweenTextArea


CHERCHER
function XoopsFormDhtmlTextArea($caption$name$value$rows=5$cols=50$hiddentext="xoopsHiddenText")
    {
        
$this->XoopsFormTextArea($caption$name$value$rows$cols);
        
$this->_hiddenText $hiddentext;
    }


REMPLACER PAR
function XoopsFormDhtmlTextArea($caption$name$value$rows='100%'$cols='400px'$hiddentext="xoopsHiddenText")
    {
        
$this->XoopsFormInbetweenTextArea(array('caption'=>$caption'name'=>$name'value'=>$value'width'=>'100%''height'=>'400px'));
    }


CHERCHER
function render()
    {
        
$ret "<a name='moresmiley'></a><img onmouseover='style.cursor="hand"' src='".XOOPS_URL."/images/url.gif' alt='url' onclick='xoopsCodeUrl("".$this->getName()."", "".htmlspecialchars(_ENTERURL, ENT_QUOTES)."", "".htmlspecialchars(_ENTERWEBTITLE, ENT_QUOTES)."");' />&nbsp;<img onmouseover='style.cursor="hand"' src='".XOOPS_URL."/images/email.gif' alt='email' onclick='javascript:xoopsCodeEmail("".$this->getName()."", "".htmlspecialchars(_ENTEREMAIL, ENT_QUOTES)."");' />&nbsp;<img onclick='javascript:xoopsCodeImg("".$this->getName()."", "".htmlspecialchars(_ENTERIMGURL, ENT_QUOTES)."", "".htmlspecialchars(_ENTERIMGPOS, ENT_QUOTES)."", "".htmlspecialchars(_IMGPOSRORL, ENT_QUOTES)."", "".htmlspecialchars(_ERRORIMGPOS, ENT_QUOTES)."");' onmouseover='style.cursor="hand"' src='".XOOPS_URL."/images/imgsrc.gif' alt='imgsrc' />&nbsp;<img onmouseover='style.cursor="hand"' onclick='javascript:openWithSelfMain("".XOOPS_URL."/imagemanager.php?target=".$this->getName()."","imgmanager",400,430);' src='".XOOPS_URL."/images/image.gif' alt='image' />&nbsp;<img src='".XOOPS_URL."/images/code.gif' onmouseover='style.cursor="hand"' alt='code' onclick='javascript:xoopsCodeCode("".$this->getName()."", "".htmlspecialchars(_ENTERCODE, ENT_QUOTES)."");' />&nbsp;<img onclick='javascript:xoopsCodeQuote("".$this->getName()."", "".htmlspecialchars(_ENTERQUOTE, ENT_QUOTES)."");' onmouseover='style.cursor="hand"' src='".XOOPS_URL."/images/quote.gif' alt='quote' /><br />n";

        
$sizearray = array("xx-small""x-small""small""medium""large""x-large""xx-large");
        
$ret .= "<select id='".$this->getName()."Size' onchange='setVisible("".$this->_hiddenText."");setElementSize("".$this->_hiddenText."",this.options[this.selectedIndex].value);'>n";
        
$ret .= "<option value='SIZE'>"._SIZE."</option>n";
        foreach ( 
$sizearray as $size ) {
            
$ret .=  "<option value='$size'>$size</option>n";
        }
        
$ret .= "</select>n";
        
$fontarray = array("Arial""Courier""Georgia""Helvetica""Impact""Verdana");
        
$ret .= "<select id='".$this->getName()."Font' onchange='setVisible("".$this->_hiddenText."");setElementFont("".$this->_hiddenText."",this.options[this.selectedIndex].value);'>n";
        
$ret .= "<option value='FONT'>"._FONT."</option>n";
        foreach ( 
$fontarray as $font ) {
            
$ret .= "<option value='$font'>$font</option>n";
        }
        
$ret .= "</select>n";
        
$colorarray = array("00""33""66""99""CC""FF");
        
$ret .= "<select id='".$this->getName()."Color' onchange='setVisible("".$this->_hiddenText."");setElementColor("".$this->_hiddenText."",this.options[this.selectedIndex].value);'>n";
        
$ret .= "<option value='COLOR'>"._COLOR."</option>n";
        foreach ( 
$colorarray as $color1 ) {
            foreach ( 
$colorarray as $color2 ) {
                foreach ( 
$colorarray as $color3 ) {
                    
$ret .= "<option value='".$color1.$color2.$color3."' style='background-color:#".$color1.$color2.$color3.";color:#".$color1.$color2.$color3.";'>#".$color1.$color2.$color3."</option>n";
                }
            }
        }
        
$ret .= "</select><span id='".$this->_hiddenText."'>"._EXAMPLE."</span>n";
        
$ret .= "<br />n";
        
$ret .= "<img onclick='javascript:setVisible("".$this->_hiddenText."");makeBold("".$this->_hiddenText."");' onmouseover='style.cursor="hand"' src='".XOOPS_URL."/images/bold.gif' alt='bold' />&nbsp;<img onclick='javascript:setVisible("".$this->_hiddenText."");makeItalic("".$this->_hiddenText."");' onmouseover='style.cursor="hand"' src='".XOOPS_URL."/images/italic.gif' alt='italic' />&nbsp;<img onclick='javascript:setVisible("".$this->_hiddenText."");makeUnderline("".$this->_hiddenText."");' onmouseover='style.cursor="hand"' src='".XOOPS_URL."/images/underline.gif' alt='underline' />&nbsp;<img onclick='javascript:setVisible("".$this->_hiddenText."");makeLineThrough("".$this->_hiddenText."");' src='".XOOPS_URL."/images/linethrough.gif' alt='linethrough' onmouseover='style.cursor="hand"' />&nbsp;&nbsp;<input type='text' id='".$this->getName()."Addtext' size='20' />&nbsp;<input type='button' onclick='xoopsCodeText("".$this->getName()."", "".$this->_hiddenText."", "".htmlspecialchars(_ENTERTEXTBOX, ENT_QUOTES)."")' class='formButton' value='"._ADD."' /><br /><br /><textarea id='".$this->getName()."' name='".$this->getName()."' onselect="xoopsSavePosition('".$this->getName()."');" onclick="xoopsSavePosition('".$this->getName()."');" onkeyup="xoopsSavePosition('".$this->getName()."');" cols='".$this->getCols()."' rows='".$this->getRows()."'".$this->getExtra().">".$this->getValue()."</textarea><br />n";
        
$ret .= $this->_renderSmileys();
        return 
$ret;
    }


REMPLACER PAR
function render()
    {
                 return 
$this->_render();
    }


ATTENTION : Ce hack n'a pas été testé sous xoops 2.2.x, je ne suis pas sûr qu'il soit valable pour ces versions, je testerai bientôt.

N'oubliez pas de réinitialiser vos modules pour l'utilisation des zones d'édition dhtml par défaut, le noyau de xoops s'occupera lui-même de fournir InBetween à la place.
Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

42 Personne(s) en ligne (31 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 42 | Plus ...