mirror of
				https://github.com/osmarks/mycorrhiza.git
				synced 2025-10-31 07:33:00 +00:00 
			
		
		
		
	Link the user panel from the admin panel
This commit is contained in:
		
							
								
								
									
										4
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.mod
									
									
									
									
									
								
							| @@ -3,7 +3,7 @@ module github.com/bouncepaw/mycorrhiza | |||||||
| go 1.16 | go 1.16 | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/bouncepaw/mycomarkup v0.5.5 | 	github.com/bouncepaw/mycomarkup v0.5.6 | ||||||
| 	github.com/go-ini/ini v1.62.0 | 	github.com/go-ini/ini v1.62.0 | ||||||
| 	github.com/gorilla/feeds v1.1.1 | 	github.com/gorilla/feeds v1.1.1 | ||||||
| 	github.com/kr/pretty v0.2.1 // indirect | 	github.com/kr/pretty v0.2.1 // indirect | ||||||
| @@ -14,4 +14,4 @@ require ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| // Use this trick for testing of mycomarkup: | // Use this trick for testing of mycomarkup: | ||||||
| // replace github.com/bouncepaw/mycomarkup v0.5.5 => "/Users/bouncepaw/GolandProjects/mycomarkup" | // replace github.com/bouncepaw/mycomarkup v0.5.6 => "/Users/bouncepaw/GolandProjects/mycomarkup" | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= | github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= | ||||||
| github.com/bouncepaw/mycomarkup v0.5.5 h1:dEZcNDUQKxwOITkhvE8Zf5HDuYJ4C8c1K8mxSY0UNE8= | github.com/bouncepaw/mycomarkup v0.5.6 h1:uTHuVbQI00SVdlD2SjiXpXX9E/qUEXTIObNvJFEIfV0= | ||||||
| github.com/bouncepaw/mycomarkup v0.5.5/go.mod h1:0n6thlGGgrx2Y/2NaaUH4qHW4v1xJ+EpW7yMFUxNRIg= | github.com/bouncepaw/mycomarkup v0.5.6/go.mod h1:0n6thlGGgrx2Y/2NaaUH4qHW4v1xJ+EpW7yMFUxNRIg= | ||||||
| github.com/go-ini/ini v1.62.0 h1:7VJT/ZXjzqSrvtraFp4ONq80hTcRQth1c9ZnQ3uNQvU= | github.com/go-ini/ini v1.62.0 h1:7VJT/ZXjzqSrvtraFp4ONq80hTcRQth1c9ZnQ3uNQvU= | ||||||
| github.com/go-ini/ini v1.62.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= | github.com/go-ini/ini v1.62.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= | ||||||
| github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= | github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= | ||||||
|   | |||||||
| @@ -1,5 +1,43 @@ | |||||||
| {% import "github.com/bouncepaw/mycorrhiza/user" %} | {% import "github.com/bouncepaw/mycorrhiza/user" %} | ||||||
|  |  | ||||||
|  | {% func AdminPanelHTML() %} | ||||||
|  | <div class="layout"> | ||||||
|  | <main class="main-width"> | ||||||
|  | 	<h1>Administrative 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> | ||||||
|  | 			<li><a href="/admin/users">Manage users</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" class="btn"> | ||||||
|  | 			</fieldset> | ||||||
|  | 		</form> | ||||||
|  | 		<form action="/reindex" method="GET" style="float:left"> | ||||||
|  | 			<fieldset> | ||||||
|  | 				<legend>Reindex hyphae</legend> | ||||||
|  | 				<input type="submit" class="btn"> | ||||||
|  | 			</fieldset> | ||||||
|  | 		</form> | ||||||
|  | 		<form action="/admin/reindex-users" method="POST" style="float:left"> | ||||||
|  | 			<fieldset> | ||||||
|  | 				<legend>Reindex users</legend> | ||||||
|  | 				<input type="submit" class="btn"> | ||||||
|  | 			</fieldset> | ||||||
|  | 		</form> | ||||||
|  | 	</section> | ||||||
|  | </main> | ||||||
|  | </div> | ||||||
|  | {% endfunc %} | ||||||
|  |  | ||||||
| {% func AdminUsersPanelHTML(userList []*user.User) %} | {% func AdminUsersPanelHTML(userList []*user.User) %} | ||||||
| <div class="layout"> | <div class="layout"> | ||||||
| <main class="main-width"> | <main class="main-width"> | ||||||
|   | |||||||
| @@ -21,10 +21,79 @@ var ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| //line views/admin.qtpl:3 | //line views/admin.qtpl:3 | ||||||
| func StreamAdminUsersPanelHTML(qw422016 *qt422016.Writer, userList []*user.User) { | func StreamAdminPanelHTML(qw422016 *qt422016.Writer) { | ||||||
| //line views/admin.qtpl:3 | //line views/admin.qtpl:3 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| <div class="layout"> | <div class="layout"> | ||||||
|  | <main class="main-width"> | ||||||
|  | 	<h1>Administrative 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> | ||||||
|  | 			<li><a href="/admin/users">Manage users</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" class="btn"> | ||||||
|  | 			</fieldset> | ||||||
|  | 		</form> | ||||||
|  | 		<form action="/reindex" method="GET" style="float:left"> | ||||||
|  | 			<fieldset> | ||||||
|  | 				<legend>Reindex hyphae</legend> | ||||||
|  | 				<input type="submit" class="btn"> | ||||||
|  | 			</fieldset> | ||||||
|  | 		</form> | ||||||
|  | 		<form action="/admin/reindex-users" method="POST" style="float:left"> | ||||||
|  | 			<fieldset> | ||||||
|  | 				<legend>Reindex users</legend> | ||||||
|  | 				<input type="submit" class="btn"> | ||||||
|  | 			</fieldset> | ||||||
|  | 		</form> | ||||||
|  | 	</section> | ||||||
|  | </main> | ||||||
|  | </div> | ||||||
|  | `) | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | func WriteAdminPanelHTML(qq422016 qtio422016.Writer) { | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | 	StreamAdminPanelHTML(qw422016) | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | 	qt422016.ReleaseWriter(qw422016) | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | func AdminPanelHTML() string { | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | 	qb422016 := qt422016.AcquireByteBuffer() | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | 	WriteAdminPanelHTML(qb422016) | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | 	qs422016 := string(qb422016.B) | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | 	qt422016.ReleaseByteBuffer(qb422016) | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | 	return qs422016 | ||||||
|  | //line views/admin.qtpl:39 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | //line views/admin.qtpl:41 | ||||||
|  | func StreamAdminUsersPanelHTML(qw422016 *qt422016.Writer, userList []*user.User) { | ||||||
|  | //line views/admin.qtpl:41 | ||||||
|  | 	qw422016.N().S(` | ||||||
|  | <div class="layout"> | ||||||
| <main class="main-width"> | <main class="main-width"> | ||||||
| 	<h1>Manage users</h1> | 	<h1>Manage users</h1> | ||||||
|  |  | ||||||
| @@ -45,132 +114,132 @@ func StreamAdminUsersPanelHTML(qw422016 *qt422016.Writer, userList []*user.User) | |||||||
| 	</thead> | 	</thead> | ||||||
| 	<tbody> | 	<tbody> | ||||||
| 	`) | 	`) | ||||||
| //line views/admin.qtpl:24 | //line views/admin.qtpl:62 | ||||||
| 	for _, u := range userList { | 	for _, u := range userList { | ||||||
| //line views/admin.qtpl:24 | //line views/admin.qtpl:62 | ||||||
| 		qw422016.N().S(` | 		qw422016.N().S(` | ||||||
| 		<tr> | 		<tr> | ||||||
| 			<td>`) | 			<td>`) | ||||||
| //line views/admin.qtpl:26 | //line views/admin.qtpl:64 | ||||||
| 		qw422016.E().S(u.Name) | 		qw422016.E().S(u.Name) | ||||||
| //line views/admin.qtpl:26 | //line views/admin.qtpl:64 | ||||||
| 		qw422016.N().S(`</td> | 		qw422016.N().S(`</td> | ||||||
| 			<td>`) | 			<td>`) | ||||||
| //line views/admin.qtpl:27 | //line views/admin.qtpl:65 | ||||||
| 		qw422016.E().S(u.Group) | 		qw422016.E().S(u.Group) | ||||||
| //line views/admin.qtpl:27 | //line views/admin.qtpl:65 | ||||||
| 		qw422016.N().S(`</td> | 		qw422016.N().S(`</td> | ||||||
| 			<td>`) | 			<td>`) | ||||||
| //line views/admin.qtpl:28 | //line views/admin.qtpl:66 | ||||||
| 		qw422016.E().S(u.RegisteredAt.Format("2006-01-02 15:04:05-0700")) | 		qw422016.E().S(u.RegisteredAt.Format("2006-01-02 15:04:05-0700")) | ||||||
| //line views/admin.qtpl:28 | //line views/admin.qtpl:66 | ||||||
| 		qw422016.N().S(`</td> | 		qw422016.N().S(`</td> | ||||||
| 			<td> | 			<td> | ||||||
| 				<a href="/admin/users/`) | 				<a href="/admin/users/`) | ||||||
| //line views/admin.qtpl:30 | //line views/admin.qtpl:68 | ||||||
| 		qw422016.N().U(u.Name) | 		qw422016.N().U(u.Name) | ||||||
| //line views/admin.qtpl:30 | //line views/admin.qtpl:68 | ||||||
| 		qw422016.N().S(`/edit">Edit</a> | 		qw422016.N().S(`/edit">Edit</a> | ||||||
| 			</td> | 			</td> | ||||||
| 		</tr> | 		</tr> | ||||||
| 	`) | 	`) | ||||||
| //line views/admin.qtpl:33 | //line views/admin.qtpl:71 | ||||||
| 	} | 	} | ||||||
| //line views/admin.qtpl:33 | //line views/admin.qtpl:71 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| 	</tbody> | 	</tbody> | ||||||
| 	</table> | 	</table> | ||||||
| </main> | </main> | ||||||
| </div> | </div> | ||||||
| `) | `) | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| func WriteAdminUsersPanelHTML(qq422016 qtio422016.Writer, userList []*user.User) { | func WriteAdminUsersPanelHTML(qq422016 qtio422016.Writer, userList []*user.User) { | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| 	StreamAdminUsersPanelHTML(qw422016, userList) | 	StreamAdminUsersPanelHTML(qw422016, userList) | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| 	qt422016.ReleaseWriter(qw422016) | 	qt422016.ReleaseWriter(qw422016) | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| func AdminUsersPanelHTML(userList []*user.User) string { | func AdminUsersPanelHTML(userList []*user.User) string { | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| 	qb422016 := qt422016.AcquireByteBuffer() | 	qb422016 := qt422016.AcquireByteBuffer() | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| 	WriteAdminUsersPanelHTML(qb422016, userList) | 	WriteAdminUsersPanelHTML(qb422016, userList) | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| 	qs422016 := string(qb422016.B) | 	qs422016 := string(qb422016.B) | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| 	qt422016.ReleaseByteBuffer(qb422016) | 	qt422016.ReleaseByteBuffer(qb422016) | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| 	return qs422016 | 	return qs422016 | ||||||
| //line views/admin.qtpl:38 | //line views/admin.qtpl:76 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/admin.qtpl:40 | //line views/admin.qtpl:78 | ||||||
| func StreamAdminUsersUserHTML(qw422016 *qt422016.Writer, u *user.User) { | func StreamAdminUsersUserHTML(qw422016 *qt422016.Writer, u *user.User) { | ||||||
| //line views/admin.qtpl:40 | //line views/admin.qtpl:78 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| <div class="layout"> | <div class="layout"> | ||||||
| <main class="main-width"> | <main class="main-width"> | ||||||
| 	<h1>`) | 	<h1>`) | ||||||
| //line views/admin.qtpl:43 | //line views/admin.qtpl:81 | ||||||
| 	qw422016.E().S(u.Name) | 	qw422016.E().S(u.Name) | ||||||
| //line views/admin.qtpl:43 | //line views/admin.qtpl:81 | ||||||
| 	qw422016.N().S(`</h1> | 	qw422016.N().S(`</h1> | ||||||
|  |  | ||||||
| 	<form action="" method="post"> | 	<form action="" method="post"> | ||||||
| 		<label for="group">Group:</label> | 		<label for="group">Group:</label> | ||||||
| 		<select id="group" name="group"> | 		<select id="group" name="group"> | ||||||
| 			<option`) | 			<option`) | ||||||
| //line views/admin.qtpl:48 | //line views/admin.qtpl:86 | ||||||
| 	if u.Group == "anon" { | 	if u.Group == "anon" { | ||||||
| //line views/admin.qtpl:48 | //line views/admin.qtpl:86 | ||||||
| 		qw422016.N().S(` selected`) | 		qw422016.N().S(` selected`) | ||||||
| //line views/admin.qtpl:48 | //line views/admin.qtpl:86 | ||||||
| 	} | 	} | ||||||
| //line views/admin.qtpl:48 | //line views/admin.qtpl:86 | ||||||
| 	qw422016.N().S(`>anon</option> | 	qw422016.N().S(`>anon</option> | ||||||
| 			<option`) | 			<option`) | ||||||
| //line views/admin.qtpl:49 | //line views/admin.qtpl:87 | ||||||
| 	if u.Group == "editor" { | 	if u.Group == "editor" { | ||||||
| //line views/admin.qtpl:49 | //line views/admin.qtpl:87 | ||||||
| 		qw422016.N().S(` selected`) | 		qw422016.N().S(` selected`) | ||||||
| //line views/admin.qtpl:49 | //line views/admin.qtpl:87 | ||||||
| 	} | 	} | ||||||
| //line views/admin.qtpl:49 | //line views/admin.qtpl:87 | ||||||
| 	qw422016.N().S(`>editor</option> | 	qw422016.N().S(`>editor</option> | ||||||
| 			<option`) | 			<option`) | ||||||
| //line views/admin.qtpl:50 | //line views/admin.qtpl:88 | ||||||
| 	if u.Group == "trusted" { | 	if u.Group == "trusted" { | ||||||
| //line views/admin.qtpl:50 | //line views/admin.qtpl:88 | ||||||
| 		qw422016.N().S(` selected`) | 		qw422016.N().S(` selected`) | ||||||
| //line views/admin.qtpl:50 | //line views/admin.qtpl:88 | ||||||
| 	} | 	} | ||||||
| //line views/admin.qtpl:50 | //line views/admin.qtpl:88 | ||||||
| 	qw422016.N().S(`>trusted</option> | 	qw422016.N().S(`>trusted</option> | ||||||
| 			<option`) | 			<option`) | ||||||
| //line views/admin.qtpl:51 | //line views/admin.qtpl:89 | ||||||
| 	if u.Group == "moderator" { | 	if u.Group == "moderator" { | ||||||
| //line views/admin.qtpl:51 | //line views/admin.qtpl:89 | ||||||
| 		qw422016.N().S(` selected`) | 		qw422016.N().S(` selected`) | ||||||
| //line views/admin.qtpl:51 | //line views/admin.qtpl:89 | ||||||
| 	} | 	} | ||||||
| //line views/admin.qtpl:51 | //line views/admin.qtpl:89 | ||||||
| 	qw422016.N().S(`>moderator</option> | 	qw422016.N().S(`>moderator</option> | ||||||
| 			<option`) | 			<option`) | ||||||
| //line views/admin.qtpl:52 | //line views/admin.qtpl:90 | ||||||
| 	if u.Group == "admin" { | 	if u.Group == "admin" { | ||||||
| //line views/admin.qtpl:52 | //line views/admin.qtpl:90 | ||||||
| 		qw422016.N().S(` selected`) | 		qw422016.N().S(` selected`) | ||||||
| //line views/admin.qtpl:52 | //line views/admin.qtpl:90 | ||||||
| 	} | 	} | ||||||
| //line views/admin.qtpl:52 | //line views/admin.qtpl:90 | ||||||
| 	qw422016.N().S(`>admin</option> | 	qw422016.N().S(`>admin</option> | ||||||
| 		</select> | 		</select> | ||||||
| 		<br> | 		<br> | ||||||
| @@ -181,31 +250,31 @@ func StreamAdminUsersUserHTML(qw422016 *qt422016.Writer, u *user.User) { | |||||||
| </main> | </main> | ||||||
| </div> | </div> | ||||||
| `) | `) | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| func WriteAdminUsersUserHTML(qq422016 qtio422016.Writer, u *user.User) { | func WriteAdminUsersUserHTML(qq422016 qtio422016.Writer, u *user.User) { | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| 	StreamAdminUsersUserHTML(qw422016, u) | 	StreamAdminUsersUserHTML(qw422016, u) | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| 	qt422016.ReleaseWriter(qw422016) | 	qt422016.ReleaseWriter(qw422016) | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| func AdminUsersUserHTML(u *user.User) string { | func AdminUsersUserHTML(u *user.User) string { | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| 	qb422016 := qt422016.AcquireByteBuffer() | 	qb422016 := qt422016.AcquireByteBuffer() | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| 	WriteAdminUsersUserHTML(qb422016, u) | 	WriteAdminUsersUserHTML(qb422016, u) | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| 	qs422016 := string(qb422016.B) | 	qs422016 := string(qb422016.B) | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| 	qt422016.ReleaseByteBuffer(qb422016) | 	qt422016.ReleaseByteBuffer(qb422016) | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| 	return qs422016 | 	return qs422016 | ||||||
| //line views/admin.qtpl:61 | //line views/admin.qtpl:99 | ||||||
| } | } | ||||||
|   | |||||||
| @@ -130,43 +130,6 @@ for u := range user.YieldUsers() { | |||||||
| </div> | </div> | ||||||
| {% endfunc %} | {% endfunc %} | ||||||
|  |  | ||||||
| {% func AdminPanelHTML() %} |  | ||||||
| <div class="layout"> |  | ||||||
| <main class="main-width"> |  | ||||||
| 	<h1>Administrative 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> |  | ||||||
| 		<form action="/admin/reindex-users" method="POST" style="float:left"> |  | ||||||
| 			<fieldset> |  | ||||||
| 				<legend>Reindex users</legend> |  | ||||||
| 				<input type="submit"> |  | ||||||
| 			</fieldset> |  | ||||||
| 		</form> |  | ||||||
| 	</section> |  | ||||||
| </main> |  | ||||||
| </div> |  | ||||||
| {% endfunc %} |  | ||||||
|  |  | ||||||
| {% func omnipresentScripts() %} | {% func omnipresentScripts() %} | ||||||
| {% for _, scriptPath := range cfg.OmnipresentScripts %} | {% for _, scriptPath := range cfg.OmnipresentScripts %} | ||||||
| <script src="{%s scriptPath %}"></script> | <script src="{%s scriptPath %}"></script> | ||||||
|   | |||||||
| @@ -461,118 +461,50 @@ func AboutHTML() string { | |||||||
| } | } | ||||||
|  |  | ||||||
| //line views/stuff.qtpl:133 | //line views/stuff.qtpl:133 | ||||||
| func StreamAdminPanelHTML(qw422016 *qt422016.Writer) { | func streamomnipresentScripts(qw422016 *qt422016.Writer) { | ||||||
| //line views/stuff.qtpl:133 | //line views/stuff.qtpl:133 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| <div class="layout"> |  | ||||||
| <main class="main-width"> |  | ||||||
| 	<h1>Administrative 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> |  | ||||||
| 		<form action="/admin/reindex-users" method="POST" style="float:left"> |  | ||||||
| 			<fieldset> |  | ||||||
| 				<legend>Reindex users</legend> |  | ||||||
| 				<input type="submit"> |  | ||||||
| 			</fieldset> |  | ||||||
| 		</form> |  | ||||||
| 	</section> |  | ||||||
| </main> |  | ||||||
| </div> |  | ||||||
| `) | `) | ||||||
| //line views/stuff.qtpl:168 | //line views/stuff.qtpl:134 | ||||||
| } |  | ||||||
|  |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| func WriteAdminPanelHTML(qq422016 qtio422016.Writer) { |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| 	StreamAdminPanelHTML(qw422016) |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| 	qt422016.ReleaseWriter(qw422016) |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| func AdminPanelHTML() string { |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| 	qb422016 := qt422016.AcquireByteBuffer() |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| 	WriteAdminPanelHTML(qb422016) |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| 	qs422016 := string(qb422016.B) |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| 	qt422016.ReleaseByteBuffer(qb422016) |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| 	return qs422016 |  | ||||||
| //line views/stuff.qtpl:168 |  | ||||||
| } |  | ||||||
|  |  | ||||||
| //line views/stuff.qtpl:170 |  | ||||||
| func streamomnipresentScripts(qw422016 *qt422016.Writer) { |  | ||||||
| //line views/stuff.qtpl:170 |  | ||||||
| 	qw422016.N().S(` |  | ||||||
| `) |  | ||||||
| //line views/stuff.qtpl:171 |  | ||||||
| 	for _, scriptPath := range cfg.OmnipresentScripts { | 	for _, scriptPath := range cfg.OmnipresentScripts { | ||||||
| //line views/stuff.qtpl:171 | //line views/stuff.qtpl:134 | ||||||
| 		qw422016.N().S(` | 		qw422016.N().S(` | ||||||
| <script src="`) | <script src="`) | ||||||
| //line views/stuff.qtpl:172 | //line views/stuff.qtpl:135 | ||||||
| 		qw422016.E().S(scriptPath) | 		qw422016.E().S(scriptPath) | ||||||
| //line views/stuff.qtpl:172 | //line views/stuff.qtpl:135 | ||||||
| 		qw422016.N().S(`"></script> | 		qw422016.N().S(`"></script> | ||||||
| `) | `) | ||||||
| //line views/stuff.qtpl:173 | //line views/stuff.qtpl:136 | ||||||
| 	} | 	} | ||||||
| //line views/stuff.qtpl:173 | //line views/stuff.qtpl:136 | ||||||
| 	qw422016.N().S(` | 	qw422016.N().S(` | ||||||
| `) | `) | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| func writeomnipresentScripts(qq422016 qtio422016.Writer) { | func writeomnipresentScripts(qq422016 qtio422016.Writer) { | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| 	streamomnipresentScripts(qw422016) | 	streamomnipresentScripts(qw422016) | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| 	qt422016.ReleaseWriter(qw422016) | 	qt422016.ReleaseWriter(qw422016) | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| } | } | ||||||
|  |  | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| func omnipresentScripts() string { | func omnipresentScripts() string { | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| 	qb422016 := qt422016.AcquireByteBuffer() | 	qb422016 := qt422016.AcquireByteBuffer() | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| 	writeomnipresentScripts(qb422016) | 	writeomnipresentScripts(qb422016) | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| 	qs422016 := string(qb422016.B) | 	qs422016 := string(qb422016.B) | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| 	qt422016.ReleaseByteBuffer(qb422016) | 	qt422016.ReleaseByteBuffer(qb422016) | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| 	return qs422016 | 	return qs422016 | ||||||
| //line views/stuff.qtpl:174 | //line views/stuff.qtpl:137 | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								web/admin.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								web/admin.go
									
									
									
									
									
								
							| @@ -2,9 +2,9 @@ package web | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"mime" |  | ||||||
| 	"io" | 	"io" | ||||||
| 	"log" | 	"log" | ||||||
|  | 	"mime" | ||||||
| 	"net/http" | 	"net/http" | ||||||
| 	"sort" | 	"sort" | ||||||
| 	"strings" | 	"strings" | ||||||
| @@ -18,9 +18,9 @@ import ( | |||||||
| // initAdmin sets up /admin routes if auth is used. Call it after you have decided if you want to use auth. | // initAdmin sets up /admin routes if auth is used. Call it after you have decided if you want to use auth. | ||||||
| func initAdmin() { | func initAdmin() { | ||||||
| 	if user.AuthUsed { | 	if user.AuthUsed { | ||||||
| 		http.HandleFunc("/admin", handlerAdmin) | 		http.HandleFunc("/admin/", handlerAdmin) | ||||||
| 		http.HandleFunc("/admin/shutdown", handlerAdminShutdown) | 		http.HandleFunc("/admin/shutdown/", handlerAdminShutdown) | ||||||
| 		http.HandleFunc("/admin/reindex-users", handlerAdminReindexUsers) | 		http.HandleFunc("/admin/reindex-users/", handlerAdminReindexUsers) | ||||||
|  |  | ||||||
| 		http.HandleFunc("/admin/users/", handlerAdminUsers) | 		http.HandleFunc("/admin/users/", handlerAdminUsers) | ||||||
| 	} | 	} | ||||||
| @@ -54,7 +54,7 @@ func handlerAdminReindexUsers(w http.ResponseWriter, rq *http.Request) { | |||||||
| 		user.ReadUsersFromFilesystem() | 		user.ReadUsersFromFilesystem() | ||||||
| 		redirectTo := rq.Referer() | 		redirectTo := rq.Referer() | ||||||
| 		if redirectTo == "" { | 		if redirectTo == "" { | ||||||
| 			redirectTo = "/hypha/"+cfg.UserHypha | 			redirectTo = "/hypha/" + cfg.UserHypha | ||||||
| 		} | 		} | ||||||
| 		http.Redirect(w, rq, redirectTo, http.StatusSeeOther) | 		http.Redirect(w, rq, redirectTo, http.StatusSeeOther) | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Timur Ismagilov
					Timur Ismagilov