rejetto forum
May 25, 2012, 09:09:58 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: This forum is free, you do NOT need to register to post. But you may.
PROBLEMS? QUESTIONS? CLICK HERE!
Fill the survey!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Recently Uploaded Files List?  (Read 736 times)
0 Members and 2 Guests are viewing this topic.
Age
Regular poster
**
Offline Offline

Canada Canada

Posts: 17



View Profile WWW Email
« on: November 05, 2010, 12:42:45 PM »

Hello,

Long time fan of HFS here, and I try my best to learn everything I can from the wiki and the forum before posting, but I'm having trouble figuring this out.

Is there anyway to display a list of the top ten latest files that were uploaded? (I'm using Beta 271)

Any advice would be well received.

Thanks,
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #1 on: November 08, 2010, 04:43:51 PM »

sorry for the late reply.
it is possible.
anyway HFS by itself doesn't hold a list of uploaded files, you must create this list yourself.
use the [upload completed] event http://www.rejetto.com/wiki/index.php/HFS:_Event_scripts
store the name of the item in a variable or a file.
a way is to treat the list as a text, and use a line for every item.
you put the new one on top of others.
Code:
[upload completed]
{.set|#uploads|%item-name%
|mode=prepend.}

but you should also discard lines over 10th.
use {.for.} to run 10 times {.pos.} then {.cut.} the rest of the string.
This is left as homework Wink

after you got your list in memory, you use it as you like.
a plus would be to {.save.} it every time it is changed, and {.load.} it at event [start]
so it won't clear at every restart of HFS.
« Last Edit: November 08, 2010, 04:45:46 PM by rejetto » Logged
Age
Regular poster
**
Offline Offline

Canada Canada

Posts: 17



View Profile WWW Email
« Reply #2 on: November 08, 2010, 08:44:00 PM »

Alright, I'm committed to this.
So just for testing purposes, I'll use a variable because that seems like it's easier.

In my macros I put:

Code:
[upload completed]
{.set|variablerecentuploads|%item-name%
|mode=prepend.}

This should now start logging the names of uploads into a sort of list with "variablerecentuploads" for a name, and each new item is represented by $1, $2, $3, etc. as I can sort of tell from the wiki?(http://www.rejetto.com/wiki/index.php/HFS:_scripting_commands#Variables_and_functions)

Now, assuming that's correct, in order for me to display this list, I am a little confused. Should I put something like this somewhere in my template?

Code:
{{.^variablerecentuploads|$1.}}
to display the first "spot" on the list?

Then follow with:

Code:
{{.^variablerecentuploads|$2.}}
{{.^variablerecentuploads|$3.}}
{{.^variablerecentuploads|$4.}}
etc... ?

Is there something similar you could direct me to so that I could read up on this?

Thanks for your direction.

<3
Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11831


View Profile
« Reply #3 on: November 29, 2010, 09:18:55 AM »

sorry for the late reply.
nope: your variable is not an indexed table at the moment, is just a text with several lines.
you should go in the direction i told you in my previous message, but i understand it requires programming skills, most people don't have.
in next release (273) i'm introducing some changes that will ease this task a bit. A script like this will be then possible


firstly i copy the list, because we'll destroy it in the process
{.set|#x|var=#uploads.}

{.for|i|1|10|{:
  at number {.^i.} we got {.chop|#x|{.chr|13.}.}
:}
Logged
r][m
Insane poster
*****
Offline Offline

United States United States

Posts: 340


View Profile
« Reply #4 on: November 29, 2010, 12:18:27 PM »

The attached were posted here some time ago (don't remember by who).
New-files works pretty well.
The filelist.tpl is interesting, but doesn't work very well.
Maybe these will give some ideas to work from.

* new-files.txt (1.59 KB - downloaded 54 times.)
* filelist.tpl (1.26 KB - downloaded 45 times.)
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!


Google visited last this page May 20, 2012, 07:15:01 AM
anything