Skip to content

Commit

Permalink
added loom studio
Browse files Browse the repository at this point in the history
  • Loading branch information
anujag authored and anujag committed Aug 9, 2012
1 parent 1a2ce99 commit b1f71c5
Show file tree
Hide file tree
Showing 11 changed files with 357 additions and 83 deletions.
46 changes: 42 additions & 4 deletions gstudio/methods.py
Expand Up @@ -13,22 +13,60 @@ def delete(idnum):


def make_rep_object(title,auth_id): def make_rep_object(title,auth_id):
new_ob = Gbobject() new_ob = Gbobject()
new_ob.title = title new_ob.content_org=title
myfile = open('/tmp/file.org', 'w')
myfile.write(new_ob.content_org)
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.write("\n#+TITLE: ")
myfile = open('/tmp/file.org', 'r')
stdout = os.popen(PYSCRIPT_URL_GSTUDIO)
output = stdout.read()
data = open("/tmp/file.html")
data1 = data.readlines()
data2 = data1[67:]
newdata=""
for line in data2:
newdata += line.lstrip()
new_ob.content = newdata
new_ob.title = "Re: " +title
new_ob.status = 2 new_ob.status = 2
new_ob.slug = slugify(title) new_ob.slug = slugify(title)
new_ob.content = ""
new_ob.save() new_ob.save()
new_ob.objecttypes.add(Objecttype.objects.get(title="Reply")) new_ob.objecttypes.add(Objecttype.objects.get(title="Reply"))
new_ob.authors.add(Author.objects.get(id=auth_id)) new_ob.authors.add(Author.objects.get(id=auth_id))
new_ob.sites.add(Site.objects.get_current()) new_ob.sites.add(Site.objects.get_current())
return new_ob return new_ob


def make_topic_object(title,auth_id,content): def make_topic_object(title,auth_id,content):
print "save"
new_ob = Gbobject() new_ob = Gbobject()
new_ob.title = title new_ob.title = "Query: " + title
new_ob.content_org = content
myfile = open('/tmp/file.org', 'w')
myfile.write(new_ob.content_org)
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.write("\n#+TITLE: ")
myfile = open('/tmp/file.org', 'r')
stdout = os.popen(PYSCRIPT_URL_GSTUDIO)
output = stdout.read()
data = open("/tmp/file.html")
data1 = data.readlines()
data2 = data1[67:]
newdata=""
for line in data2:
newdata += line.lstrip()
new_ob.content = newdata
new_ob.status = 2 new_ob.status = 2
new_ob.slug = slugify(title) new_ob.slug = slugify(title)
new_ob.content = content
new_ob.save() new_ob.save()
new_ob.objecttypes.add(Objecttype.objects.get(title="Topic")) new_ob.objecttypes.add(Objecttype.objects.get(title="Topic"))
new_ob.authors.add(Author.objects.get(id=auth_id)) new_ob.authors.add(Author.objects.get(id=auth_id))
Expand Down
32 changes: 32 additions & 0 deletions gstudio/static/gstudio/js/replycomment.js
@@ -0,0 +1,32 @@
$.noConflict();
jQuery(document).ready(function($) {
$(".commenteditor").one("click",function() {
$("#chart").hide();
$("#content").css({"width": "300px",})
document.getElementById('gnoweditor').style.visibility="visible";
$("#gnoweditor").orgitdown(mySettings);
var screentop=$(document).scrollTop();
$(".orgitdownContainer").css({"margin-top":screentop,});
});

$(".commentsavecontent").one("click",function(){
var org_data = $("#gnoweditor").val();


// document.getElementByClass("commentreptext").setAttribute("value",org_data);
var elmts = document.getElementsByClassName ("commentreptext");
for (var i = 0; i < elmts.length; i++) {
elmts[i].setAttribute("value",org_data);
}
alert(org_data);

});
$(".deleteresponse").one("click",function() {
var elmts=document.getElementsByClassName("deleteresponse");
alert("hai");
alert(elmts.length);



});
});
30 changes: 30 additions & 0 deletions gstudio/static/gstudio/js/replytotopic.js
@@ -0,0 +1,30 @@
$.noConflict();
jQuery(document).ready(function($) {
$(".editor").one("click",function() {
$("#chart").hide();
$("#content").css({"width": "300px",})
document.getElementById('gnoweditor').style.visibility="visible";
$("#gnoweditor").orgitdown(mySettings);
var screentop=$(document).scrollTop();
$(".orgitdownContainer").css({"margin-top":screentop,});

});


$(".savecontent").one("click",function() {
alert("Please click on Submit");
var org_data = $("#gnoweditor").val();

// alert(org_data);
// document.getElementsByClassName("reptext").value = org_data;

var elmts = document.getElementsByClassName ("reptext");
for (var i = 0; i < elmts.length; i++) {
elmts[i].setAttribute("value",org_data);
}

});



});
17 changes: 17 additions & 0 deletions gstudio/static/gstudio/js/topiccomment.js
@@ -0,0 +1,17 @@
$.noConflict();
jQuery(document).ready(function($) {
$("#topicaddcontent").one("click",function() {
$("#chart").hide();
$("#content").css({"width": "300px",})
document.getElementById('gnoweditor').style.visibility="visible";
$("#gnoweditor").orgitdown(mySettings);
var screentop=$(document).scrollTop();
$(".orgitdownContainer").css({"margin-top":screentop,});
});

$("#topicaddsave").one("click",function(){
var org_data = $("#gnoweditor").val();
$("#contenttext").val(org_data);
$('#topicsubmit').trigger('click');
});
});
24 changes: 21 additions & 3 deletions gstudio/templates/gstudio/NewTopic1.html
@@ -1,7 +1,20 @@


{% extends "gstudio/base.html" %} {% extends "gstudio/base.html" %}
{% block content %} {% block content %}
<h1>Add a new Topic</h1> <script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" >
$(window).load(function() {
$("#content").css({
"width": "1000px",});});
$(window).load(function() {
$("#chart").hide();});
$(window).load(function() {

$("#graphcss").hide();
});
</script>

<h1>Add a new Twist</h1>
{% if errors %} {% if errors %}
<ul> <ul>
{% for error in errors %} {% for error in errors %}
Expand All @@ -12,9 +25,14 @@ <h1>Add a new Topic</h1>


<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
<p>Title: <input type="text" name="subject"></p> <p>Title: <input type="text" name="subject"></p>
<p>Description: <textarea name="message" rows="10" cols="50"></textarea></p> <p>Description: <textarea name="message" id="contenttext" rows="10" cols="50" style="display:none" ></textarea></p>
<!-- style="display:none;" -->

<input type="button" id="topicaddcontent" name="content" value="Add Description">
<input type="button" id="topicaddsave" name="savecontent" value="Save">

<input type="hidden" value={{user.id}} name = "idusr"> <input type="hidden" value={{user.id}} name = "idusr">
<input type="submit" value="Submit"> <input type="submit" id="topicsubmit" value="Submit" style="display:none">
</form> </form>


{% endblock %} {% endblock %}
2 changes: 1 addition & 1 deletion gstudio/templates/gstudio/_header.html
Expand Up @@ -15,7 +15,7 @@


{% if user.is_authenticated %} {% if user.is_authenticated %}
{% if user.is_staff %} {% if user.is_staff %}
| <a href="{{ get_absolute_url }}/gstudio/user/{{user.username}}" title="MyBoard">Gnowledge Studio</a> | <a href="{{ get_absolute_url }}/gstudio/user/{{user.username}}" title="My Loom Studio">Loom Studio</a>
| <a href="{{ get_absolute_url }}/gstudio/resources/documents" title="My Documents">Documents</a> | <a href="{{ get_absolute_url }}/gstudio/resources/documents" title="My Documents">Documents</a>
| <a href="{{ get_absolute_url }}/gstudio/user/wikipage/{{user.username}}" title="MyWiki">Wikipage</a> | <a href="{{ get_absolute_url }}/gstudio/user/wikipage/{{user.username}}" title="MyWiki">Wikipage</a>
| <a href="{{ get_absolute_url }}/gstudio/resources/images" title="Images">Images</a> | <a href="{{ get_absolute_url }}/gstudio/resources/images" title="Images">Images</a>
Expand Down
10 changes: 10 additions & 0 deletions gstudio/templates/gstudio/skeleton.html
Expand Up @@ -283,6 +283,16 @@
<script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/sets/org/set.js"></script> <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/sets/org/set.js"></script>


<script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js"></script> <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}gstudio/js/replytotopic.js"></script>

<script type="text/javascript" src="{{STATIC_URL}}gstudio/js/replycomment.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/sets/org/set.js"></script>

<script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js"></script>

<script type="text/javascript" src="{{STATIC_URL}}gstudio/js/topiccomment.js"></script>



<script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/sets/savedata.js"></script> <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/sets/savedata.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
Expand Down

0 comments on commit b1f71c5

Please sign in to comment.