Fixed the Go Version in the Travis file.
Added the Go and Database versions to the Control Panel Debug Page. Renamed common.TopicsPage to common.TopicListPage. Renamed *HeaderVars to *Header. Added the Paginator struct and refactored the code to use it. io.Writers are now used instead of http.ResponseWriters in transpiled templates for greater flexibility. Added the alert, menu_alerts, and menu_item templates. Added support for more integer types in the arithmetic functions for the transpiled templates. Exported AccSelectBuilder. Added an Each method to AccSelectBuilder. Added column quoting to the order by portions of queries for the MySQL Adapter. Began work on the client side rendering of alerts. Began work on the Menu Manager and associated functionality.
This commit is contained in:
parent
55a0c31bc3
commit
10f4c59cb5
|
@ -1,6 +1,6 @@
|
||||||
language: go
|
language: go
|
||||||
go:
|
go:
|
||||||
- 1.10
|
- "1.10"
|
||||||
- master
|
- master
|
||||||
before_install:
|
before_install:
|
||||||
- cd $HOME
|
- cd $HOME
|
||||||
|
|
16
README.md
16
README.md
|
@ -49,11 +49,6 @@ It's entirely possible that your host might already have MySQL, so you might be
|
||||||
At some point, we'll have releases which you can download, but right now, you'll have to use the `git clone` command as mentioned down in the advanced setup section to download a copy of Gosora.
|
At some point, we'll have releases which you can download, but right now, you'll have to use the `git clone` command as mentioned down in the advanced setup section to download a copy of Gosora.
|
||||||
|
|
||||||
|
|
||||||
# Updating
|
|
||||||
|
|
||||||
The update system is currently under development, however if you have Git installed, then you can run `dev-update.bat` or `dev-update-linux` to update your instance to the latest commit and to update the associated database schema, etc.
|
|
||||||
|
|
||||||
|
|
||||||
# Installation Instructions
|
# Installation Instructions
|
||||||
|
|
||||||
*Linux*
|
*Linux*
|
||||||
|
@ -96,9 +91,9 @@ Several important features for saving memory in the templates system may have to
|
||||||
|
|
||||||
# Advanced Installation
|
# Advanced Installation
|
||||||
|
|
||||||
An example of running the commands directly on Windows. We're looking into reducing the number of commands you need to type, for instance, you could invoke the update-deps batch or shell files to install / update all of the dependencies instead of typing each `get get -u`
|
This section explains how to set things up without running the batch or shell files. For Windows, you will likely have to open up cmd.exe (the app called Command Prompt in Win10) to run these commands inside or something similar, while with Linux you would likely use the Terminal or console.
|
||||||
|
|
||||||
Linux is similar, however you might need to use cd and mv a bit more like in the shell files due to the differences in go build across platforms. Additionally, Linux doesn't require `StackExchange/wmi` or ``/x/sys/windows`
|
Linux is similar, however you might need to use cd and mv a bit more like in the shell files due to the differences in go build across platforms. Additionally, Linux doesn't require `StackExchange/wmi` or `/x/sys/windows`
|
||||||
|
|
||||||
You also need to substitute the `gosora.exe` bits for `./Gosora` on Linux. For more info, you might want to take a gander inside the `./run-linux` and `./install-linux` shell files to see how they're implemented.
|
You also need to substitute the `gosora.exe` bits for `./Gosora` on Linux. For more info, you might want to take a gander inside the `./run-linux` and `./install-linux` shell files to see how they're implemented.
|
||||||
|
|
||||||
|
@ -154,6 +149,13 @@ gosora.exe
|
||||||
I'm looking into minimising the number of go gets for the advanced build and to maybe remove the platform and database engine specific dependencies if possible for those who don't need them.
|
I'm looking into minimising the number of go gets for the advanced build and to maybe remove the platform and database engine specific dependencies if possible for those who don't need them.
|
||||||
|
|
||||||
|
|
||||||
|
# Updating
|
||||||
|
|
||||||
|
The update system is currently under development, however if you have Git installed, then you can run `dev-update.bat` or `dev-update-linux` to update your instance to the latest commit and to update the associated database schema, etc.
|
||||||
|
|
||||||
|
In addition to this, you can update the dependencies without updating Gosora by running `update-deps.bat` or `./update-deps-linux` (.bat is for Windows, the other for Linux as the names would suggest).
|
||||||
|
|
||||||
|
|
||||||
# How do I install plugins?
|
# How do I install plugins?
|
||||||
|
|
||||||
For the default plugins like Markdown and Helloworld, you can find them in the Plugin Manager of your Control Panel. For ones which aren't included by default, you will need to drag them from your /extend/ directory and into the / directory (the root directory of your Gosora installation, where the executable and most of the main Go files are).
|
For the default plugins like Markdown and Helloworld, you can find them in the Plugin Manager of your Control Panel. For ones which aren't included by default, you will need to drag them from your /extend/ directory and into the / directory (the root directory of your Gosora installation, where the executable and most of the main Go files are).
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
|
||||||
"../common"
|
"../common"
|
||||||
|
"../tmpl_gen/client"
|
||||||
"github.com/gopherjs/gopherjs/js"
|
"github.com/gopherjs/gopherjs/js"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,4 +16,14 @@ func main() {
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
})
|
})
|
||||||
|
|
||||||
|
js.Global.Set("renderAlert", func(asid int, path string, msg string, avatar string) string {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
alertItem := common.AlertItem{asid, path, msg, avatar}
|
||||||
|
err := tmpl.Template_alert(alertItem, &buf)
|
||||||
|
if err != nil {
|
||||||
|
println(err.Error())
|
||||||
|
}
|
||||||
|
return string(buf.Bytes())
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: Use the error_buffer variable to construct the system log in the Control Panel. Should we log errors caused by users too? Or just collect statistics on those or do nothing? Intercept recover()? Could we intercept the logger instead here? We might get too much information, if we intercept the logger, maybe make it part of the Debug page?
|
// TODO: Use the error_buffer variable to construct the system log in the Control Panel. Should we log errors caused by users too? Or just collect statistics on those or do nothing? Intercept recover()? Could we intercept the logger instead here? We might get too much information, if we intercept the logger, maybe make it part of the Debug page?
|
||||||
// ? - Should we pass HeaderVars / HeaderLite rather than forcing the errors to pull the global HeaderVars instance?
|
// ? - Should we pass Header / HeaderLite rather than forcing the errors to pull the global Header instance?
|
||||||
var errorBufferMutex sync.RWMutex
|
var errorBufferMutex sync.RWMutex
|
||||||
var errorBuffer []error
|
var errorBuffer []error
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ func LogWarning(err error) {
|
||||||
// InternalError is the main function for handling internal errors, while simultaneously printing out a page for the end-user to let them know that *something* has gone wrong
|
// InternalError is the main function for handling internal errors, while simultaneously printing out a page for the end-user to let them know that *something* has gone wrong
|
||||||
// ? - Add a user parameter?
|
// ? - Add a user parameter?
|
||||||
func InternalError(err error, w http.ResponseWriter, r *http.Request) RouteError {
|
func InternalError(err error, w http.ResponseWriter, r *http.Request) RouteError {
|
||||||
pi := Page{"Internal Server Error", GuestUser, DefaultHeaderVar(), tList, "A problem has occurred in the system."}
|
pi := Page{"Internal Server Error", GuestUser, DefaultHeader(w), tList, "A problem has occurred in the system."}
|
||||||
handleErrorTemplate(w, r, pi)
|
handleErrorTemplate(w, r, pi)
|
||||||
LogError(err)
|
LogError(err)
|
||||||
return HandledRouteError()
|
return HandledRouteError()
|
||||||
|
@ -122,9 +122,8 @@ func SilentInternalErrorXML(err error, w http.ResponseWriter, r *http.Request) R
|
||||||
}
|
}
|
||||||
|
|
||||||
func PreError(errmsg string, w http.ResponseWriter, r *http.Request) RouteError {
|
func PreError(errmsg string, w http.ResponseWriter, r *http.Request) RouteError {
|
||||||
//LogError(errors.New(errmsg))
|
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
pi := Page{"Error", GuestUser, DefaultHeaderVar(), tList, errmsg}
|
pi := Page{"Error", GuestUser, DefaultHeader(w), tList, errmsg}
|
||||||
handleErrorTemplate(w, r, pi)
|
handleErrorTemplate(w, r, pi)
|
||||||
return HandledRouteError()
|
return HandledRouteError()
|
||||||
}
|
}
|
||||||
|
@ -144,9 +143,8 @@ func PreErrorJSQ(errmsg string, w http.ResponseWriter, r *http.Request, isJs boo
|
||||||
|
|
||||||
// LocalError is an error shown to the end-user when something goes wrong and it's not the software's fault
|
// LocalError is an error shown to the end-user when something goes wrong and it's not the software's fault
|
||||||
func LocalError(errmsg string, w http.ResponseWriter, r *http.Request, user User) RouteError {
|
func LocalError(errmsg string, w http.ResponseWriter, r *http.Request, user User) RouteError {
|
||||||
//LogError(errors.New(errmsg))
|
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
pi := Page{"Local Error", user, DefaultHeaderVar(), tList, errmsg}
|
pi := Page{"Local Error", user, DefaultHeader(w), tList, errmsg}
|
||||||
handleErrorTemplate(w, r, pi)
|
handleErrorTemplate(w, r, pi)
|
||||||
return HandledRouteError()
|
return HandledRouteError()
|
||||||
}
|
}
|
||||||
|
@ -168,7 +166,7 @@ func LocalErrorJS(errmsg string, w http.ResponseWriter, r *http.Request) RouteEr
|
||||||
// NoPermissions is an error shown to the end-user when they try to access an area which they aren't authorised to access
|
// NoPermissions is an error shown to the end-user when they try to access an area which they aren't authorised to access
|
||||||
func NoPermissions(w http.ResponseWriter, r *http.Request, user User) RouteError {
|
func NoPermissions(w http.ResponseWriter, r *http.Request, user User) RouteError {
|
||||||
w.WriteHeader(403)
|
w.WriteHeader(403)
|
||||||
pi := Page{"Local Error", user, DefaultHeaderVar(), tList, "You don't have permission to do that."}
|
pi := Page{"Local Error", user, DefaultHeader(w), tList, "You don't have permission to do that."}
|
||||||
handleErrorTemplate(w, r, pi)
|
handleErrorTemplate(w, r, pi)
|
||||||
return HandledRouteError()
|
return HandledRouteError()
|
||||||
}
|
}
|
||||||
|
@ -189,7 +187,7 @@ func NoPermissionsJS(w http.ResponseWriter, r *http.Request, user User) RouteErr
|
||||||
// ? - Is this actually used? Should it be used? A ban in Gosora should be more of a permission revocation to stop them posting rather than something which spits up an error page, right?
|
// ? - Is this actually used? Should it be used? A ban in Gosora should be more of a permission revocation to stop them posting rather than something which spits up an error page, right?
|
||||||
func Banned(w http.ResponseWriter, r *http.Request, user User) RouteError {
|
func Banned(w http.ResponseWriter, r *http.Request, user User) RouteError {
|
||||||
w.WriteHeader(403)
|
w.WriteHeader(403)
|
||||||
pi := Page{"Banned", user, DefaultHeaderVar(), tList, "You have been banned from this site."}
|
pi := Page{"Banned", user, DefaultHeader(w), tList, "You have been banned from this site."}
|
||||||
handleErrorTemplate(w, r, pi)
|
handleErrorTemplate(w, r, pi)
|
||||||
return HandledRouteError()
|
return HandledRouteError()
|
||||||
}
|
}
|
||||||
|
@ -221,7 +219,7 @@ func LoginRequiredJSQ(w http.ResponseWriter, r *http.Request, user User, isJs bo
|
||||||
// LoginRequired is an error shown to the end-user when they try to access an area which requires them to login
|
// LoginRequired is an error shown to the end-user when they try to access an area which requires them to login
|
||||||
func LoginRequired(w http.ResponseWriter, r *http.Request, user User) RouteError {
|
func LoginRequired(w http.ResponseWriter, r *http.Request, user User) RouteError {
|
||||||
w.WriteHeader(401)
|
w.WriteHeader(401)
|
||||||
pi := Page{"Local Error", user, DefaultHeaderVar(), tList, "You need to login to do that."}
|
pi := Page{"Local Error", user, DefaultHeader(w), tList, "You need to login to do that."}
|
||||||
handleErrorTemplate(w, r, pi)
|
handleErrorTemplate(w, r, pi)
|
||||||
return HandledRouteError()
|
return HandledRouteError()
|
||||||
}
|
}
|
||||||
|
@ -237,7 +235,7 @@ func LoginRequiredJS(w http.ResponseWriter, r *http.Request, user User) RouteErr
|
||||||
// ? - Should we add JS and JSQ versions of this?
|
// ? - Should we add JS and JSQ versions of this?
|
||||||
func SecurityError(w http.ResponseWriter, r *http.Request, user User) RouteError {
|
func SecurityError(w http.ResponseWriter, r *http.Request, user User) RouteError {
|
||||||
w.WriteHeader(403)
|
w.WriteHeader(403)
|
||||||
pi := Page{"Security Error", user, DefaultHeaderVar(), tList, "There was a security issue with your request."}
|
pi := Page{"Security Error", user, DefaultHeader(w), tList, "There was a security issue with your request."}
|
||||||
if RunPreRenderHook("pre_render_security_error", w, r, &user, &pi) {
|
if RunPreRenderHook("pre_render_security_error", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -251,28 +249,28 @@ func SecurityError(w http.ResponseWriter, r *http.Request, user User) RouteError
|
||||||
// NotFound is used when the requested page doesn't exist
|
// NotFound is used when the requested page doesn't exist
|
||||||
// ? - Add a JSQ and JS version of this?
|
// ? - Add a JSQ and JS version of this?
|
||||||
// ? - Add a user parameter?
|
// ? - Add a user parameter?
|
||||||
func NotFound(w http.ResponseWriter, r *http.Request, headerVars *HeaderVars) RouteError {
|
func NotFound(w http.ResponseWriter, r *http.Request, header *Header) RouteError {
|
||||||
return CustomError("The requested page doesn't exist.", 404, "Not Found", w, r, headerVars, GuestUser)
|
return CustomError("The requested page doesn't exist.", 404, "Not Found", w, r, header, GuestUser)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomError lets us make custom error types which aren't covered by the generic functions above
|
// CustomError lets us make custom error types which aren't covered by the generic functions above
|
||||||
func CustomError(errmsg string, errcode int, errtitle string, w http.ResponseWriter, r *http.Request, headerVars *HeaderVars, user User) RouteError {
|
func CustomError(errmsg string, errcode int, errtitle string, w http.ResponseWriter, r *http.Request, header *Header, user User) RouteError {
|
||||||
if headerVars == nil {
|
if header == nil {
|
||||||
headerVars = DefaultHeaderVar()
|
header = DefaultHeader(w)
|
||||||
}
|
}
|
||||||
w.WriteHeader(errcode)
|
w.WriteHeader(errcode)
|
||||||
pi := Page{errtitle, user, headerVars, tList, errmsg}
|
pi := Page{errtitle, user, header, tList, errmsg}
|
||||||
handleErrorTemplate(w, r, pi)
|
handleErrorTemplate(w, r, pi)
|
||||||
return HandledRouteError()
|
return HandledRouteError()
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomErrorJSQ is a version of CustomError which lets us handle both JSON and regular pages depending on how it's being accessed
|
// CustomErrorJSQ is a version of CustomError which lets us handle both JSON and regular pages depending on how it's being accessed
|
||||||
func CustomErrorJSQ(errmsg string, errcode int, errtitle string, w http.ResponseWriter, r *http.Request, headerVars *HeaderVars, user User, isJs bool) RouteError {
|
func CustomErrorJSQ(errmsg string, errcode int, errtitle string, w http.ResponseWriter, r *http.Request, header *Header, user User, isJs bool) RouteError {
|
||||||
if !isJs {
|
if !isJs {
|
||||||
if headerVars == nil {
|
if header == nil {
|
||||||
headerVars = DefaultHeaderVar()
|
header = DefaultHeader(w)
|
||||||
}
|
}
|
||||||
return CustomError(errmsg, errcode, errtitle, w, r, headerVars, user)
|
return CustomError(errmsg, errcode, errtitle, w, r, header, user)
|
||||||
}
|
}
|
||||||
return CustomErrorJS(errmsg, errcode, w, r, user)
|
return CustomErrorJS(errmsg, errcode, w, r, user)
|
||||||
}
|
}
|
||||||
|
@ -285,9 +283,8 @@ func CustomErrorJS(errmsg string, errcode int, w http.ResponseWriter, r *http.Re
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleErrorTemplate(w http.ResponseWriter, r *http.Request, pi Page) {
|
func handleErrorTemplate(w http.ResponseWriter, r *http.Request, pi Page) {
|
||||||
//LogError(errors.New("error happened"))
|
|
||||||
// TODO: What to do about this hook?
|
// TODO: What to do about this hook?
|
||||||
if RunPreRenderHook("pre_render_error", w, r, &pi.CurrentUser, &pi) {
|
if RunPreRenderHook("pre_render_error", w, r, &pi.Header.CurrentUser, &pi) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := RunThemeTemplate(pi.Header.Theme.Name, "error", pi, w)
|
err := RunThemeTemplate(pi.Header.Theme.Name, "error", pi, w)
|
||||||
|
|
|
@ -62,7 +62,7 @@ type Message interface {
|
||||||
// While the idea is nice, this might result in too much code duplication, as we have seventy billion page structs, what else could we do to get static typing with these in plugins?
|
// While the idea is nice, this might result in too much code duplication, as we have seventy billion page structs, what else could we do to get static typing with these in plugins?
|
||||||
type PageInt interface {
|
type PageInt interface {
|
||||||
Title() string
|
Title() string
|
||||||
HeaderVars() *HeaderVars
|
Header() *Header
|
||||||
CurrentUser() *User
|
CurrentUser() *User
|
||||||
GetExtData(name string) interface{}
|
GetExtData(name string) interface{}
|
||||||
SetExtData(name string, contents interface{})
|
SetExtData(name string, contents interface{})
|
||||||
|
|
|
@ -0,0 +1,408 @@
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
|
"strconv"
|
||||||
|
"sync/atomic"
|
||||||
|
|
||||||
|
"../query_gen/lib"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Menus *DefaultMenuStore
|
||||||
|
|
||||||
|
type MenuItemList []MenuItem
|
||||||
|
|
||||||
|
type DefaultMenuStore struct {
|
||||||
|
menus map[int]*atomic.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDefaultMenuStore() *DefaultMenuStore {
|
||||||
|
return &DefaultMenuStore{make(map[int]*atomic.Value)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (store *DefaultMenuStore) Get(mid int) *MenuListHolder {
|
||||||
|
aStore, ok := store.menus[mid]
|
||||||
|
if ok {
|
||||||
|
return aStore.Load().(*MenuListHolder)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type MenuListHolder struct {
|
||||||
|
List MenuItemList
|
||||||
|
Variations map[int]menuTmpl // 0 = Guest Menu, 1 = Member Menu, 2 = Super Mod Menu, 3 = Admin Menu
|
||||||
|
}
|
||||||
|
|
||||||
|
type menuTmpl struct {
|
||||||
|
RenderBuffer [][]byte
|
||||||
|
VariableIndices []int
|
||||||
|
}
|
||||||
|
|
||||||
|
type MenuItem struct {
|
||||||
|
ID int
|
||||||
|
HTMLID string
|
||||||
|
CSSClass string
|
||||||
|
Position string
|
||||||
|
Path string
|
||||||
|
Aria string
|
||||||
|
Tooltip string
|
||||||
|
Order int
|
||||||
|
TmplName string
|
||||||
|
|
||||||
|
GuestOnly bool
|
||||||
|
MemberOnly bool
|
||||||
|
SuperModOnly bool
|
||||||
|
AdminOnly bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (store *DefaultMenuStore) Load(mid int) error {
|
||||||
|
var mlist MenuItemList
|
||||||
|
acc := qgen.Builder.Accumulator()
|
||||||
|
err := acc.Select("menu_items").Columns("htmlID, cssClass, position, path, aria, tooltip, order, tmplName, guestOnly, memberOnly, staffOnly, adminOnly").Where("mid = " + strconv.Itoa(mid)).Orderby("order ASC").Each(func(rows *sql.Rows) error {
|
||||||
|
var mitem = MenuItem{ID: 1}
|
||||||
|
err := rows.Scan(&mitem.HTMLID, &mitem.CSSClass, &mitem.Position, &mitem.Path, &mitem.Aria, &mitem.Tooltip, &mitem.Order, &mitem.TmplName, &mitem.GuestOnly, &mitem.MemberOnly, &mitem.SuperModOnly, &mitem.AdminOnly)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mlist = append(mlist, mitem)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
hold := &MenuListHolder{mlist, make(map[int]menuTmpl)}
|
||||||
|
err = hold.Preparse()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var aStore = &atomic.Value{}
|
||||||
|
aStore.Store(hold)
|
||||||
|
store.menus[mid] = aStore
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Run this in main, sync ticks, when the phrase file changes (need to implement the sync for that first), and when the settings are changed
|
||||||
|
func (hold *MenuListHolder) Preparse() error {
|
||||||
|
var tmpls = make(map[string]MenuTmpl)
|
||||||
|
var loadTmpl = func(name string) error {
|
||||||
|
data, err := ioutil.ReadFile("./templates/" + name + ".html")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
tmpls[name] = hold.Parse(name, data)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
err := loadTmpl("menu_item")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = loadTmpl("menu_alerts")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var addVariation = func(index int, callback func(mitem MenuItem) bool) {
|
||||||
|
renderBuffer, variableIndices := hold.Scan(tmpls, callback)
|
||||||
|
hold.Variations[index] = menuTmpl{renderBuffer, variableIndices}
|
||||||
|
fmt.Print("renderBuffer: ")
|
||||||
|
menuDumpSlice(renderBuffer)
|
||||||
|
fmt.Printf("\nvariableIndices: %+v\n", variableIndices)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Guest Menu
|
||||||
|
addVariation(0, func(mitem MenuItem) bool {
|
||||||
|
return !mitem.MemberOnly
|
||||||
|
})
|
||||||
|
// Member Menu
|
||||||
|
addVariation(1, func(mitem MenuItem) bool {
|
||||||
|
return !mitem.SuperModOnly && !mitem.GuestOnly
|
||||||
|
})
|
||||||
|
// Super Mod Menu
|
||||||
|
addVariation(2, func(mitem MenuItem) bool {
|
||||||
|
return !mitem.AdminOnly && !mitem.GuestOnly
|
||||||
|
})
|
||||||
|
// Admin Menu
|
||||||
|
addVariation(3, func(mitem MenuItem) bool {
|
||||||
|
return !mitem.GuestOnly
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func nextCharIs(tmplData []byte, i int, expects byte) bool {
|
||||||
|
if len(tmplData) <= (i + 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return tmplData[i+1] == expects
|
||||||
|
}
|
||||||
|
|
||||||
|
func skipUntilIfExists(tmplData []byte, i int, expects byte) (newI int, hasIt bool) {
|
||||||
|
j := i
|
||||||
|
for ; j < len(tmplData); j++ {
|
||||||
|
if tmplData[j] == expects {
|
||||||
|
return j, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return j, false
|
||||||
|
}
|
||||||
|
|
||||||
|
func skipUntilCharsExist(tmplData []byte, i int, expects []byte) (newI int, hasIt bool) {
|
||||||
|
j := i
|
||||||
|
expectIndex := 0
|
||||||
|
for ; j < len(tmplData) && expectIndex < len(expects); j++ {
|
||||||
|
if tmplData[j] != expects[expectIndex] {
|
||||||
|
return j, false
|
||||||
|
}
|
||||||
|
expectIndex++
|
||||||
|
}
|
||||||
|
return j, true
|
||||||
|
}
|
||||||
|
|
||||||
|
type menuRenderItem struct {
|
||||||
|
Type int // 0: text, 1: variable
|
||||||
|
Index int
|
||||||
|
}
|
||||||
|
|
||||||
|
type MenuTmpl struct {
|
||||||
|
Name string
|
||||||
|
TextBuffer [][]byte
|
||||||
|
VariableBuffer [][]byte
|
||||||
|
RenderList []menuRenderItem
|
||||||
|
}
|
||||||
|
|
||||||
|
func menuDumpSlice(outerSlice [][]byte) {
|
||||||
|
for sliceID, slice := range outerSlice {
|
||||||
|
fmt.Print(strconv.Itoa(sliceID) + ":[")
|
||||||
|
for _, char := range slice {
|
||||||
|
fmt.Print(string(char))
|
||||||
|
}
|
||||||
|
fmt.Print("] ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (hold *MenuListHolder) Parse(name string, tmplData []byte) (menuTmpl MenuTmpl) {
|
||||||
|
//fmt.Println("tmplData: ", string(tmplData))
|
||||||
|
var textBuffer, variableBuffer [][]byte
|
||||||
|
var renderList []menuRenderItem
|
||||||
|
var subBuffer []byte
|
||||||
|
|
||||||
|
// ? We only support simple properties on MenuItem right now
|
||||||
|
var addVariable = func(name []byte) {
|
||||||
|
//fmt.Println("appending subBuffer: ", string(subBuffer))
|
||||||
|
textBuffer = append(textBuffer, subBuffer)
|
||||||
|
subBuffer = nil
|
||||||
|
|
||||||
|
//fmt.Println("adding variable: ", string(name))
|
||||||
|
variableBuffer = append(variableBuffer, name)
|
||||||
|
renderList = append(renderList, menuRenderItem{0, len(textBuffer) - 1})
|
||||||
|
renderList = append(renderList, menuRenderItem{1, len(variableBuffer) - 1})
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(tmplData); i++ {
|
||||||
|
char := tmplData[i]
|
||||||
|
if char == '{' && nextCharIs(tmplData, i, '{') {
|
||||||
|
dotIndex, hasDot := skipUntilIfExists(tmplData, i, '.')
|
||||||
|
if !hasDot {
|
||||||
|
// Template function style
|
||||||
|
langIndex, hasChars := skipUntilCharsExist(tmplData, i+2, []byte("lang"))
|
||||||
|
if hasChars {
|
||||||
|
startIndex, hasStart := skipUntilIfExists(tmplData, langIndex, '"')
|
||||||
|
endIndex, hasEnd := skipUntilIfExists(tmplData, startIndex+1, '"')
|
||||||
|
if hasStart && hasEnd {
|
||||||
|
fenceIndex, hasFence := skipUntilIfExists(tmplData, endIndex, '}')
|
||||||
|
if !hasFence || !nextCharIs(tmplData, fenceIndex, '}') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
//fmt.Println("tmplData[startIndex:endIndex]: ", tmplData[startIndex+1:endIndex])
|
||||||
|
prefix := []byte("lang.")
|
||||||
|
addVariable(append(prefix, tmplData[startIndex+1:endIndex]...))
|
||||||
|
i = fenceIndex + 1
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
fenceIndex, hasFence := skipUntilIfExists(tmplData, dotIndex, '}')
|
||||||
|
if !hasFence || !nextCharIs(tmplData, fenceIndex, '}') {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
addVariable(tmplData[dotIndex:fenceIndex])
|
||||||
|
i = fenceIndex + 1
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
subBuffer = append(subBuffer, char)
|
||||||
|
}
|
||||||
|
if len(subBuffer) > 0 {
|
||||||
|
// TODO: Have a property in renderList which holds the byte slice since variableBuffers and textBuffers have the same underlying implementation?
|
||||||
|
textBuffer = append(textBuffer, subBuffer)
|
||||||
|
renderList = append(renderList, menuRenderItem{0, len(textBuffer) - 1})
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("name: ", name)
|
||||||
|
fmt.Print("textBuffer: ")
|
||||||
|
menuDumpSlice(textBuffer)
|
||||||
|
fmt.Print("\nvariableBuffer: ")
|
||||||
|
menuDumpSlice(variableBuffer)
|
||||||
|
fmt.Printf("\nrenderList: %+v\n", renderList)
|
||||||
|
return MenuTmpl{name, textBuffer, variableBuffer, renderList}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (hold *MenuListHolder) Scan(menuTmpls map[string]MenuTmpl, showItem func(mitem MenuItem) bool) (renderBuffer [][]byte, variableIndices []int) {
|
||||||
|
for _, mitem := range hold.List {
|
||||||
|
// Do we want this item in this variation of the menu?
|
||||||
|
if !showItem(mitem) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
menuTmpl, ok := menuTmpls[mitem.TmplName]
|
||||||
|
if !ok {
|
||||||
|
menuTmpl = menuTmpls["menu_item"]
|
||||||
|
}
|
||||||
|
fmt.Println("menuTmpl: ", menuTmpl)
|
||||||
|
for _, renderItem := range menuTmpl.RenderList {
|
||||||
|
if renderItem.Type == 0 {
|
||||||
|
renderBuffer = append(renderBuffer, menuTmpl.TextBuffer[renderItem.Index])
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
variable := menuTmpl.VariableBuffer[renderItem.Index]
|
||||||
|
fmt.Println("initial variable: ", string(variable))
|
||||||
|
dotAt, hasDot := skipUntilIfExists(variable, 0, '.')
|
||||||
|
if !hasDot {
|
||||||
|
fmt.Println("no dot")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if bytes.Equal(variable[:dotAt], []byte("lang")) {
|
||||||
|
fmt.Println("lang: ", string(bytes.TrimPrefix(variable[dotAt:], []byte("."))))
|
||||||
|
renderBuffer = append(renderBuffer, []byte(GetTmplPhrase(string(bytes.TrimPrefix(variable[dotAt:], []byte("."))))))
|
||||||
|
} else {
|
||||||
|
var renderItem []byte
|
||||||
|
switch string(variable) {
|
||||||
|
case ".HTMLID":
|
||||||
|
renderItem = []byte(mitem.HTMLID)
|
||||||
|
case ".CSSClass":
|
||||||
|
renderItem = []byte(mitem.CSSClass)
|
||||||
|
case ".Position":
|
||||||
|
renderItem = []byte(mitem.Position)
|
||||||
|
case ".Path":
|
||||||
|
renderItem = []byte(mitem.Path)
|
||||||
|
case ".Aria":
|
||||||
|
renderItem = []byte(mitem.Aria)
|
||||||
|
case ".Tooltip":
|
||||||
|
renderItem = []byte(mitem.Tooltip)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, hasInnerVar := skipUntilIfExists(renderItem, 0, '{')
|
||||||
|
if hasInnerVar {
|
||||||
|
fmt.Println("inner var: ", string(renderItem))
|
||||||
|
dotAt, hasDot := skipUntilIfExists(renderItem, 0, '.')
|
||||||
|
endFence, hasEndFence := skipUntilIfExists(renderItem, dotAt, '}')
|
||||||
|
if !hasDot || !hasEndFence || (endFence-dotAt) <= 1 {
|
||||||
|
renderBuffer = append(renderBuffer, renderItem)
|
||||||
|
variableIndices = append(variableIndices, len(renderBuffer)-1)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if bytes.Equal(renderItem[1:dotAt], []byte("lang")) {
|
||||||
|
fmt.Println("lang var: ", string(renderItem[dotAt+1:endFence]))
|
||||||
|
renderBuffer = append(renderBuffer, []byte(GetTmplPhrase(string(renderItem[dotAt+1:endFence]))))
|
||||||
|
} else {
|
||||||
|
fmt.Println("other var: ", string(variable[:dotAt]))
|
||||||
|
if len(renderItem) > 0 {
|
||||||
|
renderBuffer = append(renderBuffer, renderItem)
|
||||||
|
variableIndices = append(variableIndices, len(renderBuffer)-1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("normal var: ", string(variable[:dotAt]))
|
||||||
|
if len(renderItem) > 0 {
|
||||||
|
renderBuffer = append(renderBuffer, renderItem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: Need more coalescing in the renderBuffer
|
||||||
|
return renderBuffer, variableIndices
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Pre-render the lang stuff
|
||||||
|
func (hold *MenuListHolder) Build(w io.Writer, user *User) error {
|
||||||
|
var mTmpl menuTmpl
|
||||||
|
if !user.Loggedin {
|
||||||
|
mTmpl = hold.Variations[0]
|
||||||
|
} else if user.IsAdmin {
|
||||||
|
mTmpl = hold.Variations[3]
|
||||||
|
} else if user.IsSuperMod {
|
||||||
|
mTmpl = hold.Variations[2]
|
||||||
|
} else {
|
||||||
|
mTmpl = hold.Variations[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(mTmpl.VariableIndices) == 0 {
|
||||||
|
fmt.Println("no variable indices")
|
||||||
|
for _, renderItem := range mTmpl.RenderBuffer {
|
||||||
|
fmt.Printf("renderItem: %+v\n", renderItem)
|
||||||
|
w.Write(renderItem)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var nearIndex = 0
|
||||||
|
for index, renderItem := range mTmpl.RenderBuffer {
|
||||||
|
if index != mTmpl.VariableIndices[nearIndex] {
|
||||||
|
fmt.Println("wrote text: ", string(renderItem))
|
||||||
|
w.Write(renderItem)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("variable: ", string(renderItem))
|
||||||
|
variable := renderItem
|
||||||
|
// ? - I can probably remove this check now that I've kicked it upstream, or we could keep it here for safety's sake?
|
||||||
|
if len(variable) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
prevIndex := 0
|
||||||
|
for i := 0; i < len(renderItem); i++ {
|
||||||
|
fenceStart, hasFence := skipUntilIfExists(variable, i, '{')
|
||||||
|
if !hasFence {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
i = fenceStart
|
||||||
|
fenceEnd, hasFence := skipUntilIfExists(variable, fenceStart, '}')
|
||||||
|
if !hasFence {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
i = fenceEnd
|
||||||
|
dotAt, hasDot := skipUntilIfExists(variable, fenceStart, '.')
|
||||||
|
if !hasDot {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if bytes.Equal(variable[fenceStart:dotAt], []byte("me")) {
|
||||||
|
fmt.Println("maybe me variable")
|
||||||
|
w.Write(variable[prevIndex:fenceStart])
|
||||||
|
switch string(variable[dotAt:fenceEnd]) {
|
||||||
|
case "Link":
|
||||||
|
w.Write([]byte(user.Link))
|
||||||
|
case "Session":
|
||||||
|
w.Write([]byte(user.Session))
|
||||||
|
}
|
||||||
|
prevIndex = fenceEnd
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Println("prevIndex: ", prevIndex)
|
||||||
|
fmt.Println("len(variable)-1: ", len(variable)-1)
|
||||||
|
w.Write(variable[prevIndex : len(variable)-1])
|
||||||
|
if len(mTmpl.VariableIndices) > (nearIndex + 1) {
|
||||||
|
nearIndex++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
104
common/pages.go
104
common/pages.go
|
@ -9,7 +9,8 @@ import (
|
||||||
|
|
||||||
// TODO: Allow resources in spots other than /static/ and possibly even external domains (e.g. CDNs)
|
// TODO: Allow resources in spots other than /static/ and possibly even external domains (e.g. CDNs)
|
||||||
// TODO: Preload Trumboyg on Cosora on the forum list
|
// TODO: Preload Trumboyg on Cosora on the forum list
|
||||||
type HeaderVars struct {
|
type Header struct {
|
||||||
|
Title string
|
||||||
NoticeList []string
|
NoticeList []string
|
||||||
Scripts []string
|
Scripts []string
|
||||||
//PreloadScripts []string
|
//PreloadScripts []string
|
||||||
|
@ -20,21 +21,22 @@ type HeaderVars struct {
|
||||||
Themes map[string]*Theme // TODO: Use a slice containing every theme instead of the main map for speed?
|
Themes map[string]*Theme // TODO: Use a slice containing every theme instead of the main map for speed?
|
||||||
Theme *Theme
|
Theme *Theme
|
||||||
//TemplateName string // TODO: Use this to move template calls to the router rather than duplicating them over and over and over?
|
//TemplateName string // TODO: Use this to move template calls to the router rather than duplicating them over and over and over?
|
||||||
|
CurrentUser User // TODO: Deprecate CurrentUser on the page structs
|
||||||
Zone string
|
Zone string
|
||||||
MetaDesc string
|
MetaDesc string
|
||||||
Writer http.ResponseWriter
|
Writer http.ResponseWriter
|
||||||
ExtData ExtData
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
func (header *HeaderVars) AddScript(name string) {
|
func (header *Header) AddScript(name string) {
|
||||||
header.Scripts = append(header.Scripts, name)
|
header.Scripts = append(header.Scripts, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*func (header *HeaderVars) PreloadScript(name string) {
|
/*func (header *Header) PreloadScript(name string) {
|
||||||
header.PreloadScripts = append(header.PreloadScripts, name)
|
header.PreloadScripts = append(header.PreloadScripts, name)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
func (header *HeaderVars) AddSheet(name string) {
|
func (header *Header) AddSheet(name string) {
|
||||||
header.Stylesheets = append(header.Stylesheets, name)
|
header.Stylesheets = append(header.Stylesheets, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,18 +59,31 @@ type ExtData struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AlertItem struct {
|
||||||
|
ASID int
|
||||||
|
Path string
|
||||||
|
Message string
|
||||||
|
Avatar string
|
||||||
|
}
|
||||||
|
|
||||||
type Page struct {
|
type Page struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
ItemList []interface{}
|
ItemList []interface{}
|
||||||
Something interface{}
|
Something interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Paginator struct {
|
||||||
|
PageList []int
|
||||||
|
Page int
|
||||||
|
LastPage int
|
||||||
|
}
|
||||||
|
|
||||||
type TopicPage struct {
|
type TopicPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
ItemList []ReplyUser
|
ItemList []ReplyUser
|
||||||
Topic TopicUser
|
Topic TopicUser
|
||||||
Poll Poll
|
Poll Poll
|
||||||
|
@ -76,40 +91,34 @@ type TopicPage struct {
|
||||||
LastPage int
|
LastPage int
|
||||||
}
|
}
|
||||||
|
|
||||||
type TopicsPage struct {
|
type TopicListPage struct {
|
||||||
Title string
|
*Header
|
||||||
CurrentUser User
|
|
||||||
Header *HeaderVars
|
|
||||||
TopicList []*TopicsRow
|
TopicList []*TopicsRow
|
||||||
ForumList []Forum
|
ForumList []Forum
|
||||||
DefaultForum int
|
DefaultForum int
|
||||||
PageList []int
|
Paginator
|
||||||
Page int
|
|
||||||
LastPage int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ForumPage struct {
|
type ForumPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
ItemList []*TopicsRow
|
ItemList []*TopicsRow
|
||||||
Forum *Forum
|
Forum *Forum
|
||||||
PageList []int
|
Paginator
|
||||||
Page int
|
|
||||||
LastPage int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ForumsPage struct {
|
type ForumsPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
ItemList []Forum
|
ItemList []Forum
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProfilePage struct {
|
type ProfilePage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
ItemList []ReplyUser
|
ItemList []ReplyUser
|
||||||
ProfileOwner User
|
ProfileOwner User
|
||||||
}
|
}
|
||||||
|
@ -117,7 +126,7 @@ type ProfilePage struct {
|
||||||
type CreateTopicPage struct {
|
type CreateTopicPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
ItemList []Forum
|
ItemList []Forum
|
||||||
FID int
|
FID int
|
||||||
}
|
}
|
||||||
|
@ -125,7 +134,7 @@ type CreateTopicPage struct {
|
||||||
type IPSearchPage struct {
|
type IPSearchPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
ItemList map[int]*User
|
ItemList map[int]*User
|
||||||
IP string
|
IP string
|
||||||
}
|
}
|
||||||
|
@ -143,7 +152,7 @@ type PanelStats struct {
|
||||||
type PanelPage struct {
|
type PanelPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
ItemList []interface{}
|
ItemList []interface{}
|
||||||
|
@ -163,7 +172,7 @@ type GridElement struct {
|
||||||
type PanelDashboardPage struct {
|
type PanelDashboardPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
GridItems []GridElement
|
GridItems []GridElement
|
||||||
|
@ -182,7 +191,7 @@ type PanelAnalyticsItem struct {
|
||||||
type PanelAnalyticsPage struct {
|
type PanelAnalyticsPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
PrimaryGraph PanelTimeGraph
|
PrimaryGraph PanelTimeGraph
|
||||||
|
@ -198,7 +207,7 @@ type PanelAnalyticsRoutesItem struct {
|
||||||
type PanelAnalyticsRoutesPage struct {
|
type PanelAnalyticsRoutesPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
ItemList []PanelAnalyticsRoutesItem
|
ItemList []PanelAnalyticsRoutesItem
|
||||||
|
@ -214,7 +223,7 @@ type PanelAnalyticsAgentsItem struct {
|
||||||
type PanelAnalyticsAgentsPage struct {
|
type PanelAnalyticsAgentsPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
ItemList []PanelAnalyticsAgentsItem
|
ItemList []PanelAnalyticsAgentsItem
|
||||||
|
@ -224,7 +233,7 @@ type PanelAnalyticsAgentsPage struct {
|
||||||
type PanelAnalyticsRoutePage struct {
|
type PanelAnalyticsRoutePage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
Route string
|
Route string
|
||||||
|
@ -236,7 +245,7 @@ type PanelAnalyticsRoutePage struct {
|
||||||
type PanelAnalyticsAgentPage struct {
|
type PanelAnalyticsAgentPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
Agent string
|
Agent string
|
||||||
|
@ -248,7 +257,7 @@ type PanelAnalyticsAgentPage struct {
|
||||||
type PanelThemesPage struct {
|
type PanelThemesPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
PrimaryThemes []*Theme
|
PrimaryThemes []*Theme
|
||||||
|
@ -258,31 +267,27 @@ type PanelThemesPage struct {
|
||||||
type PanelUserPage struct {
|
type PanelUserPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
ItemList []User
|
ItemList []User
|
||||||
PageList []int
|
Paginator
|
||||||
Page int
|
|
||||||
LastPage int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PanelGroupPage struct {
|
type PanelGroupPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
ItemList []GroupAdmin
|
ItemList []GroupAdmin
|
||||||
PageList []int
|
Paginator
|
||||||
Page int
|
|
||||||
LastPage int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PanelEditGroupPage struct {
|
type PanelEditGroupPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
ID int
|
ID int
|
||||||
|
@ -300,7 +305,7 @@ type GroupForumPermPreset struct {
|
||||||
type PanelEditForumPage struct {
|
type PanelEditForumPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
ID int
|
ID int
|
||||||
|
@ -320,7 +325,7 @@ type NameLangToggle struct {
|
||||||
type PanelEditForumGroupPage struct {
|
type PanelEditForumGroupPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
ForumID int
|
ForumID int
|
||||||
|
@ -335,7 +340,7 @@ type PanelEditForumGroupPage struct {
|
||||||
type PanelEditGroupPermsPage struct {
|
type PanelEditGroupPermsPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
ID int
|
ID int
|
||||||
|
@ -355,7 +360,7 @@ type BackupItem struct {
|
||||||
type PanelBackupPage struct {
|
type PanelBackupPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
Backups []BackupItem
|
Backups []BackupItem
|
||||||
|
@ -370,21 +375,21 @@ type LogItem struct {
|
||||||
type PanelLogsPage struct {
|
type PanelLogsPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
Logs []LogItem
|
Logs []LogItem
|
||||||
PageList []int
|
Paginator
|
||||||
Page int
|
|
||||||
LastPage int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PanelDebugPage struct {
|
type PanelDebugPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
Header *HeaderVars
|
Header *Header
|
||||||
Stats PanelStats
|
Stats PanelStats
|
||||||
Zone string
|
Zone string
|
||||||
|
GoVersion string
|
||||||
|
DBVersion string
|
||||||
Uptime string
|
Uptime string
|
||||||
OpenConns int
|
OpenConns int
|
||||||
DBAdapter string
|
DBAdapter string
|
||||||
|
@ -400,8 +405,7 @@ type AreYouSure struct {
|
||||||
Message string
|
Message string
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is mostly for errors.go, please create *HeaderVars on the spot instead of relying on this or the atomic store underlying it, if possible
|
|
||||||
// TODO: Write a test for this
|
// TODO: Write a test for this
|
||||||
func DefaultHeaderVar() *HeaderVars {
|
func DefaultHeader(w http.ResponseWriter) *Header {
|
||||||
return &HeaderVars{Site: Site, Theme: Themes[fallbackTheme]}
|
return &Header{Site: Site, Theme: Themes[fallbackTheme], CurrentUser: GuestUser, Writer: w}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,13 @@ var PreRoute func(http.ResponseWriter, *http.Request) (User, bool) = preRoute
|
||||||
|
|
||||||
// TODO: Come up with a better middleware solution
|
// TODO: Come up with a better middleware solution
|
||||||
// nolint We need these types so people can tell what they are without scrolling to the bottom of the file
|
// nolint We need these types so people can tell what they are without scrolling to the bottom of the file
|
||||||
var PanelUserCheck func(http.ResponseWriter, *http.Request, *User) (*HeaderVars, PanelStats, RouteError) = panelUserCheck
|
var PanelUserCheck func(http.ResponseWriter, *http.Request, *User) (*Header, PanelStats, RouteError) = panelUserCheck
|
||||||
var SimplePanelUserCheck func(http.ResponseWriter, *http.Request, *User) (*HeaderLite, RouteError) = simplePanelUserCheck
|
var SimplePanelUserCheck func(http.ResponseWriter, *http.Request, *User) (*HeaderLite, RouteError) = simplePanelUserCheck
|
||||||
var SimpleForumUserCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerLite *HeaderLite, err RouteError) = simpleForumUserCheck
|
var SimpleForumUserCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerLite *HeaderLite, err RouteError) = simpleForumUserCheck
|
||||||
var ForumUserCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerVars *HeaderVars, err RouteError) = forumUserCheck
|
var ForumUserCheck func(w http.ResponseWriter, r *http.Request, user *User, fid int) (header *Header, err RouteError) = forumUserCheck
|
||||||
var MemberCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, err RouteError) = memberCheck
|
var MemberCheck func(w http.ResponseWriter, r *http.Request, user *User) (header *Header, err RouteError) = memberCheck
|
||||||
var SimpleUserCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, err RouteError) = simpleUserCheck
|
var SimpleUserCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, err RouteError) = simpleUserCheck
|
||||||
var UserCheck func(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, err RouteError) = userCheck
|
var UserCheck func(w http.ResponseWriter, r *http.Request, user *User) (header *Header, err RouteError) = userCheck
|
||||||
|
|
||||||
func simpleForumUserCheck(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerLite *HeaderLite, rerr RouteError) {
|
func simpleForumUserCheck(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerLite *HeaderLite, rerr RouteError) {
|
||||||
if !Forums.Exists(fid) {
|
if !Forums.Exists(fid) {
|
||||||
|
@ -46,20 +46,20 @@ func simpleForumUserCheck(w http.ResponseWriter, r *http.Request, user *User, fi
|
||||||
return headerLite, nil
|
return headerLite, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func forumUserCheck(w http.ResponseWriter, r *http.Request, user *User, fid int) (headerVars *HeaderVars, rerr RouteError) {
|
func forumUserCheck(w http.ResponseWriter, r *http.Request, user *User, fid int) (header *Header, rerr RouteError) {
|
||||||
headerVars, rerr = UserCheck(w, r, user)
|
header, rerr = UserCheck(w, r, user)
|
||||||
if rerr != nil {
|
if rerr != nil {
|
||||||
return headerVars, rerr
|
return header, rerr
|
||||||
}
|
}
|
||||||
if !Forums.Exists(fid) {
|
if !Forums.Exists(fid) {
|
||||||
return headerVars, NotFound(w, r, headerVars)
|
return header, NotFound(w, r, header)
|
||||||
}
|
}
|
||||||
|
|
||||||
if VhookSkippable["forum_check_pre_perms"] != nil {
|
if VhookSkippable["forum_check_pre_perms"] != nil {
|
||||||
var skip bool
|
var skip bool
|
||||||
skip, rerr = RunVhookSkippable("forum_check_pre_perms", w, r, user, &fid, &headerVars)
|
skip, rerr = RunVhookSkippable("forum_check_pre_perms", w, r, user, &fid, &header)
|
||||||
if skip || rerr != nil {
|
if skip || rerr != nil {
|
||||||
return headerVars, rerr
|
return header, rerr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ func forumUserCheck(w http.ResponseWriter, r *http.Request, user *User, fid int)
|
||||||
return nil, PreError("Something weird happened", w, r)
|
return nil, PreError("Something weird happened", w, r)
|
||||||
}
|
}
|
||||||
cascadeForumPerms(fperms, user)
|
cascadeForumPerms(fperms, user)
|
||||||
return headerVars, rerr
|
return header, rerr
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Put this on the user instance? Do we really want forum specific logic in there? Maybe, a method which spits a new pointer with the same contents as user?
|
// TODO: Put this on the user instance? Do we really want forum specific logic in there? Maybe, a method which spits a new pointer with the same contents as user?
|
||||||
|
@ -98,7 +98,7 @@ func cascadeForumPerms(fperms *ForumPerms, user *User) {
|
||||||
|
|
||||||
// Even if they have the right permissions, the control panel is only open to supermods+. There are many areas without subpermissions which assume that the current user is a supermod+ and admins are extremely unlikely to give these permissions to someone who isn't at-least a supermod to begin with
|
// Even if they have the right permissions, the control panel is only open to supermods+. There are many areas without subpermissions which assume that the current user is a supermod+ and admins are extremely unlikely to give these permissions to someone who isn't at-least a supermod to begin with
|
||||||
// TODO: Do a panel specific theme?
|
// TODO: Do a panel specific theme?
|
||||||
func panelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, stats PanelStats, rerr RouteError) {
|
func panelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (header *Header, stats PanelStats, rerr RouteError) {
|
||||||
var theme = &Theme{Name: ""}
|
var theme = &Theme{Name: ""}
|
||||||
|
|
||||||
cookie, err := r.Cookie("current_theme")
|
cookie, err := r.Cookie("current_theme")
|
||||||
|
@ -112,17 +112,18 @@ func panelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerV
|
||||||
theme = Themes[DefaultThemeBox.Load().(string)]
|
theme = Themes[DefaultThemeBox.Load().(string)]
|
||||||
}
|
}
|
||||||
|
|
||||||
headerVars = &HeaderVars{
|
header = &Header{
|
||||||
Site: Site,
|
Site: Site,
|
||||||
Settings: SettingBox.Load().(SettingMap),
|
Settings: SettingBox.Load().(SettingMap),
|
||||||
Themes: Themes,
|
Themes: Themes,
|
||||||
Theme: theme,
|
Theme: theme,
|
||||||
|
CurrentUser: *user,
|
||||||
Zone: "panel",
|
Zone: "panel",
|
||||||
Writer: w,
|
Writer: w,
|
||||||
}
|
}
|
||||||
// TODO: We should probably initialise headerVars.ExtData
|
// TODO: We should probably initialise header.ExtData
|
||||||
|
|
||||||
headerVars.AddSheet(theme.Name + "/panel.css")
|
header.AddSheet(theme.Name + "/panel.css")
|
||||||
if len(theme.Resources) > 0 {
|
if len(theme.Resources) > 0 {
|
||||||
rlist := theme.Resources
|
rlist := theme.Resources
|
||||||
for _, resource := range rlist {
|
for _, resource := range rlist {
|
||||||
|
@ -130,9 +131,9 @@ func panelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerV
|
||||||
extarr := strings.Split(resource.Name, ".")
|
extarr := strings.Split(resource.Name, ".")
|
||||||
ext := extarr[len(extarr)-1]
|
ext := extarr[len(extarr)-1]
|
||||||
if ext == "css" {
|
if ext == "css" {
|
||||||
headerVars.AddSheet(resource.Name)
|
header.AddSheet(resource.Name)
|
||||||
} else if ext == "js" {
|
} else if ext == "js" {
|
||||||
headerVars.AddScript(resource.Name)
|
header.AddScript(resource.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +142,7 @@ func panelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerV
|
||||||
stats.Users = Users.GlobalCount()
|
stats.Users = Users.GlobalCount()
|
||||||
stats.Groups = Groups.GlobalCount()
|
stats.Groups = Groups.GlobalCount()
|
||||||
stats.Forums = Forums.GlobalCount() // TODO: Stop it from showing the blanked forums
|
stats.Forums = Forums.GlobalCount() // TODO: Stop it from showing the blanked forums
|
||||||
stats.Settings = len(headerVars.Settings)
|
stats.Settings = len(header.Settings)
|
||||||
stats.WordFilters = len(WordFilterBox.Load().(WordFilterMap))
|
stats.WordFilters = len(WordFilterBox.Load().(WordFilterMap))
|
||||||
stats.Themes = len(Themes)
|
stats.Themes = len(Themes)
|
||||||
stats.Reports = 0 // TODO: Do the report count. Only show open threads?
|
stats.Reports = 0 // TODO: Do the report count. Only show open threads?
|
||||||
|
@ -153,16 +154,16 @@ func panelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerV
|
||||||
pusher.Push("/static/global.js", nil)
|
pusher.Push("/static/global.js", nil)
|
||||||
pusher.Push("/static/jquery-3.1.1.min.js", nil)
|
pusher.Push("/static/jquery-3.1.1.min.js", nil)
|
||||||
// TODO: Test these
|
// TODO: Test these
|
||||||
for _, sheet := range headerVars.Stylesheets {
|
for _, sheet := range header.Stylesheets {
|
||||||
pusher.Push("/static/"+sheet, nil)
|
pusher.Push("/static/"+sheet, nil)
|
||||||
}
|
}
|
||||||
for _, script := range headerVars.Scripts {
|
for _, script := range header.Scripts {
|
||||||
pusher.Push("/static/"+script, nil)
|
pusher.Push("/static/"+script, nil)
|
||||||
}
|
}
|
||||||
// TODO: Push avatars?
|
// TODO: Push avatars?
|
||||||
}
|
}
|
||||||
|
|
||||||
return headerVars, stats, nil
|
return header, stats, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func simplePanelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, rerr RouteError) {
|
func simplePanelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (headerLite *HeaderLite, rerr RouteError) {
|
||||||
|
@ -173,12 +174,12 @@ func simplePanelUserCheck(w http.ResponseWriter, r *http.Request, user *User) (h
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add this to the member routes
|
// TODO: Add this to the member routes
|
||||||
func memberCheck(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, rerr RouteError) {
|
func memberCheck(w http.ResponseWriter, r *http.Request, user *User) (header *Header, rerr RouteError) {
|
||||||
headerVars, rerr = UserCheck(w, r, user)
|
header, rerr = UserCheck(w, r, user)
|
||||||
if !user.Loggedin {
|
if !user.Loggedin {
|
||||||
return headerVars, NoPermissions(w, r, *user)
|
return header, NoPermissions(w, r, *user)
|
||||||
}
|
}
|
||||||
return headerVars, rerr
|
return header, rerr
|
||||||
}
|
}
|
||||||
|
|
||||||
// SimpleUserCheck is back from the grave, yay :D
|
// SimpleUserCheck is back from the grave, yay :D
|
||||||
|
@ -191,7 +192,7 @@ func simpleUserCheck(w http.ResponseWriter, r *http.Request, user *User) (header
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add the ability for admins to restrict certain themes to certain groups?
|
// TODO: Add the ability for admins to restrict certain themes to certain groups?
|
||||||
func userCheck(w http.ResponseWriter, r *http.Request, user *User) (headerVars *HeaderVars, rerr RouteError) {
|
func userCheck(w http.ResponseWriter, r *http.Request, user *User) (header *Header, rerr RouteError) {
|
||||||
var theme = &Theme{Name: ""}
|
var theme = &Theme{Name: ""}
|
||||||
|
|
||||||
cookie, err := r.Cookie("current_theme")
|
cookie, err := r.Cookie("current_theme")
|
||||||
|
@ -205,20 +206,21 @@ func userCheck(w http.ResponseWriter, r *http.Request, user *User) (headerVars *
|
||||||
theme = Themes[DefaultThemeBox.Load().(string)]
|
theme = Themes[DefaultThemeBox.Load().(string)]
|
||||||
}
|
}
|
||||||
|
|
||||||
headerVars = &HeaderVars{
|
header = &Header{
|
||||||
Site: Site,
|
Site: Site,
|
||||||
Settings: SettingBox.Load().(SettingMap),
|
Settings: SettingBox.Load().(SettingMap),
|
||||||
Themes: Themes,
|
Themes: Themes,
|
||||||
Theme: theme,
|
Theme: theme,
|
||||||
|
CurrentUser: *user,
|
||||||
Zone: "frontend",
|
Zone: "frontend",
|
||||||
Writer: w,
|
Writer: w,
|
||||||
}
|
}
|
||||||
|
|
||||||
if user.IsBanned {
|
if user.IsBanned {
|
||||||
headerVars.NoticeList = append(headerVars.NoticeList, GetNoticePhrase("account_banned"))
|
header.NoticeList = append(header.NoticeList, GetNoticePhrase("account_banned"))
|
||||||
}
|
}
|
||||||
if user.Loggedin && !user.Active {
|
if user.Loggedin && !user.Active {
|
||||||
headerVars.NoticeList = append(headerVars.NoticeList, GetNoticePhrase("account_inactive"))
|
header.NoticeList = append(header.NoticeList, GetNoticePhrase("account_inactive"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(theme.Resources) > 0 {
|
if len(theme.Resources) > 0 {
|
||||||
|
@ -231,9 +233,9 @@ func userCheck(w http.ResponseWriter, r *http.Request, user *User) (headerVars *
|
||||||
extarr := strings.Split(resource.Name, ".")
|
extarr := strings.Split(resource.Name, ".")
|
||||||
ext := extarr[len(extarr)-1]
|
ext := extarr[len(extarr)-1]
|
||||||
if ext == "css" {
|
if ext == "css" {
|
||||||
headerVars.AddSheet(resource.Name)
|
header.AddSheet(resource.Name)
|
||||||
} else if ext == "js" {
|
} else if ext == "js" {
|
||||||
headerVars.AddScript(resource.Name)
|
header.AddScript(resource.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,16 +247,16 @@ func userCheck(w http.ResponseWriter, r *http.Request, user *User) (headerVars *
|
||||||
pusher.Push("/static/global.js", nil)
|
pusher.Push("/static/global.js", nil)
|
||||||
pusher.Push("/static/jquery-3.1.1.min.js", nil)
|
pusher.Push("/static/jquery-3.1.1.min.js", nil)
|
||||||
// TODO: Test these
|
// TODO: Test these
|
||||||
for _, sheet := range headerVars.Stylesheets {
|
for _, sheet := range header.Stylesheets {
|
||||||
pusher.Push("/static/"+sheet, nil)
|
pusher.Push("/static/"+sheet, nil)
|
||||||
}
|
}
|
||||||
for _, script := range headerVars.Scripts {
|
for _, script := range header.Scripts {
|
||||||
pusher.Push("/static/"+script, nil)
|
pusher.Push("/static/"+script, nil)
|
||||||
}
|
}
|
||||||
// TODO: Push avatars?
|
// TODO: Push avatars?
|
||||||
}
|
}
|
||||||
|
|
||||||
return headerVars, nil
|
return header, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func preRoute(w http.ResponseWriter, r *http.Request) (User, bool) {
|
func preRoute(w http.ResponseWriter, r *http.Request) (User, bool) {
|
||||||
|
|
|
@ -2,8 +2,8 @@ package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -15,7 +15,7 @@ import (
|
||||||
|
|
||||||
var Ctemplates []string
|
var Ctemplates []string
|
||||||
var Templates = template.New("")
|
var Templates = template.New("")
|
||||||
var PrebuildTmplList []func(User, *HeaderVars) CTmpl
|
var PrebuildTmplList []func(User, *Header) CTmpl
|
||||||
|
|
||||||
type CTmpl struct {
|
type CTmpl struct {
|
||||||
Name string
|
Name string
|
||||||
|
@ -28,7 +28,7 @@ type CTmpl struct {
|
||||||
|
|
||||||
// TODO: Stop duplicating these bits of code
|
// TODO: Stop duplicating these bits of code
|
||||||
// nolint
|
// nolint
|
||||||
func interpreted_topic_template(pi TopicPage, w http.ResponseWriter) error {
|
func interpretedTopicTemplate(pi TopicPage, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["topic"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["topic"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "topic"
|
mapping = "topic"
|
||||||
|
@ -37,11 +37,11 @@ func interpreted_topic_template(pi TopicPage, w http.ResponseWriter) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_topic_handle = interpreted_topic_template
|
var Template_topic_handle = interpretedTopicTemplate
|
||||||
var Template_topic_alt_handle = interpreted_topic_template
|
var Template_topic_alt_handle = interpretedTopicTemplate
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_topics_handle = func(pi TopicsPage, w http.ResponseWriter) error {
|
var Template_topics_handle = func(pi TopicListPage, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["topics"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["topics"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "topics"
|
mapping = "topics"
|
||||||
|
@ -50,7 +50,7 @@ var Template_topics_handle = func(pi TopicsPage, w http.ResponseWriter) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_forum_handle = func(pi ForumPage, w http.ResponseWriter) error {
|
var Template_forum_handle = func(pi ForumPage, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["forum"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["forum"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "forum"
|
mapping = "forum"
|
||||||
|
@ -59,7 +59,7 @@ var Template_forum_handle = func(pi ForumPage, w http.ResponseWriter) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_forums_handle = func(pi ForumsPage, w http.ResponseWriter) error {
|
var Template_forums_handle = func(pi ForumsPage, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["forums"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["forums"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "forums"
|
mapping = "forums"
|
||||||
|
@ -68,7 +68,7 @@ var Template_forums_handle = func(pi ForumsPage, w http.ResponseWriter) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_profile_handle = func(pi ProfilePage, w http.ResponseWriter) error {
|
var Template_profile_handle = func(pi ProfilePage, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["profile"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["profile"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "profile"
|
mapping = "profile"
|
||||||
|
@ -77,7 +77,7 @@ var Template_profile_handle = func(pi ProfilePage, w http.ResponseWriter) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_create_topic_handle = func(pi CreateTopicPage, w http.ResponseWriter) error {
|
var Template_create_topic_handle = func(pi CreateTopicPage, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["create_topic"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["create_topic"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "create_topic"
|
mapping = "create_topic"
|
||||||
|
@ -86,7 +86,7 @@ var Template_create_topic_handle = func(pi CreateTopicPage, w http.ResponseWrite
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_login_handle = func(pi Page, w http.ResponseWriter) error {
|
var Template_login_handle = func(pi Page, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["login"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["login"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "login"
|
mapping = "login"
|
||||||
|
@ -95,7 +95,7 @@ var Template_login_handle = func(pi Page, w http.ResponseWriter) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_register_handle = func(pi Page, w http.ResponseWriter) error {
|
var Template_register_handle = func(pi Page, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["register"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["register"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "register"
|
mapping = "register"
|
||||||
|
@ -104,7 +104,7 @@ var Template_register_handle = func(pi Page, w http.ResponseWriter) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_error_handle = func(pi Page, w http.ResponseWriter) error {
|
var Template_error_handle = func(pi Page, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["error"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["error"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "error"
|
mapping = "error"
|
||||||
|
@ -113,7 +113,7 @@ var Template_error_handle = func(pi Page, w http.ResponseWriter) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var Template_ip_search_handle = func(pi IPSearchPage, w http.ResponseWriter) error {
|
var Template_ip_search_handle = func(pi IPSearchPage, w io.Writer) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["ip_search"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["ip_search"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "ip_search"
|
mapping = "ip_search"
|
||||||
|
@ -127,8 +127,12 @@ func CompileTemplates() error {
|
||||||
config.Minify = Config.MinifyTemplates
|
config.Minify = Config.MinifyTemplates
|
||||||
config.SuperDebug = Dev.TemplateDebug
|
config.SuperDebug = Dev.TemplateDebug
|
||||||
|
|
||||||
var c tmpl.CTemplateSet
|
c := tmpl.NewCTemplateSet()
|
||||||
c.SetConfig(config)
|
c.SetConfig(config)
|
||||||
|
c.SetBaseImportMap(map[string]string{
|
||||||
|
"io": "io",
|
||||||
|
"./common": "./common",
|
||||||
|
})
|
||||||
|
|
||||||
// Schemas to train the template compiler on what to expect
|
// Schemas to train the template compiler on what to expect
|
||||||
// TODO: Add support for interface{}s
|
// TODO: Add support for interface{}s
|
||||||
|
@ -136,11 +140,12 @@ func CompileTemplates() error {
|
||||||
// TODO: Do a more accurate level calculation for this?
|
// TODO: Do a more accurate level calculation for this?
|
||||||
user2 := User{1, BuildProfileURL("admin-alice", 1), "Admin Alice", "alice@localhost", 1, true, true, true, true, false, false, AllPerms, make(map[string]bool), "", true, BuildAvatar(1, ""), "", "", "", "", 58, 1000, 0, "127.0.0.1", 0}
|
user2 := User{1, BuildProfileURL("admin-alice", 1), "Admin Alice", "alice@localhost", 1, true, true, true, true, false, false, AllPerms, make(map[string]bool), "", true, BuildAvatar(1, ""), "", "", "", "", 58, 1000, 0, "127.0.0.1", 0}
|
||||||
user3 := User{2, BuildProfileURL("admin-fred", 62), "Admin Fred", "fred@localhost", 1, true, true, true, true, false, false, AllPerms, make(map[string]bool), "", true, BuildAvatar(2, ""), "", "", "", "", 42, 900, 0, "::1", 0}
|
user3 := User{2, BuildProfileURL("admin-fred", 62), "Admin Fred", "fred@localhost", 1, true, true, true, true, false, false, AllPerms, make(map[string]bool), "", true, BuildAvatar(2, ""), "", "", "", "", 42, 900, 0, "::1", 0}
|
||||||
headerVars := &HeaderVars{
|
header := &Header{
|
||||||
Site: Site,
|
Site: Site,
|
||||||
Settings: SettingBox.Load().(SettingMap),
|
Settings: SettingBox.Load().(SettingMap),
|
||||||
Themes: Themes,
|
Themes: Themes,
|
||||||
Theme: Themes[DefaultThemeBox.Load().(string)],
|
Theme: Themes[DefaultThemeBox.Load().(string)],
|
||||||
|
CurrentUser: user,
|
||||||
NoticeList: []string{"test"},
|
NoticeList: []string{"test"},
|
||||||
Stylesheets: []string{"panel"},
|
Stylesheets: []string{"panel"},
|
||||||
Scripts: []string{"whatever"},
|
Scripts: []string{"whatever"},
|
||||||
|
@ -161,7 +166,7 @@ func CompileTemplates() error {
|
||||||
replyList = append(replyList, ReplyUser{0, 0, "Yo!", "Yo!", 0, "alice", "Alice", Config.DefaultGroup, now, RelativeTime(now), 0, 0, "", "", 0, "", "", "", "", 0, "127.0.0.1", false, 1, "", ""})
|
replyList = append(replyList, ReplyUser{0, 0, "Yo!", "Yo!", 0, "alice", "Alice", Config.DefaultGroup, now, RelativeTime(now), 0, 0, "", "", 0, "", "", "", "", 0, "127.0.0.1", false, 1, "", ""})
|
||||||
|
|
||||||
var varList = make(map[string]tmpl.VarItem)
|
var varList = make(map[string]tmpl.VarItem)
|
||||||
tpage := TopicPage{"Title", user, headerVars, replyList, topic, poll, 1, 1}
|
tpage := TopicPage{"Title", user, header, replyList, topic, poll, 1, 1}
|
||||||
topicIDTmpl, err := c.Compile("topic.html", "templates/", "common.TopicPage", tpage, varList)
|
topicIDTmpl, err := c.Compile("topic.html", "templates/", "common.TopicPage", tpage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -172,7 +177,7 @@ func CompileTemplates() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
varList = make(map[string]tmpl.VarItem)
|
varList = make(map[string]tmpl.VarItem)
|
||||||
ppage := ProfilePage{"User 526", user, headerVars, replyList, user}
|
ppage := ProfilePage{"User 526", user, header, replyList, user}
|
||||||
profileTmpl, err := c.Compile("profile.html", "templates/", "common.ProfilePage", ppage, varList)
|
profileTmpl, err := c.Compile("profile.html", "templates/", "common.ProfilePage", ppage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -189,7 +194,7 @@ func CompileTemplates() error {
|
||||||
forumList = append(forumList, *forum)
|
forumList = append(forumList, *forum)
|
||||||
}
|
}
|
||||||
varList = make(map[string]tmpl.VarItem)
|
varList = make(map[string]tmpl.VarItem)
|
||||||
forumsPage := ForumsPage{"Forum List", user, headerVars, forumList}
|
forumsPage := ForumsPage{"Forum List", user, header, forumList}
|
||||||
forumsTmpl, err := c.Compile("forums.html", "templates/", "common.ForumsPage", forumsPage, varList)
|
forumsTmpl, err := c.Compile("forums.html", "templates/", "common.ForumsPage", forumsPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -197,8 +202,9 @@ func CompileTemplates() error {
|
||||||
|
|
||||||
var topicsList []*TopicsRow
|
var topicsList []*TopicsRow
|
||||||
topicsList = append(topicsList, &TopicsRow{1, "topic-title", "Topic Title", "The topic content.", 1, false, false, "Date", time.Now(), "Date", user3.ID, 1, "", "127.0.0.1", 0, 1, "classname", "", &user2, "", 0, &user3, "General", "/forum/general.2"})
|
topicsList = append(topicsList, &TopicsRow{1, "topic-title", "Topic Title", "The topic content.", 1, false, false, "Date", time.Now(), "Date", user3.ID, 1, "", "127.0.0.1", 0, 1, "classname", "", &user2, "", 0, &user3, "General", "/forum/general.2"})
|
||||||
topicsPage := TopicsPage{"Topic List", user, headerVars, topicsList, forumList, Config.DefaultForum, []int{1}, 1, 1}
|
header.Title = "Topic List"
|
||||||
topicsTmpl, err := c.Compile("topics.html", "templates/", "common.TopicsPage", topicsPage, varList)
|
topicListPage := TopicListPage{header, topicsList, forumList, Config.DefaultForum, Paginator{[]int{1}, 1, 1}}
|
||||||
|
topicListTmpl, err := c.Compile("topics.html", "templates/", "common.TopicListPage", topicListPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -206,25 +212,25 @@ func CompileTemplates() error {
|
||||||
//var topicList []TopicUser
|
//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})
|
//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 := BlankForum(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, []int{1}, 1, 1}
|
forumPage := ForumPage{"General Forum", user, header, topicsList, forumItem, Paginator{[]int{1}, 1, 1}}
|
||||||
forumTmpl, err := c.Compile("forum.html", "templates/", "common.ForumPage", forumPage, varList)
|
forumTmpl, err := c.Compile("forum.html", "templates/", "common.ForumPage", forumPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
loginPage := Page{"Login Page", user, headerVars, tList, nil}
|
loginPage := Page{"Login Page", user, header, tList, nil}
|
||||||
loginTmpl, err := c.Compile("login.html", "templates/", "common.Page", loginPage, varList)
|
loginTmpl, err := c.Compile("login.html", "templates/", "common.Page", loginPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
registerPage := Page{"Registration Page", user, headerVars, tList, nil}
|
registerPage := Page{"Registration Page", user, header, tList, nil}
|
||||||
registerTmpl, err := c.Compile("register.html", "templates/", "common.Page", registerPage, varList)
|
registerTmpl, err := c.Compile("register.html", "templates/", "common.Page", registerPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
errorPage := Page{"Error", user, headerVars, tList, "A problem has occurred in the system."}
|
errorPage := Page{"Error", user, header, tList, "A problem has occurred in the system."}
|
||||||
errorTmpl, err := c.Compile("error.html", "templates/", "common.Page", errorPage, varList)
|
errorTmpl, err := c.Compile("error.html", "templates/", "common.Page", errorPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -232,7 +238,7 @@ func CompileTemplates() error {
|
||||||
|
|
||||||
var ipUserList = make(map[int]*User)
|
var ipUserList = make(map[int]*User)
|
||||||
ipUserList[1] = &user2
|
ipUserList[1] = &user2
|
||||||
ipSearchPage := IPSearchPage{"IP Search", user2, headerVars, ipUserList, "::1"}
|
ipSearchPage := IPSearchPage{"IP Search", user2, header, ipUserList, "::1"}
|
||||||
ipSearchTmpl, err := c.Compile("ip_search.html", "templates/", "common.IPSearchPage", ipSearchPage, varList)
|
ipSearchTmpl, err := c.Compile("ip_search.html", "templates/", "common.IPSearchPage", ipSearchPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -261,7 +267,7 @@ func CompileTemplates() error {
|
||||||
config.SkipHandles = true
|
config.SkipHandles = true
|
||||||
c.SetConfig(config)
|
c.SetConfig(config)
|
||||||
for _, tmplfunc := range PrebuildTmplList {
|
for _, tmplfunc := range PrebuildTmplList {
|
||||||
tmplItem := tmplfunc(user, headerVars)
|
tmplItem := tmplfunc(user, header)
|
||||||
varList = make(map[string]tmpl.VarItem)
|
varList = make(map[string]tmpl.VarItem)
|
||||||
compiledTmpl, err := c.Compile(tmplItem.Filename, tmplItem.Path, tmplItem.StructName, tmplItem.Data, varList, tmplItem.Imports...)
|
compiledTmpl, err := c.Compile(tmplItem.Filename, tmplItem.Path, tmplItem.StructName, tmplItem.Data, varList, tmplItem.Imports...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -275,94 +281,132 @@ func CompileTemplates() error {
|
||||||
writeTemplate("topic_alt", topicIDAltTmpl)
|
writeTemplate("topic_alt", topicIDAltTmpl)
|
||||||
writeTemplate("profile", profileTmpl)
|
writeTemplate("profile", profileTmpl)
|
||||||
writeTemplate("forums", forumsTmpl)
|
writeTemplate("forums", forumsTmpl)
|
||||||
writeTemplate("topics", topicsTmpl)
|
writeTemplate("topics", topicListTmpl)
|
||||||
writeTemplate("forum", forumTmpl)
|
writeTemplate("forum", forumTmpl)
|
||||||
writeTemplate("login", loginTmpl)
|
writeTemplate("login", loginTmpl)
|
||||||
writeTemplate("register", registerTmpl)
|
writeTemplate("register", registerTmpl)
|
||||||
writeTemplate("ip_search", ipSearchTmpl)
|
writeTemplate("ip_search", ipSearchTmpl)
|
||||||
writeTemplate("error", errorTmpl)
|
writeTemplate("error", errorTmpl)
|
||||||
|
writeTemplateList(c, &wg, "./")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func CompileJSTemplates() error {
|
||||||
|
log.Print("Compiling the JS templates")
|
||||||
|
var config tmpl.CTemplateConfig
|
||||||
|
config.Minify = Config.MinifyTemplates
|
||||||
|
config.SuperDebug = Dev.TemplateDebug
|
||||||
|
config.SkipHandles = true
|
||||||
|
config.PackageName = "tmpl"
|
||||||
|
|
||||||
|
c := tmpl.NewCTemplateSet()
|
||||||
|
c.SetConfig(config)
|
||||||
|
c.SetBaseImportMap(map[string]string{
|
||||||
|
"io": "io",
|
||||||
|
"../../common": "../../common",
|
||||||
|
})
|
||||||
|
var varList = make(map[string]tmpl.VarItem)
|
||||||
|
|
||||||
|
// TODO: Check what sort of path is sent exactly and use it here
|
||||||
|
alertItem := AlertItem{Avatar: "", ASID: 1, Path: "/", Message: "uh oh, something happened"}
|
||||||
|
alertTmpl, err := c.Compile("alert.html", "templates/", "common.AlertItem", alertItem, varList)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var dirPrefix = "./tmpl_gen/client/"
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
var writeTemplate = func(name string, content string) {
|
||||||
|
log.Print("Writing template '" + name + "'")
|
||||||
|
if content == "" {
|
||||||
|
log.Fatal("No content body")
|
||||||
|
}
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
out := "package main\n\n"
|
err := writeFile(dirPrefix+"template_"+name+".go", content)
|
||||||
for templateName, count := range c.TemplateFragmentCount {
|
|
||||||
out += "var " + templateName + "_frags = make([][]byte," + strconv.Itoa(count) + ")\n"
|
|
||||||
}
|
|
||||||
out += "\n// nolint\nfunc init() {\n" + c.FragOut + "}\n"
|
|
||||||
err := writeFile("./template_list.go", out)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
|
}
|
||||||
wg.Wait()
|
writeTemplate("alert", alertTmpl)
|
||||||
|
writeTemplateList(c, &wg, dirPrefix)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func writeTemplateList(c *tmpl.CTemplateSet, wg *sync.WaitGroup, prefix string) {
|
||||||
|
log.Print("Writing template list")
|
||||||
|
wg.Add(1)
|
||||||
|
go func() {
|
||||||
|
out := "package " + c.GetConfig().PackageName + "\n\n"
|
||||||
|
for templateName, count := range c.TemplateFragmentCount {
|
||||||
|
out += "var " + templateName + "_frags = make([][]byte," + strconv.Itoa(count) + ")\n"
|
||||||
|
}
|
||||||
|
out += "\n// nolint\nfunc init() {\n" + c.FragOut + "}\n"
|
||||||
|
err := writeFile(prefix+"template_list.go", out)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
wg.Done()
|
||||||
|
}()
|
||||||
|
wg.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
func arithToInt64(in interface{}) (out int64) {
|
||||||
|
switch in := in.(type) {
|
||||||
|
case int64:
|
||||||
|
out = in
|
||||||
|
case int32:
|
||||||
|
out = int64(in)
|
||||||
|
case int:
|
||||||
|
out = int64(in)
|
||||||
|
case uint32:
|
||||||
|
out = int64(in)
|
||||||
|
case uint16:
|
||||||
|
out = int64(in)
|
||||||
|
case uint8:
|
||||||
|
out = int64(in)
|
||||||
|
case uint:
|
||||||
|
out = int64(in)
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
func arithDuoToInt64(left interface{}, right interface{}) (leftInt int64, rightInt int64) {
|
||||||
|
return arithToInt64(left), arithToInt64(right)
|
||||||
|
}
|
||||||
|
|
||||||
func InitTemplates() error {
|
func InitTemplates() error {
|
||||||
DebugLog("Initialising the template system")
|
DebugLog("Initialising the template system")
|
||||||
|
|
||||||
// TODO: Add support for 64-bit integers
|
|
||||||
// TODO: Add support for floats
|
// TODO: Add support for floats
|
||||||
fmap := make(map[string]interface{})
|
fmap := make(map[string]interface{})
|
||||||
fmap["add"] = func(left interface{}, right interface{}) interface{} {
|
fmap["add"] = func(left interface{}, right interface{}) interface{} {
|
||||||
var leftInt, rightInt int
|
leftInt, rightInt := arithDuoToInt64(left, right)
|
||||||
switch left := left.(type) {
|
|
||||||
case uint, uint8, uint16, int, int32:
|
|
||||||
leftInt = left.(int)
|
|
||||||
}
|
|
||||||
switch right := right.(type) {
|
|
||||||
case uint, uint8, uint16, int, int32:
|
|
||||||
rightInt = right.(int)
|
|
||||||
}
|
|
||||||
return leftInt + rightInt
|
return leftInt + rightInt
|
||||||
}
|
}
|
||||||
|
|
||||||
fmap["subtract"] = func(left interface{}, right interface{}) interface{} {
|
fmap["subtract"] = func(left interface{}, right interface{}) interface{} {
|
||||||
var leftInt, rightInt int
|
leftInt, rightInt := arithDuoToInt64(left, right)
|
||||||
switch left := left.(type) {
|
|
||||||
case uint, uint8, uint16, int, int32:
|
|
||||||
leftInt = left.(int)
|
|
||||||
}
|
|
||||||
switch right := right.(type) {
|
|
||||||
case uint, uint8, uint16, int, int32:
|
|
||||||
rightInt = right.(int)
|
|
||||||
}
|
|
||||||
return leftInt - rightInt
|
return leftInt - rightInt
|
||||||
}
|
}
|
||||||
|
|
||||||
fmap["multiply"] = func(left interface{}, right interface{}) interface{} {
|
fmap["multiply"] = func(left interface{}, right interface{}) interface{} {
|
||||||
var leftInt, rightInt int
|
leftInt, rightInt := arithDuoToInt64(left, right)
|
||||||
switch left := left.(type) {
|
|
||||||
case uint, uint8, uint16, int, int32:
|
|
||||||
leftInt = left.(int)
|
|
||||||
}
|
|
||||||
switch right := right.(type) {
|
|
||||||
case uint, uint8, uint16, int, int32:
|
|
||||||
rightInt = right.(int)
|
|
||||||
}
|
|
||||||
return leftInt * rightInt
|
return leftInt * rightInt
|
||||||
}
|
}
|
||||||
|
|
||||||
fmap["divide"] = func(left interface{}, right interface{}) interface{} {
|
fmap["divide"] = func(left interface{}, right interface{}) interface{} {
|
||||||
var leftInt, rightInt int
|
leftInt, rightInt := arithDuoToInt64(left, right)
|
||||||
switch left := left.(type) {
|
|
||||||
case uint, uint8, uint16, int, int32:
|
|
||||||
leftInt = left.(int)
|
|
||||||
}
|
|
||||||
switch right := right.(type) {
|
|
||||||
case uint, uint8, uint16, int, int32:
|
|
||||||
rightInt = right.(int)
|
|
||||||
}
|
|
||||||
if leftInt == 0 || rightInt == 0 {
|
if leftInt == 0 || rightInt == 0 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return leftInt / rightInt
|
return leftInt / rightInt
|
||||||
}
|
}
|
||||||
|
|
||||||
fmap["dock"] = func(dock interface{}, headerVarInt interface{}) interface{} {
|
fmap["dock"] = func(dock interface{}, headerInt interface{}) interface{} {
|
||||||
return template.HTML(BuildWidget(dock.(string), headerVarInt.(*HeaderVars)))
|
return template.HTML(BuildWidget(dock.(string), headerInt.(*Header)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fmap["lang"] = func(phraseNameInt interface{}) interface{} {
|
fmap["lang"] = func(phraseNameInt interface{}) interface{} {
|
||||||
|
|
|
@ -32,6 +32,8 @@ type CTemplateConfig struct {
|
||||||
Debug bool
|
Debug bool
|
||||||
SuperDebug bool
|
SuperDebug bool
|
||||||
SkipHandles bool
|
SkipHandles bool
|
||||||
|
SkipInitBlock bool
|
||||||
|
PackageName string
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
|
@ -55,26 +57,17 @@ type CTemplateSet struct {
|
||||||
nextNode parse.NodeType
|
nextNode parse.NodeType
|
||||||
//tempVars map[string]string
|
//tempVars map[string]string
|
||||||
config CTemplateConfig
|
config CTemplateConfig
|
||||||
doImports bool
|
baseImportMap map[string]string
|
||||||
expectsInt interface{}
|
expectsInt interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CTemplateSet) SetConfig(config CTemplateConfig) {
|
func NewCTemplateSet() *CTemplateSet {
|
||||||
c.config = config
|
return &CTemplateSet{
|
||||||
}
|
config: CTemplateConfig{
|
||||||
|
PackageName: "main",
|
||||||
func (c *CTemplateSet) GetConfig() CTemplateConfig {
|
},
|
||||||
return c.config
|
baseImportMap: map[string]string{},
|
||||||
}
|
funcMap: map[string]interface{}{
|
||||||
|
|
||||||
func (c *CTemplateSet) Compile(name string, fileDir string, expects string, expectsInt interface{}, varList map[string]VarItem, imports ...string) (out string, err error) {
|
|
||||||
if c.config.Debug {
|
|
||||||
fmt.Println("Compiling template '" + name + "'")
|
|
||||||
}
|
|
||||||
|
|
||||||
c.fileDir = fileDir
|
|
||||||
c.doImports = true
|
|
||||||
c.funcMap = map[string]interface{}{
|
|
||||||
"and": "&&",
|
"and": "&&",
|
||||||
"not": "!",
|
"not": "!",
|
||||||
"or": "||",
|
"or": "||",
|
||||||
|
@ -91,11 +84,33 @@ func (c *CTemplateSet) Compile(name string, fileDir string, expects string, expe
|
||||||
"dock": true,
|
"dock": true,
|
||||||
"lang": true,
|
"lang": true,
|
||||||
"scope": true,
|
"scope": true,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c.importMap = map[string]string{
|
func (c *CTemplateSet) SetConfig(config CTemplateConfig) {
|
||||||
"net/http": "net/http",
|
if config.PackageName == "" {
|
||||||
"./common": "./common",
|
config.PackageName = "main"
|
||||||
|
}
|
||||||
|
c.config = config
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CTemplateSet) GetConfig() CTemplateConfig {
|
||||||
|
return c.config
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CTemplateSet) SetBaseImportMap(importMap map[string]string) {
|
||||||
|
c.baseImportMap = importMap
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CTemplateSet) Compile(name string, fileDir string, expects string, expectsInt interface{}, varList map[string]VarItem, imports ...string) (out string, err error) {
|
||||||
|
if c.config.Debug {
|
||||||
|
fmt.Println("Compiling template '" + name + "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
c.importMap = map[string]string{}
|
||||||
|
for index, item := range c.baseImportMap {
|
||||||
|
c.importMap[index] = item
|
||||||
}
|
}
|
||||||
if len(imports) > 0 {
|
if len(imports) > 0 {
|
||||||
for _, importItem := range imports {
|
for _, importItem := range imports {
|
||||||
|
@ -103,6 +118,7 @@ func (c *CTemplateSet) Compile(name string, fileDir string, expects string, expe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.fileDir = fileDir
|
||||||
c.varList = varList
|
c.varList = varList
|
||||||
c.hasDispInt = false
|
c.hasDispInt = false
|
||||||
c.localDispStructIndex = 0
|
c.localDispStructIndex = 0
|
||||||
|
@ -157,11 +173,9 @@ func (c *CTemplateSet) Compile(name string, fileDir string, expects string, expe
|
||||||
c.TemplateFragmentCount[fname] = c.fragmentCursor[fname] + 1
|
c.TemplateFragmentCount[fname] = c.fragmentCursor[fname] + 1
|
||||||
|
|
||||||
var importList string
|
var importList string
|
||||||
if c.doImports {
|
|
||||||
for _, item := range c.importMap {
|
for _, item := range c.importMap {
|
||||||
importList += "import \"" + item + "\"\n"
|
importList += "import \"" + item + "\"\n"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var varString string
|
var varString string
|
||||||
for _, varItem := range c.varList {
|
for _, varItem := range c.varList {
|
||||||
|
@ -169,9 +183,12 @@ func (c *CTemplateSet) Compile(name string, fileDir string, expects string, expe
|
||||||
}
|
}
|
||||||
|
|
||||||
fout := "// +build !no_templategen\n\n// Code generated by Gosora. More below:\n/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */\n"
|
fout := "// +build !no_templategen\n\n// Code generated by Gosora. More below:\n/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */\n"
|
||||||
|
fout += "package " + c.config.PackageName + "\n" + importList + "\n"
|
||||||
|
|
||||||
fout += "package main\n" + importList + "\n"
|
if !c.config.SkipInitBlock {
|
||||||
|
if len(c.langIndexToName) > 0 {
|
||||||
fout += "var " + fname + "_tmpl_phrase_id int\n\n"
|
fout += "var " + fname + "_tmpl_phrase_id int\n\n"
|
||||||
|
}
|
||||||
fout += "// nolint\nfunc init() {\n"
|
fout += "// nolint\nfunc init() {\n"
|
||||||
|
|
||||||
if !c.config.SkipHandles {
|
if !c.config.SkipHandles {
|
||||||
|
@ -189,8 +206,9 @@ func (c *CTemplateSet) Compile(name string, fileDir string, expects string, expe
|
||||||
fout += "\t})\n"
|
fout += "\t})\n"
|
||||||
}
|
}
|
||||||
fout += "}\n\n"
|
fout += "}\n\n"
|
||||||
|
}
|
||||||
|
|
||||||
fout += "// nolint\nfunc Template_" + fname + "(tmpl_" + fname + "_vars " + expects + ", w http.ResponseWriter) error {\n"
|
fout += "// nolint\nfunc Template_" + fname + "(tmpl_" + fname + "_vars " + expects + ", w io.Writer) error {\n"
|
||||||
if len(c.langIndexToName) > 0 {
|
if len(c.langIndexToName) > 0 {
|
||||||
fout += "var phrases = common.GetTmplPhrasesBytes(" + fname + "_tmpl_phrase_id)\n"
|
fout += "var phrases = common.GetTmplPhrasesBytes(" + fname + "_tmpl_phrase_id)\n"
|
||||||
}
|
}
|
||||||
|
|
103
common/themes.go
103
common/themes.go
|
@ -7,6 +7,7 @@ import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"mime"
|
"mime"
|
||||||
|
@ -271,72 +272,72 @@ func (theme *Theme) MapTemplates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch dTmplPtr := destTmplPtr.(type) {
|
switch dTmplPtr := destTmplPtr.(type) {
|
||||||
case *func(TopicPage, http.ResponseWriter) error:
|
case *func(TopicPage, io.Writer) error:
|
||||||
switch sTmplPtr := sourceTmplPtr.(type) {
|
switch sTmplPtr := sourceTmplPtr.(type) {
|
||||||
case *func(TopicPage, http.ResponseWriter) error:
|
case *func(TopicPage, io.Writer) error:
|
||||||
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
||||||
overridenTemplates[themeTmpl.Name] = true
|
overridenTemplates[themeTmpl.Name] = true
|
||||||
*dTmplPtr = *sTmplPtr
|
*dTmplPtr = *sTmplPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case *func(TopicsPage, http.ResponseWriter) error:
|
case *func(TopicListPage, io.Writer) error:
|
||||||
switch sTmplPtr := sourceTmplPtr.(type) {
|
switch sTmplPtr := sourceTmplPtr.(type) {
|
||||||
case *func(TopicsPage, http.ResponseWriter) error:
|
case *func(TopicListPage, io.Writer) error:
|
||||||
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
||||||
overridenTemplates[themeTmpl.Name] = true
|
overridenTemplates[themeTmpl.Name] = true
|
||||||
*dTmplPtr = *sTmplPtr
|
*dTmplPtr = *sTmplPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case *func(ForumPage, http.ResponseWriter) error:
|
case *func(ForumPage, io.Writer) error:
|
||||||
switch sTmplPtr := sourceTmplPtr.(type) {
|
switch sTmplPtr := sourceTmplPtr.(type) {
|
||||||
case *func(ForumPage, http.ResponseWriter) error:
|
case *func(ForumPage, io.Writer) error:
|
||||||
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
||||||
overridenTemplates[themeTmpl.Name] = true
|
overridenTemplates[themeTmpl.Name] = true
|
||||||
*dTmplPtr = *sTmplPtr
|
*dTmplPtr = *sTmplPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case *func(ForumsPage, http.ResponseWriter) error:
|
case *func(ForumsPage, io.Writer) error:
|
||||||
switch sTmplPtr := sourceTmplPtr.(type) {
|
switch sTmplPtr := sourceTmplPtr.(type) {
|
||||||
case *func(ForumsPage, http.ResponseWriter) error:
|
case *func(ForumsPage, io.Writer) error:
|
||||||
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
||||||
overridenTemplates[themeTmpl.Name] = true
|
overridenTemplates[themeTmpl.Name] = true
|
||||||
*dTmplPtr = *sTmplPtr
|
*dTmplPtr = *sTmplPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case *func(ProfilePage, http.ResponseWriter) error:
|
case *func(ProfilePage, io.Writer) error:
|
||||||
switch sTmplPtr := sourceTmplPtr.(type) {
|
switch sTmplPtr := sourceTmplPtr.(type) {
|
||||||
case *func(ProfilePage, http.ResponseWriter) error:
|
case *func(ProfilePage, io.Writer) error:
|
||||||
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
||||||
overridenTemplates[themeTmpl.Name] = true
|
overridenTemplates[themeTmpl.Name] = true
|
||||||
*dTmplPtr = *sTmplPtr
|
*dTmplPtr = *sTmplPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case *func(CreateTopicPage, http.ResponseWriter) error:
|
case *func(CreateTopicPage, io.Writer) error:
|
||||||
switch sTmplPtr := sourceTmplPtr.(type) {
|
switch sTmplPtr := sourceTmplPtr.(type) {
|
||||||
case *func(CreateTopicPage, http.ResponseWriter) error:
|
case *func(CreateTopicPage, io.Writer) error:
|
||||||
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
||||||
overridenTemplates[themeTmpl.Name] = true
|
overridenTemplates[themeTmpl.Name] = true
|
||||||
*dTmplPtr = *sTmplPtr
|
*dTmplPtr = *sTmplPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case *func(IPSearchPage, http.ResponseWriter) error:
|
case *func(IPSearchPage, io.Writer) error:
|
||||||
switch sTmplPtr := sourceTmplPtr.(type) {
|
switch sTmplPtr := sourceTmplPtr.(type) {
|
||||||
case *func(IPSearchPage, http.ResponseWriter) error:
|
case *func(IPSearchPage, io.Writer) error:
|
||||||
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
||||||
overridenTemplates[themeTmpl.Name] = true
|
overridenTemplates[themeTmpl.Name] = true
|
||||||
*dTmplPtr = *sTmplPtr
|
*dTmplPtr = *sTmplPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case *func(Page, http.ResponseWriter) error:
|
case *func(Page, io.Writer) error:
|
||||||
switch sTmplPtr := sourceTmplPtr.(type) {
|
switch sTmplPtr := sourceTmplPtr.(type) {
|
||||||
case *func(Page, http.ResponseWriter) error:
|
case *func(Page, io.Writer) error:
|
||||||
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
//overridenTemplates[themeTmpl.Name] = d_tmpl_ptr
|
||||||
overridenTemplates[themeTmpl.Name] = true
|
overridenTemplates[themeTmpl.Name] = true
|
||||||
*dTmplPtr = *sTmplPtr
|
*dTmplPtr = *sTmplPtr
|
||||||
|
@ -372,58 +373,58 @@ func ResetTemplateOverrides() {
|
||||||
|
|
||||||
// Not really a pointer, more of a function handle, an artifact from one of the earlier versions of themes.go
|
// Not really a pointer, more of a function handle, an artifact from one of the earlier versions of themes.go
|
||||||
switch oPtr := originPointer.(type) {
|
switch oPtr := originPointer.(type) {
|
||||||
case func(TopicPage, http.ResponseWriter) error:
|
case func(TopicPage, io.Writer) error:
|
||||||
switch dPtr := destTmplPtr.(type) {
|
switch dPtr := destTmplPtr.(type) {
|
||||||
case *func(TopicPage, http.ResponseWriter) error:
|
case *func(TopicPage, io.Writer) error:
|
||||||
*dPtr = oPtr
|
*dPtr = oPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case func(TopicsPage, http.ResponseWriter) error:
|
case func(TopicListPage, io.Writer) error:
|
||||||
switch dPtr := destTmplPtr.(type) {
|
switch dPtr := destTmplPtr.(type) {
|
||||||
case *func(TopicsPage, http.ResponseWriter) error:
|
case *func(TopicListPage, io.Writer) error:
|
||||||
*dPtr = oPtr
|
*dPtr = oPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case func(ForumPage, http.ResponseWriter) error:
|
case func(ForumPage, io.Writer) error:
|
||||||
switch dPtr := destTmplPtr.(type) {
|
switch dPtr := destTmplPtr.(type) {
|
||||||
case *func(ForumPage, http.ResponseWriter) error:
|
case *func(ForumPage, io.Writer) error:
|
||||||
*dPtr = oPtr
|
*dPtr = oPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case func(ForumsPage, http.ResponseWriter) error:
|
case func(ForumsPage, io.Writer) error:
|
||||||
switch dPtr := destTmplPtr.(type) {
|
switch dPtr := destTmplPtr.(type) {
|
||||||
case *func(ForumsPage, http.ResponseWriter) error:
|
case *func(ForumsPage, io.Writer) error:
|
||||||
*dPtr = oPtr
|
*dPtr = oPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case func(ProfilePage, http.ResponseWriter) error:
|
case func(ProfilePage, io.Writer) error:
|
||||||
switch dPtr := destTmplPtr.(type) {
|
switch dPtr := destTmplPtr.(type) {
|
||||||
case *func(ProfilePage, http.ResponseWriter) error:
|
case *func(ProfilePage, io.Writer) error:
|
||||||
*dPtr = oPtr
|
*dPtr = oPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case func(CreateTopicPage, http.ResponseWriter) error:
|
case func(CreateTopicPage, io.Writer) error:
|
||||||
switch dPtr := destTmplPtr.(type) {
|
switch dPtr := destTmplPtr.(type) {
|
||||||
case *func(CreateTopicPage, http.ResponseWriter) error:
|
case *func(CreateTopicPage, io.Writer) error:
|
||||||
*dPtr = oPtr
|
*dPtr = oPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case func(IPSearchPage, http.ResponseWriter) error:
|
case func(IPSearchPage, io.Writer) error:
|
||||||
switch dPtr := destTmplPtr.(type) {
|
switch dPtr := destTmplPtr.(type) {
|
||||||
case *func(IPSearchPage, http.ResponseWriter) error:
|
case *func(IPSearchPage, io.Writer) error:
|
||||||
*dPtr = oPtr
|
*dPtr = oPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
}
|
}
|
||||||
case func(Page, http.ResponseWriter) error:
|
case func(Page, io.Writer) error:
|
||||||
switch dPtr := destTmplPtr.(type) {
|
switch dPtr := destTmplPtr.(type) {
|
||||||
case *func(Page, http.ResponseWriter) error:
|
case *func(Page, io.Writer) error:
|
||||||
*dPtr = oPtr
|
*dPtr = oPtr
|
||||||
default:
|
default:
|
||||||
LogError(errors.New("The source and destination templates are incompatible"))
|
LogError(errors.New("The source and destination templates are incompatible"))
|
||||||
|
@ -441,48 +442,48 @@ func ResetTemplateOverrides() {
|
||||||
// NEW method of doing theme templates to allow one user to have a different theme to another. Under construction.
|
// NEW method of doing theme templates to allow one user to have a different theme to another. Under construction.
|
||||||
// TODO: Generate the type switch instead of writing it by hand
|
// TODO: Generate the type switch instead of writing it by hand
|
||||||
// TODO: Cut the number of types in half
|
// TODO: Cut the number of types in half
|
||||||
func RunThemeTemplate(theme string, template string, pi interface{}, w http.ResponseWriter) error {
|
func RunThemeTemplate(theme string, template string, pi interface{}, w io.Writer) error {
|
||||||
var getTmpl = GetThemeTemplate(theme, template)
|
var getTmpl = GetThemeTemplate(theme, template)
|
||||||
switch tmplO := getTmpl.(type) {
|
switch tmplO := getTmpl.(type) {
|
||||||
case *func(TopicPage, http.ResponseWriter) error:
|
case *func(TopicPage, io.Writer) error:
|
||||||
var tmpl = *tmplO
|
var tmpl = *tmplO
|
||||||
return tmpl(pi.(TopicPage), w)
|
return tmpl(pi.(TopicPage), w)
|
||||||
case *func(TopicsPage, http.ResponseWriter) error:
|
case *func(TopicListPage, io.Writer) error:
|
||||||
var tmpl = *tmplO
|
var tmpl = *tmplO
|
||||||
return tmpl(pi.(TopicsPage), w)
|
return tmpl(pi.(TopicListPage), w)
|
||||||
case *func(ForumPage, http.ResponseWriter) error:
|
case *func(ForumPage, io.Writer) error:
|
||||||
var tmpl = *tmplO
|
var tmpl = *tmplO
|
||||||
return tmpl(pi.(ForumPage), w)
|
return tmpl(pi.(ForumPage), w)
|
||||||
case *func(ForumsPage, http.ResponseWriter) error:
|
case *func(ForumsPage, io.Writer) error:
|
||||||
var tmpl = *tmplO
|
var tmpl = *tmplO
|
||||||
return tmpl(pi.(ForumsPage), w)
|
return tmpl(pi.(ForumsPage), w)
|
||||||
case *func(ProfilePage, http.ResponseWriter) error:
|
case *func(ProfilePage, io.Writer) error:
|
||||||
var tmpl = *tmplO
|
var tmpl = *tmplO
|
||||||
return tmpl(pi.(ProfilePage), w)
|
return tmpl(pi.(ProfilePage), w)
|
||||||
case *func(CreateTopicPage, http.ResponseWriter) error:
|
case *func(CreateTopicPage, io.Writer) error:
|
||||||
var tmpl = *tmplO
|
var tmpl = *tmplO
|
||||||
return tmpl(pi.(CreateTopicPage), w)
|
return tmpl(pi.(CreateTopicPage), w)
|
||||||
case *func(IPSearchPage, http.ResponseWriter) error:
|
case *func(IPSearchPage, io.Writer) error:
|
||||||
var tmpl = *tmplO
|
var tmpl = *tmplO
|
||||||
return tmpl(pi.(IPSearchPage), w)
|
return tmpl(pi.(IPSearchPage), w)
|
||||||
case *func(Page, http.ResponseWriter) error:
|
case *func(Page, io.Writer) error:
|
||||||
var tmpl = *tmplO
|
var tmpl = *tmplO
|
||||||
return tmpl(pi.(Page), w)
|
return tmpl(pi.(Page), w)
|
||||||
case func(TopicPage, http.ResponseWriter) error:
|
case func(TopicPage, io.Writer) error:
|
||||||
return tmplO(pi.(TopicPage), w)
|
return tmplO(pi.(TopicPage), w)
|
||||||
case func(TopicsPage, http.ResponseWriter) error:
|
case func(TopicListPage, io.Writer) error:
|
||||||
return tmplO(pi.(TopicsPage), w)
|
return tmplO(pi.(TopicListPage), w)
|
||||||
case func(ForumPage, http.ResponseWriter) error:
|
case func(ForumPage, io.Writer) error:
|
||||||
return tmplO(pi.(ForumPage), w)
|
return tmplO(pi.(ForumPage), w)
|
||||||
case func(ForumsPage, http.ResponseWriter) error:
|
case func(ForumsPage, io.Writer) error:
|
||||||
return tmplO(pi.(ForumsPage), w)
|
return tmplO(pi.(ForumsPage), w)
|
||||||
case func(ProfilePage, http.ResponseWriter) error:
|
case func(ProfilePage, io.Writer) error:
|
||||||
return tmplO(pi.(ProfilePage), w)
|
return tmplO(pi.(ProfilePage), w)
|
||||||
case func(CreateTopicPage, http.ResponseWriter) error:
|
case func(CreateTopicPage, io.Writer) error:
|
||||||
return tmplO(pi.(CreateTopicPage), w)
|
return tmplO(pi.(CreateTopicPage), w)
|
||||||
case func(IPSearchPage, http.ResponseWriter) error:
|
case func(IPSearchPage, io.Writer) error:
|
||||||
return tmplO(pi.(IPSearchPage), w)
|
return tmplO(pi.(IPSearchPage), w)
|
||||||
case func(Page, http.ResponseWriter) error:
|
case func(Page, io.Writer) error:
|
||||||
return tmplO(pi.(Page), w)
|
return tmplO(pi.(Page), w)
|
||||||
case string:
|
case string:
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap[template]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap[template]
|
||||||
|
|
|
@ -12,14 +12,12 @@ var TopicList TopicListInt
|
||||||
type TopicListHolder struct {
|
type TopicListHolder struct {
|
||||||
List []*TopicsRow
|
List []*TopicsRow
|
||||||
ForumList []Forum
|
ForumList []Forum
|
||||||
PageList []int
|
Paginator Paginator
|
||||||
Page int
|
|
||||||
LastPage int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type TopicListInt interface {
|
type TopicListInt interface {
|
||||||
GetListByGroup(group *Group, page int) (topicList []*TopicsRow, forumList []Forum, pageList []int, outPage int, lastPage int, err error)
|
GetListByGroup(group *Group, page int) (topicList []*TopicsRow, forumList []Forum, paginator Paginator, err error)
|
||||||
GetList(page int) (topicList []*TopicsRow, forumList []Forum, pageList []int, outPage int, lastPage int, err error)
|
GetList(page int) (topicList []*TopicsRow, forumList []Forum, paginator Paginator, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DefaultTopicList struct {
|
type DefaultTopicList struct {
|
||||||
|
@ -99,11 +97,11 @@ func (tList *DefaultTopicList) Tick() error {
|
||||||
var oddLists = make(map[int]*TopicListHolder)
|
var oddLists = make(map[int]*TopicListHolder)
|
||||||
var evenLists = make(map[int]*TopicListHolder)
|
var evenLists = make(map[int]*TopicListHolder)
|
||||||
|
|
||||||
var addList = func(gid int, topicList []*TopicsRow, forumList []Forum, pageList []int, page int, lastPage int) {
|
var addList = func(gid int, topicList []*TopicsRow, forumList []Forum, paginator Paginator) {
|
||||||
if gid%2 == 0 {
|
if gid%2 == 0 {
|
||||||
evenLists[gid] = &TopicListHolder{topicList, forumList, pageList, page, lastPage}
|
evenLists[gid] = &TopicListHolder{topicList, forumList, paginator}
|
||||||
} else {
|
} else {
|
||||||
oddLists[gid] = &TopicListHolder{topicList, forumList, pageList, page, lastPage}
|
oddLists[gid] = &TopicListHolder{topicList, forumList, paginator}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,11 +109,11 @@ func (tList *DefaultTopicList) Tick() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
topicList, forumList, pageList, page, lastPage, err := tList.getListByGroup(guestGroup, 1)
|
topicList, forumList, paginator, err := tList.getListByGroup(guestGroup, 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
addList(guestGroup.ID, topicList, forumList, pageList, page, lastPage)
|
addList(guestGroup.ID, topicList, forumList, paginator)
|
||||||
|
|
||||||
for _, gid := range tList.groupList {
|
for _, gid := range tList.groupList {
|
||||||
group, err := Groups.Get(gid) // TODO: Bulk load the groups?
|
group, err := Groups.Get(gid) // TODO: Bulk load the groups?
|
||||||
|
@ -126,11 +124,11 @@ func (tList *DefaultTopicList) Tick() error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
topicList, forumList, pageList, page, lastPage, err := tList.getListByGroup(group, 1)
|
topicList, forumList, paginator, err := tList.getListByGroup(group, 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
addList(group.ID, topicList, forumList, pageList, page, lastPage)
|
addList(group.ID, topicList, forumList, paginator)
|
||||||
}
|
}
|
||||||
|
|
||||||
tList.oddLock.Lock()
|
tList.oddLock.Lock()
|
||||||
|
@ -144,7 +142,7 @@ func (tList *DefaultTopicList) Tick() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tList *DefaultTopicList) GetListByGroup(group *Group, page int) (topicList []*TopicsRow, forumList []Forum, pageList []int, outPage int, lastPage int, err error) {
|
func (tList *DefaultTopicList) GetListByGroup(group *Group, page int) (topicList []*TopicsRow, forumList []Forum, paginator Paginator, err error) {
|
||||||
// TODO: Cache the first three pages not just the first along with all the topics on this beaten track
|
// TODO: Cache the first three pages not just the first along with all the topics on this beaten track
|
||||||
if page == 1 {
|
if page == 1 {
|
||||||
var holder *TopicListHolder
|
var holder *TopicListHolder
|
||||||
|
@ -159,14 +157,14 @@ func (tList *DefaultTopicList) GetListByGroup(group *Group, page int) (topicList
|
||||||
tList.oddLock.RUnlock()
|
tList.oddLock.RUnlock()
|
||||||
}
|
}
|
||||||
if ok {
|
if ok {
|
||||||
return holder.List, holder.ForumList, holder.PageList, holder.Page, holder.LastPage, nil
|
return holder.List, holder.ForumList, holder.Paginator, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tList.getListByGroup(group, page)
|
return tList.getListByGroup(group, page)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tList *DefaultTopicList) getListByGroup(group *Group, page int) (topicList []*TopicsRow, forumList []Forum, pageList []int, outPage int, lastPage int, err error) {
|
func (tList *DefaultTopicList) getListByGroup(group *Group, page int) (topicList []*TopicsRow, forumList []Forum, paginator Paginator, err error) {
|
||||||
// TODO: Make CanSee a method on *Group with a canSee field? Have a CanSee method on *User to cover the case of superadmins?
|
// TODO: Make CanSee a method on *Group with a canSee field? Have a CanSee method on *User to cover the case of superadmins?
|
||||||
canSee := group.CanSee
|
canSee := group.CanSee
|
||||||
|
|
||||||
|
@ -185,19 +183,19 @@ func (tList *DefaultTopicList) getListByGroup(group *Group, page int) (topicList
|
||||||
argList, qlist := ForumListToArgQ(forumList)
|
argList, qlist := ForumListToArgQ(forumList)
|
||||||
if qlist == "" {
|
if qlist == "" {
|
||||||
// We don't want to kill the page, so pass an empty slice and nil error
|
// We don't want to kill the page, so pass an empty slice and nil error
|
||||||
return topicList, forumList, pageList, 1, 1, nil
|
return topicList, forumList, Paginator{[]int{}, 1, 1}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
topicList, pageList, page, lastPage, err = tList.getList(page, argList, qlist)
|
topicList, paginator, err = tList.getList(page, argList, qlist)
|
||||||
return topicList, forumList, pageList, page, lastPage, err
|
return topicList, forumList, paginator, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Reduce the number of returns
|
// TODO: Reduce the number of returns
|
||||||
func (tList *DefaultTopicList) GetList(page int) (topicList []*TopicsRow, forumList []Forum, pageList []int, outPage int, lastPage int, err error) {
|
func (tList *DefaultTopicList) GetList(page int) (topicList []*TopicsRow, forumList []Forum, paginator Paginator, err error) {
|
||||||
// TODO: Make CanSee a method on *Group with a canSee field? Have a CanSee method on *User to cover the case of superadmins?
|
// TODO: Make CanSee a method on *Group with a canSee field? Have a CanSee method on *User to cover the case of superadmins?
|
||||||
canSee, err := Forums.GetAllVisibleIDs()
|
canSee, err := Forums.GetAllVisibleIDs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, 1, 1, err
|
return nil, nil, Paginator{nil, 1, 1}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need a list of the visible forums for Quick Topic
|
// We need a list of the visible forums for Quick Topic
|
||||||
|
@ -215,24 +213,24 @@ func (tList *DefaultTopicList) GetList(page int) (topicList []*TopicsRow, forumL
|
||||||
argList, qlist := ForumListToArgQ(forumList)
|
argList, qlist := ForumListToArgQ(forumList)
|
||||||
if qlist == "" {
|
if qlist == "" {
|
||||||
// If the super admin can't see anything, then things have gone terribly wrong
|
// If the super admin can't see anything, then things have gone terribly wrong
|
||||||
return topicList, forumList, pageList, 1, 1, err
|
return topicList, forumList, Paginator{[]int{}, 1, 1}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
topicList, pageList, outPage, lastPage, err = tList.getList(page, argList, qlist)
|
topicList, paginator, err = tList.getList(page, argList, qlist)
|
||||||
return topicList, forumList, pageList, outPage, lastPage, err
|
return topicList, forumList, paginator, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Rename this to TopicListStore and pass back a TopicList instance holding the pagination data and topic list rather than passing them back one argument at a time
|
// TODO: Rename this to TopicListStore and pass back a TopicList instance holding the pagination data and topic list rather than passing them back one argument at a time
|
||||||
func (tList *DefaultTopicList) getList(page int, argList []interface{}, qlist string) (topicList []*TopicsRow, pageList []int, outPage int, lastPage int, err error) {
|
func (tList *DefaultTopicList) getList(page int, argList []interface{}, qlist string) (topicList []*TopicsRow, paginator Paginator, err error) {
|
||||||
topicCount, err := ArgQToTopicCount(argList, qlist)
|
topicCount, err := ArgQToTopicCount(argList, qlist)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 1, 1, err
|
return nil, Paginator{nil, 1, 1}, err
|
||||||
}
|
}
|
||||||
offset, page, lastPage := PageOffset(topicCount, page, Config.ItemsPerPage)
|
offset, page, lastPage := PageOffset(topicCount, page, Config.ItemsPerPage)
|
||||||
|
|
||||||
stmt, err := qgen.Builder.SimpleSelect("topics", "tid, title, content, createdBy, is_closed, sticky, createdAt, lastReplyAt, lastReplyBy, parentID, postCount, likeCount", "parentID IN("+qlist+")", "sticky DESC, lastReplyAt DESC, createdBy DESC", "?,?")
|
stmt, err := qgen.Builder.SimpleSelect("topics", "tid, title, content, createdBy, is_closed, sticky, createdAt, lastReplyAt, lastReplyBy, parentID, postCount, likeCount", "parentID IN("+qlist+")", "sticky DESC, lastReplyAt DESC, createdBy DESC", "?,?")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 1, 1, err
|
return nil, Paginator{nil, 1, 1}, err
|
||||||
}
|
}
|
||||||
defer stmt.Close()
|
defer stmt.Close()
|
||||||
|
|
||||||
|
@ -241,7 +239,7 @@ func (tList *DefaultTopicList) getList(page int, argList []interface{}, qlist st
|
||||||
|
|
||||||
rows, err := stmt.Query(argList...)
|
rows, err := stmt.Query(argList...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 1, 1, err
|
return nil, Paginator{nil, 1, 1}, err
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
|
@ -250,7 +248,7 @@ func (tList *DefaultTopicList) getList(page int, argList []interface{}, qlist st
|
||||||
topicItem := TopicsRow{ID: 0}
|
topicItem := TopicsRow{ID: 0}
|
||||||
err := rows.Scan(&topicItem.ID, &topicItem.Title, &topicItem.Content, &topicItem.CreatedBy, &topicItem.IsClosed, &topicItem.Sticky, &topicItem.CreatedAt, &topicItem.LastReplyAt, &topicItem.LastReplyBy, &topicItem.ParentID, &topicItem.PostCount, &topicItem.LikeCount)
|
err := rows.Scan(&topicItem.ID, &topicItem.Title, &topicItem.Content, &topicItem.CreatedBy, &topicItem.IsClosed, &topicItem.Sticky, &topicItem.CreatedAt, &topicItem.LastReplyAt, &topicItem.LastReplyBy, &topicItem.ParentID, &topicItem.PostCount, &topicItem.LikeCount)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 1, 1, err
|
return nil, Paginator{nil, 1, 1}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
topicItem.Link = BuildTopicURL(NameToSlug(topicItem.Title), topicItem.ID)
|
topicItem.Link = BuildTopicURL(NameToSlug(topicItem.Title), topicItem.ID)
|
||||||
|
@ -269,7 +267,7 @@ func (tList *DefaultTopicList) getList(page int, argList []interface{}, qlist st
|
||||||
}
|
}
|
||||||
err = rows.Err()
|
err = rows.Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 1, 1, err
|
return nil, Paginator{nil, 1, 1}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert the user ID map to a slice, then bulk load the users
|
// Convert the user ID map to a slice, then bulk load the users
|
||||||
|
@ -283,7 +281,7 @@ func (tList *DefaultTopicList) getList(page int, argList []interface{}, qlist st
|
||||||
// TODO: What if a user is deleted via the Control Panel?
|
// TODO: What if a user is deleted via the Control Panel?
|
||||||
userList, err := Users.BulkGetMap(idSlice)
|
userList, err := Users.BulkGetMap(idSlice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 1, 1, err
|
return nil, Paginator{nil, 1, 1}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second pass to the add the user data
|
// Second pass to the add the user data
|
||||||
|
@ -293,8 +291,8 @@ func (tList *DefaultTopicList) getList(page int, argList []interface{}, qlist st
|
||||||
topicItem.LastUser = userList[topicItem.LastReplyBy]
|
topicItem.LastUser = userList[topicItem.LastReplyBy]
|
||||||
}
|
}
|
||||||
|
|
||||||
pageList = Paginate(topicCount, Config.ItemsPerPage, 5)
|
pageList := Paginate(topicCount, Config.ItemsPerPage, 5)
|
||||||
return topicList, pageList, page, lastPage, nil
|
return topicList, Paginator{pageList, page, lastPage}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal. Don't rely on it.
|
// Internal. Don't rely on it.
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -80,7 +81,6 @@ func preparseWidget(widget *Widget, wdata string) (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
widget.Literal = true
|
|
||||||
widget.Body, err = prebuildWidget("widget_simple", tmp)
|
widget.Body, err = prebuildWidget("widget_simple", tmp)
|
||||||
case "about":
|
case "about":
|
||||||
var tmp NameTextPair
|
var tmp NameTextPair
|
||||||
|
@ -88,12 +88,11 @@ func preparseWidget(widget *Widget, wdata string) (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
widget.Literal = true
|
|
||||||
widget.Body, err = prebuildWidget("widget_about", tmp)
|
widget.Body, err = prebuildWidget("widget_about", tmp)
|
||||||
default:
|
default:
|
||||||
widget.Literal = true
|
|
||||||
widget.Body = wdata
|
widget.Body = wdata
|
||||||
}
|
}
|
||||||
|
widget.Literal = true
|
||||||
|
|
||||||
// TODO: Test this
|
// TODO: Test this
|
||||||
// TODO: Should we toss this through a proper parser rather than crudely replacing it?
|
// TODO: Should we toss this through a proper parser rather than crudely replacing it?
|
||||||
|
@ -117,23 +116,36 @@ func preparseWidget(widget *Widget, wdata string) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func BuildWidget(dock string, headerVars *HeaderVars) (sbody string) {
|
func BuildWidget(dock string, header *Header) (sbody string) {
|
||||||
var widgets []*Widget
|
var widgets []*Widget
|
||||||
if !headerVars.Theme.HasDock(dock) {
|
if !header.Theme.HasDock(dock) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let themes forcibly override this slot
|
// Let themes forcibly override this slot
|
||||||
sbody = headerVars.Theme.BuildDock(dock)
|
sbody = header.Theme.BuildDock(dock)
|
||||||
if sbody != "" {
|
if sbody != "" {
|
||||||
return sbody
|
return sbody
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("dock: ", dock)
|
||||||
switch dock {
|
switch dock {
|
||||||
case "leftOfNav":
|
case "leftOfNav":
|
||||||
widgets = Docks.LeftOfNav
|
widgets = Docks.LeftOfNav
|
||||||
case "rightOfNav":
|
case "rightOfNav":
|
||||||
widgets = Docks.RightOfNav
|
widgets = Docks.RightOfNav
|
||||||
|
case "topMenu":
|
||||||
|
fmt.Println("topMenu")
|
||||||
|
// 1 = id for the default menu
|
||||||
|
mhold := Menus.Get(1)
|
||||||
|
if mhold != nil {
|
||||||
|
fmt.Println("header.Writer: ", header.Writer)
|
||||||
|
err := mhold.Build(header.Writer, &header.CurrentUser)
|
||||||
|
if err != nil {
|
||||||
|
LogError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
case "rightSidebar":
|
case "rightSidebar":
|
||||||
widgets = Docks.RightSidebar
|
widgets = Docks.RightSidebar
|
||||||
case "footer":
|
case "footer":
|
||||||
|
@ -144,8 +156,8 @@ func BuildWidget(dock string, headerVars *HeaderVars) (sbody string) {
|
||||||
if !widget.Enabled {
|
if !widget.Enabled {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if widget.Allowed(headerVars.Zone) {
|
if widget.Allowed(header.Zone) {
|
||||||
item, err := widget.Build(headerVars)
|
item, err := widget.Build(header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LogError(err)
|
LogError(err)
|
||||||
}
|
}
|
||||||
|
@ -156,7 +168,7 @@ func BuildWidget(dock string, headerVars *HeaderVars) (sbody string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Test this
|
// TODO: Test this
|
||||||
// TODO: Add support for zone:id. Perhaps, carry a ZoneID property around in headerVars? It might allow some weirdness like frontend[5] which matches any zone with an ID of 5 but it would be a tad faster than verifying each zone, although it might be problematic if users end up relying on this behaviour for areas which don't pass IDs to the widgets system but *probably* should
|
// TODO: Add support for zone:id. Perhaps, carry a ZoneID property around in *Header? It might allow some weirdness like frontend[5] which matches any zone with an ID of 5 but it would be a tad faster than verifying each zone, although it might be problematic if users end up relying on this behaviour for areas which don't pass IDs to the widgets system but *probably* should
|
||||||
func (widget *Widget) Allowed(zone string) bool {
|
func (widget *Widget) Allowed(zone string) bool {
|
||||||
for _, loc := range strings.Split(widget.Location, "|") {
|
for _, loc := range strings.Split(widget.Location, "|") {
|
||||||
if loc == "global" || loc == zone {
|
if loc == "global" || loc == zone {
|
||||||
|
@ -177,8 +189,8 @@ func (widget *Widget) Build(hvars interface{}) (string, error) {
|
||||||
return widget.Body, nil
|
return widget.Body, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var headerVars = hvars.(*HeaderVars)
|
var header = hvars.(*Header)
|
||||||
err := RunThemeTemplate(headerVars.Theme.Name, widget.Body, hvars, headerVars.Writer)
|
err := RunThemeTemplate(header.Theme.Name, widget.Body, hvars, header.Writer)
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ echo "Updating GopherJS"
|
||||||
go get -u github.com/gopherjs/gopherjs
|
go get -u github.com/gopherjs/gopherjs
|
||||||
|
|
||||||
echo "Updating Gosora"
|
echo "Updating Gosora"
|
||||||
|
rm ./schema/lastSchema.json
|
||||||
|
cp ./schema/schema.json ./schema/lastSchema.json
|
||||||
git pull origin master
|
git pull origin master
|
||||||
|
|
||||||
echo "Patching Gosora"
|
echo "Patching Gosora"
|
||||||
|
|
|
@ -101,6 +101,7 @@ if %errorlevel% neq 0 (
|
||||||
|
|
||||||
|
|
||||||
echo Updating Gosora
|
echo Updating Gosora
|
||||||
|
copy ./schema/schema.json ./schema/lastSchema.json
|
||||||
git pull origin master
|
git pull origin master
|
||||||
if %errorlevel% neq 0 (
|
if %errorlevel% neq 0 (
|
||||||
pause
|
pause
|
||||||
|
|
|
@ -52,7 +52,7 @@ type Guild struct {
|
||||||
type Page struct {
|
type Page struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser common.User
|
CurrentUser common.User
|
||||||
Header *common.HeaderVars
|
Header *common.Header
|
||||||
ItemList []*common.TopicsRow
|
ItemList []*common.TopicsRow
|
||||||
Forum *common.Forum
|
Forum *common.Forum
|
||||||
Guild *Guild
|
Guild *Guild
|
||||||
|
@ -64,14 +64,14 @@ type Page struct {
|
||||||
type ListPage struct {
|
type ListPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser common.User
|
CurrentUser common.User
|
||||||
Header *common.HeaderVars
|
Header *common.Header
|
||||||
GuildList []*Guild
|
GuildList []*Guild
|
||||||
}
|
}
|
||||||
|
|
||||||
type MemberListPage struct {
|
type MemberListPage struct {
|
||||||
Title string
|
Title string
|
||||||
CurrentUser common.User
|
CurrentUser common.User
|
||||||
Header *common.HeaderVars
|
Header *common.Header
|
||||||
ItemList []Member
|
ItemList []Member
|
||||||
Guild *Guild
|
Guild *Guild
|
||||||
Page int
|
Page int
|
||||||
|
@ -90,7 +90,7 @@ type Member struct {
|
||||||
User common.User
|
User common.User
|
||||||
}
|
}
|
||||||
|
|
||||||
func PrebuildTmplList(user common.User, headerVars *common.HeaderVars) common.CTmpl {
|
func PrebuildTmplList(user common.User, header *common.Header) common.CTmpl {
|
||||||
var guildList = []*Guild{
|
var guildList = []*Guild{
|
||||||
&Guild{
|
&Guild{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
|
@ -107,13 +107,13 @@ func PrebuildTmplList(user common.User, headerVars *common.HeaderVars) common.CT
|
||||||
Forums: []*common.Forum{common.Forums.DirtyGet(1)},
|
Forums: []*common.Forum{common.Forums.DirtyGet(1)},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
listPage := ListPage{"Guild List", user, headerVars, guildList}
|
listPage := ListPage{"Guild List", user, header, guildList}
|
||||||
return common.CTmpl{"guilds_guild_list", "guilds_guild_list.html", "templates/", "guilds.ListPage", listPage, []string{"./extend/guilds/lib"}}
|
return common.CTmpl{"guilds_guild_list", "guilds_guild_list.html", "templates/", "guilds.ListPage", listPage, []string{"./extend/guilds/lib"}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Do this properly via the widget system
|
// TODO: Do this properly via the widget system
|
||||||
// TODO: REWRITE THIS
|
// TODO: REWRITE THIS
|
||||||
func CommonAreaWidgets(headerVars *common.HeaderVars) {
|
func CommonAreaWidgets(header *common.Header) {
|
||||||
// TODO: Hot Groups? Featured Groups? Official Groups?
|
// TODO: Hot Groups? Featured Groups? Official Groups?
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
var menu = common.WidgetMenu{"Guilds", []common.WidgetMenuItem{
|
var menu = common.WidgetMenu{"Guilds", []common.WidgetMenuItem{
|
||||||
|
@ -126,16 +126,16 @@ func CommonAreaWidgets(headerVars *common.HeaderVars) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if headerVars.Theme.HasDock("leftSidebar") {
|
if header.Theme.HasDock("leftSidebar") {
|
||||||
headerVars.Widgets.LeftSidebar = template.HTML(string(b.Bytes()))
|
header.Widgets.LeftSidebar = template.HTML(string(b.Bytes()))
|
||||||
} else if headerVars.Theme.HasDock("rightSidebar") {
|
} else if header.Theme.HasDock("rightSidebar") {
|
||||||
headerVars.Widgets.RightSidebar = template.HTML(string(b.Bytes()))
|
header.Widgets.RightSidebar = template.HTML(string(b.Bytes()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Do this properly via the widget system
|
// TODO: Do this properly via the widget system
|
||||||
// TODO: Make a better more customisable group widget system
|
// TODO: Make a better more customisable group widget system
|
||||||
func GuildWidgets(headerVars *common.HeaderVars, guildItem *Guild) (success bool) {
|
func GuildWidgets(header *common.Header, guildItem *Guild) (success bool) {
|
||||||
return false // Disabled until the next commit
|
return false // Disabled until the next commit
|
||||||
|
|
||||||
/*var b bytes.Buffer
|
/*var b bytes.Buffer
|
||||||
|
@ -150,10 +150,10 @@ func GuildWidgets(headerVars *common.HeaderVars, guildItem *Guild) (success bool
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if themes[headerVars.Theme.Name].Sidebars == "left" {
|
if themes[header.Theme.Name].Sidebars == "left" {
|
||||||
headerVars.Widgets.LeftSidebar = template.HTML(string(b.Bytes()))
|
header.Widgets.LeftSidebar = template.HTML(string(b.Bytes()))
|
||||||
} else if themes[headerVars.Theme.Name].Sidebars == "right" || themes[headerVars.Theme.Name].Sidebars == "both" {
|
} else if themes[header.Theme.Name].Sidebars == "right" || themes[header.Theme.Name].Sidebars == "both" {
|
||||||
headerVars.Widgets.RightSidebar = template.HTML(string(b.Bytes()))
|
header.Widgets.RightSidebar = template.HTML(string(b.Bytes()))
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -165,11 +165,11 @@ func GuildWidgets(headerVars *common.HeaderVars, guildItem *Guild) (success bool
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func RouteGuildList(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func RouteGuildList(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
CommonAreaWidgets(headerVars)
|
CommonAreaWidgets(header)
|
||||||
|
|
||||||
rows, err := ListStmt.Query()
|
rows, err := ListStmt.Query()
|
||||||
if err != nil && err != common.ErrNoRows {
|
if err != nil && err != common.ErrNoRows {
|
||||||
|
@ -192,8 +192,8 @@ func RouteGuildList(w http.ResponseWriter, r *http.Request, user common.User) co
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := ListPage{"Guild List", user, headerVars, guildList}
|
pi := ListPage{"Guild List", user, header, guildList}
|
||||||
err = common.RunThemeTemplate(headerVars.Theme.Name, "guilds_guild_list", pi, w)
|
err = common.RunThemeTemplate(header.Theme.Name, "guilds_guild_list", pi, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ func MiddleViewGuild(w http.ResponseWriter, r *http.Request, user common.User) c
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.LocalError("Bad guild", w, r, user)
|
return common.LocalError("Bad guild", w, r, user)
|
||||||
}
|
}
|
||||||
// TODO: Build and pass headerVars
|
// TODO: Build and pass header
|
||||||
if !guildItem.Active {
|
if !guildItem.Active {
|
||||||
return common.NotFound(w, r, nil)
|
return common.NotFound(w, r, nil)
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ func MiddleViewGuild(w http.ResponseWriter, r *http.Request, user common.User) c
|
||||||
}
|
}
|
||||||
|
|
||||||
func RouteCreateGuild(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func RouteCreateGuild(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
|
@ -237,9 +237,9 @@ func RouteCreateGuild(w http.ResponseWriter, r *http.Request, user common.User)
|
||||||
if !user.Loggedin || !user.PluginPerms["CreateGuild"] {
|
if !user.Loggedin || !user.PluginPerms["CreateGuild"] {
|
||||||
return common.NoPermissions(w, r, user)
|
return common.NoPermissions(w, r, user)
|
||||||
}
|
}
|
||||||
CommonAreaWidgets(headerVars)
|
CommonAreaWidgets(header)
|
||||||
|
|
||||||
pi := common.Page{"Create Guild", user, headerVars, tList, nil}
|
pi := common.Page{"Create Guild", user, header, tList, nil}
|
||||||
err := common.Templates.ExecuteTemplate(w, "guilds_create_guild.html", pi)
|
err := common.Templates.ExecuteTemplate(w, "guilds_create_guild.html", pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
|
@ -298,7 +298,7 @@ func RouteCreateGuildSubmit(w http.ResponseWriter, r *http.Request, user common.
|
||||||
}
|
}
|
||||||
|
|
||||||
func RouteMemberList(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func RouteMemberList(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ func RouteMemberList(w http.ResponseWriter, r *http.Request, user common.User) c
|
||||||
}
|
}
|
||||||
guildItem.Link = BuildGuildURL(common.NameToSlug(guildItem.Name), guildItem.ID)
|
guildItem.Link = BuildGuildURL(common.NameToSlug(guildItem.Name), guildItem.ID)
|
||||||
|
|
||||||
GuildWidgets(headerVars, guildItem)
|
GuildWidgets(header, guildItem)
|
||||||
|
|
||||||
rows, err := MemberListJoinStmt.Query(guildID)
|
rows, err := MemberListJoinStmt.Query(guildID)
|
||||||
if err != nil && err != common.ErrNoRows {
|
if err != nil && err != common.ErrNoRows {
|
||||||
|
@ -356,12 +356,12 @@ func RouteMemberList(w http.ResponseWriter, r *http.Request, user common.User) c
|
||||||
}
|
}
|
||||||
rows.Close()
|
rows.Close()
|
||||||
|
|
||||||
pi := MemberListPage{"Guild Member List", user, headerVars, guildMembers, guildItem, 0, 0}
|
pi := MemberListPage{"Guild Member List", user, header, guildMembers, guildItem, 0, 0}
|
||||||
// A plugin with plugins. Pluginception!
|
// A plugin with plugins. Pluginception!
|
||||||
if common.RunPreRenderHook("pre_render_guilds_member_list", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_guilds_member_list", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err = common.RunThemeTemplate(headerVars.Theme.Name, "guilds_member_list", pi, w)
|
err = common.RunThemeTemplate(header.Theme.Name, "guilds_member_list", pi, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
@ -445,7 +445,7 @@ func ForumCheck(args ...interface{}) (skip bool, rerr common.RouteError) {
|
||||||
return true, common.InternalError(errors.New("Unable to find the parent group for a forum"), w, r)
|
return true, common.InternalError(errors.New("Unable to find the parent group for a forum"), w, r)
|
||||||
}
|
}
|
||||||
if !guildItem.Active {
|
if !guildItem.Active {
|
||||||
return true, common.NotFound(w, r, nil) // TODO: Can we pull headerVars out of args?
|
return true, common.NotFound(w, r, nil) // TODO: Can we pull header out of args?
|
||||||
}
|
}
|
||||||
r = r.WithContext(context.WithValue(r.Context(), "guilds_current_group", guildItem))
|
r = r.WithContext(context.WithValue(r.Context(), "guilds_current_group", guildItem))
|
||||||
}
|
}
|
||||||
|
@ -496,7 +496,7 @@ func ForumCheck(args ...interface{}) (skip bool, rerr common.RouteError) {
|
||||||
|
|
||||||
func Widgets(args ...interface{}) interface{} {
|
func Widgets(args ...interface{}) interface{} {
|
||||||
var zone = args[0].(string)
|
var zone = args[0].(string)
|
||||||
var headerVars = args[2].(*common.HeaderVars)
|
var header = args[2].(*common.Header)
|
||||||
var request = args[3].(*http.Request)
|
var request = args[3].(*http.Request)
|
||||||
|
|
||||||
if zone != "view_forum" {
|
if zone != "view_forum" {
|
||||||
|
@ -512,12 +512,12 @@ func Widgets(args ...interface{}) interface{} {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if headerVars.ExtData.Items == nil {
|
if header.ExtData.Items == nil {
|
||||||
headerVars.ExtData.Items = make(map[string]interface{})
|
header.ExtData.Items = make(map[string]interface{})
|
||||||
}
|
}
|
||||||
headerVars.ExtData.Items["guilds_current_group"] = guildItem
|
header.ExtData.Items["guilds_current_group"] = guildItem
|
||||||
|
|
||||||
return GuildWidgets(headerVars, guildItem)
|
return GuildWidgets(header, guildItem)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
12
gen_mysql.go
12
gen_mysql.go
|
@ -76,7 +76,7 @@ func _gen_mysql() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
common.DebugLog("Preparing getUsersOffset statement.")
|
common.DebugLog("Preparing getUsersOffset statement.")
|
||||||
stmts.getUsersOffset, err = db.Prepare("SELECT `uid`,`name`,`group`,`active`,`is_super_admin`,`avatar` FROM `users` ORDER BY uid ASC LIMIT ?,?")
|
stmts.getUsersOffset, err = db.Prepare("SELECT `uid`,`name`,`group`,`active`,`is_super_admin`,`avatar` FROM `users` ORDER BY `uid` ASC LIMIT ?,?")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Error in getUsersOffset statement.")
|
log.Print("Error in getUsersOffset statement.")
|
||||||
return err
|
return err
|
||||||
|
@ -97,14 +97,14 @@ func _gen_mysql() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
common.DebugLog("Preparing getModlogsOffset statement.")
|
common.DebugLog("Preparing getModlogsOffset statement.")
|
||||||
stmts.getModlogsOffset, err = db.Prepare("SELECT `action`,`elementID`,`elementType`,`ipaddress`,`actorID`,`doneAt` FROM `moderation_logs` ORDER BY doneAt DESC LIMIT ?,?")
|
stmts.getModlogsOffset, err = db.Prepare("SELECT `action`,`elementID`,`elementType`,`ipaddress`,`actorID`,`doneAt` FROM `moderation_logs` ORDER BY `doneAt` DESC LIMIT ?,?")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Error in getModlogsOffset statement.")
|
log.Print("Error in getModlogsOffset statement.")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
common.DebugLog("Preparing getAdminlogsOffset statement.")
|
common.DebugLog("Preparing getAdminlogsOffset statement.")
|
||||||
stmts.getAdminlogsOffset, err = db.Prepare("SELECT `action`,`elementID`,`elementType`,`ipaddress`,`actorID`,`doneAt` FROM `administration_logs` ORDER BY doneAt DESC LIMIT ?,?")
|
stmts.getAdminlogsOffset, err = db.Prepare("SELECT `action`,`elementID`,`elementType`,`ipaddress`,`actorID`,`doneAt` FROM `administration_logs` ORDER BY `doneAt` DESC LIMIT ?,?")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Error in getAdminlogsOffset statement.")
|
log.Print("Error in getAdminlogsOffset statement.")
|
||||||
return err
|
return err
|
||||||
|
@ -139,14 +139,14 @@ func _gen_mysql() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
common.DebugLog("Preparing forumEntryExists statement.")
|
common.DebugLog("Preparing forumEntryExists statement.")
|
||||||
stmts.forumEntryExists, err = db.Prepare("SELECT `fid` FROM `forums` WHERE `name` = '' ORDER BY fid ASC LIMIT 0,1")
|
stmts.forumEntryExists, err = db.Prepare("SELECT `fid` FROM `forums` WHERE `name` = '' ORDER BY `fid` ASC LIMIT 0,1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Error in forumEntryExists statement.")
|
log.Print("Error in forumEntryExists statement.")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
common.DebugLog("Preparing groupEntryExists statement.")
|
common.DebugLog("Preparing groupEntryExists statement.")
|
||||||
stmts.groupEntryExists, err = db.Prepare("SELECT `gid` FROM `users_groups` WHERE `name` = '' ORDER BY gid ASC LIMIT 0,1")
|
stmts.groupEntryExists, err = db.Prepare("SELECT `gid` FROM `users_groups` WHERE `name` = '' ORDER BY `gid` ASC LIMIT 0,1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Error in groupEntryExists statement.")
|
log.Print("Error in groupEntryExists statement.")
|
||||||
return err
|
return err
|
||||||
|
@ -160,7 +160,7 @@ func _gen_mysql() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
common.DebugLog("Preparing getForumTopics statement.")
|
common.DebugLog("Preparing getForumTopics statement.")
|
||||||
stmts.getForumTopics, err = db.Prepare("SELECT `topics`.`tid`, `topics`.`title`, `topics`.`content`, `topics`.`createdBy`, `topics`.`is_closed`, `topics`.`sticky`, `topics`.`createdAt`, `topics`.`lastReplyAt`, `topics`.`parentID`, `users`.`name`, `users`.`avatar` FROM `topics` LEFT JOIN `users` ON `topics`.`createdBy` = `users`.`uid` WHERE `topics`.`parentID` = ? ORDER BY topics.sticky DESC,topics.lastReplyAt DESC,topics.createdBy DESC")
|
stmts.getForumTopics, err = db.Prepare("SELECT `topics`.`tid`, `topics`.`title`, `topics`.`content`, `topics`.`createdBy`, `topics`.`is_closed`, `topics`.`sticky`, `topics`.`createdAt`, `topics`.`lastReplyAt`, `topics`.`parentID`, `users`.`name`, `users`.`avatar` FROM `topics` LEFT JOIN `users` ON `topics`.`createdBy` = `users`.`uid` WHERE `topics`.`parentID` = ? ORDER BY `topics`.`sticky` DESC,`topics`.`lastReplyAt` DESC,`topics`.`createdBy` DESC")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Error in getForumTopics statement.")
|
log.Print("Error in getForumTopics statement.")
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -649,6 +649,8 @@
|
||||||
"panel_backups_download":"Download",
|
"panel_backups_download":"Download",
|
||||||
"panel_backups_no_backups":"There aren't any backups available at this time.",
|
"panel_backups_no_backups":"There aren't any backups available at this time.",
|
||||||
"panel_debug_head":"Debug",
|
"panel_debug_head":"Debug",
|
||||||
|
"panel_debug_go_version_label":"Go Version",
|
||||||
|
"panel_debug_database_version_label":"DB Version",
|
||||||
"panel_debug_uptime_label":"Uptime",
|
"panel_debug_uptime_label":"Uptime",
|
||||||
"panel_debug_open_database_connections_label":"Open DB Conns",
|
"panel_debug_open_database_connections_label":"Open DB Conns",
|
||||||
"panel_debug_adapter_label":"Adapter"
|
"panel_debug_adapter_label":"Adapter"
|
||||||
|
|
17
main.go
17
main.go
|
@ -7,6 +7,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -70,6 +71,18 @@ func afterDBInit() (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Print("Initialising the menu item list")
|
||||||
|
common.Menus = common.NewDefaultMenuStore()
|
||||||
|
err = common.Menus.Load(1) // 1 = the default menu
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
menuHold := common.Menus.Get(1)
|
||||||
|
fmt.Println("menuHold: %+v", menuHold)
|
||||||
|
var b bytes.Buffer
|
||||||
|
menuHold.Build(&b, &common.GuestUser)
|
||||||
|
fmt.Println("menuHold output: ", string(b.Bytes()))
|
||||||
|
|
||||||
log.Print("Initialising the authentication system")
|
log.Print("Initialising the authentication system")
|
||||||
common.Auth, err = common.NewDefaultAuth()
|
common.Auth, err = common.NewDefaultAuth()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -225,6 +238,10 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = common.CompileJSTemplates()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -1747,7 +1748,7 @@ func routePanelUsers(w http.ResponseWriter, r *http.Request, user common.User) c
|
||||||
}
|
}
|
||||||
|
|
||||||
pageList := common.Paginate(stats.Users, perPage, 5)
|
pageList := common.Paginate(stats.Users, perPage, 5)
|
||||||
pi := common.PanelUserPage{common.GetTitlePhrase("panel_users"), user, headerVars, stats, "users", userList, pageList, page, lastPage}
|
pi := common.PanelUserPage{common.GetTitlePhrase("panel_users"), user, headerVars, stats, "users", userList, common.Paginator{pageList, page, lastPage}}
|
||||||
return panelRenderTemplate("panel_users", w, r, user, &pi)
|
return panelRenderTemplate("panel_users", w, r, user, &pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1940,7 +1941,7 @@ func routePanelGroups(w http.ResponseWriter, r *http.Request, user common.User)
|
||||||
//log.Printf("groupList: %+v\n", groupList)
|
//log.Printf("groupList: %+v\n", groupList)
|
||||||
|
|
||||||
pageList := common.Paginate(stats.Groups, perPage, 5)
|
pageList := common.Paginate(stats.Groups, perPage, 5)
|
||||||
pi := common.PanelGroupPage{common.GetTitlePhrase("panel_groups"), user, headerVars, stats, "groups", groupList, pageList, page, lastPage}
|
pi := common.PanelGroupPage{common.GetTitlePhrase("panel_groups"), user, headerVars, stats, "groups", groupList, common.Paginator{pageList, page, lastPage}}
|
||||||
return panelRenderTemplate("panel_groups", w, r, user, &pi)
|
return panelRenderTemplate("panel_groups", w, r, user, &pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2517,7 +2518,7 @@ func routePanelLogsMod(w http.ResponseWriter, r *http.Request, user common.User)
|
||||||
}
|
}
|
||||||
|
|
||||||
pageList := common.Paginate(logCount, perPage, 5)
|
pageList := common.Paginate(logCount, perPage, 5)
|
||||||
pi := common.PanelLogsPage{common.GetTitlePhrase("panel_mod_logs"), user, headerVars, stats, "logs", logs, pageList, page, lastPage}
|
pi := common.PanelLogsPage{common.GetTitlePhrase("panel_mod_logs"), user, headerVars, stats, "logs", logs, common.Paginator{pageList, page, lastPage}}
|
||||||
return panelRenderTemplate("panel_modlogs", w, r, user, &pi)
|
return panelRenderTemplate("panel_modlogs", w, r, user, &pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2557,7 +2558,7 @@ func routePanelLogsAdmin(w http.ResponseWriter, r *http.Request, user common.Use
|
||||||
}
|
}
|
||||||
|
|
||||||
pageList := common.Paginate(logCount, perPage, 5)
|
pageList := common.Paginate(logCount, perPage, 5)
|
||||||
pi := common.PanelLogsPage{common.GetTitlePhrase("panel_admin_logs"), user, headerVars, stats, "logs", logs, pageList, page, lastPage}
|
pi := common.PanelLogsPage{common.GetTitlePhrase("panel_admin_logs"), user, headerVars, stats, "logs", logs, common.Paginator{pageList, page, lastPage}}
|
||||||
return panelRenderTemplate("panel_adminlogs", w, r, user, &pi)
|
return panelRenderTemplate("panel_adminlogs", w, r, user, &pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2567,6 +2568,8 @@ func routePanelDebug(w http.ResponseWriter, r *http.Request, user common.User) c
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goVersion := runtime.Version()
|
||||||
|
dbVersion := qgen.Builder.DbVersion()
|
||||||
var uptime string
|
var uptime string
|
||||||
upDuration := time.Since(startTime)
|
upDuration := time.Since(startTime)
|
||||||
hours := int(upDuration.Hours())
|
hours := int(upDuration.Hours())
|
||||||
|
@ -2586,6 +2589,6 @@ func routePanelDebug(w http.ResponseWriter, r *http.Request, user common.User) c
|
||||||
// Disk I/O?
|
// Disk I/O?
|
||||||
// TODO: Fetch the adapter from Builder rather than getting it from a global?
|
// TODO: Fetch the adapter from Builder rather than getting it from a global?
|
||||||
|
|
||||||
pi := common.PanelDebugPage{common.GetTitlePhrase("panel_debug"), user, headerVars, stats, "debug", uptime, openConnCount, dbAdapter}
|
pi := common.PanelDebugPage{common.GetTitlePhrase("panel_debug"), user, headerVars, stats, "debug", goVersion, dbVersion, uptime, openConnCount, dbAdapter}
|
||||||
return panelRenderTemplate("panel_debug", w, r, user, &pi)
|
return panelRenderTemplate("panel_debug", w, r, user, &pi)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
@ -63,28 +64,13 @@ func patcher(scanner *bufio.Scanner) error {
|
||||||
|
|
||||||
func eachUser(handle func(int) error) error {
|
func eachUser(handle func(int) error) error {
|
||||||
acc := qgen.Builder.Accumulator()
|
acc := qgen.Builder.Accumulator()
|
||||||
stmt := acc.Select("users").Prepare()
|
err := acc.Select("users").Each(func(rows *sql.Rows) error {
|
||||||
err := acc.FirstError()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rows, err := stmt.Query()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer rows.Close()
|
|
||||||
|
|
||||||
for rows.Next() {
|
|
||||||
var uid int
|
var uid int
|
||||||
err := rows.Scan(&uid)
|
err := rows.Scan(&uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = handle(uid)
|
return handle(uid)
|
||||||
if err != nil {
|
})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return rows.Err()
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ func deactivateHeythere() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func heythereReply(data ...interface{}) interface{} {
|
func heythereReply(data ...interface{}) interface{} {
|
||||||
currentUser := data[0].(*common.TopicPage).CurrentUser
|
currentUser := data[0].(*common.TopicPage).Header.CurrentUser
|
||||||
reply := data[1].(*common.ReplyUser)
|
reply := data[1].(*common.ReplyUser)
|
||||||
reply.Content = "Hey there, " + currentUser.Name + "!"
|
reply.Content = "Hey there, " + currentUser.Name + "!"
|
||||||
reply.ContentHtml = "Hey there, " + currentUser.Name + "!"
|
reply.ContentHtml = "Hey there, " + currentUser.Name + "!"
|
||||||
|
|
|
@ -49,25 +49,25 @@ func (update *accUpdateBuilder) Prepare() *sql.Stmt {
|
||||||
return update.build.SimpleUpdate(update.table, update.set, update.where)
|
return update.build.SimpleUpdate(update.table, update.set, update.where)
|
||||||
}
|
}
|
||||||
|
|
||||||
type accSelectBuilder struct {
|
type AccSelectBuilder struct {
|
||||||
table string
|
table string
|
||||||
columns string
|
columns string
|
||||||
where string
|
where string
|
||||||
orderby string
|
orderby string
|
||||||
limit string
|
limit string
|
||||||
dateCutoff *dateCutoff // We might want to do this in a slightly less hacky way
|
dateCutoff *dateCutoff // We might want to do this in a slightly less hacky way
|
||||||
inChain *accSelectBuilder
|
inChain *AccSelectBuilder
|
||||||
inColumn string
|
inColumn string
|
||||||
|
|
||||||
build *Accumulator
|
build *Accumulator
|
||||||
}
|
}
|
||||||
|
|
||||||
func (selectItem *accSelectBuilder) Columns(columns string) *accSelectBuilder {
|
func (selectItem *AccSelectBuilder) Columns(columns string) *AccSelectBuilder {
|
||||||
selectItem.columns = columns
|
selectItem.columns = columns
|
||||||
return selectItem
|
return selectItem
|
||||||
}
|
}
|
||||||
|
|
||||||
func (selectItem *accSelectBuilder) Where(where string) *accSelectBuilder {
|
func (selectItem *AccSelectBuilder) Where(where string) *AccSelectBuilder {
|
||||||
if selectItem.where != "" {
|
if selectItem.where != "" {
|
||||||
selectItem.where += " AND "
|
selectItem.where += " AND "
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ func (selectItem *accSelectBuilder) Where(where string) *accSelectBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Don't implement the SQL at the accumulator level but the adapter level
|
// TODO: Don't implement the SQL at the accumulator level but the adapter level
|
||||||
func (selectItem *accSelectBuilder) In(column string, inList []int) *accSelectBuilder {
|
func (selectItem *AccSelectBuilder) In(column string, inList []int) *AccSelectBuilder {
|
||||||
if len(inList) == 0 {
|
if len(inList) == 0 {
|
||||||
return selectItem
|
return selectItem
|
||||||
}
|
}
|
||||||
|
@ -94,28 +94,28 @@ func (selectItem *accSelectBuilder) In(column string, inList []int) *accSelectBu
|
||||||
return selectItem
|
return selectItem
|
||||||
}
|
}
|
||||||
|
|
||||||
func (selectItem *accSelectBuilder) InQ(column string, subBuilder *accSelectBuilder) *accSelectBuilder {
|
func (selectItem *AccSelectBuilder) InQ(column string, subBuilder *AccSelectBuilder) *AccSelectBuilder {
|
||||||
selectItem.inChain = subBuilder
|
selectItem.inChain = subBuilder
|
||||||
selectItem.inColumn = column
|
selectItem.inColumn = column
|
||||||
return selectItem
|
return selectItem
|
||||||
}
|
}
|
||||||
|
|
||||||
func (selectItem *accSelectBuilder) DateCutoff(column string, quantity int, unit string) *accSelectBuilder {
|
func (selectItem *AccSelectBuilder) DateCutoff(column string, quantity int, unit string) *AccSelectBuilder {
|
||||||
selectItem.dateCutoff = &dateCutoff{column, quantity, unit}
|
selectItem.dateCutoff = &dateCutoff{column, quantity, unit}
|
||||||
return selectItem
|
return selectItem
|
||||||
}
|
}
|
||||||
|
|
||||||
func (selectItem *accSelectBuilder) Orderby(orderby string) *accSelectBuilder {
|
func (selectItem *AccSelectBuilder) Orderby(orderby string) *AccSelectBuilder {
|
||||||
selectItem.orderby = orderby
|
selectItem.orderby = orderby
|
||||||
return selectItem
|
return selectItem
|
||||||
}
|
}
|
||||||
|
|
||||||
func (selectItem *accSelectBuilder) Limit(limit string) *accSelectBuilder {
|
func (selectItem *AccSelectBuilder) Limit(limit string) *AccSelectBuilder {
|
||||||
selectItem.limit = limit
|
selectItem.limit = limit
|
||||||
return selectItem
|
return selectItem
|
||||||
}
|
}
|
||||||
|
|
||||||
func (selectItem *accSelectBuilder) Prepare() *sql.Stmt {
|
func (selectItem *AccSelectBuilder) Prepare() *sql.Stmt {
|
||||||
// TODO: Phase out the procedural API and use the adapter's OO API? The OO API might need a bit more work before we do that and it needs to be rolled out to MSSQL.
|
// TODO: Phase out the procedural API and use the adapter's OO API? The OO API might need a bit more work before we do that and it needs to be rolled out to MSSQL.
|
||||||
if selectItem.dateCutoff != nil || selectItem.inChain != nil {
|
if selectItem.dateCutoff != nil || selectItem.inChain != nil {
|
||||||
selectBuilder := selectItem.build.GetAdapter().Builder().Select().FromAcc(selectItem)
|
selectBuilder := selectItem.build.GetAdapter().Builder().Select().FromAcc(selectItem)
|
||||||
|
@ -124,7 +124,7 @@ func (selectItem *accSelectBuilder) Prepare() *sql.Stmt {
|
||||||
return selectItem.build.SimpleSelect(selectItem.table, selectItem.columns, selectItem.where, selectItem.orderby, selectItem.limit)
|
return selectItem.build.SimpleSelect(selectItem.table, selectItem.columns, selectItem.where, selectItem.orderby, selectItem.limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (selectItem *accSelectBuilder) Query(args ...interface{}) (*sql.Rows, error) {
|
func (selectItem *AccSelectBuilder) Query(args ...interface{}) (*sql.Rows, error) {
|
||||||
stmt := selectItem.Prepare()
|
stmt := selectItem.Prepare()
|
||||||
if stmt != nil {
|
if stmt != nil {
|
||||||
return stmt.Query(args...)
|
return stmt.Query(args...)
|
||||||
|
@ -132,6 +132,23 @@ func (selectItem *accSelectBuilder) Query(args ...interface{}) (*sql.Rows, error
|
||||||
return nil, selectItem.build.FirstError()
|
return nil, selectItem.build.FirstError()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Experimental, reduces lines
|
||||||
|
func (selectItem *AccSelectBuilder) Each(handle func(*sql.Rows) error) error {
|
||||||
|
rows, err := selectItem.Query()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
|
for rows.Next() {
|
||||||
|
err = handle(rows)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rows.Err()
|
||||||
|
}
|
||||||
|
|
||||||
type accInsertBuilder struct {
|
type accInsertBuilder struct {
|
||||||
table string
|
table string
|
||||||
columns string
|
columns string
|
||||||
|
|
|
@ -197,8 +197,8 @@ func (build *Accumulator) Update(table string) *accUpdateBuilder {
|
||||||
return &accUpdateBuilder{table, "", "", build}
|
return &accUpdateBuilder{table, "", "", build}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (build *Accumulator) Select(table string) *accSelectBuilder {
|
func (build *Accumulator) Select(table string) *AccSelectBuilder {
|
||||||
return &accSelectBuilder{table, "", "", "", "", nil, nil, "", build}
|
return &AccSelectBuilder{table, "", "", "", "", nil, nil, "", build}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (build *Accumulator) Insert(table string) *accInsertBuilder {
|
func (build *Accumulator) Insert(table string) *accInsertBuilder {
|
||||||
|
|
|
@ -142,7 +142,7 @@ func (selectItem *selectPrebuilder) Limit(limit string) *selectPrebuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We probably want to avoid the double allocation of two builders somehow
|
// TODO: We probably want to avoid the double allocation of two builders somehow
|
||||||
func (selectItem *selectPrebuilder) FromAcc(accBuilder *accSelectBuilder) *selectPrebuilder {
|
func (selectItem *selectPrebuilder) FromAcc(accBuilder *AccSelectBuilder) *selectPrebuilder {
|
||||||
selectItem.table = accBuilder.table
|
selectItem.table = accBuilder.table
|
||||||
selectItem.columns = accBuilder.columns
|
selectItem.columns = accBuilder.columns
|
||||||
selectItem.where = accBuilder.where
|
selectItem.where = accBuilder.where
|
||||||
|
|
|
@ -135,14 +135,13 @@ func (adapter *MssqlAdapter) SimpleInsert(name string, table string, columns str
|
||||||
if table == "" {
|
if table == "" {
|
||||||
return "", errors.New("You need a name for this table")
|
return "", errors.New("You need a name for this table")
|
||||||
}
|
}
|
||||||
if len(columns) == 0 {
|
|
||||||
return "", errors.New("No columns found for SimpleInsert")
|
|
||||||
}
|
|
||||||
if len(fields) == 0 {
|
|
||||||
return "", errors.New("No input data found for SimpleInsert")
|
|
||||||
}
|
|
||||||
|
|
||||||
var querystr = "INSERT INTO [" + table + "] ("
|
var querystr = "INSERT INTO [" + table + "]"
|
||||||
|
if columns == "" {
|
||||||
|
adapter.pushStatement(name, "insert", querystr)
|
||||||
|
return querystr, nil
|
||||||
|
}
|
||||||
|
querystr += " ("
|
||||||
|
|
||||||
// Escape the column names, just in case we've used a reserved keyword
|
// Escape the column names, just in case we've used a reserved keyword
|
||||||
for _, column := range processColumns(columns) {
|
for _, column := range processColumns(columns) {
|
||||||
|
|
|
@ -143,14 +143,10 @@ func (adapter *MysqlAdapter) SimpleInsert(name string, table string, columns str
|
||||||
if table == "" {
|
if table == "" {
|
||||||
return "", errors.New("You need a name for this table")
|
return "", errors.New("You need a name for this table")
|
||||||
}
|
}
|
||||||
if len(columns) == 0 {
|
|
||||||
return "", errors.New("No columns found for SimpleInsert")
|
|
||||||
}
|
|
||||||
if len(fields) == 0 {
|
|
||||||
return "", errors.New("No input data found for SimpleInsert")
|
|
||||||
}
|
|
||||||
|
|
||||||
var querystr = "INSERT INTO `" + table + "`(" + adapter.buildColumns(columns) + ") VALUES ("
|
var querystr = "INSERT INTO `" + table + "`"
|
||||||
|
if columns != "" {
|
||||||
|
querystr += "(" + adapter.buildColumns(columns) + ") VALUES ("
|
||||||
for _, field := range processFields(fields) {
|
for _, field := range processFields(fields) {
|
||||||
nameLen := len(field.Name)
|
nameLen := len(field.Name)
|
||||||
if field.Name[0] == '"' && field.Name[nameLen-1] == '"' && nameLen >= 3 {
|
if field.Name[0] == '"' && field.Name[nameLen-1] == '"' && nameLen >= 3 {
|
||||||
|
@ -162,12 +158,16 @@ func (adapter *MysqlAdapter) SimpleInsert(name string, table string, columns str
|
||||||
querystr += field.Name + ","
|
querystr += field.Name + ","
|
||||||
}
|
}
|
||||||
querystr = querystr[0:len(querystr)-1] + ")"
|
querystr = querystr[0:len(querystr)-1] + ")"
|
||||||
|
}
|
||||||
|
|
||||||
adapter.pushStatement(name, "insert", querystr)
|
adapter.pushStatement(name, "insert", querystr)
|
||||||
return querystr, nil
|
return querystr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (adapter *MysqlAdapter) buildColumns(columns string) (querystr string) {
|
func (adapter *MysqlAdapter) buildColumns(columns string) (querystr string) {
|
||||||
|
if columns == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
// Escape the column names, just in case we've used a reserved keyword
|
// Escape the column names, just in case we've used a reserved keyword
|
||||||
for _, column := range processColumns(columns) {
|
for _, column := range processColumns(columns) {
|
||||||
if column.Type == "function" {
|
if column.Type == "function" {
|
||||||
|
@ -393,7 +393,7 @@ func (adapter *MysqlAdapter) buildOrderby(orderby string) (querystr string) {
|
||||||
querystr = " ORDER BY "
|
querystr = " ORDER BY "
|
||||||
for _, column := range processOrderby(orderby) {
|
for _, column := range processOrderby(orderby) {
|
||||||
// TODO: We might want to escape this column
|
// TODO: We might want to escape this column
|
||||||
querystr += column.Column + " " + strings.ToUpper(column.Order) + ","
|
querystr += "`" + strings.Replace(column.Column, ".", "`.`", -1) + "` " + strings.ToUpper(column.Order) + ","
|
||||||
}
|
}
|
||||||
querystr = querystr[0 : len(querystr)-1]
|
querystr = querystr[0 : len(querystr)-1]
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,12 +115,6 @@ func (adapter *PgsqlAdapter) SimpleInsert(name string, table string, columns str
|
||||||
if table == "" {
|
if table == "" {
|
||||||
return "", errors.New("You need a name for this table")
|
return "", errors.New("You need a name for this table")
|
||||||
}
|
}
|
||||||
if len(columns) == 0 {
|
|
||||||
return "", errors.New("No columns found for SimpleInsert")
|
|
||||||
}
|
|
||||||
if len(fields) == 0 {
|
|
||||||
return "", errors.New("No input data found for SimpleInsert")
|
|
||||||
}
|
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,6 +209,32 @@ func seedTables(adapter qgen.Adapter) error {
|
||||||
|
|
||||||
qgen.Install.SimpleInsert("replies", "tid, content, parsed_content, createdAt, createdBy, lastUpdated, lastEdit, lastEditBy, ipaddress", "1,'A reply!','A reply!',UTC_TIMESTAMP(),1,UTC_TIMESTAMP(),0,0,'::1'")
|
qgen.Install.SimpleInsert("replies", "tid, content, parsed_content, createdAt, createdBy, lastUpdated, lastEdit, lastEditBy, ipaddress", "1,'A reply!','A reply!',UTC_TIMESTAMP(),1,UTC_TIMESTAMP(),0,0,'::1'")
|
||||||
|
|
||||||
|
/*
|
||||||
|
{{range .MenuItems}}
|
||||||
|
<li id="menu_{{.ID}}" class="menu_{{.Position}}"><a href="{{.Path}}" aria-label="{{.Aria}}" title="{{.Tooltip}}"></a></li>
|
||||||
|
{{end}}
|
||||||
|
<li class="menu_left menu_topics"><a href="/" aria-label="{{lang "menu_topics_aria"}}" title="{{lang "menu_topics_tooltip"}}"></a></li>
|
||||||
|
<li id="general_alerts" class="menu_right menu_alerts">
|
||||||
|
<div class="alert_bell"></div>
|
||||||
|
<div class="alert_counter" aria-label="{{lang "menu_alert_counter_aria"}}"></div>
|
||||||
|
<div class="alert_aftercounter"></div>
|
||||||
|
<div class="alertList" aria-label="{{lang "menu_alert_list_aria"}}"></div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
qgen.DBTableColumn{"guestOnly", "boolean", 1, false, false, "0"},
|
||||||
|
qgen.DBTableColumn{"memberOnly", "boolean", 1, false, false, "0"},
|
||||||
|
qgen.DBTableColumn{"staffOnly", "boolean", 1, false, false, "0"},
|
||||||
|
qgen.DBTableColumn{"adminOnly", "boolean", 1, false, false, "0"},
|
||||||
|
*/
|
||||||
|
|
||||||
|
qgen.Install.SimpleInsert("menus", "", "")
|
||||||
|
|
||||||
|
qgen.Install.SimpleInsert("menu_items", "mid, htmlID, position, path, aria, tooltip, order", "1,'menu_forums','left','/forums/','{lang.menu_forums_aria}','{lang.menu_forums_tooltip}',0")
|
||||||
|
|
||||||
|
qgen.Install.SimpleInsert("menu_items", "mid, htmlID, cssClass, position, path, aria, tooltip, order", "1,'menu_topics','menu_topics','left','/topics/','{lang.menu_topics_aria}','{lang.menu_topics_tooltip}',1")
|
||||||
|
|
||||||
|
qgen.Install.SimpleInsert("menu_items", "mid, htmlID, cssClass, position, tmplName, order", "1,'general_alerts','menu_alerts','right','menu_alerts',2")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,35 @@ func createTables(adapter qgen.Adapter) error {
|
||||||
[]qgen.DBTableKey{},
|
[]qgen.DBTableKey{},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
qgen.Install.CreateTable("menus", "", "",
|
||||||
|
[]qgen.DBTableColumn{
|
||||||
|
qgen.DBTableColumn{"mid", "int", 0, false, true, ""},
|
||||||
|
},
|
||||||
|
[]qgen.DBTableKey{
|
||||||
|
qgen.DBTableKey{"mid", "primary"},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
qgen.Install.CreateTable("menu_items", "", "",
|
||||||
|
[]qgen.DBTableColumn{
|
||||||
|
qgen.DBTableColumn{"mid", "int", 0, false, false, ""},
|
||||||
|
qgen.DBTableColumn{"htmlID", "varchar", 200, false, false, "''"},
|
||||||
|
qgen.DBTableColumn{"cssClass", "varchar", 200, false, false, "''"},
|
||||||
|
qgen.DBTableColumn{"position", "varchar", 100, false, false, ""},
|
||||||
|
qgen.DBTableColumn{"path", "varchar", 200, false, false, "''"},
|
||||||
|
qgen.DBTableColumn{"aria", "varchar", 200, false, false, "''"},
|
||||||
|
qgen.DBTableColumn{"tooltip", "varchar", 200, false, false, "''"},
|
||||||
|
qgen.DBTableColumn{"tmplName", "varchar", 200, false, false, "''"},
|
||||||
|
qgen.DBTableColumn{"order", "int", 0, false, false, "0"},
|
||||||
|
|
||||||
|
qgen.DBTableColumn{"guestOnly", "boolean", 0, false, false, "0"},
|
||||||
|
qgen.DBTableColumn{"memberOnly", "boolean", 0, false, false, "0"},
|
||||||
|
qgen.DBTableColumn{"staffOnly", "boolean", 0, false, false, "0"},
|
||||||
|
qgen.DBTableColumn{"adminOnly", "boolean", 0, false, false, "0"},
|
||||||
|
},
|
||||||
|
[]qgen.DBTableKey{},
|
||||||
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
qgen.Install.CreateTable("registration_logs", "", "",
|
qgen.Install.CreateTable("registration_logs", "", "",
|
||||||
[]qgen.DBTableColumn{
|
[]qgen.DBTableColumn{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// TODO: How should we handle headerLite and headerVar?
|
// TODO: How should we handle *HeaderLite and *Header?
|
||||||
func routes() {
|
func routes() {
|
||||||
addRoute(View("routeAPI", "/api/"))
|
addRoute(View("routeAPI", "/api/"))
|
||||||
addRoute(View("routes.Overview", "/overview/"))
|
addRoute(View("routes.Overview", "/overview/"))
|
||||||
|
|
|
@ -15,18 +15,18 @@ import (
|
||||||
var tList []interface{}
|
var tList []interface{}
|
||||||
|
|
||||||
func AccountLogin(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func AccountLogin(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
if user.Loggedin {
|
if user.Loggedin {
|
||||||
return common.LocalError("You're already logged in.", w, r, user)
|
return common.LocalError("You're already logged in.", w, r, user)
|
||||||
}
|
}
|
||||||
pi := common.Page{common.GetTitlePhrase("login"), user, headerVars, tList, nil}
|
pi := common.Page{common.GetTitlePhrase("login"), user, header, tList, nil}
|
||||||
if common.RunPreRenderHook("pre_render_login", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_login", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err := common.RunThemeTemplate(headerVars.Theme.Name, "login", pi, w)
|
err := common.RunThemeTemplate(header.Theme.Name, "login", pi, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
@ -74,18 +74,18 @@ func AccountLoginSubmit(w http.ResponseWriter, r *http.Request, user common.User
|
||||||
}
|
}
|
||||||
|
|
||||||
func AccountRegister(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func AccountRegister(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
if user.Loggedin {
|
if user.Loggedin {
|
||||||
return common.LocalError("You're already logged in.", w, r, user)
|
return common.LocalError("You're already logged in.", w, r, user)
|
||||||
}
|
}
|
||||||
pi := common.Page{common.GetTitlePhrase("register"), user, headerVars, tList, nil}
|
pi := common.Page{common.GetTitlePhrase("register"), user, header, tList, nil}
|
||||||
if common.RunPreRenderHook("pre_render_register", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_register", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err := common.RunThemeTemplate(headerVars.Theme.Name, "register", pi, w)
|
err := common.RunThemeTemplate(header.Theme.Name, "register", pi, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
@ -169,12 +169,12 @@ func AccountRegisterSubmit(w http.ResponseWriter, r *http.Request, user common.U
|
||||||
}
|
}
|
||||||
|
|
||||||
func AccountEditCritical(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func AccountEditCritical(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := common.Page{"Edit Password", user, headerVars, tList, nil}
|
pi := common.Page{"Edit Password", user, header, tList, nil}
|
||||||
if common.RunPreRenderHook("pre_render_account_own_edit_critical", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_account_own_edit_critical", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,19 +40,19 @@ func ViewForum(w http.ResponseWriter, r *http.Request, user common.User, sfid st
|
||||||
return common.PreError("The provided ForumID is not a valid number.", w, r)
|
return common.PreError("The provided ForumID is not a valid number.", w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
headerVars, ferr := common.ForumUserCheck(w, r, &user, fid)
|
header, ferr := common.ForumUserCheck(w, r, &user, fid)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
if !user.Perms.ViewTopic {
|
if !user.Perms.ViewTopic {
|
||||||
return common.NoPermissions(w, r, user)
|
return common.NoPermissions(w, r, user)
|
||||||
}
|
}
|
||||||
headerVars.Zone = "view_forum"
|
header.Zone = "view_forum"
|
||||||
|
|
||||||
// TODO: Fix this double-check
|
// TODO: Fix this double-check
|
||||||
forum, err := common.Forums.Get(fid)
|
forum, err := common.Forums.Get(fid)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return common.NotFound(w, r, headerVars)
|
return common.NotFound(w, r, header)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
@ -112,11 +112,11 @@ func ViewForum(w http.ResponseWriter, r *http.Request, user common.User, sfid st
|
||||||
}
|
}
|
||||||
|
|
||||||
pageList := common.Paginate(forum.TopicCount, common.Config.ItemsPerPage, 5)
|
pageList := common.Paginate(forum.TopicCount, common.Config.ItemsPerPage, 5)
|
||||||
pi := common.ForumPage{forum.Name, user, headerVars, topicList, forum, pageList, page, lastPage}
|
pi := common.ForumPage{forum.Name, user, header, topicList, forum, common.Paginator{pageList, page, lastPage}}
|
||||||
if common.RunPreRenderHook("pre_render_forum", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_forum", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err = common.RunThemeTemplate(headerVars.Theme.Name, "forum", pi, w)
|
err = common.RunThemeTemplate(header.Theme.Name, "forum", pi, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func ForumList(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func ForumList(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
headerVars.Zone = "forums"
|
header.Zone = "forums"
|
||||||
headerVars.MetaDesc = headerVars.Settings["meta_desc"].(string)
|
header.MetaDesc = header.Settings["meta_desc"].(string)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var forumList []common.Forum
|
var forumList []common.Forum
|
||||||
|
@ -50,11 +50,11 @@ func ForumList(w http.ResponseWriter, r *http.Request, user common.User) common.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := common.ForumsPage{common.GetTitlePhrase("forums"), user, headerVars, forumList}
|
pi := common.ForumsPage{common.GetTitlePhrase("forums"), user, header, forumList}
|
||||||
if common.RunPreRenderHook("pre_render_forum_list", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_forum_list", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err = common.RunThemeTemplate(headerVars.Theme.Name, "forums", pi, w)
|
err = common.RunThemeTemplate(header.Theme.Name, "forums", pi, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,13 +45,13 @@ func StaticFile(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Overview(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func Overview(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
headerVars.Zone = "overview"
|
header.Zone = "overview"
|
||||||
|
|
||||||
pi := common.Page{common.GetTitlePhrase("overview"), user, headerVars, tList, nil}
|
pi := common.Page{common.GetTitlePhrase("overview"), user, header, tList, nil}
|
||||||
if common.RunPreRenderHook("pre_render_overview", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_overview", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -63,18 +63,18 @@ func Overview(w http.ResponseWriter, r *http.Request, user common.User) common.R
|
||||||
}
|
}
|
||||||
|
|
||||||
func CustomPage(w http.ResponseWriter, r *http.Request, user common.User, name string) common.RouteError {
|
func CustomPage(w http.ResponseWriter, r *http.Request, user common.User, name string) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
headerVars.Zone = "custom_page"
|
header.Zone = "custom_page"
|
||||||
|
|
||||||
// ! Is this safe?
|
// ! Is this safe?
|
||||||
if common.Templates.Lookup("page_"+name+".html") == nil {
|
if common.Templates.Lookup("page_"+name+".html") == nil {
|
||||||
return common.NotFound(w, r, headerVars)
|
return common.NotFound(w, r, header)
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := common.Page{common.GetTitlePhrase("page"), user, headerVars, tList, nil}
|
pi := common.Page{common.GetTitlePhrase("page"), user, header, tList, nil}
|
||||||
// TODO: Pass the page name to the pre-render hook?
|
// TODO: Pass the page name to the pre-render hook?
|
||||||
if common.RunPreRenderHook("pre_render_custom_page", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_custom_page", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func IPSearch(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func IPSearch(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,11 @@ func IPSearch(w http.ResponseWriter, r *http.Request, user common.User) common.R
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := common.IPSearchPage{common.GetTitlePhrase("ip_search"), user, headerVars, userList, ip}
|
pi := common.IPSearchPage{common.GetTitlePhrase("ip_search"), user, header, userList, ip}
|
||||||
if common.RunPreRenderHook("pre_render_ip_search", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_ip_search", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err = common.RunThemeTemplate(headerVars.Theme.Name, "ip_search", pi, w)
|
err = common.RunThemeTemplate(header.Theme.Name, "ip_search", pi, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ViewProfile(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func ViewProfile(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ func ViewProfile(w http.ResponseWriter, r *http.Request, user common.User) commo
|
||||||
// TODO: Add a shared function for checking for ErrNoRows and internal erroring if it's not that case?
|
// TODO: Add a shared function for checking for ErrNoRows and internal erroring if it's not that case?
|
||||||
puser, err = common.Users.Get(pid)
|
puser, err = common.Users.Get(pid)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return common.NotFound(w, r, headerVars)
|
return common.NotFound(w, r, header)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
@ -113,12 +113,12 @@ func ViewProfile(w http.ResponseWriter, r *http.Request, user common.User) commo
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add a phrase for this title
|
// TODO: Add a phrase for this title
|
||||||
ppage := common.ProfilePage{puser.Name + "'s Profile", user, headerVars, replyList, *puser}
|
ppage := common.ProfilePage{puser.Name + "'s Profile", user, header, replyList, *puser}
|
||||||
if common.RunPreRenderHook("pre_render_profile", w, r, &user, &ppage) {
|
if common.RunPreRenderHook("pre_render_profile", w, r, &user, &ppage) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = common.RunThemeTemplate(headerVars.Theme.Name, "profile", ppage, w)
|
err = common.RunThemeTemplate(header.Theme.Name, "profile", ppage, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TopicList(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
func TopicList(w http.ResponseWriter, r *http.Request, user common.User) common.RouteError {
|
||||||
headerVars, ferr := common.UserCheck(w, r, &user)
|
header, ferr := common.UserCheck(w, r, &user)
|
||||||
if ferr != nil {
|
if ferr != nil {
|
||||||
return ferr
|
return ferr
|
||||||
}
|
}
|
||||||
headerVars.Zone = "topics"
|
header.Title = common.GetTitlePhrase("topics")
|
||||||
headerVars.MetaDesc = headerVars.Settings["meta_desc"].(string)
|
header.Zone = "topics"
|
||||||
|
header.MetaDesc = header.Settings["meta_desc"].(string)
|
||||||
|
|
||||||
group, err := common.Groups.Get(user.Group)
|
group, err := common.Groups.Get(user.Group)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -28,29 +29,26 @@ func TopicList(w http.ResponseWriter, r *http.Request, user common.User) common.
|
||||||
// TODO: Pass a struct back rather than passing back so many variables
|
// TODO: Pass a struct back rather than passing back so many variables
|
||||||
var topicList []*common.TopicsRow
|
var topicList []*common.TopicsRow
|
||||||
var forumList []common.Forum
|
var forumList []common.Forum
|
||||||
var pageList []int
|
var paginator common.Paginator
|
||||||
var lastPage int
|
|
||||||
if user.IsSuperAdmin {
|
if user.IsSuperAdmin {
|
||||||
topicList, forumList, pageList, page, lastPage, err = common.TopicList.GetList(page)
|
topicList, forumList, paginator, err = common.TopicList.GetList(page)
|
||||||
} else {
|
} else {
|
||||||
topicList, forumList, pageList, page, lastPage, err = common.TopicList.GetListByGroup(group, page)
|
topicList, forumList, paginator, err = common.TopicList.GetListByGroup(group, page)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ! Need an inline error not a page level error
|
// ! Need an inline error not a page level error
|
||||||
//log.Printf("topicList: %+v\n", topicList)
|
|
||||||
//log.Printf("forumList: %+v\n", forumList)
|
|
||||||
if len(topicList) == 0 {
|
if len(topicList) == 0 {
|
||||||
return common.NotFound(w, r, headerVars)
|
return common.NotFound(w, r, header)
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := common.TopicsPage{common.GetTitlePhrase("topics"), user, headerVars, topicList, forumList, common.Config.DefaultForum, pageList, page, lastPage}
|
pi := common.TopicListPage{header, topicList, forumList, common.Config.DefaultForum, paginator}
|
||||||
if common.RunPreRenderHook("pre_render_topic_list", w, r, &user, &pi) {
|
if common.RunPreRenderHook("pre_render_topic_list", w, r, &user, &pi) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err = common.RunThemeTemplate(headerVars.Theme.Name, "topics", pi, w)
|
err = common.RunThemeTemplate(header.Theme.Name, "topics", pi, w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.InternalError(err, w, r)
|
return common.InternalError(err, w, r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,3 +28,7 @@ INSERT INTO [forums_permissions] ([gid],[fid],[permissions]) VALUES (5,2,'{"View
|
||||||
INSERT INTO [forums_permissions] ([gid],[fid],[permissions]) VALUES (6,2,'{"ViewTopic":true}');
|
INSERT INTO [forums_permissions] ([gid],[fid],[permissions]) VALUES (6,2,'{"ViewTopic":true}');
|
||||||
INSERT INTO [topics] ([title],[content],[parsed_content],[createdAt],[lastReplyAt],[lastReplyBy],[createdBy],[parentID],[ipaddress]) VALUES ('TestTopic','Atopicautomaticallygeneratedbythesoftware.','Atopicautomaticallygeneratedbythesoftware.',GETUTCDATE(),GETUTCDATE(),1,1,2,'::1');
|
INSERT INTO [topics] ([title],[content],[parsed_content],[createdAt],[lastReplyAt],[lastReplyBy],[createdBy],[parentID],[ipaddress]) VALUES ('TestTopic','Atopicautomaticallygeneratedbythesoftware.','Atopicautomaticallygeneratedbythesoftware.',GETUTCDATE(),GETUTCDATE(),1,1,2,'::1');
|
||||||
INSERT INTO [replies] ([tid],[content],[parsed_content],[createdAt],[createdBy],[lastUpdated],[lastEdit],[lastEditBy],[ipaddress]) VALUES (1,'Areply!','Areply!',GETUTCDATE(),1,GETUTCDATE(),0,0,'::1');
|
INSERT INTO [replies] ([tid],[content],[parsed_content],[createdAt],[createdBy],[lastUpdated],[lastEdit],[lastEditBy],[ipaddress]) VALUES (1,'Areply!','Areply!',GETUTCDATE(),1,GETUTCDATE(),0,0,'::1');
|
||||||
|
INSERT INTO [menus];
|
||||||
|
INSERT INTO [menu_items] ([mid],[htmlID],[position],[path],[aria],[tooltip],[order]) VALUES (1,'menu_forums','left','/forums/','{lang.menu_forums_aria}','{lang.menu_forums_tooltip}',0);
|
||||||
|
INSERT INTO [menu_items] ([mid],[htmlID],[cssClass],[position],[path],[aria],[tooltip],[order]) VALUES (1,'menu_topics','menu_topics','left','/topics/','{lang.menu_topics_aria}','{lang.menu_topics_tooltip}',1);
|
||||||
|
INSERT INTO [menu_items] ([mid],[htmlID],[cssClass],[position],[tmplName],[order]) VALUES (1,'general_alerts','menu_alerts','right','menu_alerts',2);
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
CREATE TABLE [menu_items] (
|
||||||
|
[mid] int not null,
|
||||||
|
[htmlID] nvarchar (200) DEFAULT '' not null,
|
||||||
|
[cssClass] nvarchar (200) DEFAULT '' not null,
|
||||||
|
[position] nvarchar (100) not null,
|
||||||
|
[path] nvarchar (200) DEFAULT '' not null,
|
||||||
|
[aria] nvarchar (200) DEFAULT '' not null,
|
||||||
|
[tooltip] nvarchar (200) DEFAULT '' not null,
|
||||||
|
[tmplName] nvarchar (200) DEFAULT '' not null,
|
||||||
|
[order] int DEFAULT 0 not null,
|
||||||
|
[guestOnly] bit DEFAULT 0 not null,
|
||||||
|
[memberOnly] bit DEFAULT 0 not null,
|
||||||
|
[staffOnly] bit DEFAULT 0 not null,
|
||||||
|
[adminOnly] bit DEFAULT 0 not null
|
||||||
|
);
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE [menus] (
|
||||||
|
[mid] int not null IDENTITY,
|
||||||
|
primary key([mid])
|
||||||
|
);
|
|
@ -28,3 +28,7 @@ INSERT INTO `forums_permissions`(`gid`,`fid`,`permissions`) VALUES (5,2,'{"ViewT
|
||||||
INSERT INTO `forums_permissions`(`gid`,`fid`,`permissions`) VALUES (6,2,'{"ViewTopic":true}');
|
INSERT INTO `forums_permissions`(`gid`,`fid`,`permissions`) VALUES (6,2,'{"ViewTopic":true}');
|
||||||
INSERT INTO `topics`(`title`,`content`,`parsed_content`,`createdAt`,`lastReplyAt`,`lastReplyBy`,`createdBy`,`parentID`,`ipaddress`) VALUES ('TestTopic','Atopicautomaticallygeneratedbythesoftware.','Atopicautomaticallygeneratedbythesoftware.',UTC_TIMESTAMP(),UTC_TIMESTAMP(),1,1,2,'::1');
|
INSERT INTO `topics`(`title`,`content`,`parsed_content`,`createdAt`,`lastReplyAt`,`lastReplyBy`,`createdBy`,`parentID`,`ipaddress`) VALUES ('TestTopic','Atopicautomaticallygeneratedbythesoftware.','Atopicautomaticallygeneratedbythesoftware.',UTC_TIMESTAMP(),UTC_TIMESTAMP(),1,1,2,'::1');
|
||||||
INSERT INTO `replies`(`tid`,`content`,`parsed_content`,`createdAt`,`createdBy`,`lastUpdated`,`lastEdit`,`lastEditBy`,`ipaddress`) VALUES (1,'Areply!','Areply!',UTC_TIMESTAMP(),1,UTC_TIMESTAMP(),0,0,'::1');
|
INSERT INTO `replies`(`tid`,`content`,`parsed_content`,`createdAt`,`createdBy`,`lastUpdated`,`lastEdit`,`lastEditBy`,`ipaddress`) VALUES (1,'Areply!','Areply!',UTC_TIMESTAMP(),1,UTC_TIMESTAMP(),0,0,'::1');
|
||||||
|
INSERT INTO `menus`;
|
||||||
|
INSERT INTO `menu_items`(`mid`,`htmlID`,`position`,`path`,`aria`,`tooltip`,`order`) VALUES (1,'menu_forums','left','/forums/','{lang.menu_forums_aria}','{lang.menu_forums_tooltip}',0);
|
||||||
|
INSERT INTO `menu_items`(`mid`,`htmlID`,`cssClass`,`position`,`path`,`aria`,`tooltip`,`order`) VALUES (1,'menu_topics','menu_topics','left','/topics/','{lang.menu_topics_aria}','{lang.menu_topics_tooltip}',1);
|
||||||
|
INSERT INTO `menu_items`(`mid`,`htmlID`,`cssClass`,`position`,`tmplName`,`order`) VALUES (1,'general_alerts','menu_alerts','right','menu_alerts',2);
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
CREATE TABLE `menu_items` (
|
||||||
|
`mid` int not null,
|
||||||
|
`htmlID` varchar(200) DEFAULT '' not null,
|
||||||
|
`cssClass` varchar(200) DEFAULT '' not null,
|
||||||
|
`position` varchar(100) not null,
|
||||||
|
`path` varchar(200) DEFAULT '' not null,
|
||||||
|
`aria` varchar(200) DEFAULT '' not null,
|
||||||
|
`tooltip` varchar(200) DEFAULT '' not null,
|
||||||
|
`tmplName` varchar(200) DEFAULT '' not null,
|
||||||
|
`order` int DEFAULT 0 not null,
|
||||||
|
`guestOnly` boolean DEFAULT 0 not null,
|
||||||
|
`memberOnly` boolean DEFAULT 0 not null,
|
||||||
|
`staffOnly` boolean DEFAULT 0 not null,
|
||||||
|
`adminOnly` boolean DEFAULT 0 not null
|
||||||
|
);
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE `menus` (
|
||||||
|
`mid` int not null AUTO_INCREMENT,
|
||||||
|
primary key(`mid`)
|
||||||
|
);
|
|
@ -28,3 +28,7 @@
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
CREATE TABLE `menu_items` (
|
||||||
|
`mid` int not null,
|
||||||
|
`htmlID` varchar (200) DEFAULT '' not null,
|
||||||
|
`cssClass` varchar (200) DEFAULT '' not null,
|
||||||
|
`position` varchar (100) not null,
|
||||||
|
`path` varchar (200) DEFAULT '' not null,
|
||||||
|
`aria` varchar (200) DEFAULT '' not null,
|
||||||
|
`tooltip` varchar (200) DEFAULT '' not null,
|
||||||
|
`tmplName` varchar (200) DEFAULT '' not null,
|
||||||
|
`order` int DEFAULT 0 not null,
|
||||||
|
`guestOnly` boolean DEFAULT 0 not null,
|
||||||
|
`memberOnly` boolean DEFAULT 0 not null,
|
||||||
|
`staffOnly` boolean DEFAULT 0 not null,
|
||||||
|
`adminOnly` boolean DEFAULT 0 not null
|
||||||
|
);
|
|
@ -0,0 +1,4 @@
|
||||||
|
CREATE TABLE `menus` (
|
||||||
|
`mid` serial not null,
|
||||||
|
primary key(`mid`)
|
||||||
|
);
|
|
@ -3,8 +3,8 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
|
||||||
import "./common"
|
import "./common"
|
||||||
|
import "io"
|
||||||
|
|
||||||
var error_tmpl_phrase_id int
|
var error_tmpl_phrase_id int
|
||||||
|
|
||||||
|
@ -15,12 +15,6 @@ func init() {
|
||||||
common.TmplPtrMap["error"] = &common.Template_error_handle
|
common.TmplPtrMap["error"] = &common.Template_error_handle
|
||||||
common.TmplPtrMap["o_error"] = Template_error
|
common.TmplPtrMap["o_error"] = Template_error
|
||||||
error_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
error_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -42,7 +36,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_error(tmpl_error_vars common.Page, w http.ResponseWriter) error {
|
func Template_error(tmpl_error_vars common.Page, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(error_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(error_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_error_vars.Title))
|
w.Write([]byte(tmpl_error_vars.Title))
|
||||||
|
@ -84,59 +78,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_error_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_error_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_error_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_error_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_error_vars.Header)))
|
||||||
|
if tmpl_error_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_error_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_error_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_error_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_error_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_error_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_error_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_error_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_error_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_error_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -151,18 +133,18 @@ w.Write(header_frags[21])
|
||||||
}
|
}
|
||||||
w.Write(header_frags[22])
|
w.Write(header_frags[22])
|
||||||
w.Write(error_frags[0])
|
w.Write(error_frags[0])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(error_frags[1])
|
w.Write(error_frags[1])
|
||||||
w.Write([]byte(tmpl_error_vars.Something.(string)))
|
w.Write([]byte(tmpl_error_vars.Something.(string)))
|
||||||
w.Write(error_frags[2])
|
w.Write(error_frags[2])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_error_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_error_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_error_vars.Header.Themes) != 0 {
|
if len(tmpl_error_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_error_vars.Header.Themes {
|
for _, item := range tmpl_error_vars.Header.Themes {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
import "io"
|
||||||
import "./common"
|
import "./common"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
||||||
|
@ -16,12 +16,6 @@ func init() {
|
||||||
common.TmplPtrMap["forum"] = &common.Template_forum_handle
|
common.TmplPtrMap["forum"] = &common.Template_forum_handle
|
||||||
common.TmplPtrMap["o_forum"] = Template_forum
|
common.TmplPtrMap["o_forum"] = Template_forum
|
||||||
forum_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
forum_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -75,7 +69,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_forum(tmpl_forum_vars common.ForumPage, w http.ResponseWriter) error {
|
func Template_forum(tmpl_forum_vars common.ForumPage, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(forum_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(forum_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_forum_vars.Title))
|
w.Write([]byte(tmpl_forum_vars.Title))
|
||||||
|
@ -117,59 +111,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_forum_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_forum_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_forum_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_forum_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_forum_vars.Header)))
|
||||||
|
if tmpl_forum_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_forum_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_forum_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_forum_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_forum_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_forum_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_forum_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_forum_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_forum_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_forum_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -185,24 +167,24 @@ w.Write(header_frags[21])
|
||||||
w.Write(header_frags[22])
|
w.Write(header_frags[22])
|
||||||
if tmpl_forum_vars.Page > 1 {
|
if tmpl_forum_vars.Page > 1 {
|
||||||
w.Write(forum_frags[0])
|
w.Write(forum_frags[0])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(forum_frags[1])
|
w.Write(forum_frags[1])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
||||||
w.Write(forum_frags[2])
|
w.Write(forum_frags[2])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1)))
|
||||||
w.Write(forum_frags[3])
|
w.Write(forum_frags[3])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(forum_frags[4])
|
w.Write(forum_frags[4])
|
||||||
}
|
}
|
||||||
if tmpl_forum_vars.LastPage != tmpl_forum_vars.Page {
|
if tmpl_forum_vars.LastPage != tmpl_forum_vars.Page {
|
||||||
w.Write(forum_frags[5])
|
w.Write(forum_frags[5])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(forum_frags[6])
|
w.Write(forum_frags[6])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
||||||
w.Write(forum_frags[7])
|
w.Write(forum_frags[7])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1)))
|
||||||
w.Write(forum_frags[8])
|
w.Write(forum_frags[8])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(forum_frags[9])
|
w.Write(forum_frags[9])
|
||||||
}
|
}
|
||||||
w.Write(forum_frags[10])
|
w.Write(forum_frags[10])
|
||||||
|
@ -216,22 +198,22 @@ if tmpl_forum_vars.CurrentUser.ID != 0 {
|
||||||
w.Write(forum_frags[14])
|
w.Write(forum_frags[14])
|
||||||
if tmpl_forum_vars.CurrentUser.Perms.CreateTopic {
|
if tmpl_forum_vars.CurrentUser.Perms.CreateTopic {
|
||||||
w.Write(forum_frags[15])
|
w.Write(forum_frags[15])
|
||||||
w.Write(phrases[23])
|
w.Write(phrases[17])
|
||||||
w.Write(forum_frags[16])
|
w.Write(forum_frags[16])
|
||||||
w.Write(phrases[24])
|
w.Write(phrases[18])
|
||||||
w.Write(forum_frags[17])
|
w.Write(forum_frags[17])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
||||||
w.Write(forum_frags[18])
|
w.Write(forum_frags[18])
|
||||||
w.Write(forum_frags[19])
|
w.Write(forum_frags[19])
|
||||||
w.Write(phrases[25])
|
w.Write(phrases[19])
|
||||||
w.Write(forum_frags[20])
|
w.Write(forum_frags[20])
|
||||||
w.Write(phrases[26])
|
w.Write(phrases[20])
|
||||||
w.Write(forum_frags[21])
|
w.Write(forum_frags[21])
|
||||||
} else {
|
} else {
|
||||||
w.Write(forum_frags[22])
|
w.Write(forum_frags[22])
|
||||||
w.Write(phrases[27])
|
w.Write(phrases[21])
|
||||||
w.Write(forum_frags[23])
|
w.Write(forum_frags[23])
|
||||||
w.Write(phrases[28])
|
w.Write(phrases[22])
|
||||||
w.Write(forum_frags[24])
|
w.Write(forum_frags[24])
|
||||||
}
|
}
|
||||||
w.Write(forum_frags[25])
|
w.Write(forum_frags[25])
|
||||||
|
@ -239,48 +221,48 @@ w.Write(forum_frags[25])
|
||||||
w.Write(forum_frags[26])
|
w.Write(forum_frags[26])
|
||||||
if tmpl_forum_vars.CurrentUser.ID != 0 {
|
if tmpl_forum_vars.CurrentUser.ID != 0 {
|
||||||
w.Write(forum_frags[27])
|
w.Write(forum_frags[27])
|
||||||
w.Write(phrases[29])
|
w.Write(phrases[23])
|
||||||
w.Write(forum_frags[28])
|
w.Write(forum_frags[28])
|
||||||
w.Write(phrases[30])
|
w.Write(phrases[24])
|
||||||
w.Write(forum_frags[29])
|
w.Write(forum_frags[29])
|
||||||
w.Write(phrases[31])
|
w.Write(phrases[25])
|
||||||
w.Write(forum_frags[30])
|
w.Write(forum_frags[30])
|
||||||
w.Write(phrases[32])
|
w.Write(phrases[26])
|
||||||
w.Write(forum_frags[31])
|
w.Write(forum_frags[31])
|
||||||
w.Write(phrases[33])
|
w.Write(phrases[27])
|
||||||
w.Write(forum_frags[32])
|
w.Write(forum_frags[32])
|
||||||
if tmpl_forum_vars.CurrentUser.Perms.CreateTopic {
|
if tmpl_forum_vars.CurrentUser.Perms.CreateTopic {
|
||||||
w.Write(forum_frags[33])
|
w.Write(forum_frags[33])
|
||||||
w.Write(phrases[34])
|
w.Write(phrases[28])
|
||||||
w.Write(forum_frags[34])
|
w.Write(forum_frags[34])
|
||||||
w.Write([]byte(tmpl_forum_vars.CurrentUser.Avatar))
|
w.Write([]byte(tmpl_forum_vars.CurrentUser.Avatar))
|
||||||
w.Write(forum_frags[35])
|
w.Write(forum_frags[35])
|
||||||
w.Write(phrases[35])
|
w.Write(phrases[29])
|
||||||
w.Write(forum_frags[36])
|
w.Write(forum_frags[36])
|
||||||
w.Write(phrases[36])
|
w.Write(phrases[30])
|
||||||
w.Write(forum_frags[37])
|
w.Write(forum_frags[37])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
||||||
w.Write(forum_frags[38])
|
w.Write(forum_frags[38])
|
||||||
w.Write(phrases[37])
|
w.Write(phrases[31])
|
||||||
w.Write(forum_frags[39])
|
w.Write(forum_frags[39])
|
||||||
w.Write(phrases[38])
|
w.Write(phrases[32])
|
||||||
w.Write(forum_frags[40])
|
w.Write(forum_frags[40])
|
||||||
w.Write(phrases[39])
|
w.Write(phrases[33])
|
||||||
w.Write(forum_frags[41])
|
w.Write(forum_frags[41])
|
||||||
w.Write(phrases[40])
|
w.Write(phrases[34])
|
||||||
w.Write(forum_frags[42])
|
w.Write(forum_frags[42])
|
||||||
if tmpl_forum_vars.CurrentUser.Perms.UploadFiles {
|
if tmpl_forum_vars.CurrentUser.Perms.UploadFiles {
|
||||||
w.Write(forum_frags[43])
|
w.Write(forum_frags[43])
|
||||||
w.Write(phrases[41])
|
w.Write(phrases[35])
|
||||||
w.Write(forum_frags[44])
|
w.Write(forum_frags[44])
|
||||||
}
|
}
|
||||||
w.Write(forum_frags[45])
|
w.Write(forum_frags[45])
|
||||||
w.Write(phrases[42])
|
w.Write(phrases[36])
|
||||||
w.Write(forum_frags[46])
|
w.Write(forum_frags[46])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Write(forum_frags[47])
|
w.Write(forum_frags[47])
|
||||||
w.Write(phrases[43])
|
w.Write(phrases[37])
|
||||||
w.Write(forum_frags[48])
|
w.Write(forum_frags[48])
|
||||||
if len(tmpl_forum_vars.ItemList) != 0 {
|
if len(tmpl_forum_vars.ItemList) != 0 {
|
||||||
for _, item := range tmpl_forum_vars.ItemList {
|
for _, item := range tmpl_forum_vars.ItemList {
|
||||||
|
@ -317,12 +299,12 @@ w.Write([]byte(item.Creator.Name))
|
||||||
w.Write(forum_frags[63])
|
w.Write(forum_frags[63])
|
||||||
if item.IsClosed {
|
if item.IsClosed {
|
||||||
w.Write(forum_frags[64])
|
w.Write(forum_frags[64])
|
||||||
w.Write(phrases[44])
|
w.Write(phrases[38])
|
||||||
w.Write(forum_frags[65])
|
w.Write(forum_frags[65])
|
||||||
}
|
}
|
||||||
if item.Sticky {
|
if item.Sticky {
|
||||||
w.Write(forum_frags[66])
|
w.Write(forum_frags[66])
|
||||||
w.Write(phrases[45])
|
w.Write(phrases[39])
|
||||||
w.Write(forum_frags[67])
|
w.Write(forum_frags[67])
|
||||||
}
|
}
|
||||||
w.Write(forum_frags[68])
|
w.Write(forum_frags[68])
|
||||||
|
@ -357,12 +339,12 @@ w.Write(forum_frags[81])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
w.Write(forum_frags[82])
|
w.Write(forum_frags[82])
|
||||||
w.Write(phrases[46])
|
w.Write(phrases[40])
|
||||||
if tmpl_forum_vars.CurrentUser.Perms.CreateTopic {
|
if tmpl_forum_vars.CurrentUser.Perms.CreateTopic {
|
||||||
w.Write(forum_frags[83])
|
w.Write(forum_frags[83])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Forum.ID)))
|
||||||
w.Write(forum_frags[84])
|
w.Write(forum_frags[84])
|
||||||
w.Write(phrases[47])
|
w.Write(phrases[41])
|
||||||
w.Write(forum_frags[85])
|
w.Write(forum_frags[85])
|
||||||
}
|
}
|
||||||
w.Write(forum_frags[86])
|
w.Write(forum_frags[86])
|
||||||
|
@ -374,9 +356,9 @@ if tmpl_forum_vars.Page > 1 {
|
||||||
w.Write(paginator_frags[1])
|
w.Write(paginator_frags[1])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1)))
|
||||||
w.Write(paginator_frags[2])
|
w.Write(paginator_frags[2])
|
||||||
w.Write(phrases[48])
|
w.Write(phrases[42])
|
||||||
w.Write(paginator_frags[3])
|
w.Write(paginator_frags[3])
|
||||||
w.Write(phrases[49])
|
w.Write(phrases[43])
|
||||||
w.Write(paginator_frags[4])
|
w.Write(paginator_frags[4])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page - 1)))
|
||||||
w.Write(paginator_frags[5])
|
w.Write(paginator_frags[5])
|
||||||
|
@ -396,9 +378,9 @@ w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1)))
|
||||||
w.Write(paginator_frags[10])
|
w.Write(paginator_frags[10])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_forum_vars.Page + 1)))
|
||||||
w.Write(paginator_frags[11])
|
w.Write(paginator_frags[11])
|
||||||
w.Write(phrases[50])
|
w.Write(phrases[44])
|
||||||
w.Write(paginator_frags[12])
|
w.Write(paginator_frags[12])
|
||||||
w.Write(phrases[51])
|
w.Write(phrases[45])
|
||||||
w.Write(paginator_frags[13])
|
w.Write(paginator_frags[13])
|
||||||
}
|
}
|
||||||
w.Write(paginator_frags[14])
|
w.Write(paginator_frags[14])
|
||||||
|
@ -407,11 +389,11 @@ w.Write(forum_frags[88])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_forum_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_forum_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[52])
|
w.Write(phrases[46])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[53])
|
w.Write(phrases[47])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[54])
|
w.Write(phrases[48])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_forum_vars.Header.Themes) != 0 {
|
if len(tmpl_forum_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_forum_vars.Header.Themes {
|
for _, item := range tmpl_forum_vars.Header.Themes {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
import "io"
|
||||||
import "./common"
|
import "./common"
|
||||||
|
|
||||||
var forums_tmpl_phrase_id int
|
var forums_tmpl_phrase_id int
|
||||||
|
@ -15,12 +15,6 @@ func init() {
|
||||||
common.TmplPtrMap["forums"] = &common.Template_forums_handle
|
common.TmplPtrMap["forums"] = &common.Template_forums_handle
|
||||||
common.TmplPtrMap["o_forums"] = Template_forums
|
common.TmplPtrMap["o_forums"] = Template_forums
|
||||||
forums_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
forums_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -45,7 +39,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_forums(tmpl_forums_vars common.ForumsPage, w http.ResponseWriter) error {
|
func Template_forums(tmpl_forums_vars common.ForumsPage, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(forums_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(forums_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_forums_vars.Title))
|
w.Write([]byte(tmpl_forums_vars.Title))
|
||||||
|
@ -87,59 +81,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_forums_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_forums_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_forums_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_forums_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_forums_vars.Header)))
|
||||||
|
if tmpl_forums_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_forums_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_forums_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_forums_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_forums_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_forums_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_forums_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_forums_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_forums_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_forums_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -154,7 +136,7 @@ w.Write(header_frags[21])
|
||||||
}
|
}
|
||||||
w.Write(header_frags[22])
|
w.Write(header_frags[22])
|
||||||
w.Write(forums_frags[0])
|
w.Write(forums_frags[0])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(forums_frags[1])
|
w.Write(forums_frags[1])
|
||||||
if len(tmpl_forums_vars.ItemList) != 0 {
|
if len(tmpl_forums_vars.ItemList) != 0 {
|
||||||
for _, item := range tmpl_forums_vars.ItemList {
|
for _, item := range tmpl_forums_vars.ItemList {
|
||||||
|
@ -173,7 +155,7 @@ w.Write([]byte(item.Desc))
|
||||||
w.Write(forums_frags[8])
|
w.Write(forums_frags[8])
|
||||||
} else {
|
} else {
|
||||||
w.Write(forums_frags[9])
|
w.Write(forums_frags[9])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(forums_frags[10])
|
w.Write(forums_frags[10])
|
||||||
}
|
}
|
||||||
w.Write(forums_frags[11])
|
w.Write(forums_frags[11])
|
||||||
|
@ -192,7 +174,7 @@ w.Write(forums_frags[17])
|
||||||
if item.LastTopic.Title != "" {
|
if item.LastTopic.Title != "" {
|
||||||
w.Write([]byte(item.LastTopic.Title))
|
w.Write([]byte(item.LastTopic.Title))
|
||||||
} else {
|
} else {
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
}
|
}
|
||||||
w.Write(forums_frags[18])
|
w.Write(forums_frags[18])
|
||||||
if item.LastTopicTime != "" {
|
if item.LastTopicTime != "" {
|
||||||
|
@ -204,18 +186,18 @@ w.Write(forums_frags[21])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
w.Write(forums_frags[22])
|
w.Write(forums_frags[22])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(forums_frags[23])
|
w.Write(forums_frags[23])
|
||||||
}
|
}
|
||||||
w.Write(forums_frags[24])
|
w.Write(forums_frags[24])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_forums_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_forums_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[23])
|
w.Write(phrases[17])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[24])
|
w.Write(phrases[18])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[25])
|
w.Write(phrases[19])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_forums_vars.Header.Themes) != 0 {
|
if len(tmpl_forums_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_forums_vars.Header.Themes {
|
for _, item := range tmpl_forums_vars.Header.Themes {
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "strconv"
|
import "io"
|
||||||
import "net/http"
|
|
||||||
import "./common"
|
import "./common"
|
||||||
import "./extend/guilds/lib"
|
import "./extend/guilds/lib"
|
||||||
|
import "strconv"
|
||||||
|
|
||||||
var guilds_guild_list_tmpl_phrase_id int
|
var guilds_guild_list_tmpl_phrase_id int
|
||||||
|
|
||||||
|
@ -14,12 +14,6 @@ var guilds_guild_list_tmpl_phrase_id int
|
||||||
func init() {
|
func init() {
|
||||||
common.TmplPtrMap["o_guilds_guild_list"] = Template_guilds_guild_list
|
common.TmplPtrMap["o_guilds_guild_list"] = Template_guilds_guild_list
|
||||||
guilds_guild_list_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
guilds_guild_list_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -40,7 +34,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_guilds_guild_list(tmpl_guilds_guild_list_vars guilds.ListPage, w http.ResponseWriter) error {
|
func Template_guilds_guild_list(tmpl_guilds_guild_list_vars guilds.ListPage, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(guilds_guild_list_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(guilds_guild_list_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_guilds_guild_list_vars.Title))
|
w.Write([]byte(tmpl_guilds_guild_list_vars.Title))
|
||||||
|
@ -82,59 +76,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_guilds_guild_list_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_guilds_guild_list_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_guilds_guild_list_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_guilds_guild_list_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_guilds_guild_list_vars.Header)))
|
||||||
|
if tmpl_guilds_guild_list_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_guilds_guild_list_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_guilds_guild_list_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_guilds_guild_list_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_guilds_guild_list_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_guilds_guild_list_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_guilds_guild_list_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_guilds_guild_list_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_guilds_guild_list_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_guilds_guild_list_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -170,11 +152,11 @@ w.Write(guilds_guild_list_frags[8])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_guilds_guild_list_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_guilds_guild_list_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_guilds_guild_list_vars.Header.Themes) != 0 {
|
if len(tmpl_guilds_guild_list_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_guilds_guild_list_vars.Header.Themes {
|
for _, item := range tmpl_guilds_guild_list_vars.Header.Themes {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
import "io"
|
||||||
import "./common"
|
import "./common"
|
||||||
|
|
||||||
var ip_search_tmpl_phrase_id int
|
var ip_search_tmpl_phrase_id int
|
||||||
|
@ -15,12 +15,6 @@ func init() {
|
||||||
common.TmplPtrMap["ip_search"] = &common.Template_ip_search_handle
|
common.TmplPtrMap["ip_search"] = &common.Template_ip_search_handle
|
||||||
common.TmplPtrMap["o_ip_search"] = Template_ip_search
|
common.TmplPtrMap["o_ip_search"] = Template_ip_search
|
||||||
ip_search_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
ip_search_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -44,7 +38,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_ip_search(tmpl_ip_search_vars common.IPSearchPage, w http.ResponseWriter) error {
|
func Template_ip_search(tmpl_ip_search_vars common.IPSearchPage, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(ip_search_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(ip_search_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_ip_search_vars.Title))
|
w.Write([]byte(tmpl_ip_search_vars.Title))
|
||||||
|
@ -86,59 +80,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_ip_search_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_ip_search_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_ip_search_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_ip_search_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_ip_search_vars.Header)))
|
||||||
|
if tmpl_ip_search_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_ip_search_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_ip_search_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_ip_search_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_ip_search_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_ip_search_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_ip_search_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_ip_search_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_ip_search_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_ip_search_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -153,7 +135,7 @@ w.Write(header_frags[21])
|
||||||
}
|
}
|
||||||
w.Write(header_frags[22])
|
w.Write(header_frags[22])
|
||||||
w.Write(ip_search_frags[0])
|
w.Write(ip_search_frags[0])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(ip_search_frags[1])
|
w.Write(ip_search_frags[1])
|
||||||
if tmpl_ip_search_vars.IP != "" {
|
if tmpl_ip_search_vars.IP != "" {
|
||||||
w.Write(ip_search_frags[2])
|
w.Write(ip_search_frags[2])
|
||||||
|
@ -161,7 +143,7 @@ w.Write([]byte(tmpl_ip_search_vars.IP))
|
||||||
w.Write(ip_search_frags[3])
|
w.Write(ip_search_frags[3])
|
||||||
}
|
}
|
||||||
w.Write(ip_search_frags[4])
|
w.Write(ip_search_frags[4])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(ip_search_frags[5])
|
w.Write(ip_search_frags[5])
|
||||||
if tmpl_ip_search_vars.IP != "" {
|
if tmpl_ip_search_vars.IP != "" {
|
||||||
w.Write(ip_search_frags[6])
|
w.Write(ip_search_frags[6])
|
||||||
|
@ -181,7 +163,7 @@ w.Write(ip_search_frags[12])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
w.Write(ip_search_frags[13])
|
w.Write(ip_search_frags[13])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(ip_search_frags[14])
|
w.Write(ip_search_frags[14])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,11 +173,11 @@ w.Write(ip_search_frags[16])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_ip_search_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_ip_search_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[23])
|
w.Write(phrases[17])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[24])
|
w.Write(phrases[18])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_ip_search_vars.Header.Themes) != 0 {
|
if len(tmpl_ip_search_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_ip_search_vars.Header.Themes {
|
for _, item := range tmpl_ip_search_vars.Header.Themes {
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
var footer_frags = make([][]byte,13)
|
|
||||||
var topic_alt_frags = make([][]byte,200)
|
|
||||||
var ip_search_frags = make([][]byte,18)
|
|
||||||
var guilds_guild_list_frags = make([][]byte,10)
|
|
||||||
var topics_frags = make([][]byte,98)
|
|
||||||
var forum_frags = make([][]byte,90)
|
|
||||||
var header_frags = make([][]byte,24)
|
|
||||||
var topic_frags = make([][]byte,199)
|
|
||||||
var profile_comments_row_frags = make([][]byte,51)
|
|
||||||
var profile_frags = make([][]byte,50)
|
|
||||||
var forums_frags = make([][]byte,26)
|
|
||||||
var login_frags = make([][]byte,8)
|
|
||||||
var register_frags = make([][]byte,9)
|
|
||||||
var menu_frags = make([][]byte,30)
|
|
||||||
var paginator_frags = make([][]byte,16)
|
var paginator_frags = make([][]byte,16)
|
||||||
|
var register_frags = make([][]byte,9)
|
||||||
|
var topic_alt_frags = make([][]byte,200)
|
||||||
|
var profile_comments_row_frags = make([][]byte,51)
|
||||||
|
var topics_frags = make([][]byte,98)
|
||||||
var error_frags = make([][]byte,4)
|
var error_frags = make([][]byte,4)
|
||||||
|
var guilds_guild_list_frags = make([][]byte,10)
|
||||||
|
var topic_frags = make([][]byte,199)
|
||||||
|
var forums_frags = make([][]byte,26)
|
||||||
|
var profile_frags = make([][]byte,50)
|
||||||
|
var forum_frags = make([][]byte,90)
|
||||||
|
var login_frags = make([][]byte,8)
|
||||||
|
var ip_search_frags = make([][]byte,18)
|
||||||
|
var menu_frags = make([][]byte,23)
|
||||||
|
var footer_frags = make([][]byte,13)
|
||||||
|
var header_frags = make([][]byte,24)
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -65,59 +65,44 @@ menu_frags[1] = []byte(`</div>
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<div class="move_left">
|
<div class="move_left">
|
||||||
<div class="move_right">
|
<div class="move_right">
|
||||||
<ul>`)
|
<ul>
|
||||||
menu_frags[2] = []byte(`
|
|
||||||
<li id="menu_overview" class="menu_left"><a href="/" rel="home">`)
|
<li id="menu_overview" class="menu_left"><a href="/" rel="home">`)
|
||||||
menu_frags[3] = []byte(`</a></li>
|
menu_frags[2] = []byte(`</a></li>
|
||||||
<li id="menu_forums" class="menu_left"><a href="/forums/" aria-label="`)
|
`)
|
||||||
|
menu_frags[3] = []byte(`
|
||||||
|
<li class="menu_left menu_account"><a href="/user/edit/critical/" aria-label="`)
|
||||||
menu_frags[4] = []byte(`" title="`)
|
menu_frags[4] = []byte(`" title="`)
|
||||||
menu_frags[5] = []byte(`"></a></li>
|
menu_frags[5] = []byte(`"></a></li>
|
||||||
<li class="menu_left menu_topics"><a href="/" aria-label="`)
|
|
||||||
menu_frags[6] = []byte(`" title="`)
|
|
||||||
menu_frags[7] = []byte(`"></a></li>
|
|
||||||
<li id="general_alerts" class="menu_right menu_alerts">
|
|
||||||
<div class="alert_bell"></div>
|
|
||||||
<div class="alert_counter" aria-label="`)
|
|
||||||
menu_frags[8] = []byte(`"></div>
|
|
||||||
<div class="alert_aftercounter"></div>
|
|
||||||
<div class="alertList" aria-label="`)
|
|
||||||
menu_frags[9] = []byte(`"></div>
|
|
||||||
</li>
|
|
||||||
`)
|
|
||||||
menu_frags[10] = []byte(`
|
|
||||||
<li class="menu_left menu_account"><a href="/user/edit/critical/" aria-label="`)
|
|
||||||
menu_frags[11] = []byte(`" title="`)
|
|
||||||
menu_frags[12] = []byte(`"></a></li>
|
|
||||||
<li class="menu_left menu_profile"><a href="`)
|
<li class="menu_left menu_profile"><a href="`)
|
||||||
menu_frags[13] = []byte(`" aria-label="`)
|
menu_frags[6] = []byte(`" aria-label="`)
|
||||||
menu_frags[14] = []byte(`" title="`)
|
menu_frags[7] = []byte(`" title="`)
|
||||||
menu_frags[15] = []byte(`"></a></li>
|
menu_frags[8] = []byte(`"></a></li>
|
||||||
<li class="menu_left menu_panel menu_account supermod_only"><a href="/panel/" aria-label="`)
|
<li class="menu_left menu_panel menu_account supermod_only"><a href="/panel/" aria-label="`)
|
||||||
menu_frags[16] = []byte(`" title="`)
|
menu_frags[9] = []byte(`" title="`)
|
||||||
menu_frags[17] = []byte(`"></a></li>
|
menu_frags[10] = []byte(`"></a></li>
|
||||||
<li class="menu_left menu_logout"><a href="/accounts/logout/?session=`)
|
<li class="menu_left menu_logout"><a href="/accounts/logout/?session=`)
|
||||||
menu_frags[18] = []byte(`" aria-label="`)
|
menu_frags[11] = []byte(`" aria-label="`)
|
||||||
menu_frags[19] = []byte(`" title="`)
|
menu_frags[12] = []byte(`" title="`)
|
||||||
menu_frags[20] = []byte(`"></a></li>
|
menu_frags[13] = []byte(`"></a></li>
|
||||||
`)
|
`)
|
||||||
menu_frags[21] = []byte(`
|
menu_frags[14] = []byte(`
|
||||||
<li class="menu_left menu_register"><a href="/accounts/create/" aria-label="`)
|
<li class="menu_left menu_register"><a href="/accounts/create/" aria-label="`)
|
||||||
menu_frags[22] = []byte(`" title="`)
|
menu_frags[15] = []byte(`" title="`)
|
||||||
menu_frags[23] = []byte(`"></a></li>
|
menu_frags[16] = []byte(`"></a></li>
|
||||||
<li class="menu_left menu_login"><a href="/accounts/login/" aria-label="`)
|
<li class="menu_left menu_login"><a href="/accounts/login/" aria-label="`)
|
||||||
menu_frags[24] = []byte(`" title="`)
|
menu_frags[17] = []byte(`" title="`)
|
||||||
menu_frags[25] = []byte(`"></a></li>
|
menu_frags[18] = []byte(`"></a></li>
|
||||||
`)
|
`)
|
||||||
menu_frags[26] = []byte(`
|
menu_frags[19] = []byte(`
|
||||||
<li class="menu_left menu_hamburger" title="`)
|
<li class="menu_left menu_hamburger" title="`)
|
||||||
menu_frags[27] = []byte(`"><a></a></li>
|
menu_frags[20] = []byte(`"><a></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="right_of_nav">`)
|
<div class="right_of_nav">`)
|
||||||
menu_frags[28] = []byte(`</div>`)
|
menu_frags[21] = []byte(`</div>`)
|
||||||
header_frags[17] = []byte(`
|
header_frags[17] = []byte(`
|
||||||
<div id="back"><div id="main" `)
|
<div id="back"><div id="main" `)
|
||||||
header_frags[18] = []byte(`class="shrink_main"`)
|
header_frags[18] = []byte(`class="shrink_main"`)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
import "io"
|
||||||
import "./common"
|
import "./common"
|
||||||
|
|
||||||
var login_tmpl_phrase_id int
|
var login_tmpl_phrase_id int
|
||||||
|
@ -15,12 +15,6 @@ func init() {
|
||||||
common.TmplPtrMap["login"] = &common.Template_login_handle
|
common.TmplPtrMap["login"] = &common.Template_login_handle
|
||||||
common.TmplPtrMap["o_login"] = Template_login
|
common.TmplPtrMap["o_login"] = Template_login
|
||||||
login_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
login_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -47,7 +41,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_login(tmpl_login_vars common.Page, w http.ResponseWriter) error {
|
func Template_login(tmpl_login_vars common.Page, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(login_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(login_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_login_vars.Title))
|
w.Write([]byte(tmpl_login_vars.Title))
|
||||||
|
@ -89,59 +83,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_login_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_login_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_login_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_login_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_login_vars.Header)))
|
||||||
|
if tmpl_login_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_login_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_login_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_login_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_login_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_login_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_login_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_login_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_login_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_login_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -156,26 +138,26 @@ w.Write(header_frags[21])
|
||||||
}
|
}
|
||||||
w.Write(header_frags[22])
|
w.Write(header_frags[22])
|
||||||
w.Write(login_frags[0])
|
w.Write(login_frags[0])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(login_frags[1])
|
w.Write(login_frags[1])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(login_frags[2])
|
w.Write(login_frags[2])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(login_frags[3])
|
w.Write(login_frags[3])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(login_frags[4])
|
w.Write(login_frags[4])
|
||||||
w.Write(phrases[23])
|
w.Write(phrases[17])
|
||||||
w.Write(login_frags[5])
|
w.Write(login_frags[5])
|
||||||
w.Write(phrases[24])
|
w.Write(phrases[18])
|
||||||
w.Write(login_frags[6])
|
w.Write(login_frags[6])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_login_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_login_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[25])
|
w.Write(phrases[19])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[26])
|
w.Write(phrases[20])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[27])
|
w.Write(phrases[21])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_login_vars.Header.Themes) != 0 {
|
if len(tmpl_login_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_login_vars.Header.Themes {
|
for _, item := range tmpl_login_vars.Header.Themes {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
import "io"
|
||||||
import "./common"
|
import "./common"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
||||||
|
@ -16,12 +16,6 @@ func init() {
|
||||||
common.TmplPtrMap["profile"] = &common.Template_profile_handle
|
common.TmplPtrMap["profile"] = &common.Template_profile_handle
|
||||||
common.TmplPtrMap["o_profile"] = Template_profile
|
common.TmplPtrMap["o_profile"] = Template_profile
|
||||||
profile_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
profile_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -70,7 +64,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_profile(tmpl_profile_vars common.ProfilePage, w http.ResponseWriter) error {
|
func Template_profile(tmpl_profile_vars common.ProfilePage, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(profile_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(profile_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_profile_vars.Title))
|
w.Write([]byte(tmpl_profile_vars.Title))
|
||||||
|
@ -112,59 +106,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_profile_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_profile_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_profile_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_profile_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_profile_vars.Header)))
|
||||||
|
if tmpl_profile_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_profile_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_profile_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_profile_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_profile_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_profile_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -199,11 +181,11 @@ w.Write(profile_frags[8])
|
||||||
w.Write(profile_frags[9])
|
w.Write(profile_frags[9])
|
||||||
if !tmpl_profile_vars.CurrentUser.Loggedin {
|
if !tmpl_profile_vars.CurrentUser.Loggedin {
|
||||||
w.Write(profile_frags[10])
|
w.Write(profile_frags[10])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(profile_frags[11])
|
w.Write(profile_frags[11])
|
||||||
} else {
|
} else {
|
||||||
w.Write(profile_frags[12])
|
w.Write(profile_frags[12])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(profile_frags[13])
|
w.Write(profile_frags[13])
|
||||||
if tmpl_profile_vars.CurrentUser.IsSuperMod && !tmpl_profile_vars.ProfileOwner.IsSuperMod {
|
if tmpl_profile_vars.CurrentUser.IsSuperMod && !tmpl_profile_vars.ProfileOwner.IsSuperMod {
|
||||||
w.Write(profile_frags[14])
|
w.Write(profile_frags[14])
|
||||||
|
@ -213,11 +195,11 @@ w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
|
||||||
w.Write(profile_frags[16])
|
w.Write(profile_frags[16])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_frags[17])
|
w.Write(profile_frags[17])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(profile_frags[18])
|
w.Write(profile_frags[18])
|
||||||
} else {
|
} else {
|
||||||
w.Write(profile_frags[19])
|
w.Write(profile_frags[19])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(profile_frags[20])
|
w.Write(profile_frags[20])
|
||||||
}
|
}
|
||||||
w.Write(profile_frags[21])
|
w.Write(profile_frags[21])
|
||||||
|
@ -227,36 +209,36 @@ w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
|
||||||
w.Write(profile_frags[23])
|
w.Write(profile_frags[23])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_frags[24])
|
w.Write(profile_frags[24])
|
||||||
w.Write(phrases[23])
|
w.Write(phrases[17])
|
||||||
w.Write(profile_frags[25])
|
w.Write(profile_frags[25])
|
||||||
w.Write(phrases[24])
|
w.Write(phrases[18])
|
||||||
w.Write(profile_frags[26])
|
w.Write(profile_frags[26])
|
||||||
}
|
}
|
||||||
w.Write(profile_frags[27])
|
w.Write(profile_frags[27])
|
||||||
if tmpl_profile_vars.CurrentUser.Perms.BanUsers {
|
if tmpl_profile_vars.CurrentUser.Perms.BanUsers {
|
||||||
w.Write(profile_frags[28])
|
w.Write(profile_frags[28])
|
||||||
w.Write(phrases[25])
|
w.Write(phrases[19])
|
||||||
w.Write(profile_frags[29])
|
w.Write(profile_frags[29])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
|
||||||
w.Write(profile_frags[30])
|
w.Write(profile_frags[30])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_frags[31])
|
w.Write(profile_frags[31])
|
||||||
w.Write(profile_frags[32])
|
w.Write(profile_frags[32])
|
||||||
w.Write(phrases[26])
|
w.Write(phrases[20])
|
||||||
w.Write(profile_frags[33])
|
w.Write(profile_frags[33])
|
||||||
w.Write(phrases[27])
|
w.Write(phrases[21])
|
||||||
w.Write(profile_frags[34])
|
w.Write(profile_frags[34])
|
||||||
w.Write(phrases[28])
|
w.Write(phrases[22])
|
||||||
w.Write(profile_frags[35])
|
w.Write(profile_frags[35])
|
||||||
w.Write(phrases[29])
|
w.Write(phrases[23])
|
||||||
w.Write(profile_frags[36])
|
w.Write(profile_frags[36])
|
||||||
w.Write(phrases[30])
|
w.Write(phrases[24])
|
||||||
w.Write(profile_frags[37])
|
w.Write(profile_frags[37])
|
||||||
w.Write(phrases[31])
|
w.Write(phrases[25])
|
||||||
w.Write(profile_frags[38])
|
w.Write(profile_frags[38])
|
||||||
}
|
}
|
||||||
w.Write(profile_frags[39])
|
w.Write(profile_frags[39])
|
||||||
w.Write(phrases[32])
|
w.Write(phrases[26])
|
||||||
w.Write(profile_frags[40])
|
w.Write(profile_frags[40])
|
||||||
if tmpl_profile_vars.Header.Theme.BgAvatars {
|
if tmpl_profile_vars.Header.Theme.BgAvatars {
|
||||||
if len(tmpl_profile_vars.ItemList) != 0 {
|
if len(tmpl_profile_vars.ItemList) != 0 {
|
||||||
|
@ -282,17 +264,17 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(profile_comments_row_frags[9])
|
w.Write(profile_comments_row_frags[9])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_comments_row_frags[10])
|
w.Write(profile_comments_row_frags[10])
|
||||||
w.Write(phrases[33])
|
w.Write(phrases[27])
|
||||||
w.Write(profile_comments_row_frags[11])
|
w.Write(profile_comments_row_frags[11])
|
||||||
w.Write(phrases[34])
|
w.Write(phrases[28])
|
||||||
w.Write(profile_comments_row_frags[12])
|
w.Write(profile_comments_row_frags[12])
|
||||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(profile_comments_row_frags[13])
|
w.Write(profile_comments_row_frags[13])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_comments_row_frags[14])
|
w.Write(profile_comments_row_frags[14])
|
||||||
w.Write(phrases[35])
|
w.Write(phrases[29])
|
||||||
w.Write(profile_comments_row_frags[15])
|
w.Write(profile_comments_row_frags[15])
|
||||||
w.Write(phrases[36])
|
w.Write(phrases[30])
|
||||||
w.Write(profile_comments_row_frags[16])
|
w.Write(profile_comments_row_frags[16])
|
||||||
}
|
}
|
||||||
w.Write(profile_comments_row_frags[17])
|
w.Write(profile_comments_row_frags[17])
|
||||||
|
@ -300,9 +282,9 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(profile_comments_row_frags[18])
|
w.Write(profile_comments_row_frags[18])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_comments_row_frags[19])
|
w.Write(profile_comments_row_frags[19])
|
||||||
w.Write(phrases[37])
|
w.Write(phrases[31])
|
||||||
w.Write(profile_comments_row_frags[20])
|
w.Write(profile_comments_row_frags[20])
|
||||||
w.Write(phrases[38])
|
w.Write(phrases[32])
|
||||||
w.Write(profile_comments_row_frags[21])
|
w.Write(profile_comments_row_frags[21])
|
||||||
if item.Tag != "" {
|
if item.Tag != "" {
|
||||||
w.Write(profile_comments_row_frags[22])
|
w.Write(profile_comments_row_frags[22])
|
||||||
|
@ -340,17 +322,17 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(profile_comments_row_frags[36])
|
w.Write(profile_comments_row_frags[36])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_comments_row_frags[37])
|
w.Write(profile_comments_row_frags[37])
|
||||||
w.Write(phrases[39])
|
w.Write(phrases[33])
|
||||||
w.Write(profile_comments_row_frags[38])
|
w.Write(profile_comments_row_frags[38])
|
||||||
w.Write(phrases[40])
|
w.Write(phrases[34])
|
||||||
w.Write(profile_comments_row_frags[39])
|
w.Write(profile_comments_row_frags[39])
|
||||||
w.Write([]byte(strconv.Itoa(item.ID)))
|
w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(profile_comments_row_frags[40])
|
w.Write(profile_comments_row_frags[40])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_comments_row_frags[41])
|
w.Write(profile_comments_row_frags[41])
|
||||||
w.Write(phrases[41])
|
w.Write(phrases[35])
|
||||||
w.Write(profile_comments_row_frags[42])
|
w.Write(profile_comments_row_frags[42])
|
||||||
w.Write(phrases[42])
|
w.Write(phrases[36])
|
||||||
w.Write(profile_comments_row_frags[43])
|
w.Write(profile_comments_row_frags[43])
|
||||||
}
|
}
|
||||||
w.Write(profile_comments_row_frags[44])
|
w.Write(profile_comments_row_frags[44])
|
||||||
|
@ -358,9 +340,9 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(profile_comments_row_frags[45])
|
w.Write(profile_comments_row_frags[45])
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_comments_row_frags[46])
|
w.Write(profile_comments_row_frags[46])
|
||||||
w.Write(phrases[43])
|
w.Write(phrases[37])
|
||||||
w.Write(profile_comments_row_frags[47])
|
w.Write(profile_comments_row_frags[47])
|
||||||
w.Write(phrases[44])
|
w.Write(phrases[38])
|
||||||
w.Write(profile_comments_row_frags[48])
|
w.Write(profile_comments_row_frags[48])
|
||||||
w.Write([]byte(item.ContentHtml))
|
w.Write([]byte(item.ContentHtml))
|
||||||
w.Write(profile_comments_row_frags[49])
|
w.Write(profile_comments_row_frags[49])
|
||||||
|
@ -374,9 +356,9 @@ w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
w.Write(profile_frags[43])
|
w.Write(profile_frags[43])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_profile_vars.ProfileOwner.ID)))
|
||||||
w.Write(profile_frags[44])
|
w.Write(profile_frags[44])
|
||||||
w.Write(phrases[45])
|
w.Write(phrases[39])
|
||||||
w.Write(profile_frags[45])
|
w.Write(profile_frags[45])
|
||||||
w.Write(phrases[46])
|
w.Write(phrases[40])
|
||||||
w.Write(profile_frags[46])
|
w.Write(profile_frags[46])
|
||||||
}
|
}
|
||||||
w.Write(profile_frags[47])
|
w.Write(profile_frags[47])
|
||||||
|
@ -384,11 +366,11 @@ w.Write(profile_frags[48])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_profile_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_profile_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[47])
|
w.Write(phrases[41])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[48])
|
w.Write(phrases[42])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[49])
|
w.Write(phrases[43])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_profile_vars.Header.Themes) != 0 {
|
if len(tmpl_profile_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_profile_vars.Header.Themes {
|
for _, item := range tmpl_profile_vars.Header.Themes {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
import "io"
|
||||||
import "./common"
|
import "./common"
|
||||||
|
|
||||||
var register_tmpl_phrase_id int
|
var register_tmpl_phrase_id int
|
||||||
|
@ -15,12 +15,6 @@ func init() {
|
||||||
common.TmplPtrMap["register"] = &common.Template_register_handle
|
common.TmplPtrMap["register"] = &common.Template_register_handle
|
||||||
common.TmplPtrMap["o_register"] = Template_register
|
common.TmplPtrMap["o_register"] = Template_register
|
||||||
register_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
register_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -48,7 +42,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_register(tmpl_register_vars common.Page, w http.ResponseWriter) error {
|
func Template_register(tmpl_register_vars common.Page, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(register_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(register_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_register_vars.Title))
|
w.Write([]byte(tmpl_register_vars.Title))
|
||||||
|
@ -90,59 +84,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_register_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_register_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_register_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_register_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_register_vars.Header)))
|
||||||
|
if tmpl_register_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_register_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_register_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_register_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_register_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_register_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_register_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_register_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_register_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_register_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -157,28 +139,28 @@ w.Write(header_frags[21])
|
||||||
}
|
}
|
||||||
w.Write(header_frags[22])
|
w.Write(header_frags[22])
|
||||||
w.Write(register_frags[0])
|
w.Write(register_frags[0])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(register_frags[1])
|
w.Write(register_frags[1])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(register_frags[2])
|
w.Write(register_frags[2])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(register_frags[3])
|
w.Write(register_frags[3])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(register_frags[4])
|
w.Write(register_frags[4])
|
||||||
w.Write(phrases[23])
|
w.Write(phrases[17])
|
||||||
w.Write(register_frags[5])
|
w.Write(register_frags[5])
|
||||||
w.Write(phrases[24])
|
w.Write(phrases[18])
|
||||||
w.Write(register_frags[6])
|
w.Write(register_frags[6])
|
||||||
w.Write(phrases[25])
|
w.Write(phrases[19])
|
||||||
w.Write(register_frags[7])
|
w.Write(register_frags[7])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_register_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_register_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[26])
|
w.Write(phrases[20])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[27])
|
w.Write(phrases[21])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[28])
|
w.Write(phrases[22])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_register_vars.Header.Themes) != 0 {
|
if len(tmpl_register_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_register_vars.Header.Themes {
|
for _, item := range tmpl_register_vars.Header.Themes {
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
|
||||||
import "./common"
|
import "./common"
|
||||||
|
import "io"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
||||||
var topic_tmpl_phrase_id int
|
var topic_tmpl_phrase_id int
|
||||||
|
@ -16,12 +16,6 @@ func init() {
|
||||||
common.TmplPtrMap["topic"] = &common.Template_topic_handle
|
common.TmplPtrMap["topic"] = &common.Template_topic_handle
|
||||||
common.TmplPtrMap["o_topic"] = Template_topic
|
common.TmplPtrMap["o_topic"] = Template_topic
|
||||||
topic_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
topic_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -101,7 +95,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_topic(tmpl_topic_vars common.TopicPage, w http.ResponseWriter) error {
|
func Template_topic(tmpl_topic_vars common.TopicPage, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(topic_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(topic_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_topic_vars.Title))
|
w.Write([]byte(tmpl_topic_vars.Title))
|
||||||
|
@ -143,59 +137,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_topic_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_topic_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_topic_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_topic_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_topic_vars.Header)))
|
||||||
|
if tmpl_topic_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_topic_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_topic_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_topic_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_topic_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_topic_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -220,13 +202,13 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[4])
|
w.Write(topic_frags[4])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1)))
|
||||||
w.Write(topic_frags[5])
|
w.Write(topic_frags[5])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(topic_frags[6])
|
w.Write(topic_frags[6])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[7])
|
w.Write(topic_frags[7])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page - 1)))
|
||||||
w.Write(topic_frags[8])
|
w.Write(topic_frags[8])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(topic_frags[9])
|
w.Write(topic_frags[9])
|
||||||
}
|
}
|
||||||
if tmpl_topic_vars.LastPage != tmpl_topic_vars.Page {
|
if tmpl_topic_vars.LastPage != tmpl_topic_vars.Page {
|
||||||
|
@ -235,18 +217,18 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[11])
|
w.Write(topic_frags[11])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1)))
|
||||||
w.Write(topic_frags[12])
|
w.Write(topic_frags[12])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(topic_frags[13])
|
w.Write(topic_frags[13])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[14])
|
w.Write(topic_frags[14])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Page + 1)))
|
||||||
w.Write(topic_frags[15])
|
w.Write(topic_frags[15])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(topic_frags[16])
|
w.Write(topic_frags[16])
|
||||||
}
|
}
|
||||||
w.Write(topic_frags[17])
|
w.Write(topic_frags[17])
|
||||||
w.Write(topic_frags[18])
|
w.Write(topic_frags[18])
|
||||||
w.Write(phrases[23])
|
w.Write(phrases[17])
|
||||||
w.Write(topic_frags[19])
|
w.Write(topic_frags[19])
|
||||||
if tmpl_topic_vars.Topic.Sticky {
|
if tmpl_topic_vars.Topic.Sticky {
|
||||||
w.Write(topic_frags[20])
|
w.Write(topic_frags[20])
|
||||||
|
@ -262,24 +244,24 @@ w.Write([]byte(tmpl_topic_vars.Topic.Title))
|
||||||
w.Write(topic_frags[24])
|
w.Write(topic_frags[24])
|
||||||
if tmpl_topic_vars.Topic.IsClosed {
|
if tmpl_topic_vars.Topic.IsClosed {
|
||||||
w.Write(topic_frags[25])
|
w.Write(topic_frags[25])
|
||||||
w.Write(phrases[24])
|
w.Write(phrases[18])
|
||||||
w.Write(topic_frags[26])
|
w.Write(topic_frags[26])
|
||||||
w.Write(phrases[25])
|
w.Write(phrases[19])
|
||||||
w.Write(topic_frags[27])
|
w.Write(topic_frags[27])
|
||||||
}
|
}
|
||||||
if tmpl_topic_vars.CurrentUser.Perms.EditTopic {
|
if tmpl_topic_vars.CurrentUser.Perms.EditTopic {
|
||||||
w.Write(topic_frags[28])
|
w.Write(topic_frags[28])
|
||||||
w.Write([]byte(tmpl_topic_vars.Topic.Title))
|
w.Write([]byte(tmpl_topic_vars.Topic.Title))
|
||||||
w.Write(topic_frags[29])
|
w.Write(topic_frags[29])
|
||||||
w.Write(phrases[26])
|
w.Write(phrases[20])
|
||||||
w.Write(topic_frags[30])
|
w.Write(topic_frags[30])
|
||||||
w.Write(phrases[27])
|
w.Write(phrases[21])
|
||||||
w.Write(topic_frags[31])
|
w.Write(topic_frags[31])
|
||||||
}
|
}
|
||||||
w.Write(topic_frags[32])
|
w.Write(topic_frags[32])
|
||||||
if tmpl_topic_vars.Poll.ID > 0 {
|
if tmpl_topic_vars.Poll.ID > 0 {
|
||||||
w.Write(topic_frags[33])
|
w.Write(topic_frags[33])
|
||||||
w.Write(phrases[28])
|
w.Write(phrases[22])
|
||||||
w.Write(topic_frags[34])
|
w.Write(topic_frags[34])
|
||||||
w.Write([]byte(tmpl_topic_vars.Topic.ClassName))
|
w.Write([]byte(tmpl_topic_vars.Topic.ClassName))
|
||||||
w.Write(topic_frags[35])
|
w.Write(topic_frags[35])
|
||||||
|
@ -311,20 +293,20 @@ w.Write(topic_frags[46])
|
||||||
w.Write(topic_frags[47])
|
w.Write(topic_frags[47])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID)))
|
||||||
w.Write(topic_frags[48])
|
w.Write(topic_frags[48])
|
||||||
w.Write(phrases[29])
|
w.Write(phrases[23])
|
||||||
w.Write(topic_frags[49])
|
w.Write(topic_frags[49])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID)))
|
||||||
w.Write(topic_frags[50])
|
w.Write(topic_frags[50])
|
||||||
w.Write(phrases[30])
|
w.Write(phrases[24])
|
||||||
w.Write(topic_frags[51])
|
w.Write(topic_frags[51])
|
||||||
w.Write(phrases[31])
|
w.Write(phrases[25])
|
||||||
w.Write(topic_frags[52])
|
w.Write(topic_frags[52])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Poll.ID)))
|
||||||
w.Write(topic_frags[53])
|
w.Write(topic_frags[53])
|
||||||
}
|
}
|
||||||
w.Write(topic_frags[54])
|
w.Write(topic_frags[54])
|
||||||
w.Write(topic_frags[55])
|
w.Write(topic_frags[55])
|
||||||
w.Write(phrases[32])
|
w.Write(phrases[26])
|
||||||
w.Write(topic_frags[56])
|
w.Write(topic_frags[56])
|
||||||
w.Write([]byte(tmpl_topic_vars.Topic.ClassName))
|
w.Write([]byte(tmpl_topic_vars.Topic.ClassName))
|
||||||
w.Write(topic_frags[57])
|
w.Write(topic_frags[57])
|
||||||
|
@ -344,7 +326,7 @@ if tmpl_topic_vars.Topic.LikeCount > 0 {
|
||||||
w.Write(topic_frags[64])
|
w.Write(topic_frags[64])
|
||||||
}
|
}
|
||||||
w.Write(topic_frags[65])
|
w.Write(topic_frags[65])
|
||||||
w.Write(phrases[33])
|
w.Write(phrases[27])
|
||||||
w.Write(topic_frags[66])
|
w.Write(topic_frags[66])
|
||||||
w.Write([]byte(tmpl_topic_vars.Topic.UserLink))
|
w.Write([]byte(tmpl_topic_vars.Topic.UserLink))
|
||||||
w.Write(topic_frags[67])
|
w.Write(topic_frags[67])
|
||||||
|
@ -358,15 +340,15 @@ w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[71])
|
w.Write(topic_frags[71])
|
||||||
if tmpl_topic_vars.Topic.Liked {
|
if tmpl_topic_vars.Topic.Liked {
|
||||||
w.Write(topic_frags[72])
|
w.Write(topic_frags[72])
|
||||||
w.Write(phrases[34])
|
w.Write(phrases[28])
|
||||||
w.Write(topic_frags[73])
|
w.Write(topic_frags[73])
|
||||||
w.Write(phrases[35])
|
w.Write(phrases[29])
|
||||||
w.Write(topic_frags[74])
|
w.Write(topic_frags[74])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_frags[75])
|
w.Write(topic_frags[75])
|
||||||
w.Write(phrases[36])
|
w.Write(phrases[30])
|
||||||
w.Write(topic_frags[76])
|
w.Write(topic_frags[76])
|
||||||
w.Write(phrases[37])
|
w.Write(phrases[31])
|
||||||
w.Write(topic_frags[77])
|
w.Write(topic_frags[77])
|
||||||
}
|
}
|
||||||
w.Write(topic_frags[78])
|
w.Write(topic_frags[78])
|
||||||
|
@ -381,9 +363,9 @@ if tmpl_topic_vars.CurrentUser.Perms.EditTopic {
|
||||||
w.Write(topic_frags[82])
|
w.Write(topic_frags[82])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[83])
|
w.Write(topic_frags[83])
|
||||||
w.Write(phrases[38])
|
w.Write(phrases[32])
|
||||||
w.Write(topic_frags[84])
|
w.Write(topic_frags[84])
|
||||||
w.Write(phrases[39])
|
w.Write(phrases[33])
|
||||||
w.Write(topic_frags[85])
|
w.Write(topic_frags[85])
|
||||||
}
|
}
|
||||||
if tmpl_topic_vars.CurrentUser.Perms.DeleteTopic {
|
if tmpl_topic_vars.CurrentUser.Perms.DeleteTopic {
|
||||||
|
@ -392,9 +374,9 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[87])
|
w.Write(topic_frags[87])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[88])
|
w.Write(topic_frags[88])
|
||||||
w.Write(phrases[40])
|
w.Write(phrases[34])
|
||||||
w.Write(topic_frags[89])
|
w.Write(topic_frags[89])
|
||||||
w.Write(phrases[41])
|
w.Write(phrases[35])
|
||||||
w.Write(topic_frags[90])
|
w.Write(topic_frags[90])
|
||||||
}
|
}
|
||||||
if tmpl_topic_vars.CurrentUser.Perms.CloseTopic {
|
if tmpl_topic_vars.CurrentUser.Perms.CloseTopic {
|
||||||
|
@ -404,9 +386,9 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[92])
|
w.Write(topic_frags[92])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[93])
|
w.Write(topic_frags[93])
|
||||||
w.Write(phrases[42])
|
w.Write(phrases[36])
|
||||||
w.Write(topic_frags[94])
|
w.Write(topic_frags[94])
|
||||||
w.Write(phrases[43])
|
w.Write(phrases[37])
|
||||||
w.Write(topic_frags[95])
|
w.Write(topic_frags[95])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_frags[96])
|
w.Write(topic_frags[96])
|
||||||
|
@ -414,9 +396,9 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[97])
|
w.Write(topic_frags[97])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[98])
|
w.Write(topic_frags[98])
|
||||||
w.Write(phrases[44])
|
w.Write(phrases[38])
|
||||||
w.Write(topic_frags[99])
|
w.Write(topic_frags[99])
|
||||||
w.Write(phrases[45])
|
w.Write(phrases[39])
|
||||||
w.Write(topic_frags[100])
|
w.Write(topic_frags[100])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,9 +409,9 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[102])
|
w.Write(topic_frags[102])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[103])
|
w.Write(topic_frags[103])
|
||||||
w.Write(phrases[46])
|
w.Write(phrases[40])
|
||||||
w.Write(topic_frags[104])
|
w.Write(topic_frags[104])
|
||||||
w.Write(phrases[47])
|
w.Write(phrases[41])
|
||||||
w.Write(topic_frags[105])
|
w.Write(topic_frags[105])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_frags[106])
|
w.Write(topic_frags[106])
|
||||||
|
@ -437,9 +419,9 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[107])
|
w.Write(topic_frags[107])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[108])
|
w.Write(topic_frags[108])
|
||||||
w.Write(phrases[48])
|
w.Write(phrases[42])
|
||||||
w.Write(topic_frags[109])
|
w.Write(topic_frags[109])
|
||||||
w.Write(phrases[49])
|
w.Write(phrases[43])
|
||||||
w.Write(topic_frags[110])
|
w.Write(topic_frags[110])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -447,7 +429,7 @@ if tmpl_topic_vars.CurrentUser.Perms.ViewIPs {
|
||||||
w.Write(topic_frags[111])
|
w.Write(topic_frags[111])
|
||||||
w.Write([]byte(tmpl_topic_vars.Topic.IPAddress))
|
w.Write([]byte(tmpl_topic_vars.Topic.IPAddress))
|
||||||
w.Write(topic_frags[112])
|
w.Write(topic_frags[112])
|
||||||
w.Write(phrases[50])
|
w.Write(phrases[44])
|
||||||
w.Write(topic_frags[113])
|
w.Write(topic_frags[113])
|
||||||
w.Write([]byte(tmpl_topic_vars.Topic.IPAddress))
|
w.Write([]byte(tmpl_topic_vars.Topic.IPAddress))
|
||||||
w.Write(topic_frags[114])
|
w.Write(topic_frags[114])
|
||||||
|
@ -457,15 +439,15 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[116])
|
w.Write(topic_frags[116])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[117])
|
w.Write(topic_frags[117])
|
||||||
w.Write(phrases[51])
|
w.Write(phrases[45])
|
||||||
w.Write(topic_frags[118])
|
w.Write(topic_frags[118])
|
||||||
w.Write(phrases[52])
|
w.Write(phrases[46])
|
||||||
w.Write(topic_frags[119])
|
w.Write(topic_frags[119])
|
||||||
w.Write(phrases[53])
|
w.Write(phrases[47])
|
||||||
w.Write(topic_frags[120])
|
w.Write(topic_frags[120])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.LikeCount)))
|
||||||
w.Write(topic_frags[121])
|
w.Write(topic_frags[121])
|
||||||
w.Write(phrases[54])
|
w.Write(phrases[48])
|
||||||
w.Write(topic_frags[122])
|
w.Write(topic_frags[122])
|
||||||
if tmpl_topic_vars.Topic.Tag != "" {
|
if tmpl_topic_vars.Topic.Tag != "" {
|
||||||
w.Write(topic_frags[123])
|
w.Write(topic_frags[123])
|
||||||
|
@ -473,15 +455,15 @@ w.Write([]byte(tmpl_topic_vars.Topic.Tag))
|
||||||
w.Write(topic_frags[124])
|
w.Write(topic_frags[124])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_frags[125])
|
w.Write(topic_frags[125])
|
||||||
w.Write(phrases[55])
|
w.Write(phrases[49])
|
||||||
w.Write(topic_frags[126])
|
w.Write(topic_frags[126])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level)))
|
||||||
w.Write(topic_frags[127])
|
w.Write(topic_frags[127])
|
||||||
w.Write(phrases[56])
|
w.Write(phrases[50])
|
||||||
w.Write(topic_frags[128])
|
w.Write(topic_frags[128])
|
||||||
}
|
}
|
||||||
w.Write(topic_frags[129])
|
w.Write(topic_frags[129])
|
||||||
w.Write(phrases[57])
|
w.Write(phrases[51])
|
||||||
w.Write(topic_frags[130])
|
w.Write(topic_frags[130])
|
||||||
if len(tmpl_topic_vars.ItemList) != 0 {
|
if len(tmpl_topic_vars.ItemList) != 0 {
|
||||||
for _, item := range tmpl_topic_vars.ItemList {
|
for _, item := range tmpl_topic_vars.ItemList {
|
||||||
|
@ -522,9 +504,9 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(topic_frags[148])
|
w.Write(topic_frags[148])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[149])
|
w.Write(topic_frags[149])
|
||||||
w.Write(phrases[58])
|
w.Write(phrases[52])
|
||||||
w.Write(topic_frags[150])
|
w.Write(topic_frags[150])
|
||||||
w.Write(phrases[59])
|
w.Write(phrases[53])
|
||||||
w.Write(topic_frags[151])
|
w.Write(topic_frags[151])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_frags[152])
|
w.Write(topic_frags[152])
|
||||||
|
@ -532,9 +514,9 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(topic_frags[153])
|
w.Write(topic_frags[153])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[154])
|
w.Write(topic_frags[154])
|
||||||
w.Write(phrases[60])
|
w.Write(phrases[54])
|
||||||
w.Write(topic_frags[155])
|
w.Write(topic_frags[155])
|
||||||
w.Write(phrases[61])
|
w.Write(phrases[55])
|
||||||
w.Write(topic_frags[156])
|
w.Write(topic_frags[156])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -544,9 +526,9 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(topic_frags[158])
|
w.Write(topic_frags[158])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[159])
|
w.Write(topic_frags[159])
|
||||||
w.Write(phrases[62])
|
w.Write(phrases[56])
|
||||||
w.Write(topic_frags[160])
|
w.Write(topic_frags[160])
|
||||||
w.Write(phrases[63])
|
w.Write(phrases[57])
|
||||||
w.Write(topic_frags[161])
|
w.Write(topic_frags[161])
|
||||||
}
|
}
|
||||||
if tmpl_topic_vars.CurrentUser.Perms.DeleteReply {
|
if tmpl_topic_vars.CurrentUser.Perms.DeleteReply {
|
||||||
|
@ -555,16 +537,16 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(topic_frags[163])
|
w.Write(topic_frags[163])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[164])
|
w.Write(topic_frags[164])
|
||||||
w.Write(phrases[64])
|
w.Write(phrases[58])
|
||||||
w.Write(topic_frags[165])
|
w.Write(topic_frags[165])
|
||||||
w.Write(phrases[65])
|
w.Write(phrases[59])
|
||||||
w.Write(topic_frags[166])
|
w.Write(topic_frags[166])
|
||||||
}
|
}
|
||||||
if tmpl_topic_vars.CurrentUser.Perms.ViewIPs {
|
if tmpl_topic_vars.CurrentUser.Perms.ViewIPs {
|
||||||
w.Write(topic_frags[167])
|
w.Write(topic_frags[167])
|
||||||
w.Write([]byte(item.IPAddress))
|
w.Write([]byte(item.IPAddress))
|
||||||
w.Write(topic_frags[168])
|
w.Write(topic_frags[168])
|
||||||
w.Write(phrases[66])
|
w.Write(phrases[60])
|
||||||
w.Write(topic_frags[169])
|
w.Write(topic_frags[169])
|
||||||
w.Write([]byte(item.IPAddress))
|
w.Write([]byte(item.IPAddress))
|
||||||
w.Write(topic_frags[170])
|
w.Write(topic_frags[170])
|
||||||
|
@ -574,13 +556,13 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(topic_frags[172])
|
w.Write(topic_frags[172])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[173])
|
w.Write(topic_frags[173])
|
||||||
w.Write(phrases[67])
|
w.Write(phrases[61])
|
||||||
w.Write(topic_frags[174])
|
w.Write(topic_frags[174])
|
||||||
w.Write(phrases[68])
|
w.Write(phrases[62])
|
||||||
w.Write(topic_frags[175])
|
w.Write(topic_frags[175])
|
||||||
w.Write([]byte(strconv.Itoa(item.LikeCount)))
|
w.Write([]byte(strconv.Itoa(item.LikeCount)))
|
||||||
w.Write(topic_frags[176])
|
w.Write(topic_frags[176])
|
||||||
w.Write(phrases[69])
|
w.Write(phrases[63])
|
||||||
w.Write(topic_frags[177])
|
w.Write(topic_frags[177])
|
||||||
if item.Tag != "" {
|
if item.Tag != "" {
|
||||||
w.Write(topic_frags[178])
|
w.Write(topic_frags[178])
|
||||||
|
@ -588,11 +570,11 @@ w.Write([]byte(item.Tag))
|
||||||
w.Write(topic_frags[179])
|
w.Write(topic_frags[179])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_frags[180])
|
w.Write(topic_frags[180])
|
||||||
w.Write(phrases[70])
|
w.Write(phrases[64])
|
||||||
w.Write(topic_frags[181])
|
w.Write(topic_frags[181])
|
||||||
w.Write([]byte(strconv.Itoa(item.Level)))
|
w.Write([]byte(strconv.Itoa(item.Level)))
|
||||||
w.Write(topic_frags[182])
|
w.Write(topic_frags[182])
|
||||||
w.Write(phrases[71])
|
w.Write(phrases[65])
|
||||||
w.Write(topic_frags[183])
|
w.Write(topic_frags[183])
|
||||||
}
|
}
|
||||||
w.Write(topic_frags[184])
|
w.Write(topic_frags[184])
|
||||||
|
@ -602,23 +584,23 @@ w.Write(topic_frags[184])
|
||||||
w.Write(topic_frags[185])
|
w.Write(topic_frags[185])
|
||||||
if tmpl_topic_vars.CurrentUser.Perms.CreateReply {
|
if tmpl_topic_vars.CurrentUser.Perms.CreateReply {
|
||||||
w.Write(topic_frags[186])
|
w.Write(topic_frags[186])
|
||||||
w.Write(phrases[72])
|
w.Write(phrases[66])
|
||||||
w.Write(topic_frags[187])
|
w.Write(topic_frags[187])
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
w.Write(topic_frags[188])
|
w.Write(topic_frags[188])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
|
||||||
w.Write(topic_frags[189])
|
w.Write(topic_frags[189])
|
||||||
w.Write(phrases[73])
|
w.Write(phrases[67])
|
||||||
w.Write(topic_frags[190])
|
w.Write(topic_frags[190])
|
||||||
w.Write(phrases[74])
|
w.Write(phrases[68])
|
||||||
w.Write(topic_frags[191])
|
w.Write(topic_frags[191])
|
||||||
w.Write(phrases[75])
|
w.Write(phrases[69])
|
||||||
w.Write(topic_frags[192])
|
w.Write(topic_frags[192])
|
||||||
w.Write(phrases[76])
|
w.Write(phrases[70])
|
||||||
w.Write(topic_frags[193])
|
w.Write(topic_frags[193])
|
||||||
if tmpl_topic_vars.CurrentUser.Perms.UploadFiles {
|
if tmpl_topic_vars.CurrentUser.Perms.UploadFiles {
|
||||||
w.Write(topic_frags[194])
|
w.Write(topic_frags[194])
|
||||||
w.Write(phrases[77])
|
w.Write(phrases[71])
|
||||||
w.Write(topic_frags[195])
|
w.Write(topic_frags[195])
|
||||||
}
|
}
|
||||||
w.Write(topic_frags[196])
|
w.Write(topic_frags[196])
|
||||||
|
@ -627,11 +609,11 @@ w.Write(topic_frags[197])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_topic_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_topic_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[78])
|
w.Write(phrases[72])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[79])
|
w.Write(phrases[73])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[80])
|
w.Write(phrases[74])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_topic_vars.Header.Themes) != 0 {
|
if len(tmpl_topic_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_topic_vars.Header.Themes {
|
for _, item := range tmpl_topic_vars.Header.Themes {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
import "io"
|
||||||
import "./common"
|
import "./common"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
||||||
|
@ -16,12 +16,6 @@ func init() {
|
||||||
common.TmplPtrMap["topic_alt"] = &common.Template_topic_alt_handle
|
common.TmplPtrMap["topic_alt"] = &common.Template_topic_alt_handle
|
||||||
common.TmplPtrMap["o_topic_alt"] = Template_topic_alt
|
common.TmplPtrMap["o_topic_alt"] = Template_topic_alt
|
||||||
topic_alt_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
topic_alt_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -88,7 +82,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_topic_alt(tmpl_topic_alt_vars common.TopicPage, w http.ResponseWriter) error {
|
func Template_topic_alt(tmpl_topic_alt_vars common.TopicPage, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(topic_alt_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(topic_alt_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Title))
|
w.Write([]byte(tmpl_topic_alt_vars.Title))
|
||||||
|
@ -130,59 +124,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_topic_alt_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_topic_alt_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_topic_alt_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_topic_alt_vars.Header)))
|
||||||
|
if tmpl_topic_alt_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_topic_alt_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_topic_alt_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_topic_alt_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_topic_alt_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -202,13 +184,13 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[1])
|
w.Write(topic_alt_frags[1])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page - 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page - 1)))
|
||||||
w.Write(topic_alt_frags[2])
|
w.Write(topic_alt_frags[2])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(topic_alt_frags[3])
|
w.Write(topic_alt_frags[3])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[4])
|
w.Write(topic_alt_frags[4])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page - 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page - 1)))
|
||||||
w.Write(topic_alt_frags[5])
|
w.Write(topic_alt_frags[5])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(topic_alt_frags[6])
|
w.Write(topic_alt_frags[6])
|
||||||
}
|
}
|
||||||
if tmpl_topic_alt_vars.LastPage != tmpl_topic_alt_vars.Page {
|
if tmpl_topic_alt_vars.LastPage != tmpl_topic_alt_vars.Page {
|
||||||
|
@ -217,18 +199,18 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[8])
|
w.Write(topic_alt_frags[8])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1)))
|
||||||
w.Write(topic_alt_frags[9])
|
w.Write(topic_alt_frags[9])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(topic_alt_frags[10])
|
w.Write(topic_alt_frags[10])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[11])
|
w.Write(topic_alt_frags[11])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Page + 1)))
|
||||||
w.Write(topic_alt_frags[12])
|
w.Write(topic_alt_frags[12])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(topic_alt_frags[13])
|
w.Write(topic_alt_frags[13])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[14])
|
w.Write(topic_alt_frags[14])
|
||||||
w.Write(topic_alt_frags[15])
|
w.Write(topic_alt_frags[15])
|
||||||
w.Write(phrases[23])
|
w.Write(phrases[17])
|
||||||
w.Write(topic_alt_frags[16])
|
w.Write(topic_alt_frags[16])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[17])
|
w.Write(topic_alt_frags[17])
|
||||||
|
@ -248,18 +230,18 @@ w.Write([]byte(tmpl_topic_alt_vars.Topic.Title))
|
||||||
w.Write(topic_alt_frags[23])
|
w.Write(topic_alt_frags[23])
|
||||||
if tmpl_topic_alt_vars.Topic.IsClosed {
|
if tmpl_topic_alt_vars.Topic.IsClosed {
|
||||||
w.Write(topic_alt_frags[24])
|
w.Write(topic_alt_frags[24])
|
||||||
w.Write(phrases[24])
|
w.Write(phrases[18])
|
||||||
w.Write(topic_alt_frags[25])
|
w.Write(topic_alt_frags[25])
|
||||||
w.Write(phrases[25])
|
w.Write(phrases[19])
|
||||||
w.Write(topic_alt_frags[26])
|
w.Write(topic_alt_frags[26])
|
||||||
}
|
}
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic {
|
if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic {
|
||||||
w.Write(topic_alt_frags[27])
|
w.Write(topic_alt_frags[27])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.Title))
|
w.Write([]byte(tmpl_topic_alt_vars.Topic.Title))
|
||||||
w.Write(topic_alt_frags[28])
|
w.Write(topic_alt_frags[28])
|
||||||
w.Write(phrases[26])
|
w.Write(phrases[20])
|
||||||
w.Write(topic_alt_frags[29])
|
w.Write(topic_alt_frags[29])
|
||||||
w.Write(phrases[27])
|
w.Write(phrases[21])
|
||||||
w.Write(topic_alt_frags[30])
|
w.Write(topic_alt_frags[30])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[31])
|
w.Write(topic_alt_frags[31])
|
||||||
|
@ -271,7 +253,7 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
|
||||||
w.Write(topic_alt_frags[34])
|
w.Write(topic_alt_frags[34])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[35])
|
w.Write(topic_alt_frags[35])
|
||||||
w.Write(phrases[28])
|
w.Write(phrases[22])
|
||||||
w.Write(topic_alt_frags[36])
|
w.Write(topic_alt_frags[36])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar))
|
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar))
|
||||||
w.Write(topic_alt_frags[37])
|
w.Write(topic_alt_frags[37])
|
||||||
|
@ -285,7 +267,7 @@ w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag))
|
||||||
w.Write(topic_alt_frags[41])
|
w.Write(topic_alt_frags[41])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_alt_frags[42])
|
w.Write(topic_alt_frags[42])
|
||||||
w.Write(phrases[29])
|
w.Write(phrases[23])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
|
||||||
w.Write(topic_alt_frags[43])
|
w.Write(topic_alt_frags[43])
|
||||||
}
|
}
|
||||||
|
@ -312,22 +294,22 @@ w.Write(topic_alt_frags[52])
|
||||||
w.Write(topic_alt_frags[53])
|
w.Write(topic_alt_frags[53])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
|
||||||
w.Write(topic_alt_frags[54])
|
w.Write(topic_alt_frags[54])
|
||||||
w.Write(phrases[30])
|
w.Write(phrases[24])
|
||||||
w.Write(topic_alt_frags[55])
|
w.Write(topic_alt_frags[55])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
|
||||||
w.Write(topic_alt_frags[56])
|
w.Write(topic_alt_frags[56])
|
||||||
w.Write(phrases[31])
|
w.Write(phrases[25])
|
||||||
w.Write(topic_alt_frags[57])
|
w.Write(topic_alt_frags[57])
|
||||||
w.Write(phrases[32])
|
w.Write(phrases[26])
|
||||||
w.Write(topic_alt_frags[58])
|
w.Write(topic_alt_frags[58])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
|
||||||
w.Write(topic_alt_frags[59])
|
w.Write(topic_alt_frags[59])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[60])
|
w.Write(topic_alt_frags[60])
|
||||||
w.Write(topic_alt_frags[61])
|
w.Write(topic_alt_frags[61])
|
||||||
w.Write(phrases[33])
|
w.Write(phrases[27])
|
||||||
w.Write(topic_alt_frags[62])
|
w.Write(topic_alt_frags[62])
|
||||||
w.Write(phrases[34])
|
w.Write(phrases[28])
|
||||||
w.Write(topic_alt_frags[63])
|
w.Write(topic_alt_frags[63])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar))
|
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar))
|
||||||
w.Write(topic_alt_frags[64])
|
w.Write(topic_alt_frags[64])
|
||||||
|
@ -341,7 +323,7 @@ w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag))
|
||||||
w.Write(topic_alt_frags[68])
|
w.Write(topic_alt_frags[68])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_alt_frags[69])
|
w.Write(topic_alt_frags[69])
|
||||||
w.Write(phrases[35])
|
w.Write(phrases[29])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
|
||||||
w.Write(topic_alt_frags[70])
|
w.Write(topic_alt_frags[70])
|
||||||
}
|
}
|
||||||
|
@ -367,14 +349,14 @@ w.Write(topic_alt_frags[79])
|
||||||
w.Write(topic_alt_frags[80])
|
w.Write(topic_alt_frags[80])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[81])
|
w.Write(topic_alt_frags[81])
|
||||||
w.Write(phrases[36])
|
w.Write(phrases[30])
|
||||||
w.Write(topic_alt_frags[82])
|
w.Write(topic_alt_frags[82])
|
||||||
}
|
}
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic {
|
if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic {
|
||||||
w.Write(topic_alt_frags[83])
|
w.Write(topic_alt_frags[83])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[84])
|
w.Write(topic_alt_frags[84])
|
||||||
w.Write(phrases[37])
|
w.Write(phrases[31])
|
||||||
w.Write(topic_alt_frags[85])
|
w.Write(topic_alt_frags[85])
|
||||||
}
|
}
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteTopic {
|
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteTopic {
|
||||||
|
@ -383,7 +365,7 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[87])
|
w.Write(topic_alt_frags[87])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[88])
|
w.Write(topic_alt_frags[88])
|
||||||
w.Write(phrases[38])
|
w.Write(phrases[32])
|
||||||
w.Write(topic_alt_frags[89])
|
w.Write(topic_alt_frags[89])
|
||||||
}
|
}
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Perms.CloseTopic {
|
if tmpl_topic_alt_vars.CurrentUser.Perms.CloseTopic {
|
||||||
|
@ -393,7 +375,7 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[91])
|
w.Write(topic_alt_frags[91])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[92])
|
w.Write(topic_alt_frags[92])
|
||||||
w.Write(phrases[39])
|
w.Write(phrases[33])
|
||||||
w.Write(topic_alt_frags[93])
|
w.Write(topic_alt_frags[93])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_alt_frags[94])
|
w.Write(topic_alt_frags[94])
|
||||||
|
@ -401,7 +383,7 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[95])
|
w.Write(topic_alt_frags[95])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[96])
|
w.Write(topic_alt_frags[96])
|
||||||
w.Write(phrases[40])
|
w.Write(phrases[34])
|
||||||
w.Write(topic_alt_frags[97])
|
w.Write(topic_alt_frags[97])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,7 +394,7 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[99])
|
w.Write(topic_alt_frags[99])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[100])
|
w.Write(topic_alt_frags[100])
|
||||||
w.Write(phrases[41])
|
w.Write(phrases[35])
|
||||||
w.Write(topic_alt_frags[101])
|
w.Write(topic_alt_frags[101])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_alt_frags[102])
|
w.Write(topic_alt_frags[102])
|
||||||
|
@ -420,7 +402,7 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[103])
|
w.Write(topic_alt_frags[103])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[104])
|
w.Write(topic_alt_frags[104])
|
||||||
w.Write(phrases[42])
|
w.Write(phrases[36])
|
||||||
w.Write(topic_alt_frags[105])
|
w.Write(topic_alt_frags[105])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,9 +410,9 @@ if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
|
||||||
w.Write(topic_alt_frags[106])
|
w.Write(topic_alt_frags[106])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
|
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
|
||||||
w.Write(topic_alt_frags[107])
|
w.Write(topic_alt_frags[107])
|
||||||
w.Write(phrases[43])
|
w.Write(phrases[37])
|
||||||
w.Write(topic_alt_frags[108])
|
w.Write(topic_alt_frags[108])
|
||||||
w.Write(phrases[44])
|
w.Write(phrases[38])
|
||||||
w.Write(topic_alt_frags[109])
|
w.Write(topic_alt_frags[109])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[110])
|
w.Write(topic_alt_frags[110])
|
||||||
|
@ -438,11 +420,11 @@ w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[111])
|
w.Write(topic_alt_frags[111])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[112])
|
w.Write(topic_alt_frags[112])
|
||||||
w.Write(phrases[45])
|
w.Write(phrases[39])
|
||||||
w.Write(topic_alt_frags[113])
|
w.Write(topic_alt_frags[113])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[114])
|
w.Write(topic_alt_frags[114])
|
||||||
w.Write(phrases[46])
|
w.Write(phrases[40])
|
||||||
w.Write(topic_alt_frags[115])
|
w.Write(topic_alt_frags[115])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.LikeCount)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.LikeCount)))
|
||||||
w.Write(topic_alt_frags[116])
|
w.Write(topic_alt_frags[116])
|
||||||
|
@ -452,7 +434,7 @@ if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
|
||||||
w.Write(topic_alt_frags[118])
|
w.Write(topic_alt_frags[118])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
|
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
|
||||||
w.Write(topic_alt_frags[119])
|
w.Write(topic_alt_frags[119])
|
||||||
w.Write(phrases[47])
|
w.Write(phrases[41])
|
||||||
w.Write(topic_alt_frags[120])
|
w.Write(topic_alt_frags[120])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
|
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
|
||||||
w.Write(topic_alt_frags[121])
|
w.Write(topic_alt_frags[121])
|
||||||
|
@ -466,7 +448,7 @@ if item.ActionType != "" {
|
||||||
w.Write(topic_alt_frags[125])
|
w.Write(topic_alt_frags[125])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[126])
|
w.Write(topic_alt_frags[126])
|
||||||
w.Write(phrases[48])
|
w.Write(phrases[42])
|
||||||
w.Write(topic_alt_frags[127])
|
w.Write(topic_alt_frags[127])
|
||||||
w.Write([]byte(item.Avatar))
|
w.Write([]byte(item.Avatar))
|
||||||
w.Write(topic_alt_frags[128])
|
w.Write(topic_alt_frags[128])
|
||||||
|
@ -480,7 +462,7 @@ w.Write([]byte(item.Tag))
|
||||||
w.Write(topic_alt_frags[132])
|
w.Write(topic_alt_frags[132])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_alt_frags[133])
|
w.Write(topic_alt_frags[133])
|
||||||
w.Write(phrases[49])
|
w.Write(phrases[43])
|
||||||
w.Write([]byte(strconv.Itoa(item.Level)))
|
w.Write([]byte(strconv.Itoa(item.Level)))
|
||||||
w.Write(topic_alt_frags[134])
|
w.Write(topic_alt_frags[134])
|
||||||
}
|
}
|
||||||
|
@ -516,7 +498,7 @@ w.Write(topic_alt_frags[148])
|
||||||
w.Write(topic_alt_frags[149])
|
w.Write(topic_alt_frags[149])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[150])
|
w.Write(topic_alt_frags[150])
|
||||||
w.Write(phrases[50])
|
w.Write(phrases[44])
|
||||||
w.Write(topic_alt_frags[151])
|
w.Write(topic_alt_frags[151])
|
||||||
}
|
}
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply {
|
if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply {
|
||||||
|
@ -525,7 +507,7 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(topic_alt_frags[153])
|
w.Write(topic_alt_frags[153])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[154])
|
w.Write(topic_alt_frags[154])
|
||||||
w.Write(phrases[51])
|
w.Write(phrases[45])
|
||||||
w.Write(topic_alt_frags[155])
|
w.Write(topic_alt_frags[155])
|
||||||
}
|
}
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply {
|
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply {
|
||||||
|
@ -534,16 +516,16 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(topic_alt_frags[157])
|
w.Write(topic_alt_frags[157])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[158])
|
w.Write(topic_alt_frags[158])
|
||||||
w.Write(phrases[52])
|
w.Write(phrases[46])
|
||||||
w.Write(topic_alt_frags[159])
|
w.Write(topic_alt_frags[159])
|
||||||
}
|
}
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
|
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
|
||||||
w.Write(topic_alt_frags[160])
|
w.Write(topic_alt_frags[160])
|
||||||
w.Write([]byte(item.IPAddress))
|
w.Write([]byte(item.IPAddress))
|
||||||
w.Write(topic_alt_frags[161])
|
w.Write(topic_alt_frags[161])
|
||||||
w.Write(phrases[53])
|
w.Write(phrases[47])
|
||||||
w.Write(topic_alt_frags[162])
|
w.Write(topic_alt_frags[162])
|
||||||
w.Write(phrases[54])
|
w.Write(phrases[48])
|
||||||
w.Write(topic_alt_frags[163])
|
w.Write(topic_alt_frags[163])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[164])
|
w.Write(topic_alt_frags[164])
|
||||||
|
@ -551,11 +533,11 @@ w.Write([]byte(strconv.Itoa(item.ID)))
|
||||||
w.Write(topic_alt_frags[165])
|
w.Write(topic_alt_frags[165])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[166])
|
w.Write(topic_alt_frags[166])
|
||||||
w.Write(phrases[55])
|
w.Write(phrases[49])
|
||||||
w.Write(topic_alt_frags[167])
|
w.Write(topic_alt_frags[167])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[168])
|
w.Write(topic_alt_frags[168])
|
||||||
w.Write(phrases[56])
|
w.Write(phrases[50])
|
||||||
w.Write(topic_alt_frags[169])
|
w.Write(topic_alt_frags[169])
|
||||||
w.Write([]byte(strconv.Itoa(item.LikeCount)))
|
w.Write([]byte(strconv.Itoa(item.LikeCount)))
|
||||||
w.Write(topic_alt_frags[170])
|
w.Write(topic_alt_frags[170])
|
||||||
|
@ -576,7 +558,7 @@ w.Write(topic_alt_frags[176])
|
||||||
w.Write(topic_alt_frags[177])
|
w.Write(topic_alt_frags[177])
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply {
|
if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply {
|
||||||
w.Write(topic_alt_frags[178])
|
w.Write(topic_alt_frags[178])
|
||||||
w.Write(phrases[57])
|
w.Write(phrases[51])
|
||||||
w.Write(topic_alt_frags[179])
|
w.Write(topic_alt_frags[179])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Avatar))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Avatar))
|
||||||
w.Write(topic_alt_frags[180])
|
w.Write(topic_alt_frags[180])
|
||||||
|
@ -590,28 +572,28 @@ w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Tag))
|
||||||
w.Write(topic_alt_frags[184])
|
w.Write(topic_alt_frags[184])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topic_alt_frags[185])
|
w.Write(topic_alt_frags[185])
|
||||||
w.Write(phrases[58])
|
w.Write(phrases[52])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.CurrentUser.Level)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.CurrentUser.Level)))
|
||||||
w.Write(topic_alt_frags[186])
|
w.Write(topic_alt_frags[186])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[187])
|
w.Write(topic_alt_frags[187])
|
||||||
w.Write(phrases[59])
|
w.Write(phrases[53])
|
||||||
w.Write(topic_alt_frags[188])
|
w.Write(topic_alt_frags[188])
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
w.Write(topic_alt_frags[189])
|
w.Write(topic_alt_frags[189])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
|
||||||
w.Write(topic_alt_frags[190])
|
w.Write(topic_alt_frags[190])
|
||||||
w.Write(phrases[60])
|
w.Write(phrases[54])
|
||||||
w.Write(topic_alt_frags[191])
|
w.Write(topic_alt_frags[191])
|
||||||
w.Write(phrases[61])
|
w.Write(phrases[55])
|
||||||
w.Write(topic_alt_frags[192])
|
w.Write(topic_alt_frags[192])
|
||||||
w.Write(phrases[62])
|
w.Write(phrases[56])
|
||||||
w.Write(topic_alt_frags[193])
|
w.Write(topic_alt_frags[193])
|
||||||
w.Write(phrases[63])
|
w.Write(phrases[57])
|
||||||
w.Write(topic_alt_frags[194])
|
w.Write(topic_alt_frags[194])
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Perms.UploadFiles {
|
if tmpl_topic_alt_vars.CurrentUser.Perms.UploadFiles {
|
||||||
w.Write(topic_alt_frags[195])
|
w.Write(topic_alt_frags[195])
|
||||||
w.Write(phrases[64])
|
w.Write(phrases[58])
|
||||||
w.Write(topic_alt_frags[196])
|
w.Write(topic_alt_frags[196])
|
||||||
}
|
}
|
||||||
w.Write(topic_alt_frags[197])
|
w.Write(topic_alt_frags[197])
|
||||||
|
@ -620,11 +602,11 @@ w.Write(topic_alt_frags[198])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_topic_alt_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_topic_alt_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[65])
|
w.Write(phrases[59])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[66])
|
w.Write(phrases[60])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[67])
|
w.Write(phrases[61])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_topic_alt_vars.Header.Themes) != 0 {
|
if len(tmpl_topic_alt_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_topic_alt_vars.Header.Themes {
|
for _, item := range tmpl_topic_alt_vars.Header.Themes {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Code generated by Gosora. More below:
|
// 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. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "net/http"
|
import "io"
|
||||||
import "./common"
|
import "./common"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
|
||||||
|
@ -16,12 +16,6 @@ func init() {
|
||||||
common.TmplPtrMap["topics"] = &common.Template_topics_handle
|
common.TmplPtrMap["topics"] = &common.Template_topics_handle
|
||||||
common.TmplPtrMap["o_topics"] = Template_topics
|
common.TmplPtrMap["o_topics"] = Template_topics
|
||||||
topics_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
topics_tmpl_phrase_id = common.RegisterTmplPhraseNames([]string{
|
||||||
"menu_forums_aria",
|
|
||||||
"menu_forums_tooltip",
|
|
||||||
"menu_topics_aria",
|
|
||||||
"menu_topics_tooltip",
|
|
||||||
"menu_alert_counter_aria",
|
|
||||||
"menu_alert_list_aria",
|
|
||||||
"menu_account_aria",
|
"menu_account_aria",
|
||||||
"menu_account_tooltip",
|
"menu_account_tooltip",
|
||||||
"menu_profile_aria",
|
"menu_profile_aria",
|
||||||
|
@ -75,7 +69,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func Template_topics(tmpl_topics_vars common.TopicsPage, w http.ResponseWriter) error {
|
func Template_topics(tmpl_topics_vars common.TopicListPage, w io.Writer) error {
|
||||||
var phrases = common.GetTmplPhrasesBytes(topics_tmpl_phrase_id)
|
var phrases = common.GetTmplPhrasesBytes(topics_tmpl_phrase_id)
|
||||||
w.Write(header_frags[0])
|
w.Write(header_frags[0])
|
||||||
w.Write([]byte(tmpl_topics_vars.Title))
|
w.Write([]byte(tmpl_topics_vars.Title))
|
||||||
|
@ -117,59 +111,47 @@ w.Write(header_frags[16])
|
||||||
w.Write(menu_frags[0])
|
w.Write(menu_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_topics_vars.Header)))
|
w.Write([]byte(common.BuildWidget("leftOfNav",tmpl_topics_vars.Header)))
|
||||||
w.Write(menu_frags[1])
|
w.Write(menu_frags[1])
|
||||||
w.Write(menu_frags[2])
|
|
||||||
w.Write([]byte(tmpl_topics_vars.Header.Site.ShortName))
|
w.Write([]byte(tmpl_topics_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_frags[2])
|
||||||
|
w.Write([]byte(common.BuildWidget("topMenu",tmpl_topics_vars.Header)))
|
||||||
|
if tmpl_topics_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_frags[3])
|
w.Write(menu_frags[3])
|
||||||
w.Write(phrases[0])
|
w.Write(phrases[0])
|
||||||
w.Write(menu_frags[4])
|
w.Write(menu_frags[4])
|
||||||
w.Write(phrases[1])
|
w.Write(phrases[1])
|
||||||
w.Write(menu_frags[5])
|
w.Write(menu_frags[5])
|
||||||
w.Write(phrases[2])
|
|
||||||
w.Write(menu_frags[6])
|
|
||||||
w.Write(phrases[3])
|
|
||||||
w.Write(menu_frags[7])
|
|
||||||
w.Write(phrases[4])
|
|
||||||
w.Write(menu_frags[8])
|
|
||||||
w.Write(phrases[5])
|
|
||||||
w.Write(menu_frags[9])
|
|
||||||
if tmpl_topics_vars.CurrentUser.Loggedin {
|
|
||||||
w.Write(menu_frags[10])
|
|
||||||
w.Write(phrases[6])
|
|
||||||
w.Write(menu_frags[11])
|
|
||||||
w.Write(phrases[7])
|
|
||||||
w.Write(menu_frags[12])
|
|
||||||
w.Write([]byte(tmpl_topics_vars.CurrentUser.Link))
|
w.Write([]byte(tmpl_topics_vars.CurrentUser.Link))
|
||||||
w.Write(menu_frags[13])
|
w.Write(menu_frags[6])
|
||||||
w.Write(phrases[8])
|
w.Write(phrases[2])
|
||||||
w.Write(menu_frags[14])
|
w.Write(menu_frags[7])
|
||||||
w.Write(phrases[9])
|
w.Write(phrases[3])
|
||||||
w.Write(menu_frags[15])
|
w.Write(menu_frags[8])
|
||||||
w.Write(phrases[10])
|
w.Write(phrases[4])
|
||||||
w.Write(menu_frags[16])
|
w.Write(menu_frags[9])
|
||||||
w.Write(phrases[11])
|
w.Write(phrases[5])
|
||||||
w.Write(menu_frags[17])
|
w.Write(menu_frags[10])
|
||||||
w.Write([]byte(tmpl_topics_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topics_vars.CurrentUser.Session))
|
||||||
w.Write(menu_frags[18])
|
w.Write(menu_frags[11])
|
||||||
w.Write(phrases[12])
|
w.Write(phrases[6])
|
||||||
w.Write(menu_frags[19])
|
w.Write(menu_frags[12])
|
||||||
w.Write(phrases[13])
|
w.Write(phrases[7])
|
||||||
w.Write(menu_frags[20])
|
w.Write(menu_frags[13])
|
||||||
} else {
|
} else {
|
||||||
w.Write(menu_frags[21])
|
w.Write(menu_frags[14])
|
||||||
w.Write(phrases[14])
|
w.Write(phrases[8])
|
||||||
w.Write(menu_frags[22])
|
w.Write(menu_frags[15])
|
||||||
w.Write(phrases[15])
|
w.Write(phrases[9])
|
||||||
w.Write(menu_frags[23])
|
w.Write(menu_frags[16])
|
||||||
w.Write(phrases[16])
|
w.Write(phrases[10])
|
||||||
w.Write(menu_frags[24])
|
w.Write(menu_frags[17])
|
||||||
w.Write(phrases[17])
|
w.Write(phrases[11])
|
||||||
w.Write(menu_frags[25])
|
w.Write(menu_frags[18])
|
||||||
}
|
}
|
||||||
w.Write(menu_frags[26])
|
w.Write(menu_frags[19])
|
||||||
w.Write(phrases[18])
|
w.Write(phrases[12])
|
||||||
w.Write(menu_frags[27])
|
w.Write(menu_frags[20])
|
||||||
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_topics_vars.Header)))
|
w.Write([]byte(common.BuildWidget("rightOfNav",tmpl_topics_vars.Header)))
|
||||||
w.Write(menu_frags[28])
|
w.Write(menu_frags[21])
|
||||||
w.Write(header_frags[17])
|
w.Write(header_frags[17])
|
||||||
if tmpl_topics_vars.Header.Widgets.RightSidebar != "" {
|
if tmpl_topics_vars.Header.Widgets.RightSidebar != "" {
|
||||||
w.Write(header_frags[18])
|
w.Write(header_frags[18])
|
||||||
|
@ -188,26 +170,26 @@ if tmpl_topics_vars.CurrentUser.ID != 0 {
|
||||||
w.Write(topics_frags[1])
|
w.Write(topics_frags[1])
|
||||||
}
|
}
|
||||||
w.Write(topics_frags[2])
|
w.Write(topics_frags[2])
|
||||||
w.Write(phrases[19])
|
w.Write(phrases[13])
|
||||||
w.Write(topics_frags[3])
|
w.Write(topics_frags[3])
|
||||||
if tmpl_topics_vars.CurrentUser.ID != 0 {
|
if tmpl_topics_vars.CurrentUser.ID != 0 {
|
||||||
w.Write(topics_frags[4])
|
w.Write(topics_frags[4])
|
||||||
if len(tmpl_topics_vars.ForumList) != 0 {
|
if len(tmpl_topics_vars.ForumList) != 0 {
|
||||||
w.Write(topics_frags[5])
|
w.Write(topics_frags[5])
|
||||||
w.Write(phrases[20])
|
w.Write(phrases[14])
|
||||||
w.Write(topics_frags[6])
|
w.Write(topics_frags[6])
|
||||||
w.Write(phrases[21])
|
w.Write(phrases[15])
|
||||||
w.Write(topics_frags[7])
|
w.Write(topics_frags[7])
|
||||||
w.Write(topics_frags[8])
|
w.Write(topics_frags[8])
|
||||||
w.Write(phrases[22])
|
w.Write(phrases[16])
|
||||||
w.Write(topics_frags[9])
|
w.Write(topics_frags[9])
|
||||||
w.Write(phrases[23])
|
w.Write(phrases[17])
|
||||||
w.Write(topics_frags[10])
|
w.Write(topics_frags[10])
|
||||||
} else {
|
} else {
|
||||||
w.Write(topics_frags[11])
|
w.Write(topics_frags[11])
|
||||||
w.Write(phrases[24])
|
w.Write(phrases[18])
|
||||||
w.Write(topics_frags[12])
|
w.Write(topics_frags[12])
|
||||||
w.Write(phrases[25])
|
w.Write(phrases[19])
|
||||||
w.Write(topics_frags[13])
|
w.Write(topics_frags[13])
|
||||||
}
|
}
|
||||||
w.Write(topics_frags[14])
|
w.Write(topics_frags[14])
|
||||||
|
@ -215,21 +197,21 @@ w.Write(topics_frags[14])
|
||||||
w.Write(topics_frags[15])
|
w.Write(topics_frags[15])
|
||||||
if tmpl_topics_vars.CurrentUser.ID != 0 {
|
if tmpl_topics_vars.CurrentUser.ID != 0 {
|
||||||
w.Write(topics_frags[16])
|
w.Write(topics_frags[16])
|
||||||
w.Write(phrases[26])
|
w.Write(phrases[20])
|
||||||
w.Write(topics_frags[17])
|
w.Write(topics_frags[17])
|
||||||
w.Write(phrases[27])
|
w.Write(phrases[21])
|
||||||
w.Write(topics_frags[18])
|
w.Write(topics_frags[18])
|
||||||
w.Write(phrases[28])
|
w.Write(phrases[22])
|
||||||
w.Write(topics_frags[19])
|
w.Write(topics_frags[19])
|
||||||
w.Write(phrases[29])
|
w.Write(phrases[23])
|
||||||
w.Write(topics_frags[20])
|
w.Write(topics_frags[20])
|
||||||
w.Write(phrases[30])
|
w.Write(phrases[24])
|
||||||
w.Write(topics_frags[21])
|
w.Write(topics_frags[21])
|
||||||
if len(tmpl_topics_vars.ForumList) != 0 {
|
if len(tmpl_topics_vars.ForumList) != 0 {
|
||||||
w.Write(topics_frags[22])
|
w.Write(topics_frags[22])
|
||||||
w.Write([]byte(tmpl_topics_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topics_vars.CurrentUser.Session))
|
||||||
w.Write(topics_frags[23])
|
w.Write(topics_frags[23])
|
||||||
w.Write(phrases[31])
|
w.Write(phrases[25])
|
||||||
w.Write(topics_frags[24])
|
w.Write(topics_frags[24])
|
||||||
if len(tmpl_topics_vars.ForumList) != 0 {
|
if len(tmpl_topics_vars.ForumList) != 0 {
|
||||||
for _, item := range tmpl_topics_vars.ForumList {
|
for _, item := range tmpl_topics_vars.ForumList {
|
||||||
|
@ -243,17 +225,17 @@ w.Write(topics_frags[28])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Write(topics_frags[29])
|
w.Write(topics_frags[29])
|
||||||
w.Write(phrases[32])
|
w.Write(phrases[26])
|
||||||
w.Write(topics_frags[30])
|
w.Write(topics_frags[30])
|
||||||
w.Write(phrases[33])
|
w.Write(phrases[27])
|
||||||
w.Write(topics_frags[31])
|
w.Write(topics_frags[31])
|
||||||
w.Write([]byte(tmpl_topics_vars.CurrentUser.Session))
|
w.Write([]byte(tmpl_topics_vars.CurrentUser.Session))
|
||||||
w.Write(topics_frags[32])
|
w.Write(topics_frags[32])
|
||||||
w.Write([]byte(tmpl_topics_vars.CurrentUser.Avatar))
|
w.Write([]byte(tmpl_topics_vars.CurrentUser.Avatar))
|
||||||
w.Write(topics_frags[33])
|
w.Write(topics_frags[33])
|
||||||
w.Write(phrases[34])
|
w.Write(phrases[28])
|
||||||
w.Write(topics_frags[34])
|
w.Write(topics_frags[34])
|
||||||
w.Write(phrases[35])
|
w.Write(phrases[29])
|
||||||
w.Write(topics_frags[35])
|
w.Write(topics_frags[35])
|
||||||
if len(tmpl_topics_vars.ForumList) != 0 {
|
if len(tmpl_topics_vars.ForumList) != 0 {
|
||||||
for _, item := range tmpl_topics_vars.ForumList {
|
for _, item := range tmpl_topics_vars.ForumList {
|
||||||
|
@ -269,28 +251,28 @@ w.Write(topics_frags[40])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Write(topics_frags[41])
|
w.Write(topics_frags[41])
|
||||||
w.Write(phrases[36])
|
w.Write(phrases[30])
|
||||||
w.Write(topics_frags[42])
|
w.Write(topics_frags[42])
|
||||||
w.Write(phrases[37])
|
w.Write(phrases[31])
|
||||||
w.Write(topics_frags[43])
|
w.Write(topics_frags[43])
|
||||||
w.Write(phrases[38])
|
w.Write(phrases[32])
|
||||||
w.Write(topics_frags[44])
|
w.Write(topics_frags[44])
|
||||||
w.Write(phrases[39])
|
w.Write(phrases[33])
|
||||||
w.Write(topics_frags[45])
|
w.Write(topics_frags[45])
|
||||||
w.Write(phrases[40])
|
w.Write(phrases[34])
|
||||||
w.Write(topics_frags[46])
|
w.Write(topics_frags[46])
|
||||||
if tmpl_topics_vars.CurrentUser.Perms.UploadFiles {
|
if tmpl_topics_vars.CurrentUser.Perms.UploadFiles {
|
||||||
w.Write(topics_frags[47])
|
w.Write(topics_frags[47])
|
||||||
w.Write(phrases[41])
|
w.Write(phrases[35])
|
||||||
w.Write(topics_frags[48])
|
w.Write(topics_frags[48])
|
||||||
}
|
}
|
||||||
w.Write(topics_frags[49])
|
w.Write(topics_frags[49])
|
||||||
w.Write(phrases[42])
|
w.Write(phrases[36])
|
||||||
w.Write(topics_frags[50])
|
w.Write(topics_frags[50])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Write(topics_frags[51])
|
w.Write(topics_frags[51])
|
||||||
w.Write(phrases[43])
|
w.Write(phrases[37])
|
||||||
w.Write(topics_frags[52])
|
w.Write(topics_frags[52])
|
||||||
if len(tmpl_topics_vars.TopicList) != 0 {
|
if len(tmpl_topics_vars.TopicList) != 0 {
|
||||||
for _, item := range tmpl_topics_vars.TopicList {
|
for _, item := range tmpl_topics_vars.TopicList {
|
||||||
|
@ -337,12 +319,12 @@ w.Write([]byte(item.Creator.Name))
|
||||||
w.Write(topics_frags[72])
|
w.Write(topics_frags[72])
|
||||||
if item.IsClosed {
|
if item.IsClosed {
|
||||||
w.Write(topics_frags[73])
|
w.Write(topics_frags[73])
|
||||||
w.Write(phrases[44])
|
w.Write(phrases[38])
|
||||||
w.Write(topics_frags[74])
|
w.Write(topics_frags[74])
|
||||||
}
|
}
|
||||||
if item.Sticky {
|
if item.Sticky {
|
||||||
w.Write(topics_frags[75])
|
w.Write(topics_frags[75])
|
||||||
w.Write(phrases[45])
|
w.Write(phrases[39])
|
||||||
w.Write(topics_frags[76])
|
w.Write(topics_frags[76])
|
||||||
}
|
}
|
||||||
w.Write(topics_frags[77])
|
w.Write(topics_frags[77])
|
||||||
|
@ -377,10 +359,10 @@ w.Write(topics_frags[90])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
w.Write(topics_frags[91])
|
w.Write(topics_frags[91])
|
||||||
w.Write(phrases[46])
|
w.Write(phrases[40])
|
||||||
if tmpl_topics_vars.CurrentUser.Perms.CreateTopic {
|
if tmpl_topics_vars.CurrentUser.Perms.CreateTopic {
|
||||||
w.Write(topics_frags[92])
|
w.Write(topics_frags[92])
|
||||||
w.Write(phrases[47])
|
w.Write(phrases[41])
|
||||||
w.Write(topics_frags[93])
|
w.Write(topics_frags[93])
|
||||||
}
|
}
|
||||||
w.Write(topics_frags[94])
|
w.Write(topics_frags[94])
|
||||||
|
@ -392,9 +374,9 @@ if tmpl_topics_vars.Page > 1 {
|
||||||
w.Write(paginator_frags[1])
|
w.Write(paginator_frags[1])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page - 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page - 1)))
|
||||||
w.Write(paginator_frags[2])
|
w.Write(paginator_frags[2])
|
||||||
w.Write(phrases[48])
|
w.Write(phrases[42])
|
||||||
w.Write(paginator_frags[3])
|
w.Write(paginator_frags[3])
|
||||||
w.Write(phrases[49])
|
w.Write(phrases[43])
|
||||||
w.Write(paginator_frags[4])
|
w.Write(paginator_frags[4])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page - 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page - 1)))
|
||||||
w.Write(paginator_frags[5])
|
w.Write(paginator_frags[5])
|
||||||
|
@ -414,9 +396,9 @@ w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page + 1)))
|
||||||
w.Write(paginator_frags[10])
|
w.Write(paginator_frags[10])
|
||||||
w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page + 1)))
|
w.Write([]byte(strconv.Itoa(tmpl_topics_vars.Page + 1)))
|
||||||
w.Write(paginator_frags[11])
|
w.Write(paginator_frags[11])
|
||||||
w.Write(phrases[50])
|
w.Write(phrases[44])
|
||||||
w.Write(paginator_frags[12])
|
w.Write(paginator_frags[12])
|
||||||
w.Write(phrases[51])
|
w.Write(phrases[45])
|
||||||
w.Write(paginator_frags[13])
|
w.Write(paginator_frags[13])
|
||||||
}
|
}
|
||||||
w.Write(paginator_frags[14])
|
w.Write(paginator_frags[14])
|
||||||
|
@ -425,11 +407,11 @@ w.Write(topics_frags[96])
|
||||||
w.Write(footer_frags[0])
|
w.Write(footer_frags[0])
|
||||||
w.Write([]byte(common.BuildWidget("footer",tmpl_topics_vars.Header)))
|
w.Write([]byte(common.BuildWidget("footer",tmpl_topics_vars.Header)))
|
||||||
w.Write(footer_frags[1])
|
w.Write(footer_frags[1])
|
||||||
w.Write(phrases[52])
|
w.Write(phrases[46])
|
||||||
w.Write(footer_frags[2])
|
w.Write(footer_frags[2])
|
||||||
w.Write(phrases[53])
|
w.Write(phrases[47])
|
||||||
w.Write(footer_frags[3])
|
w.Write(footer_frags[3])
|
||||||
w.Write(phrases[54])
|
w.Write(phrases[48])
|
||||||
w.Write(footer_frags[4])
|
w.Write(footer_frags[4])
|
||||||
if len(tmpl_topics_vars.Header.Themes) != 0 {
|
if len(tmpl_topics_vars.Header.Themes) != 0 {
|
||||||
for _, item := range tmpl_topics_vars.Header.Themes {
|
for _, item := range tmpl_topics_vars.Header.Themes {
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
{{if .Avatar}}<div class='alertItem withAvatar' style='background-image:url("{{.Avatar}}");'><a class='text' data-asid='{{.ASID}}' href="{{.Path}}">{{.Message}}</a></div>{{else}}
|
||||||
|
<div class='alertItem'><a href="{{.Path}}" class='text'>{{.Message}}</a></div>{{end}}
|
|
@ -2,16 +2,9 @@
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<div class="move_left">
|
<div class="move_left">
|
||||||
<div class="move_right">
|
<div class="move_right">
|
||||||
<ul>{{/** Add a menu manager **/}}
|
<ul>
|
||||||
<li id="menu_overview" class="menu_left"><a href="/" rel="home">{{.Header.Site.ShortName}}</a></li>
|
<li id="menu_overview" class="menu_left"><a href="/" rel="home">{{.Header.Site.ShortName}}</a></li>
|
||||||
<li id="menu_forums" class="menu_left"><a href="/forums/" aria-label="{{lang "menu_forums_aria"}}" title="{{lang "menu_forums_tooltip"}}"></a></li>
|
{{dock "topMenu" .Header }}
|
||||||
<li class="menu_left menu_topics"><a href="/" aria-label="{{lang "menu_topics_aria"}}" title="{{lang "menu_topics_tooltip"}}"></a></li>
|
|
||||||
<li id="general_alerts" class="menu_right menu_alerts">
|
|
||||||
<div class="alert_bell"></div>
|
|
||||||
<div class="alert_counter" aria-label="{{lang "menu_alert_counter_aria"}}"></div>
|
|
||||||
<div class="alert_aftercounter"></div>
|
|
||||||
<div class="alertList" aria-label="{{lang "menu_alert_list_aria"}}"></div>
|
|
||||||
</li>
|
|
||||||
{{if .CurrentUser.Loggedin}}
|
{{if .CurrentUser.Loggedin}}
|
||||||
<li class="menu_left menu_account"><a href="/user/edit/critical/" aria-label="{{lang "menu_account_aria"}}" title="{{lang "menu_account_tooltip"}}"></a></li>
|
<li class="menu_left menu_account"><a href="/user/edit/critical/" aria-label="{{lang "menu_account_aria"}}" title="{{lang "menu_account_tooltip"}}"></a></li>
|
||||||
<li class="menu_left menu_profile"><a href="{{.CurrentUser.Link}}" aria-label="{{lang "menu_profile_aria"}}" title="{{lang "menu_profile_tooltip"}}"></a></li>
|
<li class="menu_left menu_profile"><a href="{{.CurrentUser.Link}}" aria-label="{{lang "menu_profile_aria"}}" title="{{lang "menu_profile_tooltip"}}"></a></li>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<li id="general_alerts" class="menu_right menu_alerts">
|
||||||
|
<div class="alert_bell"></div>
|
||||||
|
<div class="alert_counter" aria-label="{{lang "menu_alert_counter_aria"}}"></div>
|
||||||
|
<div class="alert_aftercounter"></div>
|
||||||
|
<div class="alertList" aria-label="{{lang "menu_alert_list_aria"}}"></div>
|
||||||
|
</li>
|
|
@ -0,0 +1 @@
|
||||||
|
<li id="{{.HTMLID}}" class="menu_{{.Position}} {{.CSSClass}}"><a href="{{.Path}}" aria-label="{{.Aria}}" title="{{.Tooltip}}"></a></li>
|
|
@ -7,12 +7,21 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="panel_debug" class="colstack_grid">
|
<div id="panel_debug" class="colstack_grid">
|
||||||
<div class="grid_item grid_stat"><span>{{lang "panel_debug_uptime_label"}}</span></div>
|
<div class="grid_item grid_stat"><span>{{lang "panel_debug_uptime_label"}}</span></div>
|
||||||
<div class="grid_item grid_stat"><span>{{lang "panel_debug_open_database_connections_label"}}</span></div>
|
<div class="grid_item grid_stat"><span>{{lang "panel_debug_go_version_label"}}</span></div>
|
||||||
<div class="grid_item grid_stat"><span>{{lang "panel_debug_adapter_label"}}</span></div>
|
<div class="grid_item grid_stat"><span>{{lang "panel_debug_database_version_label"}}</span></div>
|
||||||
|
|
||||||
<div class="grid_item grid_stat"><span>{{.Uptime}}</span></div>
|
<div class="grid_item grid_stat"><span>{{.Uptime}}</span></div>
|
||||||
|
<div class="grid_item grid_stat"><span>{{.GoVersion}}</span></div>
|
||||||
|
<div class="grid_item grid_stat"><span>{{.DBVersion}}</span></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="grid_item grid_stat"><span>{{lang "panel_debug_open_database_connections_label"}}</span></div>
|
||||||
|
<div class="grid_item grid_stat"><span>{{lang "panel_debug_adapter_label"}}</span></div>
|
||||||
|
<div class="grid_item grid_stat"><span>???</span></div>
|
||||||
|
|
||||||
<div class="grid_item grid_stat"><span>{{.OpenConns}}</span></div>
|
<div class="grid_item grid_stat"><span>{{.OpenConns}}</span></div>
|
||||||
<div class="grid_item grid_stat"><span>{{.DBAdapter}}</span></div>
|
<div class="grid_item grid_stat"><span>{{.DBAdapter}}</span></div>
|
||||||
|
<div class="grid_item grid_stat"><span>?</span></div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
<div class="colstack_item colstack_head">
|
<div class="colstack_item colstack_head">
|
||||||
<div class="rowitem"><a href="/panel/themes/">Theme Manager</a></div>
|
<div class="rowitem"><a href="/panel/themes/">Theme Manager</a></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="colstack_item rowmenu">
|
||||||
|
<div class="rowitem passive"><a href="/panel/themes/menus/">Menus</a></div>
|
||||||
|
</div>
|
||||||
<div class="colstack_item rowmenu">
|
<div class="colstack_item rowmenu">
|
||||||
<div class="rowitem passive"><a href="#">Widgets</a></div>
|
<div class="rowitem passive"><a href="#">Widgets</a></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"Creator": "Azareal",
|
"Creator": "Azareal",
|
||||||
"URL": "github.com/Azareal/Gosora",
|
"URL": "github.com/Azareal/Gosora",
|
||||||
"Tag": "WIP",
|
"Tag": "WIP",
|
||||||
"Docks":["rightSidebar","footer"],
|
"Docks":["topMenu","rightSidebar","footer"],
|
||||||
"Templates": [
|
"Templates": [
|
||||||
{
|
{
|
||||||
"Name": "topic",
|
"Name": "topic",
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"FullImage": "shadow.png",
|
"FullImage": "shadow.png",
|
||||||
"URL": "github.com/Azareal/Gosora",
|
"URL": "github.com/Azareal/Gosora",
|
||||||
"BgAvatars":true,
|
"BgAvatars":true,
|
||||||
|
"Docks":["topMenu"],
|
||||||
"Templates": [
|
"Templates": [
|
||||||
{
|
{
|
||||||
"Name": "topic",
|
"Name": "topic",
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"MobileFriendly": true,
|
"MobileFriendly": true,
|
||||||
"BgAvatars":true,
|
"BgAvatars":true,
|
||||||
"URL": "github.com/Azareal/Gosora",
|
"URL": "github.com/Azareal/Gosora",
|
||||||
"Docks":["rightSidebar"],
|
"Docks":["topMenu","rightSidebar"],
|
||||||
"Templates": [
|
"Templates": [
|
||||||
{
|
{
|
||||||
"Name": "topic",
|
"Name": "topic",
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
"HideFromThemes": true,
|
"HideFromThemes": true,
|
||||||
"BgAvatars":true,
|
"BgAvatars":true,
|
||||||
"URL": "github.com/Azareal/Gosora",
|
"URL": "github.com/Azareal/Gosora",
|
||||||
|
"Docks":["topMenu"],
|
||||||
"Templates": [
|
"Templates": [
|
||||||
{
|
{
|
||||||
"Name": "topic",
|
"Name": "topic",
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"MobileFriendly": true,
|
"MobileFriendly": true,
|
||||||
"URL": "github.com/Azareal/Gosora",
|
"URL": "github.com/Azareal/Gosora",
|
||||||
"BgAvatars":true,
|
"BgAvatars":true,
|
||||||
"Docks":["rightSidebar"],
|
"Docks":["topMenu","rightSidebar"],
|
||||||
"Templates": [
|
"Templates": [
|
||||||
{
|
{
|
||||||
"Name": "topic",
|
"Name": "topic",
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
// +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 tmpl
|
||||||
|
import "../../common"
|
||||||
|
import "io"
|
||||||
|
import "strconv"
|
||||||
|
|
||||||
|
// nolint
|
||||||
|
func init() {
|
||||||
|
common.TmplPtrMap["o_alert"] = Template_alert
|
||||||
|
}
|
||||||
|
|
||||||
|
// nolint
|
||||||
|
func Template_alert(tmpl_alert_vars common.AlertItem, w io.Writer) error {
|
||||||
|
if tmpl_alert_vars.Avatar != "" {
|
||||||
|
w.Write(alert_frags[0])
|
||||||
|
w.Write([]byte(tmpl_alert_vars.Avatar))
|
||||||
|
w.Write(alert_frags[1])
|
||||||
|
w.Write([]byte(strconv.Itoa(tmpl_alert_vars.ASID)))
|
||||||
|
w.Write(alert_frags[2])
|
||||||
|
w.Write([]byte(tmpl_alert_vars.Path))
|
||||||
|
w.Write(alert_frags[3])
|
||||||
|
w.Write([]byte(tmpl_alert_vars.Message))
|
||||||
|
w.Write(alert_frags[4])
|
||||||
|
} else {
|
||||||
|
w.Write(alert_frags[5])
|
||||||
|
w.Write([]byte(tmpl_alert_vars.Path))
|
||||||
|
w.Write(alert_frags[6])
|
||||||
|
w.Write([]byte(tmpl_alert_vars.Message))
|
||||||
|
w.Write(alert_frags[7])
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package tmpl
|
||||||
|
|
||||||
|
var alert_frags = make([][]byte,9)
|
||||||
|
|
||||||
|
// nolint
|
||||||
|
func init() {
|
||||||
|
alert_frags[0] = []byte(`<div class='alertItem withAvatar' style='background-image:url("`)
|
||||||
|
alert_frags[1] = []byte(`");'><a class='text' data-asid='`)
|
||||||
|
alert_frags[2] = []byte(`' href="`)
|
||||||
|
alert_frags[3] = []byte(`">`)
|
||||||
|
alert_frags[4] = []byte(`</a></div>`)
|
||||||
|
alert_frags[5] = []byte(`
|
||||||
|
<div class='alertItem'><a href="`)
|
||||||
|
alert_frags[6] = []byte(`" class='text'>`)
|
||||||
|
alert_frags[7] = []byte(`</a></div>`)
|
||||||
|
}
|
Loading…
Reference in New Issue