mirror of
https://github.com/documize/community.git
synced 2025-07-23 07:09:43 +02:00
WIP
This commit is contained in:
parent
d0970c153b
commit
f916801008
3 changed files with 176 additions and 8 deletions
|
@ -732,6 +732,18 @@ func (h *Handler) Export(w http.ResponseWriter, r *http.Request) {
|
||||||
method := "document.Export"
|
method := "document.Export"
|
||||||
ctx := domain.GetRequestContext(r)
|
ctx := domain.GetRequestContext(r)
|
||||||
|
|
||||||
|
// Deduce ORG if anon user.
|
||||||
|
if len(ctx.OrgID) == 0 {
|
||||||
|
ctx.Subdomain = organization.GetSubdomainFromHost(r)
|
||||||
|
org, err := h.Store.Organization.GetOrganizationByDomain(ctx.Subdomain)
|
||||||
|
if err != nil {
|
||||||
|
response.WriteServerError(w, method, err)
|
||||||
|
h.Runtime.Log.Error(method, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.OrgID = org.RefID
|
||||||
|
}
|
||||||
|
|
||||||
defer streamutil.Close(r.Body)
|
defer streamutil.Close(r.Body)
|
||||||
body, err := ioutil.ReadAll(r.Body)
|
body, err := ioutil.ReadAll(r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -756,6 +768,6 @@ func (h *Handler) Export(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||||
w.Write([]byte(export))
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
|
w.Write([]byte(export))
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -363,7 +363,7 @@ export default Service.extend({
|
||||||
return this.get('ajax').post('export', {
|
return this.get('ajax').post('export', {
|
||||||
data: JSON.stringify(spec),
|
data: JSON.stringify(spec),
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
dataType: 'text/html'
|
dataType: 'html'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue