diff options
author | supriya <supriya@dragbox.(none)> | 2012-06-11 16:24:50 +0530 |
---|---|---|
committer | supriya <supriya@dragbox.(none)> | 2012-06-11 16:24:50 +0530 |
commit | 04f1a3ffa2b83e2849d7e3f7902de0309cf7443c (patch) | |
tree | 11e029fa6a875d004a81aa2c5dd93cc75537be9b /gstudio/views | |
parent | 833243ea72813e1e3c4256fc00b9e0576e66cf06 (diff) | |
download | gnowsys-04f1a3ffa2b83e2849d7e3f7902de0309cf7443c.tar.gz |
Gnowmacs editor added to gnowsys-studio
Diffstat (limited to 'gstudio/views')
-rw-r--r-- | gstudio/views/ajaxviews.py | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/gstudio/views/ajaxviews.py b/gstudio/views/ajaxviews.py index 23c06e5..c35ca83 100644 --- a/gstudio/views/ajaxviews.py +++ b/gstudio/views/ajaxviews.py @@ -20,6 +20,8 @@ import json from gstudio.models import * from objectapp.models import * rlist={} +import os +from settings import PYSCRIPT_URL_GSTUDIO def AjaxAttribute(request): iden = request.GET["id"] @@ -338,7 +340,57 @@ def selectionlist_OB(obj): rlist=additemdict(rlist,each) return rlist - +def AjaxAddContentOrg(request): + iden = request.GET["id"] + content = request.GET["contentorg"] + nid = NID.objects.get(id = iden) + refobj = nid.ref + refobj.content_org = content + refobj.save() + return HttpResponse("sucess") + + +def AjaxCreateFile(request): + iden = request.GET["id"] + # newtitle = request.GET["title"] + orgcontent = request.GET["content_org"] + myfile = open('/tmp/file.org', 'w') + myfile.write(orgcontent) + myfile.close() + myfile = open('/tmp/file.org', 'r') + myfile.readline() + myfile = open('/tmp/file.org', 'a') + myfile.write("\n#+OPTIONS: timestamp:nil author:nil creator:nil H:3 num:nil toc:nil @:t ::t |:t ^:t -:t f:t *:t <:t") + myfile = open('/tmp/file.org', 'r') + +# os.remove("/tmp/file.org") + return HttpResponse("test sucess") + +# def AjaxSetOption(request): +# myfile = open('/tmp/file.org', 'a') +# myfile.write("\n#+OPTIONS: timestamp:nil author:nil creator:nil H:3 num:t toc:nil @:t ::t |:t ^:t -:t f:t *:t <:t") +# myfile = open('/tmp/file.org', 'r') +# return HttpResponse("set option") + +def AjaxCreateHtml(request): + stdout = os.popen(PYSCRIPT_URL_GSTUDIO) + output = stdout.read() + return HttpResponse(output) + +def AjaxAddContent(request): + iden = request.GET["id"] + nid = NID.objects.get(id = iden) + refobj = nid.ref + data = open("/tmp/file.html") + data1 = data.readlines() + data2 = data1[67:] + newdata="" + for line in data2: + newdata += line.lstrip() + refobj.content= newdata + refobj.save() + return HttpResponse(refobj.content) + |