Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: categorie sorting in the batch upload  (Read 2460 times)

0 Members and 1 Guest are viewing this topic.

racl

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
categorie sorting in the batch upload
« on: April 11, 2006, 04:23:38 pm »

Hi!

I designed my gallerie with different categories and subcategories:

cat0
 ->cat0.1
  =>album1
  =>album2
 ->cat0.2
    ->cat0.2.1
       =>album1
       =>album2
    ->cat0.2.2
 ->cat0.3
 ->cat0.4
cat2
 ->cat1.1
...
a.s.o.

if i start adding files with the batch-upload function, i get the cat and album overview like this:

-> cat0.1
 =>album1
 =>album1 (from another cat)
-> cat0.2
 => album2
 => album2 (from another cat)

it's absolutely compley, in which album i have to save my files.


that's why i'd like to sort it like this:

-> cat 0 (without parent cat)
 -> cat0.1
  =>album1
  =>album2
 ->cat0.2
  =>ablum1
  =>album2


what information do i need additionally from the database and what do i have to change in the searchnew.php?

i hope, you can help, i think this is the concerned code:

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.4
  $Source: /cvsroot/coppermine/stable/searchnew.php,v $
  $Revision: 1.18 $
  $Author: gaugau $
  $Date: 2006/02/24 13:30:07 $
**********************************************/

define('IN_COPPERMINE'true);
define('SEARCHNEW_PHP'true);

require(
'include/init.inc.php');

if (!
GALLERY_ADMIN_MODEcpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);

/**
 * Local functions definition
 */

/**
 * albumselect()
 *
 * return the HTML code for a listbox with name $id that contains the list
 * of all albums
 *
 * @param string $id the name of the listbox
 * @return the HTML code
 */


 
function albumselect($id "album") {
// frogfoot re-wrote this function to present the list in categorized, sorted and nicely formatted order

    
global $CONFIG$lang_search_new_php$cpg_udb;
    static 
$select "";

    
// Reset counter
    
$list_count 0;

    if (
$select == "") {
        
$result cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = 0");
        while (
$row mysql_fetch_array($result)) {
            
// Add to multi-dim array for later sorting
            
$listArray[$list_count]['cat'] = $lang_search_new_php['albums_no_category'];
            
$listArray[$list_count]['aid'] = $row['aid'];
            
$listArray[$list_count]['title'] = $row['title'];
            
$list_count++;
        }
        
mysql_free_result($result);

        
$result cpg_db_query("SELECT DISTINCT a.aid as aid, a.title as title, c.name as cname FROM {$CONFIG['TABLE_ALBUMS']} as a, {$CONFIG['TABLE_CATEGORIES']} as c WHERE a.category = c.cid AND a.category < '" FIRST_USER_CAT "'");
        while (
$row mysql_fetch_array($result)) {
            
// Add to multi-dim array for later sorting
            
$listArray[$list_count]['cat'] = $row['cname'];
            
$listArray[$list_count]['aid'] = $row['aid'];
            
$listArray[$list_count]['title'] = $row['title'];
            
$list_count++;
        }
        
mysql_free_result($result);

        
//if (defined('UDB_INTEGRATION')) {
            
$sql $cpg_udb->get_batch_add_album_list();
        
/*} else {
            $sql = "SELECT aid, CONCAT('(', user_name, ') ', title) AS title " . "FROM {$CONFIG['TABLE_ALBUMS']} AS a " . "INNER JOIN {$CONFIG['TABLE_USERS']} AS u ON category = (" . FIRST_USER_CAT . " + user_id)";
        }*/
        
$result cpg_db_query($sql);
        while (
$row mysql_fetch_array($result)) {
            
// Add to multi-dim array for later sorting
            
$listArray[$list_count]['cat'] = $lang_search_new_php['personal_albums'];
            
$listArray[$list_count]['aid'] = $row['aid'];
            
$listArray[$list_count]['title'] = $row['title'];
            
$list_count++;
        }
        
mysql_free_result($result);

        
$select '<option value="0">' $lang_search_new_php['select_album'] . "</option>\n";

        
// Sort the pulldown options by category and album name
        
$listArray array_csort($listArray,'cat','title');

        
// Create the nicely sorted and formatted drop down list
        
$alb_cat '';
        foreach (
$listArray as $val) {
            if (
$val['cat'] != $alb_cat) {
          if (
$alb_cat$select .= "</optgroup>\n";
                
$select .= '<optgroup label="' $val['cat'] . '">' "\n";
                
$alb_cat $val['cat'];
            }
            
$select .= '<option value="' $val['aid'] . '"' . ($val['aid'] == $sel_album ' selected' '') . '>   ' $val['title'] . "</option>\n";
        }
        if (
$alb_cat$select .= "</optgroup>\n";
    }

    return 
"\n<select name=\"$id\" class=\"listbox\">\n$select</select>\n";
}
« Last Edit: April 12, 2006, 10:06:24 am by racl »
Logged

racl

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: categorie sorting in the batch-addition
« Reply #1 on: April 12, 2006, 09:24:30 am »

another possibility for sorting would be

cat0.cat0.1.album1
cat0.cat0.1.album2

cat0.cat0.2.album1

cat0.cat0.3.album1

cat1.cat1.1.album1
cat1.cat1.1.album2

any suggestions?
Logged

racl

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: categorie sorting in the batch upload
« Reply #2 on: June 28, 2006, 07:23:50 am »

does anyone know, where and how to set up the categories overview newly in the batch upload? it's very important. the ablumtitles often repeat themself. i can't see which album is in which cat!!!
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.