Seite 2 von 4

Re: Slideshow mit script.aculo.us

Verfasst: Do 16. Jul 2009, 09:23
von ameise
Ich würde gerne noch mal auf das Thema zurückkommen, da ich wirklich nicht verstehe, wo das Problem bei mir liegt.
Ich habe die Slideshow Schritt für Schritt eingebaut. Ohne Einbindung des CSS werden die Bilder untereinander gereiht - das Problem wurde ja schon beschrieben. Wenn ich aber das CSS einbinde bleibt die Stelle, wo sich die Bilder wechseln sollten aber einfach nur weiß (siehe http://www.azure-europe.com/de/boote/bo ... index.html). Was kann das denn sein?

Hier mal der Code:

Code: Alles auswählen

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<base href="http://www.azure-europe.com/cms/" />
<meta name="verify-v1" content="sYWonZ/QnqQ0gYevOxMzvLVduxYU9OG/BGj4u4deU58=" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="de" />
<link rel="shortcut icon" href="favicon.ico">
<script src="js/js_slideshow.js" type="text/javascript"></script>
<script src="js/scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous/src/effects.js" type="text/javascript"></script>
<link href="css/layout_2col_left_13.css" rel="stylesheet" type="text/css" />
<link href="css/layout_lightbox.css" rel="stylesheet" type="text/css" />
<link href="css/layout_slideshow.css" rel="stylesheet" type="text/css" />

<!--[if lte IE 7]> <link href="css/patch_2col_left_13.css" rel="stylesheet" type="text/css" /> <![endif]-->

</head>
<body>
<div class="page_margins">
<div class="page">
<div id="header">
<div id="toplogo"></div>
<div id="topnav"><a href="/de/werft/index.html" title="Werft">Werft</a> | <a href="/de/boote/index.html" title="Boote" class="active">Boote</a> | <a href="/de/messen/index.html" title="Messen">Messen</a> | <a href="/de/kontakt/index.html" title="Kontakt">Kontakt</a> 

</div>
<div id="topimage">
<div class="slideshow-box">
    <div class="slideshow" id="slideshow" style="width:709px;height:259px;">
        
        <div class="slide" style="width:709px;height:259px;"><img src="http://www.azure-europe.com/cms/upload/banner/AZ240_running_00049_ccreplace250.jpg" alt="" width="709" height="259" /></div>
        <div class="slide" style="width:709px;height:259px;"><img src="http://www.azure-europe.com/cms/upload/banner/208z-01.jpg" alt="" width="709" height="259" /></div>
        <div class="slide" style="width:709px;height:259px;"><img src="http://www.azure-europe.com/cms/upload/banner/AZ298_my09_fisheye_pg34_081.jpg" alt="" width="709" height="259" /></div>
        <div class="slide" style="width:709px;height:259px;"><img src="http://www.azure-europe.com/cms/upload/banner/AZ238_floating_00041_cc.jpg" alt="" width="709" height="259" /></div>
        <div class="slide" style="width:709px;height:259px;"><img src="http://www.azure-europe.com/cms/upload/banner/AZ298_running_025_cc.jpg" alt="" width="709" height="259" /></div>
        <div class="slide" style="width:709px;height:259px;"><img src="http://www.azure-europe.com/cms/upload/banner/AZ259cuddy_my09_still_043.jpg" alt="" width="709" height="259" /></div>

        <div class="slide" style="width:709px;height:259px;"><img src="http://www.azure-europe.com/cms/upload/banner/AZ298_my09_run_008.jpg" alt="" width="709" height="259" /></div>
        <div class="slide" style="width:709px;height:259px;"><img src="http://www.azure-europe.com/cms/upload/banner/AZ275_my09_run_012.jpg" alt="" width="709" height="259" /></div>
    </div>
</div>

<script type="text/javascript">//<![CDATA[
    new Slideshow('slideshow', 7000);
//]]></script>
<noscript><p class="noscript">JavaScript Code zum Erstellen der Bilder-Slideshow</p></noscript>
</div>
<div id="topimage_overlay">
<img src="http://www.azure-europe.com/cms/upload/logobalken/topbereich_overlay.jpg" alt="" />
</div>
Ich kann mir gerade wirklich nicht erklären, was da für ein Fehler auftaucht. Für Hilfe wäre ich sehr dankbar.
Barbara

Re: Slideshow mit script.aculo.us

Verfasst: Do 16. Jul 2009, 09:42
von idea-tec
Also, wenn ich die gepostete Seite aufrufe erhalte ich im Browser einen Javascript-Error angezeigt.
Dieser meldet mir "Slideshow ist undefiniert"!!!

Da stimmt (wahrscheinlich) irgendwas mit den Pfaden oder den Dateien nicht. Wobei ich gestehen muss, dass ich nichts erkennen kann.

HINWEIS:
- Man kann die Datei js_slideshow.js bei dir zwar aufrufen, aber diese wird dann nicht ausgeliefert. Prüf mal die Rechte der Datei!
- Man kann auch die Datei: scriptaculous/lib/prototype.js aufrufen, diese wird auch an den Browser ausgeliefert.
Vielleicht hängt es ja damit zusammen.

Re: Slideshow mit script.aculo.us

Verfasst: Do 16. Jul 2009, 10:21
von ameise25
idea-tec hat geschrieben:Also, wenn ich die gepostete Seite aufrufe erhalte ich im Browser einen Javascript-Error angezeigt.
Dieser meldet mir "Slideshow ist undefiniert"!!!
Das ist ja interessant. Den Fehler zeigt er bei mir gar nicht.

Habe alle Datei-Rechte geprüft und wenn ich das recht sehe sind alle Dateien freigegeben.

Re: Slideshow mit script.aculo.us

Verfasst: Do 16. Jul 2009, 10:38
von idea-tec
jetzt sehe ich die slideshow!!!

allerdings noch immer einen javascript-error: "Class" ist undefiniert

Re: Slideshow mit script.aculo.us

Verfasst: Do 16. Jul 2009, 10:43
von ameise25
Habe einfach mal noch ein bischen rumprobiert... bei mir wird sie jetzt auch angezeigt. Aber der javascript-error erscheint bei mir nicht... ??? In welchem Browser schaust du denn?

Re: Slideshow mit script.aculo.us

Verfasst: Do 16. Jul 2009, 10:47
von idea-tec
IE 7.0.6 auf Win Vista

Re: Slideshow mit script.aculo.us

Verfasst: Do 16. Jul 2009, 22:22
von xmurrix
ameise hat geschrieben:...<script src="js/js_slideshow.js" type="text/javascript"></script>
<script src="js/scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous/src/effects.js" type="text/javascript"></script>...
Hallo Ameise,

bei dir liegt das Problem an der falschen Reihenfolge der eingebundenen JS-Dateien.
Im HTML-Markup muss zuerst die prototype.js, dann die effects.js und zum Schluss die js_slideshow.js eingebunden werden. Das ist wichtig, da in effects.js der Code in prototype.js verwendet wird, genauso wie in js_slideshow.js der Code von effects.js.

So sollte es klappen:

Code: Alles auswählen

...
<script src="js/scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous/src/effects.js" type="text/javascript"></script>
<script src="js/js_slideshow.js" type="text/javascript"></script>
...
Gruß
xmurrix

Hilfe: Slideshow

Verfasst: Fr 18. Sep 2009, 14:17
von kodu
Hi,
die slideshow habe ich eingebunden, genau nach Einleitung...
Es scheint auch zu funktionieren, nur habe ich vermutlich keine Ahnung wie ich ein Verzeichnis mit den Bildern genau bestimme :oops:

Es erscheint:
Slideshow: Es wurden keine Bilder im angegebenen Verzeichnis gefunden!

Egal wie ich versuche ein Verzeichnis einzutragen.

Bin für Hinweise dankbar...

Grüße!
Kodu

Re: Slideshow mit script.aculo.us

Verfasst: Sa 24. Okt 2009, 10:58
von hohorstmann
... irgendwie keinen Plan mehr ...

Contenido 4.8.6
Slideshow 0.95
Ich bekomme die Fehlermeldung: "illegal call"

Was habe ich getan?

Code: Alles auswählen

1. Layout geändert:
         <link href="css/style.css" rel="stylesheet" type="text/css">
         <link href="css/style_print.css" rel="stylesheet" type="text/css" media="print">
         <link rel="stylesheet" href="css/slideshow.css" type="text/css" media="screen, projection"></link>
         <script src="js/scriptaculous/lib/prototype.js" type="text/javascript"></script>
         <script src="js/scriptaculous/src/effects.js" type="text/javascript"></script>

Code: Alles auswählen

2. Modul im Backend importiert

Code: Alles auswählen

3. Dateien übertragen
cms/css/slideshow.css
cms/includes/class.uploadmeta.php

/cms/js/scriptaculous/lib/prototype.js
/cms/js/scriptaculous/src/builder.js, .., unittest.js (insgesamt 8 JavaScripts)
/cms/js/slideshow.js

/cms/templates/slideshow.html

Code: Alles auswählen

4. Template erstellt
5. Neuen Artikel erstellt
6. Cache gelöscht
7. Aufruf http://rv-rauxel.de/cms/front_content.php?idcat=57&idart=1240
Folge: Am Ort der SlideShow erscheint die Fehlermeldung: illegal call

Hat da jemand einen Tip für mich?

Re: Slideshow mit script.aculo.us

Verfasst: Sa 24. Okt 2009, 15:25
von idea-tec
welche dateien werden denn im modul per include aufgerufen?

Re: Slideshow mit script.aculo.us

Verfasst: Sa 24. Okt 2009, 15:57
von hohorstmann
Ich habe einmal den kompletten Code unten aufgeführt. Zuerst das Input-, dann das Output-Modul:

Code: Alles auswählen

?><?php
/**
 * Module-Input: Slideshow
 *
 * @author      Murat Purc <murat@purc.de>
 * @copyright   © Murat Purc 2008
 * @package     Contenido
 * @subpackage  Module_Slideshow
 */


if (!class_exists('ModSlideshow')) {

cInclude('classes', 'class.upload.php');

/**
 * Contenido module input class for Slideshow
 *
 * @author      Murat Purc <murat@purc.de>
 * @copyright   © Murat Purc 2008
 * @package     Contenido
 * @subpackage  Module_Slideshow
 */
class ModSlideshow {

    /**
     * Default slideshow speed
     * @var  int
     */
    const DEFAULT_SPEED = 4000;

    /**
     * Selected slideshow order
     * @var  string
     */
    private $_sSelectedOrder;

    /**
     * Assoziative order array
     * @var  array
     */
    private $_aOrder;

    /**
     * Selected folder containing images for the slideshow
     * @var  string
     */
    private $_sSelectedDirname;

    /**
     * Client id
     * @var  int
     */
    private $_client;

    /**
     * Slideshow identifier
     * @var  string
     */
    public $sElementId;

    /**
     * Speed in milliseconds (time between two slides)
     * @var  int
     */
    public $iSpeed;

    /**
     * Horizontal align
     * @var  string
     */
    public $sCenterHorizontalChk;

    /**
     * Max width of slideshow images
     * @var  int
     */
    public $maxWidth;

    /**
     * Max height of slideshow images
     * @var  int
     */
    public $maxHeight;


    /**
     * Max cache time of resized images in minutes
     * @var  int
     */
    public $maxCachetime;


    /**
     * Constructor sets some properties
     *
     * @param  int    $clientId   Client id
     * @param  array  $aSettings  Module settings
     */
    public function __construct($clientId, $aSettings) {
        $this->_client              = (int) $clientId;
        $this->sElementId           = trim($aSettings['elementId']);
        $this->_sSelectedDirname    = $aSettings['selectedDirname'];
        $this->iSpeed               = (int) $aSettings['speed'];
        $this->sCenterHorizontalChk = ($aSettings['centerHorizontalChk'] != '') ? ' checked="checked"' : '';
        $this->maxWidth             = (int) $aSettings['maxWidth'];
        $this->maxHeight            = (int) $aSettings['maxHeight'];
        $this->maxCachetime         = (int) $aSettings['maxCachetime'];
        $this->_sSelectedOrder      = $aSettings['selectedOrder'];
        $this->_aOrder = array(
            'RAND()'         => mi18n("Zufällig"),
            'filename:ASC'   => mi18n("Dateiname aufsteigend"),
            'filename:DESC'  => mi18n("Dateiname absteigend"),
            'size:ASC'       => mi18n("Dateigröße aufsteigend"),
            'size:DESC'      => mi18n("Dateigröße absteigend"),
            'filetype:ASC'   => mi18n("Dateityp aufsteigend"),
            'filetype:DESC'  => mi18n("Dateityp absteigend"),
            'created:ASC'    => mi18n("Erstellungsdatum aufsteigend"),
            'created:esc'    => mi18n("Erstellungsdatum absteigend"),
            'idupl:ASC'      => mi18n("Id aufsteigend"),
            'idupl:DESC'     => mi18n("Id absteigend")
        );

        if ($this->sElementId == '') {
            $this->sElementId = 'slideshow';
        }

        if ($this->iSpeed <= 0) {
            $this->iSpeed = self::DEFAULT_SPEED;
        }

        if ($this->maxWidth <= 0) {
            $this->maxWidth = '';
        }

        if ($this->maxHeight <= 0) {
            $this->maxHeight = '';
        }

        if ($this->maxCachetime <= 0) {
            $this->maxCachetime = '';
        }
    }


    /**
     * Generates and returns option items of the dirname select box.
     *
     * @return  string  Composed option items.
     */
    public function generateDirSelectOptions(){
        $oUploadColl = new UploadCollection();
        $oUploadColl->flexSelect('dirname', '', 'idclient=' . $this->_client, 'dirname');

        $opt = '<option value="">' . mi18n("-- Ordner auswählen --") . '</option>' . "\n";
        while ($oUploadItem = $oUploadColl->next()) {
            $dirname = $oUploadItem->get('dirname');
            $sel = ($dirname == $this->_sSelectedDirname) ? ' selected="selected"' : '';
            $opt .= '<option value="' . $dirname . '"' . $sel . '>' . $dirname . '</option>' . "\n";
        }
        return $opt;
    }


    /**
     * Generates and returns option items of the order select box.
     *
     * @return  string  Composed option items.
     */
    public function generateOrderSelectOptions(){
        $opt = '<option value="">' . mi18n("-- Reihenfolge auswählen --") . '</option>' . "\n";
        foreach ($this->_aOrder as $key => $value) {
            $sel = ($key == $this->_sSelectedOrder) ? ' selected="selected"' : '';
            $opt .= '<option value="' . $key . '"' . $sel . '>' . $value . '</option>' . "\n";
        }
        return $opt;
    }

}
} // if (!class_exists('ModSlideshow'))


$oModSlideshow = new ModSlideshow($client, array(
    'elementId'           => "CMS_VALUE[7]",
    'selectedDirname'     => "CMS_VALUE[0]",
    'speed'               => "CMS_VALUE[1]",
    'centerHorizontalChk' => "CMS_VALUE[2]",
    'maxWidth'            => "CMS_VALUE[3]",
    'maxHeight'           => "CMS_VALUE[4]",
    'maxCachetime'        => "CMS_VALUE[5]",
    'selectedOrder'       => "CMS_VALUE[6]"
));

?>

<!-- module slideshow -->
<table cellspacing="0" cellpadding="3" border="0">
<tr>
    <td valign="top" class="text_medium"><?php print mi18n("ID der Slideshow") ?></td>
    <td>
        <input type="text" class="text_medium" name="CMS_VAR[7]" value="<?php print $oModSlideshow->sElementId ?>" /><br />
        <small><?php print mi18n("(Bei mehrfachem Vorkommen der Slideshow innerhalb einer Seite, muss die ID eindeutig sein, z. B. slideshow, slideshow2, slideshow3, usw.)") ?></small><br />
        <br />
    </td>
</tr>
<tr>
    <td valign="top" class="text_medium"><?php print mi18n("Ordner für Slideshow wählen:") ?></td>
    <td>
        <select name="CMS_VAR[0]" class="text_medium">
        <?php print $oModSlideshow->generateDirSelectOptions() ?>
        </select><br />
        <small><?php print mi18n("(Der ausgewählte Ordner sollte nur Bilder enthalten)") ?></small><br />
        <br />
    </td>
</tr>
<tr>
    <td valign="top" class="text_medium"><?php print mi18n("Reihenfolge der Bilder in der Slideshow:") ?></td>
    <td>
        <select name="CMS_VAR[6]" class="text_medium">
        <?php print $oModSlideshow->generateOrderSelectOptions() ?>
        </select><br />
        <br />
    </td>
</tr>
<tr>
    <td valign="top" class="text_medium"><?php print mi18n("Slideshowgeschwindigkeit in Millisekunden:") ?></td>
    <td class="text_medium">
        <input type="text" class="text_medium" name="CMS_VAR[1]" value="<?php print $oModSlideshow->iSpeed ?>" /> <?php print mi18n("ms") ?><br />
        <small><?php print mi18n("(z. B. 4000 für 4 Sekunden)") ?></small><br />
        <br />
    </td>
</tr>
<tr>
    <td class="text_medium" colspan="2">
        <input type="checkbox" class="text_medium" name="CMS_VAR[2]" value="vcenter"<?php print $oModSlideshow->sCenterHorizontalChk ?> /> <?php print mi18n("Bilder horizontal zentrieren") ?><br />
        <small><?php print mi18n("(Bei unterschiedlich großen Bildern alle Bilder horizontal zentrieren.<br /> Die vertikale Zentrierung kann über CSS definiert werden.)") ?></small><br />
        <br />
    </td>
</tr>
<tr>
    <td valign="top" class="text_medium"><?php print mi18n("Maximale Breite der Bilder:") ?></td>
    <td class="text_medium">
        <input type="text" class="text_medium" name="CMS_VAR[3]" value="<?php print $oModSlideshow->maxWidth ?>" /> <?php print mi18n("Pixel") ?><br />
    </td>
</tr>
<tr>
    <td valign="top" class="text_medium"><?php print mi18n("Maximale Höhe der Bilder:") ?></td>
    <td class="text_medium">
        <input type="text" class="text_medium" name="CMS_VAR[4]" value="<?php print $oModSlideshow->maxHeight ?>" /> <?php print mi18n("Pixel") ?><br />
        <small><?php print mi18n("(Sind Werte für maximale Breite und/oder Höhe angegeben,<br />werden große Bilder heruntergerechnet.)") ?></small><br />
        <br />
    </td>
</tr>
<tr>
    <td valign="top" class="text_medium"><?php print mi18n("Maximale Cachedauer der Bilder:") ?></td>
    <td class="text_medium">
        <input type="text" class="text_medium" name="CMS_VAR[5]" value="<?php print $oModSlideshow->maxCachetime ?>" /> <?php print mi18n("Minuten") ?><br />
        <small><?php print mi18n("(Gilt nur für zu große Bilder, die heruntergerechnet wurden.)") ?></small>
    </td>
</tr>
</table>
<!-- /module slideshow -->

<?php

unset($oModSlideshow);

Code: Alles auswählen

<?php
/**
 * Module-Output: Slideshow
 *
 * @author      Murat Purc <murat@purc.de>
 * @copyright   © Murat Purc 2008
 * @package     Contenido
 * @subpackage  Module_Slideshow
 */


if (!class_exists('ModSlideshow')) {

cInclude('classes', 'class.upload.php');
cInclude('frontend', 'includes/class.uploadmeta.php');
cInclude('includes', 'functions.api.images.php');

/**
 * Contenido module output class for Slideshow
 *
 * @author      Murat Purc <murat@purc.de>
 * @copyright   © Murat Purc 2008
 * @package     Contenido
 * @subpackage  Module_Slideshow
 */
class ModSlideshow {

    /**
     * Default slideshow speed
     * @var  int
     */
    const DEFAULT_SPEED = 4000;

    /**
     * Default cache time of resized images in minutes
     * @var  int
     */
    const DEFAULT_CACHETIME = 10;

    /**
     * Default image width
     * @var  string
     */
    const DEFAULT_WIDTH = '100%';

    /**
     * Default image height
     * @var  string
     */
    const DEFAULT_HEIGHT = '100%';

    /**
     * Supported filetypes for the slideshow
     * @var  string
     */
    const FILE_TYPES = "'jpg','jpeg','png','gif'";

    /**
     * To store occured errors
     * @var  string
     */
    private $_sError = '';

    /**
     * Max calculated image width
     * @var  int
     */
    public $iMaxWidth = 0;

    /**
     * Max calculated image height
     * @var  int
     */
    public $iMaxHeight = 0;

    /**
     * Language id
     * @var  int
     */
    private $_lang;

    /**
     * Assoziative order array
     * @var  array
     */
    private $_aOrder;

    /**
     * Client HTML path
     * @var  string
     */
    private $_sHtmlPath;

    /**
     * Client upload directory
     * @var  string
     */
    private $_sUploadDir;

    /**
     * Absolute path to client upload directory
     * @var  string
     */
    private $_sAbsUploadPath;

    /**
     * Slideshow id
     * @var  string
     */
     private $_sElementId;

    /**
     * Selected slideshow directory
     * @var  string
     */
    private $_sSelectedDirname;

    /**
     * Slideshow speed in miliseconds
     * @var  int
     */
    private $_iSpeed;

    /**
     * Max allowed image width
     * @var  int
     */
    private $_maxAllowedWidth;

    /**
     * Max allowed image height
     * @var  int
     */
    private $_maxAllowedHeight;

    /**
     * Max cache time for resized images in minutes
     * @var  int
     */
    private $_iMaxCachetime;

    /**
     * Flag to center images horizontaly
     * @var  bool
     */
    private $_bCenterImagesHorizontal = false;

    /**
     * Slideshow order 
     * @var  string
     */
    private $_sSelectedOrder;


    /**
     * Constructor sets some properties...
     *
     * @param  array  $aClientCfg  Client configuration
     * @param  int    $iLangId     Language id
     * @param  array  $aSettings   Module settings
     */
    public function __construct($aClientCfg, $iLangId, $aSettings) {
        $this->_lang           = $iLangId;
        $this->_sHtmlPath      = $aClientCfg['path']['htmlpath'];
        $this->_sUploadDir     = $aClientCfg['upl']['frontendpath'];
        $this->_sAbsUploadPath = $aClientCfg['upl']['path'];

        $this->_aOrder = array(
            'RAND()'         => mi18n("Zufällig"),
            'filename:ASC'   => mi18n("Dateiname aufsteigend"),
            'filename:DESC'  => mi18n("Dateiname absteigend"),
            'size:ASC'       => mi18n("Dateigröße aufsteigend"),
            'size:DESC'      => mi18n("Dateigröße absteigend"),
            'filetype:ASC'   => mi18n("Dateityp aufsteigend"),
            'filetype:DESC'  => mi18n("Dateityp absteigend"),
            'created:ASC'    => mi18n("Erstellungsdatum aufsteigend"),
            'created:esc'    => mi18n("Erstellungsdatum absteigend"),
            'idupl:ASC'      => mi18n("Id aufsteigend"),
            'idupl:DESC'     => mi18n("Id absteigend")
        );

        // slideshow id
        $this->_sElementId = trim($aSettings['elementId']);
        if ($this->_sElementId == '') {
            $this->_sElementId = 'slideshow';
        }

        // directory including images 4 the slideshow
        $this->_sSelectedDirname = trim($aSettings['selectedDirname']);
        if ($this->_sSelectedDirname == '') {
            $this->_sError = mi18n("Slideshow: Es ist kein Verzeichnis gewählt!");
            return;
        } elseif (!is_dir($this->_sUploadDir.$this->_sSelectedDirname)) {
            $this->_sError = mi18n("Slideshow: Das gewählte Verzeichnis existiert nicht");
            return;
        }

        // slideshowspeed
        $this->_iSpeed = (int) $aSettings['speed'];
        if ($this->_iSpeed <= 0) {
            $this->_iSpeed = self::DEFAULT_SPEED;
        }

        // flag 2 center all images horizontally
        $this->_bCenterImagesHorizontal = ($aSettings['centerHorizontalChk'] != '') ? true : false;

        // max allowed width of images. bigger ones will be resized
        $this->_maxAllowedWidth = (int) $aSettings['maxWidth'];
        if ($this->_maxAllowedWidth <= 0) {
            $this->_maxAllowedWidth = '';
        }

        // max allowed height of images. bigger ones will also be resized
        $this->_maxAllowedHeight = (int) $aSettings['maxHeight'];
        if ( $this->_maxAllowedHeight <= 0) {
            $this->_maxAllowedHeight = '';
        }

        // max cachetime in minutes 4 resized images
        $this->_iMaxCachetime = (int) $aSettings['maxCachetime'];
        if ($this->_iMaxCachetime <= 0) {
            $this->_iMaxCachetime = self::DEFAULT_CACHETIME;
        } elseif ($this->_maxAllowedWidth == '' && $this->_maxAllowedHeight == '') {
            $this->_iMaxCachetime = self::DEFAULT_CACHETIME;
        }

        // selected order type
        $this->_sSelectedOrder = $aSettings['selectedOrder'];
        if (!isset($this->_sSelectedOrder[$this->_aOrder])) {
            $this->_sSelectedOrder = 'filename:ASC';
        }

    }


    /**
     * Generates the slideshow or a message on any occured error.
     */
    public function generateOutput(){
        if ($this->_sError !== '') {
            print $this->_sError;
            return;
        }

        $oTemplate   = new Template();
        $oUploadColl = new UploadCollection();

        // order settings
        if (strpos($this->_sSelectedOrder, ':') > 0) {
            list($sort, $sortdir) = explode(':', $this->_sSelectedOrder);
            $sOrder = $sort . ' ' . $sortdir;
        } else {
            $sOrder = $this->_sSelectedOrder;
        }
        
        // where statement with selected dir and supported filetypes
        $sWhere = 'dirname="' . $this->_sSelectedDirname . '" AND filetype IN(' . self::FILE_TYPES . ')';

        // run the statement
        $oUploadColl->select($sWhere, '', $sOrder);

        $aImages = array();

        // iterate thru upload collection 2 store data in array
        while ($oUploadItem = $oUploadColl->next()) {
            // some checks
            $sImageFile = $this->_sAbsUploadPath . $this->_sSelectedDirname . $oUploadItem->get('filename');
            if (!is_file($sImageFile) || !is_readable($sImageFile)) {
                continue;
            }

            if (is_numeric($this->_maxAllowedWidth) && is_numeric($this->_maxAllowedHeight)) {
                // bigger images have 2 be resized
                $sImageFile = cApiImgScale(
                    $sImageFile, $this->_maxAllowedWidth, $this->_maxAllowedHeight, false, false, $this->_iMaxCachetime
                );
                if (!$sImageFile) {
                    continue;
                }
                $sImageFile = str_replace($this->_sHtmlPath, '', $sImageFile);
            } else {
                // use original image file
                $sImageFile = $this->_sUploadDir . $this->_sSelectedDirname . $oUploadItem->get('filename');
            }

            // get'n store image dimensions
            $size = $this->_getImageSize($sImageFile);
            $attr = (is_array($size)) ? ' ' . $size[3] : '';

            // add new images array item
            $aImages[$oUploadItem->get('idupl')] = array(
                'size'  => $size,
                'src'   => $sImageFile,
                'alt'   => '',
                'attr'  => $attr
            );
        }

        if (count($aImages) == 0) {
            print mi18n("Slideshow: Es wurden keine Bilder im angegebenen Verzeichnis gefunden!");
            return;
        }

        // now get description by language
        $sWhere = '';
        foreach ($aImages as $idUpl => $item) {
            $sWhere .= ' idupl=' . $idUpl . ' OR ';
        }
        $sWhere = substr($sWhere, 0, -3) . ' AND idlang=' . $this->_lang;
        $oUploadMetaColl = new UploadMetaCollection();
        $oUploadMetaColl->select($sWhere, '', '');

        // iterate upload meta collection 2 store description in images array
        while ($oItem = $oUploadMetaColl->next()) {
            $aImages[$oItem->get('idupl')]['alt'] = htmlspecialchars($oItem->get('description'));
        }

        // max width and height of slideshow box
        $sStyleDimensions  = (is_numeric($this->iMaxWidth)) ? 'width:' . $this->iMaxWidth . 'px;' : 'width:' . self::DEFAULT_WIDTH . ';';
        $sStyleDimensions .= (is_numeric($this->iMaxHeight)) ? 'height:' . $this->iMaxHeight . 'px;' : 'height:' . self::DEFAULT_HEIGHT . ';';
        $sStyleDimensions  = sprintf(' style="%s"', $sStyleDimensions);

        $oTemplate->set('s', 'SLIDESHOW.ID', $this->_sElementId);
        $oTemplate->set('s', 'SLIDESHOW.ATTRIBUTES', $sStyleDimensions);

        // loop images array an fill template
        foreach ($aImages as $image) {
            if ($this->_bCenterImagesHorizontal == true) {
                // comopse css definition 2 center a image horizontally
                $sCenterCss = $this->_css2centerImageHorizontal($image['size']);
                if ($sCenterCss != '') {
                    $image["attr"] .= ' style="'.$sCenterCss.'"';
                }
            }

            $oTemplate->set('d', 'SLIDE.ATTRIBUTES', $sStyleDimensions);
            $oTemplate->set('d', 'IMG.SRC', $image['src']);
            $oTemplate->set('d', 'IMG.ALT', $image['alt']);
            $oTemplate->set('d', 'IMG.ATTRIBUTES', $image['attr']);
            $oTemplate->next();
        }

        $oTemplate->set('s', 'SLIDESHOW.SPEED', $this->_iSpeed);
        $oTemplate->set('s', 'NOSCRIPT', mi18n("JavaScript Code zum Erstellen der Bilder-Slideshow"));

        $oTemplate->generate('templates/slideshow.html', 0, 0);
    }


    /**
     * Returns value of getimagesize function, and also stores maximum width/height of
     * existing images.
     *
     * @param string Image file to ger size array for
     * @return array Returnvalue of getimagesize() function
     * @access private
     */
    private function _getImageSize($file){
        $size = @getimagesize($file);
        if (is_array($size)) {
            if ($this->iMaxWidth < $size[0]) {
                $this->iMaxWidth = $size[0];
            }
            if ($this->iMaxHeight < $size[1]) {
                $this->iMaxHeight = $size[1];
            }
        }
        return $size;
    }


    /**
     * Composes css definition 2 center a image horizontally and returns it back.
     * 
     * @param mixed Array including image size imnformations (result of getimagesize())
     * @return string Composed css definition
     * @access private
     */
    private function _css2centerImageHorizontal($size){
        if (!is_array($size) || $this->iMaxHeight == 0 || ($size[1] == $this->iMaxHeight)) {
            return '';
        }
        $css = "margin-top:".(($this->iMaxHeight - $size[1]) / 2)."px";
        return $css;
    }

}
} // if (!class_exists('ModSlideshow'))


// create slideshow module instance, pass client config and actual language id
$oModSlideshow = new ModSlideshow($cfgClient[$client], $lang, array(
    'elementId'           => "CMS_VALUE[7]",
    'selectedDirname'     => "CMS_VALUE[0]",
    'speed'               => "CMS_VALUE[1]",
    'centerHorizontalChk' => "CMS_VALUE[2]",
    'maxWidth'            => "CMS_VALUE[3]",
    'maxHeight'           => "CMS_VALUE[4]",
    'maxCachetime'        => "CMS_VALUE[5]",
    'selectedOrder'       => "CMS_VALUE[6]"
));

// generate the slideshow
$oModSlideshow->generateOutput();

// save memory
unset($oModSlideshow);

?>

Re: Slideshow mit script.aculo.us

Verfasst: Sa 24. Okt 2009, 16:10
von idea-tec
dann schau mal in die 3 dateien:
cInclude('classes', 'class.upload.php');
cInclude('frontend', 'includes/class.uploadmeta.php');
cInclude('includes', 'functions.api.images.php');
irgendwo in denen steckt eine abfrage drin, die wenn entsprechend ausfällt, wird die weitere ausführung abgebrochen und illegal call ausgegeben.
info: ich gebe hinweise ins blaue, ohne die dateien zu kennen, aber irgendwo muss die ausgabe ja herkommen.

Re: Slideshow mit script.aculo.us

Verfasst: Sa 24. Okt 2009, 16:52
von Oldperl
Hallo,
hohorstmann hat geschrieben:Ich bekomme die Fehlermeldung: "illegal call"...
Kann eigentlich nur die hochgeladene Datei "class.uploadmeta.php" sein, alle anderen aufgeführten Include-Dateien gehören zu Contenido und sollten daher den Security-Fix enthalten.

Gruß aus Franken

Ortwin

Re: Slideshow mit script.aculo.us

Verfasst: Mo 26. Okt 2009, 17:04
von hohorstmann
Ja, das ist sehr gut möglich. Im Script gibt es ganz zu Anfang den Schnipsel:
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
Wenn ich nur wüsste was : CON_FRAMEWORK ist ...

Ich befürchte, dass mir diverse Dateien (Module etc) in meinem Backend fehlen. Ich kenne ja alle für die Slideshow notwendigen Files, aber leider nicht diejenigen, die die eventuell noch dazu gehören könnten. Deswegen bin ich hilf- und ratlos. Sollte nur nur eine Neuinstallation bzw. Update die Lösung sein, dann wäre das eine Katastrophe.

Code: Alles auswählen

<?php

/**
 * Project: 
 * Contenido Content Management System
 * 
 * Description: 
 * Upload meta data item and item collection.
 * NOTE:
 * This file doesn't belongs to official Contenido core, is just a addon to eliminate usage of manual
 * generated sql statements in modules...
 * 
 * Requirements: 
 * @con_php_req 5.0
 * 
 *
 * @package    Contenido Backend classes
 * @version    0.1
 * @author     Murat Purc
 * @copyright  four for business AG <www.4fb.de>
 * @license    http://www.contenido.org/license/LIZENZ.txt
 * @link       http://www.4fb.de
 * @link       http://www.contenido.org
 * 
 * {@internal 
 *   created 2008-09-27, Murat Purc
 *   $Id$
 * }}
 * 
 */

if(!defined('CON_FRAMEWORK')) {
	die('Illegal call');
}
cInclude('classes', 'class.dbfs.php');


class UploadMetaCollection extends ItemCollection
{
	/**
     * Constructor function
     */
	function UploadMetaCollection ()
	{
		global $cfg;
		parent::ItemCollection($cfg["tab"]["upl_meta"], "id_uplmeta");
	}

	function create ($idupl, $idlang, $medianame, $description, $keywords, $internal_notice)
	{
		global $auth;

		$item = parent::create();

		$item->set("idupl", $idupl, false);
		$item->set("idlang", $idlang, false);
		$item->set("medianame", $medianame, false);
		$item->set("description", $description, false);
		$item->set("keywords", $keywords, false);
		$item->set("internal_notice", $internal_notice, false);
		$item->set("author", $auth->auth["uid"]);
		$item->set("created", date("Y-m-d H:i:s"),false);
		$item->store();

		$item->update();

		return ($item);	
	}

	function loadItem ($itemID)
	{
		$item = new UploadMeta();
		$item->loadByPrimaryKey($itemID);
		return ($item);
	}

	function delete ($id)
	{
		return parent::delete($id);
	}
}


class UploadMeta extends Item
{

	/**
     * Constructor function
     */
	function UploadMeta ()
	{
		global $cfg;
		parent::Item($cfg["tab"]["upl_meta"], "id_uplmeta");
	}


	function store ()
	{
		global $auth;
        $this->set("modified", date("Y-m-d H:i:s"),false);
		$this->set("modifiedby", $auth->auth["uid"]);
		parent::store();	
	}

}


Re: Slideshow mit script.aculo.us

Verfasst: Mo 26. Okt 2009, 17:19
von idea-tec
hohorstmann hat geschrieben:Contenido 4.8.6
Slideshow 0.95
Ich bekomme die Fehlermeldung: "illegal call"
Was daran liegt, dass (meines aktuellen Wissens nach) die Funktion

Code: Alles auswählen

if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
erst ab 4.8.7 zur Verfügung steht.

Versuch es deshalb einfach mal so:

Code: Alles auswählen

if(!defined('CON_FRAMEWORK')) {
//die('Illegal call');
}