Luxbum.net - Script de galerie photo

Changeset 222

Show
Ignore:
Timestamp:
05/28/07 18:20:15 (1 year ago)
Author:
nicolas
Message:

slideshow commence à marcher

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/api/process/commonfile.php

    r201 r222  
    11<?php 
    22 
     3// 1,2,4,8,16 etc, so can define masks 
    34define('TYPE_IMAGE_FILE', 1); 
    45define('TYPE_FLV_FILE', 2); 
     6 
    57 
    68/** 
  • trunk/api/process/luxbumgallery.php

    r221 r222  
    3131    * Default constructor 
    3232    * @param String $dir Dossier de la galerie 
     33    * @param integer $fileType Type de fichiers souhaités dans la galerie 
    3334    * @return luxBumGallery 
    3435    */ 
    35    function __construct($dir, $preview = '') { 
     36   function __construct($dir, $fileType = '') { 
    3637      parent::__construct(); 
    37       $this->preview = $preview
     38      $this->preview = ''
    3839 
    3940      $this->dir = files::addTailSlash($dir); 
     
    4243      $this->name = $list[count($list) - 1]; 
    4344 
    44       $this->addAllImages(); 
     45      $this->addAllFiles($fileType); 
    4546      $this->_completeInfos (); 
    4647      $this->_loadPrivate(); 
     
    278279    * They have all their date / description correctly filled in. 
    279280    */ 
    280    function addAllImages() { 
     281   private function addAllFiles($fileType) { 
     282       
     283      if ($fileType == '') { 
     284         $fileType = TYPE_IMAGE_FILE | TYPE_FLV_FILE; 
     285      } 
    281286 
    282287      // Ouverture du dossier des photos 
     
    291296             
    292297            // Add an image file 
    293             if (files::isPhotoFile ($this->dir, $current_file)) { 
     298            if (files::isPhotoFile ($this->dir, $current_file) && ($fileType & TYPE_IMAGE_FILE)) { 
    294299               $imageTemp = new luxBumImage ($this->dir, $current_file); 
    295300                 
     
    308313             
    309314            // Add a flash video file 
    310             else if (files::isFlvFile($this->dir, $current_file)) { 
     315            else if (files::isFlvFile($this->dir, $current_file) && ($fileType & TYPE_FLV_FILE)) { 
    311316               $object = new LuxbumFlv($this->dir, $current_file); 
    312317               $this->addToList($object); 
  • trunk/api/ui/public/Gallery.php

    r221 r222  
    3636      $gallery = new luxBumGallery($dir); 
    3737      $gallery->createOrMajDescriptionFile(); 
    38       $gallery->getDescriptions(); 
    3938 
    4039      $imgIndex = $gallery->getImageIndex($defaultImage); 
  • trunk/api/ui/public/SlideShow.php

    r221 r222  
    2121    */ 
    2222   function action($request, $match) { 
    23       $dir = $match[1]; 
     23      $dir = files::addTailSlash($match[1]); 
     24      $defaultImage = $match[2]; 
    2425       
    2526      // Check if the gallery is private 
    26           $this->checkDir($dir); 
     27          $this->checkFile($dir, $defaultImage); 
    2728      $this->checkPrivate($dir); 
    2829 
     
    3031      $GLOBALS['LB']['title'] =  ' - '.NOM_GALERIE; 
    3132 
    32       $GLOBALS['_LB_render']['res'] = new luxBumGallery($dir); 
    33       $res =& $GLOBALS['_LB_render']['res']; 
     33      $gallery = new luxBumGallery($dir, TYPE_IMAGE_FILE); 
     34      $imgIndex = $gallery->getImageIndex($defaultImage); 
     35      $gallery->setDefaultIndex($imgIndex); 
     36       
    3437 
    35       // Add comment form valid 
    36       lbPostAction::comment(); 
    37  
    38       header('Content-Type: text/html; charset=UTF-8'); 
    39       include (TEMPLATE_DIR.TEMPLATE.'/slideshow.php'); 
    40       return 200; 
    41  
     38      $context = new Pluf_Template_Context(array('gallery'  => $gallery,  
     39                                                 'cfg'      => $GLOBALS['_PX_config'])); 
     40       
     41      $tmpl = new Pluf_Template('slideshow.html'); 
     42      return new Pluf_HTTP_Response($tmpl->render($context)); 
    4243   } 
    4344} 
  • trunk/templates/common/slideshow/slideshow.js

    r175 r222  
    339339} 
    340340 
    341 /* XmlHTTPRequest function to get the next Photo Path */ 
     341/*function to get the next Photo Path */ 
    342342function getCurrentPhoto(index, pos) { 
    343 //    var xmlhttp = getHTTPObject('photo'); 
    344 //    xmlhttp.open("POST", "slideshow.php", true); 
    345 //    xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
    346 //    xmlhttp.send("action=photo&dir="+currentDir+"&file="+photosURL[index]); 
    347     
    348 //    if (xmlhttp) { 
    349 //       /* we define what should be done once the server has answered */ 
    350 //       xmlhttp.onreadystatechange=function() { 
    351 //          /* 4 : "complete" */ 
    352 //          if (xmlhttp.readyState == 4) { 
    353 //             /* HTTP Code 200 "Ok" */ 
    354 //             if (xmlhttp.status == 200) { 
    355                if (pos == "fg") { 
    356                   document.getElementById(foreImage).src = photosURL[index]; 
    357                } 
    358                else if (pos == "bg") { 
    359                   document.getElementById(backImage).src = photosURL[index]; 
    360                } 
    361 //             } 
    362 //          } 
    363 //       } 
    364 //   } 
     343   if (pos == "fg") { 
     344      document.getElementById(foreImage).src = photosURL[index]; 
     345   } 
     346   else if (pos == "bg") { 
     347      document.getElementById(backImage).src = photosURL[index]; 
     348   } 
    365349} 
    366350 
  • trunk/templates/public/luxbum/slideshow.html

    r201 r222  
    55    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    66    <meta name="MSSmartTagsPreventParsing" content="TRUE" /> 
    7     <script  type="text/javascript" src="http://localhost/luxbum/trunk/common_templates/slideshow/slideshow.js"></script
    8     <title><?php lb::pageTitle(); ?></title
     7    <title>{$cfg['gallery_name']}</title
     8    <script  type="text/javascript" src="{$cfg['url_base']}templates/common/slideshow/slideshow.js"></script
    99 
    10     <?php lbconf::favicon();?> 
    11     <?php lbconf::pageStyle();?> 
     10        {style} 
     11         
     12  </head> 
    1213 
    1314{literal} 
     
    132133  <script type="text/javascript"> 
    133134    <!-- 
    134         var photosDir = "<?php lbslide::photoDir();?>"; 
    135         var currentDir = "<?php lbslide::slideshowDir();?>"; 
    136         var photosURL = new Array(); 
     135      var photosURL = new Array(); 
    137136 
    138         <?php while (!$res->EOF()):?> 
    139         photosURL[<?php echo (lbpage::resPosition(true)-1);?>] = "<?php lb::displayApercu("%s"); ?>"; 
    140         <?php $res->moveNext(); 
    141         endwhile;?> 
     137      {assign $cpt =0} 
     138      {foreach $gallery as $img} 
     139      photosURL[{$cpt}] = "{$img.previewUrl}"; 
     140      {assign $cpt=$cpt+1} 
     141      {/foreach} 
    142142 
    143         var smoothtrans = <?php lbslide::slideshowFadingText();?>; // Set this to false to prevent any fading effect 
    144         var slide_speed = <?php lbslide::slideshowTime();?>
    145         --> 
     143      var smoothtrans = {$cfg['slideshow_fading']}; // Set this to false to prevent any fading effect 
     144      var slide_speed = {$cfg['slideshow_time']}
     145     --> 
    146146  </script> 
    147147 
     
    152152 
    153153    <div id="controle"> 
    154       <div id="s_next">&raquo;</div> 
    155       <div id="s_prev">&laquo;</div> 
     154      <div id="s_next"><img src="{$cfg['color_theme_path']}/images/next.png" alt="{i18n next}"/></div> 
     155      <div id="s_prev"><img src="{$cfg['color_theme_path']}/images/previous.png" alt="{i18n previous}"/></div> 
    156156      <div id="s_play">Démarrer</div> 
    157157      <div id="s_pause">Pause</div> 
     
    182182  </div> 
    183183</body> 
    184 <?php include ('footer.php');?> 
     184{include '_footer.html'}