Dotclear

Changeset 874


Ignore:
Timestamp:
03/13/09 18:53:39 (14 years ago)
Author:
bruno
bzr:base-revision:
svn-v4:b35155ea-a742-4b26-8089-0891bb790021:plugins/gallery/trunk:869
bzr:committer:
dsls <dsls@kissifrott>
bzr:mapping-version:
v4
bzr:repository-uuid:
b35155ea-a742-4b26-8089-0891bb790021
bzr:revision-id:
dsls@kissifrott-20090313164312-pmhf3cn7dk8y1adu
bzr:revno:
22
bzr:revprop:branch-nick:
gallery
bzr:root:
plugins/gallery/trunk
bzr:timestamp:
2009-03-13 17:43:12.414999962 +0100
bzr:user-agent:
bzr1.12+bzr-svn0.5.0
Message:

Added custom theme client-side support

Location:
plugins/gallery/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/gallery/trunk/_public_tpl.php

    r857 r874  
    2121$core->tpl->addValue('GalleryAttachmentThumbURL',array('tplGallery','GalleryAttachmentThumbURL')); 
    2222$core->tpl->addValue('GalleryFeedURL',array('tplGallery','GalleryFeedURL')); 
     23$core->tpl->addValue('GalleryThemeParam',array('tplGallery','GalleryThemeParam')); 
    2324 
    2425/* Galleries items management */ 
     
    270271     } 
    271272 
     273     public static function GalleryThemeParam($attr) 
     274     { 
     275          global $_ctx; 
     276          $f = $GLOBALS['core']->tpl->getFilters($attr); 
     277          $querychar=($GLOBALS['core']->blog->settings->url_scan == 'path_info')?'?':'&amp;'; 
     278          return '<?php if (!is_null($_GET["theme"])): echo "'. 
     279               $querychar.'theme=".html::escapeHTML($_GET["theme"]);endif;?>'; 
     280     } 
     281 
    272282     public static function GalleryItemMeta($attr) 
    273283     { 
  • plugins/gallery/trunk/_public_urlhandlers.php

    r860 r874  
    7272          $GLOBALS['_ctx']->gal_params = $gal_params; 
    7373          $GLOBALS['_ctx']->gallery_url = $GLOBALS['_ctx']->posts->post_url; 
    74           $GLOBALS['_ctx']->gallery_theme = $theme; 
    7574          $GLOBALS['_ctx']->comment_preview = new ArrayObject(); 
    7675          $GLOBALS['_ctx']->comment_preview['content'] = ''; 
     
    9796          $post_id = $GLOBALS['_ctx']->posts->post_id; 
    9897          $post_password = $GLOBALS['_ctx']->posts->post_password; 
     98          $wished=null; 
     99          if (isset($_GET['theme'])) 
     100               $wished=html::escapeHTML($_GET['theme']); 
    99101          if ($themetoset) { 
    100                $theme = $GLOBALS['core']->gallery->getGalTheme($GLOBALS["_ctx"]->posts); 
    101                $GLOBALS['_ctx']->gallery_theme = $theme; 
     102               $theme = $GLOBALS['core']->gallery->getGalTheme($GLOBALS["_ctx"]->posts,'gal',$wished); 
    102103          }  
     104 
     105          $GLOBALS['_ctx']->gallery_theme = $theme; 
    103106           
    104107           
  • plugins/gallery/trunk/class.dc.gallery.php

    r869 r874  
    8989     } 
    9090 
    91      public function getGalTheme ($gal,$context='gal') { 
     91     /** 
     92      * getGalTheme 
     93      *  
     94      * Retrieves gallery theme from gallery metadata 
     95      * Theme can be different according to context 
     96      * a wished theme can be specified, but it will be checked before 
     97      * 
     98      * @param record $gal the gallery record 
     99      * @param string $context context to fetch theme from (integ, gal)  
     100      * @param string $wished wished theme (theme switcher, for instance) 
     101      * @access public 
     102      * @return string the gallery theme name 
     103      */ 
     104     public function getGalTheme ($gal,$context='gal',$wished=null) { 
     105          if ($wished != null) { 
     106               if ($this->themeExists($wished)) 
     107                    return $wished; 
     108          } 
    92109          $meta = $this->core->meta->getMetaArray($gal->post_meta); 
    93110          if ($context == 'gal') { 
     
    12141231 
    12151232     /** 
     1233      * themeExists 
     1234      *  
     1235      * checks whether a gallery theme exists. 
     1236      * 
     1237      * @param string $theme the theme to check 
     1238      * @access public 
     1239      * @return boolean true if theme exits, false otherwise. 
     1240      */ 
     1241     public function themeExists($theme) { 
     1242          $galtheme=basename($theme); 
     1243          if ($galtheme == "gal_feed") 
     1244               return false; 
     1245          $themes_dir = path::fullFromRoot($this->core->blog->settings->gallery_themes_path,DC_ROOT); 
     1246          $theme_path = $themes_dir.'/gal_'.$galtheme; 
     1247          return file_exists($theme_path) && is_dir($theme_path); 
     1248     } 
     1249 
     1250     /** 
    12161251      * fillGalleryContext  
    12171252      *  
  • plugins/gallery/trunk/default-templates/gal_simple/gallery_item.html

    r857 r874  
    1010      <tpl:GalleryPagination> 
    1111<p class="pagination"> 
    12         <tpl:PaginationIf start="0"><a href="{{tpl:PaginationURL offset="-1"}}" class="next">&#171; {{tpl:lang previous images}} 
     12<tpl:PaginationIf start="0"><a href="{{tpl:PaginationURL offset="-1"}}{{tpl:GalleryThemeParam}}" class="next">&#171; {{tpl:lang previous images}} 
    1313        </a> - </tpl:PaginationIf> 
    1414        {{tpl:lang page}} {{tpl:PaginationCurrent}} {{tpl:lang of}} {{tpl:PaginationCounter}} 
    15         <tpl:PaginationIf end="0"> - <a href="{{tpl:PaginationURL offset="+1"}}" class="prev"> 
     15     <tpl:PaginationIf end="0"> - <a href="{{tpl:PaginationURL offset="+1"}}{{tpl:GalleryThemeParam}}" class="prev"> 
    1616        {{tpl:lang next images}} &#187;</a></tpl:PaginationIf> 
    1717 
Note: See TracChangeset for help on using the changeset viewer.

Sites map