summaryrefslogtreecommitdiff
path: root/www/browse.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/browse.php')
-rw-r--r--www/browse.php66
1 files changed, 58 insertions, 8 deletions
diff --git a/www/browse.php b/www/browse.php
index 028174e..468401a 100644
--- a/www/browse.php
+++ b/www/browse.php
@@ -1,20 +1,63 @@
<?php
+
+
function print_browser($content){
+ require_once("include.php");
+
+ if($_SERVER['REQUEST_METHOD'] == 'POST'){
+ //echo "created_folder : ". $_POST["foldername"] . " in ". $_GET["folder"];
+ create_folder("/".$_GET["folder"], $_POST["foldername"], /*$_POST["public"]?*/"PUBLIC"/*:"PRIVATE"*/);
+ browse(collect_content($GLOBALS["db"], $_GET["name"] , $_GET["folder"]));
+ }else{
+ browse(collect_content($GLOBALS["db"], $_GET["name"] , $_GET["folder"]));
+ }
+}
- include("static/header.html");
+function browse($content){
+ include("static/header.html");
+ if($_SESSION["login"] && $_SESSION["username"] == $_GET["name"]){
+ print_menu();
+ }
- $file_list = "";
- foreach($content as $file){
- $file_list .= get_item($file);
- }
- echo '<link rel="stylesheet" type="text/css" href="/static/browser.css">
- <table>'.$file_list.'</table>';
- include("static/footer.html");
+ $file_list = "";
+ if($content){
+ foreach($content as $file){
+ $file_list .= get_item($file);
+ }
+ }
+
+ echo '<link rel="stylesheet" type="text/css" href="/static/browser.css">
+ <script>
+ function showNewFolder(){
+ document.getElementById("new-folder-bg").style.visibility = "visible";
+ return;
+ }
+ function hideNewFolder(){
+ if(document.getElementById("new-folder-name").value!=""){
+ document.getElementById("new-folder-bg").style.visibility = "hidden";
+ }
+ return;
+ }
+ </script>
+ <div id="new-folder-bg">
+ <div id="new-folder-area">
+ <h1 class="new-folder-"> New Folder </h1>
+ <form id="new-folder-form" method="post" action="'.$_GET["name"].$_GET["folder"].'">
+ <input class="new-folder-input" id="new-folder-name" type="text" placeholder="name" name="foldername" required>
+ <label style="display:inline">Public</label><input style="display:inline; margin-left: 5px;" class="new-folder-input" type="checkbox" name="public">
+ <input style="display:block" onclick="hideNewFolder()" type="submit" id="button-input" class="new-folder-input" value="create">
+ </form>
+ </div>
+ </div>
+ <table>'.$file_list.'</table>';
+
+ include("static/footer.html");
}
+
function get_icon($file){
if($file[4]=="DIRECTORY"){
return '<td id="icon">'.get_link($file).'<img src="/static/img/icon_folder.svg" width="30px"></a></td>';
@@ -31,3 +74,10 @@ function get_link($file){
function get_item($file){
return '<tr>'.get_icon($file).'<td>'.get_link($file).$file[3].'</a></td></tr>';
}
+
+function print_menu(){
+ echo '<div id="menu">
+ <div class="menu-item" id="new-item" onclick="showNewFolder()" ><img src="/static/img/icon_new.svg" width="45px" onclick="toggleNewFolder()"></div>
+ <div class="menu-item" id="upload-item"><img src="/static/img/icon_upload.svg" width="45px"></div>
+ </div><!-- div menu-->';
+}