1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00

Move stuff.qtpl and admin.qtpl to views/stuff.qtpl

This commit is contained in:
bouncepaw 2021-02-22 23:19:28 +05:00
parent e72752a484
commit ecbd23b3a5
7 changed files with 278 additions and 293 deletions

View File

@ -4,8 +4,8 @@ import (
"log" "log"
"net/http" "net/http"
"github.com/bouncepaw/mycorrhiza/templates"
"github.com/bouncepaw/mycorrhiza/user" "github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/views"
) )
// This is not init(), because user.AuthUsed is not set at init-stage. // This is not init(), because user.AuthUsed is not set at init-stage.
@ -21,7 +21,7 @@ func handlerAdmin(w http.ResponseWriter, rq *http.Request) {
if user.CanProceed(rq, "admin") { if user.CanProceed(rq, "admin") {
w.Header().Set("Content-Type", "text/html;charset=utf-8") w.Header().Set("Content-Type", "text/html;charset=utf-8")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
w.Write([]byte(base("Admin panel", templates.AdminPanelHTML(), user.FromRequest(rq)))) w.Write([]byte(base("Admin panel", views.AdminPanelHTML(), user.FromRequest(rq))))
} }
} }

View File

@ -13,7 +13,6 @@ import (
"github.com/bouncepaw/mycorrhiza/hyphae" "github.com/bouncepaw/mycorrhiza/hyphae"
"github.com/bouncepaw/mycorrhiza/markup" "github.com/bouncepaw/mycorrhiza/markup"
"github.com/bouncepaw/mycorrhiza/mimetype" "github.com/bouncepaw/mycorrhiza/mimetype"
"github.com/bouncepaw/mycorrhiza/templates"
"github.com/bouncepaw/mycorrhiza/user" "github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util" "github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views" "github.com/bouncepaw/mycorrhiza/views"
@ -99,7 +98,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
} }
} }
util.HTTP200Page(w, util.HTTP200Page(w,
templates.BaseHTML( views.BaseHTML(
util.BeautifulName(hyphaName), util.BeautifulName(hyphaName),
views.HyphaHTML(rq, h, contents), views.HyphaHTML(rq, h, contents),
u, u,

11
main.go
View File

@ -20,6 +20,7 @@ import (
"github.com/bouncepaw/mycorrhiza/templates" "github.com/bouncepaw/mycorrhiza/templates"
"github.com/bouncepaw/mycorrhiza/user" "github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util" "github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views"
) )
// WikiDir is a rooted path to the wiki storage directory. // WikiDir is a rooted path to the wiki storage directory.
@ -53,13 +54,13 @@ func handlerList(w http.ResponseWriter, rq *http.Request) {
u = user.FromRequest(rq) u = user.FromRequest(rq)
) )
for h := range hyphae.YieldExistingHyphae() { for h := range hyphae.YieldExistingHyphae() {
tbody += templates.HyphaListRowHTML(h.Name, mimetype.FromExtension(filepath.Ext(h.BinaryPath)), h.BinaryPath != "") tbody += views.HyphaListRowHTML(h.Name, mimetype.FromExtension(filepath.Ext(h.BinaryPath)), h.BinaryPath != "")
} }
util.HTTP200Page(w, base("List of pages", templates.HyphaListHTML(tbody, pageCount), u)) util.HTTP200Page(w, base("List of pages", views.HyphaListHTML(tbody, pageCount), u))
} }
// This part is present in all html documents. // This part is present in all html documents.
var base = templates.BaseHTML var base = views.BaseHTML
// Reindex all hyphae by checking the wiki storage directory anew. // Reindex all hyphae by checking the wiki storage directory anew.
func handlerReindex(w http.ResponseWriter, rq *http.Request) { func handlerReindex(w http.ResponseWriter, rq *http.Request) {
@ -148,13 +149,13 @@ func handlerIcon(w http.ResponseWriter, rq *http.Request) {
func handlerAbout(w http.ResponseWriter, rq *http.Request) { func handlerAbout(w http.ResponseWriter, rq *http.Request) {
w.Header().Set("Content-Type", "text/html;charset=utf-8") w.Header().Set("Content-Type", "text/html;charset=utf-8")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
w.Write([]byte(base("About "+util.SiteName, templates.AboutHTML(), user.FromRequest(rq)))) w.Write([]byte(base("About "+util.SiteName, views.AboutHTML(), user.FromRequest(rq))))
} }
func handlerUserList(w http.ResponseWriter, rq *http.Request) { func handlerUserList(w http.ResponseWriter, rq *http.Request) {
w.Header().Set("Content-Type", "text/html;charset=utf-8") w.Header().Set("Content-Type", "text/html;charset=utf-8")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
w.Write([]byte(base("User list", templates.UserListHTML(), user.FromRequest(rq)))) w.Write([]byte(base("User list", views.UserListHTML(), user.FromRequest(rq))))
} }
func handlerRobotsTxt(w http.ResponseWriter, rq *http.Request) { func handlerRobotsTxt(w http.ResponseWriter, rq *http.Request) {

View File

@ -1,30 +0,0 @@
{% func AdminPanelHTML() %}
<div class="layout">
<main class="main-width">
<h1>Admininstrative functions</h1>
<section>
<h2>Safe things</h2>
<ul>
<li><a href="/about">About this wiki<a></li>
<li><a href="/user-list">User list</a></li>
<li><a href="/update-header-links">Update header links</a></li>
</ul>
</section>
<section>
<h2>Dangerous things</h2>
<form action="/admin/shutdown" method="POST" style="float:left">
<fieldset>
<legend>Shutdown wiki</legend>
<input type="submit">
</fieldset>
</form>
<form action="/reindex" method="GET" style="float:left">
<fieldset>
<legend>Reindex hyphae</legend>
<input type="submit">
</fieldset>
</form>
</section>
</main>
</div>
{% endfunc %}

View File

@ -1,80 +0,0 @@
// Code generated by qtc from "admin.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
//line templates/admin.qtpl:1
package templates
//line templates/admin.qtpl:1
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line templates/admin.qtpl:1
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line templates/admin.qtpl:1
func StreamAdminPanelHTML(qw422016 *qt422016.Writer) {
//line templates/admin.qtpl:1
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<h1>Admininstrative functions</h1>
<section>
<h2>Safe things</h2>
<ul>
<li><a href="/about">About this wiki<a></li>
<li><a href="/user-list">User list</a></li>
<li><a href="/update-header-links">Update header links</a></li>
</ul>
</section>
<section>
<h2>Dangerous things</h2>
<form action="/admin/shutdown" method="POST" style="float:left">
<fieldset>
<legend>Shutdown wiki</legend>
<input type="submit">
</fieldset>
</form>
<form action="/reindex" method="GET" style="float:left">
<fieldset>
<legend>Reindex hyphae</legend>
<input type="submit">
</fieldset>
</form>
</section>
</main>
</div>
`)
//line templates/admin.qtpl:30
}
//line templates/admin.qtpl:30
func WriteAdminPanelHTML(qq422016 qtio422016.Writer) {
//line templates/admin.qtpl:30
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/admin.qtpl:30
StreamAdminPanelHTML(qw422016)
//line templates/admin.qtpl:30
qt422016.ReleaseWriter(qw422016)
//line templates/admin.qtpl:30
}
//line templates/admin.qtpl:30
func AdminPanelHTML() string {
//line templates/admin.qtpl:30
qb422016 := qt422016.AcquireByteBuffer()
//line templates/admin.qtpl:30
WriteAdminPanelHTML(qb422016)
//line templates/admin.qtpl:30
qs422016 := string(qb422016.B)
//line templates/admin.qtpl:30
qt422016.ReleaseByteBuffer(qb422016)
//line templates/admin.qtpl:30
return qs422016
//line templates/admin.qtpl:30
}

View File

@ -6,6 +6,7 @@
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/static/common.css"> <link rel="stylesheet" type="text/css" href="/static/common.css">
<title>{%s title %}</title> <title>{%s title %}</title>
{% for _, el := range headElements %}{%s= el %}{% endfor %} {% for _, el := range headElements %}{%s= el %}{% endfor %}
@ -17,7 +18,7 @@
{%- for _, link := range util.HeaderLinks -%} {%- for _, link := range util.HeaderLinks -%}
<li class="header-links__entry"><a class="header-links__link" href="{%s link.Href %}">{%s link.Display %}</a></li> <li class="header-links__entry"><a class="header-links__link" href="{%s link.Href %}">{%s link.Display %}</a></li>
{%- endfor -%} {%- endfor -%}
{%s= userMenuHTML(u) %} {%s= UserMenuHTML(u) %}
</ul> </ul>
</nav> </nav>
</header> </header>
@ -123,3 +124,34 @@ for u := range user.YieldUsers() {
</main> </main>
</div> </div>
{% endfunc %} {% endfunc %}
{% func AdminPanelHTML() %}
<div class="layout">
<main class="main-width">
<h1>Admininstrative functions</h1>
<section>
<h2>Safe things</h2>
<ul>
<li><a href="/about">About this wiki<a></li>
<li><a href="/user-list">User list</a></li>
<li><a href="/update-header-links">Update header links</a></li>
</ul>
</section>
<section>
<h2>Dangerous things</h2>
<form action="/admin/shutdown" method="POST" style="float:left">
<fieldset>
<legend>Shutdown wiki</legend>
<input type="submit">
</fieldset>
</form>
<form action="/reindex" method="GET" style="float:left">
<fieldset>
<legend>Reindex hyphae</legend>
<input type="submit">
</fieldset>
</form>
</section>
</main>
</div>
{% endfunc %}

View File

@ -1,50 +1,51 @@
// Code generated by qtc from "stuff.qtpl". DO NOT EDIT. // Code generated by qtc from "stuff.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details. // See https://github.com/valyala/quicktemplate for details.
//line templates/stuff.qtpl:1 //line views/stuff.qtpl:1
package templates package views
//line templates/stuff.qtpl:1 //line views/stuff.qtpl:1
import "github.com/bouncepaw/mycorrhiza/util" import "github.com/bouncepaw/mycorrhiza/util"
//line templates/stuff.qtpl:2 //line views/stuff.qtpl:2
import "github.com/bouncepaw/mycorrhiza/user" import "github.com/bouncepaw/mycorrhiza/user"
//line templates/stuff.qtpl:4 //line views/stuff.qtpl:4
import ( import (
qtio422016 "io" qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate" qt422016 "github.com/valyala/quicktemplate"
) )
//line templates/stuff.qtpl:4 //line views/stuff.qtpl:4
var ( var (
_ = qtio422016.Copy _ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer _ = qt422016.AcquireByteBuffer
) )
//line templates/stuff.qtpl:4 //line views/stuff.qtpl:4
func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User, headElements ...string) { func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User, headElements ...string) {
//line templates/stuff.qtpl:4 //line views/stuff.qtpl:4
qw422016.N().S(` qw422016.N().S(`
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/static/common.css"> <link rel="stylesheet" type="text/css" href="/static/common.css">
<title>`) <title>`)
//line templates/stuff.qtpl:10 //line views/stuff.qtpl:11
qw422016.E().S(title) qw422016.E().S(title)
//line templates/stuff.qtpl:10 //line views/stuff.qtpl:11
qw422016.N().S(`</title> qw422016.N().S(`</title>
`) `)
//line templates/stuff.qtpl:11 //line views/stuff.qtpl:12
for _, el := range headElements { for _, el := range headElements {
//line templates/stuff.qtpl:11 //line views/stuff.qtpl:12
qw422016.N().S(el) qw422016.N().S(el)
//line templates/stuff.qtpl:11 //line views/stuff.qtpl:12
} }
//line templates/stuff.qtpl:11 //line views/stuff.qtpl:12
qw422016.N().S(` qw422016.N().S(`
</head> </head>
<body> <body>
@ -52,76 +53,76 @@ func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User,
<nav class="header-links main-width"> <nav class="header-links main-width">
<ul class="header-links__list"> <ul class="header-links__list">
`) `)
//line templates/stuff.qtpl:17 //line views/stuff.qtpl:18
for _, link := range util.HeaderLinks { for _, link := range util.HeaderLinks {
//line templates/stuff.qtpl:17 //line views/stuff.qtpl:18
qw422016.N().S(` <li class="header-links__entry"><a class="header-links__link" href="`) qw422016.N().S(` <li class="header-links__entry"><a class="header-links__link" href="`)
//line templates/stuff.qtpl:18 //line views/stuff.qtpl:19
qw422016.E().S(link.Href) qw422016.E().S(link.Href)
//line templates/stuff.qtpl:18 //line views/stuff.qtpl:19
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line templates/stuff.qtpl:18 //line views/stuff.qtpl:19
qw422016.E().S(link.Display) qw422016.E().S(link.Display)
//line templates/stuff.qtpl:18 //line views/stuff.qtpl:19
qw422016.N().S(`</a></li> qw422016.N().S(`</a></li>
`) `)
//line templates/stuff.qtpl:19 //line views/stuff.qtpl:20
} }
//line templates/stuff.qtpl:19 //line views/stuff.qtpl:20
qw422016.N().S(` `) qw422016.N().S(` `)
//line templates/stuff.qtpl:20 //line views/stuff.qtpl:21
qw422016.N().S(userMenuHTML(u)) qw422016.N().S(UserMenuHTML(u))
//line templates/stuff.qtpl:20 //line views/stuff.qtpl:21
qw422016.N().S(` qw422016.N().S(`
</ul> </ul>
</nav> </nav>
</header> </header>
`) `)
//line templates/stuff.qtpl:24 //line views/stuff.qtpl:25
qw422016.N().S(body) qw422016.N().S(body)
//line templates/stuff.qtpl:24 //line views/stuff.qtpl:25
qw422016.N().S(` qw422016.N().S(`
</body> </body>
</html> </html>
`) `)
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
} }
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, u *user.User, headElements ...string) { func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, u *user.User, headElements ...string) {
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
StreamBaseHTML(qw422016, title, body, u, headElements...) StreamBaseHTML(qw422016, title, body, u, headElements...)
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
} }
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
func BaseHTML(title, body string, u *user.User, headElements ...string) string { func BaseHTML(title, body string, u *user.User, headElements ...string) string {
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
WriteBaseHTML(qb422016, title, body, u, headElements...) WriteBaseHTML(qb422016, title, body, u, headElements...)
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
return qs422016 return qs422016
//line templates/stuff.qtpl:27 //line views/stuff.qtpl:28
} }
//line templates/stuff.qtpl:29 //line views/stuff.qtpl:30
func StreamUserListHTML(qw422016 *qt422016.Writer) { func StreamUserListHTML(qw422016 *qt422016.Writer) {
//line templates/stuff.qtpl:29 //line views/stuff.qtpl:30
qw422016.N().S(` qw422016.N().S(`
<div class="layout"> <div class="layout">
<main class="main-width user-list"> <main class="main-width user-list">
<h1>List of users</h1> <h1>List of users</h1>
`) `)
//line templates/stuff.qtpl:34 //line views/stuff.qtpl:35
var ( var (
admins = make([]string, 0) admins = make([]string, 0)
moderators = make([]string, 0) moderators = make([]string, 0)
@ -138,129 +139,129 @@ func StreamUserListHTML(qw422016 *qt422016.Writer) {
} }
} }
//line templates/stuff.qtpl:49 //line views/stuff.qtpl:50
qw422016.N().S(` qw422016.N().S(`
<section> <section>
<h2>Admins</h2> <h2>Admins</h2>
<ol>`) <ol>`)
//line templates/stuff.qtpl:52 //line views/stuff.qtpl:53
for _, name := range admins { for _, name := range admins {
//line templates/stuff.qtpl:52 //line views/stuff.qtpl:53
qw422016.N().S(` qw422016.N().S(`
<li><a href="/page/`) <li><a href="/page/`)
//line templates/stuff.qtpl:53 //line views/stuff.qtpl:54
qw422016.E().S(util.UserHypha) qw422016.E().S(util.UserHypha)
//line templates/stuff.qtpl:53 //line views/stuff.qtpl:54
qw422016.N().S(`/`) qw422016.N().S(`/`)
//line templates/stuff.qtpl:53 //line views/stuff.qtpl:54
qw422016.E().S(name) qw422016.E().S(name)
//line templates/stuff.qtpl:53 //line views/stuff.qtpl:54
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line templates/stuff.qtpl:53 //line views/stuff.qtpl:54
qw422016.E().S(name) qw422016.E().S(name)
//line templates/stuff.qtpl:53 //line views/stuff.qtpl:54
qw422016.N().S(`</a></li> qw422016.N().S(`</a></li>
`) `)
//line templates/stuff.qtpl:54 //line views/stuff.qtpl:55
} }
//line templates/stuff.qtpl:54 //line views/stuff.qtpl:55
qw422016.N().S(`</ol> qw422016.N().S(`</ol>
</section> </section>
<section> <section>
<h2>Moderators</h2> <h2>Moderators</h2>
<ol>`) <ol>`)
//line templates/stuff.qtpl:58 //line views/stuff.qtpl:59
for _, name := range moderators { for _, name := range moderators {
//line templates/stuff.qtpl:58 //line views/stuff.qtpl:59
qw422016.N().S(` qw422016.N().S(`
<li><a href="/page/`) <li><a href="/page/`)
//line templates/stuff.qtpl:59 //line views/stuff.qtpl:60
qw422016.E().S(util.UserHypha) qw422016.E().S(util.UserHypha)
//line templates/stuff.qtpl:59 //line views/stuff.qtpl:60
qw422016.N().S(`/`) qw422016.N().S(`/`)
//line templates/stuff.qtpl:59 //line views/stuff.qtpl:60
qw422016.E().S(name) qw422016.E().S(name)
//line templates/stuff.qtpl:59 //line views/stuff.qtpl:60
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line templates/stuff.qtpl:59 //line views/stuff.qtpl:60
qw422016.E().S(name) qw422016.E().S(name)
//line templates/stuff.qtpl:59 //line views/stuff.qtpl:60
qw422016.N().S(`</a></li> qw422016.N().S(`</a></li>
`) `)
//line templates/stuff.qtpl:60 //line views/stuff.qtpl:61
} }
//line templates/stuff.qtpl:60 //line views/stuff.qtpl:61
qw422016.N().S(`</ol> qw422016.N().S(`</ol>
</section> </section>
<section> <section>
<h2>Editors</h2> <h2>Editors</h2>
<ol>`) <ol>`)
//line templates/stuff.qtpl:64 //line views/stuff.qtpl:65
for _, name := range editors { for _, name := range editors {
//line templates/stuff.qtpl:64 //line views/stuff.qtpl:65
qw422016.N().S(` qw422016.N().S(`
<li><a href="/page/`) <li><a href="/page/`)
//line templates/stuff.qtpl:65 //line views/stuff.qtpl:66
qw422016.E().S(util.UserHypha) qw422016.E().S(util.UserHypha)
//line templates/stuff.qtpl:65 //line views/stuff.qtpl:66
qw422016.N().S(`/`) qw422016.N().S(`/`)
//line templates/stuff.qtpl:65 //line views/stuff.qtpl:66
qw422016.E().S(name) qw422016.E().S(name)
//line templates/stuff.qtpl:65 //line views/stuff.qtpl:66
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line templates/stuff.qtpl:65 //line views/stuff.qtpl:66
qw422016.E().S(name) qw422016.E().S(name)
//line templates/stuff.qtpl:65 //line views/stuff.qtpl:66
qw422016.N().S(`</a></li> qw422016.N().S(`</a></li>
`) `)
//line templates/stuff.qtpl:66 //line views/stuff.qtpl:67
} }
//line templates/stuff.qtpl:66 //line views/stuff.qtpl:67
qw422016.N().S(`</ol> qw422016.N().S(`</ol>
</section> </section>
</main> </main>
</div> </div>
`) `)
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
} }
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
func WriteUserListHTML(qq422016 qtio422016.Writer) { func WriteUserListHTML(qq422016 qtio422016.Writer) {
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
StreamUserListHTML(qw422016) StreamUserListHTML(qw422016)
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
} }
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
func UserListHTML() string { func UserListHTML() string {
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
WriteUserListHTML(qb422016) WriteUserListHTML(qb422016)
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
return qs422016 return qs422016
//line templates/stuff.qtpl:70 //line views/stuff.qtpl:71
} }
//line templates/stuff.qtpl:72 //line views/stuff.qtpl:73
func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int) { func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int) {
//line templates/stuff.qtpl:72 //line views/stuff.qtpl:73
qw422016.N().S(` qw422016.N().S(`
<div class="layout"> <div class="layout">
<main class="main-width"> <main class="main-width">
<h1>List of hyphae</h1> <h1>List of hyphae</h1>
<p>This wiki has `) <p>This wiki has `)
//line templates/stuff.qtpl:76 //line views/stuff.qtpl:77
qw422016.N().D(pageCount) qw422016.N().D(pageCount)
//line templates/stuff.qtpl:76 //line views/stuff.qtpl:77
qw422016.N().S(` hyphae.</p> qw422016.N().S(` hyphae.</p>
<table> <table>
<thead> <thead>
@ -271,206 +272,268 @@ func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int)
</thead> </thead>
<tbody> <tbody>
`) `)
//line templates/stuff.qtpl:85 //line views/stuff.qtpl:86
qw422016.N().S(tbody) qw422016.N().S(tbody)
//line templates/stuff.qtpl:85 //line views/stuff.qtpl:86
qw422016.N().S(` qw422016.N().S(`
</tbody> </tbody>
</table> </table>
</main> </main>
</div> </div>
`) `)
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
} }
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
func WriteHyphaListHTML(qq422016 qtio422016.Writer, tbody string, pageCount int) { func WriteHyphaListHTML(qq422016 qtio422016.Writer, tbody string, pageCount int) {
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
StreamHyphaListHTML(qw422016, tbody, pageCount) StreamHyphaListHTML(qw422016, tbody, pageCount)
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
} }
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
func HyphaListHTML(tbody string, pageCount int) string { func HyphaListHTML(tbody string, pageCount int) string {
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
WriteHyphaListHTML(qb422016, tbody, pageCount) WriteHyphaListHTML(qb422016, tbody, pageCount)
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
return qs422016 return qs422016
//line templates/stuff.qtpl:90 //line views/stuff.qtpl:91
} }
//line templates/stuff.qtpl:92 //line views/stuff.qtpl:93
func StreamHyphaListRowHTML(qw422016 *qt422016.Writer, hyphaName, binaryMime string, binaryPresent bool) { func StreamHyphaListRowHTML(qw422016 *qt422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
//line templates/stuff.qtpl:92 //line views/stuff.qtpl:93
qw422016.N().S(` qw422016.N().S(`
<tr> <tr>
<td><a href="/page/`) <td><a href="/page/`)
//line templates/stuff.qtpl:94 //line views/stuff.qtpl:95
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line templates/stuff.qtpl:94 //line views/stuff.qtpl:95
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line templates/stuff.qtpl:94 //line views/stuff.qtpl:95
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line templates/stuff.qtpl:94 //line views/stuff.qtpl:95
qw422016.N().S(`</a></td> qw422016.N().S(`</a></td>
`) `)
//line templates/stuff.qtpl:95 //line views/stuff.qtpl:96
if binaryPresent { if binaryPresent {
//line templates/stuff.qtpl:95 //line views/stuff.qtpl:96
qw422016.N().S(` qw422016.N().S(`
<td>`) <td>`)
//line templates/stuff.qtpl:96 //line views/stuff.qtpl:97
qw422016.E().S(binaryMime) qw422016.E().S(binaryMime)
//line templates/stuff.qtpl:96 //line views/stuff.qtpl:97
qw422016.N().S(`</td> qw422016.N().S(`</td>
`) `)
//line templates/stuff.qtpl:97 //line views/stuff.qtpl:98
} else { } else {
//line templates/stuff.qtpl:97 //line views/stuff.qtpl:98
qw422016.N().S(` qw422016.N().S(`
<td></td> <td></td>
`) `)
//line templates/stuff.qtpl:99 //line views/stuff.qtpl:100
} }
//line templates/stuff.qtpl:99 //line views/stuff.qtpl:100
qw422016.N().S(` qw422016.N().S(`
</tr> </tr>
`) `)
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
} }
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
func WriteHyphaListRowHTML(qq422016 qtio422016.Writer, hyphaName, binaryMime string, binaryPresent bool) { func WriteHyphaListRowHTML(qq422016 qtio422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
StreamHyphaListRowHTML(qw422016, hyphaName, binaryMime, binaryPresent) StreamHyphaListRowHTML(qw422016, hyphaName, binaryMime, binaryPresent)
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
} }
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
func HyphaListRowHTML(hyphaName, binaryMime string, binaryPresent bool) string { func HyphaListRowHTML(hyphaName, binaryMime string, binaryPresent bool) string {
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
WriteHyphaListRowHTML(qb422016, hyphaName, binaryMime, binaryPresent) WriteHyphaListRowHTML(qb422016, hyphaName, binaryMime, binaryPresent)
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
return qs422016 return qs422016
//line templates/stuff.qtpl:101 //line views/stuff.qtpl:102
} }
//line templates/stuff.qtpl:103 //line views/stuff.qtpl:104
func StreamAboutHTML(qw422016 *qt422016.Writer) { func StreamAboutHTML(qw422016 *qt422016.Writer) {
//line templates/stuff.qtpl:103 //line views/stuff.qtpl:104
qw422016.N().S(` qw422016.N().S(`
<div class="layout"> <div class="layout">
<main class="main-width"> <main class="main-width">
<section> <section>
<h1>About `) <h1>About `)
//line templates/stuff.qtpl:107 //line views/stuff.qtpl:108
qw422016.E().S(util.SiteName) qw422016.E().S(util.SiteName)
//line templates/stuff.qtpl:107 //line views/stuff.qtpl:108
qw422016.N().S(`</h1> qw422016.N().S(`</h1>
<ul> <ul>
<li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> β 0.13 indev</li> <li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> β 0.13 indev</li>
`) `)
//line templates/stuff.qtpl:110 //line views/stuff.qtpl:111
if user.AuthUsed { if user.AuthUsed {
//line templates/stuff.qtpl:110 //line views/stuff.qtpl:111
qw422016.N().S(` <li><b>User count:</b> `) qw422016.N().S(` <li><b>User count:</b> `)
//line templates/stuff.qtpl:111 //line views/stuff.qtpl:112
qw422016.N().D(user.Count()) qw422016.N().D(user.Count())
//line templates/stuff.qtpl:111 //line views/stuff.qtpl:112
qw422016.N().S(`</li> qw422016.N().S(`</li>
<li><b>Home page:</b> <a href="/">`) <li><b>Home page:</b> <a href="/">`)
//line templates/stuff.qtpl:112 //line views/stuff.qtpl:113
qw422016.E().S(util.HomePage) qw422016.E().S(util.HomePage)
//line templates/stuff.qtpl:112 //line views/stuff.qtpl:113
qw422016.N().S(`</a></li> qw422016.N().S(`</a></li>
<li><b>Administrators:</b>`) <li><b>Administrators:</b>`)
//line templates/stuff.qtpl:113 //line views/stuff.qtpl:114
for i, username := range user.ListUsersWithGroup("admin") { for i, username := range user.ListUsersWithGroup("admin") {
//line templates/stuff.qtpl:114 //line views/stuff.qtpl:115
if i > 0 { if i > 0 {
//line templates/stuff.qtpl:114 //line views/stuff.qtpl:115
qw422016.N().S(`<span aria-hidden="true">, </span> qw422016.N().S(`<span aria-hidden="true">, </span>
`) `)
//line templates/stuff.qtpl:115 //line views/stuff.qtpl:116
} }
//line templates/stuff.qtpl:115 //line views/stuff.qtpl:116
qw422016.N().S(` <a href="/page/`) qw422016.N().S(` <a href="/page/`)
//line templates/stuff.qtpl:116 //line views/stuff.qtpl:117
qw422016.E().S(util.UserHypha) qw422016.E().S(util.UserHypha)
//line templates/stuff.qtpl:116 //line views/stuff.qtpl:117
qw422016.N().S(`/`) qw422016.N().S(`/`)
//line templates/stuff.qtpl:116 //line views/stuff.qtpl:117
qw422016.E().S(username) qw422016.E().S(username)
//line templates/stuff.qtpl:116 //line views/stuff.qtpl:117
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line templates/stuff.qtpl:116 //line views/stuff.qtpl:117
qw422016.E().S(username) qw422016.E().S(username)
//line templates/stuff.qtpl:116 //line views/stuff.qtpl:117
qw422016.N().S(`</a>`) qw422016.N().S(`</a>`)
//line templates/stuff.qtpl:116 //line views/stuff.qtpl:117
} }
//line templates/stuff.qtpl:116 //line views/stuff.qtpl:117
qw422016.N().S(`</li> qw422016.N().S(`</li>
`) `)
//line templates/stuff.qtpl:117 //line views/stuff.qtpl:118
} else { } else {
//line templates/stuff.qtpl:117 //line views/stuff.qtpl:118
qw422016.N().S(` <li>This wiki does not use authorization</li> qw422016.N().S(` <li>This wiki does not use authorization</li>
`) `)
//line templates/stuff.qtpl:119 //line views/stuff.qtpl:120
} }
//line templates/stuff.qtpl:119 //line views/stuff.qtpl:120
qw422016.N().S(` </ul> qw422016.N().S(` </ul>
<p>See <a href="/list">/list</a> for information about hyphae on this wiki.</p> <p>See <a href="/list">/list</a> for information about hyphae on this wiki.</p>
</section> </section>
</main> </main>
</div> </div>
`) `)
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
} }
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
func WriteAboutHTML(qq422016 qtio422016.Writer) { func WriteAboutHTML(qq422016 qtio422016.Writer) {
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
StreamAboutHTML(qw422016) StreamAboutHTML(qw422016)
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
} }
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
func AboutHTML() string { func AboutHTML() string {
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
WriteAboutHTML(qb422016) WriteAboutHTML(qb422016)
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
return qs422016 return qs422016
//line templates/stuff.qtpl:125 //line views/stuff.qtpl:126
}
//line views/stuff.qtpl:128
func StreamAdminPanelHTML(qw422016 *qt422016.Writer) {
//line views/stuff.qtpl:128
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<h1>Admininstrative functions</h1>
<section>
<h2>Safe things</h2>
<ul>
<li><a href="/about">About this wiki<a></li>
<li><a href="/user-list">User list</a></li>
<li><a href="/update-header-links">Update header links</a></li>
</ul>
</section>
<section>
<h2>Dangerous things</h2>
<form action="/admin/shutdown" method="POST" style="float:left">
<fieldset>
<legend>Shutdown wiki</legend>
<input type="submit">
</fieldset>
</form>
<form action="/reindex" method="GET" style="float:left">
<fieldset>
<legend>Reindex hyphae</legend>
<input type="submit">
</fieldset>
</form>
</section>
</main>
</div>
`)
//line views/stuff.qtpl:157
}
//line views/stuff.qtpl:157
func WriteAdminPanelHTML(qq422016 qtio422016.Writer) {
//line views/stuff.qtpl:157
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/stuff.qtpl:157
StreamAdminPanelHTML(qw422016)
//line views/stuff.qtpl:157
qt422016.ReleaseWriter(qw422016)
//line views/stuff.qtpl:157
}
//line views/stuff.qtpl:157
func AdminPanelHTML() string {
//line views/stuff.qtpl:157
qb422016 := qt422016.AcquireByteBuffer()
//line views/stuff.qtpl:157
WriteAdminPanelHTML(qb422016)
//line views/stuff.qtpl:157
qs422016 := string(qb422016.B)
//line views/stuff.qtpl:157
qt422016.ReleaseByteBuffer(qb422016)
//line views/stuff.qtpl:157
return qs422016
//line views/stuff.qtpl:157
} }