allow for reordering of files in image gallery block

Bug #1396761 reported by Robert Lyon
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
Wishlist
Unassigned

Bug Description

This bug is similar to https://bugs.launchpad.net/mahara/+bug/732462 and any resorting drag/drop fix there will need to be done for this as bug also.

But there is another complicating factor that makes this bug separate and that is:

When we first add a gallery block to a page and select some images to be attached to it the block renders them in the order we selected them.

but when we got to edit the block again to add more items it changes the sort order of the originally added items

This is due to the image gallery using a function to return the information for the selected items via:

'selectlistcallback' => 'artefact_get_records_by_id'

and that function returns a list of selected items in the order of when they were created in the system - eg an array of class objects with each class->id being the array key.

eg:

array (
    [9] => stdClass Object
        (
            [artefacttype] => image
            [title] => cats.jpg
             ...
            [id] => 9
        )
    [16] => stdClass Object
        (
            [artefacttype] => image
            [title] => ants.jpg
            ...
            [id] => 16
        )

So we end up with something that is not alphabetical - nor the order we selected them to be attached to the block

What would be needed is to take the $values (which is in the order of attaching to block) and impose that sort order on the $selected array so that when we edit the block again it doesn't loose our initial selection order.

Revision history for this message
aceMa (h-manthey) wrote :

When rendering an image gallery the script starts with a list of image-ids that fall from the DB and represents the gallery. Of course any information that could indicate the order of the images has to be added to the relation of gallery and image. So it is possible that the starting-point is the table that holds this relation.

Robert Lyon (robertl-9)
Changed in mahara:
milestone: 15.04.0 → 15.04.1
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 15.04.1 → 15.10.0
importance: Medium → Wishlist
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 15.10.0 → 16.04.0
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 16.04.0 → 16.10.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.0 → 16.10.1
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.1 → 17.04.0
Changed in mahara:
milestone: 17.04.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.