Slideshow module again

Re: Slideshow module again

by PBSL John -
Number of replies: 13

As part of coursework for an OSS course I've taken this semester, two classmates and I have fixed up a few issues for this activity and added new features:

Fixed issues

  • Internationalised many strings
  • Thumbnails in caption editing now display correctly
  • When deleting a slideshow the captions are actually deleted from the database
  • Replace calls to eregi with preg_match (I think we covered your fixes Michael)

New features

  • Add comments to each slide
  • Keep track of reading position. When opening a slideshow it loads the last reading position by default
  • Add YouTube/Vimeo video to each slide with the ability to position it

Backup and restore of the comments, last read positions and media work correctly.

Here's a link to our GitHub repository: https://github.com/PBSLjohn/moodle-mod_slideshow

Attachment rsz_1rsz_viewphp_with_comment_and_video.png
In reply to PBSL John

Re: Slideshow module again

by Michael Veit -

Thanks for the development. The function with the Videos could be interesting.

I'm testing your version a little bit with a local moodle version and I have found two issues.

  • The position of the images is always left. The settting of the position hasn't function.
  • The thumbnails in the caption page will be displayed only if the file is really ending with the extension jpg.

 

To show the thumbnails in the caption page again, I've made in the last few weeks a few changes. (The changes based of my version of Montag, 19. November 2012).

If you create a new slideshow, the full filename is stored with the extension in the database table "slideshow_captions" in the field "image".

If there are slideshows already, then the thumbnails are also displayed. Wether the full name is stored in the database table depends on the server system.
I tested this local with xampp: full filename was stored.
And I tested this on the live server: full filname wasn't  stored.
But for the function it isn't important.

The follow files were changed:

  • caption.php
  • edit_form.php
  • lib.php
  • view.php

I have marked the changes with "MV". Maybe you want to apply these changes.

 

Other changes are:

view.php

  • line 51 - 58: add <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> --> so the special characters (e.g. ä, ü) are displayed correctly if the background is white.

 

captions.php

  • line 38: add the full name of the course in the header

 

version.php

  • line 27: version 2012122700

In the hope that it will be useful.

So long
Michael

In reply to PBSL John

Re: Slideshow module again

by Michael Veit -

I found another bug:

  • The description can be found in the html code, but isn't visible on the website. It might be behind the image. If you delete the image from the website (not from the slideshow) than you can see the description.

Regards
Michael

In reply to Michael Veit

Re: Slideshow module again

by PBSL John -

Pushed changes to github with various fixes. I also sent a pull request to Paul Vaughan's repo yesterday, to try and keep the module from fragmenting too much.

The position of the images is always left. The settting of the position hasn't function.

Do you mean the "Centred" setting? It works for me in both Chrome and Firefox.

The thumbnails in the caption page will be displayed only if the file is really ending with the extension jpg.

I haven't been able to reproduce this, .png and .jpg files both show the thumbnail on the caption editing page for me.

view.php

    • line 51 - 58: add <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> --> so the special characters (e.g. ä, ü) are displayed correctly if the background is white.

 Incorporated this, and also fixed the markup. It was missing html and body opening tags.

captions.php

    • line 38: add the full name of the course in the header

Added it to media.php and the autopopup as well

I found another bug:

    • The description can be found in the html code, but isn't visible on the website. It might be behind the image. If you delete the image from the website (not from the slideshow) than you can see the description.

I fixed both under the image and to the right of the image caption display.

Might I suggest you clone one of the repositories on github? It's easier than using zip files to share changes.

In reply to PBSL John

Re: Slideshow module again

by Michael Veit -

"The thumbnails in the caption page will be displayed only if the file is really ending with the extension jpg.

I haven't been able to reproduce this, .png and .jpg files both show the thumbnail on the caption editing page for me."

 

OK. Probably it is caused by the uppercase. To accept uppercase and lowercase in the file extension, add in lib.php in line 345 "i":

Zele 345: if (  preg_match("/\.jpe?g$/i", $file_record->filename) || preg_match("/\.gif$/i", $file_record->filename) || preg_match("/\.png$/i", $file_record->filename))

Regards
Michael

In reply to Michael Veit

Re: Slideshow module again

by PBSL John -

Fixed it and pushed to the repo. Thanks for your input smile

In reply to PBSL John

Re: Slideshow module again

by Michael Veit -

"The thumbnails in the caption page will be displayed only if the file is really ending with the extension jpg.

I haven't been able to reproduce this, .png and .jpg files both show the thumbnail on the caption editing page for me."

 

Once again, the thumbnails in the caption page don't appear, because it is set generally the file extension ".jpg". Also is displayed the filename always with the filename extension ".jpg, regardless of which it is actually. This is the case on my local system as well as on the test server. Until now, I don't found the cause.

In reply to Michael Veit

Re: Slideshow module again

by PBSL John -

You might be running an outdated version; I fixed this a few revisions ago and it's currently working for me with png images (see attached image). Here is the latest version.

Attachment caption thumbnails showing.png
In reply to Michael Veit

Re: Slideshow module again

by Michael Veit -

In another slideshow it is always the extension ".PNG". There are images with this extension but not all. The images have different extensions. The position of the image (postion 1, 2, 3, ...) with the displayed extension is different, not always the same.

In reply to Michael Veit

Re: Slideshow module again

by PBSL John -

Do you mean that the images with different extension aren't displaying? Were they displayed in previous versions (Paul Vaughan or James Barrett's)? I think the module expects all images to be the same format, allowing multiple formats might be quite a big change; I'll have a look tomorrow.

In reply to PBSL John

Re: Slideshow module again

by Michael Veit -

Thumbnails/(Imagees) with different extension in the same slideshow don't be displayed in the caption page. In the slideshow modules (for moodle 1.X) from James Barrett the thumbnails in the caption page have been produced by the database information: slideshow_captions --> image and the html code ".jpg". This worked as long as only jpg file extension were accepted.

In the version for moodle 2.x there weren't thumbnails on the caption page.

If you can solve it, it would be a fine thing.

In my version I changed the database record in the table slideshow_comments in the field image. If it is a new slideshow, the filename is written with extension. If it is a old slideshow, the thumbnails in the caption page are also displayed. Wether the change is applied to the database depends on the server. Maybe it could be also a solution for you.

 

In reply to Michael Veit

Re: Slideshow module again

by PBSL John -

Regarding the centre option, what resolution is your screen? When the centred option is active what gets centred is a 960px div (slide image and comments column). If your resolution is on the lower end the div might take up the whole width of the screen, cancelling the effect.

I've made comments optional now, and the second column is only displayed if comments are enabled and/or captions are shown to the right of the image. With comments disabled and captions either off or above/below the image you should see the effect of enabling centred images.

In reply to PBSL John

Re: Slideshow module again

by Michael Veit -

OK. If the setting "Centred?" works (slideshow admin setting) depends on wether comments are allowed or not:

If the standard page "view.php" is displayed:

  • allowed --> no function --> always left
  • not allowed --> function --> centred (default) or left

But the comments are always above on the standard page (view.php) and then would be nice if the images are displayed also centred (and the comments also).

In reply to Michael Veit

Re: Slideshow module again

by PBSL John -

I think this may have to do with your screen's resolution (what resolution do you have?). If comments are enabled the whole section is probably too wide to notice whether it is centred or not. I can't think of any elegant alternative other than allowing comments to be disabled. That makes the section narrower, which makes it clear when it is centred. See the attached image: the top is the result with centerd disabled, the bottom is the result with centred enabled on a 1600x900 screen.

If this is not how it's being displayed on your Moodle installation, you may not be running the latest version, see my last post for the link.

Attachment centredfalsetruesmall.png