pass a struct with the info
Former-commit-id: 6f9843613e6abfe0b19e6e43f9299afb98645477 [formerly 805fa39b073401c946b559e0e967fdc553f16295] [formerly f9e2de337abc0cbeb5ccdb8b6962871b0bd3ee0e [formerly 1d26b8e95e73a94ba92673861c4e83dfded0d92e]] Former-commit-id: 259a1ba8cdc71e7d32add58f9487e5827aa6685e [formerly 161a1a49bc1158f11f07fc9ff638506dafb6c918] Former-commit-id: 67fe1fef4602baf4ddae40b28e65ac9a2a42ca9d
This commit is contained in:
@@ -10,22 +10,22 @@ import (
|
||||
)
|
||||
|
||||
// serveListing presents the user with a listage of a directory folder.
|
||||
func serveListing(w http.ResponseWriter, r *http.Request, c *FileManager, u *User, i *fileInfo) (int, error) {
|
||||
func serveListing(ctx *requestContext, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
var err error
|
||||
|
||||
// Loads the content of the directory
|
||||
listing, err := getListing(u, i.VirtualPath, c.PrefixURL+r.URL.Path)
|
||||
listing, err := getListing(ctx.User, ctx.Info.VirtualPath, ctx.FileManager.PrefixURL+r.URL.Path)
|
||||
if err != nil {
|
||||
return errorToHTTP(err, true), err
|
||||
}
|
||||
|
||||
listing.Context = httpserver.Context{
|
||||
Root: http.Dir(u.scope),
|
||||
Root: http.Dir(ctx.User.scope),
|
||||
Req: r,
|
||||
URL: r.URL,
|
||||
}
|
||||
|
||||
cookieScope := c.BaseURL
|
||||
cookieScope := ctx.FileManager.BaseURL
|
||||
if cookieScope == "" {
|
||||
cookieScope = "/"
|
||||
}
|
||||
@@ -80,17 +80,17 @@ func serveListing(w http.ResponseWriter, r *http.Request, c *FileManager, u *Use
|
||||
p := &page{
|
||||
minimal: r.Header.Get("Minimal") == "true",
|
||||
Name: listing.Name,
|
||||
Path: i.VirtualPath,
|
||||
Path: ctx.Info.VirtualPath,
|
||||
IsDir: true,
|
||||
User: u,
|
||||
PrefixURL: c.PrefixURL,
|
||||
BaseURL: c.AbsoluteURL(),
|
||||
WebDavURL: c.AbsoluteWebDavURL(),
|
||||
User: ctx.User,
|
||||
PrefixURL: ctx.FileManager.PrefixURL,
|
||||
BaseURL: ctx.FileManager.AbsoluteURL(),
|
||||
WebDavURL: ctx.FileManager.AbsoluteWebDavURL(),
|
||||
Display: displayMode,
|
||||
Data: listing,
|
||||
}
|
||||
|
||||
return p.PrintAsHTML(w, c.assets.templates, "listing")
|
||||
return p.PrintAsHTML(w, ctx.FileManager.assets.templates, "listing")
|
||||
}
|
||||
|
||||
// handleSortOrder gets and stores for a Listing the 'sort' and 'order',
|
||||
|
||||
Reference in New Issue
Block a user