Changeset 861 in ExiteCMS for trunk/administration/downloads.php


Ignore:
Timestamp:
10/02/07 22:23:07 (5 years ago)
Author:
hverton
Message:

moved more templates to the template include directory
download panel had problems displaying an odd number of categories
make more modules xhtml compliant

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/downloads.php

    r838 r861  
    8787 
    8888// initialise some variables we need later 
    89 if (!isset($download_cat_id)) $download_cat_id = ""; 
     89if (!isset($download_cat_id)) $download_cat_id = "-1"; 
    9090if (!isset($step)) $step = ""; 
    9191$barmsg = ""; 
     
    168168    } 
    169169 
    170     // get the first download category 
     170    // build the download tree 
     171    $variables['tree'] = array(); 
     172    $variables['tree'][] = array('node' => 'P', 'nestlevel' => -1, 'name' => $locale['455'], 'id' => 0); 
     173    // Download root first 
     174    $result = dbquery("SELECT * FROM ".$db_prefix."downloads WHERE download_cat = '0' ORDER BY download_id DESC"); 
     175    if ($rows = dbrows($result)) { 
     176        $row = 1; 
     177        while ($data = dbarray($result)) { 
     178            $variables['tree'][] = array('node' => 'D', 'first' => ($row == 1), 'last' => ($row == $rows), 'cat_id' => 0, 'url' => $data['download_url'], 'name' => $data['download_title'], 'id' => $data['download_id']); 
     179        } 
     180    } else { 
     181        // no downloads in this category 
     182        $variables['tree'][] = array('node' => 'E', 'name' => $locale['505'], 'id' => 0); 
     183    } 
     184    // Then recurse through the download categories 
    171185    $result = dbquery("SELECT * FROM ".$db_prefix."download_cats WHERE download_cat_id > 0 AND download_parent = 0 ORDER BY download_cat_id DESC LIMIT 1"); 
    172     $variables['tree'] = array(); 
    173186    if (dbrows($result) != 0) { 
    174187        $data = dbarray($result); 
     
    189202    // get all downloads from the database 
    190203    $variables['barfiles'] = array(); 
    191     $result = dbquery("SELECT * FROM ".$db_prefix."downloads ORDER BY download_id"); 
     204    $result = dbquery("SELECT * FROM ".$db_prefix."downloads ORDER BY download_id DESC"); 
    192205    while($data = dbarray($result)) { 
    193         $data['download_cat_name'] = $variables['download_cats'][$data['download_cat']]; 
     206        if ($data['download_cat']) { 
     207            $data['download_cat_name'] = $variables['download_cats'][$data['download_cat']]; 
     208        } else { 
     209            $data['download_cat_name'] = $locale['455']; 
     210        } 
    194211        $variables['barfiles'][] = $data; 
    195212    } 
Note: See TracChangeset for help on using the changeset viewer.