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 /objectapp | |
parent | be4ded863eaf69cf6080f39ede26c8b343e0fecf (diff) | |
download | gnowsys-06f170eae6261d894b9651e549d42abdfcecf46c.tar.gz |
orgitdown with save functionality
Diffstat (limited to 'objectapp')
-rw-r--r-- | objectapp/models.py | 2 | ||||
-rwxr-xr-x | objectapp/static/objectapp/js/orgitdown/orgitdown/jquery.orgitdown.js | 29 | ||||
-rw-r--r-- | objectapp/static/objectapp/js/orgitdown/orgitdown/sets/org/set.js | 3 | ||||
-rw-r--r-- | objectapp/static/objectapp/js/orgitdown/orgitdown/sets/savedata.js | 12 | ||||
-rw-r--r-- | objectapp/static/objectapp/js/orgitdown/orgitdown/skins/orgitdown/images/bg-editor.png | bin | 3013 -> 0 bytes | |||
-rw-r--r-- | objectapp/templates/objectapp/skeleton.html | 17 |
6 files changed, 46 insertions, 17 deletions
diff --git a/objectapp/models.py b/objectapp/models.py index 6c189f8..58b8222 100644 --- a/objectapp/models.py +++ b/objectapp/models.py @@ -161,7 +161,7 @@ class Gbobject(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) image = models.ImageField(_('image'), upload_to=UPLOAD_TO, blank=True, help_text=_('used for illustration')) diff --git a/objectapp/static/objectapp/js/orgitdown/orgitdown/jquery.orgitdown.js b/objectapp/static/objectapp/js/orgitdown/orgitdown/jquery.orgitdown.js index fe3a487..c766300 100755 --- a/objectapp/static/objectapp/js/orgitdown/orgitdown/jquery.orgitdown.js +++ b/objectapp/static/objectapp/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/objectapp/static/objectapp/js/orgitdown/orgitdown/sets/org/set.js b/objectapp/static/objectapp/js/orgitdown/orgitdown/sets/org/set.js index 5eed850..25b118e 100644 --- a/objectapp/static/objectapp/js/orgitdown/orgitdown/sets/org/set.js +++ b/objectapp/static/objectapp/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/objectapp/static/objectapp/js/orgitdown/orgitdown/sets/savedata.js b/objectapp/static/objectapp/js/orgitdown/orgitdown/sets/savedata.js index f407075..eaf728c 100644 --- a/objectapp/static/objectapp/js/orgitdown/orgitdown/sets/savedata.js +++ b/objectapp/static/objectapp/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/objectapp/static/objectapp/js/orgitdown/orgitdown/skins/orgitdown/images/bg-editor.png b/objectapp/static/objectapp/js/orgitdown/orgitdown/skins/orgitdown/images/bg-editor.png Binary files differdeleted file mode 100644 index 31fae12..0000000 --- a/objectapp/static/objectapp/js/orgitdown/orgitdown/skins/orgitdown/images/bg-editor.png +++ /dev/null diff --git a/objectapp/templates/objectapp/skeleton.html b/objectapp/templates/objectapp/skeleton.html index 9645957..76cd820 100644 --- a/objectapp/templates/objectapp/skeleton.html +++ b/objectapp/templates/objectapp/skeleton.html @@ -53,30 +53,33 @@ 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 { |