Added the Cosmo and Cosmo Conflux themes. Freshly ported over from one of my other projects.

The porting is still underway, part of it relies on functionality which hasn't be implemented in Gosora yet like sidebars and alerts.

Restructured the BBCode parser plugin.
Added the [code] tag to the BBCode parser. Disabled by default for now.
Added a benchmark for comparing performance between when [code] is enabled and when it isn't.
Tweaked the templates to make them more flexible, thus allowing a wider variety of themes.
Images of the themes can now be found in the Theme Manager.
There's an emoji on each theme row to show which themes are mobile friendly and which aren't.
Fixed editing and deleting posts on Tempra Conflux.
Moved a large portion of the inline CSS in the topic_alt template into the stylesheets.
This commit is contained in:
Azareal 2017-01-07 06:31:04 +00:00
parent 5ef65be135
commit bbbd0c381f
54 changed files with 2576 additions and 141 deletions

View File

@ -92,6 +92,13 @@ Experimental plugins aka the ones in the /experimental/ folder (e.g. plugin_send
We're looking for ways to clean-up the plugin system so that all of them (except the experimental ones) are housed in /extend/, however we've encountered some problems with Go's packaging system. We plan to fix this issue in the future.
# Images
[[https://github.com/Azareal/Gosora/blob/master/images/tempra-simple.png|alt=Tempra Simple Theme]]
[[https://github.com/Azareal/Gosora/blob/master/images/tempra-conflux.png|alt=Tempra Conflux Theme]]
[[https://github.com/Azareal/Gosora/blob/master/images/cosmo-conflux.png|alt=Cosmo Conflux Theme]]
[[https://github.com/Azareal/Gosora/blob/master/images/cosmo.png|alt=Cosmo Theme]]
# TO-DO
Oh my, you caught me right at the start of this project. There's nothing to see here yet, asides from the absolute basics. You might want to look again later!

View File

@ -1,7 +1,13 @@
package main
import "io"
import "os"
import "log"
import "strings"
import "mime"
import "errors"
import "os"
import "io"
import "io/ioutil"
import "path/filepath"
import "net/http"
type SFile struct
{
@ -49,3 +55,25 @@ func (r SFile) Seek(offset int64, whence int) (int64, error) {
}
return r.Pos, nil
}
func add_static_file(path string, prefix string) error {
data, err := ioutil.ReadFile(path)
if err != nil {
return err
}
fi, err := os.Open(path)
if err != nil {
return err
}
f, err := fi.Stat()
if err != nil {
return err
}
log.Print("Adding the '" + path + "' static file")
path = strings.TrimPrefix(path, prefix)
log.Print("Added the '" + path + "' static file")
static_files["/static" + path] = SFile{data,0,int64(len(data)),mime.TypeByExtension(filepath.Ext(prefix + path)),f,f.ModTime().UTC().Format(http.TimeFormat)}
return nil
}

View File

@ -752,96 +752,145 @@ func BenchmarkBBCodePluginWithRegexp(b *testing.B) {
b.ReportAllocs()
b.Run("empty_post", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse("")
_ = bbcode_regex_parse("")
}
})
b.Run("short_post", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse("Hey everyone, how's it going?")
_ = bbcode_regex_parse("Hey everyone, how's it going?")
}
})
b.Run("one_smily", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse("Hey everyone, how's it going? :)")
_ = bbcode_regex_parse("Hey everyone, how's it going? :)")
}
})
b.Run("five_smilies", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse("Hey everyone, how's it going? :):):):):)")
_ = bbcode_regex_parse("Hey everyone, how's it going? :):):):):)")
}
})
b.Run("ten_smilies", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse("Hey everyone, how's it going? :):):):):):):):):):)")
_ = bbcode_regex_parse("Hey everyone, how's it going? :):):):):):):):):):)")
}
})
b.Run("twenty_smilies", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse("Hey everyone, how's it going? :):):):):):):):):):):):):):):):):):):):)")
_ = bbcode_regex_parse("Hey everyone, how's it going? :):):):):):):):):):):):):):):):):):):):)")
}
})
b.Run("one_bold", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse("[b]H[/b]ey everyone, how's it going?")
_ = bbcode_regex_parse("[b]H[/b]ey everyone, how's it going?")
}
})
b.Run("five_bold", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b]eryone, how's it going?")
_ = bbcode_regex_parse("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b]eryone, how's it going?")
}
})
b.Run("ten_bold", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b][b]e[/b][b]r[/b][b]y[/b][b]o[/b][b]n[/b]e, how's it going?")
_ = bbcode_regex_parse("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b][b]e[/b][b]r[/b][b]y[/b][b]o[/b][b]n[/b]e, how's it going?")
}
})
}
func BenchmarkBBCodePluginWithCustomParser(b *testing.B) {
func BenchmarkBBCodePluginWithoutCodeTag(b *testing.B) {
b.ReportAllocs()
b.Run("empty_post", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse2("")
_ = bbcode_parse_without_code("")
}
})
b.Run("short_post", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse2("Hey everyone, how's it going?")
_ = bbcode_parse_without_code("Hey everyone, how's it going?")
}
})
b.Run("one_smily", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse2("Hey everyone, how's it going? :)")
_ = bbcode_parse_without_code("Hey everyone, how's it going? :)")
}
})
b.Run("five_smilies", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse2("Hey everyone, how's it going? :):):):):)")
_ = bbcode_parse_without_code("Hey everyone, how's it going? :):):):):)")
}
})
b.Run("ten_smilies", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse2("Hey everyone, how's it going? :):):):):):):):):):)")
_ = bbcode_parse_without_code("Hey everyone, how's it going? :):):):):):):):):):)")
}
})
b.Run("twenty_smilies", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse2("Hey everyone, how's it going? :):):):):):):):):):):):):):):):):):):):)")
_ = bbcode_parse_without_code("Hey everyone, how's it going? :):):):):):):):):):):):):):):):):):):):)")
}
})
b.Run("one_bold", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse2("[b]H[/b]ey everyone, how's it going?")
_ = bbcode_parse_without_code("[b]H[/b]ey everyone, how's it going?")
}
})
b.Run("five_bold", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse2("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b]eryone, how's it going?")
_ = bbcode_parse_without_code("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b]eryone, how's it going?")
}
})
b.Run("ten_bold", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_parse2("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b][b]e[/b][b]r[/b][b]y[/b][b]o[/b][b]n[/b]e, how's it going?")
_ = bbcode_parse_without_code("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b][b]e[/b][b]r[/b][b]y[/b][b]o[/b][b]n[/b]e, how's it going?")
}
})
}
func BenchmarkBBCodePluginWithFullParser(b *testing.B) {
b.ReportAllocs()
b.Run("empty_post", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_full_parse("")
}
})
b.Run("short_post", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_full_parse("Hey everyone, how's it going?")
}
})
b.Run("one_smily", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_full_parse("Hey everyone, how's it going? :)")
}
})
b.Run("five_smilies", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_full_parse("Hey everyone, how's it going? :):):):):)")
}
})
b.Run("ten_smilies", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_full_parse("Hey everyone, how's it going? :):):):):):):):):):)")
}
})
b.Run("twenty_smilies", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_full_parse("Hey everyone, how's it going? :):):):):):):):):):):):):):):):):):):):)")
}
})
b.Run("one_bold", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_full_parse("[b]H[/b]ey everyone, how's it going?")
}
})
b.Run("five_bold", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_full_parse("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b]eryone, how's it going?")
}
})
b.Run("ten_bold", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = bbcode_full_parse("[b]H[/b][b]e[/b][b]y[/b] [b]e[/b][b]v[/b][b]e[/b][b]r[/b][b]y[/b][b]o[/b][b]n[/b]e, how's it going?")
}
})
}

BIN
images/cosmo-conflux.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 KiB

BIN
images/cosmo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

BIN
images/tempra-simple.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

View File

@ -1255,7 +1255,10 @@ func route_panel_themes(w http.ResponseWriter, r *http.Request){
}
pi := Page{"Theme Manager","panel-themes",user,noticeList,themeList,0}
templates.ExecuteTemplate(w,"panel-themes.html", pi)
err := templates.ExecuteTemplate(w,"panel-themes.html", pi)
if err != nil {
log.Print(err)
}
}
func route_panel_themes_default(w http.ResponseWriter, r *http.Request){

View File

Before

Width:  |  Height:  |  Size: 244 KiB

After

Width:  |  Height:  |  Size: 244 KiB

View File

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 309 KiB

View File

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

View File

@ -1,4 +1,5 @@
package main
//import "strings"
import "regexp"
var bbcode_bold *regexp.Regexp
@ -13,7 +14,9 @@ func init() {
}
func init_bbcode() {
plugins["bbcode"].AddHook("parse_assign", bbcode_parse2)
plugins["bbcode"].AddHook("parse_assign", bbcode_parse_without_code)
//plugins["bbcode"].AddHook("parse_assign", bbcode_full_parse)
bbcode_bold = regexp.MustCompile(`(?s)\[b\](.*)\[/b\]`)
bbcode_italic = regexp.MustCompile(`(?s)\[i\](.*)\[/i\]`)
bbcode_underline = regexp.MustCompile(`(?s)\[u\](.*)\[/u\]`)
@ -24,10 +27,11 @@ func init_bbcode() {
}
func deactivate_bbcode() {
plugins["bbcode"].RemoveHook("parse_assign", bbcode_parse2)
plugins["bbcode"].RemoveHook("parse_assign", bbcode_parse_without_code)
//plugins["bbcode"].RemoveHook("parse_assign", bbcode_full_parse)
}
func bbcode_parse(data interface{}) interface{} {
func bbcode_regex_parse(data interface{}) interface{} {
msg := data.(string)
msg = bbcode_bold.ReplaceAllString(msg,"<b>$1</b>")
msg = bbcode_italic.ReplaceAllString(msg,"<i>$1</i>")
@ -38,7 +42,47 @@ func bbcode_parse(data interface{}) interface{} {
return msg
}
func bbcode_parse2(data interface{}) interface{} {
// Only does the simple BBCode like [u], [b], [i] and [s]
func bbcode_simple_parse(data interface{}) interface{} {
msg := data.(string)
msgbytes := []byte(msg)
has_u := false
has_b := false
has_i := false
has_s := false
for i := 0; i < len(msgbytes); i++ {
if msgbytes[i] == '[' && msgbytes[i + 2] == ']' {
if msgbytes[i + 1] == 'b' {
msgbytes[i] = '<'
msgbytes[i + 2] = '>'
has_b = true
} else if msgbytes[i + 1] == 'i' {
msgbytes[i] = '<'
msgbytes[i + 2] = '>'
has_i = true
} else if msgbytes[i + 1] == 'u' {
msgbytes[i] = '<'
msgbytes[i + 2] = '>'
has_u = true
} else if msgbytes[i + 1] == 's' {
msgbytes[i] = '<'
msgbytes[i + 2] = '>'
has_s = true
}
i += 2
}
}
// There's an unclosed tag in there x.x
if has_i || has_u || has_b || has_s {
closer := []byte("</u></i></b></s>")
msgbytes = append(msgbytes, closer...)
}
return string(msgbytes)
}
// Here for benchmarking purposes. Might add a plugin setting for disabling [code] as it has it's paws everywhere
func bbcode_parse_without_code(data interface{}) interface{} {
msg := data.(string)
msgbytes := []byte(msg)
has_u := false
@ -111,3 +155,91 @@ func bbcode_parse2(data interface{}) interface{} {
}
return msg
}
// Does every type of BBCode
func bbcode_full_parse(data interface{}) interface{} {
msg := data.(string)
msgbytes := []byte(msg)
has_u := false
has_b := false
has_i := false
has_s := false
has_c := false
complex_bbc := false
for i := 0; i < len(msgbytes); i++ {
if msgbytes[i] == '[' {
if msgbytes[i + 2] != ']' {
if msgbytes[i + 1] == '/' {
if msgbytes[i + 3] == ']' {
if !has_c {
if msgbytes[i + 2] == 'b' {
msgbytes[i] = '<'
msgbytes[i + 3] = '>'
has_b = false
} else if msgbytes[i + 2] == 'i' {
msgbytes[i] = '<'
msgbytes[i + 3] = '>'
has_i = false
} else if msgbytes[i + 2] == 'u' {
msgbytes[i] = '<'
msgbytes[i + 3] = '>'
has_u = false
} else if msgbytes[i + 2] == 's' {
msgbytes[i] = '<'
msgbytes[i + 3] = '>'
has_s = false
}
i += 3
}
} else {
if msgbytes[i + 2] == 'c' && msgbytes[i + 3] == 'o' && msgbytes[i + 4] == 'd' && msgbytes[i + 5] == 'e' {
has_c = false
i += 6
}
complex_bbc = true
}
} else {
if msgbytes[i + 1] == 'c' && msgbytes[i + 2] == 'o' && msgbytes[i + 3] == 'd' && msgbytes[i + 4] == 'e' {
has_c = true
i += 5
}
complex_bbc = true
}
} else if !has_c {
if msgbytes[i + 1] == 'b' {
msgbytes[i] = '<'
msgbytes[i + 2] = '>'
has_b = true
} else if msgbytes[i + 1] == 'i' {
msgbytes[i] = '<'
msgbytes[i + 2] = '>'
has_i = true
} else if msgbytes[i + 1] == 'u' {
msgbytes[i] = '<'
msgbytes[i + 2] = '>'
has_u = true
} else if msgbytes[i + 1] == 's' {
msgbytes[i] = '<'
msgbytes[i + 2] = '>'
has_s = true
}
i += 2
}
}
}
// There's an unclosed tag in there x.x
if has_i || has_u || has_b || has_s {
closer := []byte("</u></i></b></s>")
msgbytes = append(msgbytes, closer...)
}
msg = string(msgbytes)
if complex_bbc {
msg = bbcode_url.ReplaceAllString(msg,"<a href=\"$1$2//$3\" rel=\"nofollow\">$1$2//$3</i>")
msg = bbcode_url_label.ReplaceAllString(msg,"<a href=\"$1$2//$3\" rel=\"nofollow\">$4</i>")
//msg = strings.Replace(msg,"[code]","",-1)
//msg = strings.Replace(msg,"[/code]","",-1)
}
return msg
}

View File

@ -58,7 +58,7 @@ w.Write([]byte(`
</div>
<div style="clear: both;"></div>
</div>
`))
<div id="back"><div id="main">`))
if len(tmpl_forum_vars.NoticeList) != 0 {
for _, item := range tmpl_forum_vars.NoticeList {
w.Write([]byte(`<div class="alert">` + item + `</div>`))
@ -66,7 +66,7 @@ w.Write([]byte(`<div class="alert">` + item + `</div>`))
}
w.Write([]byte(`
<div class="rowblock">
<div class="rowitem"><a>` + tmpl_forum_vars.Title + `</a></div>
<div class="rowitem rowhead"><a>` + tmpl_forum_vars.Title + `</a></div>
</div>
<div class="rowblock">
`))
@ -102,7 +102,7 @@ w.Write([]byte(`<div class="rowitem passive">There aren't any topics in this for
w.Write([]byte(`
</div>
<!--<link rel="stylesheet" href="https://use.fontawesome.com/8670aa03ca.css">-->
</div>
</div><div style="clear: both;"></div></div></div>
</body>
</html>`))
}

View File

@ -58,7 +58,7 @@ w.Write([]byte(`
</div>
<div style="clear: both;"></div>
</div>
`))
<div id="back"><div id="main">`))
if len(tmpl_forums_vars.NoticeList) != 0 {
for _, item := range tmpl_forums_vars.NoticeList {
w.Write([]byte(`<div class="alert">` + item + `</div>`))
@ -81,7 +81,7 @@ w.Write([]byte(`<div class="rowitem passive">You don't have access to any forums
w.Write([]byte(`
</div>
<!--<link rel="stylesheet" href="https://use.fontawesome.com/8670aa03ca.css">-->
</div>
</div><div style="clear: both;"></div></div></div>
</body>
</html>`))
}

View File

@ -58,7 +58,7 @@ w.Write([]byte(`
</div>
<div style="clear: both;"></div>
</div>
`))
<div id="back"><div id="main">`))
if len(tmpl_profile_vars.NoticeList) != 0 {
for _, item := range tmpl_profile_vars.NoticeList {
w.Write([]byte(`<div class="alert">` + item + `</div>`))
@ -93,7 +93,7 @@ w.Write([]byte(`
</div>
</div>
<div class="colblock_right">
<div class="rowitem"><a>Comments</a></div>
<div class="rowitem rowhead"><a>Comments</a></div>
</div>
<div class="colblock_right" style="overflow: hidden;">
`))
@ -147,7 +147,7 @@ w.Write([]byte(`
}
w.Write([]byte(`
<!--<link rel="stylesheet" href="https://use.fontawesome.com/8670aa03ca.css">-->
</div>
</div><div style="clear: both;"></div></div></div>
</body>
</html>`))
}

View File

@ -1,8 +1,8 @@
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
package main
import "html/template"
import "io"
import "strconv"
import "html/template"
func init() {
template_topic_handle = template_topic
@ -59,7 +59,7 @@ w.Write([]byte(`
</div>
<div style="clear: both;"></div>
</div>
`))
<div id="back"><div id="main">`))
if len(tmpl_topic_vars.NoticeList) != 0 {
for _, item := range tmpl_topic_vars.NoticeList {
w.Write([]byte(`<div class="alert">` + item + `</div>`))
@ -136,7 +136,7 @@ w.Write([]byte(`
if len(tmpl_topic_vars.ItemList) != 0 {
for _, item := range tmpl_topic_vars.ItemList {
w.Write([]byte(`
<div class="rowitem passive deletable_block editable_parent post_item" style="`))
<div class="rowitem rowhead passive deletable_block editable_parent post_item" style="`))
if item.Avatar != "" {
w.Write([]byte(`background-image: url(` + item.Avatar + `), url(/static/white-dot.jpg);background-position: 0px `))
if item.ContentLines <= 5 {
@ -191,7 +191,7 @@ w.Write([]byte(`
}
w.Write([]byte(`
<!--<link rel="stylesheet" href="https://use.fontawesome.com/8670aa03ca.css">-->
</div>
</div><div style="clear: both;"></div></div></div>
</body>
</html>`))
}

View File

@ -59,7 +59,7 @@ w.Write([]byte(`
</div>
<div style="clear: both;"></div>
</div>
`))
<div id="back"><div id="main">`))
if len(tmpl_topic_alt_vars.NoticeList) != 0 {
for _, item := range tmpl_topic_alt_vars.NoticeList {
w.Write([]byte(`<div class="alert">` + item + `</div>`))
@ -68,43 +68,41 @@ w.Write([]byte(`<div class="alert">` + item + `</div>`))
w.Write([]byte(`
<div class="rowblock">
<form action='/topic/edit/submit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `' method="post">
<div class="rowitem" style="`))
<div class="rowitem rowhead`))
if tmpl_topic_alt_vars.Topic.Sticky {
w.Write([]byte(`background-color: #FFFFEA;background: linear-gradient(to bottom, hsl(60, 70%, 96%), hsl(60, 70%, 89%)), url('/static/fabric-base-simple-alpha.png');`))
w.Write([]byte(` topic_sticky_head`))
} else {
if tmpl_topic_alt_vars.Topic.Is_Closed {
w.Write([]byte(`background-color: #eaeaea;background: linear-gradient(to bottom, #eaeaea, hsl(0,0%,79%));`))
} else {
w.Write([]byte(`background: linear-gradient(to bottom, white, hsl(0, 0%, 93%));`))
w.Write([]byte(` topic_closed_head`))
}
}
w.Write([]byte(`">
<a class='topic_name hide_on_edit'>` + tmpl_topic_alt_vars.Topic.Title + `</a>
<span class='username hide_on_micro topic_status_e topic_status_` + tmpl_topic_alt_vars.Topic.Status + ` hide_on_edit' style="font-weight:normal;float: right;">` + tmpl_topic_alt_vars.Topic.Status + `</span>
<span class="username hide_on_micro" style="border-right: 0;font-weight: normal;float: right;">Status</span>
<span class="username hide_on_micro status_label" style="border-right: 0;font-weight: normal;float: right;">Status</span>
`))
if tmpl_topic_alt_vars.CurrentUser.Is_Mod {
w.Write([]byte(`
<a href='/topic/edit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `' class="username hide_on_edit open_edit" style="font-weight: normal;margin-left: 6px;">Edit</a>
<a href='/topic/delete/submit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `' class="username" style="font-weight: normal;">Delete</a>
<a href='/topic/edit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `' class="username hide_on_edit open_edit topic_button" style="font-weight: normal;margin-left: 6px;">Edit</a>
<a href='/topic/delete/submit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `' class="username topic_button" style="font-weight: normal;">Delete</a>
`))
if tmpl_topic_alt_vars.Topic.Sticky {
w.Write([]byte(`<a href='/topic/unstick/submit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `' class="username" style="font-weight: normal;">Unpin</a>`))
w.Write([]byte(`<a href='/topic/unstick/submit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `' class="username topic_button" style="font-weight: normal;">Unpin</a>`))
} else {
w.Write([]byte(`<a href='/topic/stick/submit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `' class="username" style="font-weight: normal;">Pin</a>`))
w.Write([]byte(`<a href='/topic/stick/submit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `' class="username topic_button" style="font-weight: normal;">Pin</a>`))
}
w.Write([]byte(`
<input class='show_on_edit topic_name_input' name="topic_name" value='` + tmpl_topic_alt_vars.Topic.Title + `' type="text" />
<select name="topic_status" class='show_on_edit topic_status_input' style='float: right;'>
<option>open</option>
<option>shut</option>
<option>closed</option>
</select>
<button name="topic-button" class="formbutton show_on_edit submit_edit">Update</button>
`))
}
w.Write([]byte(`
<a href="/report/submit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `?session=` + tmpl_topic_alt_vars.CurrentUser.Session + `&type=topic" class="username report_item" style="font-weight: normal;">Report</a>
<a href="/report/submit/` + strconv.Itoa(tmpl_topic_alt_vars.Topic.ID) + `?session=` + tmpl_topic_alt_vars.CurrentUser.Session + `&type=topic" class="username report_item topic_button" style="font-weight: normal;">Report</a>
</div>
</form>
</div>
@ -114,37 +112,49 @@ w.Write([]byte(`
<div class="userinfo" style="background: white;width: 132px;padding: 2px;margin-top: 2px;float: left;position: sticky;top: 4px;box-shadow:0 1px 2px rgba(0,0,0,.1);">
<div class="avatar_item" style="background-image: url(` + tmpl_topic_alt_vars.Topic.Avatar + `), url(/static/white-dot.jpg);background-position: 0px -10px;background-repeat: no-repeat, repeat-y;background-size: 128px;width: 128px;height: 100%;min-height: 128px;border-style: solid;border-color: #eaeaea;border-width: 1px;">&nbsp;</div>
<div class="the_name" style="margin-top: 3px;text-align: center;color: #505050;">` + tmpl_topic_alt_vars.Topic.CreatedByName + `</div>
`))
if tmpl_topic_alt_vars.Topic.Tag != "" {
w.Write([]byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">` + tmpl_topic_alt_vars.Topic.Tag + `</div><div class="tag_post"></div></div>`))
}
w.Write([]byte(`
</div>
<div class="content_container" style="background: white;margin-left: 137px;min-height: 128px;margin-bottom: 0;margin-right: 3px;box-shadow:0 1px 2px rgba(0,0,0,.1);">
<div class="hide_on_edit topic_content user_content" style="padding: 5px;margin-top: 3px;margin-bottom: 0;background: white;min-height: 153px;padding-bottom: 0;width: 100%;">` + string(tmpl_topic_alt_vars.Topic.Content.(template.HTML)) + `</div>
<div class="content_container">
<div class="hide_on_edit topic_content user_content" style="min-height: 153px;">` + string(tmpl_topic_alt_vars.Topic.Content.(template.HTML)) + `</div>
<textarea name="topic_content" class="show_on_edit topic_content_input">` + string(tmpl_topic_alt_vars.Topic.Content.(template.HTML)) + `</textarea>
</div>
<div style="clear:both;"></div>
</div>
`))
if len(tmpl_topic_alt_vars.ItemList) != 0 {
for _, item := range tmpl_topic_alt_vars.ItemList {
w.Write([]byte(`
<div class="rowitem passive deletable_block editable_parent post_item" style="background-color: #eaeaea;padding-top: 4px;padding-left: 5px;clear: both;border-bottom: none;padding-right: 4px;padding-bottom: 2px;">
<div class="userinfo" style="background: white;width: 132px;padding: 2px;margin-top: 2px;float: left;position: sticky;top: 4px;box-shadow:0 1px 2px rgba(0,0,0,.1);">
<div class="rowitem passive deletable_block editable_parent post_item">
<div class="userinfo">
<div class="avatar_item" style="background-image: url(` + item.Avatar + `), url(/static/white-dot.jpg);background-position: 0px -10px;background-repeat: no-repeat, repeat-y;background-size: 128px;width: 128px;height: 100%;min-height: 128px;border-style: solid;border-color: #eaeaea;border-width: 1px;">&nbsp;</div>
<div class="the_name" style="margin-top: 3px;text-align: center;color: #505050;">` + item.CreatedByName + `</div>
`))
if item.Tag != "" {
w.Write([]byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">` + item.Tag + `</div><div class="tag_post"></div></div>`))
}
w.Write([]byte(`
</div>
<div class="content_container" style="background: white;margin-left: 137px;min-height: 128px;margin-bottom: 0;margin-right: 3px;box-shadow:0 1px 2px rgba(0,0,0,.1);">
<div class="content_container">
<div class="editable_block user_content">` + string(item.ContentHtml) + `</div>
<div class="button_container">
`))
if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply {
w.Write([]byte(`<a href="/reply/edit/submit/` + strconv.Itoa(item.ID) + `" class="action_button">Edit</a>`))
w.Write([]byte(`<a href="/reply/edit/submit/` + strconv.Itoa(item.ID) + `" class="action_button edit_item">Edit</a>`))
}
w.Write([]byte(`
`))
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply {
w.Write([]byte(`<a href="/reply/delete/submit/` + strconv.Itoa(item.ID) + `" class="action_button">Delete</a>`))
w.Write([]byte(`<a href="/reply/delete/submit/` + strconv.Itoa(item.ID) + `" class="action_button delete_item">Delete</a>`))
}
w.Write([]byte(`
<a href="/report/submit/` + strconv.Itoa(item.ID) + `?session=` + tmpl_topic_alt_vars.CurrentUser.Session + `&type=reply" class="action_button">Report</a>
<a href="/report/submit/` + strconv.Itoa(item.ID) + `?session=` + tmpl_topic_alt_vars.CurrentUser.Session + `&type=reply" class="action_button report_item">Report</a>
</div>
</div>
<div style="clear:both;"></div>
</div>
`))
}
@ -168,7 +178,7 @@ w.Write([]byte(`
}
w.Write([]byte(`
<!--<link rel="stylesheet" href="https://use.fontawesome.com/8670aa03ca.css">-->
</div>
</div><div style="clear: both;"></div></div></div>
</body>
</html>`))
}

View File

@ -58,7 +58,7 @@ w.Write([]byte(`
</div>
<div style="clear: both;"></div>
</div>
`))
<div id="back"><div id="main">`))
if len(tmpl_topics_vars.NoticeList) != 0 {
for _, item := range tmpl_topics_vars.NoticeList {
w.Write([]byte(`<div class="alert">` + item + `</div>`))
@ -66,7 +66,7 @@ w.Write([]byte(`<div class="alert">` + item + `</div>`))
}
w.Write([]byte(`
<div class="rowblock">
<div class="rowitem"><a>Topic List</a></div>
<div class="rowitem rowhead"><a>Topic List</a></div>
</div>
<div class="rowblock">
`))
@ -92,7 +92,7 @@ w.Write([]byte(`<span class="username topic_status_e topic_status_closed" style=
w.Write([]byte(`<span class="username hide_on_micro topic_status_e topic_status_open" style="float: right;">open</span>`))
}
w.Write([]byte(`
<span class="username hide_on_micro" style="border-right: 0;float: right;">Status</span>
<span class="username hide_on_micro status_label" style="border-right: 0;float: right;">Status</span>
</div>
`))
}
@ -102,7 +102,7 @@ w.Write([]byte(`<div class="rowitem passive">There aren't any topics yet.</div>`
w.Write([]byte(`
</div>
<!--<link rel="stylesheet" href="https://use.fontawesome.com/8670aa03ca.css">-->
</div>
</div><div style="clear: both;"></div></div></div>
</body>
</html>`))
}

View File

@ -1,4 +1,4 @@
<!--<link rel="stylesheet" href="https://use.fontawesome.com/8670aa03ca.css">-->
</div>
</div><div style="clear: both;"></div></div></div>
</body>
</html>

View File

@ -1,6 +1,6 @@
{{template "header.html" . }}
<div class="rowblock">
<div class="rowitem"><a>{{.Title}}</a></div>
<div class="rowitem rowhead"><a>{{.Title}}</a></div>
</div>
<div class="rowblock">
{{range .ItemList}}<div class="rowitem passive" style="{{ if .Avatar }}background-image: url({{ .Avatar }});background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;{{end}}{{ if .Sticky }}background-color: #FFFFCC;{{else if .Is_Closed}}background-color: #eaeaea;{{end}}">

View File

@ -13,4 +13,4 @@
<body>
<div class="container">
{{template "menu.html" .}}
{{range .NoticeList}}<div class="alert">{{.}}</div>{{end}}
<div id="back"><div id="main">{{range .NoticeList}}<div class="alert">{{.}}</div>{{end}}

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colblock_right">
<div class="rowitem"><a>Dashboard</a></div>
<div class="rowitem rowhead"><a>Dashboard</a></div>
</div>
<div class="colblock_right">
<div class="rowitem passive">Coming Soon...</div>

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colblock_right">
<div class="rowitem"><a>Forums</a></div>
<div class="rowitem rowhead"><a>Forums</a></div>
</div>
<div class="colblock_right">
{{range .ItemList}}
@ -15,7 +15,7 @@
{{end}}
</div><br />
<div class="colblock_right">
<div class="rowitem"><a>Add Forum</a></div>
<div class="rowitem rowhead"><a>Add Forum</a></div>
</div>
<div class="colblock_right">
<form action="/panel/forums/create/?session={{.CurrentUser.Session}}" method="post">
@ -24,7 +24,7 @@
<div class="formitem"><input name="forum-name" type="text" /></div>
</div>
<div class="formrow">
<div class="formitem"><button name="panel-button" class="formbutton">Add</div></div>
<div class="formitem"><button name="panel-button" class="formbutton">Add Forum</button></div>
</div>
</form>
</div>

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colblock_right">
<div class="rowitem"><a>Groups</a></div>
<div class="rowitem rowhead"><a>Groups</a></div>
</div>
<div class="colblock_right">
{{range .ItemList}}

View File

@ -1,5 +1,5 @@
<div class="colblock_left">
<div class="rowitem"><a href="/panel/">Control Panel</a></div>
<div class="rowitem rowhead"><a href="/panel/">Control Panel</a></div>
<div class="rowitem passive"><a href="/panel/users/">Users</a></div>
<div class="rowitem passive"><a href="/panel/groups/">Groups</a></div>
{{if .CurrentUser.Perms.ManageForums}}<div class="rowitem passive"><a href="/panel/forums/">Forums</a></div>{{end}}

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colblock_right">
<div class="rowitem"><a>Plugins</a></div>
<div class="rowitem rowhead"><a>Plugins</a></div>
</div>
<div class="colblock_right">
{{range .ItemList}}

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colblock_right">
<div class="rowitem"><a>Edit Setting</a></div>
<div class="rowitem rowhead"><a>Edit Setting</a></div>
</div>
<div class="colblock_right">
<form action="/panel/settings/edit/submit/{{.Something.Name}}?session={{.CurrentUser.Session}}" method="post">

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colblock_right">
<div class="rowitem"><a>Settings</a></div>
<div class="rowitem rowhead"><a>Settings</a></div>
</div>
<div class="colblock_right">
{{ range $key, $value := .Something }}

View File

@ -2,16 +2,17 @@
{{template "panel-menu.html" . }}
<style type="text/css">.rowitem::after {content:"";display:block;clear:both;}</style>
<div class="colblock_right">
<div class="rowitem"><a>Themes</a></div>
<div class="rowitem rowhead"><a>Themes</a></div>
</div>
<div class="colblock_right">
{{range .ItemList}}
<div class="rowitem editable_parent" style="font-weight: normal;text-transform: none;">
<div class="rowitem editable_parent" style="font-weight: normal;text-transform: none;{{if .FullImage}}background-image: url('/static/{{.FullImage}}');background-position: center;background-size: 50%;background-repeat: no-repeat;{{end}}">
<span style="float: left;">
<a href="/panel/themes/{{.Name}}" class="editable_block" style="font-size: 20px;">{{.FriendlyName}}</a><br />
<small style="margin-left: 2px;">Author: {{.Creator}}</small>
</span>
<span style="float: right;">
{{if .MobileFriendly}}<span class="username" title="Mobile Friendly">📱</span>{{end}}
{{if .Active}}<span>Default</span>{{else}}<a href="/panel/themes/default/{{.Name}}?session={{$.CurrentUser.Session}}" class="username">Make Default</a>{{end}}
</span>
</div>

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colblock_right">
<div class="rowitem"><a>User Editor</a></div>
<div class="rowitem rowhead"><a>User Editor</a></div>
</div>
<div class="colblock_right">
<form action="/panel/users/edit/submit/{{.Something.ID}}?session={{.CurrentUser.Session}}" method="post">

View File

@ -1,7 +1,7 @@
{{template "header.html" . }}
{{template "panel-menu.html" . }}
<div class="colblock_right">
<div class="rowitem"><a>Users</a></div>
<div class="rowitem rowhead"><a>Users</a></div>
</div>
<div class="colblock_right">
{{range .ItemList}}

View File

@ -13,7 +13,7 @@
</div>
</div>
<div class="colblock_right">
<div class="rowitem"><a>Comments</a></div>
<div class="rowitem rowhead"><a>Comments</a></div>
</div>
<div class="colblock_right" style="overflow: hidden;">
{{range .ItemList}}

View File

@ -32,7 +32,7 @@
</div>
</div><br />
<div class="rowblock post_container" style="overflow: hidden;">{{range .ItemList}}
<div class="rowitem passive deletable_block editable_parent post_item" style="{{ if .Avatar }}background-image: url({{.Avatar}}), url(/static/white-dot.jpg);background-position: 0px {{if le .ContentLines 5}}-1{{end}}0px;background-repeat: no-repeat, repeat-y;background-size: 128px;padding-left: 136px;{{.Css}}{{end}}">
<div class="rowitem rowhead passive deletable_block editable_parent post_item" style="{{ if .Avatar }}background-image: url({{.Avatar}}), url(/static/white-dot.jpg);background-position: 0px {{if le .ContentLines 5}}-1{{end}}0px;background-repeat: no-repeat, repeat-y;background-size: 128px;padding-left: 136px;{{.Css}}{{end}}">
<p class="editable_block user_content" style="margin: 0;padding: 0;">{{.ContentHtml}}</p><br /><br />
<a href="/user/{{.CreatedBy}}" class="username real_username">{{.CreatedByName}}</a>
{{if $.CurrentUser.Perms.EditReply}}<a href="/reply/edit/submit/{{.ID}}" class="mod_button"><button class="username edit_item">Edit</button></a>{{end}}

View File

@ -1,23 +1,23 @@
{{template "header.html" . }}
<div class="rowblock">
<form action='/topic/edit/submit/{{.Topic.ID}}' method="post">
<div class="rowitem" style="{{ if .Topic.Sticky }}background-color: #FFFFEA;background: linear-gradient(to bottom, hsl(60, 70%, 96%), hsl(60, 70%, 89%)), url('/static/fabric-base-simple-alpha.png');{{else if .Topic.Is_Closed}}background-color: #eaeaea;background: linear-gradient(to bottom, #eaeaea, hsl(0,0%,79%));{{else}}background: linear-gradient(to bottom, white, hsl(0, 0%, 93%));{{end}}">
<div class="rowitem rowhead{{ if .Topic.Sticky }} topic_sticky_head{{else if .Topic.Is_Closed}} topic_closed_head{{end}}">
<a class='topic_name hide_on_edit'>{{.Topic.Title}}</a>
<span class='username hide_on_micro topic_status_e topic_status_{{.Topic.Status}} hide_on_edit' style="font-weight:normal;float: right;">{{.Topic.Status}}</span>
<span class="username hide_on_micro" style="border-right: 0;font-weight: normal;float: right;">Status</span>
<span class="username hide_on_micro status_label" style="border-right: 0;font-weight: normal;float: right;">Status</span>
{{if .CurrentUser.Is_Mod}}
<a href='/topic/edit/{{.Topic.ID}}' class="username hide_on_edit open_edit" style="font-weight: normal;margin-left: 6px;">Edit</a>
<a href='/topic/delete/submit/{{.Topic.ID}}' class="username" style="font-weight: normal;">Delete</a>
{{ if .Topic.Sticky }}<a href='/topic/unstick/submit/{{.Topic.ID}}' class="username" style="font-weight: normal;">Unpin</a>{{else}}<a href='/topic/stick/submit/{{.Topic.ID}}' class="username" style="font-weight: normal;">Pin</a>{{end}}
<a href='/topic/edit/{{.Topic.ID}}' class="username hide_on_edit open_edit topic_button" style="font-weight: normal;margin-left: 6px;">Edit</a>
<a href='/topic/delete/submit/{{.Topic.ID}}' class="username topic_button" style="font-weight: normal;">Delete</a>
{{ if .Topic.Sticky }}<a href='/topic/unstick/submit/{{.Topic.ID}}' class="username topic_button" style="font-weight: normal;">Unpin</a>{{else}}<a href='/topic/stick/submit/{{.Topic.ID}}' class="username topic_button" style="font-weight: normal;">Pin</a>{{end}}
<input class='show_on_edit topic_name_input' name="topic_name" value='{{.Topic.Title}}' type="text" />
<select name="topic_status" class='show_on_edit topic_status_input' style='float: right;'>
<option>open</option>
<option>shut</option>
<option>closed</option>
</select>
<button name="topic-button" class="formbutton show_on_edit submit_edit">Update</button>
{{end}}
<a href="/report/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}&type=topic" class="username report_item" style="font-weight: normal;">Report</a>
<a href="/report/submit/{{.Topic.ID}}?session={{.CurrentUser.Session}}&type=topic" class="username report_item topic_button" style="font-weight: normal;">Report</a>
</div>
</form>
</div>
@ -27,26 +27,30 @@
<div class="userinfo" style="background: white;width: 132px;padding: 2px;margin-top: 2px;float: left;position: sticky;top: 4px;box-shadow:0 1px 2px rgba(0,0,0,.1);">
<div class="avatar_item" style="background-image: url({{.Topic.Avatar}}), url(/static/white-dot.jpg);background-position: 0px -10px;background-repeat: no-repeat, repeat-y;background-size: 128px;width: 128px;height: 100%;min-height: 128px;border-style: solid;border-color: #eaeaea;border-width: 1px;">&nbsp;</div>
<div class="the_name" style="margin-top: 3px;text-align: center;color: #505050;">{{.Topic.CreatedByName}}</div>
{{if .Topic.Tag}}<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">{{.Topic.Tag}}</div><div class="tag_post"></div></div>{{end}}
</div>
<div class="content_container" style="background: white;margin-left: 137px;min-height: 128px;margin-bottom: 0;margin-right: 3px;box-shadow:0 1px 2px rgba(0,0,0,.1);">
<div class="hide_on_edit topic_content user_content" style="padding: 5px;margin-top: 3px;margin-bottom: 0;background: white;min-height: 153px;padding-bottom: 0;width: 100%;">{{.Topic.Content}}</div>
<div class="content_container">
<div class="hide_on_edit topic_content user_content" style="min-height: 153px;">{{.Topic.Content}}</div>
<textarea name="topic_content" class="show_on_edit topic_content_input">{{.Topic.Content}}</textarea>
</div>
<div style="clear:both;"></div>
</div>
{{range .ItemList}}
<div class="rowitem passive deletable_block editable_parent post_item" style="background-color: #eaeaea;padding-top: 4px;padding-left: 5px;clear: both;border-bottom: none;padding-right: 4px;padding-bottom: 2px;">
<div class="userinfo" style="background: white;width: 132px;padding: 2px;margin-top: 2px;float: left;position: sticky;top: 4px;box-shadow:0 1px 2px rgba(0,0,0,.1);">
<div class="rowitem passive deletable_block editable_parent post_item">
<div class="userinfo">
<div class="avatar_item" style="background-image: url({{.Avatar}}), url(/static/white-dot.jpg);background-position: 0px -10px;background-repeat: no-repeat, repeat-y;background-size: 128px;width: 128px;height: 100%;min-height: 128px;border-style: solid;border-color: #eaeaea;border-width: 1px;">&nbsp;</div>
<div class="the_name" style="margin-top: 3px;text-align: center;color: #505050;">{{.CreatedByName}}</div>
{{if .Tag}}<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">{{.Tag}}</div><div class="tag_post"></div></div>{{end}}
</div>
<div class="content_container" style="background: white;margin-left: 137px;min-height: 128px;margin-bottom: 0;margin-right: 3px;box-shadow:0 1px 2px rgba(0,0,0,.1);">
<div class="content_container">
<div class="editable_block user_content">{{.ContentHtml}}</div>
<div class="button_container">
{{if $.CurrentUser.Perms.EditReply}}<a href="/reply/edit/submit/{{.ID}}" class="action_button">Edit</a>{{end}}
{{if $.CurrentUser.Perms.DeleteReply}}<a href="/reply/delete/submit/{{.ID}}" class="action_button">Delete</a>{{end}}
<a href="/report/submit/{{.ID}}?session={{$.CurrentUser.Session}}&type=reply" class="action_button">Report</a>
{{if $.CurrentUser.Perms.EditReply}}<a href="/reply/edit/submit/{{.ID}}" class="action_button edit_item">Edit</a>{{end}}
{{if $.CurrentUser.Perms.DeleteReply}}<a href="/reply/delete/submit/{{.ID}}" class="action_button delete_item">Delete</a>{{end}}
<a href="/report/submit/{{.ID}}?session={{$.CurrentUser.Session}}&type=reply" class="action_button report_item">Report</a>
</div>
</div>
<div style="clear:both;"></div>
</div>
{{end}}</div>
{{if .CurrentUser.Perms.CreateReply}}

View File

@ -1,12 +1,12 @@
{{template "header.html" . }}
<div class="rowblock">
<div class="rowitem"><a>Topic List</a></div>
<div class="rowitem rowhead"><a>Topic List</a></div>
</div>
<div class="rowblock">
{{range .ItemList}}<div class="rowitem passive" style="{{if .Avatar}}background-image: url({{.Avatar}});background-position: left;background-repeat: no-repeat;background-size: 64px;padding-left: 72px;{{end}}{{if .Sticky}}background-color: #FFFFCC;{{else if .Is_Closed}}background-color: #eaeaea;{{end}}">
<a href="/topic/{{.ID}}">{{.Title}}</a> {{if .Is_Closed}}<span class="username topic_status_e topic_status_closed" style="float: right;">shut</span>
{{else}}<span class="username hide_on_micro topic_status_e topic_status_open" style="float: right;">open</span>{{end}}
<span class="username hide_on_micro" style="border-right: 0;float: right;">Status</span>
<span class="username hide_on_micro status_label" style="border-right: 0;float: right;">Status</span>
</div>
{{else}}<div class="rowitem passive">There aren't any topics yet.</div>{{end}}
</div>

View File

@ -1,7 +1,7 @@
/* Copyright Azareal 2016 - 2017 */
package main
import "fmt"
//import "fmt"
import "log"
import "io"
import "os"
@ -23,6 +23,8 @@ type Theme struct
FriendlyName string
Version string
Creator string
FullImage string
MobileFriendly bool
Settings map[string]ThemeSetting
Templates []TemplateMapping
@ -62,9 +64,22 @@ func init_themes() {
}
var theme Theme
json.Unmarshal(themeFile, &theme)
err = json.Unmarshal(themeFile, &theme)
if err != nil {
log.Fatal(err)
}
theme.Active = false // Set this to false, just in case someone explicitly overrode this value in the JSON file
if theme.FullImage != "" {
log.Print("Adding theme image")
err = add_static_file("./themes/" + themeName + "/" + theme.FullImage, "./themes/" + themeName)
if err != nil {
log.Fatal(err)
}
}
themes[theme.Name] = theme
}
}
@ -106,7 +121,7 @@ func map_theme_templates(theme Theme) {
log.Fatal("Invalid source template name")
}
// go generate is one possibility, but it would simply add another step of compilation
// `go generate` is one possibility for letting plugins inject custom page structs, but it would simply add another step of compilation. It might be simpler than the current build process from the perspective of the administrator?
dest_tmpl_ptr, ok := tmpl_ptr_map[themeTmpl.Name]
if !ok {
@ -123,21 +138,21 @@ func map_theme_templates(theme Theme) {
case *func(TopicPage,io.Writer):
//overriden_templates[themeTmpl.Name] = d_tmpl_ptr
overriden_templates[themeTmpl.Name] = true
log.Print("Topic Handle")
fmt.Println(template_topic_handle)
log.Print("Before")
fmt.Println(d_tmpl_ptr)
fmt.Println(*d_tmpl_ptr)
log.Print("Source")
fmt.Println(s_tmpl_ptr)
fmt.Println(*s_tmpl_ptr)
//log.Print("Topic Handle")
//fmt.Println(template_topic_handle)
//log.Print("Before")
//fmt.Println(d_tmpl_ptr)
//fmt.Println(*d_tmpl_ptr)
//log.Print("Source")
//fmt.Println(s_tmpl_ptr)
//fmt.Println(*s_tmpl_ptr)
*d_tmpl_ptr = *s_tmpl_ptr
log.Print("After")
fmt.Println(d_tmpl_ptr)
fmt.Println(*d_tmpl_ptr)
log.Print("Source")
fmt.Println(s_tmpl_ptr)
fmt.Println(*s_tmpl_ptr)
//log.Print("After")
//fmt.Println(d_tmpl_ptr)
//fmt.Println(*d_tmpl_ptr)
//log.Print("Source")
//fmt.Println(s_tmpl_ptr)
//fmt.Println(*s_tmpl_ptr)
default:
log.Fatal("The source and destination templates are incompatible")
}
@ -218,19 +233,19 @@ func reset_template_overrides() {
case func(TopicPage,io.Writer):
switch d_ptr := dest_tmpl_ptr.(type) {
case *func(TopicPage,io.Writer):
log.Print("Topic Handle")
fmt.Println(template_topic_handle)
log.Print("Before")
fmt.Println(d_ptr)
fmt.Println(*d_ptr)
log.Print("Origin")
fmt.Println(o_ptr)
//log.Print("Topic Handle")
//fmt.Println(template_topic_handle)
//log.Print("Before")
//fmt.Println(d_ptr)
//fmt.Println(*d_ptr)
//log.Print("Origin")
//fmt.Println(o_ptr)
*d_ptr = o_ptr
log.Print("After")
fmt.Println(d_ptr)
fmt.Println(*d_ptr)
log.Print("Origin")
fmt.Println(o_ptr)
//log.Print("After")
//fmt.Println(d_ptr)
//fmt.Println(*d_ptr)
//log.Print("Origin")
//fmt.Println(o_ptr)
default:
log.Fatal("The origin and destination templates are incompatible")
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View File

@ -0,0 +1,12 @@
{
"Name": "cosmo-classic",
"FriendlyName": "Cosmo Classic",
"Version": "Coming Soon",
"Creator": "Azareal",
"Templates": [
{
"Name": "topic",
"Source": "topic_alt"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View File

@ -0,0 +1,13 @@
{
"Name": "cosmo-conflux",
"FriendlyName": "Cosmo Conflux",
"Version": "Coming Soon",
"Creator": "Azareal",
"FullImage": "cosmo-conflux.png",
"Templates": [
{
"Name": "topic",
"Source": "topic_alt"
}
]
}

BIN
themes/cosmo/cosmo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

1086
themes/cosmo/public/main.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
"FriendlyName": "AtomBB Cosmo",
"Version": "Coming Soon",
"Creator": "Azareal",
"FullImage": "cosmo.png",
"Templates": [
{
"Name": "topic",

View File

@ -171,18 +171,15 @@ li a
/*height: 40px;*/
width: 100%;
}
/*Clearfix*/
.formrow:before,
.formrow:after {
content: " ";
display: table;
}
.formrow:after {
clear: both;
}
.formrow:not(:last-child)
{
border-bottom: 1px dotted #ccc;
@ -197,22 +194,18 @@ li a
padding-bottom: 8px;
font-weight: bold;
}
.formitem:first-child
{
font-weight: bold;
}
.formitem:not(:last-child)
{
border-right: 1px dotted #ccc;
}
.formitem.invisible_border
{
border: none;
}
/* Mostly for textareas */
.formitem:only-child
{
@ -249,11 +242,22 @@ button
border-radius: 2px;
}
.topic_status:empty
{
.topic_status:empty {
display: none;
}
.rowhead {
background: linear-gradient(to bottom, white, hsl(0, 0%, 93%));
}
.topic_sticky_head {
background-color: #FFFFEA;
background: linear-gradient(to bottom, hsl(60, 70%, 96%), hsl(60, 70%, 89%)), url('/static/fabric-base-simple-alpha.png');
}
.topic_closed_head {
background-color: #eaeaea;
background: linear-gradient(to bottom, #eaeaea, hsl(0,0%,79%));
}
.username
{
text-transform: none;
@ -353,6 +357,41 @@ button.username
padding-right: 5px;
}
.post_item {
background-color: #eaeaea;
padding-top: 4px;
padding-left: 5px;
clear: both;
border-bottom: none;
padding-right: 4px;
padding-bottom: 2px;
}
.post_item:last-child {
padding-bottom: 7px;
}
.post_tag {
display: none;
}
.userinfo {
background: white;
width: 132px;
padding: 2px;
margin-top: 2px;
float: left;
position: sticky;
top: 4px;
box-shadow:0 1px 2px rgba(0,0,0,.1);
}
.content_container {
background: white;
margin-left: 137px;
min-height: 128px;
margin-bottom: 0;
margin-right: 3px;
box-shadow:0 1px 2px rgba(0,0,0,.1);
}
/* Media Queries from Simple. Probably useless in Conflux */
@media (max-width: 880px) {
li

View File

@ -3,6 +3,7 @@
"FriendlyName": "Tempra Conflux",
"Version": "0.0.1",
"Creator": "Azareal",
"FullImage": "tempra-conflux.png",
"Templates": [
{
"Name": "topic",

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

View File

@ -2,5 +2,7 @@
"Name": "tempra-simple",
"FriendlyName": "Tempra Simple",
"Version": "0.0.1",
"Creator": "Azareal"
"Creator": "Azareal",
"FullImage": "tempra-simple.png",
"MobileFriendly": true
}