From b1f71c5439e3bdf7a3c0fb2c1730d6242c6356d9 Mon Sep 17 00:00:00 2001 From: anujag Date: Thu, 9 Aug 2012 18:38:06 +0530 Subject: added loom studio --- gstudio/methods.py | 46 ++++- gstudio/static/gstudio/js/replycomment.js | 32 ++++ gstudio/static/gstudio/js/replytotopic.js | 30 +++ gstudio/static/gstudio/js/topiccomment.js | 17 ++ gstudio/templates/gstudio/NewTopic1.html | 24 ++- gstudio/templates/gstudio/_header.html | 2 +- gstudio/templates/gstudio/skeleton.html | 10 + gstudio/templates/gstudio/tags/comment.html | 204 ++++++++++++++++----- gstudio/templates/metadashboard/grpdashboard.html | 62 ++++--- gstudio/templates/metadashboard/userdashboard.html | 10 +- gstudio/views/group.py | 3 +- 11 files changed, 357 insertions(+), 83 deletions(-) create mode 100644 gstudio/static/gstudio/js/replycomment.js create mode 100644 gstudio/static/gstudio/js/replytotopic.js create mode 100644 gstudio/static/gstudio/js/topiccomment.js (limited to 'gstudio') diff --git a/gstudio/methods.py b/gstudio/methods.py index 7040716..2b6e0ee 100644 --- a/gstudio/methods.py +++ b/gstudio/methods.py @@ -13,10 +13,28 @@ def delete(idnum): def make_rep_object(title,auth_id): 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.slug = slugify(title) - new_ob.content = "" new_ob.save() new_ob.objecttypes.add(Objecttype.objects.get(title="Reply")) new_ob.authors.add(Author.objects.get(id=auth_id)) @@ -24,11 +42,31 @@ def make_rep_object(title,auth_id): return new_ob def make_topic_object(title,auth_id,content): + print "save" 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.slug = slugify(title) - new_ob.content = content + new_ob.save() new_ob.objecttypes.add(Objecttype.objects.get(title="Topic")) new_ob.authors.add(Author.objects.get(id=auth_id)) diff --git a/gstudio/static/gstudio/js/replycomment.js b/gstudio/static/gstudio/js/replycomment.js new file mode 100644 index 0000000..8e33eba --- /dev/null +++ b/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); + + + + }); +}); diff --git a/gstudio/static/gstudio/js/replytotopic.js b/gstudio/static/gstudio/js/replytotopic.js new file mode 100644 index 0000000..7f14b31 --- /dev/null +++ b/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); + } + + }); + + + + }); diff --git a/gstudio/static/gstudio/js/topiccomment.js b/gstudio/static/gstudio/js/topiccomment.js new file mode 100644 index 0000000..611b9d1 --- /dev/null +++ b/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'); + }); + }); diff --git a/gstudio/templates/gstudio/NewTopic1.html b/gstudio/templates/gstudio/NewTopic1.html index 38a61c5..5f2db82 100644 --- a/gstudio/templates/gstudio/NewTopic1.html +++ b/gstudio/templates/gstudio/NewTopic1.html @@ -1,7 +1,20 @@ {% extends "gstudio/base.html" %} {% block content %} -

Add a new Topic

+ + + +

Add a new Twist

{% if errors %} + +
+ + + +
  • {{each}}'s fabric +{% if child.rating.get_rating %} +Current rating is {{ child.rating.get_rating }}
    {% endif %} +{{child.content}} +
    {% csrf_token %} + + + + + + + +



    + + + + + + +
    + Do you wanna rate it ?
    + + + + + + +
    + +
    +
  • + + + {% show_comment child idusr flag admin_id attribute%} + + + {% else %} + {% ifequal idusr each.id %} + +
    + +{{each}}'s Response
    +{% if child.rating.get_rating %} +Current rating is {{ child.rating.get_rating }}
    +{% endif %} + {{child.content}} +
    {% csrf_token %} + + + + + +



    + + + + + + + + + +
    + Do you wanna rate it ?
    + + + + + + +
    + + +
    +
    + {% show_comment child idusr flag admin_id attribute%} + + + {% else %} + {% ifequal attribute "true" %} + +
    + + {{each}}'s Response
    +{% if child.rating.get_rating %} +Current rating is {{ child.rating.get_rating }}
    +{% endif %} + {{child.content}} + +
    {% csrf_token %} + + + + + +



    + + + + + +
    + Rate this response
    + + + + + + +
    + + +
    + +
    + + {% show_comment child idusr flag admin_id attribute%} {% endifequal %} + {% endifequal %} + {% endifequal %} + {% endfor %} + {% endfor %} + +{% endif %} diff --git a/gstudio/templates/metadashboard/grpdashboard.html b/gstudio/templates/metadashboard/grpdashboard.html index e92f616..f6cb6c0 100644 --- a/gstudio/templates/metadashboard/grpdashboard.html +++ b/gstudio/templates/metadashboard/grpdashboard.html @@ -14,14 +14,25 @@ $(window).load(function() { $("#graphcss").hide(); }); +var i=0; + {% if user.is_authenticated %} - - Hello Welcome to the {{ meet_ob.title }}
    -

    This Discussion was initiated by {{admin_m.username}}

    + +

    {{admin_m.username}}'s initial twist to the thread

    - You are logged in as {{user.username}} +
    {%if flag %}
    @@ -42,55 +53,60 @@ $(window).load(function() {
    {% csrf_token %} - +
    - - + + +
    {% autoescape off %} {% for each in topic %}

    {{each.title}}

    Posted on : {{each.creation_date}} - Posted by : + by : {% for author in each.authors.all %} {{author}} {% endfor %}
    - Current rating is
    {{ each.rating.get_rating }}
    + {%autoescape on%} - {{each.content}} + {% with each.html_content|safe as each_content %} + {{each_content}} + {% endwith %} {% endautoescape%}
    {% csrf_token %} - Reply to the main thread : - + + -
    - - Do you wanna rate it ?
    +


    + + + +
    + +
    + + +

    - Replies : + Fibers : +

    On the loom now:


    {% for each in meetings.member_systems.all %} {{each.title}}
    {% endfor %} - +


    {% else %} -

    OOPS!!! Login Please!

    +

    Please Login

    {% endif %} diff --git a/gstudio/views/group.py b/gstudio/views/group.py index 157e276..d38b5ae 100644 --- a/gstudio/views/group.py +++ b/gstudio/views/group.py @@ -54,7 +54,8 @@ def groupdashboard(request,grpid): rep = request.POST.get("reply",'') id_no = request.POST.get("iden",'') id_no1 = request.POST.get("parentid","") - idusr = request.POST.get("idusr",'') + print "topicid",id_no,"replyid",id_no1,"reply",rep + idusr = request.POST.get("idusr",'') rating = request.POST.get("star1","") flag1=request.POST.get("release","") block = request.POST.get("block","") -- cgit v1.1