Category Manager moving categories things when editing existing categories Category Manager moving categories things when editing existing categories
 

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

Category Manager moving categories things when editing existing categories

Started by barramyainc, January 03, 2009, 07:23:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

barramyainc

Hi all

This post will probably be more so aimed at Nibbler as he posted the link for the new file.  I was having problems with the category Manager displaying a blank page due to the number of categories I have on my site, so installed the catmgr.php as per the following thread - http://forum.coppermine-gallery.net/index.php/topic,50783.0.html

All is working fine in regards to the original white screen problem, except for one slight issue - the sub-category appears to not keep the main category which it has been linked to, or its linking itself to a different category, when the sub-category is edited.  When a new sub-category is added, the behaviour is as expected (well as I've been used to!) with the new category being added to the bottom of the list (error1.jpg).  Before when I was editing a category, nothing changes with the position in the list, now however the sub-category loses its original category.  It links to a new category (as pictured) or looses it completely.

When I re-link the moved sub-category to the new main category - for example 1PW - it appears to the top of the sub-category list rather than back to the bottom.  It's ok when there are only a few in the category to move them manually - however when there is a long list it takes a while to reposition them.

I am running 1.4.19 with Stramm's mod packs, and I have tested with a few themes incase the theme I was using (which I'm in the process of updating) was causing a problem.  I have also used the default version of Category Manager for 1.4.19 however got the original white screen problem.

Any ideas?

Site is located at http://albums.britishwrestlingpictures.com - a test admin account can be provided if needed.

Thanks

Sarah


Nibbler

Try replacing the cat_list_box function with this updated version.


function cat_list_box($cid, &$parent, $on_change_refresh = true)
{
    global $lang_catmgr_php, $CAT_LIST;

    if ($on_change_refresh) {

        $lb = '<select name="parent" onmouseover="setbuild(this, '. (int) $parent['cid'] . ')" onchange="updateParent(this, ' . $cid . ')" class="listbox">';

        if ($parent['cid'] == 0) {
            $lb .= '<option value="0" selected="selected">' . $lang_catmgr_php['no_category'] . '</option>';
        } else {
            $lb .= '<option value="' . $parent['cid'] .  '" selected="selected">' . $parent['name'] . '</option>';
        }

        $lb .= '</select>';

    } else {

        $lb = '<select name="parent" id="build_source" class="listbox">' . "\n";

        $lb .= '    <option value="0"' . ($parent == 0 ? ' selected': '') . '>' . $lang_catmgr_php['no_category'] . "</option>\n";

        foreach ($CAT_LIST as $category) {
       
            if ($category['cid'] > 1) {
                $lb .= '    <option value="' . $category['cid'] . '"' . ($parent == $category['cid'] ? ' selected': '') . ">" . $category['name'] . "</option>\n";
            }
        }
       
        $lb .= '</select>';
    }

    return $lb;
}

barramyainc

Cat doesn't appear to be changed or lost during the edit as allowed me to update the icon with no problems - however has been moved - Worthing - 30th December 2008 for example moved from Premier Promotions Category to IPW category but at the bottom (also does not appear to be indented the same as the other categories within the main category- have left as is).

Nibbler

Alright then, change


$lb = cat_list_box($current_category['parent'], $current_category['cid'], false);


to


$lb = cat_list_box($current_category['cid'], $current_category['parent'], false);

barramyainc