Changeset 11380


Ignore:
Timestamp:
Jun 15, 2011, 4:19:31 PM (13 years ago)
Author:
mistic100
Message:

add filters on date_creation fields, remove 'make associations on login'

Location:
extensions/SmartAlbums
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/SmartAlbums/admin.php

    r11376 r11380  
    1212        $conf['SmartAlbums'] = array(
    1313    'update_on_upload' => $_POST['update_on_upload'],
    14     'update_on_login' => $_POST['update_on_login'],
    1514    );   
    1615       
     
    2221  'SMART_PATH' => SMART_PATH,
    2322        'update_on_upload' => $conf['SmartAlbums']['update_on_upload'],
    24         'update_on_login' => $conf['SmartAlbums']['update_on_login'],
    2523));
    2624       
  • extensions/SmartAlbums/include/functions.inc.php

    r11376 r11380  
    4242/*
    4343 * Make associations for all SmartAlbums
    44  * Called with invalidate_user_cache and/or on admin login
    45  * @param string login (not mandatory)
    46  */
    47 function smart_make_all_associations($login = false)
     44 * Called with invalidate_user_cache
     45 */
     46function smart_make_all_associations()
    4847{
    4948  global $conf;
     
    5150  if (!is_array($conf['SmartAlbums'])) $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']);
    5251 
    53   if ( !$login AND !defined('SMART_NOT_UPDATE') AND $conf['SmartAlbums']['update_on_upload'] != 'false' )
    54     continue;
    55   else if ( is_string($login) AND is_admin() AND $conf['SmartAlbums']['update_on_login'] != 'false' )
    56     continue;
    57   else
    58     return;
     52  if ( defined('SMART_NOT_UPDATE') OR $conf['SmartAlbums']['update_on_upload'] == 'false' ) return;
    5953 
    6054  /* get categories with smart filters */
     
    6963  $smart_cats = array_from_query($query, 'id');
    7064  array_map('smart_make_associations', $smart_cats);
    71  
    72   if (is_string($login))
    73   {
    74     define('SMART_NOT_UPDATE', 1);
    75     invalidate_user_cache();
    76   }
    7765}
    7866
     
    178166    else if ($filter['type'] == 'date')
    179167    {
    180       if      ($filter['cond'] == 'the')    $where[] = 'date_available BETWEEN "'.$filter['value'].' 00:00:00" AND "'.$filter['value'].' 23:59:59"';
    181       else if ($filter['cond'] == 'before') $where[] = 'date_available < "'.$filter['value'].' 00:00:00"';
    182       else if ($filter['cond'] == 'after')  $where[] = 'date_available > "'.$filter['value'].' 23:59:59"';
     168      switch ($filter['cond'])
     169      {
     170        case 'the':
     171          $where[] = 'date_available BETWEEN "'.$filter['value'].' 00:00:00" AND "'.$filter['value'].' 23:59:59"';
     172          break;
     173        case 'before':
     174          $where[] = 'date_available < "'.$filter['value'].' 00:00:00"';
     175          break;
     176        case 'after':
     177          $where[] = 'date_available > "'.$filter['value'].' 23:59:59"';
     178          break;
     179        case 'the_crea':
     180          $where[] = 'date_creation BETWEEN "'.$filter['value'].' 00:00:00" AND "'.$filter['value'].' 23:59:59"';
     181          break;
     182        case 'before_crea':
     183          $where[] = 'date_creation < "'.$filter['value'].' 00:00:00"';
     184          break;
     185        case 'after_crea':
     186          $where[] = 'date_creation > "'.$filter['value'].' 23:59:59"';
     187          break;
     188      }
    183189    }
    184190    // limit
  • extensions/SmartAlbums/include/init_cat_modify.php

    r11376 r11380  
    7979        ),
    8080      'date' => array(
    81         'the' => l10n('Added the'),
    82         'before' => l10n('Added before the'),
    83         'after' => l10n('Added after the'),
     81        'the' => l10n('Added on'),
     82        'before' => l10n('Added before'),
     83        'after' => l10n('Added after'),
     84        'the_crea' => l10n('Created on'),
     85        'before_crea' => l10n('Created before'),
     86        'after_crea' => l10n('Created after'),
    8487        ),
    8588      'limit' => array('limit' => 'limit'), // second filter not used
  • extensions/SmartAlbums/language/en_UK/plugin.lang.php

    r11376 r11380  
    1111$lang['None of these tags'] = 'None of these tags';
    1212$lang['Only these tags'] = 'Only these tags';
    13 $lang['Added the'] = 'Added the';
    14 $lang['Added before the'] = 'Added before the';
    15 $lang['Added after the'] = 'Added after the';
     13$lang['Added on'] = 'Added on';
     14$lang['Added before'] = 'Added before';
     15$lang['Added after'] = 'Added after';
     16$lang['Created on'] = 'Created on';
     17$lang['Created before'] = 'Created before';
     18$lang['Created after'] = 'Created after';
    1619$lang['%d photo'] = '%d photo';
    1720$lang['%d photos'] = '%d photos';
     
    2427$lang['Regenerate photos list of all SmartAlbums'] = 'Regenerate photos list of all SmartAlbums';
    2528$lang['Update albums on file upload'] = 'Update albums on file upload';
    26 $lang['Update albums when an admin logins'] = 'Update albums when an admin logins';
    2729
    2830?>
  • extensions/SmartAlbums/language/fr_FR/plugin.lang.php

    r11376 r11380  
    1111$lang['None of these tags'] = 'Aucun des tags';
    1212$lang['Only these tags'] = 'Seulement les tags';
    13 $lang['Added the'] = 'Ajouté le';
    14 $lang['Added before the'] = 'Ajouté avant le';
    15 $lang['Added after the'] = 'Ajouté après le';
     13$lang['Added on'] = 'Ajouté le';
     14$lang['Added before'] = 'Ajouté avant le';
     15$lang['Added after'] = 'Ajouté après le';
     16$lang['Created on'] = 'Créé le';
     17$lang['Created before'] = 'Créé avant le';
     18$lang['Created after'] = 'Créé après le';
    1619$lang['%d photo'] = '%d photo';
    1720$lang['%d photos'] = '%d photos';
     
    2427$lang['Regenerate photos list of all SmartAlbums'] = 'Régénérer les photos de tous les SmartAlbums';
    2528$lang['Update albums on file upload'] = 'Mettre à jour les albums après la mise en ligne d\'un fichier';
    26 $lang['Update albums when an admin logins'] = 'Mettre à jour les albums quand un admin se connecte';
    2729
    2830?>
  • extensions/SmartAlbums/main.inc.php

    r11376 r11380  
    1717
    1818add_event_handler('invalidate_user_cache', 'smart_make_all_associations');
    19 add_event_handler('login_success', 'smart_make_all_associations');
    2019include_once(SMART_PATH.'include/functions.inc.php');
    2120
  • extensions/SmartAlbums/maintain.inc.php

    r11376 r11380  
    2626    \''.serialize(array(
    2727        'update_on_upload' => false,
    28         'update_on_login' => false,
    2928        )
    3029      ).'\',
     
    4746    \''.serialize(array(
    4847        'update_on_upload' => false,
    49         'update_on_login' => false,
    5048        )
    5149      ).'\',
  • extensions/SmartAlbums/template/admin.tpl

    r11376 r11380  
    1212                                <label><input type="radio" name="update_on_upload" value="false" {if $update_on_upload == 'false'}checked="checked"{/if}/> {'No'|@translate}</label>
    1313                        </li>
    14                         <li>
    15                                 <span class="property">{'Update albums when an admin logins'|@translate}</span>
    16                                 <label><input type="radio" name="update_on_login" value="true" {if $update_on_login == 'true'}checked="checked"{/if}/> {'Yes'|@translate}</label>
    17                                 <label><input type="radio" name="update_on_login" value="false" {if $update_on_login == 'false'}checked="checked"{/if}/> {'No'|@translate}</label>
    18                         </li>   
    1914                </ul>
    2015        </fieldset>
Note: See TracChangeset for help on using the changeset viewer.