Luxbum.net - Script de galerie photo

Changeset 216

Show
Ignore:
Timestamp:
05/28/07 16:01:17 (1 year ago)
Author:
nicolas
Message:

Template d'erreur pour le thème photoblog.
Ajout de la visualisation des sélections dans la vue "display".
Ajout des sélections pour le template photoblog.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/api/inc/dispatcher.php

    r212 r216  
    136136         } 
    137137      } 
    138       //return new Pluf_HTTP_Response_NotFound("No Matching view"); 
    139138      $view = new ui_public_Error("No Matching view"); 
    140139      return $view->aclError($req, $match); 
  • trunk/api/process/commongallery.php

    r212 r216  
    265265    
    266266   /** 
    267     * @return string the link url to select all images in the current gallery 
    268     */ 
    269    public function getLinkSelectAll() { 
    270       return link::selectall($this->dir); 
    271    } 
    272     
    273    /** 
    274     * @return string the link url to select all images in the current gallery 
    275     */ 
    276    public function getLinkUnselectAll() { 
    277       return link::unselectall($this->dir); 
    278    } 
    279     
    280    /** 
    281267    * Retourne le lien de la vignette de l'image vers le script qui génére 
    282268    * l'image 
  • trunk/api/process/luxbumgallery.php

    r212 r216  
    473473      } 
    474474   } 
     475 
     476    
     477   /** 
     478    * @return string the link url to select all images in the current gallery 
     479    */ 
     480   public function getLinkSelectAll() { 
     481      return link::selectall($this->dir); 
     482   } 
     483    
     484   /** 
     485    * @return string the link url to select all images in the current gallery 
     486    */ 
     487   public function getLinkUnselectAll() { 
     488      return link::unselectall($this->dir); 
     489   } 
    475490    
    476491   function __toString() { 
  • trunk/api/ui/link.php

    r215 r216  
    139139      $dir = link::encode($dir); 
    140140      $img = link::encode($img); 
    141       return  link::prefix().'display/'.$dir.$img; 
    142        
     141      if ($GLOBALS['isSelection']) { 
     142         return  link::prefix().'selectiond/'.$dir.$img; 
     143      } 
     144      else { 
     145         return  link::prefix().'display/'.$dir.$img; 
     146      } 
    143147   } 
    144148} 
  • trunk/api/ui/public/Display.php

    r209 r216  
    55 */ 
    66class ui_public_Display extends ui_CommonView { 
     7    
     8   private $gallery; 
     9   private $dir; 
     10   private $file; 
    711    
    812 
     
    1317    */ 
    1418   function view($request, $match) { 
    15       $dir = files::addTailSlash($match[1]); 
    16       $file = $match[2]; 
     19      $this->dir = files::addTailSlash($match[1]); 
     20      $this->file = $match[2]; 
    1721 
    1822      // Check if the gallery is private 
    19           $this->checkFile($dir, $file); 
    20       $this->checkPrivate($dir); 
     23          $this->checkFile($this->dir, $this->file); 
     24      $this->checkPrivate($this->dir); 
    2125 
    2226       
    23       $gallery = new luxBumGallery($dir); 
    24       $imgIndex = $gallery->getImageIndex($file); 
    25       $gallery->setDefaultIndex($imgIndex); 
     27      $GLOBALS['isSelection'] = false; 
     28      $this->gallery = new luxBumGallery($this->dir); 
     29      $imgIndex = $this->gallery->getImageIndex($this->file); 
     30      $this->gallery->setDefaultIndex($imgIndex); 
     31       
     32      return $this->common(); 
     33   } 
     34    
     35   /** 
     36    * 
     37    * @param Pluf_HTTP_Request $request 
     38    * @param array $match 
     39    */ 
     40   function selection($request, $match) { 
     41      $this->dir = files::addTailSlash($match[1]); 
     42      $this->file = $match[2]; 
    2643 
    27       if (files::isPhotoFile($dir, $file)) { 
    28               $cFile = new luxBumImage($dir, $file); 
     44      // Check if the gallery is private 
     45          $this->checkFile($this->dir, $this->file); 
     46      $this->checkPrivate($this->dir); 
     47 
     48    
     49      $GLOBALS['isSelection'] = true; 
     50      $this->gallery = new LuxbumSelectionGallery(Selection::getInstance()); 
     51       
     52      if ($this->gallery->getTotalCount() == 0) { 
     53         return new Pluf_HTTP_Response_Redirect(Pluf::f('url_base')); 
     54      } 
     55       
     56      $imgIndex = $this->gallery->getImageIndex($this->file); 
     57      if ($imgIndex == -1) { 
     58         $imgIndex = 0; 
     59         $this->dir = $this->gallery->f()->getDir(); 
     60         $this->file = $this->gallery->f()->getFile(); 
     61      } 
     62      $this->gallery->setDefaultIndex($imgIndex); 
     63       
     64      return $this->common(); 
     65   } 
     66 
     67   private function common() { 
     68      if (files::isPhotoFile($this->dir, $this->file)) { 
     69              $cFile = new luxBumImage($this->dir, $this->file); 
    2970              if (!Pluf::f('show_meta')) { 
    3071                 $metas = null; 
    3172              } 
    3273              else { 
    33                       $cFile->metaInit(); 
    34                       $metas = $cFile->getMeta(); 
     74                     $cFile->metaInit(); 
     75                     $metas = $cFile->getMeta(); 
    3576              } 
    3677      } 
    37       else if (files::isFlvFile($dir, $file)) { 
    38          $cFile = new LuxbumFlv($dir, $file); 
     78      else if (files::isFlvFile($this->dir, $this->file)) { 
     79         $cFile = new LuxbumFlv($this->dir, $this->file); 
    3980         $metas = null; 
    4081      } 
     
    5192          } 
    5293 
    53       $context = new Pluf_Template_Context(array('gallery'  => $gallery, 
    54                                                                                              'metas'    => $metas, 
    55                                                                                              'comments' => $comments, 
    56                                                  'ctPost'   => $ctPost, 
    57                                                  'cFile'    => $cFile, 
    58                                                  'cfg'      => $GLOBALS['_PX_config'])); 
     94      $context = new Pluf_Template_Context(array('gallery'     => $this->gallery, 
     95                                                                                             'metas'       => $metas, 
     96                                                                                             'isSelection' => $GLOBALS['isSelection'], 
     97                                                                                             'comments'    => $comments, 
     98                                                 'ctPost'      => $ctPost, 
     99                                                 'cFile'       => $cFile, 
     100                                                 'cfg'         => $GLOBALS['_PX_config'])); 
    59101 
    60102      $tmpl = new Pluf_Template('display.html'); 
  • trunk/index.php

    r212 r216  
    7777$dispatcher->registerController('ui_public_Selection', 'downloadSelection', '#^/downloadselection/$#i'); 
    7878$dispatcher->registerController('ui_public_Gallery', 'selection', '#^/selectiong/(.*)/(.*)$#i'); 
     79$dispatcher->registerController('ui_public_Display', 'selection', '#^/selectiond/(.*)/(.*)$#i'); 
    7980 
    8081// Private views 
  • trunk/templates/public/photoblog/display.html

    r215 r216  
    1919<h2> 
    2020  <a href="{$cfg['url_index']}"><strong>{i18n 'Home'}</strong></a>  
    21   {NavigationMenu $gallery, '%s', ' | ', $gallery.linkGallery} | {$cFile.file} 
     21  {NavigationMenu $gallery, '%s', ' | ', $gallery.linkGallery}  
     22  {if $isSelection} 
     23  | <a href="{$gallery.linkConsult}">{i18n 'My selection'}</a> 
     24  {/if} 
     25  | {$cFile.file} 
    2226</h2> 
    2327 
     
    4044 
    4145<div id="narrow"> 
     46                {if $cfg['show_selection']} 
     47                  {if $cFile->isSelected()} 
     48                  + <a href="{$cFile.linkUnselect}">{i18n 'Unselect file'}</a> 
     49                  {else} 
     50                  + <a href="{$cFile.linkSelect}">{i18n 'Select file'}</a> 
     51                  {/if} 
     52                  {if !$isSelection} 
     53                  + {i18n 'Select'} <a href="{$gallery.linkSelectAll}">{i18n 'all'}</a> / <a href="{$gallery.linkUnselectAll}">{i18n 'none'}</a> 
     54                  {/if} 
     55                {/if} 
    4256  {if $cFile->isImage() && $cfg['show_meta']} 
    4357  <div id="metaData"> 
  • trunk/templates/public/photoblog/gallery.html

    r215 r216  
    66  <a href="{$cfg['url_index']}"><strong>{i18n 'Home'}</strong></a>  
    77  {NavigationMenu $gallery, '%s', ' | '} 
     8  {if $isSelection} 
     9  | {i18n 'My selection'} 
     10  {/if} 
    811</h2> 
    912 
  • trunk/templates/public/photoblog/index.html

    r215 r216  
    5757</div> 
    5858 
     59{if $index && $cfg['show_selection'] && $selection.totalCount > 0} 
     60<h2> 
     61  {i18n 'My selection'} 
     62</h2> 
     63  <div class="album"> 
     64    <a href="{$selection.linkConsult}"><img src="{$selection.defaultImage}" alt=""/></a> 
     65    <div class="albumdesc"> 
     66      <h3><a href="{$selection.linkConsult}">{i18n 'Consult'}</a></h3> 
     67      <h3><a href="{$selection.linkDelete}">{i18n 'Delete'}</a></h3> 
     68      <h3><a href="{$selection.linkDownload}">{i18n 'Download'}</a></h3> 
     69    </div> 
     70  </div> 
     71  <p style="clear:both;"></p> 
     72{/if} 
     73 
    5974{include '_footer.html'}