diff --git a/index.html b/index.html index 9818d17..fe18942 100644 --- a/index.html +++ b/index.html @@ -22,9 +22,13 @@

- + + + + +     Path:  

diff --git a/resources/css/base.css b/resources/css/base.css index 40854c9..e956d70 100644 --- a/resources/css/base.css +++ b/resources/css/base.css @@ -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; -} diff --git a/resources/css/main.css b/resources/css/main.css index 7f279c5..5cb0460 100644 --- a/resources/css/main.css +++ b/resources/css/main.css @@ -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; diff --git a/resources/js/ajax.js b/resources/js/ajax.js index 847f2da..32033c4 100644 --- a/resources/js/ajax.js +++ b/resources/js/ajax.js @@ -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(); diff --git a/resources/js/favorites.js b/resources/js/favorites.js index 528d72a..096da6e 100644 --- a/resources/js/favorites.js +++ b/resources/js/favorites.js @@ -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("./"); +} diff --git a/resources/js/filesystemActions.js b/resources/js/filesystemActions.js index e95ec6f..738ef03 100644 --- a/resources/js/filesystemActions.js +++ b/resources/js/filesystemActions.js @@ -34,7 +34,7 @@ function getDir(query) { } } else if (query === "./") { // Do nothing since re-scanning dir - } else { + } else { pathNodes.push(query); // Add path } diff --git a/resources/js/xmlParser.js b/resources/js/xmlParser.js index fc4387f..a0560a4 100644 --- a/resources/js/xmlParser.js +++ b/resources/js/xmlParser.js @@ -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; diff --git a/resources/php/dbController.php b/resources/php/dbController.php index 808c132..27837f8 100644 --- a/resources/php/dbController.php +++ b/resources/php/dbController.php @@ -1,5 +1,5 @@ query('Select * FROM faves'); - $GeneratedXML = ""; + $GeneratedXML = ""; while ($row = $res->fetchArray(SQLITE3_ASSOC)) { - $GeneratedXML .= "" . $row['link'] . ""; + $GeneratedXML .= "" . $row['link'] . ""; } - $GeneratedXML .= ""; + $GeneratedXML .= ""; 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("../../"); diff --git a/resources/php/filesystemActions.php b/resources/php/filesystemActions.php index 90d87d5..37424ac 100644 --- a/resources/php/filesystemActions.php +++ b/resources/php/filesystemActions.php @@ -1,6 +1,6 @@ " diff --git a/resources/php/sse.php b/resources/php/sse.php index ca7eda1..1c51ed3 100644 --- a/resources/php/sse.php +++ b/resources/php/sse.php @@ -1,7 +1,7 @@