F diff --git a/css/style.css b/css/style.css
--- a/css/style.css
+++ b/css/style.css
border-color: black;
}
- .foldercontents, .filecontents, .filecontentsroot {
+ .foldercontents, .filecontents {
background: rgba(250, 250, 250, .9);
flex: 1 0 0;
}
- .filecontents, .filecontentsroot {
+ .filecontents {
background: white;
}
align-self: center;
}
- .pathentry:last-child {
- cursor: inherit;
- }
-
- .pathentry:not(:last-child):hover {
+ .pathentry:hover {
text-decoration: underline;
}
background: white;
background: rgba(255,255,255, 0.9);
}
-
- .window > h2 .close_button {
- border-left: 1px solid #ccc;
- }
-
- .close_button:hover {
- background: white;
- }
F diff --git a/loggedin.js b/loggedin.js
--- a/loggedin.js
+++ b/loggedin.js
}
}
- function read_file_contents(text, cb, folder, filename) {
- var data = new FormData();
- data.append('folder', folder);
- data.append('filename', filename);
-
- let xhr = new XMLHttpRequest();
- xhr.open('POST', '/php/readfile.php', true);
-
- if (text) {
- xhr.onload = function () {
- cb(e.responseText);
- };
- } else {
- xhr.responseType = 'arraybuffer';
- xhr.onload = function () {
- cb(xhr.response);
- };
- }
-
- xhr.send(data);
- }
-
function openfile_nondir() {
var mimetype = "text/plain";
function add_link_functionality(link, length) {
link.onclick = (e) => {
- if (length < focus.pwd.length) {
- focus.pwd.length = length;
+ focus.pwd.length = length,
openfile(true);
- }
}
link.onmouseup = (e) => {
function make_share_window(folder, filename) {
var wnd = make_window_base(null, 400, 400, 400, 0);
- wnd.h2.style.padding = "0.0rem 0rem 0.0rem 0.8rem";
- wnd.h2.style.display = 'flex';
-
- var heading = mk(wnd.h2, 'span');
- heading.innerText = "Share " + filename;
- heading.style.display = 'flex';
- heading.style.alignItems = 'center';
- heading.style.flex = "1 1 0";
-
- var x_button = mk(wnd.h2, 'button', 'close_button');
- x_button.innerText = "X";
- x_button.onclick = delete_window;
+ wnd.h2.innerText = "Share " + filename;
+ wnd.h2.style.padding = "0.2rem 0.4rem";
wnd.foldercontents = mk(wnd.visuals, 'div', 'share_dialog_contents');
wnd.foldercontents.style.padding = "0.5rem";
return wnd;
}
- function download_file(in_file, filename) {
-
- if (in_file) {
- var folder = get_path(focus.pwd.length - 1);
- filename = focus.pwd[focus.pwd.length - 1];
- } else {
- var folder = get_path();
- }
-
- read_file_contents(false, (x) => {
- var blob = new Blob([new Uint8Array(x, 0, x.length)]);
- var url = URL.createObjectURL(blob);
- var a = document.createElement('a');
- a.href = url;
- a.download = "filename";
- document.body.appendChild(a);
- a.click();
- setTimeout(() => {
- document.body.removeChild(a);
- URL.revokeObjectURL(url);
- });
- }, folder, filename);
-
- return;
- }
-
-
-
-
function delete_window() {
var index = windows.indexOf(focus);
if (index >= 0) {
}
{
- wnd.filecontentsroot = mk(wnd.visuals, 'div', 'filecontentsroot');
+ wnd.filecontentsroot = mk(wnd.visuals, 'div');
var h3 = mk(wnd.filecontentsroot, 'h3');
var download_btn = mk(h3, 'button');
download_btn.innerText = "Download";
- download_btn.onclick = () => { download_file(true); }
+ download_btn.onclick = () => { download_file(); }
mk(h3, 'div', 'separator');
var download_btn = mk(h3, 'button');
download_btn.innerText = "Share";
download_btn.onclick = () => { share(true); }
-
+
mk(h3, 'div', 'separator');
wnd.filecontents = mk(wnd.filecontentsroot, 'div', 'filecontents');
focus.pwd.push(fileview.filename);
openfile(fileview.is_directory);
}],
- // ['Open in New Window', () => {alert('not implemented')}],
+ ['Open in New Window', () => {alert('not implemented')}],
];
if (is_in_trash) {
} else if (!is_trash) {
context_list.push(
['Rename', () => { rename_file(fileview.filename); }],
- );
- if (!fileview.is_directory) {
- context_list.push(
- ['Share', () => { share(false, fileview.filename); }],
- ['Download', () => { download_file(false, fileview.filename); }],
- );
- }
- context_list.push(
+ ['Share', () => { share(false, fileview.filename); }],
['Delete', () => { move_to_trash(fileview.filename); }]
);
}
F diff --git a/php/logout.php b/php/logout.php
--- a/php/logout.php
+++ b/php/logout.php
// which will log the user out of our webpage
session_start();
- unset($_SESSION['user_object']);
+ //unset($_SESSION['user_object']);
+ session_destroy();
header('Location: /');
?>
F diff --git a/php/mkdir.php b/php/mkdir.php
--- a/php/mkdir.php
+++ b/php/mkdir.php
$dirname=$_POST['dirname'];
$user=$_SESSION['user_object'];
+ error_log("user is creating a directory".$user->username);
create_directory($parent_directory,$dirname,"",$user);
F diff --git a/php/share.php b/php/share.php
--- a/php/share.php
+++ b/php/share.php
require_once "configuration.php";
require_once "database.php";
require_once "user.php";
+
session_start();
$user=$_SESSION['user_object'];
exit(1);
}
- //$share_link=create_share_link($path,$filename,$password,$user,$can_read,$can_write);
- $share_link=create_share_link($path,$filename,$password,$user,true,true);
+ $share_link=create_share_link($path,$filename,$password,$user,$can_read,$can_write);
+ //$share_link=create_share_link($path,$filename,$password,$user,true,true);
if($share_link==NULL)
F diff --git a/php/upload.php b/php/upload.php
--- a/php/upload.php
+++ b/php/upload.php
require_once "database.php";
require_once "configuration.php";
require_once "file_type_recogniser.php";
+ require_once "user.php";
require_once "node.php";
-
session_start();
+
if (!isset( $_POST["filename"]) || !isset($_FILES["the_file"]) || !isset($_POST['parent_directory']))
{
error_log("someone tried to upload something impropperly");