From da02deb3a4dcaac3393fbacc932b10d16577a29a Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sat, 11 Jun 2016 22:15:42 +0100 Subject: [PATCH] add page --- fileinfo.go | 6 ++++++ listing.go | 1 + OLD/page.go => page.go | 19 ++++++++++--------- 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 listing.go rename OLD/page.go => page.go (96%) diff --git a/fileinfo.go b/fileinfo.go index 543fcf5d..a144c96c 100644 --- a/fileinfo.go +++ b/fileinfo.go @@ -52,6 +52,12 @@ func GetFileInfo(url *url.URL, c *Config) (*FileInfo, int, error) { return file, 0, nil } +// GetExtendedFileInfo is used to get extra parameters for FileInfo struct +func (fi FileInfo) GetExtendedFileInfo() error { + // TODO: do this! + return nil +} + // HumanSize returns the size of the file as a human-readable string // in IEC format (i.e. power of 2 or base 1024). func (fi FileInfo) HumanSize() string { diff --git a/listing.go b/listing.go new file mode 100644 index 00000000..2e5b8ff3 --- /dev/null +++ b/listing.go @@ -0,0 +1 @@ +package filemanager diff --git a/OLD/page.go b/page.go similarity index 96% rename from OLD/page.go rename to page.go index 7606f504..57828984 100644 --- a/OLD/page.go +++ b/page.go @@ -2,17 +2,23 @@ package filemanager import ( "encoding/json" + "html/template" "log" "net/http" "strings" - "text/template" ) +// Page contains the informations and functions needed to show the page +type Page struct { + Info *PageInfo +} + // PageInfo contains the information of a page type PageInfo struct { - Name string - Path string - Data interface{} + Name string + Path string + Config *Config + Data interface{} } // BreadcrumbMap returns p.Path where every element is a map @@ -43,11 +49,6 @@ func (p PageInfo) BreadcrumbMap() map[string]string { return result } -// Page contains the informations and functions needed to show the page -type Page struct { - Info *PageInfo -} - // PrintAsHTML formats the page in HTML and executes the template func (p Page) PrintAsHTML(w http.ResponseWriter, templates ...string) (int, error) { templates = append(templates, "base")