rejetto forum
May 25, 2012, 11:59:51 AM *
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 6203 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
« on: January 22, 2009, 04:46:44 AM »

It would be nice if a user which has "upload" rights can also create a folder.
Any plan to implement it?
Is it possible to do it with a macro?
« Last Edit: February 12, 2009, 02:27:48 AM by luca69 » Logged

Life is what happens to you while you are busy making other plans
Foggy
Insane poster
*****
Offline Offline

Australia Australia

Posts: 806


View Profile
« Reply #1 on: January 22, 2009, 06:58:13 AM »

yes it would be possible to do with a macro.

Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11830


View Profile
« Reply #2 on: January 22, 2009, 08:19:54 AM »

in the future this function will be totally integrated in HFS.
in the while you can build it via macro. I will write something totally untested, for your inspiration

{.if|{.can upload.}|{:
form to create the folder

{.if|{.postvar|create_folder.}|{:
  {.mkdir|{.postvar|create_folder.}
:}.}

:}.}



...the {.if|{.postvar   may even be omitted, since mkdir should just fail if the name of the folder is empty.
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #3 on: January 26, 2009, 03:28:15 AM »

Thanks for the hint. I'll try it when I have some free time  Wink

Bye
Luca
--------------- Edit
I tried to create it next to the "Delete" button with this peace of code:
Code:
<div style='margin-top:2em;'>
{.if|{.get|can delete.}|
<input type='hidden' name='action' value='delete'>
<input type='checkbox' onclick='var is = document.getElementsByName("selection"); for (var i=0; i < is.length; i++) is[i].checked = this.checked;'> All
<input style='margin-left:1em' type='submit' value='Delete selected' onclick='return confirm("Are you sure?")'>
/if.}
{.if|{.get|can upload.}|
Folder name: <input  type='text' name='fldname' maxlength="25" size="25" >
<input  type='submit' name='createfolder' value='Create Folder' >
{.if|{.postvar|fldname.}|
  {.mkdir|{.postvar|fldname.}.}
/if.}
  /if.}
</div>

The text input field and the button are displayed, but the folder is not created Sad

Any hint?
« Last Edit: January 26, 2009, 08:22:08 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: 11830


View Profile
« Reply #4 on: January 27, 2009, 02:55:33 AM »

1. put it just before </form>, so it will work also when there's no file in the folder
2. it was creating the folder in your HFS folder
3. i think it's better to check for the button instead of the content of the field
4. you forgot to {:quote:} the action. When you don't, the action is always done, not only when the IF is true.

Code:
  {.if|{.get|can upload.}|
Folder name: <input  type='text' name='fldname' maxlength="25" size="25" >
<input  type='submit' name='createfolder' value='Create Folder' >
{.if|{.postvar|createfolder.}|{:
{.mkdir|%folder-resource%\{.postvar|fldname.}.}
:}/if.}
  /if.}
</form>
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #5 on: January 27, 2009, 07:09:16 AM »

Now it works: the folder is created  Grin, but the folder list is not refreshed  Embarrassed
Any hint how can I force the refresh of the page?
Logged

Life is what happens to you while you are busy making other plans
rejetto forum
« Reply #5 on: January 27, 2009, 07:09:16 AM »

Do you like this software? Consider even $2
 Logged
r][m
Insane poster
*****
Offline Offline

United States United States

Posts: 340


View Profile
« Reply #6 on: January 27, 2009, 08:26:45 AM »

I've made several trys at this without success.
I can't get either example posted here to work at all?
Code:
{.if|{.?action = add.}|{: {.add folder|real|C:\HFS-Folder\Files|Folder1.} :}.}
does add a folder to the vfs at root level as a real folder, but it should have been a subfolder.
Search will not find it on my hard drive, so it must actually be virtural.
What I need is to be able to specify directory its created in and folder name.
Any help anyone?
« Last Edit: January 27, 2009, 08:32:42 AM by r][m » Logged
rejetto
Administrator
Insane programmer
*
Offline Offline

Italy Italy

Posts: 11830


View Profile
« Reply #7 on: January 27, 2009, 08:48:58 AM »

Now it works: the folder is created  Grin, but the folder list is not refreshed  Embarrassed
Any hint how can I force the refresh of the page?

ah, right, it's because the list is made BEFORE the folder is created.
The easiest solution would be to automatically refresh the page after the creation. But it is ugly.
This is more elegant:

1. replace the code i gave you with this one
Code:
  {.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>


2. add this to the template
Code:
[special:begin]
{.if|{.and| {.get|can upload.} | {.postvar|createfolder.} .}|{:
{.mkdir|%folder-resource%\{.postvar|fldname.}.}
:}/if.}
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #8 on: January 27, 2009, 09:20:01 AM »

THANKS !!!!
Now it is perfect! My users will love it  Grin
Logged

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

Italy Italy

Posts: 11830


View Profile
« Reply #9 on: January 27, 2009, 09:59:23 AM »

does add a folder to the vfs at root level as a real folder, but it should have been a subfolder.

from next build it will be as subfolder.
and more: the name may contain a VFS path, so you can specify where to put it.
"foo" will just go as subfolder of the current folder (or root if not in folder).
while "/foo" will go under the root, "/asd/foo" under asd, and so on.
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #10 on: February 03, 2009, 11:06:57 AM »

H E L P !!!

I found a bug: if you create a new folder, you enter into it and you click on the path on the top, than a new folder with the same name is create!!!

How to reproduce it:
1. Enter into a folder where you have upload rights (e.g. "temp") and creates a new folder (e.g. "test")
2. Click on the newly created folder
3. On the top there is the current path: /Home/temp/test: click on "test" a new folder called test is created!!
--> now you can go to /Home/test/test

Each time a new path where you have upload rights is selected, the "test" folder is created!!

The problem is that the "createfolder" is not reset, but I do not know how to do that.
« Last Edit: February 03, 2009, 11:11:37 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: 11830


View Profile
« Reply #11 on: February 03, 2009, 07:39:29 PM »

i tried to reproduce how you said, but it didn't work.
actually, what you saying is strange, because POSTed values should always been discarded by the browser at next request.
did you perhaps remove the method=post of the form
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #12 on: February 04, 2009, 01:38:00 AM »

No I did not!
Please find enclosed my template (my_hfs.tlp).
There is also the admin panel and an additional function to enable the user to change the password by himself/herself.

Please Help!

Note: I put on the top the values of createfolder and fldname for debugging; also the java script was a test to clean the vars, but it did not work Sad

hfs.tlp is the clean one only with the create folder code

* my_hfs.tpl (27.44 KB - downloaded 140 times.)
* hfs.tpl (15.03 KB - downloaded 126 times.)
« Last Edit: February 04, 2009, 01:46:02 AM by luca69 » Logged

Life is what happens to you while you are busy making other plans
r][m
Insane poster
*****
Offline Offline

United States United States

Posts: 340


View Profile
« Reply #13 on: February 04, 2009, 10:34:27 AM »

I too had some bizarre results working with add folder.
The folder created, when browsed should have been empty,
but was the hfs.exe directory! Delete section quit working, also.
Aparrently not build related. Restored with back up copy of my
tpl without add folder section, fixed it. Now to try again  Smiley
Logged
luca69
Experienced poster
***
Offline Offline

Italy Italy

Posts: 95


drl1069@hotmail.com
View Profile Email
« Reply #14 on: February 06, 2009, 01:24:17 AM »

I did some further tests putting in the top the debug code
Code:
Vars: createfolder={.postvar|createfolder.}; fldname={.postvar|fldname.};

Even putting back the folder creation to the form ...
Code:
</div>
{.if|{.get|can upload.}|
Folder name: <input  type='text' name='fldname' maxlength="25" size="25" >
<input  type='submit' name='createfolder' value='Create Folder' >
{.if|{.and| {.get|can upload.} | {.postvar|createfolder.} .}|{:
{.mkdir|%folder-resource%\{.postvar|fldname.}.}
:}/if.}
    /if.}
</form>

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)


* Screenshot224.png (16.29 KB, 680x370 - viewed 290 times.)

* Screenshot225.png (17.3 KB, 682x364 - viewed 238 times.)

* Screenshot226.png (13.53 KB, 678x296 - viewed 263 times.)
Logged

Life is what happens to you while you are busy making other plans
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 May 20, 2012, 10:23:54 AM