diff options
author | supriya <supriya@dragbox.(none)> | 2012-07-12 12:03:28 +0530 |
---|---|---|
committer | supriya <supriya@dragbox.(none)> | 2012-07-12 12:03:28 +0530 |
commit | 06f170eae6261d894b9651e549d42abdfcecf46c (patch) | |
tree | eeeb2be8a207110613129e4a1c0e3148390acd73 /gstudio | |
parent | be4ded863eaf69cf6080f39ede26c8b343e0fecf (diff) | |
download | gnowsys-06f170eae6261d894b9651e549d42abdfcecf46c.tar.gz |
orgitdown with save functionality
Diffstat (limited to 'gstudio')
-rw-r--r-- | gstudio/models.py | 2 | ||||
-rwxr-xr-x | gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js | 29 | ||||
-rw-r--r-- | gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/set.js | 3 | ||||
-rw-r--r-- | gstudio/static/gstudio/js/orgitdown/orgitdown/sets/savedata.js | 12 | ||||
-rw-r--r-- | gstudio/static/gstudio/js/orgitdown/orgitdown/skins/orgitdown/images/bg-editor.png | bin | 3013 -> 0 bytes | |||
-rw-r--r-- | gstudio/templates/gstudio/skeleton.html | 18 | ||||
-rw-r--r-- | gstudio/views/ajaxviews.py | 3 |
7 files changed, 48 insertions, 19 deletions
diff --git a/gstudio/models.py b/gstudio/models.py index 690fccc..1518229 100644 --- a/gstudio/models.py +++ b/gstudio/models.py @@ -755,7 +755,7 @@ class Nodetype(Node): (PUBLISHED, _('published'))) content = models.TextField(_('content'), null=True, blank=True) - # content_org = models.TextField(_('content'), null=True, blank=True) + content_org = models.TextField(_('content_org'), null=True, blank=True) parent = models.ForeignKey('self', null=True, blank=True, verbose_name=_('is a kind of'), related_name='children') diff --git a/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js b/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js index fe3a487..c766300 100755 --- a/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js @@ -438,7 +438,34 @@ } return selection; } - + function save() { + var org_data = $("#gnoweditor").val(); + var id = document.getElementById("objectid").value + document.getElementById("orgcontent").value = org_data; + var encode_data = encodeURIComponent(org_data); + + $.ajax({ + url: '/nodetypes/ajax/contentorgadd/?id=' + id + '&contentorg=' + encode_data, + success: function(data) { + $.ajax({ + url: '/nodetypes/ajax/ajaxcreatefile/?id=' +id+ '&content_org=' +encode_data, + success: function(data) { + $.ajax({ + url: '/nodetypes/ajax/ajaxcreatehtml/', + success: function(data) { + $.ajax({ + url: '/nodetypes/ajax/contentadd/?id=' +id, + success: function(data) { + alert("Data Saved"); + location.reload();} + }); + } + }); + } + }); + + } + });} // open preview window function preview() { if (typeof options.previewHandler === 'function') { diff --git a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/set.js b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/set.js index 5eed850..25b118e 100644 --- a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/set.js +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/set.js @@ -14,6 +14,7 @@ var mySettings = { onAltEnter: {keepDefault:false, replaceWith:'\n* '}, onAltrightArrow: {keepDefault:false, replaceWith:'*'}, markupSet: [ + {name:'Save', key:'S',call:'save' }, {name:'Bold', key:'B', openWith:'*', closeWith:'*' }, {name:'Italic', key:'I', openWith:'/', closeWith:'/' }, {name:'Stroke through', key:'S', openWith:'+', closeWith:'+' }, @@ -21,7 +22,7 @@ var mySettings = { {name:'Bulleted List', openWith:' - ', closeWith:'', multiline:true, openBlockWith:'\n', closeBlockWith:'\n'}, {name:'Numeric List', openWith:' 1. ', closeWith:'', multiline:true, openBlockWith:'\n', closeBlockWith:'\n'}, {separator:'---------------' }, - {name:'Picture', key:'P', replaceWith:'[[file:fileName.jpg]]' }, + {name:'Picture', key:'P', replaceWith:'[[http:fileName.jpg]]' }, {name:'Link', key:'L', openWith:'[[http://your.address.com here/][Your visible link text here]]', closeWith:'', placeHolder:'' }, {separator:'---------------' }, {name:'Clean', className:'clean', replaceWith:function(orgitdown) { return orgitdown.selection.replace(/<(.*?)>/g, "") } }, diff --git a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/savedata.js b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/savedata.js index f407075..eaf728c 100644 --- a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/savedata.js +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/savedata.js @@ -1,15 +1,13 @@ $.noConflict(); jQuery(document).ready(function($) { - // Code that uses jQuery's $ can follow here. - $("#editdata").click(function(){ - // $("html").css({"margin":"0","padding": "0","overflow":"hidden","height": "100%"}); + $("#editdata").one("click",function() { $("#chart").hide(); + var orgdata = document.getElementById('orgcontent').value; document.getElementById('gnoweditor').style.visibility="visible"; - //$("#gnoweditor").show(); - $("#gnoweditor").orgitdown(mySettings); - // alert($("#gnoweditor").val()); + $("#gnoweditor").orgitdown(mySettings); + $("#gnoweditor").val(orgdata); - }); + }); }); diff --git a/gstudio/static/gstudio/js/orgitdown/orgitdown/skins/orgitdown/images/bg-editor.png b/gstudio/static/gstudio/js/orgitdown/orgitdown/skins/orgitdown/images/bg-editor.png Binary files differdeleted file mode 100644 index 31fae12..0000000 --- a/gstudio/static/gstudio/js/orgitdown/orgitdown/skins/orgitdown/images/bg-editor.png +++ /dev/null diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html index 7c1c698..8716969 100644 --- a/gstudio/templates/gstudio/skeleton.html +++ b/gstudio/templates/gstudio/skeleton.html @@ -51,32 +51,34 @@ display: block; position: absolute; } - .orgitdown .orgitdownButton1 a { - background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/bold.png); + background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/org/images/save.jpeg); } .orgitdown .orgitdownButton2 a { - background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/italic.png); + background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/bold.png); } .orgitdown .orgitdownButton3 a { + background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/italic.png); +} +.orgitdown .orgitdownButton4 a { background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/stroke.png); } -.orgitdown .orgitdownButton4 a { +.orgitdown .orgitdownButton5 a { background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/list-bullet.png); } -.orgitdown .orgitdownButton5 a { +.orgitdown .orgitdownButton6 a { background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/list-numeric.png); } -.orgitdown .orgitdownButton6 a { +.orgitdown .orgitdownButton7 a { background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/picture.png); } -.orgitdown .orgitdownButton7 a { +.orgitdown .orgitdownButton8 a { background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/link.png); } -.orgitdown .orgitdownButton8 a { +.orgitdown .orgitdownButton9 a { background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/clean.png); } .orgitdown .preview a { diff --git a/gstudio/views/ajaxviews.py b/gstudio/views/ajaxviews.py index c35ca83..45064a1 100644 --- a/gstudio/views/ajaxviews.py +++ b/gstudio/views/ajaxviews.py @@ -361,6 +361,7 @@ def AjaxCreateFile(request): 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.write("\n#+TITLE:nil ") myfile = open('/tmp/file.org', 'r') # os.remove("/tmp/file.org") @@ -375,7 +376,7 @@ def AjaxCreateFile(request): def AjaxCreateHtml(request): stdout = os.popen(PYSCRIPT_URL_GSTUDIO) output = stdout.read() - return HttpResponse(output) + return HttpResponse("sucess") def AjaxAddContent(request): iden = request.GET["id"] |