rejetto forum
February 12, 2012, 12:13:30 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 [2] 3
  Print  
Author Topic: SOLVED (v223):Functional request: folder creation (with upload rights)  (Read 5815 times)
0 Members and 1 Guest are viewing this topic.
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #15 on: February 06, 2009, 04:39:36 AM »

Hi found a solution, although I do not really like it.
If I used the "get" method instead of the "post" it is working !!!

Place this code in the form to have the "Create Folder" Button

Code:
<form method='get'>
{.if|{.get|can upload.}|
Folder name: <input  type='text' name='fldname' maxlength="25" size="25" >
<input  type='submit' name='createfolder' value='Create Folder' >
    /if.}
</form>


and add this code to generate the folder
Code:
[special:begin]
{.if|{.and| {.get|can upload.} | {.urlvar|createfolder.} .}|{:
{.mkdir|%folder-resource%\{.urlvar|fldname.}.}
:}/if.}

Vars in this case are visible in the address bar, but if the user is not logged in and does not have upload rights, the folder is not created, so it's not that dangerous Cheesy

But there is still an annoying bug: if you create a folder and afterwards you want to delete it, the vars are not cleaned (as "delete" uses "post" and not "get") and the folder is created again!
If you navigate somewhere else, the get is cleaned (no vars in the address bar) and you can delete the folder
« Last Edit: February 06, 2009, 05:00:42 AM by luca69 » Logged

Life is what happens to you while you are busy making other plans
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #16 on: February 07, 2009, 11:12:57 AM »

I got the same "funny" effect! It looks like the browser "remembers" the last post as the variables are not cleanup (see 3rd screenshot in the attachments)

it is not the browser.
indeed, if you check the issued request (dump) you won't see such value.
It is HFS. A bug.
Supposed to be fixed now. (next build)

thank you for reporting!
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #17 on: February 10, 2009, 04:45:40 AM »

..ok I'll wait for next release  Cool
Logged

Life is what happens to you while you are busy making other plans
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #18 on: February 12, 2009, 02:28:29 AM »

Tested with 223: now it works  Grin Grin
Logged

Life is what happens to you while you are busy making other plans
Ranger
Tireless poster
****
Offline Offline

United States United States

Posts: 115



View Profile
« Reply #19 on: February 12, 2009, 04:36:24 PM »

I assume sine I'm using the RAWR template that this doesnt work?
Logged

luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #20 on: February 13, 2009, 01:38:31 AM »

I assume sine I'm using the RAWR template that this doesnt work?
I do not know the RAWR template, but this feature was added by me, supported by Rejetto, to the standard template.
The code is rather simple (see posts on the first page). You can chenge the template by yourself or ask the RAWR owners to do that Wink
Logged

Life is what happens to you while you are busy making other plans
rejetto forum
« Reply #20 on: February 13, 2009, 01:38:31 AM »

Do you like this software? Consider even $2
 Logged
Kremlin
Tireless poster
****
Offline Offline

Portugal Portugal

Posts: 137


kremlin@playonteam.netmadeira.com
View Profile
« Reply #21 on: February 19, 2009, 10:48:47 AM »

Creating a folder works nicely, but deleting it using 'rm' instead of 'mkdir' doesnt work? (the purpose is to enter the exact name of the folder and when you push the delete button it deletes the folder)

EDIT.

Nevermind Roll Eyes didnt think too use the 'delete' lol

EDIT2.

But now i've though about adding folders to the main page (ie. http://localhost/) without using remote access for direct hfs interface, what macro should be used? add?
« Last Edit: February 19, 2009, 11:11:53 AM by Kremlin » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #22 on: February 19, 2009, 11:22:42 AM »

{.add folder.}
documented
Logged
Kremlin
Tireless poster
****
Offline Offline

Portugal Portugal

Posts: 137


kremlin@playonteam.netmadeira.com
View Profile
« Reply #23 on: February 19, 2009, 11:37:32 AM »

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

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

tryed both and didnt work? (not used too work with macro btw)

----------------------------------------------------------------------------------

I think this might be a bug. These are the steps i took:

1. Created single account for hfs
2. Gave delete rights in Tree Root, and Upload rights in a real folder that i added
3. Specified the above code just for delete rights so it should only show in the Tree Root (ie. http://localhost/)
4. Going to the real folder i added (ie. http://localhost/abc) it now shows twice the create/delete buttons, in other words shows for delete and upload rights at the same time.

Below is the full code i used for this:

Code:
[special:begin]
{.load|/template/languages/language.txt|special:strings.}
{.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.}

-----------------------------------

<form method='get'>
{.if|{.get|can upload.}|
<input class="formCreate" type='text' name='fldname' maxlength="25" size="25" value="{.!lv_foldercreate.}" onclick="if(this.value=='{.!lv_foldercreate.}')this.value=''"/>
<input class="create" type='submit' name='createfolder' value='Create Folder' >
<input class="delete" type='submit' name='deletefolder' value='Delete File/Folder' >
/if.}
{.if|{.get|can delete.}|
<input class="formCreate" type='text' name='fldname' maxlength="25" size="25" value="{.!lv_foldercreate.}" onclick="if(this.value=='{.!lv_foldercreate.}')this.value=''"/>
<input class="create" type='submit' name='createroot' value='Create Folder' >
<input class="delete" type='submit' name='deleteroot' value='Delete File/Folder' >
/if.}
</form>

I made it so that it would only add real folder to the hfs tree and create actual folder (without adding them to the tree) within the real folder.

PS. This might be confusing but i will explain again if you want. In other words the delete rights are inherited to the below folders thus showing twice the create/delete buttons. The image below is already in the http://localhost/abc folder.

« Last Edit: February 19, 2009, 11:56:21 AM by Kremlin » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #24 on: February 20, 2009, 05:52:26 AM »

as you say, permissions are inherited, so it's normal that your script will show the buttons twice.

my advice is that you would not tell the root from the folder by the name of the variable, but from the path itself.
{.if| {.%folder% = / .} | this is the root | this is the folder.}

so you can have just the same buttons for both, and make difference only when you have to actually create the folder.
Logged
Kremlin
Tireless poster
****
Offline Offline

Portugal Portugal

Posts: 137


kremlin@playonteam.netmadeira.com
View Profile
« Reply #25 on: February 21, 2009, 08:54:42 AM »

This is a rename file option based on the same code:

Code:
[special:begin]
{.if|{.and| {.get|can upload.} | {.urlvar|renamefile.} .}|{:
{.rename|%folder-resource%\{.urlvar|oldname.}|%folder-resource%\{.urlvar|newname.}.}
:}/if.}

Code:
<form method='get'>
{.if|{.get|can upload.}|
<input type='text' name='oldname' maxlength="25" size="25" value="Old Name.." onclick="if(this.value=='Old Name..')this.value=''"/>
<input type='text' name='newname' maxlength="25" size="25" value="New Name.." onclick="if(this.value=='New Name..')this.value=''"/>
<input type='submit' name='renamefile' value='Rename File'>
/if.}
</form>
« Last Edit: February 23, 2009, 07:52:06 AM by Kremlin » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11759


View Profile
« Reply #26 on: February 21, 2009, 08:43:17 PM »

my advice solved your problem?
Logged
Kremlin
Tireless poster
****
Offline Offline

Portugal Portugal

Posts: 137


kremlin@playonteam.netmadeira.com
View Profile
« Reply #27 on: February 22, 2009, 06:23:10 AM »

Yes that's why i shared the code.  Wink
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #28 on: February 23, 2009, 06:15:00 AM »

Yes that's why i shared the code.  Wink
Many thanks  Grin
Logged

Life is what happens to you while you are busy making other plans
Sapphirescales
Experienced poster
***
Offline Offline

United States United States

Posts: 73


View Profile Email
« Reply #29 on: July 20, 2009, 07:58:40 AM »

Is there any way to make this work in another window?  Perhaps a popup window?  It's a really good feature, but it doesn't look too good on the page.........
Logged

Pages: 1 [2] 3
  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 January 24, 2012, 10:35:45 PM
anything