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: Drop Down Menu for Sorting Order Mod  (Read 16517 times)

0 Members and 1 Guest are viewing this topic.

jeepguy_1980

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 94
    • Loop Family Forum & Gallery
Drop Down Menu for Sorting Order Mod
« on: March 23, 2009, 04:49:00 am »

I wanted to make it so that the menu would automatically display the sorting order being used. However, that was a bit over my head. So here is my mod as it exists now.

This mod will replace the sort order menu with a drop down menu.  I designed it for the themes where the sort order menu runs past the table detracting from the otherwise nice theme.

i.e. changes from Attachment1 to Attachment2 and Attachment 3

To make this change, open theme.php

Find the following function:
Code: [Select]
$template_thumb_view_title_row = <<<EOT
Replace the entire function with the following:
Code: [Select]
// HTML template for title row of the thumbnail view (album title + sort options)
if (!isset($template_thumb_view_title_row)) { //{THEMES}
$template_thumb_view_title_row = <<<EOT

                        <table width="100%" cellpadding="4" cellspacing="0">
                        <tr>
                                <td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
                                <td><img src="images/spacer.gif" width="1" alt="" /></td>
                                <td class="sortorder_cell">
<form name="sort">
<select name="sortbox" OnChange="location.href=sort.sortbox.options[selectedIndex].value">
<option>Sorting Order</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=ta">{TITLE} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=td">{TITLE} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=na">{NAME} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=nd">{NAME} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=da">{DATE} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=dd">{DATE} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pa">{POSITION} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pd">{POSITION} -</option>
</select>
</form>
                                </td>
                        </tr>
                        </table>

EOT;
}  //{THEMES}

Depending on your theme, you may need to adjust your theme's style.css ".sortorder_cell" padding to make it line up better.
« Last Edit: March 23, 2009, 05:13:50 pm by jeepguy_1980 »
Logged

Heroe

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 124
    • abroadbg.com
Re: Drop Down Menu for Sorting Order Mod
« Reply #1 on: December 15, 2009, 11:33:56 am »

Hi jeepguy_1980 ,
Thank for the nice mod, but for me the mod seems dont work on my theme ;( the box appear but doesn't change the sort order.

I copy and paste the function from yr post in my theme:

Code: [Select]
// HTML template for title row of the thumbnail view (album title + sort options)
if (!isset($template_thumb_view_title_row)) { //{THEMES}
$template_thumb_view_title_row = <<<EOT

                        <table width="100%" cellpadding="4" cellspacing="0">
                        <tr>
                                <td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
                                <td><img src="images/spacer.gif" width="1" alt="" /></td>
                                <td class="sortorder_cell">
<form name="sort">
<select name="sortbox" OnChange="location.href=sort.sortbox.options[selectedIndex].value">
<option>Sorting Order</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=ta">{TITLE} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=td">{TITLE} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=na">{NAME} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=nd">{NAME} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=da">{DATE} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=dd">{DATE} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pa">{POSITION} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pd">{POSITION} -</option>
</select>
</form>
                                </td>
                        </tr>
                        </table>

EOT;
}  //{THEMES}


My theme.php is attached if u can have a look.

Here is the gallery link:

CPG Version :1.4.24
www.abroadbg.com
username: test
password:123654
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Drop Down Menu for Sorting Order Mod
« Reply #2 on: December 15, 2009, 12:03:06 pm »

Find the following function:
Code: [Select]
$template_thumb_view_title_row = <<<EOT
That's not a function, but merely a variable getting populated.

Replace the entire function with the following:
Code: [Select]
// HTML template for title row of the thumbnail view (album title + sort options)
if (!isset($template_thumb_view_title_row)) { //{THEMES}
$template_thumb_view_title_row = <<<EOT

                        <table width="100%" cellpadding="4" cellspacing="0">
                        <tr>
                                <td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
                                <td><img src="images/spacer.gif" width="1" alt="" /></td>
                                <td class="sortorder_cell">
<form name="sort">
<select name="sortbox" OnChange="location.href=sort.sortbox.options[selectedIndex].value">
<option>Sorting Order</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=ta">{TITLE} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=td">{TITLE} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=na">{NAME} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=nd">{NAME} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=da">{DATE} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=dd">{DATE} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pa">{POSITION} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pd">{POSITION} -</option>
</select>
</form>
                                </td>
                        </tr>
                        </table>

EOT;
}  //{THEMES}
No, don't do that - that's silly. Actually, the instructions need to be as following:

Edit themes/yourtheme/theme.php with a plain text editor. Find
Code: [Select]
$template_thumb_view_title_row = <<<EOTand edit as suggested below. If that section doesn't exist in your custom theme, copy
Code: [Select]
// HTML template for title row of the thumbnail view (album title + sort options)
$template_thumb_view_title_row = <<<EOT

                        <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td width="100%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
                                <td><img src="images/spacer.gif" width="1" alt="" /></td>
                                <td class="sortorder_cell">
                                        <table cellpadding="0" cellspacing="0">
                                        <tr>
                                                <td class="sortorder_options">{TITLE}</td>
                                                <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=ta" title="{SORT_TA}">&nbsp;+&nbsp;</a></span></td>
                                                <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=td" title="{SORT_TD}">&nbsp;-&nbsp;</a></span></td>
                                        </tr>
                                        <tr>
                                                <td class="sortorder_options">{NAME}</td>
                                                <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=na" title="{SORT_NA}">&nbsp;+&nbsp;</a></span></td>
                                                <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=nd" title="{SORT_ND}">&nbsp;-&nbsp;</a></span></td>
                                        </tr>
                                        <tr>
                                                <td class="sortorder_options">{DATE}</td>
                                                <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=da" title="{SORT_DA}">&nbsp;+&nbsp;</a></span></td>
                                                <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=dd" title="{SORT_DD}">&nbsp;-&nbsp;</a></span></td>
                                        </tr>
                                        <tr>
                                                <td class="sortorder_options">{POSITION}</td>
                                                <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pa" title="{SORT_PA}">&nbsp;+&nbsp;</a></span></td>
                                                <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pd" title="{SORT_PD}">&nbsp;-&nbsp;</a></span></td>
                                        </tr>
                                        </table>
                                </td>
                        </tr>
                        </table>

EOT;
from themes/sample/theme.php into a new line before
Code: [Select]
?>of the file themes/yourtheme/theme.php

Then replace your definition of $template_thumb_view_title_row  with the following code:
Code: [Select]
$template_thumb_view_title_row = <<<EOT

                        <form name="sort" action="{$_SERVER['REQUEST_URI']}" method="get">
<table width="100%" cellpadding="4" cellspacing="0">
<tr>
<td width="100%" class="statlink">
<h2>{ALBUM_NAME}</h2>
</td>
<td>
<img src="images/spacer.gif" width="1" alt="" />
</td>
<td class="sortorder_cell">
<select name="sortbox" OnChange="location.href=sort.sortbox.options[selectedIndex].value">
<option>Sorting Order</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=ta">{TITLE} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=td">{TITLE} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=na">{NAME} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=nd">{NAME} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=da">{DATE} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=dd">{DATE} -</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pa">{POSITION} +</option>
<option value="thumbnails.php?album={AID}&amp;page={PAGE}&amp;sort=pd">{POSITION} -</option>
</select>
</td>
</tr>
</table>
</form>

EOT;

@jeepguy_1980: never copy stuff from include/themes.inc.php! Always copy stuff from themes/sample/theme.php instead!
« Last Edit: December 15, 2009, 12:54:26 pm by Joachim Müller »
Logged

Heroe

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 124
    • abroadbg.com
Re: Drop Down Menu for Sorting Order Mod
« Reply #3 on: December 15, 2009, 01:58:30 pm »

Joachim Müller

Don't understand what im doing wrong, nothing don't change after yr instructions. I did all u wrote in yr last post  ???

I attached again my theme.php

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Drop Down Menu for Sorting Order Mod
« Reply #4 on: December 16, 2009, 09:48:51 am »

I have no idea what you're talking about: your site looks exactly as advertized for me (see attached screenshot). Make sure that you're not looking at a cached copy. Force-refresh your browser with [Ctrl]+[F5].
Logged

Heroe

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 124
    • abroadbg.com
Re: Drop Down Menu for Sorting Order Mod
« Reply #5 on: December 16, 2009, 02:18:20 pm »

I have no idea what you're talking about: your site looks exactly as advertized for me (see attached screenshot). Make sure that you're not looking at a cached copy. Force-refresh your browser with [Ctrl]+[F5].

I mean users and me can't change anymore the sort order from the
/thumbnails.php?album=xxx  list.

Code: [Select]
your site looks exactly as advertized for me
What u mean GauGau, i don't understand u ???
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 19 queries.