rejetto forum

Folder Creation on RAWR Templ.

Ranger · 14 · 3206

0 Members and 1 Guest are viewing this topic.

Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
I've been trying to figure out where to enter this code.

Code: [Select]
<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>


Code: [Select]
[special:begin]
{.if|{.and| {.get|can upload.} | {.urlvar|createfolder.} .}|{:
{.mkdir|%folder-resource%\{.urlvar|fldname.}.}
:}/if.}

I added the second part to the end of the template, but I'm not sure where exactly to place the first part.  I put it in the foleder section and when I refresh the template everything has LV_ in front of it. I can create a folder this way, but obviously I'm not putting it in the right section.  Thanks


Offline luca69

  • Occasional poster
  • *
    • Posts: 95
    • View Profile
Hi,
I did the same but in the standard template (not in the RAW one).

I added the following code ad the end of the form which creates the file list:
Code: [Select]

<form method='post' id='filelist'>
<div id='body'>
  {.if| %folder-item-comment% | <div id='foldercomment'>%folder-item-comment%</div> .}
  {.if| {.?search.} | <a class='big' href="."><img src="/~img14"> {.!BACK.}</a>
    | {.if| {.%folder% != / .} | <a class='big' href=".."><img src="/~img14"> {.!UP.}</a> .}
  /if.}
  {.if not| %number% | <div class='big'>{.!No files.}</div> |
    <div id='folderstats'>%number-folders% {.!folders.},  %number-files% {.!files.} - {.!Total.}: %total-size%</div>
    <table id='files' cellpadding='5'>
    {.set|sortlink| {:<a href="{.trim|
{.get|url|sort=$1| {.if| {.{.?sort.} = $1.} |  rev={.not|{.?rev.} .} /if.} /get.}
/trim.}">{.!$2.}{.if| {.{.?sort.} = $1.} | &{.if|{.?rev.}|u|d.}arr;.}</a>:} .}
    <th>{.^sortlink|n|Filename.}{.^sortlink|e|.ext.}
    <th>{.^sortlink|s|Filesize.}
    <th>{.^sortlink|t|Filetime.}
    <th>{.^sortlink|d|Hits.}
    %list%
    </table>
{.if|{.get|can delete.}|
<div style='margin-top:2em;'>
<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?")'>
</div>
/if.}

  /if not.}
 
</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.}
</form>

I recommend you to use the "post" method in the form and not the "get" one so that the vars are not visible in the URL.

But you have to change the [special:begin] session as well:

Code: [Select]
[special:begin]
{.if|{.and| {.get|can upload.} | {.postvar|createfolder.} .}|{:
{.mkdir|%folder-resource%\{.postvar|fldname.}.}
:}/if.}
Life is what happens to you while you are busy making other plans


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
I added the code you gave me and now my main directorys are showing up twice on the page!!

Attached is the tpl.


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
http://www.rejetto.com/forum/index.php?topic=6570.0 read my posts on this thread as they apply directly to the rawr template about creating and deleting folders/files


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
Thats not quite the issue with mine. I'm having problem with placement of Luca's code and it creating the LV tags in front of everything.


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
That happens because you already have a [special:begin] section in the rawr template around the top of the template, you should not add another one at the end, instead just add the code that you wan't to the one already there:

[special:begin]
{.load|/template/languages/language.txt|special:strings.} <- something like this already exists in the default rawr template

and you should now make it this:

[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.}


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
Ok thanks Kremlin, go that part taken off. However I still have 2 file lists.

This happens after I add this:

Code: [Select]
<form method='post' id='filelist'>
<div id='body'>
  {.if| %folder-item-comment% | <div id='foldercomment'>%folder-item-comment%</div> .}
  {.if| {.?search.} | <a class='big' href="."><img src="/~img14"> {.!BACK.}</a>
    | {.if| {.%folder% != / .} | <a class='big' href=".."><img src="/~img14"> {.!UP.}</a> .}
  /if.}
  {.if not| %number% | <div class='big'>{.!No files.}</div> |
    <div id='folderstats'>%number-folders% {.!folders.},  %number-files% {.!files.} - {.!Total.}: %total-size%</div>
    <table id='files' cellpadding='5'>
    {.set|sortlink| {:<a href="{.trim|
{.get|url|sort=$1| {.if| {.{.?sort.} = $1.} |  rev={.not|{.?rev.} .} /if.} /get.}
/trim.}">{.!$2.}{.if| {.{.?sort.} = $1.} | &{.if|{.?rev.}|u|d.}arr;.}</a>:} .}
    <th>{.^sortlink|n|Filename.}{.^sortlink|e|.ext.}
    <th>{.^sortlink|s|Filesize.}
    <th>{.^sortlink|t|Filetime.}
    <th>{.^sortlink|d|Hits.}
    %list%
    </table>
{.if|{.get|can delete.}|
<div style='margin-top:2em;'>
<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?")'>
</div>
/if.}

  /if not.}
 
</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.}
</form>

I understand that this happening due to the template pulling 2 file lists now. I'm just not sure how to integrate just the part I need.

Here is the section I put it under:

Code: [Select]
|<form method='post' id='filelist'>%list%.}
</table>
{.if|{.and|{.get|can delete.}|{.or|%number%|.}.}|
<input type='hidden' name='action' value='delete'>
<input style="margin-left:15px; margin-top:12px;" type='checkbox' onclick='var is
= document.getElementsByName("selection"); for (var i=0; i < is.length; i++) is[i].checked =
this.checked;'>&nbsp;&nbsp;<span style="color:#006633;"><b><---- {.!lv_delete2.}</b></span><input
style='margin-left:1em' type='submit' value='{.!lv_delete.}' onclick='return
confirm("{.!lv_delete3.}")'>
/if.}
</form>


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
Please post an image of whats happening so i can better understand whats happening to your template.


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
Here ya go.

Bottom half is from that code.


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
I see your problem i'll post a correct [files] section in a bit

Code: [Select]
[files]
<table cellspacing="1" cellpadding="0" border="0" width="100%">
<tr>
<td colspan="3" class="heading">
{.if|{.match|{.!mod_folder_tasks.};{.!mod_statistics.};{.!mod_shoutbox.}|on.}|
<span class="hide">
<a href="javascript:pinModule('moduleCol')" id="moduleCol_Link" title="{.!lv_hideTitle.}"><img src="/template/{.!theme.}/images/show.gif" align="top" alt=""/></a>
</span>
.}
<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>
&nbsp;
</td>
</tr>
{.if not|%number%|
<tr>
<td colspan="3">
<center>
{.if|{.$search-data.}|{.!lv_searchError1.}&nbsp;<x>{.$search-data.}</x>&nbsp;{.!lv_searchError2.}|{.!lv_filelistError.}.}
</center>
</td>
</tr>
|%list%.}
<td colspan="3" class="heading">
</td>
</table>

I placed the button and text field in the bar above the files but you can change it by placing the <form>(code)</form> in the place you want.
« Last Edit: February 19, 2009, 08:03:45 PM by Kremlin »


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
Still the same thing. I replaced the Files section with the code you just gave me  :-[


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
thats wierd  ???

i'm using a very similar one in my template and it works perfectly. Might it be something other than whats in the [files] section?


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
I don't know whats going on now. I copied over the default RAWR template and the 2 file lists still exist.....really stumped now.

Ok, restarted the server and its good now.

No idea why I can't get this folder creation code to work though.


Offline TSG

  • Moderator
  • Tireless poster
  • *****
    • Posts: 1934
    • View Profile
    • RAWR-Designs
I was just about to say somebody I know had this working in that template :P and then I realised it was Kremlin (different name on msn). I can't really help with this, I haven't had much experience at all with all these newer macros. I was going to work on the new templates, but our website is taking priority at the moment.