Gossamer Forum
Home : Products : Others : Fileman :

Action after Saving a file

Quote Reply
Action after Saving a file
I love this product. It's so nice to be able to upload a .tar file and extract it on the server. I also like the ability to edit a file without having to mess with ftp'ing it down changing it and the uploading it over and over again until I get it the way I need it.

Here's the problem though. I often change the same file again over and over until I get the results I want. Currently in FileMan if you open a file and click save your are redirected back to the file list. Meaning if you want to make another change to the same file you've got to locate it again and repeat those steps. Is there a way I can modify FileMan so that it will save the file I've got open but also keep it open instead of going back to the file list? Hopefully this is possible.
Quote Reply
Re: [jshinall] Action after Saving a file In reply to
That's actually a very cool idea. I tried it out real quick on one of my installs and got it working but I didn't get much of a chance to test it out very well. You'll have to edit the GT::FileMan::Commands module and the file_editor.html template as follows:

GT/FileMan/Commands.pm
-------------------------------

1) In sub cmd_editor, around line 1010, you'll see this bit of code:

Code:
# Save the contents
($self->{cgi}->{save}) ? ($filename = $self->{cgi}->{filename})
: ($filename = $self->{cgi}->{filenew});

Change it to this:

Code:
# Save the contents
($self->{cgi}->{save} || $self->{cgi}->{saveandstay})
? ($filename = $self->{cgi}->{filename})
: ($filename = $self->{cgi}->{filenew});

2) Next sub down, sub editor_process, about line 1070, you'll see this bit of code:

Code:
return $self->cmd_main_display({ reload => '1', status => $status});

Change it to:

Code:
return $self->{cgi}->{saveandstay} ? $self->cmd_edit($filename) : $self->cmd_main_display({ reload => '1', status => $status});


file_editor.html
-----------------

1) Around line 80 or so you'll see this:

Code:
<%if old%>
<tr>
<td><%font%>
<%if writeable%><input type="submit" name="save" value=" Save " class='submit'><%else%>(Not Writeable)<%endif%>&nbsp;-
<input type="submit" name="saveas" value="Save As ..." class='submit'>
<input type="text" name="filenew" size=30 value='<%if filenew%><%filenew%><%endif%>' class='object'>
<input type="hidden" name="filename" value='<%if filename%><%filename%><%endif%>'></font>
</td>
<%else%>

I changed it to:

Code:
<%if old%>
<tr>
<td><%font%>
<%if writeable%>
<input type="submit" name="save" value=" Save " class="submit">&nbsp;-
<input type="submit" name="saveandstay" value="Save &amp; Stay" class="submit">&nbsp;-
<%else%>(Not Writeable)
<%endif%>
<input type="submit" name="saveas" value="Save As ..." class='submit'>
<input type="text" name="filenew" size=30 value='<%if filenew%><%filenew%><%endif%>' class='object'>
<input type="hidden" name="filename" value='<%if filename%><%filename%><%endif%>'></font>
</td>
<%else%>

Use this at your own risk! I have not had a chance to test it very well. But please let me know how it works for you if you use it.

~Charlie