Changeset 11392


Ignore:
Timestamp:
06/16/11 12:54:59 (8 years ago)
Author:
mistic100
Message:

add a list of all SmartAlbums

Location:
extensions/SmartAlbums
Files:
7 added
9 edited
1 moved

Legend:

Unmodified
Added
Removed
  • extensions/SmartAlbums/admin.php

    r11381 r11392  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 
    33 
    4 global $conf, $template; 
     4global $conf, $template, $page; 
     5 
    56load_language('plugin.lang', SMART_PATH); 
    67if (!is_array($conf['SmartAlbums'])) $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']); 
    78 
    8  
    9 // Enregistrement de la configuration 
    10 if (isset($_POST['submit'])) 
    11 { 
    12         $conf['SmartAlbums'] = array( 
    13     'update_on_upload' => isset($_POST['update_on_upload']),  
    14     );     
    15          
    16   conf_update_param('SmartAlbums', serialize($conf['SmartAlbums'])); 
    17         array_push($page['infos'], l10n('Information data registered in database')); 
    18 } 
     9include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 
     10$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'albums'; 
     11   
     12$tabsheet = new tabsheet(); 
     13$tabsheet->add('albums', l10n('All SmartAlbums'), SMART_ADMIN.'-albums'); 
     14$tabsheet->add('config', l10n('Configuration'),   SMART_ADMIN.'-config'); 
     15$tabsheet->select($page['tab']); 
     16$tabsheet->assign(); 
    1917 
    2018$template->assign(array( 
    2119  'SMART_PATH' => SMART_PATH, 
    22         'update_on_upload' => $conf['SmartAlbums']['update_on_upload'], 
    2320)); 
    24          
    25 $template->set_filename('SmartAlbums_conf', dirname(__FILE__).'/template/admin.tpl'); 
    26 $template->assign_var_from_handle('ADMIN_CONTENT', 'SmartAlbums_conf'); 
     21 
     22include(SMART_PATH.'admin/'.$page['tab'].'.inc.php'); 
     23$template->set_filename('SmartAlbums_content', dirname(__FILE__).'/admin/template/'.$page['tab'].'.tpl'); 
     24$template->assign_var_from_handle('ADMIN_CONTENT', 'SmartAlbums_content'); 
    2725 
    2826?> 
  • extensions/SmartAlbums/include/init_cat_list.php

    r11376 r11392  
    3131;'; 
    3232   
    33   $result = pwg_query($query); 
    34   $smart_cats = array(); 
    35   while ($cat = pwg_db_fetch_assoc($result)) 
    36   { 
    37     $smart_cats[$cat['id']] = trigger_event('render_category_name', $cat['name']); 
    38   } 
    39    
     33  $smart_cats = hash_from_query($query, 'id');  
    4034  $smart_count = count($smart_cats); 
    4135   
     
    4539    if ($_GET['smart_generate'] == 'all') 
    4640    { 
    47       foreach ($smart_cats as $cat => $name) 
     41      foreach ($smart_cats as $category) 
    4842      { 
    49         $associated_images = smart_make_associations($cat); 
     43        $associated_images = smart_make_associations($category['id']); 
    5044        array_push( 
    5145          $page['infos'],  
    5246          l10n_args(get_l10n_args( 
    5347            '%d photos associated to album «%s»',  
    54             array(count($associated_images), $name) 
     48            array( 
     49              count($associated_images),  
     50              trigger_event( 
     51                'render_category_name', 
     52                $category['name'], 
     53                'admin_cat_list' 
     54                ) 
     55              ) 
    5556            )) 
    5657          ); 
     
    6566        l10n_args(get_l10n_args( 
    6667          '%d photos associated to album «%s»',  
    67           array(count($associated_images), $smart_cats[$_GET['smart_generate']]) 
     68          array( 
     69            count($associated_images),  
     70            trigger_event( 
     71              'render_category_name', 
     72              $smart_cats[$_GET['smart_generate']]['name'], 
     73              'admin_cat_list' 
     74              ) 
     75            ) 
    6876          )) 
    6977        ); 
     
    98106  $replacement[0] = ' 
    99107{if isset($SMART_URL[$category.ID])} 
    100         <li><a href="{$SMART_URL[$category.ID]}" title="{\'Regenerate photos list of this SmartAlbum\'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/synchronize.png" class="button" alt="{\'regenerate photos list\'|@translate}"></a></li> 
     108        <li><a href="{$SMART_URL[$category.ID]}" title="{\'Regenerate photos list of this SmartAlbum\'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/synchronize.png" class="button" alt="{\'Regenerate photos list of this SmartAlbum\'|@translate}"></a></li> 
    101109{/if}' 
    102110.$search[0]; 
  • extensions/SmartAlbums/include/init_cat_modify.php

    r11380 r11392  
    8787        ), 
    8888      'limit' => array('limit' => 'limit'), // second filter not used 
     89      // TODO : new filter by album 
    8990      ) 
    9091    ); 
     
    130131  } 
    131132   
     133  if (isset($_GET['new_smart'])) 
     134  { 
     135    $template->assign('new_smart', true); 
     136  } 
     137   
    132138  $template->assign(array( 
    133139    'SMART_PATH' => SMART_PATH, 
     
    141147function smart_cat_modify_prefilter($content, &$smarty) 
    142148{ 
    143   $search = '<form action="{$F_ACTION}" method="POST" id="links">'; 
     149  $search = '<form action="{$F_ACTION}" method="POST" id="catModify">'; 
    144150  $replacement = file_get_contents(SMART_PATH.'template/cat_modify.tpl')."\n".$search; 
    145151  return str_replace($search, $replacement, $content); 
  • extensions/SmartAlbums/language/en_UK/plugin.lang.php

    r11380 r11392  
    2222$lang['date filter'] = 'date filter'; 
    2323$lang['limit filter'] = 'limit filter'; 
     24$lang['Add filters here'] = 'Add filters here'; 
    2425$lang['This album is a SmartAlbum'] = 'This album is a SmartAlbum'; 
    2526$lang['Count'] = 'Count'; 
     
    2728$lang['Regenerate photos list of all SmartAlbums'] = 'Regenerate photos list of all SmartAlbums'; 
    2829$lang['Update albums on file upload'] = 'Update albums on file upload'; 
     30$lang['All SmartAlbums'] = 'All SmartAlbums'; 
     31$lang['Add a SmartAlbum'] = 'Add a SmartAlbum'; 
     32$lang['SmartAlbum deleted'] = 'SmartAlbum deleted'; 
     33$lang['SmartAlbum added'] = 'SmartAlbum added'; 
     34$lang['Only SmartAlbums are displayed on this page'] = 'Only SmartAlbums are displayed on this page'; 
     35$lang['To order albums please go the main albums management page'] = 'To order albums please go the main albums management page'; 
     36$lang['Don\'t show this message again'] = 'Don\'t show this message again'; 
    2937 
    3038?> 
  • extensions/SmartAlbums/language/fr_FR/plugin.lang.php

    r11380 r11392  
    22 
    33$lang['%d photos associated to album &laquo;%s&raquo;'] = '%d photos associées à l\'album &laquo;%s&raquo;'; 
    4 $lang['No filter selected'] = 'Aucun filter sélectionné'; 
     4$lang['No filter selected'] = 'Aucun filtre sélectionné'; 
    55$lang['No tag selected'] = 'Aucun tag sélectionné'; 
    66$lang['Date string is malformed'] = 'La date n\'est pas correcte'; 
     
    2222$lang['date filter'] = 'filtrer par date'; 
    2323$lang['limit filter'] = 'nombre max. d\'éléments'; 
     24$lang['Add filters here'] = 'Ajoutez des filtres ici'; 
    2425$lang['This album is a SmartAlbum'] = 'Cet album est un SmartAlbum'; 
    2526$lang['Count'] = 'Compter'; 
     
    2728$lang['Regenerate photos list of all SmartAlbums'] = 'Régénérer les photos de tous les SmartAlbums'; 
    2829$lang['Update albums on file upload'] = 'Mettre à jour les albums après la mise en ligne d\'un fichier'; 
     30$lang['All SmartAlbums'] = 'Tous les SmartAlbums'; 
     31$lang['Add a SmartAlbum'] = 'Ajouter un SmartAlbum'; 
     32$lang['SmartAlbum deleted'] = 'SmartAlbum ajouté'; 
     33$lang['SmartAlbum added'] = 'SmartAlbum supprimé'; 
     34$lang['Only SmartAlbums are displayed on this page'] = 'Seuls les SmartAlbums sont affichés sur cette page'; 
     35$lang['To order albums please go the main albums management page'] = 'Pour ordonner les albums veuillez vous rendre sur la page principale de gestion des albums'; 
     36$lang['Don\'t show this message again'] = 'Ne plus afficher ce message'; 
    2937 
    3038?> 
  • extensions/SmartAlbums/main.inc.php

    r11380 r11392  
    1515define('SMART_PATH', PHPWG_PLUGINS_PATH.SMART_DIR.'/'); 
    1616define('CATEGORY_FILTERS_TABLE', $prefixeTable.'category_filters'); 
     17define('SMART_ADMIN', get_root_url().'admin.php?page=plugin-' . SMART_DIR); 
    1718 
    1819add_event_handler('invalidate_user_cache', 'smart_make_all_associations'); 
     
    3940                array_push($menu, array( 
    4041                        'NAME' => 'SmartAlbums', 
    41                         'URL' => get_root_url().'admin.php?page=plugin-' . SMART_DIR)); 
     42                        'URL' => SMART_ADMIN, 
     43      ) 
     44    ); 
    4245                return $menu; 
    4346        } 
  • extensions/SmartAlbums/maintain.inc.php

    r11381 r11392  
    2626    \''.serialize(array( 
    2727        'update_on_upload' => true, 
     28        'show_list_messages' => true, 
    2829        ) 
    2930      ).'\', 
     
    3637function plugin_activate() 
    3738{  
    38   $sa_config = pwg_query('SELECT * FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\';'); 
    39    
    40   if (!pwg_db_num_rows($sa_config)) 
     39  if (!isset($conf['SmartAlbums'])) 
    4140  { 
    4241    pwg_query(' 
     
    4645    \''.serialize(array( 
    4746        'update_on_upload' => true, 
     47        'show_list_messages' => true, 
    4848        ) 
    4949      ).'\', 
  • extensions/SmartAlbums/template/cat_modify.tpl

    r11334 r11392  
    4242    return false; 
    4343  }); 
     44   
     45 
    4446   
    4547  function add_filter(type) { 
     
    100102        } 
    101103   
     104  function doBlink(obj,start,finish) {  
     105    jQuery(obj).fadeOut(400).fadeIn(400);  
     106    if(start!=finish) {  
     107      doBlink(obj,start+1,finish); 
     108    } else { 
     109      jQuery(obj).fadeOut(400); 
     110    } 
     111  } 
     112     
     113  doBlink('.new_smart', 0, 3); 
    102114  init_jquery_handlers(); 
    103115}); 
     
    111123  <legend>{'SmartAlbums'|@translate}</legend> 
    112124   
    113   <label><input type="checkbox" name="is_smart" {if isset($filters)}checked="checked"{/if}/> {'This album is a SmartAlbum'|@translate}</label> 
     125  <label><input type="checkbox" name="is_smart" {if isset($filters) OR isset($new_smart)}checked="checked"{/if}/> {'This album is a SmartAlbum'|@translate}</label> 
    114126   
    115 <div id="SmartAlbum_options" style="margin-top:1em;{if !isset($filters)}display:none;{/if}"> 
     127<div id="SmartAlbum_options" style="margin-top:1em;{if !isset($filters) AND !isset($new_smart)}display:none;{/if}"> 
    116128  <ul id="filterList"> 
    117129    {counter start=0 assign=i} 
     
    151163      </select> 
    152164      <a id="removeFilters">{'Remove all filters'|@translate}</a> 
     165      {if isset($new_smart)}<span class="new_smart">{'Add filters here'|@translate}</span>{/if} 
    153166  </p> 
    154167</div> 
     
    156169  <p class="actionButtons" id="applyFilterBlock"> 
    157170    <input class="submit" type="submit" value="{'Submit'|@translate}" name="submitFilters"/> 
    158     <input class="submit" type="submit" value="{'Count'|@translate}" name="countImages" {if !isset($filters)}style="display:none;"{/if}/> 
     171    <input class="submit" type="submit" value="{'Count'|@translate}" name="countImages" {if !isset($filters) AND !isset($new_smart)}style="display:none;"{/if}/> 
    159172    <span class="count_images_display">{$IMAGE_COUNT}</span> 
    160173  </p> 
  • extensions/SmartAlbums/template/style.css

    r10980 r11392  
    1212  margin-bottom:0px !important;  
    1313} 
     14 
     15.new_smart { 
     16  color:#00AA00; 
     17  background-color:#C2F5C2; 
     18  font-weight:bold; 
     19  padding:3px 10px; 
     20  border-radius:4px; 
     21  box-shadow:0 0 2px #0a0; 
     22} 
Note: See TracChangeset for help on using the changeset viewer.