Implimented favorites functionality.
This commit is contained in:
parent
c9019b45de
commit
c8b7b18d6f
@ -22,9 +22,13 @@
|
||||
<!-- Uploader -->
|
||||
<h2 id="fullPathHeader">
|
||||
<button type="button" title="Other Options" onclick="tgglElmView('popOutControls')">⚙</button>
|
||||
<button type="button" id="faves" title="Favorites" onclick="faveManager(this)">☆</button>
|
||||
<button type="button" title="Refresh" onclick="getDir('./')">↻</button>
|
||||
<button type="button" title="Back" onclick="getDir('../')">⇐</button>
|
||||
<button type="button" id="faves" title="Favorites" onclick="faveManager(this)">☆</button>
|
||||
<span id="faves-constraint" >
|
||||
<button onclick="getFavesList(); tgglElmView(this.parentElement.children[1].id)">Faves List ↕</button>
|
||||
<ol id="favesList" style="display: none;"> </ol>
|
||||
</span>
|
||||
Path: <span id="path"></span>
|
||||
</h2>
|
||||
|
||||
|
@ -2,13 +2,3 @@ html {
|
||||
margin: 0em;
|
||||
padding: 0em;
|
||||
}
|
||||
|
||||
iframe {
|
||||
position: fixed;
|
||||
overflow: auto;
|
||||
background-color: rgba(60, 110, 135, 0.24);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
width: 100%;
|
||||
height: auto;
|
||||
bottom: 0;
|
||||
}
|
||||
|
@ -38,6 +38,25 @@
|
||||
background-color: rgba(0,0,0,0.64);
|
||||
}
|
||||
|
||||
#favesList {
|
||||
border-style: solid;
|
||||
border-color: rgba(0, 0, 0, 0.5);
|
||||
border-width: 0.2em;
|
||||
background-color: rgba(7, 150, 159, 0.8);
|
||||
position: fixed;
|
||||
font-size: 2em;
|
||||
overflow: auto;
|
||||
padding: 1.5em;
|
||||
}
|
||||
|
||||
#favesList > li:hover {
|
||||
cursor: pointer;
|
||||
background-color: rgba(92, 199, 35, 0.8);
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
|
||||
#fullPathHeader {
|
||||
display: block;
|
||||
position: fixed;
|
||||
|
@ -10,6 +10,10 @@ if(typeof(EventSource) !== "undefined") {
|
||||
console.log("SSE Not Supported In Browser...");
|
||||
}
|
||||
|
||||
function getFavesList() {
|
||||
doAjax("resources/php/dbController.php", "getTabs=true");
|
||||
}
|
||||
|
||||
function doAjax(actionPath, data) {
|
||||
var xhttp = new XMLHttpRequest();
|
||||
|
||||
|
@ -15,3 +15,20 @@ function faveManager(elm) {
|
||||
data += "&linkPath=" + path;
|
||||
doAjax("resources/php/dbController.php", data);
|
||||
}
|
||||
|
||||
// Basically resetting path nodes and setting them up
|
||||
// to the new path and just doing a refresh
|
||||
function loadFave(elm) {
|
||||
var path = elm.innerHTML;
|
||||
var parts = path.split("/");
|
||||
var size = parts.length;
|
||||
pathNodes = [];
|
||||
|
||||
pathNodes.push(parts[0] + "/");
|
||||
for (var i = 1; i < size - 1; i++) {
|
||||
pathNodes.push(parts[i] + "/");
|
||||
}
|
||||
pathNodes.push(parts[size - 1]);
|
||||
|
||||
getDir("./");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ function getDir(query) {
|
||||
}
|
||||
} else if (query === "./") {
|
||||
// Do nothing since re-scanning dir
|
||||
} else {
|
||||
} else {
|
||||
pathNodes.push(query); // Add path
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,26 @@ function handleXMLReturnData(data) {
|
||||
} else if (data.activeElement.tagName == "SERV_MSG") {
|
||||
console.log(document.getElementById("serverMsgView"));
|
||||
document.getElementById("serverMsgView").appendChild(data.activeElement);
|
||||
} else if (data.activeElement.tagName == "FAVES_LIST") {
|
||||
generateFavesList(data);
|
||||
}
|
||||
}
|
||||
|
||||
function generateFavesList(data) {
|
||||
var listView = document.getElementById("favesList");
|
||||
var favesList = data.getElementsByTagName("FAVE_LINK");
|
||||
var size = favesList .length;
|
||||
listView.innerHTML = "";
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
var liTag = document.createElement("LI");
|
||||
var txtNode = document.createTextNode(favesList[i].innerHTML);
|
||||
|
||||
liTag.setAttribute("onclick", "loadFave(this)");
|
||||
liTag.appendChild(txtNode);
|
||||
listView.appendChild(liTag);
|
||||
}
|
||||
}
|
||||
|
||||
async function updateHTMLDirList(data) {
|
||||
var isInFaves = data.getElementsByTagName('IN_FAVE')[0].innerHTML;
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
include 'serverMessanger.php';
|
||||
include_once 'serverMessanger.php';
|
||||
|
||||
function getTabLinks() {
|
||||
$db = new SQLite3('resources/db/webfm.db');
|
||||
@ -11,11 +11,11 @@ function getTabLinks() {
|
||||
}
|
||||
|
||||
$res = $db->query('Select * FROM faves');
|
||||
$GeneratedXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TABS_LIST>";
|
||||
$GeneratedXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><FAVES_LIST>";
|
||||
while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
|
||||
$GeneratedXML .= "<TAB_LINK>" . $row['link'] . "</TAB_LINK>";
|
||||
$GeneratedXML .= "<FAVE_LINK>" . $row['link'] . "</FAVE_LINK>";
|
||||
}
|
||||
$GeneratedXML .= "</TABS_LIST>";
|
||||
$GeneratedXML .= "</FAVES_LIST>";
|
||||
echo $GeneratedXML;
|
||||
}
|
||||
|
||||
@ -50,27 +50,6 @@ function manageLink($ACTION, $PATH) {
|
||||
serverMessage("success", $message);
|
||||
}
|
||||
|
||||
function isInDBCheck($PATH) {
|
||||
$db = new SQLite3('resources/db/webfm.db');
|
||||
|
||||
if($db === false){
|
||||
$message = "Server: [Error] --> Database connection failed!";
|
||||
serverMessage("error", $message);
|
||||
die("ERROR: Could not connect to db.");
|
||||
}
|
||||
|
||||
$stmt = $db->prepare('SELECT 1 FROM faves WHERE link = :link');
|
||||
$stmt->bindValue(":link", $PATH, SQLITE3_TEXT);
|
||||
$result = $stmt->execute() ;
|
||||
$row = $result->fetchArray() ;
|
||||
|
||||
if ($row > 0) {
|
||||
return "true";
|
||||
} else {
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Determin action
|
||||
chdir("../../");
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
include 'serverMessanger.php';
|
||||
include_once 'serverMessanger.php';
|
||||
|
||||
// Create file or folder
|
||||
function createItem($FILE, $TYPE) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
session_start();
|
||||
include 'serverMessanger.php';
|
||||
include_once 'serverMessanger.php';
|
||||
|
||||
// Start of retrieving dir data
|
||||
function startListing($NEWPATH, $MERGESEASSONS, $PASSWD) {
|
||||
if (is_dir($NEWPATH)) {
|
||||
include 'lockedFolders.php';
|
||||
include_once 'lockedFolders.php';
|
||||
|
||||
if (checkForLock($NEWPATH, $PASSWD) == false) {
|
||||
$GeneratedXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><DIR_LIST>"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
// Start the session
|
||||
session_start();
|
||||
include 'config.php';
|
||||
include_once 'config.php';
|
||||
|
||||
if (!isset($_SESSION["refreshState"])) {
|
||||
$_SESSION["refreshState"] = "none";
|
||||
|
Loading…
Reference in New Issue
Block a user