contented integration

This commit is contained in:
mappu 2017-10-08 17:08:26 +13:00
parent 5347efb51a
commit 179617d058
2 changed files with 21 additions and 0 deletions

View File

@ -21,6 +21,7 @@ type ServerOptions struct {
ExternalBaseURL string
DeclareRSSLanguage string
DeclareRSSEmail string
ContentedServer string
}
func DefaultOptions() *ServerOptions {
@ -41,5 +42,6 @@ func DefaultOptions() *ServerOptions {
ExternalBaseURL: "http://127.0.0.1/",
DeclareRSSLanguage: "en-GB",
DeclareRSSEmail: `nobody@example.com`,
ContentedServer: "",
}
}

View File

@ -49,6 +49,25 @@ func (this *WikiServer) routeModify(w http.ResponseWriter, r *http.Request, arti
</label>
<input type="submit" value="Save &raquo;">
| <a href="` + template.HTMLEscapeString(this.opts.ExpectBaseURL+`formatting`) + `" target="_blank">formatting&nbsp;help</a>
`
if len(this.opts.ContentedServer) > 0 {
content += `
<script type="text/javascript" src="` + this.opts.ContentedServer + `jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="` + this.opts.ContentedServer + `sdk.js"></script>
| <a href="javascript:;" id="open-contented-uploader">upload...</a>
<script type="text/javascript">
$("#open-contented-uploader").on('click', function() {
contented.init("#contentctr", function(items) {
for (var i = 0; i < items.length; ++i) {
$("#contentctr textarea").append(" " + "` + this.opts.ContentedServer + `get/" + items[i] + " ");
}
});
});
</script>
`
}
content += `
</div>
<div id="contentctr"><textarea name="content">` + template.HTMLEscapeString(existingBody) + `</textarea></div>
</form>