Advanced search  

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]

Pages: [1]   Go Down

Author Topic: User Select Slideshow Speeds - Drop Down Menu cpg 1.4.x - Mod  (Read 12474 times)

0 Members and 1 Guest are viewing this topic.

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum

Installed Coppermine about a week ago (just upgraded to cpg 1.4 8 ). After much editing and checking out of the scripts, I'm almost ready to put cpg into production mode. The one thing I noticed was there was no choice for users for the speed of the slide show. After some editing I came up with a relatively simple mod. Feel free to try it out and if the moderators find it useful, please move it to the appropiate section.

User Select Slideshow Speeds - Drop Down Menu
mod by wirewolf - http://academyphotos.net/
See example - http://academyphotos.net/photogallery/displayimage-425-Ships'-Compass-Binnacle.html

Used in Coppermine Version cpg 1.4.8 (also worked in cpg 1.4.7) Classic Theme (should work in others)
Works in IE and Firefox (not tested with Opera)

The javascript code for the drop down is borrowed from a mod by Dr Preacox:
http://forum.coppermine-gallery.net/index.php?topic=32108.0

As always, BACKUP, BACKUP, BACKUP! your existing file just in case.

File to edit (1):
In themes/<YOUR_THEME>/theme.php:

Find in - // HTML template for the image navigation bar - (approx line 612):
Code: [Select]
<td align="center" valign="middle" class="navmenu" width="48px">
<a href="{SLIDESHOW_TGT}" class="navmenu_pic" title="{SLIDESHOW_TITLE}">
<img src="{LOCATION}images/slideshow.gif" border="0px" align="middle" alt="{SLIDESHOW_TITLE}" /></a>
</td>

Replace with:
Code: [Select]
<td align="center" valign="middle" class="navmenu" nowrap="nowrap">
  <script language="javascript" type="text/javascript">
function Go() {
if (document.slide.slidespeed[document.slide.slidespeed.selectedIndex].value != "") {
location = document.slide.slidespeed[document.slide.slidespeed.selectedIndex].value
}
}//-->
</script>
<form name="slide" style="margin: 0">
    <select name="slidespeed">
    <option value=''>Slideshow Speed</option>
    <option value="{SLIDESHOW_TGT}">-&gt; 3 Seconds</option>
    <option value="{SLIDESHOW_TGT2}">-&gt; 5 Seconds</option>
    <option value="{SLIDESHOW_TGT3}">-&gt; 7 Seconds</option>
    <option value="{SLIDESHOW_TGT4}">-&gt; 10 Seconds</option></select>
<input title="Users with slower connections may want to select 7 to 10 second speeds" class="button" onclick="Go()" type="button" value="Go!" />
</form>
</td>
--------------------------
Find in - function theme_html_img_nav_menu() - (approx line 2142):
Code: [Select]
$slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=".$CONFIG['slideshow_interval'];
Replace with (Note: I choose to hard code in the timing values. I think this range will suit most users (3 seconds to 10 seconds).
Of course you can select whatever times you wish. If you want to add more choices, be sure to edit all of the appropiate lines.
Example - $slideshow_tgt5 in three places, etc):
Code: [Select]
$slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=3000";
$slideshow_tgt2 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=5000";
$slideshow_tgt3 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=7000";
$slideshow_tgt4 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=10000";

Optional replace - (Note: you can leave in the one line if you want - slideshow=".$CONFIG['slideshow_interval']
- this can be your base speed selection as in the - Slideshow interval in milliseconds (1 second = 1000 milliseconds)
under the Admin panel for "Image view":
Code: [Select]
$slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=".$CONFIG['slideshow_interval'];
$slideshow_tgt2 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=5000";
$slideshow_tgt3 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=7000";
$slideshow_tgt4 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=10000";
--------------------------
Find in - $params = array('{THUMB_TGT}' => $thumb_tgt, - (approx line 2155):
Code: [Select]
'{SLIDESHOW_TGT}' => $slideshow_tgt,
Replace with:
Code: [Select]
'{SLIDESHOW_TGT}' => $slideshow_tgt,
'{SLIDESHOW_TGT2}' => $slideshow_tgt2,
'{SLIDESHOW_TGT3}' => $slideshow_tgt3,
'{SLIDESHOW_TGT4}' => $slideshow_tgt4,

Note: If you visit the example page you'll see that I am running the "sef_urls" (mod rewrite) and the "minicms" (by donnoman) plugins.
This "Drop Down Menu" edit works with or without these plugins (at least it did for me).

Hope you find this mod useful,
John
« Last Edit: August 26, 2006, 07:42:08 am by GauGau »
Logged

meisdug

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 3
    • my personal homepage
Re: User Select Slideshow Speeds - Drop Down Menu cpg 1.4.x - Mod
« Reply #1 on: June 24, 2008, 05:28:47 am »

Great mod, thanks John.  I just added this mod to my gallery and it works great (cpg 1.4.18).  I wanted to mention, though, that the code to edit has moved to include/themes.inc.php instead of themes/<YOUR_THEME>/theme.php.  It took me a few minutes to figure that out and find it and I just wanted to pass that along for the next guy.

--Doug
Logged
Pages: [1]   Go Up
 

Page created in 0.077 seconds with 20 queries.