Revision [4278]
This is an old revision of FileManagerHack made by ChiWaWa on 2005-01-08 22:46:57.
File Manager
How to add file upload/management in wikkaWhy
I've setup a wikka site for my company in order to store the knoweldge base and allow every users to read/write doc without leaving their workstations to find an old doc in the company's archives.My problem was quite simple, I need users to add screenshots in wiki pages. Letting them doing so by ftp would be a loss of time for them, they need something quick and simple. I also had less than 1hr to add this feature.
What
I want a file manager, with upload, rename, moove, directory support and so on. Once gently asked for that, google pointed me on a script called webadminThis script is a single file doing everything a file manager is supposed to do. Now let's add it to wikka to allow my users to work more efficiently.
How
First, I want to add a 4th button in the edit handler, right after the textbox. Here is what i've modified in /handlers/page/edit.php :$output .=
$this->FormOpen("edit").
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
"<textarea onKeyDown=\"fKeyDown()\" id=\"body\" name=\"body\" style=\"width: 100%; height: 500px\">".htmlspecialchars($body)."</textarea><br />\n".
//note add Edit
"<input size=\"40\" type=\"text\" name=\"note\" value=\"".htmlspecialchars($note)."\" /> Please add a note on youredit.<br />\n".
//finsih
"<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input type=\"button\" value=\"Cancel\" onclick=\"document.location='".$this->href("")."';\" /> ".
//ChiWaWa's little FileManagerHack
"<input type=\"button\" value=\"Manage Files\" onclick=\"window.open('/handlers/3rdparty/webadmin.php','FileManagement','height=600,width=800,toolbar=yes,location=1')\" />\n".
$this->FormClose();
$this->FormOpen("edit").
"<input type=\"hidden\" name=\"previous\" value=\"".$previous."\" />\n".
"<textarea onKeyDown=\"fKeyDown()\" id=\"body\" name=\"body\" style=\"width: 100%; height: 500px\">".htmlspecialchars($body)."</textarea><br />\n".
//note add Edit
"<input size=\"40\" type=\"text\" name=\"note\" value=\"".htmlspecialchars($note)."\" /> Please add a note on youredit.<br />\n".
//finsih
"<input name=\"submit\" type=\"submit\" value=\"Store\" accesskey=\"s\" /> <input name=\"submit\" type=\"submit\" value=\"Preview\" accesskey=\"p\" /> <input type=\"button\" value=\"Cancel\" onclick=\"document.location='".$this->href("")."';\" /> ".
//ChiWaWa's little FileManagerHack
"<input type=\"button\" value=\"Manage Files\" onclick=\"window.open('/handlers/3rdparty/webadmin.php','FileManagement','height=600,width=800,toolbar=yes,location=1')\" />\n".
$this->FormClose();
Notes :
- wikka is the site root, it is important to know when settinging the path "/handlers/3rdparty/webadmin.php". Giving the full URI to the webadmin.php script also work but I had troubles with relative paths
- The file manager open in a popup window to not interact with the current page edition
- Fell free to modify the popup window parameters to fit your needs. Usually 800x600 gives the best results.
Next step : add the script on wikka's tree
- Create the /handlers/3rdparty directory
- copy webadmin.php in it
- Important (i've lost a long time trying to fix that) : copy /images/.htaccess in /handlers/3rdparty
Finally edit webadmin.php to change some parameters :