rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: HFS-Lover on September 08, 2009, 07:32:09 PM

Title: How to use a macro ??
Post by: HFS-Lover on September 08, 2009, 07:32:09 PM
hello guys , i m just stuck with even scripts and macro


recenlty i requested

How to delete data permanently instead of sending them into recylce bin  
rejetto.com/forum/index.php?topic=7471.0

then rejetto added it in Testing build #246

+ {.delete|bin=XXX.}

but now i dont know how to use it ??


where to add this ?? , how to add this ?? , how to use it ?? , any steps ?? ,

what to do with it ??

plz tell me there is lots of possibilities in HFS , but i dont understand with these things

Thanks alot
Title: Re: How to use a macro ??
Post by: kaler on September 09, 2009, 03:03:33 PM
lol...

this marco you need, when you want to delet a file permenantly and not to copy t into the bin...
where you must add it:

you must add it whn you want to delet a file, the you write down the macro {.delet|filename|bin=XXX.}
then your file is delete forever...

Title: Re: How to use a macro ??
Post by: KooolaNL on September 09, 2009, 04:16:34 PM
hey kaler can u pm me on how u made a shoutbox plz



Greetz from Netherlands (i live 5mins from germany :P)
Title: Re: How to use a macro ??
Post by: Caco on September 10, 2009, 09:50:39 AM
Hi HFS-lover,

first of all you need to use a template. Install a template you like in your HFS, eg. RAWR template. The template is a text file that contains all the code to manage HFS web interface. Is in text format, you can modify the macros there if you understand the code behind.

If you don't want to modify the template you can use HFS events. Create a text file, name it hfs.events and put it into HFS root directory.

Every time HFS will run a specified macro, it will check in that file for a related action.

Here's an example:

[+file deleted]
{.delete|crap.txt.}

So each time HFS deletes a file, after that ([+file deleted]), it invokes macro {.delete.} which deletes the file named crap.txt in the root directory of HFS.

For complete list of events, see HFS wiki.
Title: Re: How to use a macro ??
Post by: HFS-lover on September 10, 2009, 10:53:08 AM
Thanks guys , after all i got some idea

i m using default template , now can you paste or upload the working default template with this delete working macro ?

or just tell me the code where to edit what to edit , paste here small piece of code where i have to modify the code

thanks
Title: Re: How to use a macro ??
Post by: Caco on September 10, 2009, 12:02:57 PM
"default template" is included in HFS.exe so you can't edit it. Neither you can use HFS events. You have to install a template.

Whit this:

http://www.rejetto.com/forum/index.php?action=dlattach;topic=7273.0;attach=4329

i know how to do it  ;D
Title: Re: How to use a macro ??
Post by: Caco on September 10, 2009, 12:12:22 PM
Read also the related topic to get more info  ;)

http://www.rejetto.com/forum/index.php?topic=7273.0
Title: Re: How to use a macro ??
Post by: HFS-lover on September 10, 2009, 11:53:44 PM
okay guys i got the template live 3 full and with that modification of delete ,


now please can u tell me where to edit the code for this macro ,

i know xhtml , css , little C Functions , some of php and XML 

but i m very confused with this

i tried to change the code in NewLive3-FULL.tpl file from line 95 to 101 , see below
 
Code: [Select]

{.delete|bin=0%|%folder-resource%\{.urlvar|fldname.}.}
:}/if.}
{.if|{.and| {.get|can delete.} | {.urlvar|createroot.} .}|{:
{.{.add folder.}|%folder-resource%\{.urlvar|fldname.}.}
:}/if.}
{.if|{.and| {.get|can delete.} | {.urlvar|deleteroot.} .}|{:
{.delete|bin=0%|folder-resource%\{.urlvar|fldname.}.}


i guess i m hitting  at right place ??? , but may be syntax is wrong or i m completely wrong


 just show me the right way to do it , please paste the working code

Thanks alot , i m still learning how to do this
Title: Re: How to use a macro ??
Post by: kaler on September 11, 2009, 05:50:05 AM
okay moment...

here is my code:

[special:begin]
{.if|{.and| {.get|can upload.} | {.urlvar|createfolder.} .}|{:
{.mkdir|%folder-resource%\{.urlvar|fldname.}.}
:}/if.}
{.if|{.and| {.get|can upload.} | {.urlvar|deletefolder.} .}|{:
{.delete|%folder-resource%\{.urlvar|fldname.}.}
:}/if.}
{.if|{.and| {.get|can delete.} | {.urlvar|createroot.} .}|{:
{.{.add folder.}|%folder-resource%\{.urlvar|fldname.}.}
:}/if.}
{.if|{.and| {.get|can delete.} | {.urlvar|deleteroot.} .}|{:
{.delete|%folder-resource%\{.urlvar|fldname.}.}
:}/if.}
{.if|{.and| {.get|can upload.} | {.urlvar|renamefile.} .}|{:
{.rename|%folder-resource%\{.urlvar|oldname.}|%folder-resource%\{.urlvar|newname.}.}
:}/if.}


and in the main Page:


<table>
<tr>
<td>
<b>Creating folders:</b>
{.if|{.get|can delete.}
      |<form method='get'>
      <input class="toolsinput" type='text' alt="File/Folder Name" name='fldname' maxlength="100"
      size="23" value="{.!File/Folder Name.}" onclick="if(this.value=='{.!File/Folder Name.}')            this.value=''"/><input class="toolsbutton" type='submit' name='createfolder' value='OK' ></form>.}
</td>
<td>
<b>Delete Folder:</b>

{.if|{.get|can delete.}|
      <form method='get'>
      <input class="toolsinput" type='text' alt="Type File/Folder Name" name='fldname' maxlength="100"       size="23" value="{.!File/Folder Name.}" onclick="if(this.value=='{.!File/Folder Name.}')               this.value=''"/><input class="toolsbutton" type='submit' name='deletefolder' value='OK' ></form>.}
</td>
<td>
<b>Rename File:</b>
{.if|{.get|can delete.}|
      <form method='get'>
      <input class="toolsinput" type='text' name='oldname' maxlength="50" size="18" value="Old Name.."       onclick="if(this.value=='Old Name..')this.value=''"/>
      <input class="toolsinput" type='text' name='newname' maxlength="50" size="18" value="New Name.."       onclick="if(this.value=='New Name..')this.value=''"/>
      <input type='submit' name='renamefile' value='ok' class="toolsbutton">
</form>
.}
</td>
</tr>
</table>

the table you don't need, but you know this

I hope that works to you too ???
Title: Re: How to use a macro ??
Post by: HFS-lover on September 11, 2009, 02:00:38 PM
is that works with deleting the file or folder permanently not to the recycle bin ??


Title: Re: How to use a macro ??
Post by: kaler on September 11, 2009, 04:04:40 PM
with my method it will be delet into the bin....
Title: Re: How to use a macro ??
Post by: HFS-lover on September 11, 2009, 04:25:19 PM
this option is already there , i want to delete permanently guys :)
Title: Re: How to use a macro ??
Post by: Mars on September 11, 2009, 07:37:38 PM
{.if|{.and| {.get|can delete.} | {.urlvar|deleteroot.} .}|{:
{.delete|%folder-resource%\{.urlvar|fldname.}|bin=0.}
this option is already there , i want to delete permanently guys

read the what's new of beta version  :-\
Title: Re: How to use a macro ??
Post by: HFS-lover on September 12, 2009, 02:02:56 PM
i understand where to add this bin=0 , but it still fails to delete file permanently


can anyone provide me the working template or code , where it works for you ??

thanks alot , now i m bit frustrated with this now  >:(

Title: Re: How to use a macro ??
Post by: rejetto on September 13, 2009, 09:33:46 AM
sorry for the late reply, i will try to repay with a complete answer. ;)

i think there is a sort of confusion around this.
it is not clear WHEN you want to delete.
There are at least 2 very different moments:

- when HFS deletes files by the standard "delete" feature, the one you find in the default template, with "delete" permissions set

- when the template or any script deletes a file through the {.delete.} macro

In this latter case you must only find where the {.delete.} macro is, and add the bin=0 before the closing .}

Instead, there's no way to change the first case at the moment.
But I can easily see how this may interest users, and have in mind more than a solution. One is tricky, the other is easy*.

I would go for the tricky way, and IF the non-techie users will actually use it, then i'll introduce the simpler way. I may introduce it even from next release.

Indeed, i would like to simplify the installation of scripts, so to get both power and easiness with the same tool. But this will take some time.

[+file deleted]
{.delete|crap.txt.}

nice try Caco ;) but as the event name says, the file is already deleted, and trying to deleting again won't help. (Just guessing, i didn't test)


* The easy one is based on having an options, in the menu, that simply changes this behaviour from "recycling" to permanent. Very simple, but you can't do nothing more than this.
The tricky one is based on having an event [file deleting] so that you can act on it before the deletion is performed internally. At this time you can decide to permanently delete it, or move it to a drive, or compress it! This solution is powerful but suitable only to techies.
Title: Re: How to use a macro ??
Post by: HFS-lover on September 13, 2009, 12:47:20 PM
Thanks rejetto

you are completely right

we are using the second case here , cuz we know that personal features cant be added into HFS ( u said that ) , it must be done with scripts
well you can add it to interface if you dont mind


i added bin=0 in Live-3.0.0 template , but it just doesn't work 

i just attached the template i m using now , i edited NewLive3-FULL.tpl file


check it , make it work and please upload it again for me , or just tell me where to edit the code , i just want a working template to delete files permanently


thanks alot bro
Title: Re: How to use a macro ??
Post by: rejetto on September 21, 2009, 07:40:51 AM
Sorry for the late reply.
The template you attached has serious problems.
It has a doubled deletion system, that's very confusing.

By clicking the gray "delete" button, you are using the standard system, and no macro will be used.
By clicking the red X, you are using a user scripted system, that's actually bugged. Consider these lines

{.if|{.and| {.get|can delete.} | {.urlvar|deleteroot.} .}|{:
{.delete|%folder-resource%\{.urlvar|fldname.}|bin=0.}
:}/if.}

it's checking for delete permission (ok), and then for the variable "deleteroot", that doesn't exist, because it's "fldname" that was named just after.
Title: Re: How to use a macro ??
Post by: rejetto on September 21, 2009, 09:05:58 AM
from next release you will be able to just add this event script

[+file deleting]
{.delete|%item-deleting%|bin=0.}


it will work with any template using the standard deletion method.
Title: Re: How to use a macro ??
Post by: HFS-lover on September 22, 2009, 02:47:27 AM
Thanks rejetto , i really like that , i just use default template , simple and best

Waiting for next release :D

Thanks alot , i really appreciate your efforts

 
Title: Re: How to use a macro ??
Post by: rejetto on September 24, 2009, 10:09:35 AM
it may take a while until i publish a new version.
since you need this feature so badly, and it may take several days before i publish next release, here is a #246 including the feature
http://www.sendspace.com/file/3aw554
Title: Re: How to use a macro ??
Post by: HFS-lover on September 28, 2009, 06:22:18 PM
 ;D ;D ;D ;D it works fine  :o , now i can take control of my server easily :D to remove the junk from browser

Thanks alot