width of gallery not set correctly

Bug #1366622 reported by Robert Lyon on 2014-09-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Robert Lyon
1.10
Medium
Robert Lyon
1.9
Medium
Robert Lyon
15.04
Medium
Robert Lyon

Bug Description

When creating an image gallery, a user can 'blank' out the 'Width' field.

When the block is instantiated, the $configdata['width'] is set but it's empty.

So, the $width is also empty.

i.e. $width = isset($configdata['width']) ? $configdata['width'] : 75;

I think the switch at the top should also check for '&& $configdata['width'] > 0':

i.e.

switch ($style) {
case 0: // thumbnails
$template = 'thumbnails';
$width = isset($configdata['width']) && $configdata['width'] > 0 ? $configdata['width'] : 75;
break;
case 1: // slideshow
$template = 'slideshow';
$width = isset($configdata['width']) && $configdata['width'] > 0 ? $configdata['width'] : 400;
break;
case 2: // square thumbnails
//default:
$template = 'squarethumbs';
$width = isset($configdata['width']) && $configdata['width'] > 0 ? $configdata['width'] : 75;
break;
}

Hope that makes sense.

Robert Lyon (robertl-9) on 2014-09-08
Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
milestone: none → 1.10.0
status: Confirmed → In Progress
Mahara Bot (dev-mahara) wrote :

Patch for "1.9_STABLE" branch: https://reviews.mahara.org/3687

Aaron Wells (u-aaronw) on 2014-09-10
Changed in mahara:
milestone: 1.10.0 → 1.10.1
Eduardo (o-eduardo) wrote :

Reviewed patch set 3 on Mahara version 1.10.0dev (2014073100). Before patch when witdh was set to "blank" for an image gallery, it would be accepted and the images would not show. After patch when width is set to "blank" and the settings are saved the width goes back to the default setting. Below are the steps that I need.

Log in as admin
Go to Portfolio
Click on Create page
Page Title “Testing Bug”
Save settings
Go to Edit content
Click on Media → Image Gallery
Load images
Set Width to “blank”
Save settings
Confirmed that width went back to default

Reviewed: https://reviews.mahara.org/3686
Committed: http://gitorious.org/mahara/mahara/commit/408229296c374679fa0b191d642bacba1787b3e0
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 408229296c374679fa0b191d642bacba1787b3e0
Author: Bob Lyon <email address hidden>
Date: Mon Sep 8 20:32:52 2014 +1200

Allowing for correctly saving the gallery width setting (Bug #1366622)

Currently it checks what width it should be on rendering but it
should also do this on saving to make sure a width of 0 is not set.

Change-Id: I7837c3120fa29e2a2dc5c9c63301dfa4543428a4
Signed-off-by: Bob Lyon <email address hidden>

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3796
Committed: http://gitorious.org/mahara/mahara/commit/d2526f849faa0f069b50784586fbb55811e1deb7
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit d2526f849faa0f069b50784586fbb55811e1deb7
Author: Bob Lyon <email address hidden>
Date: Mon Sep 8 20:32:52 2014 +1200

Allowing for correctly saving the gallery width setting (Bug #1366622)

Currently it checks what width it should be on rendering but it
should also do this on saving to make sure a width of 0 is not set.

Change-Id: I7837c3120fa29e2a2dc5c9c63301dfa4543428a4
Signed-off-by: Bob Lyon <email address hidden>

Eduardo (o-eduardo) wrote :

Tested on Mahara version (1.9.3testing). Path works and here is a detailed method for my testing.

1. Log in as admin
2. Go to Portfolio
3. Click on Create page → Page Title “Testing Bug”
4. Save
5. Click on Media → Image gallery type in the block
6. Under “Image selection”, select Display all images from one of my folders (will include images uploaded later)
7. Style → Thumbnails
8. Set width to “blank” (previous value was 75)
9. Save
10. Click on image gallery settings icon → Confirm width has gone back to 75 → Passed
11. Select another Image gallery type in the block
12. Under “Image selection”, select Display all images from one of my folders (will include images uploaded later)
13. Style → Thumbnails (square)
14. Set width to “blank” (previous value was 75)
15. Save
16. Click on image gallery setting icon → Confirm width has gone back to 75 → Passed
17. Select another Image gallery type in the block
18. Under “Image selection”, select → Display all images from one of my folders (will include images uploaded later)
19. Style → Slideshow
20. Set width to “blank” (previous was 400)
21. Save
22. Click on image gallery setting icon → Confirm width has gone back to 400→ Passed
23. Select another Image gallery type in the block
24. Under “Image selection”, select Choose individual images to display
25. Style → Thumbnails
26. Set width to “blank” (previous value was 75)
27. Save
28. Click on image gallery setting icon → Confirm width has gone back to 75 → Passed
29. Select another Image gallery type in the block
30. Under “Image selection”, select Choose individual images to display
31. Style → Thumbnails (square)
32. Set width to “blank” (previous value was 75)
33. Save
34. Click on image gallery setting icon → Confirm width has gone back to 75 → Passed
35. Select another Image gallery type in the block
36. Under “Image selection”, select Choose individual images to display
37. Style → Slideshow
38. Set width to “blank” (previous value was 400)
39. Save
40. Click on image gallery setting icon → Confirm width has gone back to 400 → Passed

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3687
Committed: http://gitorious.org/mahara/mahara/commit/6011b537d6d0e17ef478e019834df2e4a935fb4e
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.9_STABLE

commit 6011b537d6d0e17ef478e019834df2e4a935fb4e
Author: Bob Lyon <email address hidden>
Date: Mon Sep 8 20:32:52 2014 +1200

Allowing for correctly saving the gallery width setting (Bug #1366622)

Currently it checks what width it should be on rendering but really it
should do this on saving.

Change-Id: I7837c3120fa29e2a2dc5c9c63301dfa4543428a4
Signed-off-by: Bob Lyon <email address hidden>

Robert Lyon (robertl-9) on 2015-04-17
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers