Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: Sorting pictures in albums - move to top/bottom button  (Read 9141 times)

0 Members and 1 Guest are viewing this topic.

mironto

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 1
Sorting pictures in albums - move to top/bottom button
« on: April 06, 2009, 10:32:09 PM »

I would really like to have a button to move the picture to top/bottom of the list, instead of clicking x-times move up/down button.
Actually this should be pretty easy, as I implemented it myself already within a few minutes. Here is the code, I am sure you can optimize or make it fool proof if needed.

in picmgr.php I have added these two javascript functions:

Code: [Select]
    function Movetop_Option()
    {
        var to = document.picture_menu.to;
        var pos = selectedOptIndex;
        if (pos == 0) {
            return;
        }
        for (i=pos; i>0; i--) {
            swap_option(to, i, i-1);
        }
        selected_option(to, 0);
    }

    function Movebottom_Option()
    {
        var to = document.picture_menu.to;
        var pos = selectedOptIndex;
        if (pos == to.length-1) {
            return;
        }
        for (i=pos; i<to.length-1; i++) {
            swap_option(to, i, i+1);
        }
        selected_option(to, to.length-1);
    }

Then I added two new buttons.
Code: [Select]
<a href="javascript:Movetop_Option();"><img src="images/move_top.gif" width="26" height="21" border="0" alt="" /></a>
<a href="javascript:Movebottom_Option();"><img src="images/move_bottom.gif" width="26" height="21" border="0" alt="" /></a>

See the attached image, now I can move the pictures to top/bottom by one click.
This can also be applied for sorting albums, just edit albmgr.php the same way.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Sorting pictures in albums - move to top/bottom button
« Reply #1 on: April 07, 2009, 08:25:13 AM »

Nice one, thanks.
Logged
Pages: [1]   Go Up
 

Page created in 0.065 seconds with 20 queries.