sort chronologically by Default

Need some help with the script?

sort chronologically by Default

Postby samiro » Wed Dec 16, 2009 10:36 pm

how can i do that the image manager will sort the images chronologically by Default - So I do not have to click on it every time

Thank you :D
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby samiro » Mon Dec 21, 2009 2:54 pm

please help...


* this shuld be easy
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby eberswine » Tue Dec 22, 2009 1:58 am

Ok, here is a quick fix --

I'm sure there are a few different ways to do it:

but if you click the little IMG icon on the editor, then this will help you.

If you want it to sort chronological after you upload, then you can look in the images.mdu and play around with that area until you figure it out!

here is the little hack for the first one:
in functions.inc.php find:
Code: Select all
<a href=\"#\" onclick=\"window.open('$PHP_SELF?mod=images&area=$insert_location', '_Addimage', 'height=450,resizable=yes,scrollbars=yes,width=500');return false;\" target=\"_Addimage\"><img src=".$config_http_script_dir."/skins/images/tags/img.gif border=0 align=middle></a>


and change it to:
Code: Select all
<a href=\"#\" onclick=\"window.open('$PHP_SELF?mod=images&area=$insert_location&sortby=time&start_from=&subfolder=&align=', '_Addimage', 'height=450,resizable=yes,scrollbars=yes,width=500');return false;\" target=\"_Addimage\"><img src=".$config_http_script_dir."/skins/images/tags/img.gif border=0 align=middle></a>


Let us know if this is what you are looking for?
User avatar
eberswine
 
Posts: 281
Joined: Thu Apr 26, 2007 7:23 pm

Postby samiro » Tue Dec 22, 2009 7:20 am

no - its not working...
i think i need to change somthing in inc/mod/images.mdu
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL

Postby DarkSlim » Wed Jan 06, 2010 2:15 pm

samiro wrote:no - its not working...
i think i need to change somthing in inc/mod/images.mdu


Hi, ma kore? :)

Well, open inc/mod/images.mdu

Find:
Code: Select all
<tr><td><?=(($_GET['sortby'] == "time") ? "<a href='".$config_http_script_dir."/index.php?mod=images&area=".$_GET['area']."&sortby=name&start_from=".$_GET['start_from']."&subfolder=".($_POST['subfolder'] ? $_POST['subfolder'] : $_GET['subfolder']).($area ? '&amp;align='.$_GET['align'] : '')."'>".$echo['sortbyName']."</a>" : "<a href='".$config_http_script_dir."/index.php?mod=images&area=".$_GET['area']."&sortby=time&start_from=".$_GET['start_from']."&subfolder=".($_POST['subfolder'] ? $_POST['subfolder'] : $_GET['subfolder']).($area ? '&amp;align='.$_GET['align'] : '')."'>".$echo['sortbyTime']."</a>"); ?></td>
</tr>


Replace With:
Code: Select all
<tr><td><?=((($_GET['sortby'] == "time") || ($_GET['sortby'] == "")) ? "<a href='".$config_http_script_dir."/index.php?mod=images&area=".$_GET['area']."&sortby=name&start_from=".$_GET['start_from']."&subfolder=".($_POST['subfolder'] ? $_POST['subfolder'] : $_GET['subfolder']).($area ? '&amp;align='.$_GET['align'] : '')."'>".$echo['sortbyName']."</a>" : "<a href='".$config_http_script_dir."/index.php?mod=images&area=".$_GET['area']."&sortby=time&start_from=".$_GET['start_from']."&subfolder=".($_POST['subfolder'] ? $_POST['subfolder'] : $_GET['subfolder']).($area ? '&amp;align='.$_GET['align'] : '')."'>".$echo['sortbyTime']."</a>"); ?></td>
</tr>


Then, I havn't checked yet (so if it's not working tell me and I'll check)
Find:
Code: Select all
if (count($files)){
(($_GET['sortby'] == "time") ? arsort($files) : ksort($files));

foreach ($files as $file => $time){
$all_images += filesize($folder.'/'.$file);
}


Replace with:
Code: Select all
if (count($files)){
((($_GET['sortby'] == "time") || ($_GET['sortby'] == "")) ? arsort($files) : ksort($files));

foreach ($files as $file => $time){
$all_images += filesize($folder.'/'.$file);
}


Hope it helps,

DarkSlim
User avatar
DarkSlim
 
Posts: 296
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby eberswine » Tue Jan 12, 2010 8:31 pm

Great stuff DARK!

Both of them together work, but the top one won't work unless you do the bottom hack as well.

I am thinking this should be a DEFAULT in the new build of the CMS!

Because, if you upload something, why would you want to sort through it alphabetically rather than chronologically???
(most people would want to get the picture they uploaded right away!!!!)

I like this way better having the chronological be the default and if we want, then click on the sort by alphabetical

__ thoughts ???
User avatar
eberswine
 
Posts: 281
Joined: Thu Apr 26, 2007 7:23 pm

Postby DarkSlim » Thu Jan 14, 2010 10:10 am

eberswine wrote:Great stuff DARK!

Both of them together work, but the top one won't work unless you do the bottom hack as well.

I am thinking this should be a DEFAULT in the new build of the CMS!

Because, if you upload something, why would you want to sort through it alphabetically rather than chronologically???
(most people would want to get the picture they uploaded right away!!!!)

I like this way better having the chronological be the default and if we want, then click on the sort by alphabetical

__ thoughts ???


No prob :)
Well, I guess you are right that most people would want it
that way, we can implement it too in our community version :D
User avatar
DarkSlim
 
Posts: 296
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Postby samiro » Sun Mar 07, 2010 7:59 am

thank you all
מעוללללללההה
User avatar
samiro
 
Posts: 103
Joined: Sun Apr 20, 2008 1:52 pm
Location: IL


Return to Help



Who is online

Users browsing this forum: No registered users and 2 guests

cron