consistency

Former-commit-id: f0de208a4ae4cd0df9056443fe7a6a823882eca2 [formerly 3c65bde6f2dede145eca8f0d7c10a4d8124a01ef] [formerly 97100fe7d36d445babbc13a669d9c75577cb02d7 [formerly 6e04c97bb9d3e689e583f347588740d2d214e62b]]
Former-commit-id: 30f9afb795307f67cd9bccd2f35742a21ee69fde [formerly bc8a04744ca91ad2f951f0888cc11b023d6a067a]
Former-commit-id: 7397ffff5d09a3a56b29f7119d696ab4a4507893
This commit is contained in:
Henrique Dias
2017-06-27 14:26:12 +01:00
parent 7f28cebda6
commit e151e077c1
11 changed files with 82 additions and 76 deletions

View File

@@ -10,22 +10,22 @@ import (
)
// serveListing presents the user with a listage of a directory folder.
func serveListing(ctx *requestContext, w http.ResponseWriter, r *http.Request) (int, error) {
func serveListing(c *requestContext, w http.ResponseWriter, r *http.Request) (int, error) {
var err error
// Loads the content of the directory
listing, err := getListing(ctx.User, ctx.Info.VirtualPath, ctx.FileManager.RootURL()+r.URL.Path)
listing, err := getListing(c.us, c.fi.VirtualPath, c.fm.RootURL()+r.URL.Path)
if err != nil {
return errorToHTTP(err, true), err
}
listing.Context = httpserver.Context{
Root: http.Dir(ctx.User.scope),
Root: http.Dir(c.us.scope),
Req: r,
URL: r.URL,
}
cookieScope := ctx.FileManager.RootURL()
cookieScope := c.fm.RootURL()
if cookieScope == "" {
cookieScope = "/"
}
@@ -80,17 +80,17 @@ func serveListing(ctx *requestContext, w http.ResponseWriter, r *http.Request) (
p := &page{
minimal: r.Header.Get("Minimal") == "true",
Name: listing.Name,
Path: ctx.Info.VirtualPath,
Path: c.fi.VirtualPath,
IsDir: true,
User: ctx.User,
PrefixURL: ctx.FileManager.prefixURL,
BaseURL: ctx.FileManager.RootURL(),
WebDavURL: ctx.FileManager.WebDavURL(),
User: c.us,
PrefixURL: c.fm.prefixURL,
BaseURL: c.fm.RootURL(),
WebDavURL: c.fm.WebDavURL(),
Display: displayMode,
Data: listing,
}
return p.PrintAsHTML(w, ctx.FileManager.assets.templates, "listing")
return p.PrintAsHTML(w, c.fm.assets.templates, "listing")
}
// handleSortOrder gets and stores for a Listing the 'sort' and 'order',