Dotclear

Changeset 179


Ignore:
Timestamp:
03/13/08 14:15:19 (16 years ago)
Author:
bruno
Message:
  • fixed "orderbycat" template attribute values
  • fixed SQL requests problems under mysql 4.1 when detecting media without gallery item post associated
  • Added "Options" tab
  • "New items" checkboxes values can be changed
  • Galleries list ordering can be configured in "Options" tab
  • The plugin is not systematically enabled for each new blog
  • Added workarounds for "remember me" checkboxes in public part with latest dotclear SVN. "Remember me" in galleries/images may not work with latest dc SVN!
  • Flagged 0.2.12
Location:
plugins/gallery
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • plugins/gallery/_define.php

    r170 r179  
    2626     /* Description*/         "Image Gallery for Dotclear2", 
    2727     /* Author */             "Bruno Hondelatte", 
    28      /* Version */            '0.2.11', 
     28     /* Version */            '0.2.12', 
    2929     /* Permissions */        'usage,contentadmin' 
    3030); 
  • plugins/gallery/_install.php

    r165 r179  
    2626$installed_version = $core->getVersion('gallery'); 
    2727  
    28 if (version_compare($installed_version,$this_version,'>=') && ($core->blog->settings->gallery_gallery_url_prefix !==null)) { 
     28if (version_compare($installed_version,$this_version,'>=')) { 
    2929     return; 
    3030} 
    3131 
    32 function defaultIfNotSet($value,$default) { 
    33      if ($value === null) 
    34           return $default; 
    35      else 
    36           return $value; 
    37 } 
    38  
    39  
    40 $galleries_url_prefix = defaultIfNotSet($core->blog->settings->gallery_galleries_url_prefix,'galleries'); 
    41 $gallery_url_prefix = defaultIfNotSet($core->blog->settings->gallery_gallery_url_prefix,'gallery'); 
    42 $image_url_prefix = defaultIfNotSet($core->blog->settings->gallery_image_url_prefix,'image'); 
    43 $images_url_prefix = defaultIfNotSet($core->blog->settings->gallery_images_url_prefix,'images'); 
    44 $browser_url_prefix = defaultIfNotSet($core->blog->settings->gallery_browser_url_prefix,'browser'); 
    45 $default_theme = defaultIfNotSet($core->blog->settings->gallery_default_theme,'default'); 
    46 $nb_images_per_page = defaultIfNotSet($core->blog->settings->gallery_nb_images_per_page,24); 
    47  
    48 $core->blog->settings->setNamespace('gallery'); 
    49 $core->blog->settings->put('gallery_galleries_url_prefix',$galleries_url_prefix,'string','Gallery lists URL prefix'); 
    50 $core->blog->settings->put('gallery_gallery_url_prefix',$gallery_url_prefix,'string','Galleries URL prefix'); 
    51 $core->blog->settings->put('gallery_image_url_prefix',$image_url_prefix,'string','Images URL prefix'); 
    52 $core->blog->settings->put('gallery_images_url_prefix',$images_url_prefix,'string','Filtered Images URL prefix'); 
    53 $core->blog->settings->put('gallery_browser_url_prefix',$browser_url_prefix,'string','Browser URL prefix'); 
    54 $core->blog->settings->put('gallery_default_theme',$default_theme,'string','Default theme to use'); 
    55 $core->blog->settings->put('gallery_nb_images_per_page',$nb_images_per_page,'integer','Number of images per page'); 
    5632$core->setVersion('gallery',$this_version); 
    5733 
  • plugins/gallery/_prepend.php

    r162 r179  
    3636$GLOBALS['core']->url->register('galitem',$core->blog->settings->gallery_image_url_prefix,'^' 
    3737     .$core->blog->settings->gallery_image_url_prefix.'/(.+)$',array('urlGallery','image')); 
     38/* RNot yes implemented 
    3839$GLOBALS['core']->url->register('images','images','^images/(.+)$',array('urlGallery','images')); 
    3940$GLOBALS['core']->url->register('browse','browse','^browser$',array('urlGallery','browse')); 
    40  
     41*/ 
    4142 
    4243?> 
  • plugins/gallery/_public.php

    r169 r179  
    136136     public static function GalleryEntries($attr,$content) 
    137137     { 
     138          global $core; 
    138139          $lastn = 0; 
    139140          $sortby = 'post_dt'; 
     
    148149               $p .= "\$params['limit'] = ".$lastn.";\n"; 
    149150          } else { 
    150                $p .= "\$params['limit'] = \$core->blog->settings->nb_post_per_page;\n"; 
     151               $p .= "\$params['limit'] = \$core->blog->settings->gallery_nb_galleries_per_page;\n"; 
    151152          } 
    152153           
     
    154155          $p .= "\$params['post_type'] = 'gal';\n"; 
    155156           
     157          if (!isset($attr['sortby']) && !isset($attr['order']) && !isset($attr['orderbycat'])) { 
     158               $attr['sortby']=$core->blog->settings->gallery_galleries_sort; 
     159               $attr['order']=$core->blog->settings->gallery_galleries_order; 
     160               $attr['orderbycat']=$core->blog->settings->gallery_galleries_orderbycat?"yes":"no"; 
     161          } 
    156162          if (isset($attr['category'])) { 
    157163               $p .= "\$params['cat_url'] = '".addslashes($attr['category'])."';\n"; 
     
    169175               $order = $attr['order']; 
    170176          } 
    171           if (isset($attr['orderbycat'])) { 
     177          if (isset($attr['orderbycat']) && strtolower($attr['orderbycat'])=="yes") { 
    172178               $p .= "\$params['order'] = 'C.cat_position asc, ".$sortby." ".$order."';\n"; 
    173179          } else { 
     
    758764          # Getting commenter informations from cookie 
    759765          if (!empty($_COOKIE['comment_info'])) { 
    760                $c_cookie = unserialize($_COOKIE['comment_info']); 
    761                foreach ($c_cookie as $k => $v) { 
    762                     $GLOBALS['_ctx']->comment_preview[$k] = $v; 
    763                } 
    764                $GLOBALS['_ctx']->comment_preview['remember'] = true; 
     766               $c_cookie = @unserialize($_COOKIE['comment_info']); 
     767               if (is_array($c_cookie)) { 
     768                    foreach ($c_cookie as $k => $v) { 
     769                         $GLOBALS['_ctx']->comment_preview[$k] = $v; 
     770                    } 
     771                    $GLOBALS['_ctx']->comment_preview['remember'] = true; 
     772               } 
    765773          } 
    766774           
     
    965973          # Getting commenter informations from cookie 
    966974          if (!empty($_COOKIE['comment_info'])) { 
    967                $c_cookie = unserialize($_COOKIE['comment_info']); 
    968                foreach ($c_cookie as $k => $v) { 
    969                     $GLOBALS['_ctx']->comment_preview[$k] = $v; 
    970                } 
    971                $GLOBALS['_ctx']->comment_preview['remember'] = true; 
     975               $c_cookie = @unserialize($_COOKIE['comment_info']); 
     976               if (is_array($c_cookie)) { 
     977                    foreach ($c_cookie as $k => $v) { 
     978                         $GLOBALS['_ctx']->comment_preview[$k] = $v; 
     979                    } 
     980                    $GLOBALS['_ctx']->comment_preview['remember'] = true; 
     981               } 
    972982          } 
    973983           
  • plugins/gallery/class.dc.gallery.php

    r168 r179  
    343343     // Retrieve media items not associated to a image post in a given directory 
    344344     function getMediaWithoutGalItems($media_dir) { 
    345           $strReq = 'SELECT M.media_id, M.media_dir, M.media_file, P.post_id '. 
    346           'FROM '.$this->core->prefix.'post_media PM '. 
    347                'JOIN '.$this->core->prefix.'post P ON (PM.post_id = P.post_id AND P.post_type=\'galitem\' '. 
    348                     'AND P.blog_id = \''.$this->core->con->escape($this->core->blog->id).'\') '. 
    349                'RIGHT JOIN '.$this->core->prefix.'media M ON M.media_id = PM.media_id '. 
    350                'WHERE P.post_id IS NULL AND media_dir = \''.$this->con->escape($media_dir).'\''; 
     345          $strReq = 'SELECT M.media_id, M.media_dir, M.media_file '. 
     346               'FROM '.$this->core->prefix.'media M '. 
     347               'LEFT JOIN ('. 
     348                    'SELECT PM.post_id,PM.media_id FROM '.$this->core->prefix.'post_media PM '. 
     349                    'INNER JOIN '.$this->core->prefix.'post P '. 
     350                    'ON PM.post_id = P.post_id '. 
     351                    'AND P.blog_id = \''.$this->core->con->escape($this->core->blog->id).'\' '. 
     352                    'AND P.post_type = \'galitem\') PM2 '. 
     353               'ON M.media_id = PM2.media_id '. 
     354               'WHERE PM2.post_id IS NULL AND media_dir = \''.$this->con->escape($media_dir).'\''; 
    351355          $rs = $this->con->select($strReq); 
    352356          return $rs; 
  • plugins/gallery/default-templates/default/galleries.html

    r169 r179  
    1212  </tpl:Categories> 
    1313   
    14   <tpl:GalleryEntries sortby="date" order="desc" orderbycat="yes" no_content="1"> 
     14  <tpl:GalleryEntries no_content="1"> 
    1515    <tpl:EntriesHeader> 
    1616      <tpl:Pagination> 
     
    4848    <h2>{{tpl:lang Galleries}}</h2> 
    4949  </div> 
    50   <tpl:GalleryEntries sortby="date" order="desc" orderbycat="yes"> 
     50  <tpl:GalleryEntries> 
    5151    <tpl:EntryIfNewCat> 
    5252     <p class="day-date">{{tpl:EntryCategoryWithNull}}</p> 
  • plugins/gallery/gal.php

    r162 r179  
    603603     } 
    604604} // if canedit post 
    605 echo '<br/><p><a href="plugin.php?p=gallery&amp;m=newitems" class="multi-part">'.__('Manage new items').'</a></p>'; 
     605echo '<p><a href="plugin.php?p=gallery&amp;m=newitems" class="multi-part">'.__('Manage new items').'</a></p>'; 
     606echo '<p><a href="plugin.php?p=gallery&amp;m=options" class="multi-part">'.__('Options').'</a></p>'; 
    606607?> 
    607608 
  • plugins/gallery/gals.php

    r162 r179  
    331331<?php 
    332332     echo "</div>"; 
    333      echo '<br/><p><a href="plugin.php?p=gallery&amp;m=items" class="multi-part">'.__('Images').'</a></p>'; 
    334      echo '<br/><p><a href="plugin.php?p=gallery&amp;m=newitems" class="multi-part">'.__('Manage new items').'</a></p>'; 
     333     echo '<p><a href="plugin.php?p=gallery&amp;m=items" class="multi-part">'.__('Images').'</a></p>'; 
     334     echo '<p><a href="plugin.php?p=gallery&amp;m=newitems" class="multi-part">'.__('Manage new items').'</a></p>'; 
     335     echo '<p><a href="plugin.php?p=gallery&amp;m=options" class="multi-part">'.__('Options').'</a></p>'; 
    335336?> 
    336337</body> 
  • plugins/gallery/index.php

    r162 r179  
    2323if (!defined('DC_CONTEXT_ADMIN')) { exit; } 
    2424 
    25 if (!empty($_REQUEST['m'])) { 
     25if (is_null($core->blog->settings->gallery_gallery_url_prefix)) { 
     26     require dirname(__FILE__).'/options.php'; 
     27}elseif (!empty($_REQUEST['m'])) { 
    2628     switch ($_REQUEST['m']) { 
    2729          case 'gal' : 
     
    4648               require dirname(__FILE__).'/item.php'; 
    4749               break; 
     50          case 'options': 
     51               require dirname(__FILE__).'/options.php'; 
     52               break; 
    4853     } 
    4954} else { 
  • plugins/gallery/item.php

    r162 r179  
    456456      
    457457} // if canedit post 
    458 echo '<br/><p><a href="plugin.php?p=gallery&amp;m=newitems" class="multi-part">'.__('Manage new items').'</a></p>'; 
     458echo '<p><a href="plugin.php?p=gallery&amp;m=newitems" class="multi-part">'.__('Manage new items').'</a></p>'; 
     459echo '<p><a href="plugin.php?p=gallery&amp;m=options" class="multi-part">'.__('Options').'</a></p>'; 
    459460?> 
    460461</body> 
  • plugins/gallery/items.php

    r162 r179  
    407407?> 
    408408</div> 
    409 <?php echo '<br/><p><a href="plugin.php?p=gallery&amp;m=newitems" class="multi-part">'.__('Manage new items').'</a></p>';?> 
     409<?php  
     410echo '<p><a href="plugin.php?p=gallery&amp;m=newitems" class="multi-part">'.__('Manage new items').'</a></p>'; 
     411echo '<p><a href="plugin.php?p=gallery&amp;m=options" class="multi-part">'.__('Options').'</a></p>'; 
     412?> 
    410413</body> 
    411414</html> 
  • plugins/gallery/locales/fr/main.po

    r168 r179  
    66 
    77#: _admin.php:27 
    8 #: _public.php:466 
     8#: _public.php:487 
    99#: _widgets.php:31 
    1010#: gal.php:440 
     
    1616#: item.php:352 
    1717#: items.php:287 
    18 #: newitems.php:73 
     18#: newitems.php:80 
     19#: options.php:132 
    1920msgid "Galleries" 
    2021msgstr "Galeries" 
     
    3132 
    3233#: _public.php:131 
    33 #: _public.php:504 
     34#: _public.php:525 
    3435msgid "No category" 
    3536msgstr "Sans catégorie" 
    3637 
    37 #: _public.php:545 
     38#: _public.php:566 
    3839msgid "Random Image" 
    3940msgstr "Image aléatoire" 
    4041 
    41 #: _public.php:568 
     42#: _public.php:589 
    4243#: _widgets.php:46 
    4344msgid "Last images" 
     
    8687#: item.php:332 
    8788#: items.php:288 
    88 #: newitems.php:74 
     89#: newitems.php:81 
     90#: options.php:133 
    8991msgid "Images" 
    9092msgstr "Images" 
     
    178180#: gals.php:334 
    179181#: item.php:458 
    180 #: items.php:409 
    181 #: newitems.php:75 
     182#: items.php:410 
     183#: newitems.php:82 
     184#: options.php:134 
    182185msgid "Manage new items" 
    183186msgstr "Gestion des nouvelles images" 
     
    242245 
    243246#: items.php:269 
    244 #: newitems.php:45 
     247#: newitems.php:52 
     248#: options.php:124 
    245249msgid "Gallery Items" 
    246250msgstr "Images" 
     
    255259 
    256260#: items.php:305 
    257 #: newitems.php:79 
     261#: newitems.php:86 
    258262msgid "Media dir:" 
    259263msgstr "Répertoire contenant les media" 
     
    267271msgstr "filtrée" 
    268272 
    269 #: newitems.php:52 
     273#: newitems.php:59 
    270274msgid "Waiting..." 
    271275msgstr "En attente..." 
    272276 
    273 #: newitems.php:53 
     277#: newitems.php:60 
    274278msgid "%s entries found" 
    275279msgstr "%s entrées trouvées" 
    276280 
    277 #: newitems.php:54 
     281#: newitems.php:61 
    278282msgid "Create media" 
    279283msgstr "Création du media" 
    280284 
    281 #: newitems.php:55 
     285#: newitems.php:62 
    282286msgid "Create post for media" 
    283287msgstr "Création du billet pour le media" 
    284288 
    285 #: newitems.php:56 
     289#: newitems.php:63 
    286290msgid "Create thumbs for media" 
    287291msgstr "Création des miniatures pour le media" 
    288292 
    289 #: newitems.php:57 
     293#: newitems.php:64 
    290294msgid "Refresh gallery" 
    291295msgstr "Rafraîchissement de la galerie" 
    292296 
    293 #: newitems.php:58 
    294 #: newitems.php:82 
     297#: newitems.php:65 
     298#: newitems.php:89 
     299#: options.php:186 
    295300msgid "Delete orphan media" 
    296301msgstr "Supprimer les media orphelins" 
    297302 
    298 #: newitems.php:59 
     303#: newitems.php:66 
    299304msgid "Delete orphan items" 
    300305msgstr "Suppression des images orphelines" 
    301306 
    302 #: newitems.php:60 
     307#: newitems.php:67 
    303308msgid "Fetch new media" 
    304309msgstr "Recherche des nouveaux media" 
    305310 
    306 #: newitems.php:61 
     311#: newitems.php:68 
    307312msgid "Fetch media without post" 
    308313msgstr "Recherche des media sans billet associé" 
    309314 
    310 #: newitems.php:62 
     315#: newitems.php:69 
    311316msgid "Fetch media without thumbnails" 
    312317msgstr "Recherche des media sans miniatures" 
    313318 
    314 #: newitems.php:63 
     319#: newitems.php:70 
    315320msgid "Retrieve galleries" 
    316321msgstr "Récupération des galeries" 
    317322 
    318 #: newitems.php:64 
     323#: newitems.php:71 
    319324msgid "Whole blog" 
    320325msgstr "Tout le blog" 
    321326 
    322 #: newitems.php:78 
     327#: newitems.php:85 
    323328msgid "New Items" 
    324329msgstr "Nouvelles images" 
    325330 
    326 #: newitems.php:84 
     331#: newitems.php:91 
     332#: options.php:188 
    327333msgid "Delete orphan image-posts" 
    328334msgstr "Supprimer les billets-images orphelins" 
    329335 
    330 #: newitems.php:86 
     336#: newitems.php:93 
     337#: options.php:190 
    331338msgid "Scan dir for new media" 
    332339msgstr "Rechercher les nouveaux media dans le répertoire" 
    333340 
    334 #: newitems.php:88 
     341#: newitems.php:95 
     342#: options.php:192 
    335343msgid "Create image-posts for media in dir" 
    336344msgstr "Créer les billets-images pour les media dans le dossier" 
    337345 
    338 #: newitems.php:90 
     346#: newitems.php:97 
     347#: options.php:194 
    339348msgid "Create missing thumbnails" 
    340349msgstr "Créer les miniatures manquantes" 
    341350 
    342 #: newitems.php:91 
     351#: newitems.php:98 
    343352msgid "proceed" 
    344353msgstr "Soumettre" 
    345354 
    346 #: newitems.php:94 
     355#: newitems.php:101 
    347356msgid "Gallery mass update" 
    348357msgstr "Mise à jour en masse des galeries" 
    349358 
    350 #: newitems.php:95 
     359#: newitems.php:102 
    351360msgid "Update all galeries" 
    352361msgstr "Mettre à jour toutes les galeries" 
    353362 
    354 #: newitems.php:98 
     363#: newitems.php:105 
    355364msgid "Processing result" 
    356365msgstr "Résultat du traitement" 
    357366 
    358 #: newitems.php:100 
     367#: newitems.php:107 
    359368msgid "Requests" 
    360369msgstr "Requêtes" 
    361370 
    362 #: newitems.php:102 
     371#: newitems.php:109 
    363372msgid "Actions" 
    364373msgstr "Actions" 
    365374 
     375#: options.php:148 
     376msgid "Plugin Activation" 
     377msgstr "Activation du plugin" 
     378 
     379#: options.php:151 
     380msgid "The plugin cannot be enabled. Please check in your about:config that public_path points to an existing directory." 
     381msgstr "Ce plugin ne peut pas être activé. Vérifiez que l'entrée public_path de votre about:config pointe vers un répertoire accessible" 
     382 
     383#: options.php:153 
     384msgid "The plugin is not enabled for this blog yet. Click below to enable it" 
     385msgstr "Le plugin n'est pas activé pour ce blog. Cliquez ci-dessous pour l'activer." 
     386 
     387#: options.php:154 
     388msgid "Enable plugin" 
     389msgstr "Activer le plugin" 
     390 
     391#: options.php:162 
     392msgid "General options" 
     393msgstr "Options générales" 
     394 
     395#: options.php:163 
     396msgid "Number of galleries per page" 
     397msgstr "Nombre de galeries par page" 
     398 
     399#: options.php:166 
     400msgid "Number of images per page" 
     401msgstr "Nombre d'images  par page" 
     402 
     403#: options.php:169 
     404msgid "Galleries list sort by" 
     405msgstr "Critère de tri pour les listes de galeries" 
     406 
     407#: options.php:172 
     408msgid "Galleries list order" 
     409msgstr "Send de tri pour les listes de galeries" 
     410 
     411#: options.php:175 
     412msgid "Group galeries by category" 
     413msgstr "Regrouper les galeries par catégorie" 
     414 
     415#: options.php:184 
     416msgid "New Items default options" 
     417msgstr "Options par défaut pour la gestion des nouvelles images" 
     418 
     419#: options.php:201 
     420msgid "Advanced options" 
     421msgstr "Options avancées" 
     422 
     423#: options.php:202 
     424msgid "All the following values will define default URLs for gallery items" 
     425msgstr "Les valeurs suivantes définissent les URLs par défaut pour les éléments de galeries" 
     426 
     427#: options.php:203 
     428msgid "Galleries URL prefix" 
     429msgstr "Préfixe pour les URL de listes de galeries" 
     430 
     431#: options.php:206 
     432msgid "Gallery URL prefix" 
     433msgstr "Préfixe pour les URL de galeries" 
     434 
     435#: options.php:209 
     436msgid "Image URL prefix" 
     437msgstr "Préfixe pour les URL d'images" 
     438 
    366439msgid "next galleries" 
    367440msgstr "galeries suivantes" 
  • plugins/gallery/newitems.php

    r168 r179  
    3939$create_posts = !empty($_REQUEST['create_posts']) ? $_REQUEST['create_posts'] : 0;; 
    4040 
     41$defaults=($core->blog->settings->gallery_new_items_default != null)?$core->blog->settings->gallery_new_items_default:"YYYYN"; 
     42 
     43$c_delete_orphan_media=($defaults{0} == "Y"); 
     44$c_delete_orphan_items=($defaults{1} == "Y"); 
     45$c_scan_media=($defaults{2} == "Y"); 
     46$c_create_posts=($defaults{3} == "Y"); 
     47$c_create_thumbs=($defaults{4} == "Y"); 
    4148 
    4249?> 
     
    7986     '<p><label class="classic">'.__('Media dir:'). 
    8087     form::combo('media_dir',$dirs_combo,'').'</label></p> '. 
    81      '<p><label class="classic">'.form::checkbox('delete_orphan_media',1,1). 
     88     '<p><label class="classic">'.form::checkbox('delete_orphan_media',1,$c_delete_orphan_media). 
    8289     __('Delete orphan media').'</label></p>'. 
    83      '<p><label class="classic">'.form::checkbox('delete_orphan_items',1,1). 
     90     '<p><label class="classic">'.form::checkbox('delete_orphan_items',1,$c_delete_orphan_items). 
    8491     __('Delete orphan image-posts').'</label></p>'. 
    85      '<p><label class="classic">'.form::checkbox('scan_media',1,1). 
     92     '<p><label class="classic">'.form::checkbox('scan_media',1,$c_scan_media). 
    8693     __('Scan dir for new media').'</label></p>'. 
    87      '<p><label class="classic">'.form::checkbox('create_posts',1,1). 
     94     '<p><label class="classic">'.form::checkbox('create_posts',1,$c_create_posts). 
    8895     __('Create image-posts for media in dir').'</label></p> '. 
    89      '<p><label class="classic">'.form::checkbox('create_thumbs',1,1). 
     96     '<p><label class="classic">'.form::checkbox('create_thumbs',1,$c_create_thumbs). 
    9097     __('Create missing thumbnails').'</label></p> '. 
    9198     '<input type="button" id="proceed" value="'.__('proceed').'" />'. 
     
    103110     echo '<table id="process"><tr class="keepme"><th>ID</th><th>Action</th><th>Status</th></tr></table>'; 
    104111     echo '</fieldset>'; 
     112 
     113     echo '<p><a href="plugin.php?p=gallery&amp;m=options" class="multi-part">'.__('Options').'</a></p>'; 
    105114?> 
    106115 
Note: See TracChangeset for help on using the changeset viewer.

Sites map