Changeset 875


Ignore:
Timestamp:
09/24/05 21:05:55 (15 years ago)
Author:
plg
Message:
  • bug 162 fixed: division by zero when trying to view "all" items in admin/element_set_(global|unit)
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/element_set_global.php

    r834 r875  
    9494    case 'selection' : 
    9595    { 
    96       $collection = $_POST['selection']; 
     96      if (!isset($_POST['selection']) or count($_POST['selection']) == 0) 
     97      { 
     98        array_push($page['errors'], l10n('Select at least one picture')); 
     99      } 
     100      else 
     101      { 
     102        $collection = $_POST['selection']; 
     103      } 
    97104      break; 
    98105    } 
    99106  } 
    100107 
    101   if ($_POST['associate'] != 0) 
     108  if ($_POST['associate'] != 0 and count($collection) > 0) 
    102109  { 
    103110    $datas = array(); 
     
    126133  } 
    127134 
    128   if ($_POST['dissociate'] != 0) 
     135  if ($_POST['dissociate'] != 0 and count($collection) > 0) 
    129136  { 
    130137    // physical links must not be broken, so we must first retrieve image_id 
     
    167174   
    168175  // updating elements is useful only if needed... 
    169   if (count($dbfields['update']) > 0) 
     176  if (count($dbfields['update']) > 0 and count($collection) > 0) 
    170177  { 
    171178    $query = ' 
     
    393400 
    394401$page['cols'] = !empty($_GET['cols']) ? intval($_GET['cols']) : 5; 
    395 $page['nb_images'] = !empty($_GET['display']) ? intval($_GET['display']) : 20; 
     402 
     403// how many items to display on this page 
     404if (!empty($_GET['display'])) 
     405{ 
     406  if ('all' == $_GET['display']) 
     407  { 
     408    $page['nb_images'] = count($page['cat_elements_id']); 
     409  } 
     410  else 
     411  { 
     412    $page['nb_images'] = intval($_GET['display']); 
     413  } 
     414} 
     415else 
     416{ 
     417  $page['nb_images'] = 20; 
     418} 
    396419 
    397420if (count($page['cat_elements_id']) > 0) 
  • trunk/admin/element_set_unit.php

    r836 r875  
    158158// +-----------------------------------------------------------------------+ 
    159159 
    160 $page['nb_images'] = !empty($_GET['display']) ? intval($_GET['display']) : 5; 
     160// how many items to display on this page 
     161if (!empty($_GET['display'])) 
     162{ 
     163  if ('all' == $_GET['display']) 
     164  { 
     165    $page['nb_images'] = count($page['cat_elements_id']); 
     166  } 
     167  else 
     168  { 
     169    $page['nb_images'] = intval($_GET['display']); 
     170  } 
     171} 
     172else 
     173{ 
     174  $page['nb_images'] = 5; 
     175} 
     176 
    161177 
    162178 
  • trunk/doc/ChangeLog

    r874 r875  
     12005-09-21 Pierrick LE GALL 
     2 
     3        * bug 162 fixed: division by zero when trying to view "all" items 
     4        in admin/element_set_(global|unit) 
     5         
    162005-09-21 Pierrick LE GALL 
    27 
Note: See TracChangeset for help on using the changeset viewer.