package modules import ( "fmt" "html" "os" "path/filepath" "strings" "golang-fave/engine/assets" "golang-fave/engine/builder" "golang-fave/engine/utils" "golang-fave/engine/wrapper" ) func (this *Modules) RegisterAction_FilesList() *Action { return this.newAction(AInfo{ Mount: "files-list", WantAdmin: true, }, func(wrap *wrapper.Wrapper) { pf_path := utils.SafeFilePath(utils.Trim(wrap.R.FormValue("path"))) // Set path wrap.Write(`fave.FilesManagerSetPath('` + pf_path + `');`) // Render table start_dir := strings.Join([]string{wrap.DHtdocs, "public"}, string(os.PathSeparator)) + pf_path + "*" str_dirs := "" str_files := "" nothing := true if files, err := filepath.Glob(start_dir); err == nil { for _, file := range files { file_name := file i := strings.LastIndex(file_name, string(os.PathSeparator)) if i != -1 { file_name = file_name[i+1:] } if utils.IsDir(file) { if nothing { nothing = false } actions := builder.DataTableAction(&[]builder.DataTableActionRow{ { Icon: assets.SysSvgIconView, Href: "/public" + pf_path + file_name + "/", Hint: "View", Target: "_blank", }, { Icon: assets.SysSvgIconRemove, Href: "javascript:fave.FilesManagerRemoveFolder(\\'" + pf_path + file_name + "\\',\\'Are you sure want to delete folder?\\');", Hint: "Delete", Classes: "delete", }, }) str_dirs += `
File name | Size | Action |
---|