141
luciorota
A way to modulize image manager
  • 2009/8/19 14:50

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


Here you are a way to modulize image manager.
I think this is the first step to realize a new and improved image manager for xoops...

NOTE: This is a skeleton of an alfa version of a module... don't worry if it isn't complete.

Try this hack in XOOPS 233,it runs also in XOOPS 240b... but step 2 is a little different...

1. add a config in "xoops_data/config/xoopsconfig.php"

<?php

return array(
        
/**#@+
         * Extended HTML editor for {@link XoopsFormDhtmlTextArea}
         *
         * <p>If an extended HTML editor is set, the renderer will be replaced by the specified editor, usually a visual or WYSIWYG editor.</p>
         *
         * <ul>Developer and user guide:
         *  <li><ul>For run-time settings per call
         *          <li>To use an editor pre-configured by {@link XoopsEditor}, e.g. 'fckeditor': <code>$options['editor'] = 'fckeditor';</code></li>
         *          <li>To use a custom editor, e.g. 'MyEditor' class located in "/modules/myeditor/myeditor.php": <code>$options['editor'] = array('MyEditor', XOOPS_ROOT_PATH . "/modules/myeditor/myeditor.php");</code></li>
         *      </ul></li>
         *  <li><ul>For pre-configured settings, which will force to use a editor if no specific editor is set for call
         *          <li><ul>Set up custom configs: in XOOPS_VAR_PATH . '/configs/xoopsconfig.php' set a editor as default, e.g.
         *                  <li>a pre-configured editor 'fckeditor': <code>return array('editor' => 'fckeditor');</code></li>
         *                  <li>a custom editor 'MyEditor' class located in "/modules/myeditor/myeditor.php": <code>return array('editor' => array('MyEditor', XOOPS_ROOT_PATH . "/modules/myeditor/myeditor.php");</code></li>
         *              </ul></li>
         *          <li>To disable the default editor, in XOOPS_VAR_PATH . '/configs/xoopsconfig.php': <code>return array();</code></li>
         *          <li>To disable the default editor for a specific call: <code>$options['editor'] = 'dhtmltextarea';</code></li>
         *      </ul></li>
         * </ul>
         */
        //"editor"    => "fckeditor",
        //"editor"    => "dhtmlext",
        /**#@-*/


        /**#@+
         * Debug level for XOOPS
         *
         * Note: temporary solution only. Will be re-designed in XOOPS 3.0
         *
         * <ul>Displaying debug information to different level(s) of users:
         *  <li> 0 - To all users</li>
         *  <li> 1 - To members</li>
         *  <li> 2 - To admins only</li>
         * </ul>
         */
        
"debugLevel" => 1,
        
/**#@-*/

        /**#@+
         * Imagemanager // hack
         *
         * <p>Relative path to default/custom imagemanager</p>
         */
        //"Imagemanager" => "/imagemanager.php", // XOOPS default image manager
        
"Imagemanager" => "/modules/imagemanager/imagemanager.php",
        
/**#@-*/
    
);

?>




2. modify funcion "codeIcon" in "/class/xoopsform/formdhtmltextarea.php"

function codeIcon()
    {
        
// get imagemanager form xoopsconfig.php
        
$configs =@ include $GLOBALS['xoops']->path"var/configs/xoopsconfig.php" ); // hack
        
$Imagemanager = @$configs['Imagemanager']; // hack

        
$textarea_id $this->getName();
        
$code "<a name='moresmiley'></a>" .
            
"<img src='" XOOPS_URL "/images/url.gif' alt='" _XOOPS_FORM_ALT_URL "' title='" _XOOPS_FORM_ALT_URL "' onclick='xoopsCodeUrl("{$textarea_id}", "" . htmlspecialchars(_ENTERURL, ENT_QUOTES) . "", "" . htmlspecialchars(_ENTERWEBTITLE, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/>&nbsp;" .
            
"<img src='" XOOPS_URL "/images/email.gif' alt='" _XOOPS_FORM_ALT_EMAIL "' title='" _XOOPS_FORM_ALT_EMAIL "' onclick='xoopsCodeEmail("{$textarea_id}", "" . htmlspecialchars(_ENTEREMAIL, ENT_QUOTES) . "");'  onmouseover='style.cursor="hand"'/>&nbsp;" .
            
"<img src='" XOOPS_URL "/images/imgsrc.gif' alt='" _XOOPS_FORM_ALT_IMG "' title='" _XOOPS_FORM_ALT_IMG "' onclick='xoopsCodeImg("{$textarea_id}", "" . htmlspecialchars(_ENTERIMGURL, ENT_QUOTES) . "", "" . htmlspecialchars(_ENTERIMGPOS, ENT_QUOTES) . "", "" . htmlspecialchars(_IMGPOSRORL, ENT_QUOTES) . "", "" . htmlspecialchars(_ERRORIMGPOS, ENT_QUOTES) . "", "" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "");'  onmouseover='style.cursor="hand"'/>&nbsp;" .
            
//"<img src='" . XOOPS_URL . "/images/image.gif' alt='" . _XOOPS_FORM_ALT_IMAGE . "' title='" . _XOOPS_FORM_ALT_IMAGE . "' onclick='openWithSelfMain("" . XOOPS_URL . "/imagemanager.php/?target={$textarea_id}","imgmanager",400,430);'  onmouseover='style.cursor="hand"'/>&nbsp;" . // original
            
"<img src='" XOOPS_URL "/images/image.gif' alt='" _XOOPS_FORM_ALT_IMAGE "' title='" _XOOPS_FORM_ALT_IMAGE "' onclick='openWithSelfMain("" . XOOPS_URL . $Imagemanager . "/?target={$textarea_id}","imgmanager",400,430);'  onmouseover='style.cursor="hand"'/>&nbsp;" // hack
            
"<img src='" XOOPS_URL "/images/smiley.gif' alt='" _XOOPS_FORM_ALT_SMILEY "' title='" _XOOPS_FORM_ALT_SMILEY "' onclick='openWithSelfMain("" . XOOPS_URL . "/misc.php?action=showpopups&type=smilies&target={$textarea_id}","smilies",300,475);'  onmouseover='style.cursor="hand"'/>&nbsp;";
        
$myts =& MyTextSanitizer::getInstance();

        
$extensions array_filter($myts->config['extensions']);
        foreach (
array_keys($extensions) as $key) {
            
$extension $myts->loadExtension($key);
            @list(
$encode$js) = $extension->encode($textarea_id);
            if (empty(
$encode)) continue;
            
$code .= $encode;
            if (!empty(
$js)) {
                
$this->js .= $js;
            }
        }
        
$code .=
            
"<img src='" XOOPS_URL "/images/code.gif' alt='" _XOOPS_FORM_ALT_CODE "' title='" _XOOPS_FORM_ALT_CODE "' onclick='xoopsCodeCode("{$textarea_id}", "" . htmlspecialchars(_ENTERCODE, ENT_QUOTES) . "");'  onmouseover='style.cursor="hand"'/>&nbsp;" .
            
"<img src='" XOOPS_URL "/images/quote.gif' alt='" _XOOPS_FORM_ALT_QUOTE "' title='" _XOOPS_FORM_ALT_QUOTE "' onclick='xoopsCodeQuote("{$textarea_id}", "" . htmlspecialchars(_ENTERQUOTE, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/>";
        return 
$code;
    }




3. download herehttp://luciorota.altervista.org/xoops/modules/wfdownloads/singlefile.php?cid=3&lid=14 and install the MODULE imagemanager (tnx to XGarb)

4. try it!

A QUESTION TO ANY XOOPS GURU
What about this hack... might it be the right way?
Tell me if i'm loosing my time...

TNX



142
luciorota
Re: New image tool
  • 2009/8/16 9:46

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


It's because the module I just realize is still a skeleton of an alfa

Try to click on the image manager button in XOOPS dhtmltextarea editor...

I need help



143
luciorota
Re: New image tool
  • 2009/8/16 6:37

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


1 step: modulize image manager

Try this hack in XOOPS 233

http://luciorota.altervista.org/xoops/modules/wfdownloads/singlefile.php?cid=3&lid=14

What about?... might it be the right way?



144
luciorota
Re: New image tool
  • 2009/8/15 20:48

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


what about talking to Mr. Zollou (www.zollou.net - creator of Extgallery) about it?



145
luciorota
Re: New image tool
  • 2009/8/15 20:43

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


1 step: modulize image manager



146
luciorota
New image tool
  • 2009/8/14 15:02

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


What about including this php script in Xoops?

Smart Image Resizer
Resizes images, intelligently sharpens, crops based on width:height ratios, color fills
transparent GIFs and PNGs, and caches variations for optimal performance
Created by: Joe Lencioni (http://shiftingpixel.com)


here an improved version
http://luciorota.altervista.org/xoops/modules/wfdownloads/singlefile.php?cid=2&lid=13

ELSEWHERE

...including this script?

http://www.codicefacile.it/smartimage/index.php

It will be a very useful improvement...



147
luciorota
Trescore beer and music festival
  • 2009/5/25 7:38

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


http://www.festabirratrescore.it/

made with XOOPS 2.3.3...
Rota Lucio
lucio.rota@gmail.com;
mobile: +39 338 9966321



148
luciorota
Re: Version 2.3.3RC
  • 2009/1/26 13:52

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


i got installer problems in the tarball
Rota Lucio
lucio.rota@gmail.com;
mobile: +39 338 9966321



149
luciorota
Re: X-Center 1.09
  • 2008/10/16 5:33

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


but it runs
Rota Lucio
lucio.rota@gmail.com;
mobile: +39 338 9966321



150
luciorota
Re: X-Center 1.09 -> wysiwyg (formselecteditor.php - fault)
  • 2008/10/15 20:18

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


sorry, some \ desapears... (maybe a [code] tag bug?)

CODE

function render()
{
xoops_load('XoopsEditorHandler');
$editor_handler = XoopsEditorHandler::getInstance();
$editor_handler->allowed_editors = $this->allowed_editors;
$option_select = new XoopsFormSelect("", $this->name, $this->value);

##[ Incorrect Javascript ]#################################################
// $extra = 'onchange="if(this.options[this.selectedIndex].value.length > 0 ){
// window.document.forms.'.$this->form->getName().'.submit();
// }"';
###########################################################################

// Here is the universal version of this it will work on any system as the location.href is the best method for backward compatibility..

$extra = 'onchange=\'location.href="'.$_SERVER['PHP_SELF'].'?';

foreach ($_GET as $key => $value)
if ($key!=$this->name)
$extra .= $key.'='.$value.'&';
$extra .= $this->name.'="+this.options[this.selectedIndex].value+"';
$extra .= '"\'';

/// End of admendment.

$option_select->setExtra($extra);
$option_select->addOptionArray($editor_handler->getList($this->nohtml));

$this->addElement($option_select);

return parent::render();
}

END_CODE
Rota Lucio
lucio.rota@gmail.com;
mobile: +39 338 9966321




TopTop
« 1 ... 12 13 14 (15) 16 17 »



Login

Who's Online

155 user(s) are online (79 user(s) are browsing Support Forums)


Members: 0


Guests: 155


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