From 2d33f71b5d71c056f08608a1f5b3d2844e8f49b0 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 31 Aug 2010 10:25:37 -0400 Subject: [PATCH] Traversing directories is now possible. --- src/server.go | 2 +- web_frontend/main.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server.go b/src/server.go index 026f78d..580caac 100644 --- a/src/server.go +++ b/src/server.go @@ -29,7 +29,7 @@ func serviceHandler(connection *http.Conn, request *http.Request) { switch request.FormValue("action") { case "list": - files, err := paths.List("./") + files, err := paths.List(request.FormValue("path")) if err != nil { errorResponse(connection, err.String()) } else { diff --git a/web_frontend/main.js b/web_frontend/main.js index 7b61aa0..5cd5101 100644 --- a/web_frontend/main.js +++ b/web_frontend/main.js @@ -7,6 +7,7 @@ goog.require('goog.Uri.QueryData'); armadillo = function() { this.list('/'); + this.currentPath_ = '/'; this.listeners_ = new Array(); } @@ -40,6 +41,7 @@ armadillo.prototype.list = function(path) { // Update the listing. goog.dom.setTextContent(goog.dom.getElement('pwd'), path); + app.currentPath_ = path; var list = goog.dom.getElement('ls'); goog.dom.removeChildren(list); @@ -61,7 +63,7 @@ armadillo.prototype.list = function(path) { */ armadillo.prototype.clickHandler_ = function(e) { if (this.isDirectory_(goog.dom.getTextContent(e.target))) { - alert('this is a dir'); + this.list(this.currentPath_ + goog.dom.getTextContent(e.target)); } }; -- 2.43.5