view_list_old_page.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package route
  2. import "opennamu/route/tool"
  3. func View_list_old_page(config tool.Config, num string, set_type string) string {
  4. db := tool.DB_connect()
  5. defer tool.DB_close(db)
  6. api_data := Api_list_old_page(config, num, set_type)
  7. api_data_list := api_data["data"].([][]string)
  8. if set_type != "old" {
  9. set_type = "new"
  10. }
  11. title := tool.Get_language(db, "old_page", true)
  12. if set_type == "new" {
  13. title = tool.Get_language(db, "new_page", true)
  14. }
  15. data_html := ""
  16. for _, data := range api_data_list {
  17. doc_name := tool.Url_parser(data[0])
  18. doc_title := tool.HTML_escape(data[0])
  19. date := tool.HTML_escape(data[1])
  20. left := `<a href="/w/` + doc_name + `">` + doc_title + `</a>`
  21. right := date
  22. data_html += tool.Get_list_ui(left, right, "", "")
  23. }
  24. data_html += tool.Get_page_control(
  25. db,
  26. tool.Str_to_int(num),
  27. len(api_data_list),
  28. 50,
  29. "/list/document/" + set_type + "/{}",
  30. )
  31. out := tool.Get_template(
  32. db,
  33. config,
  34. title,
  35. data_html,
  36. []any{},
  37. [][]any{
  38. { "other", tool.Get_language(db, "return", true) },
  39. },
  40. map[string]string{},
  41. )
  42. return out
  43. }