Changeset 5138


Ignore:
Timestamp:
03/15/10 00:56:21 (10 years ago)
Author:
plg
Message:

feature 1505: when there is no photo yet in the gallery, displays a big and
obvious message, guiding to the Administration>Images>Add page.

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/common.inc.php

    r5123 r5138  
    166166} 
    167167 
     168// The "No Photo Yet" feature: if you have no photo yet in your gallery, the 
     169// gallery displays only a big box to show you the way for adding your first 
     170// photos 
     171if ( 
     172  !isset($conf['no_photo_yet'])             // the message disappears at first photo 
     173  and !(defined('IN_ADMIN') and IN_ADMIN)   // no message inside administration 
     174  and script_basename() != 'identification' // keep the ability to login 
     175  ) 
     176{ 
     177  $query = ' 
     178SELECT 
     179    COUNT(*) 
     180  FROM '.IMAGES_TABLE.' 
     181;'; 
     182  list($nb_photos) = pwg_db_fetch_row(pwg_query($query)); 
     183  if (0 == $nb_photos) 
     184  { 
     185    $template->set_filenames(array('no_photo_yet'=>'no_photo_yet.tpl')); 
     186 
     187    $url = $conf['no_photo_yet_url']; 
     188    if (substr($url, 0, 4) != 'http') 
     189    { 
     190      $url = get_root_url().$url; 
     191    } 
     192     
     193    $template->assign(array('next_step_url' => $url)); 
     194    $template->pparse('no_photo_yet'); 
     195    exit(); 
     196  } 
     197  else 
     198  { 
     199    conf_update_param('no_photo_yet', 'false'); 
     200  } 
     201} 
     202 
    168203if (isset($user['internal_status']['guest_must_be_guest']) 
    169204    and 
  • trunk/include/config_default.inc.php

    r5123 r5138  
    766766// where should the API add photos? 
    767767$conf['upload_dir'] = PHPWG_ROOT_PATH.'upload'; 
     768 
     769// where should the user be guided when there is no photo in his gallery yet? 
     770$conf['no_photo_yet_url'] = 'admin.php?page=photos_add'; 
    768771?> 
  • trunk/include/functions.inc.php

    r5123 r5138  
    10611061} 
    10621062 
     1063function conf_update_param($param, $value) 
     1064{ 
     1065  $query = ' 
     1066DELETE 
     1067  FROM '.CONFIG_TABLE.' 
     1068  WHERE param = "'.$param.'" 
     1069;'; 
     1070  pwg_query($query); 
     1071 
     1072  $query = ' 
     1073INSERT 
     1074  INTO '.CONFIG_TABLE.' 
     1075  SET param = "'.$param.'" 
     1076    , value = "'.$value.'" 
     1077;'; 
     1078  pwg_query($query); 
     1079} 
     1080 
    10631081/** 
    10641082 * Prepends and appends a string at each value of the given array. 
Note: See TracChangeset for help on using the changeset viewer.