albmgr.php new feature : jump down into the subcategories and back albmgr.php new feature : jump down into the subcategories and back
 

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]

Main Menu

albmgr.php new feature : jump down into the subcategories and back

Started by olafbecker, June 26, 2006, 12:39:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

olafbecker

Everything which is bold marked is modified now so that it is more userfriendly than befor.You did not get overloaded anymore with unused data.
this modification release your database selects and request.
Now it is much easier to administrate the album because I have already more than 5000 categories in my database and it grows fast.
www.aviationphotos.info is the place where I use under photos this Database of Coppermine in the 1.4.2 stable Version.
With the field *No category* you can jump back to the top level. And it refresh automaticly so that you can jump into subcategories and back to the top.
So feel free to use this modifications now.

Olaf Becker

if you need any help sent me an email to : obecker@teranet.de

I am still working on it and try


here is the snipout of the albmgr.php which needs to be modified so that you can use this new function.

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly 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.2
  $Source: /cvsroot/coppermine/devel/albmgr.php,v $
  $Revision: 1.18 $
  $Author: gaugau $
  $Date: 2005/10/25 01:15:41 $
**********************************************/

.
.
.
...

// modified by Olaf Becker for beeing sorted alphabetic.
// added description and description02 to the printout as well.  The description02 was added manualy into the SQL structure.
// so be carefull with SQL Database modifications !!


function alb_get_subcat_data($parent, $ident = '')
{
    global $CONFIG, $CAT_LIST;

    if ($CONFIG['categories_alpha_sort'] == 1) {
      $sort_query = 'name';
    } else {
      $sort_query = 'pos';
    }

    $result = cpg_db_query("SELECT cid, name, description, description02 " . " FROM {$CONFIG['TABLE_CATEGORIES']} " . " WHERE parent = '$parent' " . " AND CID != 1  ORDER BY $sort_query ");

    if (mysql_num_rows($result) > 0) {
        $rowset = cpg_db_fetch_rowset($result);
        foreach ($rowset as $subcat) {
            $spacer01 = '';
            $spacer02 = '';
            if ($subcat['description'] != ''){
              $spacer01 = " - ";
            }
            if ($subcat['description02'] != ''){
              $spacer02 = " - ";
            }
               
            $CAT_LIST[] = array($subcat['cid'], $ident . '&nbsp;&nbsp;&nbsp;' . $subcat['name'] . $spacer01 . $subcat['description'] . $spacer02  . $subcat['description02'] );

// is not needed anymore (removed by Olaf Becker) because you can brows now into the subcategories
//            alb_get_subcat_data($subcat['cid'], $ident . '&nbsp;&nbsp;&nbsp;');

        }
    }
}

.
.
.
.
......

?>
        <form name="album_menu" method="post" action="delete.php?what=albmgr" onSubmit="return CheckAlbumForm(this);">
        <input type="hidden" name="delete_album" value="" />
        <input type="hidden" name="sort_order" value="<?php echo $sort_order ?>" />
        <td class="tableb" valign="top" align="center">
                <br />
                <table width="300" border="0" cellspacing="0" cellpadding="0">
<?php
if (GALLERY_ADMIN_MODE) {
    $CAT_LIST = array();
    $CAT_LIST[] = array(FIRST_USER_CAT + USER_ID, $lang_albmgr_php['my_gallery']);
    $CAT_LIST[] = array(0, $lang_albmgr_php['no_category']);
    alb_get_subcat_data($cat, '');

    echo <<<EOT
                <tr>
                        <td>
                                <b>{$lang_albmgr_php['select_category']}</b>
                                <select onChange="if(this.options[this.selectedIndex].value) window.location.href='{$_SERVER['PHP_SELF']}?cat='+this.options[this.selectedIndex].value;"  name="cat" class="listbox">
EOT;
    foreach($CAT_LIST as $category) {
        echo '                                <option value="' . $category[0] . '"' . ($cat == $category[0] ? ' selected': '') . ">" . $category[1] . "</option>\n";
    }
    echo <<<EOT
                                </select>
                                <br /><br />
                        </td>
                </tr>

EOT;
}

?>

................


Joachim Müller

Please use the code button (the one with the hash sign) and describe in detail what your mod does.