rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: Foggy on December 06, 2007, 10:15:48 AM

Title: Uploaded by
Post by: Foggy on December 06, 2007, 10:15:48 AM
Would it be possible to have a symbol %uploaded-by% that translates to the name of the user who uploaded it. I know that this wouldn't be possible until HFS3 because of real folders, but in the mean time would it be possible to have an option to automatically add a comment that says "uploaded by..." because comments work both with real folders and virtual folders.
Title: Re: Uploaded by
Post by: Mars on December 06, 2007, 11:11:34 AM
I, I shall look who makes what in the log ;D ;D ;)

More it would reveal which login is used for a specific resource.

Without wanting to discourage you the slightest of the world for this proposition. On the other hand, if it is for an internal usage it would be more sensible to write a log of success uploads in a file to part, it I think that it is possible more easily in first time.
And having Uploads message, you can choose what as information to put in this log file.

after you can  create section

[history]

{{load| uploads.log}}

and talk it by ~history
Title: Re: Uploaded by
Post by: Foggy on December 07, 2007, 08:15:40 AM
I think I understand what you are saying mars and that is a good idea about logging successful uploads but what I was trying to say was have a symbol %uploaded-by% that you can use in [file] and [folder] that would translate to the name of who uploaded it.

for example
Name: %item-name% Uploaded By: %uploaded-by%
which could translate to
Name: archive.zip Uploaded By: Foggy
Title: Re: Uploaded by
Post by: bacter on December 07, 2007, 11:08:56 AM
I think %uploaded-by% would be too special.

In theory, it could be interesting to input comments when uploading files (example comments: for foggy 'uploaded by Auser', but also 'to use this program you need to install Something' ..)

But there will be some small big-problem:
The folders where you upload, have to be real folders, and there is no way to add comments for real objects to the vfs. So comments for real objects should be in a second file, something like uploaded.file.comment. So the first step would be to write such a comment-file on the users disk to be able to upload it. As with html & javascript there is no straight way to write a file to disk, the user must execute some program to create a comment.file. And that is from my potnt of view to complicated for normal users, so we have to wait at least for HFS3 with php.

But perhaps we could do something meanwhile: there are some interesting tasks that could be done on serverside with an external program, that will take his input from logged events. Such external programs are very easy to write as they don't need to use anything from hfs source. If it's fully external, the only thing such a program has to do, is to read the logfile when a new event is added, parse the log-line to separate the values, then with simple functions you can do what you need:
- ban users that try to login more than n times in m minutes without success
- write a foggy upload comment
- move uploaded files from an upload folder to another folder (if you want that users don't see new uploaded files after n seconds)
- create an account and send a confirmation to the user
- create thumbnails for new image files
- create or delete (real) folders IN a real folder.
- delete files
- .. etc
I haven't already tested it, but it seems that the only thing needed to let hfs know that we change something in the .ini file (bans, accounts) is to use the hfs -a option.
If we do something like that we could surely ask rejetto to add two things to hfs to make it even simpler: Add a command line option -r (reload .ini) and 'use external enhancement: filename' in the options menu, that would invoke the external program with every new logline as commandline parameter.

There is in my plans to write such an extension starting end of january. I would probably do it in C, but I'm also considering to refresh my pascal/modula and use delphi, perhaps knowing what languages are known withhin posters that would uses such an artifact.




Title: Re: Uploaded by
Post by: Foggy on December 07, 2007, 01:36:05 PM
What you suggest bacter is good, and I understand what you are saying but wouldnt hfs be able to create the uploaded.file.comment file quite easily. I know its quite a bad work around until HFS3 but it would get the job done, and I cant see any downside to it because if someone uploaded a file it would say who uploaded it and if the hfs administrator wants to then add a comment they can.

Thinking about comments and the such, I had the though of why not have a text field on the upload page that will upload a comment to hfs with the file, and hfs then create the comment file. I know you could manually upload a comment file but that could be abused and someone could upload a comment overwriting an old comment or adding an unneeded comment. At least this way no one can abuse the comments and people can still add comments for the files they upload.

If the idea of the text field for comments happens you could easily write some javascript that appends uploaded by to the end of the text field so the other idea isn't necessary.
Title: Re: Uploaded by
Post by: .:ʕΘЯgAnʔ:.™ on December 07, 2007, 04:52:44 PM
Thats a good idea

If someone uploaded something that was not cool at all aka illegal or just nasty
you know who to ban  ;)
Title: Re: Uploaded by
Post by: bacter on December 07, 2007, 05:28:36 PM
Foggy:

The automatic 'uploaded-by-user' filename.ext.comment probably could be done in hfs without much progrramming effort, but it would require one menu other options option more that allows doing it or not.

About adding some comment with javascript like adding ?comment="whatever you want to add" when uploading a file, i have no idea if this can be done with the html-upload-request. If this were possible, then we could have the textfield in the upload form.

.. Organ ??:

To know who uploaded a file you dont need any comment, just log to file! There you can have registered when who did do what.
Title: Re: Uploaded by
Post by: rejetto on December 08, 2007, 05:02:33 AM
i think that this can already be done in the last beta by using {{append}} but i still have to check.
you should add a line after [upload-success] like
{{append|PATH%item-name%.comment|uploaded by %user%}}

the point is the PATH thing. It is the real folder path on disk. Maybe this is not available yet. If not, i will add it.
Please, experiment ;)
Title: Re: Uploaded by
Post by: Foggy on December 08, 2007, 06:05:14 AM
Ill have a try and see how it turns out, the macros save the day again :P
Title: Re: Uploaded by
Post by: Guest on December 10, 2007, 06:02:25 PM
{{append|PATH%item-name%.comment|uploaded by %user%}}
Works great here !
Title: Re: Uploaded by
Post by: Mars on December 10, 2007, 06:10:23 PM
 
Quote
The automatic 'uploaded-by-user' filename.ext.comment probably could be done in hfs without much progrramming effort,

three possibility to see if a file is added in hfs list

- one user make an upload into a folder :  {{append|PATH%item-name%.comment|uploaded by %user%}}


- administrator add a folder or file in the hfs tree  : hfs can detect this

- look at the notification when a real folder is modified : there is delphi code for that ( i think possibility to detect if file is new)
Title: Re: Uploaded by
Post by: rejetto on December 11, 2007, 01:21:36 AM
three possibility to see if a file is added in hfs list

it seems like this is not related to the topic
Title: Re: Uploaded by
Post by: Matte on December 16, 2007, 03:42:35 PM
{{append|PATH%item-name%.comment|uploaded by %user%}}
Works great here !
Could you please explain how did you do it?
Should I see a comment under the uploaded file?

I've added the precise line right under [upload-success] but I don't see anything...
Title: Re: Uploaded by
Post by: Guest on December 16, 2007, 04:59:10 PM
It works with HFS build 163. Not sure how far back it goes.
{{append|C:\your upload folder\%item-name%.comment|Uploaded By %user%}}
This creates a .comment file in the folder which shows comment with the uploaded
file. There cannot be a space between "folder\ %item-name%" or it wont work.
Title: Re: Uploaded by
Post by: rejetto on December 17, 2007, 04:23:30 PM
next beta will automatically log the user in comments,
so just wait for it :)