Added the HeaderVars struct which is now used in the header template.
The NoticeList field in the various page structs is now part of the HeaderVars struct. The Left / Right hotkeys will no longer take you to the next or previous page, if you have a textarea, input, or select element selected. Added the panel.css file. Added the PanelSessionCheck and SimplePanelSessionCheck functions. Reworked the ExtData field in the page structs, we'll have some hooks for you to inject stuff in here soon! Fixed a problem with the templates not getting remapped properly with Tempra Conflux when the compiled templates are missing. More Atom Madness.
This commit is contained in:
parent
1ccd4479ae
commit
c4e109adb7
32
errors.go
32
errors.go
|
@ -9,15 +9,15 @@ var error_notfound []byte
|
||||||
func init_errors() error {
|
func init_errors() error {
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
user := User{0,"Guest","",0,false,false,false,false,false,false,GuestPerms,"",false,"","","","","",0,0,"0.0.0.0.0"}
|
user := User{0,"Guest","",0,false,false,false,false,false,false,GuestPerms,"",false,"","","","","",0,0,"0.0.0.0.0"}
|
||||||
pi := Page{"Internal Server Error",user,nList,tList,"A problem has occurred in the system."}
|
pi := Page{"Internal Server Error",user,hvars,tList,"A problem has occurred in the system."}
|
||||||
err := templates.ExecuteTemplate(&b,"error.html", pi)
|
err := templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
error_internal = b.Bytes()
|
error_internal = b.Bytes()
|
||||||
|
|
||||||
b.Reset()
|
b.Reset()
|
||||||
pi = Page{"Not Found",user,nList,tList,"The requested page doesn't exist."}
|
pi = Page{"Not Found",user,hvars,tList,"The requested page doesn't exist."}
|
||||||
err = templates.ExecuteTemplate(&b,"error.html", pi)
|
err = templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -50,7 +50,7 @@ func InternalErrorJS(err error, w http.ResponseWriter, r *http.Request) {
|
||||||
func PreError(errmsg string, w http.ResponseWriter, r *http.Request) {
|
func PreError(errmsg string, w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
user := User{ID:0,Group:6,Perms:GuestPerms,}
|
user := User{ID:0,Group:6,Perms:GuestPerms,}
|
||||||
pi := Page{"Error",user,nList,tList,errmsg}
|
pi := Page{"Error",user,hvars,tList,errmsg}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html",pi)
|
templates.ExecuteTemplate(&b,"error.html",pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -58,7 +58,7 @@ func PreError(errmsg string, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func LocalError(errmsg string, w http.ResponseWriter, r *http.Request, user User) {
|
func LocalError(errmsg string, w http.ResponseWriter, r *http.Request, user User) {
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
pi := Page{"Local Error",user,nList,tList,errmsg}
|
pi := Page{"Local Error",user,hvars,tList,errmsg}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html",pi)
|
templates.ExecuteTemplate(&b,"error.html",pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -66,7 +66,7 @@ func LocalError(errmsg string, w http.ResponseWriter, r *http.Request, user User
|
||||||
|
|
||||||
func LoginRequired(w http.ResponseWriter, r *http.Request, user User) {
|
func LoginRequired(w http.ResponseWriter, r *http.Request, user User) {
|
||||||
w.WriteHeader(401)
|
w.WriteHeader(401)
|
||||||
pi := Page{"Local Error",user,nList,tList,"You need to login to do that."}
|
pi := Page{"Local Error",user,hvars,tList,"You need to login to do that."}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html",pi)
|
templates.ExecuteTemplate(&b,"error.html",pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -76,7 +76,7 @@ func PreErrorJSQ(errmsg string, w http.ResponseWriter, r *http.Request, is_js st
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
if is_js == "0" {
|
if is_js == "0" {
|
||||||
user := User{ID:0,Group:6,Perms:GuestPerms,}
|
user := User{ID:0,Group:6,Perms:GuestPerms,}
|
||||||
pi := Page{"Local Error",user,nList,tList,errmsg}
|
pi := Page{"Local Error",user,hvars,tList,errmsg}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -88,7 +88,7 @@ func PreErrorJSQ(errmsg string, w http.ResponseWriter, r *http.Request, is_js st
|
||||||
func LocalErrorJSQ(errmsg string, w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
func LocalErrorJSQ(errmsg string, w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
if is_js == "0" {
|
if is_js == "0" {
|
||||||
pi := Page{"Local Error",user,nList,tList,errmsg}
|
pi := Page{"Local Error",user,hvars,tList,errmsg}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -104,7 +104,7 @@ func LocalErrorJS(errmsg string, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func NoPermissions(w http.ResponseWriter, r *http.Request, user User) {
|
func NoPermissions(w http.ResponseWriter, r *http.Request, user User) {
|
||||||
w.WriteHeader(403)
|
w.WriteHeader(403)
|
||||||
pi := Page{"Local Error",user,nList,tList,"You don't have permission to do that."}
|
pi := Page{"Local Error",user,hvars,tList,"You don't have permission to do that."}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
errpage := b.String()
|
errpage := b.String()
|
||||||
|
@ -114,7 +114,7 @@ func NoPermissions(w http.ResponseWriter, r *http.Request, user User) {
|
||||||
func NoPermissionsJSQ(w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
func NoPermissionsJSQ(w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
||||||
w.WriteHeader(403)
|
w.WriteHeader(403)
|
||||||
if is_js == "0" {
|
if is_js == "0" {
|
||||||
pi := Page{"Local Error",user,nList,tList,"You don't have permission to do that."}
|
pi := Page{"Local Error",user,hvars,tList,"You don't have permission to do that."}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -125,7 +125,7 @@ func NoPermissionsJSQ(w http.ResponseWriter, r *http.Request, user User, is_js s
|
||||||
|
|
||||||
func Banned(w http.ResponseWriter, r *http.Request, user User) {
|
func Banned(w http.ResponseWriter, r *http.Request, user User) {
|
||||||
w.WriteHeader(403)
|
w.WriteHeader(403)
|
||||||
pi := Page{"Banned",user,nList,tList,"You have been banned from this site."}
|
pi := Page{"Banned",user,hvars,tList,"You have been banned from this site."}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -134,7 +134,7 @@ func Banned(w http.ResponseWriter, r *http.Request, user User) {
|
||||||
func BannedJSQ(w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
func BannedJSQ(w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
||||||
w.WriteHeader(403)
|
w.WriteHeader(403)
|
||||||
if is_js == "0" {
|
if is_js == "0" {
|
||||||
pi := Page{"Banned",user,nList,tList,"You have been banned from this site."}
|
pi := Page{"Banned",user,hvars,tList,"You have been banned from this site."}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -146,7 +146,7 @@ func BannedJSQ(w http.ResponseWriter, r *http.Request, user User, is_js string)
|
||||||
func LoginRequiredJSQ(w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
func LoginRequiredJSQ(w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
||||||
w.WriteHeader(401)
|
w.WriteHeader(401)
|
||||||
if is_js == "0" {
|
if is_js == "0" {
|
||||||
pi := Page{"Local Error",user,nList,tList,"You need to login to do that."}
|
pi := Page{"Local Error",user,hvars,tList,"You need to login to do that."}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -157,7 +157,7 @@ func LoginRequiredJSQ(w http.ResponseWriter, r *http.Request, user User, is_js s
|
||||||
|
|
||||||
func SecurityError(w http.ResponseWriter, r *http.Request, user User) {
|
func SecurityError(w http.ResponseWriter, r *http.Request, user User) {
|
||||||
w.WriteHeader(403)
|
w.WriteHeader(403)
|
||||||
pi := Page{"Security Error",user,nList,tList,"There was a security issue with your request."}
|
pi := Page{"Security Error",user,hvars,tList,"There was a security issue with your request."}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -170,7 +170,7 @@ func NotFound(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
func CustomError(errmsg string, errcode int, errtitle string, w http.ResponseWriter, r *http.Request, user User) {
|
func CustomError(errmsg string, errcode int, errtitle string, w http.ResponseWriter, r *http.Request, user User) {
|
||||||
w.WriteHeader(errcode)
|
w.WriteHeader(errcode)
|
||||||
pi := Page{errtitle,user,nList,tList,errmsg}
|
pi := Page{errtitle,user,hvars,tList,errmsg}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
@ -179,7 +179,7 @@ func CustomError(errmsg string, errcode int, errtitle string, w http.ResponseWri
|
||||||
func CustomErrorJSQ(errmsg string, errcode int, errtitle string, w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
func CustomErrorJSQ(errmsg string, errcode int, errtitle string, w http.ResponseWriter, r *http.Request, user User, is_js string) {
|
||||||
w.WriteHeader(errcode)
|
w.WriteHeader(errcode)
|
||||||
if is_js == "0" {
|
if is_js == "0" {
|
||||||
pi := Page{errtitle,user,nList,tList,errmsg}
|
pi := Page{errtitle,user,hvars,tList,errmsg}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
templates.ExecuteTemplate(&b,"error.html", pi)
|
templates.ExecuteTemplate(&b,"error.html", pi)
|
||||||
fmt.Fprintln(w,b.String())
|
fmt.Fprintln(w,b.String())
|
||||||
|
|
22
main.go
22
main.go
|
@ -58,7 +58,11 @@ var template_create_topic_handle func(CreateTopicPage,io.Writer) = nil
|
||||||
func compile_templates() {
|
func compile_templates() {
|
||||||
var c CTemplateSet
|
var c CTemplateSet
|
||||||
user := User{62,"","compiler@localhost",0,false,false,false,false,false,false,GuestPerms,"",false,"","","","","",0,0,"0.0.0.0.0"}
|
user := User{62,"","compiler@localhost",0,false,false,false,false,false,false,GuestPerms,"",false,"","","","","",0,0,"0.0.0.0.0"}
|
||||||
noticeList := []string{"test"}
|
headerVars := HeaderVars{
|
||||||
|
NoticeList:[]string{"test"},
|
||||||
|
Stylesheets:[]string{"panel"},
|
||||||
|
Scripts:[]string{"whatever"},
|
||||||
|
}
|
||||||
|
|
||||||
log.Print("Compiling the templates")
|
log.Print("Compiling the templates")
|
||||||
|
|
||||||
|
@ -67,12 +71,12 @@ func compile_templates() {
|
||||||
replyList = append(replyList, Reply{0,0,"","Yo!",0,"",default_group,"",0,0,"",no_css_tmpl,0,"","","","",0,"127.0.0.1",false,1,"",""})
|
replyList = append(replyList, Reply{0,0,"","Yo!",0,"",default_group,"",0,0,"",no_css_tmpl,0,"","","","",0,"127.0.0.1",false,1,"",""})
|
||||||
|
|
||||||
var varList map[string]VarItem = make(map[string]VarItem)
|
var varList map[string]VarItem = make(map[string]VarItem)
|
||||||
tpage := TopicPage{"Title",user,noticeList,replyList,topic,1,1,false}
|
tpage := TopicPage{"Title",user,headerVars,replyList,topic,1,1,extData}
|
||||||
topic_id_tmpl := c.compile_template("topic.html","templates/","TopicPage", tpage, varList)
|
topic_id_tmpl := c.compile_template("topic.html","templates/","TopicPage", tpage, varList)
|
||||||
topic_id_alt_tmpl := c.compile_template("topic_alt.html","templates/","TopicPage", tpage, varList)
|
topic_id_alt_tmpl := c.compile_template("topic_alt.html","templates/","TopicPage", tpage, varList)
|
||||||
|
|
||||||
varList = make(map[string]VarItem)
|
varList = make(map[string]VarItem)
|
||||||
ppage := ProfilePage{"User 526",user,noticeList,replyList,user,false}
|
ppage := ProfilePage{"User 526",user,headerVars,replyList,user,extData}
|
||||||
profile_tmpl := c.compile_template("profile.html","templates/","ProfilePage", ppage, varList)
|
profile_tmpl := c.compile_template("profile.html","templates/","ProfilePage", ppage, varList)
|
||||||
|
|
||||||
var forumList []Forum
|
var forumList []Forum
|
||||||
|
@ -82,18 +86,18 @@ func compile_templates() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
varList = make(map[string]VarItem)
|
varList = make(map[string]VarItem)
|
||||||
forums_page := ForumsPage{"Forum List",user,noticeList,forumList,0}
|
forums_page := ForumsPage{"Forum List",user,headerVars,forumList,extData}
|
||||||
forums_tmpl := c.compile_template("forums.html","templates/","ForumsPage", forums_page, varList)
|
forums_tmpl := c.compile_template("forums.html","templates/","ForumsPage", forums_page, varList)
|
||||||
|
|
||||||
var topicsList []TopicsRow
|
var topicsList []TopicsRow
|
||||||
topicsList = append(topicsList,TopicsRow{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"classname","Admin","","",0,"","","","",58,"General"})
|
topicsList = append(topicsList,TopicsRow{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"classname","Admin","","",0,"","","","",58,"General"})
|
||||||
topics_page := TopicsPage{"Topic List",user,noticeList,topicsList,""}
|
topics_page := TopicsPage{"Topic List",user,headerVars,topicsList,extData}
|
||||||
topics_tmpl := c.compile_template("topics.html","templates/","TopicsPage", topics_page, varList)
|
topics_tmpl := c.compile_template("topics.html","templates/","TopicsPage", topics_page, varList)
|
||||||
|
|
||||||
var topicList []TopicUser
|
var topicList []TopicUser
|
||||||
topicList = append(topicList,TopicUser{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"classname","","Admin",default_group,"","",0,"","","","",58,false})
|
topicList = append(topicList,TopicUser{1,"Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"classname","","Admin",default_group,"","",0,"","","","",58,false})
|
||||||
forum_item := Forum{1,"General Forum","Where the general stuff happens",true,"all",0,"",0,"",0,""}
|
forum_item := Forum{1,"General Forum","Where the general stuff happens",true,"all",0,"",0,"",0,""}
|
||||||
forum_page := ForumPage{"General Forum",user,noticeList,topicList,forum_item,1,1,nil}
|
forum_page := ForumPage{"General Forum",user,headerVars,topicList,forum_item,1,1,extData}
|
||||||
forum_tmpl := c.compile_template("forum.html","templates/","ForumPage", forum_page, varList)
|
forum_tmpl := c.compile_template("forum.html","templates/","ForumPage", forum_page, varList)
|
||||||
|
|
||||||
log.Print("Writing the templates")
|
log.Print("Writing the templates")
|
||||||
|
@ -114,6 +118,9 @@ func write_template(name string, content string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init_templates() {
|
func init_templates() {
|
||||||
|
if debug {
|
||||||
|
log.Print("Initialising the template system")
|
||||||
|
}
|
||||||
compile_templates()
|
compile_templates()
|
||||||
|
|
||||||
// Filler functions for now...
|
// Filler functions for now...
|
||||||
|
@ -127,6 +134,9 @@ func init_templates() {
|
||||||
fmap["divide"] = filler_func
|
fmap["divide"] = filler_func
|
||||||
|
|
||||||
// The interpreted templates...
|
// The interpreted templates...
|
||||||
|
if debug {
|
||||||
|
log.Print("Loading the template files...")
|
||||||
|
}
|
||||||
templates.Funcs(fmap)
|
templates.Funcs(fmap)
|
||||||
template.Must(templates.ParseGlob("templates/*"))
|
template.Must(templates.ParseGlob("templates/*"))
|
||||||
template.Must(templates.ParseGlob("pages/*"))
|
template.Must(templates.ParseGlob("pages/*"))
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// "log"
|
//"log"
|
||||||
// "fmt"
|
//"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -535,7 +535,7 @@ func route_profile_reply_delete_submit(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_ban(w http.ResponseWriter, r *http.Request) {
|
func route_ban(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -563,7 +563,7 @@ func route_ban(w http.ResponseWriter, r *http.Request) {
|
||||||
confirm_msg := "Are you sure you want to ban '" + uname + "'?"
|
confirm_msg := "Are you sure you want to ban '" + uname + "'?"
|
||||||
yousure := AreYouSure{"/users/ban/submit/" + strconv.Itoa(uid),confirm_msg}
|
yousure := AreYouSure{"/users/ban/submit/" + strconv.Itoa(uid),confirm_msg}
|
||||||
|
|
||||||
pi := Page{"Ban User",user,noticeList,tList,yousure}
|
pi := Page{"Ban User",user,headerVars,tList,yousure}
|
||||||
templates.ExecuteTemplate(w,"areyousure.html",pi)
|
templates.ExecuteTemplate(w,"areyousure.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
65
pages.go
65
pages.go
|
@ -1,16 +1,31 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
//import "fmt"
|
//import "fmt"
|
||||||
|
import "sync"
|
||||||
import "bytes"
|
import "bytes"
|
||||||
import "strings"
|
import "strings"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
import "regexp"
|
import "regexp"
|
||||||
import "html/template"
|
import "html/template"
|
||||||
|
|
||||||
|
type HeaderVars struct
|
||||||
|
{
|
||||||
|
NoticeList []string
|
||||||
|
Scripts []string
|
||||||
|
Stylesheets []string
|
||||||
|
}
|
||||||
|
|
||||||
|
type ExtData struct
|
||||||
|
{
|
||||||
|
items map[string]interface{} // Key: pluginname
|
||||||
|
sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
type Page struct
|
type Page struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ItemList []interface{}
|
ItemList []interface{}
|
||||||
Something interface{}
|
Something interface{}
|
||||||
}
|
}
|
||||||
|
@ -19,62 +34,62 @@ type TopicPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ItemList []Reply
|
ItemList []Reply
|
||||||
Topic TopicUser
|
Topic TopicUser
|
||||||
Page int
|
Page int
|
||||||
LastPage int
|
LastPage int
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type TopicsPage struct
|
type TopicsPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ItemList []TopicsRow
|
ItemList []TopicsRow
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type ForumPage struct
|
type ForumPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ItemList []TopicUser
|
ItemList []TopicUser
|
||||||
Forum Forum
|
Forum Forum
|
||||||
Page int
|
Page int
|
||||||
LastPage int
|
LastPage int
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type ForumsPage struct
|
type ForumsPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ItemList []Forum
|
ItemList []Forum
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProfilePage struct
|
type ProfilePage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ItemList []Reply
|
ItemList []Reply
|
||||||
ProfileOwner User
|
ProfileOwner User
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateTopicPage struct
|
type CreateTopicPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ItemList []Forum
|
ItemList []Forum
|
||||||
FID int
|
FID int
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type GridElement struct
|
type GridElement struct
|
||||||
|
@ -92,32 +107,32 @@ type PanelDashboardPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
GridItems []GridElement
|
GridItems []GridElement
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type ThemesPage struct
|
type ThemesPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
PrimaryThemes []Theme
|
PrimaryThemes []Theme
|
||||||
VariantThemes []Theme
|
VariantThemes []Theme
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type EditGroupPage struct
|
type EditGroupPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ID int
|
ID int
|
||||||
Name string
|
Name string
|
||||||
Tag string
|
Tag string
|
||||||
Rank string
|
Rank string
|
||||||
DisableRank bool
|
DisableRank bool
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupForumPermPreset struct
|
type GroupForumPermPreset struct
|
||||||
|
@ -130,14 +145,14 @@ type EditForumPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ID int
|
ID int
|
||||||
Name string
|
Name string
|
||||||
Desc string
|
Desc string
|
||||||
Active bool
|
Active bool
|
||||||
Preset string
|
Preset string
|
||||||
Groups []GroupForumPermPreset
|
Groups []GroupForumPermPreset
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type NameLangPair struct
|
type NameLangPair struct
|
||||||
|
@ -157,12 +172,12 @@ type EditGroupPermsPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
ID int
|
ID int
|
||||||
Name string
|
Name string
|
||||||
LocalPerms []NameLangToggle
|
LocalPerms []NameLangToggle
|
||||||
GlobalPerms []NameLangToggle
|
GlobalPerms []NameLangToggle
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type Log struct {
|
type Log struct {
|
||||||
|
@ -175,9 +190,9 @@ type LogsPage struct
|
||||||
{
|
{
|
||||||
Title string
|
Title string
|
||||||
CurrentUser User
|
CurrentUser User
|
||||||
NoticeList []string
|
Header HeaderVars
|
||||||
Logs []Log
|
Logs []Log
|
||||||
ExtData interface{}
|
ExtData ExtData
|
||||||
}
|
}
|
||||||
|
|
||||||
type PageSimple struct
|
type PageSimple struct
|
||||||
|
|
141
panel_routes.go
141
panel_routes.go
|
@ -20,14 +20,10 @@ import "github.com/shirou/gopsutil/cpu"
|
||||||
import "github.com/shirou/gopsutil/mem"
|
import "github.com/shirou/gopsutil/mem"
|
||||||
|
|
||||||
func route_panel(w http.ResponseWriter, r *http.Request){
|
func route_panel(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod {
|
|
||||||
NoPermissions(w,r,user)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var cpustr, cpuColour string
|
var cpustr, cpuColour string
|
||||||
perc2, err := cpu.Percent(time.Duration(time.Second),true)
|
perc2, err := cpu.Percent(time.Duration(time.Second),true)
|
||||||
|
@ -189,16 +185,16 @@ func route_panel(w http.ResponseWriter, r *http.Request){
|
||||||
gridElements = append(gridElements, GridElement{"dash-visitorsperweek","2 visitors / week",13,"grid_stat stat_disabled","","","Coming Soon!"/*"The number of unique visitors we've had over the last 7 days"*/})
|
gridElements = append(gridElements, GridElement{"dash-visitorsperweek","2 visitors / week",13,"grid_stat stat_disabled","","","Coming Soon!"/*"The number of unique visitors we've had over the last 7 days"*/})
|
||||||
gridElements = append(gridElements, GridElement{"dash-postsperuser","5 posts / user / week",14,"grid_stat stat_disabled","","","Coming Soon!"/*"The average number of posts made by each active user over the past week"*/})
|
gridElements = append(gridElements, GridElement{"dash-postsperuser","5 posts / user / week",14,"grid_stat stat_disabled","","","Coming Soon!"/*"The average number of posts made by each active user over the past week"*/})
|
||||||
|
|
||||||
pi := PanelDashboardPage{"Control Panel Dashboard",user,noticeList,gridElements,nil}
|
pi := PanelDashboardPage{"Control Panel Dashboard",user,headerVars,gridElements,extData}
|
||||||
templates.ExecuteTemplate(w,"panel-dashboard.html",pi)
|
templates.ExecuteTemplate(w,"panel-dashboard.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_forums(w http.ResponseWriter, r *http.Request){
|
func route_panel_forums(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManageForums {
|
if !user.Perms.ManageForums {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -213,7 +209,7 @@ func route_panel_forums(w http.ResponseWriter, r *http.Request){
|
||||||
forumList = append(forumList,fadmin)
|
forumList = append(forumList,fadmin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pi := Page{"Forum Manager",user,noticeList,forumList,nil}
|
pi := Page{"Forum Manager",user,headerVars,forumList,nil}
|
||||||
err := templates.ExecuteTemplate(w,"panel-forums.html",pi)
|
err := templates.ExecuteTemplate(w,"panel-forums.html",pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
|
@ -221,11 +217,11 @@ func route_panel_forums(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_forums_create_submit(w http.ResponseWriter, r *http.Request){
|
func route_panel_forums_create_submit(w http.ResponseWriter, r *http.Request){
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManageForums {
|
if !user.Perms.ManageForums {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -257,11 +253,11 @@ func route_panel_forums_create_submit(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_forums_delete(w http.ResponseWriter, r *http.Request, sfid string){
|
func route_panel_forums_delete(w http.ResponseWriter, r *http.Request, sfid string){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManageForums {
|
if !user.Perms.ManageForums {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -284,16 +280,16 @@ func route_panel_forums_delete(w http.ResponseWriter, r *http.Request, sfid stri
|
||||||
confirm_msg := "Are you sure you want to delete the '" + forums[fid].Name + "' forum?"
|
confirm_msg := "Are you sure you want to delete the '" + forums[fid].Name + "' forum?"
|
||||||
yousure := AreYouSure{"/panel/forums/delete/submit/" + strconv.Itoa(fid),confirm_msg}
|
yousure := AreYouSure{"/panel/forums/delete/submit/" + strconv.Itoa(fid),confirm_msg}
|
||||||
|
|
||||||
pi := Page{"Delete Forum",user,noticeList,tList,yousure}
|
pi := Page{"Delete Forum",user,headerVars,tList,yousure}
|
||||||
templates.ExecuteTemplate(w,"areyousure.html",pi)
|
templates.ExecuteTemplate(w,"areyousure.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_forums_delete_submit(w http.ResponseWriter, r *http.Request, sfid string) {
|
func route_panel_forums_delete_submit(w http.ResponseWriter, r *http.Request, sfid string) {
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManageForums {
|
if !user.Perms.ManageForums {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -321,11 +317,11 @@ func route_panel_forums_delete_submit(w http.ResponseWriter, r *http.Request, sf
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_forums_edit(w http.ResponseWriter, r *http.Request, sfid string) {
|
func route_panel_forums_edit(w http.ResponseWriter, r *http.Request, sfid string) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManageForums {
|
if !user.Perms.ManageForums {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -354,7 +350,7 @@ func route_panel_forums_edit(w http.ResponseWriter, r *http.Request, sfid string
|
||||||
gplist = append(gplist,GroupForumPermPreset{group,forum_perms_to_group_forum_preset(group.Forums[fid])})
|
gplist = append(gplist,GroupForumPermPreset{group,forum_perms_to_group_forum_preset(group.Forums[fid])})
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := EditForumPage{"Forum Editor",user,noticeList,forum.ID,forum.Name,forum.Desc,forum.Active,forum.Preset,gplist,nil}
|
pi := EditForumPage{"Forum Editor",user,headerVars,forum.ID,forum.Name,forum.Desc,forum.Active,forum.Preset,gplist,extData}
|
||||||
err = templates.ExecuteTemplate(w,"panel-forum-edit.html",pi)
|
err = templates.ExecuteTemplate(w,"panel-forum-edit.html",pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
|
@ -362,11 +358,11 @@ func route_panel_forums_edit(w http.ResponseWriter, r *http.Request, sfid string
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid string) {
|
func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid string) {
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManageForums {
|
if !user.Perms.ManageForums {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -442,11 +438,11 @@ func route_panel_forums_edit_submit(w http.ResponseWriter, r *http.Request, sfid
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_forums_edit_perms_submit(w http.ResponseWriter, r *http.Request, sfid string){
|
func route_panel_forums_edit_perms_submit(w http.ResponseWriter, r *http.Request, sfid string){
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManageForums {
|
if !user.Perms.ManageForums {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -512,11 +508,11 @@ func route_panel_forums_edit_perms_submit(w http.ResponseWriter, r *http.Request
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_settings(w http.ResponseWriter, r *http.Request){
|
func route_panel_settings(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditSettings {
|
if !user.Perms.EditSettings {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -561,16 +557,16 @@ func route_panel_settings(w http.ResponseWriter, r *http.Request){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := Page{"Setting Manager",user,noticeList,tList,settingList}
|
pi := Page{"Setting Manager",user,headerVars,tList,settingList}
|
||||||
templates.ExecuteTemplate(w,"panel-settings.html",pi)
|
templates.ExecuteTemplate(w,"panel-settings.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_setting(w http.ResponseWriter, r *http.Request, sname string){
|
func route_panel_setting(w http.ResponseWriter, r *http.Request, sname string){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditSettings {
|
if !user.Perms.EditSettings {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -609,16 +605,16 @@ func route_panel_setting(w http.ResponseWriter, r *http.Request, sname string){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := Page{"Edit Setting",user,noticeList,itemList,setting}
|
pi := Page{"Edit Setting",user,headerVars,itemList,setting}
|
||||||
templates.ExecuteTemplate(w,"panel-setting.html",pi)
|
templates.ExecuteTemplate(w,"panel-setting.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_setting_edit(w http.ResponseWriter, r *http.Request, sname string) {
|
func route_panel_setting_edit(w http.ResponseWriter, r *http.Request, sname string) {
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditSettings {
|
if !user.Perms.EditSettings {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -668,11 +664,11 @@ func route_panel_setting_edit(w http.ResponseWriter, r *http.Request, sname stri
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_plugins(w http.ResponseWriter, r *http.Request){
|
func route_panel_plugins(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManagePlugins {
|
if !user.Perms.ManagePlugins {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -682,16 +678,16 @@ func route_panel_plugins(w http.ResponseWriter, r *http.Request){
|
||||||
pluginList = append(pluginList,plugin)
|
pluginList = append(pluginList,plugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := Page{"Plugin Manager",user,noticeList,pluginList,nil}
|
pi := Page{"Plugin Manager",user,headerVars,pluginList,nil}
|
||||||
templates.ExecuteTemplate(w,"panel-plugins.html",pi)
|
templates.ExecuteTemplate(w,"panel-plugins.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_plugins_activate(w http.ResponseWriter, r *http.Request, uname string){
|
func route_panel_plugins_activate(w http.ResponseWriter, r *http.Request, uname string){
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManagePlugins {
|
if !user.Perms.ManagePlugins {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -748,11 +744,11 @@ func route_panel_plugins_activate(w http.ResponseWriter, r *http.Request, uname
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_plugins_deactivate(w http.ResponseWriter, r *http.Request, uname string){
|
func route_panel_plugins_deactivate(w http.ResponseWriter, r *http.Request, uname string){
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManagePlugins {
|
if !user.Perms.ManagePlugins {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -796,14 +792,10 @@ func route_panel_plugins_deactivate(w http.ResponseWriter, r *http.Request, unam
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_users(w http.ResponseWriter, r *http.Request){
|
func route_panel_users(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod {
|
|
||||||
NoPermissions(w,r,user)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var userList []interface{}
|
var userList []interface{}
|
||||||
rows, err := get_users_stmt.Query()
|
rows, err := get_users_stmt.Query()
|
||||||
|
@ -843,7 +835,7 @@ func route_panel_users(w http.ResponseWriter, r *http.Request){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := Page{"User Manager",user,noticeList,userList,nil}
|
pi := Page{"User Manager",user,headerVars,userList,nil}
|
||||||
err = templates.ExecuteTemplate(w,"panel-users.html",pi)
|
err = templates.ExecuteTemplate(w,"panel-users.html",pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
|
@ -851,13 +843,12 @@ func route_panel_users(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_users_edit(w http.ResponseWriter, r *http.Request,suid string){
|
func route_panel_users_edit(w http.ResponseWriter, r *http.Request,suid string){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
if !user.Perms.EditUser {
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditUser {
|
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -893,7 +884,7 @@ func route_panel_users_edit(w http.ResponseWriter, r *http.Request,suid string){
|
||||||
groupList = append(groupList,group)
|
groupList = append(groupList,group)
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := Page{"User Editor",user,noticeList,groupList,targetUser}
|
pi := Page{"User Editor",user,headerVars,groupList,targetUser}
|
||||||
err = templates.ExecuteTemplate(w,"panel-user-edit.html",pi)
|
err = templates.ExecuteTemplate(w,"panel-user-edit.html",pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
|
@ -901,11 +892,11 @@ func route_panel_users_edit(w http.ResponseWriter, r *http.Request,suid string){
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_users_edit_submit(w http.ResponseWriter, r *http.Request, suid string){
|
func route_panel_users_edit_submit(w http.ResponseWriter, r *http.Request, suid string){
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditUser {
|
if !user.Perms.EditUser {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -996,14 +987,10 @@ func route_panel_users_edit_submit(w http.ResponseWriter, r *http.Request, suid
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_groups(w http.ResponseWriter, r *http.Request){
|
func route_panel_groups(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod {
|
|
||||||
NoPermissions(w,r,user)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var groupList []interface{}
|
var groupList []interface{}
|
||||||
for _, group := range groups[1:] {
|
for _, group := range groups[1:] {
|
||||||
|
@ -1034,16 +1021,16 @@ func route_panel_groups(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
//fmt.Printf("%+v\n", groupList)
|
//fmt.Printf("%+v\n", groupList)
|
||||||
|
|
||||||
pi := Page{"Group Manager",user,noticeList,groupList,nil}
|
pi := Page{"Group Manager",user,headerVars,groupList,nil}
|
||||||
templates.ExecuteTemplate(w,"panel-groups.html",pi)
|
templates.ExecuteTemplate(w,"panel-groups.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_groups_edit(w http.ResponseWriter, r *http.Request, sgid string){
|
func route_panel_groups_edit(w http.ResponseWriter, r *http.Request, sgid string){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditGroup {
|
if !user.Perms.EditGroup {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1085,7 +1072,7 @@ func route_panel_groups_edit(w http.ResponseWriter, r *http.Request, sgid string
|
||||||
|
|
||||||
disable_rank := !user.Perms.EditGroupGlobalPerms || (group.ID == 6)
|
disable_rank := !user.Perms.EditGroupGlobalPerms || (group.ID == 6)
|
||||||
|
|
||||||
pi := EditGroupPage{"Group Editor",user,noticeList,group.ID,group.Name,group.Tag,rank,disable_rank,nil}
|
pi := EditGroupPage{"Group Editor",user,headerVars,group.ID,group.Name,group.Tag,rank,disable_rank,extData}
|
||||||
err = templates.ExecuteTemplate(w,"panel-group-edit.html",pi)
|
err = templates.ExecuteTemplate(w,"panel-group-edit.html",pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
|
@ -1093,11 +1080,11 @@ func route_panel_groups_edit(w http.ResponseWriter, r *http.Request, sgid string
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_groups_edit_perms(w http.ResponseWriter, r *http.Request, sgid string){
|
func route_panel_groups_edit_perms(w http.ResponseWriter, r *http.Request, sgid string){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditGroup {
|
if !user.Perms.EditGroup {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1158,7 +1145,7 @@ func route_panel_groups_edit_perms(w http.ResponseWriter, r *http.Request, sgid
|
||||||
globalPerms = append(globalPerms, NameLangToggle{"ViewAdminLogs",GetGlobalPermPhrase("ViewAdminLogs"),group.Perms.ViewAdminLogs})
|
globalPerms = append(globalPerms, NameLangToggle{"ViewAdminLogs",GetGlobalPermPhrase("ViewAdminLogs"),group.Perms.ViewAdminLogs})
|
||||||
globalPerms = append(globalPerms, NameLangToggle{"ViewIPs",GetGlobalPermPhrase("ViewIPs"),group.Perms.ViewIPs})
|
globalPerms = append(globalPerms, NameLangToggle{"ViewIPs",GetGlobalPermPhrase("ViewIPs"),group.Perms.ViewIPs})
|
||||||
|
|
||||||
pi := EditGroupPermsPage{"Group Editor",user,noticeList,group.ID,group.Name,localPerms,globalPerms,nil}
|
pi := EditGroupPermsPage{"Group Editor",user,headerVars,group.ID,group.Name,localPerms,globalPerms,extData}
|
||||||
err = templates.ExecuteTemplate(w,"panel-group-edit-perms.html",pi)
|
err = templates.ExecuteTemplate(w,"panel-group-edit-perms.html",pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
|
@ -1166,11 +1153,11 @@ func route_panel_groups_edit_perms(w http.ResponseWriter, r *http.Request, sgid
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_groups_edit_submit(w http.ResponseWriter, r *http.Request, sgid string){
|
func route_panel_groups_edit_submit(w http.ResponseWriter, r *http.Request, sgid string){
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditGroup {
|
if !user.Perms.EditGroup {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1298,11 +1285,11 @@ func route_panel_groups_edit_submit(w http.ResponseWriter, r *http.Request, sgid
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_groups_edit_perms_submit(w http.ResponseWriter, r *http.Request, sgid string){
|
func route_panel_groups_edit_perms_submit(w http.ResponseWriter, r *http.Request, sgid string){
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditGroup {
|
if !user.Perms.EditGroup {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1374,11 +1361,11 @@ func route_panel_groups_edit_perms_submit(w http.ResponseWriter, r *http.Request
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_groups_create_submit(w http.ResponseWriter, r *http.Request){
|
func route_panel_groups_create_submit(w http.ResponseWriter, r *http.Request){
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.EditGroup {
|
if !user.Perms.EditGroup {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1425,11 +1412,11 @@ func route_panel_groups_create_submit(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_themes(w http.ResponseWriter, r *http.Request){
|
func route_panel_themes(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManageThemes {
|
if !user.Perms.ManageThemes {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1447,7 +1434,7 @@ func route_panel_themes(w http.ResponseWriter, r *http.Request){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := ThemesPage{"Theme Manager",user,noticeList,pThemeList,vThemeList,nil}
|
pi := ThemesPage{"Theme Manager",user,headerVars,pThemeList,vThemeList,extData}
|
||||||
err := templates.ExecuteTemplate(w,"panel-themes.html",pi)
|
err := templates.ExecuteTemplate(w,"panel-themes.html",pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
|
@ -1455,11 +1442,11 @@ func route_panel_themes(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_themes_default(w http.ResponseWriter, r *http.Request, uname string){
|
func route_panel_themes_default(w http.ResponseWriter, r *http.Request, uname string){
|
||||||
user, ok := SimpleSessionCheck(w,r)
|
user, ok := SimplePanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod || !user.Perms.ManageThemes {
|
if !user.Perms.ManageThemes {
|
||||||
NoPermissions(w,r,user)
|
NoPermissions(w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1531,14 +1518,10 @@ func route_panel_themes_default(w http.ResponseWriter, r *http.Request, uname st
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_panel_logs_mod(w http.ResponseWriter, r *http.Request){
|
func route_panel_logs_mod(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := PanelSessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !user.Is_Super_Mod {
|
|
||||||
NoPermissions(w,r,user)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
rows, err := get_modlogs_stmt.Query()
|
rows, err := get_modlogs_stmt.Query()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1626,7 +1609,7 @@ func route_panel_logs_mod(w http.ResponseWriter, r *http.Request){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := LogsPage{"Moderation Logs",user,noticeList,logs,nil}
|
pi := LogsPage{"Moderation Logs",user,headerVars,logs,extData}
|
||||||
err = templates.ExecuteTemplate(w,"panel-modlogs.html",pi)
|
err = templates.ExecuteTemplate(w,"panel-modlogs.html",pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
|
|
|
@ -351,7 +351,11 @@ $(document).ready(function(){
|
||||||
document.getElementById("back").className += " alertActive"
|
document.getElementById("back").className += " alertActive"
|
||||||
});
|
});
|
||||||
|
|
||||||
this.onkeyup = function(event){
|
$("input,textarea,select,option").keyup(function(event){
|
||||||
|
event.stopPropagation();
|
||||||
|
})
|
||||||
|
|
||||||
|
this.onkeyup = function(event) {
|
||||||
if(event.which == 37) this.querySelectorAll("#prevFloat a")[0].click();
|
if(event.which == 37) this.querySelectorAll("#prevFloat a")[0].click();
|
||||||
if(event.which == 39) this.querySelectorAll("#nextFloat a")[0].click();
|
if(event.which == 39) this.querySelectorAll("#nextFloat a")[0].click();
|
||||||
};
|
};
|
||||||
|
|
|
@ -116,9 +116,9 @@ func write_selects(adapter qgen.DB_Adapter) error {
|
||||||
|
|
||||||
adapter.SimpleSelect("get_activity_entry","activity_stream","actor, targetUser, event, elementType, elementID","asid = ?","","")
|
adapter.SimpleSelect("get_activity_entry","activity_stream","actor, targetUser, event, elementType, elementID","asid = ?","","")
|
||||||
|
|
||||||
adapter.SimpleSelect("forum_entry_exists","forums","fid","name = ''","fid ASC","0,1") // Is '' empty?
|
adapter.SimpleSelect("forum_entry_exists","forums","fid","name = ''","fid ASC","0,1")
|
||||||
|
|
||||||
adapter.SimpleSelect("group_entry_exists","users_groups","gid","name = ''","gid ASC","0,1") // Is '' empty?
|
adapter.SimpleSelect("group_entry_exists","users_groups","gid","name = ''","gid ASC","0,1")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
110
routes.go
110
routes.go
|
@ -24,6 +24,8 @@ import "golang.org/x/crypto/bcrypt"
|
||||||
// A blank list to fill out that parameter in Page for routes which don't use it
|
// A blank list to fill out that parameter in Page for routes which don't use it
|
||||||
var tList []interface{}
|
var tList []interface{}
|
||||||
var nList []string
|
var nList []string
|
||||||
|
var hvars HeaderVars
|
||||||
|
var extData ExtData
|
||||||
var success_json_bytes []byte = []byte(`{"success":"1"}`)
|
var success_json_bytes []byte = []byte(`{"success":"1"}`)
|
||||||
|
|
||||||
// GET functions
|
// GET functions
|
||||||
|
@ -68,11 +70,11 @@ func route_fstatic(w http.ResponseWriter, r *http.Request){
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
func route_overview(w http.ResponseWriter, r *http.Request){
|
func route_overview(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pi := Page{"Overview",user,noticeList,tList,nil}
|
pi := Page{"Overview",user,headerVars,tList,nil}
|
||||||
err := templates.ExecuteTemplate(w,"overview.html",pi)
|
err := templates.ExecuteTemplate(w,"overview.html",pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
|
@ -80,7 +82,7 @@ func route_overview(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_custom_page(w http.ResponseWriter, r *http.Request){
|
func route_custom_page(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -90,14 +92,14 @@ func route_custom_page(w http.ResponseWriter, r *http.Request){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := templates.ExecuteTemplate(w,"page_" + name,Page{"Page",user,noticeList,tList,nil})
|
err := templates.ExecuteTemplate(w,"page_" + name,Page{"Page",user,headerVars,tList,nil})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_topics(w http.ResponseWriter, r *http.Request){
|
func route_topics(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -160,11 +162,15 @@ func route_topics(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
rows.Close()
|
rows.Close()
|
||||||
|
|
||||||
pi := TopicsPage{"Topic List",user,noticeList,topicList,nil}
|
pi := TopicsPage{"Topic List",user,headerVars,topicList,extData}
|
||||||
if template_topics_handle != nil {
|
if template_topics_handle != nil {
|
||||||
template_topics_handle(pi,w)
|
template_topics_handle(pi,w)
|
||||||
} else {
|
} else {
|
||||||
err = templates.ExecuteTemplate(w,"topics.html",pi)
|
mapping, ok := themes[defaultTheme].TemplatesMap["topic"]
|
||||||
|
if !ok {
|
||||||
|
mapping = "topic"
|
||||||
|
}
|
||||||
|
err = templates.ExecuteTemplate(w,mapping + ".html", pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
}
|
}
|
||||||
|
@ -179,7 +185,7 @@ func route_forum(w http.ResponseWriter, r *http.Request, sfid string){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user, noticeList, ok := ForumSessionCheck(w,r,fid)
|
user, headerVars, ok := ForumSessionCheck(w,r,fid)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -240,11 +246,15 @@ func route_forum(w http.ResponseWriter, r *http.Request, sfid string){
|
||||||
}
|
}
|
||||||
rows.Close()
|
rows.Close()
|
||||||
|
|
||||||
pi := ForumPage{forums[fid].Name,user,noticeList,topicList,forums[fid],page,last_page,nil}
|
pi := ForumPage{forums[fid].Name,user,headerVars,topicList,forums[fid],page,last_page,extData}
|
||||||
if template_forum_handle != nil {
|
if template_forum_handle != nil {
|
||||||
template_forum_handle(pi,w)
|
template_forum_handle(pi,w)
|
||||||
} else {
|
} else {
|
||||||
err = templates.ExecuteTemplate(w,"forum.html",pi)
|
mapping, ok := themes[defaultTheme].TemplatesMap["forum"]
|
||||||
|
if !ok {
|
||||||
|
mapping = "forum"
|
||||||
|
}
|
||||||
|
err = templates.ExecuteTemplate(w,mapping + ".html", pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
}
|
}
|
||||||
|
@ -252,7 +262,7 @@ func route_forum(w http.ResponseWriter, r *http.Request, sfid string){
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_forums(w http.ResponseWriter, r *http.Request){
|
func route_forums(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -278,11 +288,15 @@ func route_forums(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pi := ForumsPage{"Forum List",user,noticeList,forumList,nil}
|
pi := ForumsPage{"Forum List",user,headerVars,forumList,extData}
|
||||||
if template_forums_handle != nil {
|
if template_forums_handle != nil {
|
||||||
template_forums_handle(pi,w)
|
template_forums_handle(pi,w)
|
||||||
} else {
|
} else {
|
||||||
err := templates.ExecuteTemplate(w,"forums.html",pi)
|
mapping, ok := themes[defaultTheme].TemplatesMap["forums"]
|
||||||
|
if !ok {
|
||||||
|
mapping = "forums"
|
||||||
|
}
|
||||||
|
err = templates.ExecuteTemplate(w,mapping + ".html", pi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
}
|
}
|
||||||
|
@ -312,7 +326,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
topic.Css = no_css_tmpl
|
topic.Css = no_css_tmpl
|
||||||
|
|
||||||
user, noticeList, ok := ForumSessionCheck(w,r,topic.ParentID)
|
user, headerVars, ok := ForumSessionCheck(w,r,topic.ParentID)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -450,11 +464,15 @@ func route_topic_id(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
rows.Close()
|
rows.Close()
|
||||||
|
|
||||||
tpage := TopicPage{topic.Title,user,noticeList,replyList,topic,page,last_page,nil}
|
tpage := TopicPage{topic.Title,user,headerVars,replyList,topic,page,last_page,extData}
|
||||||
if template_topic_handle != nil {
|
if template_topic_handle != nil {
|
||||||
template_topic_handle(tpage,w)
|
template_topic_handle(tpage,w)
|
||||||
} else {
|
} else {
|
||||||
err = templates.ExecuteTemplate(w,"topic.html", tpage)
|
mapping, ok := themes[defaultTheme].TemplatesMap["topic"]
|
||||||
|
if !ok {
|
||||||
|
mapping = "topic"
|
||||||
|
}
|
||||||
|
err = templates.ExecuteTemplate(w,mapping + ".html", tpage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InternalError(err,w,r)
|
InternalError(err,w,r)
|
||||||
}
|
}
|
||||||
|
@ -462,7 +480,7 @@ func route_topic_id(w http.ResponseWriter, r *http.Request){
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_profile(w http.ResponseWriter, r *http.Request){
|
func route_profile(w http.ResponseWriter, r *http.Request){
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -543,7 +561,7 @@ func route_profile(w http.ResponseWriter, r *http.Request){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ppage := ProfilePage{puser.Name + "'s Profile",user,noticeList,replyList,*puser,false}
|
ppage := ProfilePage{puser.Name + "'s Profile",user,headerVars,replyList,*puser,extData}
|
||||||
if template_profile_handle != nil {
|
if template_profile_handle != nil {
|
||||||
template_profile_handle(ppage,w)
|
template_profile_handle(ppage,w)
|
||||||
} else {
|
} else {
|
||||||
|
@ -565,7 +583,7 @@ func route_topic_create(w http.ResponseWriter, r *http.Request, sfid string){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user, noticeList, ok := ForumSessionCheck(w,r,fid)
|
user, headerVars, ok := ForumSessionCheck(w,r,fid)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -582,7 +600,7 @@ func route_topic_create(w http.ResponseWriter, r *http.Request, sfid string){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctpage := CreateTopicPage{"Create Topic",user,noticeList,forumList,fid,nil}
|
ctpage := CreateTopicPage{"Create Topic",user,headerVars,forumList,fid,extData}
|
||||||
if template_create_topic_handle != nil {
|
if template_create_topic_handle != nil {
|
||||||
template_create_topic_handle(ctpage,w)
|
template_create_topic_handle(ctpage,w)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1151,7 +1169,7 @@ func route_report_submit(w http.ResponseWriter, r *http.Request, sitem_id string
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_account_own_edit_critical(w http.ResponseWriter, r *http.Request) {
|
func route_account_own_edit_critical(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1159,12 +1177,12 @@ func route_account_own_edit_critical(w http.ResponseWriter, r *http.Request) {
|
||||||
LocalError("You need to login to edit your account.",w,r,user)
|
LocalError("You need to login to edit your account.",w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pi := Page{"Edit Password",user,noticeList,tList,nil}
|
pi := Page{"Edit Password",user,headerVars,tList,nil}
|
||||||
templates.ExecuteTemplate(w,"account-own-edit.html", pi)
|
templates.ExecuteTemplate(w,"account-own-edit.html", pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_account_own_edit_critical_submit(w http.ResponseWriter, r *http.Request) {
|
func route_account_own_edit_critical_submit(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1222,13 +1240,13 @@ func route_account_own_edit_critical_submit(w http.ResponseWriter, r *http.Reque
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
noticeList = append(noticeList,"Your password was successfully updated")
|
headerVars.NoticeList = append(headerVars.NoticeList,"Your password was successfully updated")
|
||||||
pi := Page{"Edit Password",user,noticeList,tList,nil}
|
pi := Page{"Edit Password",user,headerVars,tList,nil}
|
||||||
templates.ExecuteTemplate(w,"account-own-edit.html", pi)
|
templates.ExecuteTemplate(w,"account-own-edit.html", pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_account_own_edit_avatar(w http.ResponseWriter, r *http.Request) {
|
func route_account_own_edit_avatar(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1236,7 +1254,7 @@ func route_account_own_edit_avatar(w http.ResponseWriter, r *http.Request) {
|
||||||
LocalError("You need to login to edit your account.",w,r,user)
|
LocalError("You need to login to edit your account.",w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pi := Page{"Edit Avatar",user,noticeList,tList,nil}
|
pi := Page{"Edit Avatar",user,headerVars,tList,nil}
|
||||||
templates.ExecuteTemplate(w,"account-own-edit-avatar.html",pi)
|
templates.ExecuteTemplate(w,"account-own-edit-avatar.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1247,7 +1265,7 @@ func route_account_own_edit_avatar_submit(w http.ResponseWriter, r *http.Request
|
||||||
}
|
}
|
||||||
r.Body = http.MaxBytesReader(w, r.Body, int64(max_request_size))
|
r.Body = http.MaxBytesReader(w, r.Body, int64(max_request_size))
|
||||||
|
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1328,13 +1346,13 @@ func route_account_own_edit_avatar_submit(w http.ResponseWriter, r *http.Request
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
noticeList = append(noticeList, "Your avatar was successfully updated")
|
headerVars.NoticeList = append(headerVars.NoticeList, "Your avatar was successfully updated")
|
||||||
pi := Page{"Edit Avatar",user,noticeList,tList,nil}
|
pi := Page{"Edit Avatar",user,headerVars,tList,nil}
|
||||||
templates.ExecuteTemplate(w,"account-own-edit-avatar.html", pi)
|
templates.ExecuteTemplate(w,"account-own-edit-avatar.html", pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_account_own_edit_username(w http.ResponseWriter, r *http.Request) {
|
func route_account_own_edit_username(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1342,12 +1360,12 @@ func route_account_own_edit_username(w http.ResponseWriter, r *http.Request) {
|
||||||
LocalError("You need to login to edit your account.",w,r,user)
|
LocalError("You need to login to edit your account.",w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pi := Page{"Edit Username",user,noticeList,tList,user.Name}
|
pi := Page{"Edit Username",user,headerVars,tList,user.Name}
|
||||||
templates.ExecuteTemplate(w,"account-own-edit-username.html",pi)
|
templates.ExecuteTemplate(w,"account-own-edit-username.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_account_own_edit_username_submit(w http.ResponseWriter, r *http.Request) {
|
func route_account_own_edit_username_submit(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1375,13 +1393,13 @@ func route_account_own_edit_username_submit(w http.ResponseWriter, r *http.Reque
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
noticeList = append(noticeList,"Your username was successfully updated")
|
headerVars.NoticeList = append(headerVars.NoticeList,"Your username was successfully updated")
|
||||||
pi := Page{"Edit Username",user,noticeList,tList,nil}
|
pi := Page{"Edit Username",user,headerVars,tList,nil}
|
||||||
templates.ExecuteTemplate(w,"account-own-edit-username.html", pi)
|
templates.ExecuteTemplate(w,"account-own-edit-username.html", pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_account_own_edit_email(w http.ResponseWriter, r *http.Request) {
|
func route_account_own_edit_email(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1424,14 +1442,14 @@ func route_account_own_edit_email(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !enable_emails {
|
if !enable_emails {
|
||||||
noticeList = append(noticeList,"The mail system is currently disabled.")
|
headerVars.NoticeList = append(headerVars.NoticeList,"The mail system is currently disabled.")
|
||||||
}
|
}
|
||||||
pi := Page{"Email Manager",user,noticeList,emailList,nil}
|
pi := Page{"Email Manager",user,headerVars,emailList,nil}
|
||||||
templates.ExecuteTemplate(w,"account-own-edit-email.html", pi)
|
templates.ExecuteTemplate(w,"account-own-edit-email.html", pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_account_own_edit_email_token_submit(w http.ResponseWriter, r *http.Request) {
|
func route_account_own_edit_email_token_submit(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1497,10 +1515,10 @@ func route_account_own_edit_email_token_submit(w http.ResponseWriter, r *http.Re
|
||||||
}
|
}
|
||||||
|
|
||||||
if !enable_emails {
|
if !enable_emails {
|
||||||
noticeList = append(noticeList,"The mail system is currently disabled.")
|
headerVars.NoticeList = append(headerVars.NoticeList,"The mail system is currently disabled.")
|
||||||
}
|
}
|
||||||
noticeList = append(noticeList,"Your email was successfully verified")
|
headerVars.NoticeList = append(headerVars.NoticeList,"Your email was successfully verified")
|
||||||
pi := Page{"Email Manager",user,noticeList,emailList,nil}
|
pi := Page{"Email Manager",user,headerVars,emailList,nil}
|
||||||
templates.ExecuteTemplate(w,"account-own-edit-email.html", pi)
|
templates.ExecuteTemplate(w,"account-own-edit-email.html", pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1529,7 +1547,7 @@ func route_logout(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_login(w http.ResponseWriter, r *http.Request) {
|
func route_login(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1537,7 +1555,7 @@ func route_login(w http.ResponseWriter, r *http.Request) {
|
||||||
LocalError("You're already logged in.",w,r,user)
|
LocalError("You're already logged in.",w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pi := Page{"Login",user,noticeList,tList,nil}
|
pi := Page{"Login",user,headerVars,tList,nil}
|
||||||
templates.ExecuteTemplate(w,"login.html",pi)
|
templates.ExecuteTemplate(w,"login.html",pi)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1633,7 +1651,7 @@ func route_login_submit(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_register(w http.ResponseWriter, r *http.Request) {
|
func route_register(w http.ResponseWriter, r *http.Request) {
|
||||||
user, noticeList, ok := SessionCheck(w,r)
|
user, headerVars, ok := SessionCheck(w,r)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1641,7 +1659,7 @@ func route_register(w http.ResponseWriter, r *http.Request) {
|
||||||
LocalError("You're already logged in.",w,r,user)
|
LocalError("You're already logged in.",w,r,user)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
templates.ExecuteTemplate(w,"register.html",Page{"Registration",user,noticeList,tList,nil})
|
templates.ExecuteTemplate(w,"register.html",Page{"Registration",user,headerVars,tList,nil})
|
||||||
}
|
}
|
||||||
|
|
||||||
func route_register_submit(w http.ResponseWriter, r *http.Request) {
|
func route_register_submit(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
1
run.bat
1
run.bat
|
@ -6,7 +6,6 @@ if %errorlevel% neq 0 (
|
||||||
exit /b %errorlevel%
|
exit /b %errorlevel%
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
echo Building the router generator
|
echo Building the router generator
|
||||||
go build ./router_gen
|
go build ./router_gen
|
||||||
if %errorlevel% neq 0 (
|
if %errorlevel% neq 0 (
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Code generated by. DO NOT EDIT.
|
// 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. */
|
||||||
|
// +build !no_templategen
|
||||||
package main
|
package main
|
||||||
import "io"
|
import "io"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
@ -16,8 +17,24 @@ func template_forum(tmpl_forum_vars ForumPage, w io.Writer) {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_forum_vars.Title))
|
w.Write([]byte(tmpl_forum_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
w.Write([]byte(tmpl_forum_vars.CurrentUser.Session))
|
if len(tmpl_forum_vars.Header.Stylesheets) != 0 {
|
||||||
|
for _, item := range tmpl_forum_vars.Header.Stylesheets {
|
||||||
w.Write(header_2)
|
w.Write(header_2)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_4)
|
||||||
|
if len(tmpl_forum_vars.Header.Scripts) != 0 {
|
||||||
|
for _, item := range tmpl_forum_vars.Header.Scripts {
|
||||||
|
w.Write(header_5)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_7)
|
||||||
|
w.Write([]byte(tmpl_forum_vars.CurrentUser.Session))
|
||||||
|
w.Write(header_8)
|
||||||
w.Write(menu_0)
|
w.Write(menu_0)
|
||||||
if tmpl_forum_vars.CurrentUser.Loggedin {
|
if tmpl_forum_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_1)
|
w.Write(menu_1)
|
||||||
|
@ -33,12 +50,12 @@ w.Write(menu_5)
|
||||||
w.Write(menu_6)
|
w.Write(menu_6)
|
||||||
}
|
}
|
||||||
w.Write(menu_7)
|
w.Write(menu_7)
|
||||||
w.Write(header_3)
|
w.Write(header_9)
|
||||||
if len(tmpl_forum_vars.NoticeList) != 0 {
|
if len(tmpl_forum_vars.Header.NoticeList) != 0 {
|
||||||
for _, item := range tmpl_forum_vars.NoticeList {
|
for _, item := range tmpl_forum_vars.Header.NoticeList {
|
||||||
w.Write(header_4)
|
w.Write(header_10)
|
||||||
w.Write([]byte(item))
|
w.Write([]byte(item))
|
||||||
w.Write(header_5)
|
w.Write(header_11)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if tmpl_forum_vars.Page > 1 {
|
if tmpl_forum_vars.Page > 1 {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
// Code generated by. DO NOT EDIT.
|
// 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. */
|
||||||
|
// +build !no_templategen
|
||||||
package main
|
package main
|
||||||
import "strconv"
|
|
||||||
import "io"
|
import "io"
|
||||||
|
import "strconv"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
template_forums_handle = template_forums
|
template_forums_handle = template_forums
|
||||||
|
@ -16,8 +17,24 @@ func template_forums(tmpl_forums_vars ForumsPage, w io.Writer) {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_forums_vars.Title))
|
w.Write([]byte(tmpl_forums_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
w.Write([]byte(tmpl_forums_vars.CurrentUser.Session))
|
if len(tmpl_forums_vars.Header.Stylesheets) != 0 {
|
||||||
|
for _, item := range tmpl_forums_vars.Header.Stylesheets {
|
||||||
w.Write(header_2)
|
w.Write(header_2)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_4)
|
||||||
|
if len(tmpl_forums_vars.Header.Scripts) != 0 {
|
||||||
|
for _, item := range tmpl_forums_vars.Header.Scripts {
|
||||||
|
w.Write(header_5)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_7)
|
||||||
|
w.Write([]byte(tmpl_forums_vars.CurrentUser.Session))
|
||||||
|
w.Write(header_8)
|
||||||
w.Write(menu_0)
|
w.Write(menu_0)
|
||||||
if tmpl_forums_vars.CurrentUser.Loggedin {
|
if tmpl_forums_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_1)
|
w.Write(menu_1)
|
||||||
|
@ -33,12 +50,12 @@ w.Write(menu_5)
|
||||||
w.Write(menu_6)
|
w.Write(menu_6)
|
||||||
}
|
}
|
||||||
w.Write(menu_7)
|
w.Write(menu_7)
|
||||||
w.Write(header_3)
|
w.Write(header_9)
|
||||||
if len(tmpl_forums_vars.NoticeList) != 0 {
|
if len(tmpl_forums_vars.Header.NoticeList) != 0 {
|
||||||
for _, item := range tmpl_forums_vars.NoticeList {
|
for _, item := range tmpl_forums_vars.Header.NoticeList {
|
||||||
w.Write(header_4)
|
w.Write(header_10)
|
||||||
w.Write([]byte(item))
|
w.Write([]byte(item))
|
||||||
w.Write(header_5)
|
w.Write(header_11)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Write(forums_0)
|
w.Write(forums_0)
|
||||||
|
|
|
@ -6,9 +6,21 @@ var header_0 []byte = []byte(`<!doctype html>
|
||||||
<title>`)
|
<title>`)
|
||||||
var header_1 []byte = []byte(`</title>
|
var header_1 []byte = []byte(`</title>
|
||||||
<link href="/static/main.css" rel="stylesheet" type="text/css">
|
<link href="/static/main.css" rel="stylesheet" type="text/css">
|
||||||
|
`)
|
||||||
|
var header_2 []byte = []byte(`
|
||||||
|
<link href="/static/`)
|
||||||
|
var header_3 []byte = []byte(`.css" rel="stylesheet" type="text/css">
|
||||||
|
`)
|
||||||
|
var header_4 []byte = []byte(`
|
||||||
<script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script>
|
<script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script>
|
||||||
|
`)
|
||||||
|
var header_5 []byte = []byte(`
|
||||||
|
<script type="text/javascript" src="/static/`)
|
||||||
|
var header_6 []byte = []byte(`.js"></script>
|
||||||
|
`)
|
||||||
|
var header_7 []byte = []byte(`
|
||||||
<script type="text/javascript">var session = "`)
|
<script type="text/javascript">var session = "`)
|
||||||
var header_2 []byte = []byte(`";
|
var header_8 []byte = []byte(`";
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/static/global.js"></script>
|
<script type="text/javascript" src="/static/global.js"></script>
|
||||||
<meta name="viewport" content="width=device-width,initial-scale = 1.0, maximum-scale=1.0,user-scalable=no" />
|
<meta name="viewport" content="width=device-width,initial-scale = 1.0, maximum-scale=1.0,user-scalable=no" />
|
||||||
|
@ -51,11 +63,11 @@ var menu_7 []byte = []byte(`
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
var header_3 []byte = []byte(`
|
var header_9 []byte = []byte(`
|
||||||
<div id="back"><div id="main">
|
<div id="back"><div id="main">
|
||||||
`)
|
`)
|
||||||
var header_4 []byte = []byte(`<div class="alert">`)
|
var header_10 []byte = []byte(`<div class="alert">`)
|
||||||
var header_5 []byte = []byte(`</div>`)
|
var header_11 []byte = []byte(`</div>`)
|
||||||
var topic_0 []byte = []byte(`<div id="prevFloat" class="prev_button"><a class="prev_link" href="/topic/`)
|
var topic_0 []byte = []byte(`<div id="prevFloat" class="prev_button"><a class="prev_link" href="/topic/`)
|
||||||
var topic_1 []byte = []byte(`?page=`)
|
var topic_1 []byte = []byte(`?page=`)
|
||||||
var topic_2 []byte = []byte(`"><</a></div>`)
|
var topic_2 []byte = []byte(`"><</a></div>`)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Code generated by. DO NOT EDIT.
|
// 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. */
|
||||||
|
// +build !no_templategen
|
||||||
package main
|
package main
|
||||||
import "strconv"
|
import "strconv"
|
||||||
import "io"
|
import "io"
|
||||||
|
@ -16,8 +17,24 @@ func template_profile(tmpl_profile_vars ProfilePage, w io.Writer) {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_profile_vars.Title))
|
w.Write([]byte(tmpl_profile_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
if len(tmpl_profile_vars.Header.Stylesheets) != 0 {
|
||||||
|
for _, item := range tmpl_profile_vars.Header.Stylesheets {
|
||||||
w.Write(header_2)
|
w.Write(header_2)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_4)
|
||||||
|
if len(tmpl_profile_vars.Header.Scripts) != 0 {
|
||||||
|
for _, item := range tmpl_profile_vars.Header.Scripts {
|
||||||
|
w.Write(header_5)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_7)
|
||||||
|
w.Write([]byte(tmpl_profile_vars.CurrentUser.Session))
|
||||||
|
w.Write(header_8)
|
||||||
w.Write(menu_0)
|
w.Write(menu_0)
|
||||||
if tmpl_profile_vars.CurrentUser.Loggedin {
|
if tmpl_profile_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_1)
|
w.Write(menu_1)
|
||||||
|
@ -33,12 +50,12 @@ w.Write(menu_5)
|
||||||
w.Write(menu_6)
|
w.Write(menu_6)
|
||||||
}
|
}
|
||||||
w.Write(menu_7)
|
w.Write(menu_7)
|
||||||
w.Write(header_3)
|
w.Write(header_9)
|
||||||
if len(tmpl_profile_vars.NoticeList) != 0 {
|
if len(tmpl_profile_vars.Header.NoticeList) != 0 {
|
||||||
for _, item := range tmpl_profile_vars.NoticeList {
|
for _, item := range tmpl_profile_vars.Header.NoticeList {
|
||||||
w.Write(header_4)
|
w.Write(header_10)
|
||||||
w.Write([]byte(item))
|
w.Write([]byte(item))
|
||||||
w.Write(header_5)
|
w.Write(header_11)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Write(profile_0)
|
w.Write(profile_0)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Code generated by. DO NOT EDIT.
|
// 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. */
|
||||||
|
// +build !no_templategen
|
||||||
package main
|
package main
|
||||||
import "io"
|
import "io"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
@ -16,8 +17,24 @@ func template_topic(tmpl_topic_vars TopicPage, w io.Writer) {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_topic_vars.Title))
|
w.Write([]byte(tmpl_topic_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
if len(tmpl_topic_vars.Header.Stylesheets) != 0 {
|
||||||
|
for _, item := range tmpl_topic_vars.Header.Stylesheets {
|
||||||
w.Write(header_2)
|
w.Write(header_2)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_4)
|
||||||
|
if len(tmpl_topic_vars.Header.Scripts) != 0 {
|
||||||
|
for _, item := range tmpl_topic_vars.Header.Scripts {
|
||||||
|
w.Write(header_5)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_7)
|
||||||
|
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
|
||||||
|
w.Write(header_8)
|
||||||
w.Write(menu_0)
|
w.Write(menu_0)
|
||||||
if tmpl_topic_vars.CurrentUser.Loggedin {
|
if tmpl_topic_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_1)
|
w.Write(menu_1)
|
||||||
|
@ -33,12 +50,12 @@ w.Write(menu_5)
|
||||||
w.Write(menu_6)
|
w.Write(menu_6)
|
||||||
}
|
}
|
||||||
w.Write(menu_7)
|
w.Write(menu_7)
|
||||||
w.Write(header_3)
|
w.Write(header_9)
|
||||||
if len(tmpl_topic_vars.NoticeList) != 0 {
|
if len(tmpl_topic_vars.Header.NoticeList) != 0 {
|
||||||
for _, item := range tmpl_topic_vars.NoticeList {
|
for _, item := range tmpl_topic_vars.Header.NoticeList {
|
||||||
w.Write(header_4)
|
w.Write(header_10)
|
||||||
w.Write([]byte(item))
|
w.Write([]byte(item))
|
||||||
w.Write(header_5)
|
w.Write(header_11)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if tmpl_topic_vars.Page > 1 {
|
if tmpl_topic_vars.Page > 1 {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Code generated by. DO NOT EDIT.
|
// 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. */
|
||||||
|
// +build !no_templategen
|
||||||
package main
|
package main
|
||||||
import "io"
|
import "io"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
@ -16,8 +17,24 @@ func template_topic_alt(tmpl_topic_alt_vars TopicPage, w io.Writer) {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Title))
|
w.Write([]byte(tmpl_topic_alt_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
if len(tmpl_topic_alt_vars.Header.Stylesheets) != 0 {
|
||||||
|
for _, item := range tmpl_topic_alt_vars.Header.Stylesheets {
|
||||||
w.Write(header_2)
|
w.Write(header_2)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_4)
|
||||||
|
if len(tmpl_topic_alt_vars.Header.Scripts) != 0 {
|
||||||
|
for _, item := range tmpl_topic_alt_vars.Header.Scripts {
|
||||||
|
w.Write(header_5)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_7)
|
||||||
|
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
|
||||||
|
w.Write(header_8)
|
||||||
w.Write(menu_0)
|
w.Write(menu_0)
|
||||||
if tmpl_topic_alt_vars.CurrentUser.Loggedin {
|
if tmpl_topic_alt_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_1)
|
w.Write(menu_1)
|
||||||
|
@ -33,12 +50,12 @@ w.Write(menu_5)
|
||||||
w.Write(menu_6)
|
w.Write(menu_6)
|
||||||
}
|
}
|
||||||
w.Write(menu_7)
|
w.Write(menu_7)
|
||||||
w.Write(header_3)
|
w.Write(header_9)
|
||||||
if len(tmpl_topic_alt_vars.NoticeList) != 0 {
|
if len(tmpl_topic_alt_vars.Header.NoticeList) != 0 {
|
||||||
for _, item := range tmpl_topic_alt_vars.NoticeList {
|
for _, item := range tmpl_topic_alt_vars.Header.NoticeList {
|
||||||
w.Write(header_4)
|
w.Write(header_10)
|
||||||
w.Write([]byte(item))
|
w.Write([]byte(item))
|
||||||
w.Write(header_5)
|
w.Write(header_11)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if tmpl_topic_alt_vars.Page > 1 {
|
if tmpl_topic_alt_vars.Page > 1 {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Code generated by. DO NOT EDIT.
|
// 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. */
|
||||||
|
// +build !no_templategen
|
||||||
package main
|
package main
|
||||||
import "io"
|
import "io"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
|
@ -16,8 +17,24 @@ func template_topics(tmpl_topics_vars TopicsPage, w io.Writer) {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_topics_vars.Title))
|
w.Write([]byte(tmpl_topics_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
w.Write([]byte(tmpl_topics_vars.CurrentUser.Session))
|
if len(tmpl_topics_vars.Header.Stylesheets) != 0 {
|
||||||
|
for _, item := range tmpl_topics_vars.Header.Stylesheets {
|
||||||
w.Write(header_2)
|
w.Write(header_2)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_4)
|
||||||
|
if len(tmpl_topics_vars.Header.Scripts) != 0 {
|
||||||
|
for _, item := range tmpl_topics_vars.Header.Scripts {
|
||||||
|
w.Write(header_5)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_7)
|
||||||
|
w.Write([]byte(tmpl_topics_vars.CurrentUser.Session))
|
||||||
|
w.Write(header_8)
|
||||||
w.Write(menu_0)
|
w.Write(menu_0)
|
||||||
if tmpl_topics_vars.CurrentUser.Loggedin {
|
if tmpl_topics_vars.CurrentUser.Loggedin {
|
||||||
w.Write(menu_1)
|
w.Write(menu_1)
|
||||||
|
@ -33,12 +50,12 @@ w.Write(menu_5)
|
||||||
w.Write(menu_6)
|
w.Write(menu_6)
|
||||||
}
|
}
|
||||||
w.Write(menu_7)
|
w.Write(menu_7)
|
||||||
w.Write(header_3)
|
w.Write(header_9)
|
||||||
if len(tmpl_topics_vars.NoticeList) != 0 {
|
if len(tmpl_topics_vars.Header.NoticeList) != 0 {
|
||||||
for _, item := range tmpl_topics_vars.NoticeList {
|
for _, item := range tmpl_topics_vars.Header.NoticeList {
|
||||||
w.Write(header_4)
|
w.Write(header_10)
|
||||||
w.Write([]byte(item))
|
w.Write([]byte(item))
|
||||||
w.Write(header_5)
|
w.Write(header_11)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Write(topics_0)
|
w.Write(topics_0)
|
||||||
|
|
157
templates.go
157
templates.go
|
@ -75,7 +75,7 @@ func (c *CTemplateSet) compile_template(name string, dir string, expects string,
|
||||||
"multiply": true,
|
"multiply": true,
|
||||||
"divide": true,
|
"divide": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
c.importMap = map[string]string{
|
c.importMap = map[string]string{
|
||||||
"io":"io",
|
"io":"io",
|
||||||
"strconv":"strconv",
|
"strconv":"strconv",
|
||||||
|
@ -86,17 +86,17 @@ func (c *CTemplateSet) compile_template(name string, dir string, expects string,
|
||||||
c.stats = make(map[string]int)
|
c.stats = make(map[string]int)
|
||||||
c.expectsInt = expectsInt
|
c.expectsInt = expectsInt
|
||||||
holdreflect := reflect.ValueOf(expectsInt)
|
holdreflect := reflect.ValueOf(expectsInt)
|
||||||
|
|
||||||
res, err := ioutil.ReadFile(dir + name)
|
res, err := ioutil.ReadFile(dir + name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
content := string(res)
|
content := string(res)
|
||||||
if minify_templates {
|
if minify_templates {
|
||||||
content = minify(content)
|
content = minify(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
tree := parse.New(name, c.funcMap)
|
tree := parse.New(name, c.funcMap)
|
||||||
var treeSet map[string]*parse.Tree = make(map[string]*parse.Tree)
|
var treeSet map[string]*parse.Tree = make(map[string]*parse.Tree)
|
||||||
tree, err = tree.Parse(content,"{{","}}", treeSet, c.funcMap)
|
tree, err = tree.Parse(content,"{{","}}", treeSet, c.funcMap)
|
||||||
|
@ -106,13 +106,13 @@ func (c *CTemplateSet) compile_template(name string, dir string, expects string,
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println(name)
|
fmt.Println(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
out = ""
|
out = ""
|
||||||
fname := strings.TrimSuffix(name, filepath.Ext(name))
|
fname := strings.TrimSuffix(name, filepath.Ext(name))
|
||||||
c.tlist = make(map[string]*parse.Tree)
|
c.tlist = make(map[string]*parse.Tree)
|
||||||
c.tlist[fname] = tree
|
c.tlist[fname] = tree
|
||||||
varholder := "tmpl_" + fname + "_vars"
|
varholder := "tmpl_" + fname + "_vars"
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println(c.tlist)
|
fmt.Println(c.tlist)
|
||||||
}
|
}
|
||||||
|
@ -124,18 +124,18 @@ func (c *CTemplateSet) compile_template(name string, dir string, expects string,
|
||||||
}
|
}
|
||||||
c.FragmentCursor = make(map[string]int)
|
c.FragmentCursor = make(map[string]int)
|
||||||
c.FragmentCursor[fname] = 0
|
c.FragmentCursor[fname] = 0
|
||||||
|
|
||||||
subtree := c.tlist[fname]
|
subtree := c.tlist[fname]
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println(subtree.Root)
|
fmt.Println(subtree.Root)
|
||||||
}
|
}
|
||||||
|
|
||||||
treeLength := len(subtree.Root.Nodes)
|
treeLength := len(subtree.Root.Nodes)
|
||||||
for index, node := range subtree.Root.Nodes {
|
for index, node := range subtree.Root.Nodes {
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Node: " + node.String())
|
fmt.Println("Node: " + node.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
c.previousNode = c.currentNode
|
c.previousNode = c.currentNode
|
||||||
c.currentNode = node.Type()
|
c.currentNode = node.Type()
|
||||||
if treeLength != (index + 1) {
|
if treeLength != (index + 1) {
|
||||||
|
@ -143,38 +143,38 @@ func (c *CTemplateSet) compile_template(name string, dir string, expects string,
|
||||||
}
|
}
|
||||||
out += c.compile_switch(varholder, holdreflect, fname, node)
|
out += c.compile_switch(varholder, holdreflect, fname, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
var importList string
|
var importList string
|
||||||
if c.doImports {
|
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 {
|
||||||
varString += "var " + varItem.Name + " " + varItem.Type + " = " + varItem.Destination + "\n"
|
varString += "var " + varItem.Name + " " + varItem.Type + " = " + varItem.Destination + "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
fout := "// Code generated by. DO NOT EDIT.\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 := "// 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 main\n" + importList + c.pVarList + "\n"
|
fout += "// +build !no_templategen\npackage main\n" + importList + c.pVarList + "\n"
|
||||||
fout += "func init() {\n\ttemplate_" + fname +"_handle = template_" + fname + "\n\t//o_template_" + fname +"_handle = template_" + fname + "\n\tctemplates = append(ctemplates,\"" + fname + "\")\n\ttmpl_ptr_map[\"" + fname + "\"] = &template_" + fname + "_handle\n\ttmpl_ptr_map[\"o_" + fname + "\"] = template_" + fname + "\n}\n\n"
|
fout += "func init() {\n\ttemplate_" + fname +"_handle = template_" + fname + "\n\t//o_template_" + fname +"_handle = template_" + fname + "\n\tctemplates = append(ctemplates,\"" + fname + "\")\n\ttmpl_ptr_map[\"" + fname + "\"] = &template_" + fname + "_handle\n\ttmpl_ptr_map[\"o_" + fname + "\"] = template_" + fname + "\n}\n\n"
|
||||||
fout += "func template_" + fname + "(tmpl_" + fname + "_vars " + expects + ", w io.Writer) {\n" + varString + out + "}\n"
|
fout += "func template_" + fname + "(tmpl_" + fname + "_vars " + expects + ", w io.Writer) {\n" + varString + out + "}\n"
|
||||||
|
|
||||||
fout = strings.Replace(fout,`))
|
fout = strings.Replace(fout,`))
|
||||||
w.Write([]byte(`," + ",-1)
|
w.Write([]byte(`," + ",-1)
|
||||||
fout = strings.Replace(fout,"` + `","",-1)
|
fout = strings.Replace(fout,"` + `","",-1)
|
||||||
//spstr := "`([:space:]*)`"
|
//spstr := "`([:space:]*)`"
|
||||||
//whitespace_writes := regexp.MustCompile(`(?s)w.Write\(\[\]byte\(`+spstr+`\)\)`)
|
//whitespace_writes := regexp.MustCompile(`(?s)w.Write\(\[\]byte\(`+spstr+`\)\)`)
|
||||||
//fout = whitespace_writes.ReplaceAllString(fout,"")
|
//fout = whitespace_writes.ReplaceAllString(fout,"")
|
||||||
|
|
||||||
if debug {
|
if debug {
|
||||||
for index, count := range c.stats {
|
for index, count := range c.stats {
|
||||||
fmt.Println(index + ": " + strconv.Itoa(count))
|
fmt.Println(index + ": " + strconv.Itoa(count))
|
||||||
}
|
}
|
||||||
fmt.Println(" ")
|
fmt.Println(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Output!")
|
fmt.Println("Output!")
|
||||||
fmt.Println(fout)
|
fmt.Println(fout)
|
||||||
|
@ -203,7 +203,7 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
|
||||||
fmt.Println("If Node:")
|
fmt.Println("If Node:")
|
||||||
fmt.Println("node.Pipe",node.Pipe)
|
fmt.Println("node.Pipe",node.Pipe)
|
||||||
}
|
}
|
||||||
|
|
||||||
var expr string
|
var expr string
|
||||||
for _, cmd := range node.Pipe.Cmds {
|
for _, cmd := range node.Pipe.Cmds {
|
||||||
if super_debug {
|
if super_debug {
|
||||||
|
@ -215,11 +215,11 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
|
||||||
fmt.Println("If Node Expression Step:",c.compile_varswitch(varholder, holdreflect, template_name, cmd))
|
fmt.Println("If Node Expression Step:",c.compile_varswitch(varholder, holdreflect, template_name, cmd))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("If Node Expression:",expr)
|
fmt.Println("If Node Expression:",expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.previousNode = c.currentNode
|
c.previousNode = c.currentNode
|
||||||
c.currentNode = parse.NodeList
|
c.currentNode = parse.NodeList
|
||||||
c.nextNode = -1
|
c.nextNode = -1
|
||||||
|
@ -247,7 +247,7 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
|
||||||
fmt.Println("Range Node!")
|
fmt.Println("Range Node!")
|
||||||
fmt.Println(node.Pipe)
|
fmt.Println(node.Pipe)
|
||||||
}
|
}
|
||||||
|
|
||||||
var outVal reflect.Value
|
var outVal reflect.Value
|
||||||
for _, cmd := range node.Pipe.Cmds {
|
for _, cmd := range node.Pipe.Cmds {
|
||||||
if super_debug {
|
if super_debug {
|
||||||
|
@ -255,19 +255,19 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
|
||||||
}
|
}
|
||||||
out, outVal = c.compile_reflectswitch(varholder, holdreflect, template_name, cmd)
|
out, outVal = c.compile_reflectswitch(varholder, holdreflect, template_name, cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Returned:",out)
|
fmt.Println("Returned:",out)
|
||||||
fmt.Println("Range Kind Switch!")
|
fmt.Println("Range Kind Switch!")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch outVal.Kind() {
|
switch outVal.Kind() {
|
||||||
case reflect.Map:
|
case reflect.Map:
|
||||||
var item reflect.Value
|
var item reflect.Value
|
||||||
for _, key := range outVal.MapKeys() {
|
for _, key := range outVal.MapKeys() {
|
||||||
item = outVal.MapIndex(key)
|
item = outVal.MapIndex(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.ElseList != nil {
|
if node.ElseList != nil {
|
||||||
out = "if len(" + out + ") != 0 {\nfor _, item := range " + out + " {\n" + c.compile_switch("item", item, template_name, node.List) + "}\n} else {\n" + c.compile_switch("item", item, template_name, node.ElseList) + "}\n"
|
out = "if len(" + out + ") != 0 {\nfor _, item := range " + out + " {\n" + c.compile_switch("item", item, template_name, node.List) + "}\n} else {\n" + c.compile_switch("item", item, template_name, node.ElseList) + "}\n"
|
||||||
} else {
|
} else {
|
||||||
|
@ -275,12 +275,11 @@ func (c *CTemplateSet) compile_switch(varholder string, holdreflect reflect.Valu
|
||||||
}
|
}
|
||||||
case reflect.Slice:
|
case reflect.Slice:
|
||||||
item := outVal.Index(0)
|
item := outVal.Index(0)
|
||||||
|
|
||||||
out = "if len(" + out + ") != 0 {\nfor _, item := range " + out + " {\n" + c.compile_switch("item", item, template_name, node.List) + "}\n}"
|
out = "if len(" + out + ") != 0 {\nfor _, item := range " + out + " {\n" + c.compile_switch("item", item, template_name, node.List) + "}\n}"
|
||||||
case reflect.Invalid:
|
case reflect.Invalid:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.ElseList != nil {
|
if node.ElseList != nil {
|
||||||
out += " else {\n" + c.compile_switch(varholder, holdreflect, template_name, node.ElseList) + "}\n"
|
out += " else {\n" + c.compile_switch(varholder, holdreflect, template_name, node.ElseList) + "}\n"
|
||||||
} else {
|
} else {
|
||||||
|
@ -323,22 +322,22 @@ func (c *CTemplateSet) compile_subswitch(varholder string, holdreflect reflect.V
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Field Node:",n.Ident)
|
fmt.Println("Field Node:",n.Ident)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use reflect to determine if the field is for a method, otherwise assume it's a variable. Coming Soon. */
|
/* Use reflect to determine if the field is for a method, otherwise assume it's a variable. Coming Soon. */
|
||||||
cur := holdreflect
|
cur := holdreflect
|
||||||
|
|
||||||
var varbit string
|
var varbit string
|
||||||
if cur.Kind() == reflect.Interface {
|
if cur.Kind() == reflect.Interface {
|
||||||
cur = cur.Elem()
|
cur = cur.Elem()
|
||||||
varbit += ".(" + cur.Type().Name() + ")"
|
varbit += ".(" + cur.Type().Name() + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, id := range n.Ident {
|
for _, id := range n.Ident {
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Data Kind:",cur.Kind().String())
|
fmt.Println("Data Kind:",cur.Kind().String())
|
||||||
fmt.Println("Field Bit:",id)
|
fmt.Println("Field Bit:",id)
|
||||||
}
|
}
|
||||||
|
|
||||||
cur = cur.FieldByName(id)
|
cur = cur.FieldByName(id)
|
||||||
if cur.Kind() == reflect.Interface {
|
if cur.Kind() == reflect.Interface {
|
||||||
cur = cur.Elem()
|
cur = cur.Elem()
|
||||||
|
@ -359,7 +358,7 @@ func (c *CTemplateSet) compile_subswitch(varholder string, holdreflect reflect.V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out = c.compile_varsub(varholder + varbit, cur)
|
out = c.compile_varsub(varholder + varbit, cur)
|
||||||
|
|
||||||
for _, varItem := range c.varList {
|
for _, varItem := range c.varList {
|
||||||
if strings.HasPrefix(out, varItem.Destination) {
|
if strings.HasPrefix(out, varItem.Destination) {
|
||||||
out = strings.Replace(out, varItem.Destination, varItem.Name, 1)
|
out = strings.Replace(out, varItem.Destination, varItem.Name, 1)
|
||||||
|
@ -409,7 +408,7 @@ func (c *CTemplateSet) compile_varswitch(varholder string, holdreflect reflect.V
|
||||||
fmt.Println("Field Bit:",id)
|
fmt.Println("Field Bit:",id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use reflect to determine if the field is for a method, otherwise assume it's a variable. Coming Soon. */
|
/* Use reflect to determine if the field is for a method, otherwise assume it's a variable. Coming Soon. */
|
||||||
return c.compile_boolsub(n.String(), varholder, template_name, holdreflect)
|
return c.compile_boolsub(n.String(), varholder, template_name, holdreflect)
|
||||||
case *parse.ChainNode:
|
case *parse.ChainNode:
|
||||||
|
@ -442,7 +441,7 @@ func (c *CTemplateSet) compile_varswitch(varholder string, holdreflect reflect.V
|
||||||
fmt.Println("Args:",node.Args)
|
fmt.Println("Args:",node.Args)
|
||||||
}
|
}
|
||||||
out += c.compile_identswitch_n(varholder, holdreflect, template_name, node)
|
out += c.compile_identswitch_n(varholder, holdreflect, template_name, node)
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Out:",out)
|
fmt.Println("Out:",out)
|
||||||
}
|
}
|
||||||
|
@ -467,7 +466,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("in compile_identswitch")
|
fmt.Println("in compile_identswitch")
|
||||||
}
|
}
|
||||||
|
|
||||||
//var outbuf map[int]string
|
//var outbuf map[int]string
|
||||||
ArgLoop:
|
ArgLoop:
|
||||||
for pos := 0; pos < len(node.Args); pos++ {
|
for pos := 0; pos < len(node.Args); pos++ {
|
||||||
|
@ -494,26 +493,26 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
panic("or is missing a right operand")
|
panic("or is missing a right operand")
|
||||||
return out, val
|
return out, val
|
||||||
}
|
}
|
||||||
|
|
||||||
left := c.compile_boolsub(node.Args[pos - 1].String(), varholder, template_name, holdreflect)
|
left := c.compile_boolsub(node.Args[pos - 1].String(), varholder, template_name, holdreflect)
|
||||||
_, funcExists := c.funcMap[node.Args[pos + 1].String()]
|
_, funcExists := c.funcMap[node.Args[pos + 1].String()]
|
||||||
|
|
||||||
var right string
|
var right string
|
||||||
if !funcExists {
|
if !funcExists {
|
||||||
right = c.compile_boolsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
right = c.compile_boolsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
||||||
}
|
}
|
||||||
|
|
||||||
out += left + " || " + right
|
out += left + " || " + right
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Left operand:",node.Args[pos - 1])
|
fmt.Println("Left operand:",node.Args[pos - 1])
|
||||||
fmt.Println("Right operand:",node.Args[pos + 1])
|
fmt.Println("Right operand:",node.Args[pos + 1])
|
||||||
}
|
}
|
||||||
|
|
||||||
if !funcExists {
|
if !funcExists {
|
||||||
pos++
|
pos++
|
||||||
}
|
}
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("pos:",pos)
|
fmt.Println("pos:",pos)
|
||||||
fmt.Println("len(node.Args):",len(node.Args))
|
fmt.Println("len(node.Args):",len(node.Args))
|
||||||
|
@ -533,26 +532,26 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
panic("and is missing a right operand")
|
panic("and is missing a right operand")
|
||||||
return out, val
|
return out, val
|
||||||
}
|
}
|
||||||
|
|
||||||
left := c.compile_boolsub(node.Args[pos - 1].String(), varholder, template_name, holdreflect)
|
left := c.compile_boolsub(node.Args[pos - 1].String(), varholder, template_name, holdreflect)
|
||||||
_, funcExists := c.funcMap[node.Args[pos + 1].String()]
|
_, funcExists := c.funcMap[node.Args[pos + 1].String()]
|
||||||
|
|
||||||
var right string
|
var right string
|
||||||
if !funcExists {
|
if !funcExists {
|
||||||
right = c.compile_boolsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
right = c.compile_boolsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
||||||
}
|
}
|
||||||
|
|
||||||
out += left + " && " + right
|
out += left + " && " + right
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Left operand:",node.Args[pos - 1])
|
fmt.Println("Left operand:",node.Args[pos - 1])
|
||||||
fmt.Println("Right operand:",node.Args[pos + 1])
|
fmt.Println("Right operand:",node.Args[pos + 1])
|
||||||
}
|
}
|
||||||
|
|
||||||
if !funcExists {
|
if !funcExists {
|
||||||
pos++
|
pos++
|
||||||
}
|
}
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("pos:",pos)
|
fmt.Println("pos:",pos)
|
||||||
fmt.Println("len(node.Args):",len(node.Args))
|
fmt.Println("len(node.Args):",len(node.Args))
|
||||||
|
@ -602,7 +601,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
case "add":
|
case "add":
|
||||||
param1, val2 := c.compile_if_varsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
param1, val2 := c.compile_if_varsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
||||||
param2, val3 := c.compile_if_varsub(node.Args[pos + 2].String(), varholder, template_name, holdreflect)
|
param2, val3 := c.compile_if_varsub(node.Args[pos + 2].String(), varholder, template_name, holdreflect)
|
||||||
|
|
||||||
if val2.IsValid() {
|
if val2.IsValid() {
|
||||||
val = val2
|
val = val2
|
||||||
} else if val3.IsValid() {
|
} else if val3.IsValid() {
|
||||||
|
@ -611,7 +610,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
numSample := 1
|
numSample := 1
|
||||||
val = reflect.ValueOf(numSample)
|
val = reflect.ValueOf(numSample)
|
||||||
}
|
}
|
||||||
|
|
||||||
out += param1 + " + " + param2
|
out += param1 + " + " + param2
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("add")
|
fmt.Println("add")
|
||||||
|
@ -622,7 +621,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
case "subtract":
|
case "subtract":
|
||||||
param1, val2 := c.compile_if_varsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
param1, val2 := c.compile_if_varsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
||||||
param2, val3 := c.compile_if_varsub(node.Args[pos + 2].String(), varholder, template_name, holdreflect)
|
param2, val3 := c.compile_if_varsub(node.Args[pos + 2].String(), varholder, template_name, holdreflect)
|
||||||
|
|
||||||
if val2.IsValid() {
|
if val2.IsValid() {
|
||||||
val = val2
|
val = val2
|
||||||
} else if val3.IsValid() {
|
} else if val3.IsValid() {
|
||||||
|
@ -631,7 +630,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
numSample := 1
|
numSample := 1
|
||||||
val = reflect.ValueOf(numSample)
|
val = reflect.ValueOf(numSample)
|
||||||
}
|
}
|
||||||
|
|
||||||
out += param1 + " - " + param2
|
out += param1 + " - " + param2
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("subtract")
|
fmt.Println("subtract")
|
||||||
|
@ -642,7 +641,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
case "divide":
|
case "divide":
|
||||||
param1, val2 := c.compile_if_varsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
param1, val2 := c.compile_if_varsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
||||||
param2, val3 := c.compile_if_varsub(node.Args[pos + 2].String(), varholder, template_name, holdreflect)
|
param2, val3 := c.compile_if_varsub(node.Args[pos + 2].String(), varholder, template_name, holdreflect)
|
||||||
|
|
||||||
if val2.IsValid() {
|
if val2.IsValid() {
|
||||||
val = val2
|
val = val2
|
||||||
} else if val3.IsValid() {
|
} else if val3.IsValid() {
|
||||||
|
@ -651,7 +650,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
numSample := 1
|
numSample := 1
|
||||||
val = reflect.ValueOf(numSample)
|
val = reflect.ValueOf(numSample)
|
||||||
}
|
}
|
||||||
|
|
||||||
out += param1 + " / " + param2
|
out += param1 + " / " + param2
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("divide")
|
fmt.Println("divide")
|
||||||
|
@ -662,7 +661,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
case "multiply":
|
case "multiply":
|
||||||
param1, val2 := c.compile_if_varsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
param1, val2 := c.compile_if_varsub(node.Args[pos + 1].String(), varholder, template_name, holdreflect)
|
||||||
param2, val3 := c.compile_if_varsub(node.Args[pos + 2].String(), varholder, template_name, holdreflect)
|
param2, val3 := c.compile_if_varsub(node.Args[pos + 2].String(), varholder, template_name, holdreflect)
|
||||||
|
|
||||||
if val2.IsValid() {
|
if val2.IsValid() {
|
||||||
val = val2
|
val = val2
|
||||||
} else if val3.IsValid() {
|
} else if val3.IsValid() {
|
||||||
|
@ -671,7 +670,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
numSample := 1
|
numSample := 1
|
||||||
val = reflect.ValueOf(numSample)
|
val = reflect.ValueOf(numSample)
|
||||||
}
|
}
|
||||||
|
|
||||||
out += param1 + " * " + param2
|
out += param1 + " * " + param2
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("multiply")
|
fmt.Println("multiply")
|
||||||
|
@ -692,7 +691,7 @@ func (c *CTemplateSet) compile_identswitch(varholder string, holdreflect reflect
|
||||||
out += c.compile_if_varsub_n(id.String(), varholder, template_name, holdreflect)
|
out += c.compile_if_varsub_n(id.String(), varholder, template_name, holdreflect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//for _, outval := range outbuf {
|
//for _, outval := range outbuf {
|
||||||
// out += outval
|
// out += outval
|
||||||
//}
|
//}
|
||||||
|
@ -746,7 +745,7 @@ func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, templ
|
||||||
if varname[0] != '.' && varname[0] != '$' {
|
if varname[0] != '.' && varname[0] != '$' {
|
||||||
return varname, cur
|
return varname, cur
|
||||||
}
|
}
|
||||||
|
|
||||||
bits := strings.Split(varname,".")
|
bits := strings.Split(varname,".")
|
||||||
if varname[0] == '$' {
|
if varname[0] == '$' {
|
||||||
var res VarItemReflect
|
var res VarItemReflect
|
||||||
|
@ -757,7 +756,7 @@ func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, templ
|
||||||
}
|
}
|
||||||
out += res.Destination
|
out += res.Destination
|
||||||
cur = res.Value
|
cur = res.Value
|
||||||
|
|
||||||
if cur.Kind() == reflect.Interface {
|
if cur.Kind() == reflect.Interface {
|
||||||
cur = cur.Elem()
|
cur = cur.Elem()
|
||||||
}
|
}
|
||||||
|
@ -770,22 +769,22 @@ func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, templ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bits[0] = strings.TrimPrefix(bits[0],"$")
|
bits[0] = strings.TrimPrefix(bits[0],"$")
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Cur Kind:",cur.Kind())
|
fmt.Println("Cur Kind:",cur.Kind())
|
||||||
fmt.Println("Cur Type:",cur.Type().Name())
|
fmt.Println("Cur Type:",cur.Type().Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, bit := range bits {
|
for _, bit := range bits {
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Variable Field!")
|
fmt.Println("Variable Field!")
|
||||||
fmt.Println(bit)
|
fmt.Println(bit)
|
||||||
}
|
}
|
||||||
|
|
||||||
if bit == "" {
|
if bit == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
cur = cur.FieldByName(bit)
|
cur = cur.FieldByName(bit)
|
||||||
if cur.Kind() == reflect.Interface {
|
if cur.Kind() == reflect.Interface {
|
||||||
cur = cur.Elem()
|
cur = cur.Elem()
|
||||||
|
@ -793,38 +792,38 @@ func (c *CTemplateSet) compile_if_varsub(varname string, varholder string, templ
|
||||||
} else {
|
} else {
|
||||||
out += "." + bit
|
out += "." + bit
|
||||||
}
|
}
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Data Kind:",cur.Kind())
|
fmt.Println("Data Kind:",cur.Kind())
|
||||||
fmt.Println("Data Type:",cur.Type().Name())
|
fmt.Println("Data Type:",cur.Type().Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Out Value:",out)
|
fmt.Println("Out Value:",out)
|
||||||
fmt.Println("Out Kind:",cur.Kind())
|
fmt.Println("Out Kind:",cur.Kind())
|
||||||
fmt.Println("Out Type:",cur.Type().Name())
|
fmt.Println("Out Type:",cur.Type().Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, varItem := range c.varList {
|
for _, varItem := range c.varList {
|
||||||
if strings.HasPrefix(out, varItem.Destination) {
|
if strings.HasPrefix(out, varItem.Destination) {
|
||||||
out = strings.Replace(out, varItem.Destination, varItem.Name, 1)
|
out = strings.Replace(out, varItem.Destination, varItem.Name, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Out Value:",out)
|
fmt.Println("Out Value:",out)
|
||||||
fmt.Println("Out Kind:",cur.Kind())
|
fmt.Println("Out Kind:",cur.Kind())
|
||||||
fmt.Println("Out Type:",cur.Type().Name())
|
fmt.Println("Out Type:",cur.Type().Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
_, ok := c.stats[out]
|
_, ok := c.stats[out]
|
||||||
if ok {
|
if ok {
|
||||||
c.stats[out]++
|
c.stats[out]++
|
||||||
} else {
|
} else {
|
||||||
c.stats[out] = 1
|
c.stats[out] = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
return out, cur
|
return out, cur
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -856,18 +855,18 @@ func (c *CTemplateSet) compile_varsub(varname string, val reflect.Value) string
|
||||||
varname = strings.Replace(varname, varItem.Destination, varItem.Name, 1)
|
varname = strings.Replace(varname, varItem.Destination, varItem.Name, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, ok := c.stats[varname]
|
_, ok := c.stats[varname]
|
||||||
if ok {
|
if ok {
|
||||||
c.stats[varname]++
|
c.stats[varname]++
|
||||||
} else {
|
} else {
|
||||||
c.stats[varname] = 1
|
c.stats[varname] = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if val.Kind() == reflect.Interface {
|
if val.Kind() == reflect.Interface {
|
||||||
val = val.Elem()
|
val = val.Elem()
|
||||||
}
|
}
|
||||||
|
|
||||||
switch val.Kind() {
|
switch val.Kind() {
|
||||||
case reflect.Int:
|
case reflect.Int:
|
||||||
return "w.Write([]byte(strconv.Itoa(" + varname + ")))\n"
|
return "w.Write([]byte(strconv.Itoa(" + varname + ")))\n"
|
||||||
|
@ -894,7 +893,7 @@ func (c *CTemplateSet) compile_subtemplate(pvarholder string, pholdreflect refle
|
||||||
fmt.Println("in compile_subtemplate")
|
fmt.Println("in compile_subtemplate")
|
||||||
fmt.Println("Template Node: " + node.Name)
|
fmt.Println("Template Node: " + node.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fname := strings.TrimSuffix(node.Name, filepath.Ext(node.Name))
|
fname := strings.TrimSuffix(node.Name, filepath.Ext(node.Name))
|
||||||
varholder := "tmpl_" + fname + "_vars"
|
varholder := "tmpl_" + fname + "_vars"
|
||||||
var holdreflect reflect.Value
|
var holdreflect reflect.Value
|
||||||
|
@ -914,40 +913,40 @@ func (c *CTemplateSet) compile_subtemplate(pvarholder string, pholdreflect refle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := ioutil.ReadFile(c.dir + node.Name)
|
res, err := ioutil.ReadFile(c.dir + node.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
content := string(res)
|
content := string(res)
|
||||||
if minify_templates {
|
if minify_templates {
|
||||||
content = minify(content)
|
content = minify(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
tree := parse.New(node.Name, c.funcMap)
|
tree := parse.New(node.Name, c.funcMap)
|
||||||
var treeSet map[string]*parse.Tree = make(map[string]*parse.Tree)
|
var treeSet map[string]*parse.Tree = make(map[string]*parse.Tree)
|
||||||
tree, err = tree.Parse(content,"{{","}}", treeSet, c.funcMap)
|
tree, err = tree.Parse(content,"{{","}}", treeSet, c.funcMap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.tlist[fname] = tree
|
c.tlist[fname] = tree
|
||||||
subtree := c.tlist[fname]
|
subtree := c.tlist[fname]
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println(subtree.Root)
|
fmt.Println(subtree.Root)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.localVars[fname] = make(map[string]VarItemReflect)
|
c.localVars[fname] = make(map[string]VarItemReflect)
|
||||||
c.localVars[fname]["."] = VarItemReflect{".",varholder,holdreflect}
|
c.localVars[fname]["."] = VarItemReflect{".",varholder,holdreflect}
|
||||||
c.FragmentCursor[fname] = 0
|
c.FragmentCursor[fname] = 0
|
||||||
|
|
||||||
treeLength := len(subtree.Root.Nodes)
|
treeLength := len(subtree.Root.Nodes)
|
||||||
for index, node := range subtree.Root.Nodes {
|
for index, node := range subtree.Root.Nodes {
|
||||||
if super_debug {
|
if super_debug {
|
||||||
fmt.Println("Node:",node.String())
|
fmt.Println("Node:",node.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
c.previousNode = c.currentNode
|
c.previousNode = c.currentNode
|
||||||
c.currentNode = node.Type()
|
c.currentNode = node.Type()
|
||||||
if treeLength != (index + 1) {
|
if treeLength != (index + 1) {
|
||||||
|
@ -955,7 +954,7 @@ func (c *CTemplateSet) compile_subtemplate(pvarholder string, pholdreflect refle
|
||||||
}
|
}
|
||||||
out += c.compile_switch(varholder, holdreflect, fname, node)
|
out += c.compile_switch(varholder, holdreflect, fname, node)
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CTemplateSet) compile_command(*parse.CommandNode) (out string) {
|
func (c *CTemplateSet) compile_command(*parse.CommandNode) (out string) {
|
||||||
|
|
|
@ -3,7 +3,13 @@
|
||||||
<head>
|
<head>
|
||||||
<title>{{.Title}}</title>
|
<title>{{.Title}}</title>
|
||||||
<link href="/static/main.css" rel="stylesheet" type="text/css">
|
<link href="/static/main.css" rel="stylesheet" type="text/css">
|
||||||
|
{{range .Header.Stylesheets}}
|
||||||
|
<link href="/static/{{.}}.css" rel="stylesheet" type="text/css">
|
||||||
|
{{end}}
|
||||||
<script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script>
|
<script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script>
|
||||||
|
{{range .Header.Scripts}}
|
||||||
|
<script type="text/javascript" src="/static/{{.}}.js"></script>
|
||||||
|
{{end}}
|
||||||
<script type="text/javascript">var session = "{{.CurrentUser.Session}}";
|
<script type="text/javascript">var session = "{{.CurrentUser.Session}}";
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="/static/global.js"></script>
|
<script type="text/javascript" src="/static/global.js"></script>
|
||||||
|
@ -13,4 +19,4 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{template "menu.html" .}}
|
{{template "menu.html" .}}
|
||||||
<div id="back"><div id="main">
|
<div id="back"><div id="main">
|
||||||
{{range .NoticeList}}<div class="alert">{{.}}</div>{{end}}
|
{{range .Header.NoticeList}}<div class="alert">{{.}}</div>{{end}}
|
||||||
|
|
11
themes.go
11
themes.go
|
@ -34,6 +34,7 @@ type Theme struct
|
||||||
URL string
|
URL string
|
||||||
Settings map[string]ThemeSetting
|
Settings map[string]ThemeSetting
|
||||||
Templates []TemplateMapping
|
Templates []TemplateMapping
|
||||||
|
TemplatesMap map[string]string // TO-DO: Make template mapping work without the template compiler
|
||||||
|
|
||||||
// This variable should only be set and unset by the system, not the theme meta file
|
// This variable should only be set and unset by the system, not the theme meta file
|
||||||
Active bool
|
Active bool
|
||||||
|
@ -73,6 +74,13 @@ func LoadThemes() error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
theme.TemplatesMap = make(map[string]string)
|
||||||
|
if theme.Templates != nil {
|
||||||
|
for _, themeTmpl := range theme.Templates {
|
||||||
|
theme.TemplatesMap[themeTmpl.Name] = themeTmpl.Source
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if defaultThemeSwitch {
|
if defaultThemeSwitch {
|
||||||
log.Print("Loading the theme '" + theme.Name + "'")
|
log.Print("Loading the theme '" + theme.Name + "'")
|
||||||
theme.Active = true
|
theme.Active = true
|
||||||
|
@ -115,7 +123,6 @@ func init_themes() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
theme.Active = false // Set this to false, just in case someone explicitly overrode this value in the JSON file
|
theme.Active = false // Set this to false, just in case someone explicitly overrode this value in the JSON file
|
||||||
|
|
||||||
if theme.FullImage != "" {
|
if theme.FullImage != "" {
|
||||||
|
@ -179,7 +186,7 @@ func map_theme_templates(theme Theme) {
|
||||||
|
|
||||||
dest_tmpl_ptr, ok := tmpl_ptr_map[themeTmpl.Name]
|
dest_tmpl_ptr, ok := tmpl_ptr_map[themeTmpl.Name]
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Fatal("The destination template doesn't exist!")
|
return
|
||||||
}
|
}
|
||||||
source_tmpl_ptr, ok := tmpl_ptr_map[themeTmpl.Source]
|
source_tmpl_ptr, ok := tmpl_ptr_map[themeTmpl.Source]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -195,8 +195,8 @@ hr { color: silver; border: 1px solid silver; }
|
||||||
.rowhead, .colhead {
|
.rowhead, .colhead {
|
||||||
background: #ce2424;
|
background: #ce2424;
|
||||||
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f97779), to(#ce2424));
|
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f97779), to(#ce2424));
|
||||||
background: -moz-linear-gradient(#f97779, #ce2424);
|
background: -moz-linear-gradient(#f97779, #ce2424);
|
||||||
background: linear-gradient(#f97779, #ce2424);
|
background: linear-gradient(#f97779, #ce2424);
|
||||||
border: 0px solid #b32424;
|
border: 0px solid #b32424;
|
||||||
border-top-right-radius: 5px;
|
border-top-right-radius: 5px;
|
||||||
border-top-left-radius: 5px;
|
border-top-left-radius: 5px;
|
||||||
|
@ -284,8 +284,8 @@ hr { color: silver; border: 1px solid silver; }
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
.grid_istat { margin-bottom: 5px; }
|
|
||||||
|
|
||||||
|
.grid_istat { margin-bottom: 5px; }
|
||||||
.stat_green { background-color: lightgreen; border-color: green; }
|
.stat_green { background-color: lightgreen; border-color: green; }
|
||||||
.stat_orange { background-color: #ffe4b3; border-color: orange; }
|
.stat_orange { background-color: #ffe4b3; border-color: orange; }
|
||||||
.stat_red { background-color: #ffb2b2; border-color: red; }
|
.stat_red { background-color: #ffb2b2; border-color: red; }
|
||||||
|
@ -646,62 +646,6 @@ blockquote p {
|
||||||
.next_button { right: 14px; }
|
.next_button { right: 14px; }
|
||||||
.head_tag_upshift { display: none; }
|
.head_tag_upshift { display: none; }
|
||||||
|
|
||||||
/* Control Panel */
|
|
||||||
.tag-mini {
|
|
||||||
margin-left: 0px;
|
|
||||||
padding-left: 0px;
|
|
||||||
padding-right: 0px;
|
|
||||||
padding-top: 2px;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
|
|
||||||
color: black;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel_tag {
|
|
||||||
padding-left: 0px;
|
|
||||||
padding-right: 0px;
|
|
||||||
border: none;
|
|
||||||
background: none;
|
|
||||||
color: #202020;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel_floater { float: right; }
|
|
||||||
#panel_groups > .rowitem > .panel_floater { float: none; }
|
|
||||||
#panel_groups > .rowitem > .panel_floater > .panel_right_button { float: right; }
|
|
||||||
#panel_forums > .rowitem > .panel_floater { float: none; }
|
|
||||||
#panel_forums > .rowitem > .panel_floater > .panel_buttons { float: right; }
|
|
||||||
|
|
||||||
.panel_rank_tag, .forum_preset, .forum_active {
|
|
||||||
float: none;
|
|
||||||
color: #202020 !important;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
.panel_rank_tag_admin:before { content: "Admins"; }
|
|
||||||
.panel_rank_tag_mod:before { content: "Mods"; }
|
|
||||||
.panel_rank_tag_banned:before { content: "Banned"; }
|
|
||||||
.panel_rank_tag_guest:before { content: "Guests"; }
|
|
||||||
.panel_rank_tag_member:before { content: "Members"; }
|
|
||||||
|
|
||||||
.forum_preset_announce:after { content: "Announcements"; }
|
|
||||||
.forum_preset_members:after { content: "Member Only"; }
|
|
||||||
.forum_preset_staff:after { content: "Staff Only"; }
|
|
||||||
.forum_preset_admins:after { content: "Admin Only"; }
|
|
||||||
.forum_preset_archive:after { content: "Archive"; }
|
|
||||||
.forum_preset_all:after { content: "Public"; }
|
|
||||||
.forum_preset_custom, .forum_preset_ { display: none !important; }
|
|
||||||
.forum_active_Hide:before { content: "Hidden"; }
|
|
||||||
.forum_active_Hide + .forum_preset:before { content: " | "; }
|
|
||||||
.forum_active_Show { display: none !important; }
|
|
||||||
|
|
||||||
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
|
||||||
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
|
||||||
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
|
||||||
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
|
||||||
.perm_preset_custom:before { content: "Custom"; color: black; }
|
|
||||||
.perm_preset_default:before { content: "Default"; }
|
|
||||||
|
|
||||||
/* Responsive Layout */
|
/* Responsive Layout */
|
||||||
/* Anything that isn't a small mobile */
|
/* Anything that isn't a small mobile */
|
||||||
@media(min-width: 501px) {
|
@media(min-width: 501px) {
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/* Control Panel */
|
||||||
|
|
||||||
|
.tag-mini {
|
||||||
|
margin-left: 0px;
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
|
||||||
|
color: black;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_tag {
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
color: #202020;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_floater {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_groups > .rowitem > .panel_floater {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
#panel_groups > .rowitem > .panel_floater > .panel_right_button {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > .panel_floater {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > .panel_floater > .panel_buttons {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > span > .forum_name {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_rank_tag, .forum_preset, .forum_active {
|
||||||
|
float: none;
|
||||||
|
color: #202020 !important;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
.panel_rank_tag_admin:before { content: "Admins"; }
|
||||||
|
.panel_rank_tag_mod:before { content: "Mods"; }
|
||||||
|
.panel_rank_tag_banned:before { content: "Banned"; }
|
||||||
|
.panel_rank_tag_guest:before { content: "Guests"; }
|
||||||
|
.panel_rank_tag_member:before { content: "Members"; }
|
||||||
|
|
||||||
|
.forum_preset_announce:after { content: "Announcements"; }
|
||||||
|
.forum_preset_members:after { content: "Member Only"; }
|
||||||
|
.forum_preset_staff:after { content: "Staff Only"; }
|
||||||
|
.forum_preset_admins:after { content: "Admin Only"; }
|
||||||
|
.forum_preset_archive:after { content: "Archive"; }
|
||||||
|
.forum_preset_all:after { content: "Public"; }
|
||||||
|
.forum_preset_custom, .forum_preset_ { display: none !important; }
|
||||||
|
.forum_active_Hide:before { content: "Hidden"; }
|
||||||
|
.forum_active_Hide + .forum_preset:before { content: " | "; }
|
||||||
|
.forum_active_Show { display: none !important; }
|
||||||
|
|
||||||
|
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
||||||
|
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
||||||
|
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
||||||
|
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
||||||
|
.perm_preset_custom:before { content: "Custom"; color: black; }
|
||||||
|
.perm_preset_default:before { content: "Default"; }
|
|
@ -1,4 +1,4 @@
|
||||||
/* AtomBB Cosmo Port. Copyright Azareal 2017 */
|
/* AtomBB Cosmo Port. Copyright Azareal 2017 - 2018 */
|
||||||
/* I'm currently converting the CSS over from one of my previous projects. Don't use this yet! */
|
/* I'm currently converting the CSS over from one of my previous projects. Don't use this yet! */
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
@ -182,8 +182,8 @@ hr { color: silver; border: 1px solid silver; }
|
||||||
.rowhead, .colhead {
|
.rowhead, .colhead {
|
||||||
background: #ce2424;
|
background: #ce2424;
|
||||||
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f97779), to(#ce2424));
|
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f97779), to(#ce2424));
|
||||||
background: -moz-linear-gradient(#f97779, #ce2424);
|
background: -moz-linear-gradient(#f97779, #ce2424);
|
||||||
background: url('/static/fabric-base-simple-alpha.png'), linear-gradient(#f97779, #ce2424);
|
background: url('/static/fabric-base-simple-alpha.png'), linear-gradient(#f97779, #ce2424);
|
||||||
border: 0px solid #b32424;
|
border: 0px solid #b32424;
|
||||||
border-top-right-radius: 5px;
|
border-top-right-radius: 5px;
|
||||||
border-top-left-radius: 5px;
|
border-top-left-radius: 5px;
|
||||||
|
@ -271,8 +271,8 @@ hr { color: silver; border: 1px solid silver; }
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
.grid_istat { margin-bottom: 5px; }
|
|
||||||
|
|
||||||
|
.grid_istat { margin-bottom: 5px; }
|
||||||
.stat_green { background-color: lightgreen; border-color: green; }
|
.stat_green { background-color: lightgreen; border-color: green; }
|
||||||
.stat_orange { background-color: #ffe4b3; border-color: orange; }
|
.stat_orange { background-color: #ffe4b3; border-color: orange; }
|
||||||
.stat_red { background-color: #ffb2b2; border-color: red; }
|
.stat_red { background-color: #ffb2b2; border-color: red; }
|
||||||
|
@ -654,8 +654,8 @@ blockquote p {
|
||||||
border-style: dotted;
|
border-style: dotted;
|
||||||
border-color: #505050;
|
border-color: #505050;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,62 +671,6 @@ blockquote p {
|
||||||
.next_button { right: 14px; }
|
.next_button { right: 14px; }
|
||||||
.head_tag_upshift { display: none !important; }
|
.head_tag_upshift { display: none !important; }
|
||||||
|
|
||||||
/* Control Panel */
|
|
||||||
.tag-mini {
|
|
||||||
margin-left: 0px;
|
|
||||||
padding-left: 0px;
|
|
||||||
padding-right: 0px;
|
|
||||||
padding-top: 2px;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
|
|
||||||
color: black;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel_tag {
|
|
||||||
padding-left: 0px;
|
|
||||||
padding-right: 0px;
|
|
||||||
border: none;
|
|
||||||
background: none;
|
|
||||||
color: #202020;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel_floater { float: right; }
|
|
||||||
#panel_groups > .rowitem > .panel_floater { float: none; }
|
|
||||||
#panel_groups > .rowitem > .panel_floater > .panel_right_button { float: right; }
|
|
||||||
#panel_forums > .rowitem > .panel_floater { float: none; }
|
|
||||||
#panel_forums > .rowitem > .panel_floater > .panel_buttons { float: right; }
|
|
||||||
|
|
||||||
.panel_rank_tag, .forum_preset, .forum_active {
|
|
||||||
float: none;
|
|
||||||
color: #202020 !important;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
.panel_rank_tag_admin:before { content: "Admins"; }
|
|
||||||
.panel_rank_tag_mod:before { content: "Mods"; }
|
|
||||||
.panel_rank_tag_banned:before { content: "Banned"; }
|
|
||||||
.panel_rank_tag_guest:before { content: "Guests"; }
|
|
||||||
.panel_rank_tag_member:before { content: "Members"; }
|
|
||||||
|
|
||||||
.forum_preset_announce:after { content: "Announcements"; }
|
|
||||||
.forum_preset_members:after { content: "Member Only"; }
|
|
||||||
.forum_preset_staff:after { content: "Staff Only"; }
|
|
||||||
.forum_preset_admins:after { content: "Admin Only"; }
|
|
||||||
.forum_preset_archive:after { content: "Archive"; }
|
|
||||||
.forum_preset_all:after { content: "Public"; }
|
|
||||||
.forum_preset_custom, .forum_preset_ { display: none !important; }
|
|
||||||
.forum_active_Hide:before { content: "Hidden"; }
|
|
||||||
.forum_active_Hide + .forum_preset:before { content: " | "; }
|
|
||||||
.forum_active_Show { display: none !important; }
|
|
||||||
|
|
||||||
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
|
||||||
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
|
||||||
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
|
||||||
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
|
||||||
.perm_preset_custom:before { content: "Custom"; color: black; }
|
|
||||||
.perm_preset_default:before { content: "Default"; }
|
|
||||||
|
|
||||||
/* Responsive Layout */
|
/* Responsive Layout */
|
||||||
/* Anything that isn't a small mobile */
|
/* Anything that isn't a small mobile */
|
||||||
@media(min-width: 501px) {
|
@media(min-width: 501px) {
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/* Control Panel */
|
||||||
|
|
||||||
|
.tag-mini {
|
||||||
|
margin-left: 0px;
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
|
||||||
|
color: black;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_tag {
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
color: #202020;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_floater {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_groups > .rowitem > .panel_floater {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
#panel_groups > .rowitem > .panel_floater > .panel_right_button {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > .panel_floater {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > .panel_floater > .panel_buttons {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > span > .forum_name {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_rank_tag, .forum_preset, .forum_active {
|
||||||
|
float: none;
|
||||||
|
color: #202020 !important;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
.panel_rank_tag_admin:before { content: "Admins"; }
|
||||||
|
.panel_rank_tag_mod:before { content: "Mods"; }
|
||||||
|
.panel_rank_tag_banned:before { content: "Banned"; }
|
||||||
|
.panel_rank_tag_guest:before { content: "Guests"; }
|
||||||
|
.panel_rank_tag_member:before { content: "Members"; }
|
||||||
|
|
||||||
|
.forum_preset_announce:after { content: "Announcements"; }
|
||||||
|
.forum_preset_members:after { content: "Member Only"; }
|
||||||
|
.forum_preset_staff:after { content: "Staff Only"; }
|
||||||
|
.forum_preset_admins:after { content: "Admin Only"; }
|
||||||
|
.forum_preset_archive:after { content: "Archive"; }
|
||||||
|
.forum_preset_all:after { content: "Public"; }
|
||||||
|
.forum_preset_custom, .forum_preset_ { display: none !important; }
|
||||||
|
.forum_active_Hide:before { content: "Hidden"; }
|
||||||
|
.forum_active_Hide + .forum_preset:before { content: " | "; }
|
||||||
|
.forum_active_Show { display: none !important; }
|
||||||
|
|
||||||
|
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
||||||
|
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
||||||
|
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
||||||
|
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
||||||
|
.perm_preset_custom:before { content: "Custom"; color: black; }
|
||||||
|
.perm_preset_default:before { content: "Default"; }
|
|
@ -503,8 +503,8 @@ button.username {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
border-style: dotted;
|
border-style: solid;
|
||||||
border-color: #505050;
|
border-color: #ccc;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
|
@ -527,73 +527,6 @@ button.username {
|
||||||
top: -2px;
|
top: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Control Panel */
|
|
||||||
.panel_upshift:visited { color: black; }
|
|
||||||
|
|
||||||
.tag-mini {
|
|
||||||
margin-left: 0px;
|
|
||||||
padding-left: 0px;
|
|
||||||
padding-right: 0px;
|
|
||||||
padding-top: 2px;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
|
|
||||||
color: black;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel_tag {
|
|
||||||
padding-left: 0px;
|
|
||||||
padding-right: 0px;
|
|
||||||
border: none;
|
|
||||||
background: none;
|
|
||||||
color: #202020;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel_floater { float: right; }
|
|
||||||
#panel_groups > .rowitem > .panel_floater { float: none; }
|
|
||||||
#panel_groups > .rowitem > .panel_floater > .panel_right_button { float: right; }
|
|
||||||
#panel_forums > .rowitem > .panel_floater { float: none; }
|
|
||||||
#panel_forums > .rowitem > .panel_floater > .panel_buttons { float: right; }
|
|
||||||
#panel_forums > .rowitem > span > .forum_name { margin-right: 4px; }
|
|
||||||
#panel_forum_quick_perms > .formrow > .formitem > a { margin-right: 4px; }
|
|
||||||
.forum_active > select { margin-bottom: 3px } /* Quick fix, need to properly patch this */
|
|
||||||
|
|
||||||
.panel_rank_tag, .forum_preset, .forum_active {
|
|
||||||
float: none;
|
|
||||||
color: #202020 !important;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
|
||||||
.panel_rank_tag_admin:before { content: "Admins"; }
|
|
||||||
.panel_rank_tag_mod:before { content: "Mods"; }
|
|
||||||
.panel_rank_tag_banned:before { content: "Banned"; }
|
|
||||||
.panel_rank_tag_guest:before { content: "Guests"; }
|
|
||||||
.panel_rank_tag_member:before { content: "Members"; }
|
|
||||||
|
|
||||||
.forum_preset_announce:after { content: "Announcements"; }
|
|
||||||
.forum_preset_members:after { content: "Member Only"; }
|
|
||||||
.forum_preset_staff:after { content: "Staff Only"; }
|
|
||||||
.forum_preset_admins:after { content: "Admin Only"; }
|
|
||||||
.forum_preset_archive:after { content: "Archive"; }
|
|
||||||
.forum_preset_all:after { content: "Public"; }
|
|
||||||
.forum_preset_custom, .forum_preset_ { display: none !important; }
|
|
||||||
.forum_active_Hide:before { content: "Hidden"; }
|
|
||||||
.forum_active_Hide + .forum_preset:before { content: " | "; }
|
|
||||||
.forum_active_Show { display: none !important; }
|
|
||||||
|
|
||||||
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
|
||||||
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
|
||||||
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
|
||||||
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
|
||||||
.perm_preset_custom:before { content: "Custom"; color: black; }
|
|
||||||
.perm_preset_default:before { content: "Default"; }
|
|
||||||
|
|
||||||
.theme_row > .panel_floater > .panel_right_button { margin-left: 5px; }
|
|
||||||
|
|
||||||
@media(max-width: 1300px) {
|
|
||||||
.theme_row { background-image: none !important; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The Media Queries */
|
/* The Media Queries */
|
||||||
@media (max-width: 880px) {
|
@media (max-width: 880px) {
|
||||||
li {
|
li {
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
/* Control Panel */
|
||||||
|
|
||||||
|
.panel_upshift:visited { color: black; }
|
||||||
|
|
||||||
|
.panel_tag {
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
color: #202020;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-mini {
|
||||||
|
margin-left: 0px;
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
|
||||||
|
color: black;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_floater {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_groups > .rowitem > .panel_floater {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
#panel_groups > .rowitem > .panel_floater > .panel_right_button {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > .panel_floater {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > .panel_floater > .panel_buttons {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > span > .forum_name {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
#panel_forum_quick_perms > .formrow > .formitem > a {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Quick fix, need to properly patch this */
|
||||||
|
.forum_active > select {
|
||||||
|
margin-bottom: 3px
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_rank_tag, .forum_preset, .forum_active {
|
||||||
|
float: none;
|
||||||
|
color: #202020 !important;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
.panel_rank_tag_admin:before { content: "Admins"; }
|
||||||
|
.panel_rank_tag_mod:before { content: "Mods"; }
|
||||||
|
.panel_rank_tag_banned:before { content: "Banned"; }
|
||||||
|
.panel_rank_tag_guest:before { content: "Guests"; }
|
||||||
|
.panel_rank_tag_member:before { content: "Members"; }
|
||||||
|
|
||||||
|
.forum_preset_announce:after { content: "Announcements"; }
|
||||||
|
.forum_preset_members:after { content: "Member Only"; }
|
||||||
|
.forum_preset_staff:after { content: "Staff Only"; }
|
||||||
|
.forum_preset_admins:after { content: "Admin Only"; }
|
||||||
|
.forum_preset_archive:after { content: "Archive"; }
|
||||||
|
.forum_preset_all:after { content: "Public"; }
|
||||||
|
.forum_preset_custom, .forum_preset_ { display: none !important; }
|
||||||
|
.forum_active_Hide:before { content: "Hidden"; }
|
||||||
|
.forum_active_Hide + .forum_preset:before { content: " | "; }
|
||||||
|
.forum_active_Show { display: none !important; }
|
||||||
|
|
||||||
|
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
||||||
|
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
||||||
|
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
||||||
|
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
||||||
|
.perm_preset_custom:before { content: "Custom"; color: black; }
|
||||||
|
.perm_preset_default:before { content: "Default"; }
|
||||||
|
|
||||||
|
.theme_row > .panel_floater > .panel_right_button { margin-left: 5px; }
|
||||||
|
|
||||||
|
@media(max-width: 1300px) {
|
||||||
|
.theme_row { background-image: none !important; }
|
||||||
|
}
|
|
@ -183,8 +183,7 @@ li a {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
.colstack_head { margin-bottom: 0px; }
|
.colstack_head { margin-bottom: 0px; }
|
||||||
.colstack_left:empty { display: none; }
|
.colstack_left:empty, .colstack_right:empty { display: none; }
|
||||||
.colstack_right:empty { display: none; }
|
|
||||||
|
|
||||||
.colstack_grid {
|
.colstack_grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
@ -387,27 +386,13 @@ button.username {
|
||||||
content: "|";
|
content: "|";
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
.edit_label:before {
|
.edit_label:before { content: "Edit"; }
|
||||||
content: "Edit";
|
.trash_label:before { content: "Delete"; }
|
||||||
}
|
.pin_label:before { content: "Pin"; }
|
||||||
.trash_label:before {
|
.unpin_label:before { content: "Unpin"; }
|
||||||
content: "Delete";
|
.flag_label:before { content: "Flag"; }
|
||||||
}
|
.level_label { margin-right: 1px; }
|
||||||
.pin_label:before {
|
.level_label:before { content: "Level"; }
|
||||||
content: "Pin";
|
|
||||||
}
|
|
||||||
.unpin_label:before {
|
|
||||||
content: "Unpin";
|
|
||||||
}
|
|
||||||
.flag_label:before {
|
|
||||||
content: "Flag";
|
|
||||||
}
|
|
||||||
.level_label {
|
|
||||||
margin-right: 1px;
|
|
||||||
}
|
|
||||||
.level_label:before {
|
|
||||||
content: "Level";
|
|
||||||
}
|
|
||||||
|
|
||||||
.controls {
|
.controls {
|
||||||
margin-top: 23px;
|
margin-top: 23px;
|
||||||
|
@ -496,60 +481,6 @@ button.username {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Control Panel */
|
|
||||||
|
|
||||||
.tag-mini {
|
|
||||||
margin-left: 0px;
|
|
||||||
padding-left: 0px;
|
|
||||||
padding-right: 0px;
|
|
||||||
padding-top: 2px;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
|
|
||||||
font-family: cursive;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #202020;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.panel_floater { float: right; }
|
|
||||||
#panel_groups > .rowitem > .panel_floater { float: none; }
|
|
||||||
#panel_groups > .rowitem > .panel_floater > .panel_right_button { float: right; }
|
|
||||||
#panel_forums > .rowitem > .panel_floater { float: none; }
|
|
||||||
#panel_forums > .rowitem > .panel_floater > .panel_buttons { float: right; }
|
|
||||||
#panel_forums > .rowitem > .panel_floater > .panel_buttons > .panel_right_button {
|
|
||||||
color: #505050;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.panel_rank_tag, .forum_preset, .forum_active {
|
|
||||||
float: none;
|
|
||||||
color: #202020;
|
|
||||||
opacity: 0.7;
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
.panel_rank_tag_admin:before { content: "Admin Group"; }
|
|
||||||
.panel_rank_tag_mod:before { content: "Mod Group"; }
|
|
||||||
.panel_rank_tag_banned:before { content: "Banned Group"; }
|
|
||||||
.panel_rank_tag_guest:before { content: "Guest Group"; }
|
|
||||||
.panel_rank_tag_member:before { content: "Member Group"; }
|
|
||||||
|
|
||||||
.forum_preset_announce:after { content: "Announcements"; }
|
|
||||||
.forum_preset_members:after { content: "Member Only"; }
|
|
||||||
.forum_preset_staff:after { content: "Staff Only"; }
|
|
||||||
.forum_preset_admins:after { content: "Admin Only"; }
|
|
||||||
.forum_preset_archive:after { content: "Archive"; }
|
|
||||||
.forum_preset_all:after { content: "Public"; }
|
|
||||||
.forum_preset_custom, .forum_preset_ { display: none !important; }
|
|
||||||
.forum_active_Hide:before { content: "Hidden"; }
|
|
||||||
.forum_active_Hide + .forum_preset:before { content: " | "; }
|
|
||||||
.forum_active_Show { display: none !important; }
|
|
||||||
|
|
||||||
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
|
||||||
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
|
||||||
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
|
||||||
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
|
||||||
.perm_preset_custom:before { content: "Custom"; color: black; }
|
|
||||||
.perm_preset_default:before { content: "Default"; }
|
|
||||||
|
|
||||||
@media(max-width: 1300px) {
|
@media(max-width: 1300px) {
|
||||||
.theme_row {
|
.theme_row {
|
||||||
background-image: none !important;
|
background-image: none !important;
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/* Control Panel */
|
||||||
|
|
||||||
|
.tag-mini {
|
||||||
|
margin-left: 0px;
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
|
||||||
|
font-family: cursive;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #202020;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_floater {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_groups > .rowitem > .panel_floater {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
#panel_groups > .rowitem > .panel_floater > .panel_right_button {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > .panel_floater {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > .panel_floater > .panel_buttons {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > span > .forum_name {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
#panel_forums > .rowitem > .panel_floater > .panel_buttons > .panel_right_button {
|
||||||
|
color: #505050;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_rank_tag, .forum_preset, .forum_active {
|
||||||
|
float: none;
|
||||||
|
color: #202020;
|
||||||
|
opacity: 0.7;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
.panel_rank_tag_admin:before { content: "Admin Group"; }
|
||||||
|
.panel_rank_tag_mod:before { content: "Mod Group"; }
|
||||||
|
.panel_rank_tag_banned:before { content: "Banned Group"; }
|
||||||
|
.panel_rank_tag_guest:before { content: "Guest Group"; }
|
||||||
|
.panel_rank_tag_member:before { content: "Member Group"; }
|
||||||
|
|
||||||
|
.forum_preset_announce:after { content: "Announcements"; }
|
||||||
|
.forum_preset_members:after { content: "Member Only"; }
|
||||||
|
.forum_preset_staff:after { content: "Staff Only"; }
|
||||||
|
.forum_preset_admins:after { content: "Admin Only"; }
|
||||||
|
.forum_preset_archive:after { content: "Archive"; }
|
||||||
|
.forum_preset_all:after { content: "Public"; }
|
||||||
|
.forum_preset_custom, .forum_preset_ { display: none !important; }
|
||||||
|
.forum_active_Hide:before { content: "Hidden"; }
|
||||||
|
.forum_active_Hide + .forum_preset:before { content: " | "; }
|
||||||
|
.forum_active_Show { display: none !important; }
|
||||||
|
|
||||||
|
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
||||||
|
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
||||||
|
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
||||||
|
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
||||||
|
.perm_preset_custom:before { content: "Custom"; color: black; }
|
||||||
|
.perm_preset_default:before { content: "Default"; }
|
|
@ -211,11 +211,8 @@ li a {
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
.grid_istat {
|
|
||||||
/*margin-bottom: 10px;*/
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
.grid_istat { margin-bottom: 5px; }
|
||||||
.stat_green { background-color: lightgreen; border-color: lightgreen; }
|
.stat_green { background-color: lightgreen; border-color: lightgreen; }
|
||||||
.stat_orange { background-color: #ffe4b3; border-color: #ffe4b3; }
|
.stat_orange { background-color: #ffe4b3; border-color: #ffe4b3; }
|
||||||
.stat_red { background-color: #ffb2b2; border-color: #ffb2b2; }
|
.stat_red { background-color: #ffb2b2; border-color: #ffb2b2; }
|
||||||
|
@ -336,21 +333,6 @@ button.username { position: relative; top: -0.25px; }
|
||||||
.username.real_username:hover { color: black; }
|
.username.real_username:hover { color: black; }
|
||||||
.post_item > .username { margin-top: 20px; display: inline-block; }
|
.post_item > .username { margin-top: 20px; display: inline-block; }
|
||||||
|
|
||||||
.tag-mini {
|
|
||||||
text-transform: none;
|
|
||||||
margin-left: 0px;
|
|
||||||
padding-left: 3px;
|
|
||||||
padding-right: 3px;
|
|
||||||
padding-top: 1.5px;
|
|
||||||
padding-bottom: 0px;
|
|
||||||
color: #505050; /* 80,80,80 */
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
border-style: dotted;
|
|
||||||
border-color: #505050; /* 232,232,232. All three RGB colours being the same seems to create a shade of gray */
|
|
||||||
border-width: 1px;
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.post_item > .mod_button > button {
|
.post_item > .mod_button > button {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #202020;
|
color: #202020;
|
||||||
|
@ -358,10 +340,7 @@ button.username { position: relative; top: -0.25px; }
|
||||||
}
|
}
|
||||||
.post_item > .mod_button > button:hover { opacity: 0.9; }
|
.post_item > .mod_button > button:hover { opacity: 0.9; }
|
||||||
|
|
||||||
.mod_button {
|
.mod_button { margin-right: 4px; }
|
||||||
margin-right: 4px;
|
|
||||||
/*z-index: 10;*/
|
|
||||||
}
|
|
||||||
.like_label:before, .like_count_label:before { content: "😀"; }
|
.like_label:before, .like_count_label:before { content: "😀"; }
|
||||||
.like_count_label {
|
.like_count_label {
|
||||||
color: #505050;
|
color: #505050;
|
||||||
|
@ -470,44 +449,6 @@ button.username { position: relative; top: -0.25px; }
|
||||||
top: -2px;
|
top: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Control Panel */
|
|
||||||
|
|
||||||
.panel_upshift {
|
|
||||||
font-size: 18px;
|
|
||||||
position: relative;
|
|
||||||
top: -2px;
|
|
||||||
}
|
|
||||||
.panel_upshift:visited { color: black; }
|
|
||||||
/*.panel_tag_upshift {
|
|
||||||
margin-left: 2px;
|
|
||||||
position: relative;
|
|
||||||
top:-3px;
|
|
||||||
color: #505050;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
.panel_floater { float: right; }
|
|
||||||
.panel_rank_tag_admin:before { content: "👑"; }
|
|
||||||
.panel_rank_tag_mod:before { content: "👮"; }
|
|
||||||
.panel_rank_tag_banned:before { content: "⛓️"; }
|
|
||||||
.panel_rank_tag_guest:before { content: "👽"; }
|
|
||||||
.panel_rank_tag_member:before { content: "👪"; }
|
|
||||||
|
|
||||||
.forum_preset_announce:before { content: "📣"; }
|
|
||||||
.forum_preset_members:before { content: "👪"; }
|
|
||||||
.forum_preset_staff:before { content: "👮"; }
|
|
||||||
.forum_preset_admins:before { content: "👑"; }
|
|
||||||
.forum_preset_archive:before { content: "☠️"; }
|
|
||||||
.forum_preset_all, .forum_preset_custom, .forum_preset_ { display: none !important; }
|
|
||||||
.forum_active_Hide:before { content: "🕵️"; }
|
|
||||||
.forum_active_Show { display: none !important; }
|
|
||||||
|
|
||||||
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
|
||||||
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
|
||||||
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
|
||||||
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
|
||||||
.perm_preset_custom:before { content: "Custom"; color: black; }
|
|
||||||
.perm_preset_default:before { content: "Default"; }
|
|
||||||
|
|
||||||
@media (max-width: 880px) {
|
@media (max-width: 880px) {
|
||||||
li {
|
li {
|
||||||
height: 29px;
|
height: 29px;
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
/* Control Panel */
|
||||||
|
|
||||||
|
.tag-mini {
|
||||||
|
text-transform: none;
|
||||||
|
margin-left: 0px;
|
||||||
|
padding-left: 3px;
|
||||||
|
padding-right: 3px;
|
||||||
|
padding-top: 1.5px;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
color: #505050; /* 80,80,80 */
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border-style: dotted;
|
||||||
|
border-color: #505050; /* 232,232,232. All three RGB colours being the same seems to create a shade of gray */
|
||||||
|
border-width: 1px;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel_upshift {
|
||||||
|
font-size: 18px;
|
||||||
|
position: relative;
|
||||||
|
top: -2px;
|
||||||
|
}
|
||||||
|
.panel_upshift:visited { color: black; }
|
||||||
|
/*.panel_tag_upshift {
|
||||||
|
margin-left: 2px;
|
||||||
|
position: relative;
|
||||||
|
top:-3px;
|
||||||
|
color: #505050;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
.panel_floater { float: right; }
|
||||||
|
.panel_rank_tag_admin:before { content: "👑"; }
|
||||||
|
.panel_rank_tag_mod:before { content: "👮"; }
|
||||||
|
.panel_rank_tag_banned:before { content: "⛓️"; }
|
||||||
|
.panel_rank_tag_guest:before { content: "👽"; }
|
||||||
|
.panel_rank_tag_member:before { content: "👪"; }
|
||||||
|
|
||||||
|
.forum_preset_announce:before { content: "📣"; }
|
||||||
|
.forum_preset_members:before { content: "👪"; }
|
||||||
|
.forum_preset_staff:before { content: "👮"; }
|
||||||
|
.forum_preset_admins:before { content: "👑"; }
|
||||||
|
.forum_preset_archive:before { content: "☠️"; }
|
||||||
|
.forum_preset_all, .forum_preset_custom, .forum_preset_ { display: none !important; }
|
||||||
|
.forum_active_Hide:before { content: "🕵️"; }
|
||||||
|
.forum_active_Show { display: none !important; }
|
||||||
|
|
||||||
|
.perm_preset_no_access:before { content: "No Access"; color: maroon; }
|
||||||
|
.perm_preset_read_only:before { content: "Read Only"; color: green; }
|
||||||
|
.perm_preset_can_post:before { content: "Can Post"; color: green; }
|
||||||
|
.perm_preset_can_moderate:before { content: "Can Moderate"; color: darkblue; }
|
||||||
|
.perm_preset_custom:before { content: "Custom"; color: black; }
|
||||||
|
.perm_preset_default:before { content: "Default"; }
|
35
user.go
35
user.go
|
@ -12,6 +12,8 @@ import (
|
||||||
|
|
||||||
var guest_user User = User{ID:0,Group:6,Perms:GuestPerms}
|
var guest_user User = User{ID:0,Group:6,Perms:GuestPerms}
|
||||||
var SimpleSessionCheck func(http.ResponseWriter, *http.Request) (User,bool) = _simple_session_check
|
var SimpleSessionCheck func(http.ResponseWriter, *http.Request) (User,bool) = _simple_session_check
|
||||||
|
var PanelSessionCheck func(http.ResponseWriter, *http.Request) (User,HeaderVars,bool) = _panel_session_check
|
||||||
|
var SimplePanelSessionCheck func(http.ResponseWriter, *http.Request) (User,bool) = _simple_panel_session_check
|
||||||
|
|
||||||
type User struct
|
type User struct
|
||||||
{
|
{
|
||||||
|
@ -105,10 +107,10 @@ func SimpleForumSessionCheck(w http.ResponseWriter, r *http.Request, fid int) (u
|
||||||
return user, success
|
return user, success
|
||||||
}
|
}
|
||||||
|
|
||||||
func ForumSessionCheck(w http.ResponseWriter, r *http.Request, fid int) (user User, noticeList []string, success bool) {
|
func ForumSessionCheck(w http.ResponseWriter, r *http.Request, fid int) (user User, headerVars HeaderVars, success bool) {
|
||||||
if !forum_exists(fid) {
|
if !forum_exists(fid) {
|
||||||
NotFound(w,r)
|
NotFound(w,r)
|
||||||
return user, noticeList, false
|
return user, headerVars, false
|
||||||
}
|
}
|
||||||
user, success = SimpleSessionCheck(w,r)
|
user, success = SimpleSessionCheck(w,r)
|
||||||
fperms := groups[user.Group].Forums[fid]
|
fperms := groups[user.Group].Forums[fid]
|
||||||
|
@ -133,17 +135,36 @@ func ForumSessionCheck(w http.ResponseWriter, r *http.Request, fid int) (user Us
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if user.Is_Banned {
|
if user.Is_Banned {
|
||||||
noticeList = append(noticeList,"Your account has been suspended. Some of your permissions may have been revoked.")
|
headerVars.NoticeList = append(headerVars.NoticeList,"Your account has been suspended. Some of your permissions may have been revoked.")
|
||||||
}
|
}
|
||||||
return user, noticeList, success
|
return user, headerVars, success
|
||||||
}
|
}
|
||||||
|
|
||||||
func SessionCheck(w http.ResponseWriter, r *http.Request) (user User, noticeList []string, success bool) {
|
// 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
|
||||||
|
func _panel_session_check(w http.ResponseWriter, r *http.Request) (user User, headerVars HeaderVars, success bool) {
|
||||||
|
user, success = SimpleSessionCheck(w,r)
|
||||||
|
if !user.Is_Super_Mod {
|
||||||
|
NoPermissions(w,r,user)
|
||||||
|
return user, headerVars, false
|
||||||
|
}
|
||||||
|
headerVars.Stylesheets = append(headerVars.Stylesheets,"panel")
|
||||||
|
return user, headerVars, success
|
||||||
|
}
|
||||||
|
func _simple_panel_session_check(w http.ResponseWriter, r *http.Request) (user User, success bool) {
|
||||||
|
user, success = SimpleSessionCheck(w,r)
|
||||||
|
if !user.Is_Super_Mod {
|
||||||
|
NoPermissions(w,r,user)
|
||||||
|
return user, false
|
||||||
|
}
|
||||||
|
return user, success
|
||||||
|
}
|
||||||
|
|
||||||
|
func SessionCheck(w http.ResponseWriter, r *http.Request) (user User, headerVars HeaderVars, success bool) {
|
||||||
user, success = SimpleSessionCheck(w,r)
|
user, success = SimpleSessionCheck(w,r)
|
||||||
if user.Is_Banned {
|
if user.Is_Banned {
|
||||||
noticeList = append(noticeList,"Your account has been suspended. Some of your permissions may have been revoked.")
|
headerVars.NoticeList = append(headerVars.NoticeList,"Your account has been suspended. Some of your permissions may have been revoked.")
|
||||||
}
|
}
|
||||||
return user, noticeList, success
|
return user, headerVars, success
|
||||||
}
|
}
|
||||||
|
|
||||||
func _simple_session_check(w http.ResponseWriter, r *http.Request) (User,bool) {
|
func _simple_session_check(w http.ResponseWriter, r *http.Request) (User,bool) {
|
||||||
|
|
Loading…
Reference in New Issue