From d2a8fb12678a3d2d8951a00c67d7799d91a1c18c Mon Sep 17 00:00:00 2001 From: Azareal Date: Sat, 11 Nov 2017 05:22:33 +0000 Subject: [PATCH] Fixed the template transpiler. Fixed the PreRoute middleware. Renamed makeDummyForum to BlankForum. Began adding the plugin_guilds routers to the template transpiler for extra speed. --- common/forum.go | 2 +- common/routes_common.go | 2 +- common/template_init.go | 14 +- extend/guilds/lib/guilds.go | 2 +- general_test.go | 5 +- main.go | 5 +- template_forum.go | 231 ++++++++ template_forums.go | 146 +++++ template_list.go | 1051 +++++++++++++++++++++++++++++++++++ template_profile.go | 189 +++++++ template_topic.go | 324 +++++++++++ template_topic_alt.go | 330 +++++++++++ template_topics.go | 227 ++++++++ 13 files changed, 2520 insertions(+), 8 deletions(-) create mode 100644 template_forum.go create mode 100644 template_forums.go create mode 100644 template_list.go create mode 100644 template_profile.go create mode 100644 template_topic.go create mode 100644 template_topic_alt.go create mode 100644 template_topics.go diff --git a/common/forum.go b/common/forum.go index a643bb13..7753e4fb 100644 --- a/common/forum.go +++ b/common/forum.go @@ -104,7 +104,7 @@ func (sf SortForum) Less(i, j int) bool { } // ! Don't use this outside of tests and possibly template_init.go -func makeDummyForum(fid int, link string, name string, desc string, active bool, preset string, parentID int, parentType string, topicCount int) *Forum { +func BlankForum(fid int, link string, name string, desc string, active bool, preset string, parentID int, parentType string, topicCount int) *Forum { return &Forum{ID: fid, Link: link, Name: name, Desc: desc, Active: active, Preset: preset, ParentID: parentID, ParentType: parentType, TopicCount: topicCount} } diff --git a/common/routes_common.go b/common/routes_common.go index effbbb9f..3656fa30 100644 --- a/common/routes_common.go +++ b/common/routes_common.go @@ -268,7 +268,7 @@ func preRoute(w http.ResponseWriter, r *http.Request) (User, bool) { return *user, true } - var usercpy *User + var usercpy *User = BlankUser() *usercpy = *user // TODO: WIP. Refactor this to eliminate the unnecessary query diff --git a/common/template_init.go b/common/template_init.go index 248aa370..d0704eb1 100644 --- a/common/template_init.go +++ b/common/template_init.go @@ -156,7 +156,7 @@ func compileTemplates() error { //var topicList []TopicUser //topicList = append(topicList,TopicUser{1,"topic-title","Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"classname","","admin-fred","Admin Fred",config.DefaultGroup,"",0,"","","","",58,false}) - forumItem := makeDummyForum(1, "general-forum.1", "General Forum", "Where the general stuff happens", true, "all", 0, "", 0) + forumItem := BlankForum(1, "general-forum.1", "General Forum", "Where the general stuff happens", true, "all", 0, "", 0) forumPage := ForumPage{"General Forum", user, headerVars, topicsList, forumItem, 1, 1} forumTmpl, err := c.Compile("forum.html", "templates/", "ForumPage", forumPage, varList) if err != nil { @@ -164,6 +164,9 @@ func compileTemplates() error { } // Let plugins register their own templates + if Dev.DebugMode { + log.Print("Registering the templates for the plugins") + } for _, tmplfunc := range PrebuildTmplList { tmplItem := tmplfunc(user, headerVars) varList = make(map[string]tmpl.VarItem) @@ -198,11 +201,14 @@ func writeTemplate(name string, content string) { } } -func InitTemplates() { +func InitTemplates() error { if Dev.DebugMode { log.Print("Initialising the template system") } - compileTemplates() + err := compileTemplates() + if err != nil { + return err + } // TODO: Add support for 64-bit integers // TODO: Add support for floats @@ -269,4 +275,6 @@ func InitTemplates() { Templates.Funcs(fmap) template.Must(Templates.ParseGlob("templates/*")) template.Must(Templates.ParseGlob("pages/*")) + + return nil } diff --git a/extend/guilds/lib/guilds.go b/extend/guilds/lib/guilds.go index bb9b1572..e2f9321f 100644 --- a/extend/guilds/lib/guilds.go +++ b/extend/guilds/lib/guilds.go @@ -110,7 +110,7 @@ func PrebuildTmplList(user common.User, headerVars *common.HeaderVars) common.CT }, } listPage := ListPage{"Guild List", user, headerVars, guildList} - return common.CTmpl{"guilds-guild-list", "guilds_guild_list", "templates/", "guilds.ListPage", listPage} + return common.CTmpl{"guilds_guild_list", "guilds_guild_list.html", "templates/", "guilds.ListPage", listPage} } // TODO: Do this properly via the widget system diff --git a/general_test.go b/general_test.go index ae9f60fe..d13c0f74 100644 --- a/general_test.go +++ b/general_test.go @@ -95,7 +95,10 @@ func gloinit() (err error) { // return err //} - initTemplates() + err = initTemplates() + if err != nil { + return err + } dbProd.SetMaxOpenConns(64) err = initPhrases() diff --git a/main.go b/main.go index 312f8f54..51afa429 100644 --- a/main.go +++ b/main.go @@ -99,7 +99,10 @@ func main() { log.Fatal(err) } - common.InitTemplates() + err = common.InitTemplates() + if err != nil { + log.Fatal(err) + } err = common.InitPhrases() if err != nil { diff --git a/template_forum.go b/template_forum.go new file mode 100644 index 00000000..9aa69046 --- /dev/null +++ b/template_forum.go @@ -0,0 +1,231 @@ +// +build !no_templategen + +// Code generated by Gosora. More below: +/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ +package main +import "net/http" +import "./common" +import "strconv" + +// nolint +func init() { + template_forum_handle = template_forum + //o_template_forum_handle = template_forum + ctemplates = append(ctemplates,"forum") + TmplPtrMap["forum"] = &template_forum_handle + common.TmplPtrMap["o_forum"] = template_forum +} + +// nolint +func template_forum(tmpl_forum_vars ForumPage, w http.ResponseWriter) error { +w.Write(header_0) +w.Write([]byte(tmpl_forum_vars.Title)) +w.Write(header_1) +w.Write([]byte(tmpl_forum_vars.Header.Site.Name)) +w.Write(header_2) +w.Write([]byte(tmpl_forum_vars.Header.ThemeName)) +w.Write(header_3) +if len(tmpl_forum_vars.Header.Stylesheets) != 0 { +for _, item := range tmpl_forum_vars.Header.Stylesheets { +w.Write(header_4) +w.Write([]byte(item)) +w.Write(header_5) +} +} +w.Write(header_6) +if len(tmpl_forum_vars.Header.Scripts) != 0 { +for _, item := range tmpl_forum_vars.Header.Scripts { +w.Write(header_7) +w.Write([]byte(item)) +w.Write(header_8) +} +} +w.Write(header_9) +w.Write([]byte(tmpl_forum_vars.CurrentUser.Session)) +w.Write(header_10) +w.Write([]byte(tmpl_forum_vars.Header.Site.URL)) +w.Write(header_11) +if !tmpl_forum_vars.CurrentUser.IsSuperMod { +w.Write(header_12) +} +w.Write(header_13) +w.Write(menu_0) +w.Write(menu_1) +w.Write([]byte(tmpl_forum_vars.Header.Site.ShortName)) +w.Write(menu_2) +if tmpl_forum_vars.CurrentUser.Loggedin { +w.Write(menu_3) +w.Write([]byte(tmpl_forum_vars.CurrentUser.Link)) +w.Write(menu_4) +w.Write([]byte(tmpl_forum_vars.CurrentUser.Session)) +w.Write(menu_5) +} else { +w.Write(menu_6) +} +w.Write(menu_7) +w.Write(header_14) +if tmpl_forum_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_15) +} +w.Write(header_16) +if len(tmpl_forum_vars.Header.NoticeList) != 0 { +for _, item := range tmpl_forum_vars.Header.NoticeList { +w.Write(header_17) +w.Write([]byte(item)) +w.Write(header_18) +} +} +if tmpl_forum_vars.Page > 1 { +w.Write(forum_0) +w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) +w.Write(forum_1) +w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1))) +w.Write(forum_2) +} +if tmpl_forum_vars.LastPage != tmpl_forum_vars.Page { +w.Write(forum_3) +w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) +w.Write(forum_4) +w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1))) +w.Write(forum_5) +w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) +w.Write(forum_6) +w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1))) +w.Write(forum_7) +} +w.Write(forum_8) +if tmpl_forum_vars.CurrentUser.ID != 0 { +w.Write(forum_9) +} +w.Write(forum_10) +w.Write([]byte(tmpl_forum_vars.Title)) +w.Write(forum_11) +if tmpl_forum_vars.CurrentUser.ID != 0 { +if tmpl_forum_vars.CurrentUser.Perms.CreateTopic { +w.Write(forum_12) +w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) +w.Write(forum_13) +w.Write(forum_14) +} else { +w.Write(forum_15) +} +w.Write(forum_16) +} +w.Write(forum_17) +if tmpl_forum_vars.CurrentUser.ID != 0 { +w.Write(forum_18) +if tmpl_forum_vars.CurrentUser.Perms.CreateTopic { +w.Write(forum_19) +if tmpl_forum_vars.CurrentUser.Avatar != "" { +w.Write(forum_20) +w.Write([]byte(tmpl_forum_vars.CurrentUser.Avatar)) +w.Write(forum_21) +} +w.Write(forum_22) +w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) +w.Write(forum_23) +if tmpl_forum_vars.CurrentUser.Perms.UploadFiles { +w.Write(forum_24) +} +w.Write(forum_25) +} +} +w.Write(forum_26) +if len(tmpl_forum_vars.ItemList) != 0 { +for _, item := range tmpl_forum_vars.ItemList { +w.Write(forum_27) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(forum_28) +if item.Sticky { +w.Write(forum_29) +} else { +if item.IsClosed { +w.Write(forum_30) +} +} +w.Write(forum_31) +if item.Creator.Avatar != "" { +w.Write(forum_32) +w.Write([]byte(item.Creator.Link)) +w.Write(forum_33) +w.Write([]byte(item.Creator.Avatar)) +w.Write(forum_34) +} +w.Write(forum_35) +w.Write([]byte(item.Link)) +w.Write(forum_36) +w.Write([]byte(item.Title)) +w.Write(forum_37) +w.Write([]byte(item.Creator.Link)) +w.Write(forum_38) +w.Write([]byte(item.Creator.Name)) +w.Write(forum_39) +if item.IsClosed { +w.Write(forum_40) +} +if item.Sticky { +w.Write(forum_41) +} +w.Write(forum_42) +w.Write([]byte(strconv.Itoa(item.PostCount))) +w.Write(forum_43) +w.Write([]byte(strconv.Itoa(item.LikeCount))) +w.Write(forum_44) +if item.Sticky { +w.Write(forum_45) +} else { +if item.IsClosed { +w.Write(forum_46) +} +} +w.Write(forum_47) +if item.LastUser.Avatar != "" { +w.Write(forum_48) +w.Write([]byte(item.LastUser.Link)) +w.Write(forum_49) +w.Write([]byte(item.LastUser.Avatar)) +w.Write(forum_50) +} +w.Write(forum_51) +w.Write([]byte(item.LastUser.Link)) +w.Write(forum_52) +w.Write([]byte(item.LastUser.Name)) +w.Write(forum_53) +w.Write([]byte(item.RelativeLastReplyAt)) +w.Write(forum_54) +} +} else { +w.Write(forum_55) +if tmpl_forum_vars.CurrentUser.Perms.CreateTopic { +w.Write(forum_56) +w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID))) +w.Write(forum_57) +} +w.Write(forum_58) +} +w.Write(forum_59) +w.Write(footer_0) +if len(tmpl_forum_vars.Header.Themes) != 0 { +for _, item := range tmpl_forum_vars.Header.Themes { +if !item.HideFromThemes { +w.Write(footer_1) +w.Write([]byte(item.Name)) +w.Write(footer_2) +if tmpl_forum_vars.Header.ThemeName == item.Name { +w.Write(footer_3) +} +w.Write(footer_4) +w.Write([]byte(item.FriendlyName)) +w.Write(footer_5) +} +} +} +w.Write(footer_6) +if tmpl_forum_vars.Header.Widgets.RightSidebar != "" { +w.Write(footer_7) +w.Write([]byte(string(tmpl_forum_vars.Header.Widgets.RightSidebar))) +w.Write(footer_8) +} +w.Write(footer_9) + return nil +} diff --git a/template_forums.go b/template_forums.go new file mode 100644 index 00000000..42b4b2e8 --- /dev/null +++ b/template_forums.go @@ -0,0 +1,146 @@ +// +build !no_templategen + +// Code generated by Gosora. More below: +/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ +package main +import "./common" +import "net/http" + +// nolint +func init() { + template_forums_handle = template_forums + //o_template_forums_handle = template_forums + ctemplates = append(ctemplates,"forums") + TmplPtrMap["forums"] = &template_forums_handle + common.TmplPtrMap["o_forums"] = template_forums +} + +// nolint +func template_forums(tmpl_forums_vars ForumsPage, w http.ResponseWriter) error { +w.Write(header_0) +w.Write([]byte(tmpl_forums_vars.Title)) +w.Write(header_1) +w.Write([]byte(tmpl_forums_vars.Header.Site.Name)) +w.Write(header_2) +w.Write([]byte(tmpl_forums_vars.Header.ThemeName)) +w.Write(header_3) +if len(tmpl_forums_vars.Header.Stylesheets) != 0 { +for _, item := range tmpl_forums_vars.Header.Stylesheets { +w.Write(header_4) +w.Write([]byte(item)) +w.Write(header_5) +} +} +w.Write(header_6) +if len(tmpl_forums_vars.Header.Scripts) != 0 { +for _, item := range tmpl_forums_vars.Header.Scripts { +w.Write(header_7) +w.Write([]byte(item)) +w.Write(header_8) +} +} +w.Write(header_9) +w.Write([]byte(tmpl_forums_vars.CurrentUser.Session)) +w.Write(header_10) +w.Write([]byte(tmpl_forums_vars.Header.Site.URL)) +w.Write(header_11) +if !tmpl_forums_vars.CurrentUser.IsSuperMod { +w.Write(header_12) +} +w.Write(header_13) +w.Write(menu_0) +w.Write(menu_1) +w.Write([]byte(tmpl_forums_vars.Header.Site.ShortName)) +w.Write(menu_2) +if tmpl_forums_vars.CurrentUser.Loggedin { +w.Write(menu_3) +w.Write([]byte(tmpl_forums_vars.CurrentUser.Link)) +w.Write(menu_4) +w.Write([]byte(tmpl_forums_vars.CurrentUser.Session)) +w.Write(menu_5) +} else { +w.Write(menu_6) +} +w.Write(menu_7) +w.Write(header_14) +if tmpl_forums_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_15) +} +w.Write(header_16) +if len(tmpl_forums_vars.Header.NoticeList) != 0 { +for _, item := range tmpl_forums_vars.Header.NoticeList { +w.Write(header_17) +w.Write([]byte(item)) +w.Write(header_18) +} +} +w.Write(forums_0) +if len(tmpl_forums_vars.ItemList) != 0 { +for _, item := range tmpl_forums_vars.ItemList { +w.Write(forums_1) +if item.Desc != "" || item.LastTopic.Title != "" { +w.Write(forums_2) +} +w.Write(forums_3) +w.Write([]byte(item.Link)) +w.Write(forums_4) +w.Write([]byte(item.Name)) +w.Write(forums_5) +if item.Desc != "" { +w.Write(forums_6) +w.Write([]byte(item.Desc)) +w.Write(forums_7) +} else { +w.Write(forums_8) +} +w.Write(forums_9) +if item.LastReplyer.Avatar != "" { +w.Write(forums_10) +w.Write([]byte(item.LastReplyer.Avatar)) +w.Write(forums_11) +} +w.Write(forums_12) +w.Write([]byte(item.LastTopic.Link)) +w.Write(forums_13) +if item.LastTopic.Title != "" { +w.Write([]byte(item.LastTopic.Title)) +} else { +w.Write(forums_14) +} +w.Write(forums_15) +if item.LastTopicTime != "" { +w.Write(forums_16) +w.Write([]byte(item.LastTopicTime)) +w.Write(forums_17) +} +w.Write(forums_18) +} +} else { +w.Write(forums_19) +} +w.Write(forums_20) +w.Write(footer_0) +if len(tmpl_forums_vars.Header.Themes) != 0 { +for _, item := range tmpl_forums_vars.Header.Themes { +if !item.HideFromThemes { +w.Write(footer_1) +w.Write([]byte(item.Name)) +w.Write(footer_2) +if tmpl_forums_vars.Header.ThemeName == item.Name { +w.Write(footer_3) +} +w.Write(footer_4) +w.Write([]byte(item.FriendlyName)) +w.Write(footer_5) +} +} +} +w.Write(footer_6) +if tmpl_forums_vars.Header.Widgets.RightSidebar != "" { +w.Write(footer_7) +w.Write([]byte(string(tmpl_forums_vars.Header.Widgets.RightSidebar))) +w.Write(footer_8) +} +w.Write(footer_9) + return nil +} diff --git a/template_list.go b/template_list.go new file mode 100644 index 00000000..5676da27 --- /dev/null +++ b/template_list.go @@ -0,0 +1,1051 @@ +package main + +// nolint +var header_0 = []byte(` + + + `) +var header_1 = []byte(` | `) +var header_2 = []byte(` + + `) +var header_4 = []byte(` + + `) +var header_6 = []byte(` + + `) +var header_7 = []byte(` + + `) +var header_9 = []byte(` + + + + + + +
+`) +var menu_0 = []byte(` +`) +var header_14 = []byte(` +
+`) +var header_17 = []byte(`
`) +var header_18 = []byte(`
`) +var topic_0 = []byte(` + +
+`) +var topic_2 = []byte(` +`) +var topic_7 = []byte(` +
+ +
`) +var topic_12 = []byte(` + +
+ +
+
+

`) +var topic_16 = []byte(`

+ `) +var topic_17 = []byte(`🔒︎`) +var topic_18 = []byte(` + + + `) +var topic_20 = []byte(` +
+
+ +
+
+

`) +var topic_28 = []byte(`

+ + + + +    + `) +var topic_32 = []byte(` + `) +var topic_36 = []byte(``) +var topic_38 = []byte(``) +var topic_40 = []byte(``) +var topic_42 = []byte(``) +var topic_44 = []byte(``) +var topic_46 = []byte(``) +var topic_48 = []byte(``) +var topic_50 = []byte(` + + + `) +var topic_53 = []byte(``) +var topic_55 = []byte(``) +var topic_56 = []byte(``) +var topic_57 = []byte(``) +var topic_58 = []byte(``) +var topic_59 = []byte(` + + +
+
+ +
`) +var topic_60 = []byte(` +
+ `) +var topic_61 = []byte(` + `) +var topic_62 = []byte(` +
+`) +var topic_63 = []byte(` + +`) +var topic_95 = []byte(`
+ +`) +var topic_96 = []byte(` +
+
+ +
+
+ +
+
+
+
+ + `) +var topic_98 = []byte(` + + +
`) +var topic_99 = []byte(` +
+
+
+`) +var topic_100 = []byte(` + +
+ +`) +var footer_0 = []byte(` +
+ `) +var footer_7 = []byte(``) +var footer_9 = []byte(` +
+
+
+ + +`) +var topic_alt_0 = []byte(` +
`) +var topic_alt_5 = []byte(` +
`) +var topic_alt_10 = []byte(` + +
+ +
+
+
+

`) +var topic_alt_15 = []byte(`

+ `) +var topic_alt_16 = []byte(`🔒︎`) +var topic_alt_17 = []byte(` + + + `) +var topic_alt_19 = []byte(` +
+
+
+ +
+
+
+
 
+ + `) +var topic_alt_23 = []byte(`
`) +var topic_alt_25 = []byte(`
`) +var topic_alt_27 = []byte(` +
+
+
`) +var topic_alt_28 = []byte(`
+ +
+ `) +var topic_alt_30 = []byte(``) +var topic_alt_32 = []byte(`Edit`) +var topic_alt_34 = []byte(`Delete`) +var topic_alt_36 = []byte(`Unlock`) +var topic_alt_38 = []byte(`Lock`) +var topic_alt_40 = []byte(`Unpin`) +var topic_alt_42 = []byte(`Pin`) +var topic_alt_44 = []byte(` + Report + `) +var topic_alt_47 = []byte(` +
+ `) +var topic_alt_48 = []byte(``) +var topic_alt_50 = []byte(` + `) +var topic_alt_51 = []byte(` + `) +var topic_alt_52 = []byte(``) +var topic_alt_53 = []byte(``) +var topic_alt_54 = []byte(` +
+
+
+
+ + `) +var topic_alt_55 = []byte(` +
+
+
 
+ + `) +var topic_alt_61 = []byte(`
`) +var topic_alt_63 = []byte(`
`) +var topic_alt_65 = []byte(` +
+
+ `) +var topic_alt_68 = []byte(` + `) +var topic_alt_69 = []byte(` + `) +var topic_alt_70 = []byte(` + `) +var topic_alt_71 = []byte(` +
`) +var topic_alt_72 = []byte(`
+
+ `) +var topic_alt_73 = []byte(``) +var topic_alt_75 = []byte(`Edit`) +var topic_alt_77 = []byte(`Delete`) +var topic_alt_79 = []byte(` + Report + `) +var topic_alt_82 = []byte(` +
+ `) +var topic_alt_83 = []byte(``) +var topic_alt_85 = []byte(` + `) +var topic_alt_86 = []byte(` + `) +var topic_alt_87 = []byte(``) +var topic_alt_88 = []byte(``) +var topic_alt_89 = []byte(` +
+
+ `) +var topic_alt_90 = []byte(` +
+
+
+`) +var topic_alt_91 = []byte(`
+ +`) +var topic_alt_92 = []byte(` +
+
+
 
+ + `) +var topic_alt_96 = []byte(`
`) +var topic_alt_98 = []byte(`
`) +var topic_alt_100 = []byte(` +
+
+
+ +
+
+ +
+
+
+
+ + `) +var topic_alt_102 = []byte(` + + +
`) +var topic_alt_103 = []byte(` +
+
+
+
+`) +var topic_alt_104 = []byte(` + +
+ +`) +var profile_0 = []byte(` + +
+ +
+ +
+
+ +
+
+ `) +var profile_2 = []byte(``) +var profile_3 = []byte(``) +var profile_4 = []byte(``) +var profile_5 = []byte(` +
+
+ + `) +var profile_6 = []byte(`
+ `) +var profile_7 = []byte(`Unban + `) +var profile_10 = []byte(`Ban`) +var profile_11 = []byte(` +
`) +var profile_12 = []byte(` +
+ Report +
+
+
+
+ +
+ `) +var profile_15 = []byte(` + + + + `) +var profile_19 = []byte(` + +
+

Comments

+
+
`) +var profile_20 = []byte(` +
+ `) +var profile_27 = []byte(` + + `) +var profile_29 = []byte(`   + + `) +var profile_30 = []byte(` + + `) +var profile_33 = []byte(` + + + + `) +var profile_36 = []byte(``) +var profile_37 = []byte(``) +var profile_38 = []byte(` + +
+ `) +var profile_39 = []byte(`
+ +`) +var profile_40 = []byte(` +
+ +
+
+
+
+
+
+
+
+
+`) +var profile_42 = []byte(` +
+ +
+ +`) +var profile_43 = []byte(` + + +`) +var forums_0 = []byte(` +
+ +
+

Forums

+
+
+ `) +var forums_1 = []byte(`
+ + `) +var forums_5 = []byte(` + `) +var forums_6 = []byte(` +
`) +var forums_7 = []byte(` + `) +var forums_8 = []byte(` +
No description + `) +var forums_9 = []byte(` +
+ + + `) +var forums_10 = []byte(``) +var forums_12 = []byte(` + + `) +var forums_14 = []byte(`None`) +var forums_15 = []byte(` + `) +var forums_16 = []byte(`
`) +var forums_17 = []byte(``) +var forums_18 = []byte(` +
+
+
+
+ `) +var forums_19 = []byte(`
You don't have access to any forums.
`) +var forums_20 = []byte(` +
+ +
+`) +var topics_0 = []byte(` +
+ +
+

All Topics

+ `) +var topics_3 = []byte(` +
+
+ `) +var topics_4 = []byte(` +
+ +
+ `) +var topics_5 = []byte(`
`) +var topics_6 = []byte(` +
+ `) +var topics_7 = []byte(` +
+ +`) +var topics_8 = []byte(` +
+
+
+ What do you want to do with these 18 topics? +
+
+ + +
+
+
+ +`) +var topics_9 = []byte(` + + `) +var topics_21 = []byte(` +
+ `) +var topics_22 = []byte(`
+
+ + `) +var topics_27 = []byte(``) +var topics_30 = []byte(` + + `) +var topics_32 = []byte(` `) +var topics_33 = []byte(``) +var topics_35 = []byte(``) +var topics_36 = []byte(` +
`) +var topics_38 = []byte(` + `) +var topics_39 = []byte(` | 🔒︎`) +var topics_40 = []byte(` | 📍︎`) +var topics_41 = []byte(` +
+ + `) +var topics_42 = []byte(`
+ `) +var topics_43 = []byte(` +
+
+
+ `) +var topics_47 = []byte(``) +var topics_50 = []byte(` + + `) +var topics_52 = []byte(`
+ `) +var topics_53 = []byte(` +
+
+
`) +var topics_54 = []byte(`
There aren't any topics yet.`) +var topics_55 = []byte(` Start one?`) +var topics_56 = []byte(`
`) +var topics_57 = []byte(` +
+ +
+`) +var forum_0 = []byte(`
`) +var forum_3 = []byte(` +
`) +var forum_8 = []byte(` + +
+ +
+

`) +var forum_11 = []byte(`

+
+ `) +var forum_12 = []byte(` +
+
+ `) +var forum_14 = []byte(` +
+ +
+ `) +var forum_15 = []byte(`
`) +var forum_16 = []byte(` +
+ `) +var forum_17 = []byte(` +
+`) +var forum_18 = []byte(` +
+
+
+ What do you want to do with these 18 topics? +
+
+ + +
+
+
+ +`) +var forum_19 = []byte(` + +`) +var forum_26 = []byte(` +
+ `) +var forum_27 = []byte(`
+
+ + `) +var forum_32 = []byte(``) +var forum_35 = []byte(` + + `) +var forum_37 = []byte(` +
`) +var forum_39 = []byte(` + `) +var forum_40 = []byte(` | 🔒︎`) +var forum_41 = []byte(` | 📍︎`) +var forum_42 = []byte(` +
+ + `) +var forum_43 = []byte(`
+ `) +var forum_44 = []byte(` +
+
+
+ `) +var forum_48 = []byte(``) +var forum_51 = []byte(` + + `) +var forum_53 = []byte(`
+ `) +var forum_54 = []byte(` +
+
+
`) +var forum_55 = []byte(`
There aren't any topics in this forum yet.`) +var forum_56 = []byte(` Start one?`) +var forum_58 = []byte(`
`) +var forum_59 = []byte(` +
+ +
+`) +var guilds_guild_list_0 = []byte(` +
+ +
+ `) +var guilds_guild_list_1 = []byte(`
+ + `) +var guilds_guild_list_3 = []byte(` +
`) +var guilds_guild_list_4 = []byte(` +
+ + `) +var guilds_guild_list_5 = []byte(` members +
`) +var guilds_guild_list_6 = []byte(` +
+
+
+ `) +var guilds_guild_list_7 = []byte(`
There aren't any visible guilds.
`) +var guilds_guild_list_8 = []byte(` +
+
+`) diff --git a/template_profile.go b/template_profile.go new file mode 100644 index 00000000..a61b9a3b --- /dev/null +++ b/template_profile.go @@ -0,0 +1,189 @@ +// +build !no_templategen + +// Code generated by Gosora. More below: +/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ +package main +import "strconv" +import "net/http" +import "./common" + +// nolint +func init() { + template_profile_handle = template_profile + //o_template_profile_handle = template_profile + ctemplates = append(ctemplates,"profile") + TmplPtrMap["profile"] = &template_profile_handle + common.TmplPtrMap["o_profile"] = template_profile +} + +// nolint +func template_profile(tmpl_profile_vars ProfilePage, w http.ResponseWriter) error { +w.Write(header_0) +w.Write([]byte(tmpl_profile_vars.Title)) +w.Write(header_1) +w.Write([]byte(tmpl_profile_vars.Header.Site.Name)) +w.Write(header_2) +w.Write([]byte(tmpl_profile_vars.Header.ThemeName)) +w.Write(header_3) +if len(tmpl_profile_vars.Header.Stylesheets) != 0 { +for _, item := range tmpl_profile_vars.Header.Stylesheets { +w.Write(header_4) +w.Write([]byte(item)) +w.Write(header_5) +} +} +w.Write(header_6) +if len(tmpl_profile_vars.Header.Scripts) != 0 { +for _, item := range tmpl_profile_vars.Header.Scripts { +w.Write(header_7) +w.Write([]byte(item)) +w.Write(header_8) +} +} +w.Write(header_9) +w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) +w.Write(header_10) +w.Write([]byte(tmpl_profile_vars.Header.Site.URL)) +w.Write(header_11) +if !tmpl_profile_vars.CurrentUser.IsSuperMod { +w.Write(header_12) +} +w.Write(header_13) +w.Write(menu_0) +w.Write(menu_1) +w.Write([]byte(tmpl_profile_vars.Header.Site.ShortName)) +w.Write(menu_2) +if tmpl_profile_vars.CurrentUser.Loggedin { +w.Write(menu_3) +w.Write([]byte(tmpl_profile_vars.CurrentUser.Link)) +w.Write(menu_4) +w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) +w.Write(menu_5) +} else { +w.Write(menu_6) +} +w.Write(menu_7) +w.Write(header_14) +if tmpl_profile_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_15) +} +w.Write(header_16) +if len(tmpl_profile_vars.Header.NoticeList) != 0 { +for _, item := range tmpl_profile_vars.Header.NoticeList { +w.Write(header_17) +w.Write([]byte(item)) +w.Write(header_18) +} +} +w.Write(profile_0) +w.Write([]byte(tmpl_profile_vars.ProfileOwner.Avatar)) +w.Write(profile_1) +w.Write([]byte(tmpl_profile_vars.ProfileOwner.Name)) +w.Write(profile_2) +if tmpl_profile_vars.ProfileOwner.Tag != "" { +w.Write(profile_3) +w.Write([]byte(tmpl_profile_vars.ProfileOwner.Tag)) +w.Write(profile_4) +} +w.Write(profile_5) +if tmpl_profile_vars.CurrentUser.IsSuperMod && !tmpl_profile_vars.ProfileOwner.IsSuperMod { +w.Write(profile_6) +if tmpl_profile_vars.ProfileOwner.IsBanned { +w.Write(profile_7) +w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) +w.Write(profile_8) +w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) +w.Write(profile_9) +} else { +w.Write(profile_10) +} +w.Write(profile_11) +} +w.Write(profile_12) +w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) +w.Write(profile_13) +w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) +w.Write(profile_14) +if tmpl_profile_vars.CurrentUser.Perms.BanUsers { +w.Write(profile_15) +w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) +w.Write(profile_16) +w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) +w.Write(profile_17) +w.Write(profile_18) +} +w.Write(profile_19) +if len(tmpl_profile_vars.ItemList) != 0 { +for _, item := range tmpl_profile_vars.ItemList { +w.Write(profile_20) +w.Write([]byte(item.ClassName)) +w.Write(profile_21) +if item.Avatar != "" { +w.Write(profile_22) +w.Write([]byte(item.Avatar)) +w.Write(profile_23) +if item.ContentLines <= 5 { +w.Write(profile_24) +} +w.Write(profile_25) +} +w.Write(profile_26) +w.Write([]byte(item.ContentHtml)) +w.Write(profile_27) +w.Write([]byte(item.UserLink)) +w.Write(profile_28) +w.Write([]byte(item.CreatedByName)) +w.Write(profile_29) +if tmpl_profile_vars.CurrentUser.IsMod { +w.Write(profile_30) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(profile_31) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(profile_32) +} +w.Write(profile_33) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(profile_34) +w.Write([]byte(tmpl_profile_vars.CurrentUser.Session)) +w.Write(profile_35) +if item.Tag != "" { +w.Write(profile_36) +w.Write([]byte(item.Tag)) +w.Write(profile_37) +} +w.Write(profile_38) +} +} +w.Write(profile_39) +if !tmpl_profile_vars.CurrentUser.IsBanned { +w.Write(profile_40) +w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID))) +w.Write(profile_41) +} +w.Write(profile_42) +w.Write(profile_43) +w.Write(footer_0) +if len(tmpl_profile_vars.Header.Themes) != 0 { +for _, item := range tmpl_profile_vars.Header.Themes { +if !item.HideFromThemes { +w.Write(footer_1) +w.Write([]byte(item.Name)) +w.Write(footer_2) +if tmpl_profile_vars.Header.ThemeName == item.Name { +w.Write(footer_3) +} +w.Write(footer_4) +w.Write([]byte(item.FriendlyName)) +w.Write(footer_5) +} +} +} +w.Write(footer_6) +if tmpl_profile_vars.Header.Widgets.RightSidebar != "" { +w.Write(footer_7) +w.Write([]byte(string(tmpl_profile_vars.Header.Widgets.RightSidebar))) +w.Write(footer_8) +} +w.Write(footer_9) + return nil +} diff --git a/template_topic.go b/template_topic.go new file mode 100644 index 00000000..c4b85989 --- /dev/null +++ b/template_topic.go @@ -0,0 +1,324 @@ +// +build !no_templategen + +// Code generated by Gosora. More below: +/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ +package main +import "net/http" +import "./common" +import "strconv" + +// nolint +func init() { + template_topic_handle = template_topic + //o_template_topic_handle = template_topic + ctemplates = append(ctemplates,"topic") + TmplPtrMap["topic"] = &template_topic_handle + common.TmplPtrMap["o_topic"] = template_topic +} + +// nolint +func template_topic(tmpl_topic_vars TopicPage, w http.ResponseWriter) error { +w.Write(header_0) +w.Write([]byte(tmpl_topic_vars.Title)) +w.Write(header_1) +w.Write([]byte(tmpl_topic_vars.Header.Site.Name)) +w.Write(header_2) +w.Write([]byte(tmpl_topic_vars.Header.ThemeName)) +w.Write(header_3) +if len(tmpl_topic_vars.Header.Stylesheets) != 0 { +for _, item := range tmpl_topic_vars.Header.Stylesheets { +w.Write(header_4) +w.Write([]byte(item)) +w.Write(header_5) +} +} +w.Write(header_6) +if len(tmpl_topic_vars.Header.Scripts) != 0 { +for _, item := range tmpl_topic_vars.Header.Scripts { +w.Write(header_7) +w.Write([]byte(item)) +w.Write(header_8) +} +} +w.Write(header_9) +w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) +w.Write(header_10) +w.Write([]byte(tmpl_topic_vars.Header.Site.URL)) +w.Write(header_11) +if !tmpl_topic_vars.CurrentUser.IsSuperMod { +w.Write(header_12) +} +w.Write(header_13) +w.Write(menu_0) +w.Write(menu_1) +w.Write([]byte(tmpl_topic_vars.Header.Site.ShortName)) +w.Write(menu_2) +if tmpl_topic_vars.CurrentUser.Loggedin { +w.Write(menu_3) +w.Write([]byte(tmpl_topic_vars.CurrentUser.Link)) +w.Write(menu_4) +w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) +w.Write(menu_5) +} else { +w.Write(menu_6) +} +w.Write(menu_7) +w.Write(header_14) +if tmpl_topic_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_15) +} +w.Write(header_16) +if len(tmpl_topic_vars.Header.NoticeList) != 0 { +for _, item := range tmpl_topic_vars.Header.NoticeList { +w.Write(header_17) +w.Write([]byte(item)) +w.Write(header_18) +} +} +w.Write(topic_0) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_1) +if tmpl_topic_vars.Page > 1 { +w.Write(topic_2) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_3) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1))) +w.Write(topic_4) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_5) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1))) +w.Write(topic_6) +} +if tmpl_topic_vars.LastPage != tmpl_topic_vars.Page { +w.Write(topic_7) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_8) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1))) +w.Write(topic_9) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_10) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1))) +w.Write(topic_11) +} +w.Write(topic_12) +if tmpl_topic_vars.Topic.Sticky { +w.Write(topic_13) +} else { +if tmpl_topic_vars.Topic.IsClosed { +w.Write(topic_14) +} +} +w.Write(topic_15) +w.Write([]byte(tmpl_topic_vars.Topic.Title)) +w.Write(topic_16) +if tmpl_topic_vars.Topic.IsClosed { +w.Write(topic_17) +} +if tmpl_topic_vars.CurrentUser.Perms.EditTopic { +w.Write(topic_18) +w.Write([]byte(tmpl_topic_vars.Topic.Title)) +w.Write(topic_19) +} +w.Write(topic_20) +w.Write([]byte(tmpl_topic_vars.Topic.ClassName)) +w.Write(topic_21) +if tmpl_topic_vars.Topic.Avatar != "" { +w.Write(topic_22) +w.Write([]byte(tmpl_topic_vars.Topic.Avatar)) +w.Write(topic_23) +w.Write([]byte(tmpl_topic_vars.Header.ThemeName)) +w.Write(topic_24) +if tmpl_topic_vars.Topic.ContentLines <= 5 { +w.Write(topic_25) +} +w.Write(topic_26) +} +w.Write(topic_27) +w.Write([]byte(tmpl_topic_vars.Topic.ContentHTML)) +w.Write(topic_28) +w.Write([]byte(tmpl_topic_vars.Topic.Content)) +w.Write(topic_29) +w.Write([]byte(tmpl_topic_vars.Topic.UserLink)) +w.Write(topic_30) +w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName)) +w.Write(topic_31) +if tmpl_topic_vars.CurrentUser.Perms.LikeItem { +w.Write(topic_32) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_33) +if tmpl_topic_vars.Topic.Liked { +w.Write(topic_34) +} +w.Write(topic_35) +} +if tmpl_topic_vars.CurrentUser.Perms.EditTopic { +w.Write(topic_36) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_37) +} +if tmpl_topic_vars.CurrentUser.Perms.DeleteTopic { +w.Write(topic_38) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_39) +} +if tmpl_topic_vars.CurrentUser.Perms.CloseTopic { +if tmpl_topic_vars.Topic.IsClosed { +w.Write(topic_40) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_41) +} else { +w.Write(topic_42) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_43) +} +} +if tmpl_topic_vars.CurrentUser.Perms.PinTopic { +if tmpl_topic_vars.Topic.Sticky { +w.Write(topic_44) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_45) +} else { +w.Write(topic_46) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_47) +} +} +if tmpl_topic_vars.CurrentUser.Perms.ViewIPs { +w.Write(topic_48) +w.Write([]byte(tmpl_topic_vars.Topic.IPAddress)) +w.Write(topic_49) +} +w.Write(topic_50) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_51) +w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) +w.Write(topic_52) +if tmpl_topic_vars.Topic.LikeCount > 0 { +w.Write(topic_53) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount))) +w.Write(topic_54) +} +if tmpl_topic_vars.Topic.Tag != "" { +w.Write(topic_55) +w.Write([]byte(tmpl_topic_vars.Topic.Tag)) +w.Write(topic_56) +} else { +w.Write(topic_57) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level))) +w.Write(topic_58) +} +w.Write(topic_59) +if len(tmpl_topic_vars.ItemList) != 0 { +for _, item := range tmpl_topic_vars.ItemList { +if item.ActionType != "" { +w.Write(topic_60) +w.Write([]byte(item.ActionIcon)) +w.Write(topic_61) +w.Write([]byte(item.ActionType)) +w.Write(topic_62) +} else { +w.Write(topic_63) +w.Write([]byte(item.ClassName)) +w.Write(topic_64) +if item.Avatar != "" { +w.Write(topic_65) +w.Write([]byte(item.Avatar)) +w.Write(topic_66) +w.Write([]byte(tmpl_topic_vars.Header.ThemeName)) +w.Write(topic_67) +if item.ContentLines <= 5 { +w.Write(topic_68) +} +w.Write(topic_69) +} +w.Write(topic_70) +w.Write(topic_71) +w.Write([]byte(item.ContentHtml)) +w.Write(topic_72) +w.Write([]byte(item.UserLink)) +w.Write(topic_73) +w.Write([]byte(item.CreatedByName)) +w.Write(topic_74) +if tmpl_topic_vars.CurrentUser.Perms.LikeItem { +w.Write(topic_75) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_76) +if item.Liked { +w.Write(topic_77) +} +w.Write(topic_78) +} +if tmpl_topic_vars.CurrentUser.Perms.EditReply { +w.Write(topic_79) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_80) +} +if tmpl_topic_vars.CurrentUser.Perms.DeleteReply { +w.Write(topic_81) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_82) +} +if tmpl_topic_vars.CurrentUser.Perms.ViewIPs { +w.Write(topic_83) +w.Write([]byte(item.IPAddress)) +w.Write(topic_84) +} +w.Write(topic_85) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_86) +w.Write([]byte(tmpl_topic_vars.CurrentUser.Session)) +w.Write(topic_87) +if item.LikeCount > 0 { +w.Write(topic_88) +w.Write([]byte(strconv.Itoa(item.LikeCount))) +w.Write(topic_89) +} +if item.Tag != "" { +w.Write(topic_90) +w.Write([]byte(item.Tag)) +w.Write(topic_91) +} else { +w.Write(topic_92) +w.Write([]byte(strconv.Itoa(item.Level))) +w.Write(topic_93) +} +w.Write(topic_94) +} +} +} +w.Write(topic_95) +if tmpl_topic_vars.CurrentUser.Perms.CreateReply { +w.Write(topic_96) +w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID))) +w.Write(topic_97) +if tmpl_topic_vars.CurrentUser.Perms.UploadFiles { +w.Write(topic_98) +} +w.Write(topic_99) +} +w.Write(topic_100) +w.Write(footer_0) +if len(tmpl_topic_vars.Header.Themes) != 0 { +for _, item := range tmpl_topic_vars.Header.Themes { +if !item.HideFromThemes { +w.Write(footer_1) +w.Write([]byte(item.Name)) +w.Write(footer_2) +if tmpl_topic_vars.Header.ThemeName == item.Name { +w.Write(footer_3) +} +w.Write(footer_4) +w.Write([]byte(item.FriendlyName)) +w.Write(footer_5) +} +} +} +w.Write(footer_6) +if tmpl_topic_vars.Header.Widgets.RightSidebar != "" { +w.Write(footer_7) +w.Write([]byte(string(tmpl_topic_vars.Header.Widgets.RightSidebar))) +w.Write(footer_8) +} +w.Write(footer_9) + return nil +} diff --git a/template_topic_alt.go b/template_topic_alt.go new file mode 100644 index 00000000..8ea7d75c --- /dev/null +++ b/template_topic_alt.go @@ -0,0 +1,330 @@ +// +build !no_templategen + +// Code generated by Gosora. More below: +/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ +package main +import "strconv" +import "net/http" +import "./common" + +// nolint +func init() { + template_topic_alt_handle = template_topic_alt + //o_template_topic_alt_handle = template_topic_alt + ctemplates = append(ctemplates,"topic_alt") + TmplPtrMap["topic_alt"] = &template_topic_alt_handle + common.TmplPtrMap["o_topic_alt"] = template_topic_alt +} + +// nolint +func template_topic_alt(tmpl_topic_alt_vars TopicPage, w http.ResponseWriter) error { +w.Write(header_0) +w.Write([]byte(tmpl_topic_alt_vars.Title)) +w.Write(header_1) +w.Write([]byte(tmpl_topic_alt_vars.Header.Site.Name)) +w.Write(header_2) +w.Write([]byte(tmpl_topic_alt_vars.Header.ThemeName)) +w.Write(header_3) +if len(tmpl_topic_alt_vars.Header.Stylesheets) != 0 { +for _, item := range tmpl_topic_alt_vars.Header.Stylesheets { +w.Write(header_4) +w.Write([]byte(item)) +w.Write(header_5) +} +} +w.Write(header_6) +if len(tmpl_topic_alt_vars.Header.Scripts) != 0 { +for _, item := range tmpl_topic_alt_vars.Header.Scripts { +w.Write(header_7) +w.Write([]byte(item)) +w.Write(header_8) +} +} +w.Write(header_9) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) +w.Write(header_10) +w.Write([]byte(tmpl_topic_alt_vars.Header.Site.URL)) +w.Write(header_11) +if !tmpl_topic_alt_vars.CurrentUser.IsSuperMod { +w.Write(header_12) +} +w.Write(header_13) +w.Write(menu_0) +w.Write(menu_1) +w.Write([]byte(tmpl_topic_alt_vars.Header.Site.ShortName)) +w.Write(menu_2) +if tmpl_topic_alt_vars.CurrentUser.Loggedin { +w.Write(menu_3) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Link)) +w.Write(menu_4) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) +w.Write(menu_5) +} else { +w.Write(menu_6) +} +w.Write(menu_7) +w.Write(header_14) +if tmpl_topic_alt_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_15) +} +w.Write(header_16) +if len(tmpl_topic_alt_vars.Header.NoticeList) != 0 { +for _, item := range tmpl_topic_alt_vars.Header.NoticeList { +w.Write(header_17) +w.Write([]byte(item)) +w.Write(header_18) +} +} +if tmpl_topic_alt_vars.Page > 1 { +w.Write(topic_alt_0) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_1) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page - 1))) +w.Write(topic_alt_2) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_3) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page - 1))) +w.Write(topic_alt_4) +} +if tmpl_topic_alt_vars.LastPage != tmpl_topic_alt_vars.Page { +w.Write(topic_alt_5) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_6) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1))) +w.Write(topic_alt_7) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_8) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1))) +w.Write(topic_alt_9) +} +w.Write(topic_alt_10) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_11) +if tmpl_topic_alt_vars.Topic.Sticky { +w.Write(topic_alt_12) +} else { +if tmpl_topic_alt_vars.Topic.IsClosed { +w.Write(topic_alt_13) +} +} +w.Write(topic_alt_14) +w.Write([]byte(tmpl_topic_alt_vars.Topic.Title)) +w.Write(topic_alt_15) +if tmpl_topic_alt_vars.Topic.IsClosed { +w.Write(topic_alt_16) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic { +w.Write(topic_alt_17) +w.Write([]byte(tmpl_topic_alt_vars.Topic.Title)) +w.Write(topic_alt_18) +} +w.Write(topic_alt_19) +w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar)) +w.Write(topic_alt_20) +w.Write([]byte(tmpl_topic_alt_vars.Topic.UserLink)) +w.Write(topic_alt_21) +w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName)) +w.Write(topic_alt_22) +if tmpl_topic_alt_vars.Topic.Tag != "" { +w.Write(topic_alt_23) +w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag)) +w.Write(topic_alt_24) +} else { +w.Write(topic_alt_25) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level))) +w.Write(topic_alt_26) +} +w.Write(topic_alt_27) +w.Write([]byte(tmpl_topic_alt_vars.Topic.ContentHTML)) +w.Write(topic_alt_28) +w.Write([]byte(tmpl_topic_alt_vars.Topic.Content)) +w.Write(topic_alt_29) +if tmpl_topic_alt_vars.CurrentUser.Loggedin { +if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { +w.Write(topic_alt_30) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_31) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic { +w.Write(topic_alt_32) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_33) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteTopic { +w.Write(topic_alt_34) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_35) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.CloseTopic { +if tmpl_topic_alt_vars.Topic.IsClosed { +w.Write(topic_alt_36) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_37) +} else { +w.Write(topic_alt_38) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_39) +} +} +if tmpl_topic_alt_vars.CurrentUser.Perms.PinTopic { +if tmpl_topic_alt_vars.Topic.Sticky { +w.Write(topic_alt_40) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_41) +} else { +w.Write(topic_alt_42) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_43) +} +} +w.Write(topic_alt_44) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_45) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) +w.Write(topic_alt_46) +} +w.Write(topic_alt_47) +if tmpl_topic_alt_vars.Topic.LikeCount > 0 { +w.Write(topic_alt_48) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.LikeCount))) +w.Write(topic_alt_49) +} +w.Write(topic_alt_50) +w.Write([]byte(tmpl_topic_alt_vars.Topic.RelativeCreatedAt)) +w.Write(topic_alt_51) +if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { +w.Write(topic_alt_52) +w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress)) +w.Write(topic_alt_53) +} +w.Write(topic_alt_54) +if len(tmpl_topic_alt_vars.ItemList) != 0 { +for _, item := range tmpl_topic_alt_vars.ItemList { +w.Write(topic_alt_55) +if item.ActionType != "" { +w.Write(topic_alt_56) +} +w.Write(topic_alt_57) +w.Write([]byte(item.Avatar)) +w.Write(topic_alt_58) +w.Write([]byte(item.UserLink)) +w.Write(topic_alt_59) +w.Write([]byte(item.CreatedByName)) +w.Write(topic_alt_60) +if item.Tag != "" { +w.Write(topic_alt_61) +w.Write([]byte(item.Tag)) +w.Write(topic_alt_62) +} else { +w.Write(topic_alt_63) +w.Write([]byte(strconv.Itoa(item.Level))) +w.Write(topic_alt_64) +} +w.Write(topic_alt_65) +if item.ActionType != "" { +w.Write(topic_alt_66) +} +w.Write(topic_alt_67) +if item.ActionType != "" { +w.Write(topic_alt_68) +w.Write([]byte(item.ActionIcon)) +w.Write(topic_alt_69) +w.Write([]byte(item.ActionType)) +w.Write(topic_alt_70) +} else { +w.Write(topic_alt_71) +w.Write([]byte(item.ContentHtml)) +w.Write(topic_alt_72) +if tmpl_topic_alt_vars.CurrentUser.Loggedin { +if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { +w.Write(topic_alt_73) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_alt_74) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply { +w.Write(topic_alt_75) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_alt_76) +} +if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply { +w.Write(topic_alt_77) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_alt_78) +} +w.Write(topic_alt_79) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topic_alt_80) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) +w.Write(topic_alt_81) +} +w.Write(topic_alt_82) +if item.LikeCount > 0 { +w.Write(topic_alt_83) +w.Write([]byte(strconv.Itoa(item.LikeCount))) +w.Write(topic_alt_84) +} +w.Write(topic_alt_85) +w.Write([]byte(item.RelativeCreatedAt)) +w.Write(topic_alt_86) +if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { +w.Write(topic_alt_87) +w.Write([]byte(item.IPAddress)) +w.Write(topic_alt_88) +} +w.Write(topic_alt_89) +} +w.Write(topic_alt_90) +} +} +w.Write(topic_alt_91) +if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply { +w.Write(topic_alt_92) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Avatar)) +w.Write(topic_alt_93) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Link)) +w.Write(topic_alt_94) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Name)) +w.Write(topic_alt_95) +if tmpl_topic_alt_vars.CurrentUser.Tag != "" { +w.Write(topic_alt_96) +w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Tag)) +w.Write(topic_alt_97) +} else { +w.Write(topic_alt_98) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.CurrentUser.Level))) +w.Write(topic_alt_99) +} +w.Write(topic_alt_100) +w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) +w.Write(topic_alt_101) +if tmpl_topic_alt_vars.CurrentUser.Perms.UploadFiles { +w.Write(topic_alt_102) +} +w.Write(topic_alt_103) +} +w.Write(topic_alt_104) +w.Write(footer_0) +if len(tmpl_topic_alt_vars.Header.Themes) != 0 { +for _, item := range tmpl_topic_alt_vars.Header.Themes { +if !item.HideFromThemes { +w.Write(footer_1) +w.Write([]byte(item.Name)) +w.Write(footer_2) +if tmpl_topic_alt_vars.Header.ThemeName == item.Name { +w.Write(footer_3) +} +w.Write(footer_4) +w.Write([]byte(item.FriendlyName)) +w.Write(footer_5) +} +} +} +w.Write(footer_6) +if tmpl_topic_alt_vars.Header.Widgets.RightSidebar != "" { +w.Write(footer_7) +w.Write([]byte(string(tmpl_topic_alt_vars.Header.Widgets.RightSidebar))) +w.Write(footer_8) +} +w.Write(footer_9) + return nil +} diff --git a/template_topics.go b/template_topics.go new file mode 100644 index 00000000..0592fd20 --- /dev/null +++ b/template_topics.go @@ -0,0 +1,227 @@ +// +build !no_templategen + +// Code generated by Gosora. More below: +/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */ +package main +import "./common" +import "strconv" +import "net/http" + +// nolint +func init() { + template_topics_handle = template_topics + //o_template_topics_handle = template_topics + ctemplates = append(ctemplates,"topics") + TmplPtrMap["topics"] = &template_topics_handle + common.TmplPtrMap["o_topics"] = template_topics +} + +// nolint +func template_topics(tmpl_topics_vars TopicsPage, w http.ResponseWriter) error { +w.Write(header_0) +w.Write([]byte(tmpl_topics_vars.Title)) +w.Write(header_1) +w.Write([]byte(tmpl_topics_vars.Header.Site.Name)) +w.Write(header_2) +w.Write([]byte(tmpl_topics_vars.Header.ThemeName)) +w.Write(header_3) +if len(tmpl_topics_vars.Header.Stylesheets) != 0 { +for _, item := range tmpl_topics_vars.Header.Stylesheets { +w.Write(header_4) +w.Write([]byte(item)) +w.Write(header_5) +} +} +w.Write(header_6) +if len(tmpl_topics_vars.Header.Scripts) != 0 { +for _, item := range tmpl_topics_vars.Header.Scripts { +w.Write(header_7) +w.Write([]byte(item)) +w.Write(header_8) +} +} +w.Write(header_9) +w.Write([]byte(tmpl_topics_vars.CurrentUser.Session)) +w.Write(header_10) +w.Write([]byte(tmpl_topics_vars.Header.Site.URL)) +w.Write(header_11) +if !tmpl_topics_vars.CurrentUser.IsSuperMod { +w.Write(header_12) +} +w.Write(header_13) +w.Write(menu_0) +w.Write(menu_1) +w.Write([]byte(tmpl_topics_vars.Header.Site.ShortName)) +w.Write(menu_2) +if tmpl_topics_vars.CurrentUser.Loggedin { +w.Write(menu_3) +w.Write([]byte(tmpl_topics_vars.CurrentUser.Link)) +w.Write(menu_4) +w.Write([]byte(tmpl_topics_vars.CurrentUser.Session)) +w.Write(menu_5) +} else { +w.Write(menu_6) +} +w.Write(menu_7) +w.Write(header_14) +if tmpl_topics_vars.Header.Widgets.RightSidebar != "" { +w.Write(header_15) +} +w.Write(header_16) +if len(tmpl_topics_vars.Header.NoticeList) != 0 { +for _, item := range tmpl_topics_vars.Header.NoticeList { +w.Write(header_17) +w.Write([]byte(item)) +w.Write(header_18) +} +} +w.Write(topics_0) +if tmpl_topics_vars.CurrentUser.ID != 0 { +w.Write(topics_1) +} +w.Write(topics_2) +if tmpl_topics_vars.CurrentUser.ID != 0 { +if len(tmpl_topics_vars.ForumList) != 0 { +w.Write(topics_3) +w.Write(topics_4) +} else { +w.Write(topics_5) +} +w.Write(topics_6) +} +w.Write(topics_7) +if tmpl_topics_vars.CurrentUser.ID != 0 { +w.Write(topics_8) +if len(tmpl_topics_vars.ForumList) != 0 { +w.Write(topics_9) +if tmpl_topics_vars.CurrentUser.Avatar != "" { +w.Write(topics_10) +w.Write([]byte(tmpl_topics_vars.CurrentUser.Avatar)) +w.Write(topics_11) +} +w.Write(topics_12) +if len(tmpl_topics_vars.ForumList) != 0 { +for _, item := range tmpl_topics_vars.ForumList { +w.Write(topics_13) +if item.ID == tmpl_topics_vars.DefaultForum { +w.Write(topics_14) +} +w.Write(topics_15) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topics_16) +w.Write([]byte(item.Name)) +w.Write(topics_17) +} +} +w.Write(topics_18) +if tmpl_topics_vars.CurrentUser.Perms.UploadFiles { +w.Write(topics_19) +} +w.Write(topics_20) +} +} +w.Write(topics_21) +if len(tmpl_topics_vars.TopicList) != 0 { +for _, item := range tmpl_topics_vars.TopicList { +w.Write(topics_22) +w.Write([]byte(strconv.Itoa(item.ID))) +w.Write(topics_23) +if item.Sticky { +w.Write(topics_24) +} else { +if item.IsClosed { +w.Write(topics_25) +} +} +w.Write(topics_26) +if item.Creator.Avatar != "" { +w.Write(topics_27) +w.Write([]byte(item.Creator.Link)) +w.Write(topics_28) +w.Write([]byte(item.Creator.Avatar)) +w.Write(topics_29) +} +w.Write(topics_30) +w.Write([]byte(item.Link)) +w.Write(topics_31) +w.Write([]byte(item.Title)) +w.Write(topics_32) +if item.ForumName != "" { +w.Write(topics_33) +w.Write([]byte(item.ForumLink)) +w.Write(topics_34) +w.Write([]byte(item.ForumName)) +w.Write(topics_35) +} +w.Write(topics_36) +w.Write([]byte(item.Creator.Link)) +w.Write(topics_37) +w.Write([]byte(item.Creator.Name)) +w.Write(topics_38) +if item.IsClosed { +w.Write(topics_39) +} +if item.Sticky { +w.Write(topics_40) +} +w.Write(topics_41) +w.Write([]byte(strconv.Itoa(item.PostCount))) +w.Write(topics_42) +w.Write([]byte(strconv.Itoa(item.LikeCount))) +w.Write(topics_43) +if item.Sticky { +w.Write(topics_44) +} else { +if item.IsClosed { +w.Write(topics_45) +} +} +w.Write(topics_46) +if item.LastUser.Avatar != "" { +w.Write(topics_47) +w.Write([]byte(item.LastUser.Link)) +w.Write(topics_48) +w.Write([]byte(item.LastUser.Avatar)) +w.Write(topics_49) +} +w.Write(topics_50) +w.Write([]byte(item.LastUser.Link)) +w.Write(topics_51) +w.Write([]byte(item.LastUser.Name)) +w.Write(topics_52) +w.Write([]byte(item.RelativeLastReplyAt)) +w.Write(topics_53) +} +} else { +w.Write(topics_54) +if tmpl_topics_vars.CurrentUser.Perms.CreateTopic { +w.Write(topics_55) +} +w.Write(topics_56) +} +w.Write(topics_57) +w.Write(footer_0) +if len(tmpl_topics_vars.Header.Themes) != 0 { +for _, item := range tmpl_topics_vars.Header.Themes { +if !item.HideFromThemes { +w.Write(footer_1) +w.Write([]byte(item.Name)) +w.Write(footer_2) +if tmpl_topics_vars.Header.ThemeName == item.Name { +w.Write(footer_3) +} +w.Write(footer_4) +w.Write([]byte(item.FriendlyName)) +w.Write(footer_5) +} +} +} +w.Write(footer_6) +if tmpl_topics_vars.Header.Widgets.RightSidebar != "" { +w.Write(footer_7) +w.Write([]byte(string(tmpl_topics_vars.Header.Widgets.RightSidebar))) +w.Write(footer_8) +} +w.Write(footer_9) + return nil +}