diff options
Diffstat (limited to 'gstudio')
27 files changed, 1129 insertions, 182 deletions
diff --git a/gstudio/methods.py b/gstudio/methods.py index b0b75d3e..3d3b263a 100644 --- a/gstudio/methods.py +++ b/gstudio/methods.py @@ -6,6 +6,16 @@ import os from demo.settings import PYSCRIPT_URL_GSTUDIO from demo.settings import FILE_URL +def get_threadbox_of_twist(twistid): + thid="" + for each in System.objects.all(): + sys_set=each.system_set.all() + if sys_set: + sys_set=each.system_set.all()[0] + for eachsys in sys_set.gbobject_set.all(): + if eachsys.id==twistid: + return sys_set + return thid def delete(idnum): del_ob = Gbobject.objects.get(id=idnum) @@ -41,8 +51,9 @@ def make_rep_object(title,auth_id,usr): data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -83,8 +94,9 @@ def edit_section(sec_id,title,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -119,8 +131,9 @@ def make_topic_object(title,auth_id,content,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -163,8 +176,9 @@ def make_sectionreply_object(content_org,title,auth_id,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -208,8 +222,9 @@ def make_section_object(title,auth_id,content_org,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -278,8 +293,9 @@ def create_meeting(title,idusr,content,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -340,8 +356,9 @@ def create_wikipage(title,idusr,content_org,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -351,15 +368,15 @@ def create_wikipage(title,idusr,content_org,usr): sys.systemtypes.add(Systemtype.objects.get(title="Wikipage")) sys.authors.add(Author.objects.get(id=idusr)) - a = Attribute() - a.title = "released button of " + title - a.slug = slugify(a.title) - a.content = a.slug - a.status = 2 - a.subject = sys - a.svalue = "False" - a.attributetype_id = Attributetype.objects.get(title="pagerelease").id - a.save() + #a = Attribute() + #a.title = "released button of " + title + #a.slug = slugify(a.title) + #a.content = a.slug + #a.status = 2 + #a.subject = sys + #a.svalue = "False" + #a.attributetype_id = Attributetype.objects.get(title="pagerelease").id + #a.save() sys1 = System() sys1.title = "page box of " + title sys1.status = 2 @@ -387,19 +404,19 @@ def make_att_false(meet_ob): meet_ob.subject_of.add(each) break -def make_att1_true(page_ob): - for each in page_ob.subject_of.all(): - if(each.attributetype.title=='pagerelease'): - each.svalue = "true" - page_ob.subject_of.add(each) - break +#def make_att1_true(page_ob): + # for each in page_ob.subject_of.all(): + # if(each.attributetype.title=='pagerelease'): + # each.svalue = "true" + # page_ob.subject_of.add(each) + # break -def make_att1_false(page_ob): - for each in page_ob.subject_of.all(): - if(each.attributetype.title=='pagerelease'): - each.svalue = "" - page_ob.subject_of.add(each) - break +#def make_att1_false(page_ob): + # for each in page_ob.subject_of.all(): + # if(each.attributetype.title=='pagerelease'): + # each.svalue = "" + # page_ob.subject_of.add(each) + # break def schedule_time(stTime, endTime, sys_id): sys=System.objects.get(id=sys_id) @@ -413,7 +430,7 @@ def schedule_time(stTime, endTime, sys_id): ate.subject=sys; ate.value=endTime; ate.attributetype=atty2; ate.save() ats.save() - sys.save() + #sys.save() return sys.id @@ -440,7 +457,7 @@ def get_time(sys_id): meetover=True else: meetover=False - return (later, meetover, starttime, endtime) + return (later, meetover, starttime, endtime) def del_comment(comment_id): ob = Gbobject.objects.get(id=int(comment_id)) for each in ob.posterior_nodes.all(): @@ -488,8 +505,9 @@ def edit_topic(topic_id,title,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -523,8 +541,9 @@ def edit_thread(thread_id,title,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -561,8 +580,9 @@ def edit_nodetype(iden,rep,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -576,6 +596,28 @@ def check_release_or_not(meet_ob): if (each.attributetype.title=='release' and each.svalue=='true'): fl=1 return fl +def check_subscribe_or_not(meet_ob,user): + fl=0 + box=meet_ob.system_set.all()[0] + ch=Author.objects.filter(id=user.id) + if ch: + ch=Author.objects.get(id=user.id) + else: + ch="" + for each in box.member_set.all(): + if each == ch: + fl=1 + return fl + +def check_usr_admin(userid): + fl=0 + aut=Author.objects.filter(id=userid) + if aut: + aut=Author.objects.get(id=userid) + if aut.is_superuser: + fl=1 + return fl + def get_factory_loom_OTs(): retlist=[] @@ -584,3 +626,24 @@ def get_factory_loom_OTs(): if ((each.parent.title=='Factory_Object') and (str(each.slug)[0:4]=='loom')): retlist.append(each.title) return retlist + +def get_home_content(): + homeobj=Gbobject.objects.filter(title="home_specific_detail") + if homeobj: + homeobj=Gbobject.objects.get(title="home_specific_detail") + return homeobj.content + +def get_more_content(): + moreobj=Gbobject.objects.filter(title="more_specific_detail") + if moreobj: + moreobj=Gbobject.objects.get(title="more_specific_detail") + return moreobj.content + +def get_home_title(): + homeobj=Gbobject.objects.filter(title="home_title") + content = "" + if homeobj: + homeobj=Gbobject.objects.get(title="home_title") + content = homeobj.content + return content + diff --git a/gstudio/models.py b/gstudio/models.py index cd529c4d..98ff1bea 100644 --- a/gstudio/models.py +++ b/gstudio/models.py @@ -952,7 +952,7 @@ class Nodetype(Node): g_json["relations"].append({"from":self.id ,"type":str(key),"value":1,"to":predicate_id[key] }) - if not isinstance(nbh[key],basestring) and len(nbh[key])<=2: + if not isinstance(nbh[key],basestring) and len(nbh[key])<=10: for item in nbh[key]: if isinstance(item,unicode): g_json["node_metadata"].append({"_id":(str(attr_counter)+"b"),"screen_name":str(item)}) diff --git a/gstudio/static/gstudio/js/addcontent.js b/gstudio/static/gstudio/js/addcontent.js index 5c0c4bc2..54be47a3 100644 --- a/gstudio/static/gstudio/js/addcontent.js +++ b/gstudio/static/gstudio/js/addcontent.js @@ -8,6 +8,7 @@ var isSubsection=false; var editSubsection=false; var isNode=false; + var isObject=false; function subsecsave(objid){ var org_data = $("#gnoweditor").val(); var encode_data = encodeURIComponent(org_data); @@ -40,13 +41,15 @@ }); $("#pagecontent1").one("click",function() { + $(this).replaceWith('<textarea id="gnoweditor" style="visibility:hidden;width:450px"></textarea>'); isWikipage=true; - $("#chart").hide(); - document.getElementById('gnoweditor').style.visibility="visible"; - $("#gnoweditor").orgitdown(mySettings); + $("#chart").hide(); + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + $(".orgitdownContainer").css({"margin-top":"0px","margin-left":"10px"}); //$("#save1").show(); - $("#pagecontent1").hide(); - $("#content").css({"width":"300px",}) + $("#pagecontent1").hide(); + $("#content").css({"width":"300px",}) }); $("#save1").one("click",function() { var org_data = $("#gnoweditor").val(); @@ -125,6 +128,7 @@ $(".deletesec").hide(); }); $(".editpagecontent").one("click",function(){ + $(this).replaceWith('<textarea id="gnoweditor" style="visibility:hidden;width:450px"></textarea>'); editWikipage=true; $("#chart").hide(); $(".editpagecontent").hide(); @@ -139,11 +143,11 @@ var elmts = document.getElementsByClassName("editval"); for (var i = 0; i < elmts.length; i++){ elmts[i].setAttribute("value","edited");} - var screenTop = $(document).scrollTop(); + // var screenTop = $(document).scrollTop(); $(".orgitdownContainer").css({ - "margin-top":screenTop,}); - $(".tag").hide(); - $(".tagtext").hide(); + "margin-top":"0px","margin-left":"10px"}); + //$(".tag").hide(); + //$(".tagtext").hide(); $("#newsection1").hide(); $(".createsubsection").hide(); $("#rating").hide(); @@ -163,6 +167,7 @@ elmts[i].setAttribute("value",decode_data);} $(".pagedit").trigger('click'); $(".savepagecontent").hide(); + $(".orgitdownContainer").hide(); }); $("#editnodecontent").one("click",function(){ @@ -194,6 +199,37 @@ $("#nodedit").hide(); }); + + $("#editobjectcontent").one("click",function(){ + isObject=true; + $("#chart").hide(); + $("#content img").css({"max-width":"600px",}) + + $("#content").css({"width":"600px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var a = this.name; + + $("#gnoweditor").val(a); + var screenTop = $(document).scrollTop(); + $(".orgitdownContainer").css({ + "margin-top":screenTop,}); + $("#editnodecontent").hide(); + //$("#savenodecontent").show(); + $("#objectedit").hide(); + + }); + $("#saveobjectcontent").one("click",function(){ + var org_data = $("#gnoweditor").val(); + var encode_data = encodeURIComponent(org_data); + + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + $("#reptext").val(decode_data); + $("#objectedit").trigger('click'); + $("#objectedit").hide(); + + }); + $(".createsubsection").one("click",function(){ isSubsection=true; diff --git a/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js b/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js index 6e207a0d..78974fd8 100644 --- a/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js @@ -474,7 +474,8 @@ $("#save1").trigger('click');} if (isNode){ $("#savenodecontent").trigger('click');} - + if (isObject){ + $("#saveobjectcontent").trigger('click');} if (editWikipage){ $(".savepagecontent").trigger('click');} if (isSection){ @@ -505,7 +506,8 @@ $("#save"+objid).trigger('click');} if (isVideotitle){ $("#titlesave").trigger('click');} - + if(isSubResponse){ + saveclick(objid);} } // open preview window diff --git a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/images/video.jpeg b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/images/video.jpeg Binary files differnew file mode 100644 index 00000000..8edf9d6c --- /dev/null +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/images/video.jpeg 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 17121d78..3ed79ff1 100644 --- a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/set.js +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/set.js @@ -26,6 +26,7 @@ var mySettings = { {name:'Picture', key:'P', replaceWith:'\n#+CAPTION: \n#+ATTR_HTML: width="600" \n[[http:fileName.jpg]]\n' }, {name:'Link', key:'L', openWith:'[[http://your.address.com here/][Your visible link text here]]', closeWith:'', placeHolder:'' }, {separator:'---------------' }, + {name:'Insert Embed Html',replaceWith:'\n#+BEGIN_HTML \n#+END_HTML\n' }, {name:'Close',call:'close' } //{name:'Clean', className:'clean', replaceWith:function(orgitdown) { return orgitdown.selection.replace(/<(.*?)>/g, "") } } diff --git a/gstudio/templates/gstudio/_header.html b/gstudio/templates/gstudio/_header.html index 123b05da..6523fcf3 100644 --- a/gstudio/templates/gstudio/_header.html +++ b/gstudio/templates/gstudio/_header.html @@ -18,8 +18,10 @@ | <a href="{{ get_absolute_url }}/gstudio/resources/documents" title="My Documents">Documents</a> | <a href="{{ get_absolute_url }}/gstudio/resources/images" title="Images">Images</a> | <a href="{{ get_absolute_url }}/gstudio/resources/videos" title="My Videos">Videos</a> +<!-- | <a href="{{ get_absolute_url }}/nodetypes" title="Nodes">Node Types</a> | <a href="{{ get_absolute_url }}/objects" title="Objects">Node Objects</a> +--> {% if user.is_authenticated %} {% if user.is_staff %} diff --git a/gstudio/templates/gstudio/addingtag.html b/gstudio/templates/gstudio/addingtag.html new file mode 100644 index 00000000..2e505015 --- /dev/null +++ b/gstudio/templates/gstudio/addingtag.html @@ -0,0 +1,82 @@ +{% load gstudio_tags %} +{% load tagging_tags comments i18n %} + +<script type="text/javascript" > +var availableTags = []; +$.merge(availableTags, {% get_add_tag %}) + + +jQuery(document).ready(function($) { +$(".tag{{objectid}}").click(function(){ +data = $("#tags{{objectid}}").attr('value'); +$.ajax({ +url: '/gstudio/resources/images/addtag/', +//type: 'POST', +data: {objectid:{{objectid}},data:data}, +success: function(data){ +$('.tags{{objectid}}').html(data); + +} +}); +$("#tags{{objectid}}").val(""); +}); + +/*$(".deletetags").click(function(){ +tagname = $(this).attr('value'); + +$.ajax({ +url: '/gstudio/resources/images/deletetag/', +//type: 'POST', +data: {objectid:{{objectid}},data:tagname}, +success: function(data){ +$('.tags{{objectid}}').html(data); +} +}); + +});*/ +}); +function tagfunction(arr,id){ +tagname = arr; +$.ajax({ +url: '/gstudio/resources/images/deletetag/', +//type: 'POST', +data: {objectid:id,data:tagname}, +success: function(data){ +$('.tags'+id).html(data); +} +}); + +} +</script> + +<div class="tags{{objectid}}"> + <!-- <p class="gbobject-tags span-16 last"> --> + <strong>{% trans "Tags" %}</strong> : + {% tags_for_object viewtag as tag_list %} + {% for tag in tag_list %} + <a href="{% url objectapp_tag_detail tag %}" + title="Tag {{ tag }}" rel="tag">{{ tag }}</a> +{% if user.is_authenticated %} + <a class="deletetags" value="{{tag}}" title="delete {{tag}}" onclick='tagfunction("{{tag}}","{{objectid}}");' ><img src="/static/gstudio/js/orgitdown/orgitdown/sets/org/images/close.jpeg" width = 8px; style="vertical-align: super;"/></a> +{% endif %} + {% if not forloop.last %},{% endif %} + {% empty %} + <span>{% trans "No tags" %}</span> + {% endfor %} +<!-- </p> --> + </div> + {% if user.is_authenticated %} + <script type="text/javascript" > + $(document).ready(function(){ + $( "#tags{{objectid}}" ).autocomplete({ + source: availableTags + }); + }); + </script> +{% csrf_token %} + <input type="hidden" name="docid" value={{objectid}}> + <!-- <input type="text" class="tagtext" value="" name="texttags" />--> + <input id="tags{{objectid}}" class="tagtext" name="texttags"> + <input type="button" class="tag{{objectid}}" value="Add Tags" name="addtags" /> + <br> + {% endif %} diff --git a/gstudio/templates/gstudio/addreln.html b/gstudio/templates/gstudio/addreln.html new file mode 100644 index 00000000..b484b8b0 --- /dev/null +++ b/gstudio/templates/gstudio/addreln.html @@ -0,0 +1,76 @@ +{% load gstudio_tags %} +<script type="text/javascript"> +var availableobjs = []; +$.merge(availableobjs, {% get_available_objects %}) +var availablerts=[] +$.merge(availablerts, {% get_available_rts %}) +$(document).ready(function(){ + $("#res_relation").autocomplete({ + source: availablerts + }); + $("#res_object").autocomplete({ + source: availableobjs + }); +$("#addreln").click(function(){ +alert("Please wait till the relation is shown in the existing relations..."); +var ajurl ="/gstudio/resources/addreln/thread/"+{{meetingob.id}} + +var res_reln = $("#res_relation").val() +var res_obj= $("#res_object").val() +if (res_reln == "" || res_obj == "" ) +{ alert("Please select relation and right object"); +} +else +{ +$.ajax({ + url: ajurl, + data: {relnobj:res_reln,obobject:res_obj}, + success: function(data){ + + $('#res_relation').val(""); + $('#res_object').val(""); + alert("Added relation"); + $('#relndiv').html(data); + + } +}); +} +}); +}); +function target_popup(form) { + window.open('', 'formpopup', 'left=360,width=500,height=300,resizeable,scro\ +llbars'); + form.target = 'formpopup'; + + + } + +</script> +<div id="relndiv"> +<br/> + +<b>Existing Relations for this page: </b> + {% if not meetingob.get_relations_for_view.items %} + No relations + {% endif %} + {% for key,value in meetingob.get_relations_for_view.items %} + {{key}} - + {% for rel in value %} + {{rel}}; + {% endfor %} + {% endfor %} + +</div> +<form method="post" action=""> {% csrf_token %} +Select/Add a Relationtype: <nbsp> +<input value="" name="textreln" id="res_relation"> +<!-- +<a href="/admin/gstudio/relationtype/add" class="add-another" id="add_id_{{ field }}" onclick="return showAddAnotherPopup(this);"> +--> +<a href="/gstudio/resources/addreln/form/{{meetingob.id}}" class="add-another" id="addrel" onclick="target_popup(this)"> +<img width="10" height="10" alt="Add Another" src="/static/grappelli/img/admin/icon_addlink.gif"> +</a> +Select an object: <nbsp> +<input value="" name="textobj" id="res_object"> +<input type="button" id="addreln" name="" value="Add Relation"> +</form> diff --git a/gstudio/templates/gstudio/addrelnform.html b/gstudio/templates/gstudio/addrelnform.html new file mode 100644 index 00000000..113a450a --- /dev/null +++ b/gstudio/templates/gstudio/addrelnform.html @@ -0,0 +1,51 @@ +{% load gstudio_tags %} +{% load adminmedia grp_tags %} +<script src="{% admin_media_prefix %}jquery/jquery-1.6.2.min.js" type="text/javascript"> + +</script> +<script> +function close_window() +{ window.close() +} + + +function saverelnform() +{ +var reln=$("#res_relation").val(); +var obj=$("#res_object").val(); +var slug=$("#res_slug").val(); + +$.ajax({ + method:'POST', + url: '/gstudio/resources/addreln/form/{{meetob}}', + data: {reln:reln,obj:obj,slug:slug}, + success: function(){ + window.close() + } + }); +} + +</script> +<html> <body bgcolor="#E6E6FA"> +<form method="post" name="addrelnfrm" action="."> {% csrf_token %} +<h1>Add Relation(link) name</h1> +<h2>Title:                 +<input value="" name="reln" id="res_relation"> +<br/></h2> +<h2>Inverse Name:   +<input value="" name="obj" id="res_object"> +<br/></h2> +<h2>Slug:                 +<input value="" name="slug" id="res_slug"> +<br/></h2> +<br/>                               +<!-- +<input type="submit" id="addsavereln" name="" value="Save" ><nbsp> +--> +        +<input type="button" id="addrel" value="Save" onclick="saverelnform()"> + +<input type="submit" id="addcancelreln" name="" value="Cancel" onclick="close_window()"> +</form> +</body> +</html> diff --git a/gstudio/templates/gstudio/addrelnform_refresh.html b/gstudio/templates/gstudio/addrelnform_refresh.html new file mode 100644 index 00000000..f9592354 --- /dev/null +++ b/gstudio/templates/gstudio/addrelnform_refresh.html @@ -0,0 +1,15 @@ +{% load gstudio_tags %} + +<div id="relndiv"> +<br/> +<b>Existing Relations for this page: </b> + {% if not meetobj.get_relations_for_view.items %} + No relations + {% endif %} + {% for key,value in meetobj.get_relations_for_view.items %} + {{key}} - + {% for rel in value %} + {{rel}}; + {% endfor %} + {% endfor %} +</div> diff --git a/gstudio/templates/gstudio/edittitle.html b/gstudio/templates/gstudio/edittitle.html new file mode 100644 index 00000000..b8207e9d --- /dev/null +++ b/gstudio/templates/gstudio/edittitle.html @@ -0,0 +1,37 @@ +<script type="text/javascript" > +jQuery(document).ready(function($) { +$("#titleeditcontent").click(function(){ +document.getElementById('texttagtitle').style.visibility="visible"; +$("#texttagtitle").val($("#titleeditortext").val()); +document.getElementById('titlesave').style.visibility="visible"; +$("#titleeditcontent").hide(); +}); +$("#titlesave").click(function(){ +var org_data = $("#texttagtitle").val(); +var encode_data = encodeURIComponent(org_data); +var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); +$("#titlecommenttext").val(decode_data); + +$.ajax({ +url: '/gstudio/resources/images/edittitle/', +<!-- type:"POST", --> +data: {title:decode_data,titleid:{{objectid}}}, +success: function(){ +document.location.reload(true) +} +}); + +}); +}); +</script> + + +<!-- <form method="get" action=""> -->{% csrf_token %} +<input type="hidden" name="imgid" value={{objectid}}> +<input type="button" id="titleeditcontent" name="" value="Edit title"/> +<input type="text" value="" name="texttags" id="texttagtitle" style="visibility:hidden" /> +<input type="button" class="titlecommentsavecontent" id="titlesave" value="Save" style="visibility:hidden" /> +<input type="hidden" name="titlecontenttext" id="titlecommenttext" style="visibility:hidden" /> +<input type="hidden" id="titleeditortext" style="visibility:hidden" value="{{ objecttitle }}"> +<!-- </form> --> + diff --git a/gstudio/templates/gstudio/home.html b/gstudio/templates/gstudio/home.html index f1e7a025..44dd4685 100644 --- a/gstudio/templates/gstudio/home.html +++ b/gstudio/templates/gstudio/home.html @@ -90,7 +90,8 @@ </style> <script src="http://code.jquery.com/jquery-latest.js"></script> - <script type="text/javascript" > + <scipt src="{% admin_media_prefix %}jquery/jquery-1.6.2.min.js" type="text/javascript"></script> + <script type="text/javascript" > $(window).load(function() { @@ -123,6 +124,10 @@ <div id="header" > {% include "gstudio/_header.html" %} </div> +{% put_home_title as home_content %} +{%with home_content|safe as home %} +{{home}} +{% endwith %} <div class="tags" align="center" id="tag"> <!--<h2>{% trans "Tag Cloud" %}</h2>--> {% get_tag_cloud %} @@ -138,7 +143,12 @@ </form> </div><br/><br/><br/> <link rel="stylesheet" type="text/css" media="screen, projection" href="/static/gstudio/css/screen.css" /> -<center><p style = " font-size : 19px ; color : #4d659e"><b>The site provides a loom (place to exchange views from the members of the site on a topic, or seek responses from members); collaboratively construct wikipages; share electronic documents, images and videos and use them in your discussions or wikipages; and create semantic networks. We will soon provide a link on how to use the site prominently on the home page. All resources are released under creative commons license. <a href="/more/"><font color="red">more</font></a></b></p></center> +<center><p style = " font-size : 19px ; color : #4d659e"><b> +{% put_home_content as home_content %} +{% with home_content|safe as home %} +{{home}} +{% endwith %} +<a href="/more/"><font color="red">more</font></a></b></p></center> <div class="homebottom"> <div class="authors"> <h3>{% trans "Recents Authors" %}</h3> @@ -147,7 +157,7 @@ <div class="recentsnodetype"> <h3>{% trans "Recent Objects" %}</h3> -{% get_recent_gbobjects 12%} +{% get_random_gbobjects 12%} </div> <div class="comments"> <h3>{% trans "Recent Comments" %}</h3> diff --git a/gstudio/templates/gstudio/priorpost.html b/gstudio/templates/gstudio/priorpost.html new file mode 100644 index 00000000..49e4a8af --- /dev/null +++ b/gstudio/templates/gstudio/priorpost.html @@ -0,0 +1,68 @@ +{% load gstudio_tags %} +{% load i18n %} +<script type="text/javascript" > + +var availableObjects = []; +$.merge(availableObjects, {% get_pri_post_page %}) + +jQuery(document).ready(function($) { +$("#addpriorpost").click(function(){ + +var data +data = $("#priorpage").attr('value'); +$.ajax({ +url: '/gstudio/resources/images/addpriorpost/', +//type:"POST", +data: {title:data,titleid:{{objectid}}}, +success: function(data){ +$('#priorpostpages').html(data); + +} +}); +$("#priorpage").val(""); +}); +}); + +$(document).ready(function(){ +$( "#priorpage" ).autocomplete({ +source: availableObjects +}); +}); + +</script> + +<div id = "priorpostpages"> +<br/> +<strong>Prior Pages:</strong> +{% for each in priorgbobject %} +<a href="{{each.get_view_object_url}}">{{each}}</a> +{% if not forloop.last %},{% endif %} +{% empty %} + <span>No prior page</span> +{% endfor %} +<br/> +<strong>Posterior Pages:</strong> +{% for each in posteriorgbobject %} +<a href="{{each.get_view_object_url}}">{{each}}</a> +{% if not forloop.last %},{% endif %} +{% empty %} + <span>No Posterior Page</span> +{% endfor %} +<br/> +</div> + +{% if user.is_authenticated %} +<!-- <form method="get" action=""> -->{% csrf_token %} + +<input type="hidden" name="docid" value={{objectid}}> +<input id="priorpage" class="tagpriorpage" name="textpriorpage"> +<input type="button" class="priorpost" id="addpriorpost" value="Add Prior Page" name="addtags" /> +<br/><br/> +<!-- <input type="button" id="titleeditcontent" name="" value="Edit a title"/> +<input type="text" value="" name="texttags" id="texttagtitle" style="visibility:hidden" /> +<input type="button" class="titlecommentsavecontent" id="titlesave" value="Save" style="visibility:hidden" /> +<input type="hidden" name="titlecontenttext" id="titlecommenttext" style="visibility:hidden" /> +<input type="hidden" id="titleeditortext" style="visibility:hidden" value="{{ objecttitle }}"> +<!-- </form> --> +{% endif %} + diff --git a/gstudio/templates/gstudio/repriorpost.html b/gstudio/templates/gstudio/repriorpost.html new file mode 100644 index 00000000..3499db0e --- /dev/null +++ b/gstudio/templates/gstudio/repriorpost.html @@ -0,0 +1,34 @@ +{% load tagging_tags comments i18n %} +{% ifequal optionpriorpost "priorpost" %} +<br/> +<strong>Prior Pages:</strong> +{% for each in priorgbobject %} +<a href="{{each.get_view_object_url}}">{{each}}</a> +{% if not forloop.last %},{% endif %} +{% empty %} + <span>No prior page</span> +{% endfor %} +<br/> +<strong>Posterior Pages:</strong> +{% for each in posteriorgbobject %} +<a href="{{each.get_view_object_url}}">{{each}}</a> +{% if not forloop.last %},{% endif %} +{% empty %} + <span>No Posterior Pages</span> +{% endfor %} +<br/> +{% endifequal %} +{% ifequal optiontag "tag" %} + <strong>{% trans "Tags" %}</strong> : + {% tags_for_object viewtag as tag_list %} + {% for tag in tag_list %} + <a href="{% url objectapp_tag_detail tag %}" + title="Tag {{ tag }}" rel="tag">{{ tag }}</a> + <a class="deletetags" value="{{tag}}" title="delete {{tag}}" onclick='tagfunction("{{tag}}","{{objectid}}");'><img src="/static/gstudio/js/orgitdown/orgitdown/sets/org/images/close.jpeg" width = 8px; style="vertical-align: super;"/></a> + {% if not forloop.last %},{% endif %} + {% empty %} + <span>{% trans "No tags" %}</span> + {% endfor %} + +{% endifequal %} + diff --git a/gstudio/templates/gstudio/tags/comment.html b/gstudio/templates/gstudio/tags/comment.html index efb462fc..423fc937 100644 --- a/gstudio/templates/gstudio/tags/comment.html +++ b/gstudio/templates/gstudio/tags/comment.html @@ -6,6 +6,12 @@ $(window).load(function() { $(".commentsavecontent").hide(); $(".postreply").hide(); }); +function deleteclick(delobj) +{ + activity ='deleted_response' + not_obj=delobj +notifedtdel(); +} </script> {% if comment.posterior_nodes.count %} <!--<ul style="display: none;">--> @@ -26,7 +32,12 @@ else { document.getElementById("divchange").setAttribute("id","div2"); } +function submtfrm() +{ +alert("form to post"); +document.forms["response"].submit(); +} </script> @@ -35,7 +46,7 @@ document.getElementById("divchange").setAttribute("id","div2"); <h5>Current rating is {{ child.rating.get_rating }}<h5/> {% endif %} <font style = "color:red;" size = 3>{{child.content}}</font> - <form method="post" action=".">{% csrf_token %} + <form method="post" name="response" action=".">{% csrf_token %} <input type="hidden" class="commentreptext" id="text{{child.id}}" name="reply" style="visibility:hidden"> <input type="hidden" id="hidden{{child.id}}" value={{child.id}} name="parentid"> <input type="hidden" value={{idusr}} name="idusr"> @@ -45,8 +56,10 @@ document.getElementById("divchange").setAttribute("id","div2"); <input type="button" class="commenteditor" id="{{ child.id }}" value="Add a Response"> <input type="button" class="commentsavecontent" id="save{{child.id}}" value="Save" onclick="saveclick(document.getElementById('hidden{{child.id}}').value)"> <input type="submit" class="postreply" id="submit{{child.id}}" value="Submit"> + <input type="checkbox" class="chkdel" id="chk{{child.id}}" name="del_comment" value="delete_comment"> <input type="submit" class="submitdelete" id="delete{{child.id}}" value="Delete" onclick="deleteclick(document.getElementById('hidden{{child.id}}').value)"> + <br/> <div class="rating"> Rate the response </br> @@ -87,7 +100,7 @@ Current rating is {{ child.rating.get_rating }}<br/> {% endif %} <font style = "color:red;" size ="3">{{child.content}}</font> - <form method="post" action="">{% csrf_token %} + <form method="post" name="response" action="">{% csrf_token %} <input type="hidden" class="commentreptext" id="text{{child.id}}" name="reply" style="visibility:hidden"> <input type="hidden" id="hidden{{child.id}}" value={{child.id}} name="parentid"> <input type="hidden" value={{idusr}} name="idusr"> @@ -97,6 +110,9 @@ Current rating is {{ child.rating.get_rating }}<br/> <input type="button" class="commenteditor" id="{{ child.id }}" value="Add a Response"> <input type="button" class="commentsavecontent" id="save{{child.id}}" value="Save" onclick="saveclick(document.getElementById('hidden{{child.id}}').value)"> <input type="submit" class="postreply" id="submit{{child.id}}" value="Submit"> + + + <input type="checkbox" class="chkdel" id="chk{{child.id}}" name="del_comment" value="delete_comment"> <input type="submit" class="submitdelete" id="delete{{child.id}}" value="Delete" onclick="deleteclick(document.getElementById('hidden{{child.id}}').value)"> @@ -138,7 +154,7 @@ Current rating is {{ child.rating.get_rating }}<br/> {% endif %} <font style = "color:red;" size = 3>{{child.content}}</font> - <form method="post" action=".">{% csrf_token %} + <form method="post" name="response" action=".">{% csrf_token %} <input type="hidden" class="commentreptext" id="text{{child.id}}" name="reply" style="visibility:hidden"> <input type="hidden" id="hidden{{child.id}}" value={{child.id}} name="parentid"> <input type="hidden" value={{idusr}} name="idusr"> @@ -148,8 +164,25 @@ Current rating is {{ child.rating.get_rating }}<br/> <input type="button" class="commenteditor" id="{{ child.id }}" value="Add a Response"> <input type="button" class="commentsavecontent" id="save{{child.id}}" value="Save" onclick="saveclick(document.getElementById('hidden{{child.id}}').value)"> <input type="submit" class="postreply" id="submit{{child.id}}" value="Submit"> + +{% check_user_admin idusr as admin_usercheck %} +{% if admin_usercheck %} + <input type="checkbox" class="chkdel" id="chk{{child.id}}" name="del_comment" value="delete_comment"> - <input type="submit" class="submitdelete" id="delete{{child.id}}" value="Delete" onclick="deleteclick(document.getElementById('hidden{{child.id}}').value)"> <br/> + <input type="submit" class="submitdelete" id="delete{{child.id}}" value="Delete" onclick="deleteclick(document.getElementById('hidden{{child.id}}').value)"> + +<br/> +{% endif %} +{% for author in child.authors.all %} +{% ifequal author.id idusr %} + + <input type="checkbox" class="chkdel" id="chk{{child.id}}" name="del_comment" value="delete_comment"> + <input type="submit" class="submitdelete" id="delete{{child.id}}" value="Delete" onclick="deleteclick(document.getElementById('hidden{{child.id}}').value)"> + +<br/> +{% endifequal %} +{% endfor %} + <div class="rating"> Rate this response </br> <input name="star1" type="radio" value=1 class="star"/> diff --git a/gstudio/templates/gstudio/video.html b/gstudio/templates/gstudio/video.html index c50b6df7..201a335a 100644 --- a/gstudio/templates/gstudio/video.html +++ b/gstudio/templates/gstudio/video.html @@ -80,7 +80,7 @@ background: green; {% autopaginate vids 10 %} -<h2 style="color: teal;">Video Library</h2> +<h2 style="">Video Library</h2> <br/> <div id="upperdiv"> @@ -173,9 +173,9 @@ document.getElementById('headvideo').style.visibility="visible"; {% if fav %} -<h2 style="color: teal;">Favourite Videos</h2><br/> +<h2 style="">Favourite Videos</h2><br/> {% else %} -<h2 style="color: teal;">List of Videos in the library </h2><br/> +<h2 style="">List of Videos in the library </h2><br/> {% endif %} <div id="listvideo"> @@ -195,7 +195,7 @@ document.getElementById("divvideo").setAttribute("id","div2"); } </script> -<font size="4">{% if video.title %}{{video.title}}{% else %}{{video.altnames}}{% endif %}</font> +<font size="4">{% if video.title %}{{video.title}}{% else %}{{video.altnames}}{% endif %}[ <a href="{{ video.get_absolute_url }}" title="{{ video.title }}" rel="bookmark">Show Graph</a> ]</font> <form enctype="multipart/form-data" method="post" action="" target="_blank"> {% csrf_token %} <input type="hidden" name = "full" value ={{video.slug}}> diff --git a/gstudio/templates/metadashboard/grpdashboard.html b/gstudio/templates/metadashboard/grpdashboard.html index 6ad36ac6..8a1b335e 100644 --- a/gstudio/templates/metadashboard/grpdashboard.html +++ b/gstudio/templates/metadashboard/grpdashboard.html @@ -4,7 +4,7 @@ {% load adminmedia grp_tags %} {% load i18n comments gstudio_tags %} {% load tagging_tags comments i18n %} - + {% block title %}{{meet_ob.title}}{% endblock %} {% block content %} <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript" > @@ -21,6 +21,120 @@ $(".submitresponse").hide(); $("#editthreadsave").hide(); }); var i=0; +var availableTags = []; +$.merge(availableTags, {% get_add_tag %}) + +function notifedtdel() +{ + + +urlnot="/gstudio/group/notify/"+activity+"/"+not_obj+"/{{user.id}}" + +subactivity(urlnot,activity); +} + +function subactivity(urlnot,activity) +{ + if(activity=='added_response') + { + submitform(activity); + } + + if (activity != 'undefined') + { + + $.ajax({ + url: urlnot, + type:'GET', + success: function(){ + + submitform(activity); + } + }); + } + else + { + submitform(activity); + } +} + +function submitform(activity) +{ + + +if (activity=='edited_thread') +{ + +document.forms["threadform"].submit(); +} +if(activity=='edited_twist') +{ + + +$("#topicsubmit"+submtobj).trigger('click'); +} +if(activity=='added_response') +{ + +$("#topicsubmit"+submtobj).trigger('click'); +} +if(activity=='deleted_response') +{ + + document.forms["response"].submit(); +} +} + + + + + + + + +function Subscribeuser() +{ +if (confirm("{{user.username}},Do you want to Subscribe to get all alerts in your mail for this page")) +{ + +url = "/gstudio/group/notify/{{meet_ob.id}}/{{user.id}}" + +<!--alert(url);--> +<!-- $.get(url,function(){ --> +<!-- alert("notified user"); --> +<!-- }); --> +$.ajax({ + url: '/gstudio/group/notify/{{meet_ob.id}}/{{user.id}}', + success: function(){ + <!--alert('notified user');--> + } + }); +$("#sub2").val("UnSubscribe"); +$("#sub2").attr("onclick","UnSubscribeuser()"); +} +} + + + + + +function UnSubscribeuser() +{ +url = "/gstudio/group/notify/unsubscribe/{{meet_ob.id}}/{{user.id}}" + +<!--alert(url);--> +<!-- $.get(url,function(){ --> +<!-- alert("notified user"); --> +<!-- }); --> +$.ajax({ + url: '/gstudio/group/notify/unsubscribe/{{meet_ob.id}}/{{user.id}}', + success: function(){ + <!--alert('notified user');--> + } + }); +$("#sub1").val("Subscribe"); +$("#sub1").attr("onclick","Subscribeuser()"); +} </script> <style type="text/css"> #div2 @@ -36,17 +150,25 @@ var i=0; <!-- <input type="button" value="Home" onClick="location.href=parseURL('/gstudio/user/{{user.username}}');"> <h>Hello Welcome to the {{ meet_ob.title }}</h></br> --> - <font size ="3" > {{admin_m.username}}'s initial twist to the thread</font> - <!-- <h>You are logged in as <font color="blue">{{user.username}}</font></h> --> - </br> -<h2>{{meet_ob.title}}</h2> +<h2 style="line-height:1">{{meet_ob.title}}{% if user.is_authenticated %} {% edit_title meet_ob.id meet_ob.title %} {% endif %}</h2> +<font size ="3" > {{admin_m.username}}'s initial twist to the thread [ <a href="{{ meet_ob.get_absolute_url }}" title="{{ meet_ob.title }}" rel="bookmark">Show Graph</a> ] </font> +</br> +{% if user.is_authenticated %} + +{% check_subscribe meet_ob user as subscribe %} +{%if subscribe %} +<input type="button" id="sub1" value="UnSubscribe" name="edittitle" onclick="UnSubscribeuser()"> +{% else %} +<input type="button" id="sub2" value="Subscribe" name="edittitle" onclick="Subscribeuser()"> +{% endif %} +{% endif %} {% with meet_ob.html_content|safe as meet_ob_content %} <font size ="3" >{{meet_ob_content}} </font> {% endwith %} {% if user.is_authenticated %} -<form method="post" action=".">{% csrf_token %} +<form method="post" name="threadform" action=".">{% csrf_token %} <input type="hidden" id="threadid" value={{meet_ob.id}} style="visibility:hidden;" name="editiden"> <input type="hidden" id="threadedit{{meet_ob.id}}" style="visibility:hidden;" name="editval"> <input type="hidden" id="threadcontent{{meet_ob.id}}" value="{{meet_ob.content_org}}" style="visibility:hidden;" name="editcont"> @@ -54,7 +176,8 @@ var i=0; <br/> <input type="button" id="threadedit" value="Edit"> <input type="button" id="editthreadsave" value="Save"> -<input type="submit" id="subeditresp" value=Submit" style="visibility:hidden;"></br> +<input type="button" id="subeditresp" value="Submit" style="visibility:hidden;"> + </form> @@ -77,28 +200,13 @@ var i=0; {% endif %} </br> {% endif %} +{% endif %} - <form method="post" action="">{% csrf_token %} - <input type="hidden" name="docid" value={{meet_ob.id}}> - <input type="text" class="tagtext" value="" name="texttags" /> - <input type="submit" class="tag" value="Add Tags" name="addtags" /> - </form> - - <br> - <div class="tags"> - <p class="gbobject-tags span-16 last"> - <strong>{% trans "Tags" %}</strong> : - {% tags_for_object ot as tag_list %} - {% for tag in tag_list %} - <a href="{% url objectapp_tag_detail tag %}" - title="Tag {{ tag }}" rel="tag">{{ tag }}</a> - {% empty %} - <span>{% trans "No tags" %}</span> - {% endfor %} - </p> - </div> +<!--ADDING AND DISPLAY TAG--> +{% addtag ot meet_ob.id user %} <br/> +{% if user.is_authenticated %} <form method="post" action=".">{% csrf_token %} <!-- <input type="hidden" value="{{meet_ob.id}}" name = "meetid">--> <input type="button" id="twistaddbtn" value="Add your twist" onClick="location.href=parseURL('topicadd1/{{meet_ob.id}}');"> @@ -119,7 +227,7 @@ var i=0; --> </br> {% autoescape off %} {% for each in topic %} - <h4><font size="5" >{{each.title}}</font></h4> + <h4><font size="5" >{{each.title}}</font> [ <a href="{{ each.get_absolute_url }}" title="{{ each.title }}" rel="bookmark">Show Graph</a> ]</h4> Posted on : {{each.creation_date}} by : {% for author in each.authors.all %} @@ -141,10 +249,11 @@ var i=0; <input type="hidden" value="{{each.id}}" name = "iden"> <input type="hidden" value="{{user.id}}" name = "idusr"> <br/> {% if user.is_authenticated %} + <input type="button" class="editcontent" name="{{each.content_org}}" id="{{each.id}}" value="Edit"> <input type="button" class="editor" id="{{ each.id }}" value="Add Response"/> <input type="hidden" class="editval" id="edit{{each.id}}" name="edit" value="empty"> <input type="button" class="savecontent" id="save{{ each.id }}" value="Save" onclick="topicsaveclick(document.getElementById('hidden{{ each.id }}').value)"><br/> - <input type="button" class="editcontent" name="{{each.content_org}}" id="{{each.id}}" value="Edit"> + <input type="submit" class="submitresponse" id="topicsubmit{{ each.id }}" value="Submit"></br> {% endif %} {% ifequal user.id admin_id %} @@ -171,27 +280,10 @@ var i=0; <input type="submit" value="Rate it!!!"> --> </form> </div> - {% if user.is_authenticated %} - <form method="post" action="">{% csrf_token %} - <input type="hidden" name="docid" value={{each.id}}> - <input type="text" class="tagtext" value="" name="texttags" /> - <input type="submit" class="tag" value="Add Tags" name="addtags" /> - </form> - - <br> - <div class="tags"> - <p class="gbobject-tags span-16 last"> - <strong>{% trans "Tags" %}</strong> : - {% tags_for_object each as tag_list %} - {% for tag in tag_list %} - <a href="{% url objectapp_tag_detail tag %}" - title="Tag {{ tag }}" rel="tag">{{ tag }}</a> - {% empty %} - <span>{% trans "No tags" %}</span> - {% endfor %} - </p> - </div> - {% endif %} + +<!--ADDING AND DISPLAY TAG--> +{% addtag each each.id user %} + <br/> <p> Responses : diff --git a/gstudio/templates/metadashboard/pgedashboard.html b/gstudio/templates/metadashboard/pgedashboard.html index 1e487551..e20b93a8 100644 --- a/gstudio/templates/metadashboard/pgedashboard.html +++ b/gstudio/templates/metadashboard/pgedashboard.html @@ -5,7 +5,7 @@ {% load pagination_tags %} {% load i18n objectapp_tags %} {% load tagging_tags comments i18n %} - +{% block title %}{{ page_ob.title }}{% endblock %} <!-- {% load i18n %} --> {% block content %} <style> @@ -14,6 +14,8 @@ </style> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript" > +var availableTags = []; +$.merge(availableTags, {% get_add_tag %}) $(window).load(function() { $("#content").css({ "width": "1000px",});}); @@ -43,11 +45,11 @@ $(".savesubsec1").hide(); {% autopaginate section 1 %} <!-- <input type="button" value="Home" onClick="location.href=parseURL('/gstudio/user/wikipage/{{user.username}}');"> --> - <h1>{{ page_ob.title }}</h1> + <h1 style="line-height:0.5">{{ page_ob.title }} {% if user.is_authenticated %} {% edit_title page_ob.id page_ob.title %} {% endif %}</h1> Wikipage posted on : {{page_ob.creation_date}} by {% for author in page_ob.authors.all %} {{author}} - {% endfor %}</br></br> + {% endfor %} [ <a href="{{ page_ob.get_absolute_url }}" title="{{ page_ob.title }}" rel="bookmark">Show Graph</a> ] </br></br> {% with page_ob.html_content|safe as page_ob_content %} <font size="3"> @@ -64,37 +66,51 @@ $(".savesubsec1").hide(); <input type="button" class="savepagecontent" name="{{page_ob.id}}" value="Save"/></br> <input type="submit" class="pagedit" value="Submit"/> </form> + {% endif %} + <!-- Add relations for a page --> + + {% add_res_relation page_ob %} + <br/> - <form method="post" action="">{% csrf_token %} - <input type="hidden" name="docid" value={{page_ob.id}}> - <input type="text" class="tagtext" value="" name="texttags" /> - <input type="submit" class="tag" value="Add Tags" name="addtags" /> - </form> - {% endif %} - <br> - <div class="tags"> - <p class="gbobject-tags span-16 last"> - <strong>{% trans "Tags" %}</strong> : - {% tags_for_object ot as tag_list %} - {% for tag in tag_list %} - <a href="{% url objectapp_tag_detail tag %}" - title="Tag {{ tag }}" rel="tag">{{ tag }}</a> - {% empty %} - <span>{% trans "No tags" %}</span> - {% endfor %} - </p> - </div> - </br> + + <!--ADDING PRIOR PAGE--> + {% addpriorpost page_ob.id user %} + <!--ADDING AND DISPLAY TAG--> + {% addtag ot page_ob.id user %} + + {% ifequal document.rating.get_rating 0 %} + + <font color = 'black'>Current rating is: <font > No rating yet </font></font> + {% else %} + <font color = 'black'>Average Current rating is: </font><h4>{{ page_ob.rating.get_rating }}</h4> + <font color = 'black'>Total Number of votes is: <font ><b>{{ page_ob.rating_votes }}</b></font> </font> + {% endifequal %} + <br> + {% if user.is_authenticated %} + <form method="post" action=""> + {% csrf_token %} + <input name="star1" type="radio" value=1 class="star"/> + <input name="star1" type="radio" value=2 class="star"/> + <input name="star1" type="radio" value=3 class="star"/> + <input name="star1" type="radio" value=4 class="star"/> + <input name="star1" type="radio" value=5 class="star"/> + </br> + <input type="hidden" name="iden" value={{page_ob.id}}> + <input type="submit" value="Rate it!!!"> + </form><br> + {% endif %} + + {% if user.is_authenticated %} <form method="post" action=".">{% csrf_token %} - <input type="button" id="newsection1" value="Add a new Section" onClick="location.href=parseURL('sectionadd1/{{page_ob.id}}');"> + <!--<input type="button" id="newsection1" value="Add a new Section" onClick="location.href=parseURL('sectionadd1/{{page_ob.id}}');">--> <input type="hidden" id="pageid1" value="{{page_ob.id}}"/> </form> {% endif %} </br> {% autoescape off %} {% for each in section %} - <h4><font size="6">{{each.title}}</h4></font> + <h4><font size="6">{{each.title}} [ <a href="{{ each.get_absolute_url }}" title="{{ each.title }}" rel="bookmark">Show Graph</a> ]</h4></font> Posted on : {{each.creation_date}} by {% for author in each.authors.all %} {{author}} @@ -121,33 +137,21 @@ $(".savesubsec1").hide(); <input type="button" class="saveseccontent" name="{{each.id}}" value="Save"/> <input type="submit" class="submitresponse" value="Submit"/> </form> - <form method="post" action="">{% csrf_token %} - <input type="hidden" name="docid" value={{each.id}}> - <input type="text" class="tagtext" value="" name="texttags" /> - <input type="submit" class="tag" value="Add Tags" name="addtags" /> - </form> {% endif %} - <br> - <div class="tags"> - <p class="gbobject-tags span-16 last"> - <strong>{% trans "Tags" %}</strong> : - {% tags_for_object each as tag_list %} - {% for tag in tag_list %} - <a href="{% url objectapp_tag_detail tag %}" - title="Tag {{ tag }}" rel="tag">{{ tag }}</a> - {% empty %} - <span>{% trans "No tags" %}</span> - {% endfor %} - </p> - </div> + <br> + + <!--ADDING AND DISPLAY TAG--> + {% addtag each each.id user %} + + {% if user.is_authenticated %} <form method="post" action=".">{% csrf_token %}<br/> - Create Subsection: + <!-- Create Subsection:--> <input type="hidden" name = "replytosection" class="reptext" style="visibility:hidden;"/></br> <input type="hidden" value="{{each.id}}" name = "iden"> <input type="hidden" value="{{user.username}}" name ="usr"> <input type="hidden" value="{{user.id}}" name = "idusr"> - <input type="button" value="Create Subsection" class="createsubsection"> + <!--<input type="button" value="Create Subsection" class="createsubsection">--> <input type="hidden" value="empty" name = "edit" class="editval"/> <input type="button" value="save" class="savesubsec" name="{{each.id}}"> diff --git a/gstudio/templates/metadashboard/wikidashboard.html b/gstudio/templates/metadashboard/wikidashboard.html index 1af53cec..75382f28 100644 --- a/gstudio/templates/metadashboard/wikidashboard.html +++ b/gstudio/templates/metadashboard/wikidashboard.html @@ -1,6 +1,7 @@ {% extends "gstudio/base.html" %} {% load gstudio_tags %} {% load i18n %} +{% block title %}Wikipages{% endblock %} {% block content %} @@ -8,6 +9,10 @@ <p> Here is a list of all the pages:</p> </br> + {% if user.is_authenticated %} + <input type="button" value="Create a new page" onClick="location.href=parseURL('pageadd/');"> + <br/> + {% endif %} {% for each in pages.member_systems.all %} <a href="/gstudio/page/gnowsys-page/{{each.id}}/">{{each.title}}</a></br> {% endfor %} diff --git a/gstudio/templatetags/gstudio_tags.py b/gstudio/templatetags/gstudio_tags.py index 0ead510c..2071f154 100644 --- a/gstudio/templatetags/gstudio_tags.py +++ b/gstudio/templatetags/gstudio_tags.py @@ -60,6 +60,9 @@ VECTORS_FACTORY = lambda: VectorBuilder(Nodetype.published.all(), CACHE_NODETYPES_RELATED = {} + + + @register.inclusion_tag('gstudio/tags/dummy.html') def get_metatypes(template='gstudio/tags/metatypes.html'): """Return the metatypes""" @@ -425,6 +428,17 @@ def check_release(meeting): return var @register.assignment_tag +def check_subscribe(meeting,user): + var = check_subscribe_or_not(meeting,user) + return var + +@register.assignment_tag +def check_user_admin(userid): + var=check_usr_admin(userid) + return var + + +@register.assignment_tag def get_static_url(): var = os.path.join(os.path.dirname(__file__),STATIC_URL) return var @@ -434,3 +448,82 @@ def get_factory_looms(): fs = [] fs = get_factory_loom_OTs() return fs + +@register.assignment_tag +def put_home_content(): + var = get_home_content() + return var + +@register.assignment_tag +def put_more_content(): + var = get_more_content() + return var + +@register.assignment_tag +def put_home_title(): + var = get_home_title() + return var + +@register.inclusion_tag('gstudio/addreln.html') +def add_res_relation(meetingob): + template='gstudio/addreln.html' + print "meetob=",meetingob + return {'template':template,'meetingob':meetingob} + +@register.simple_tag +def get_available_rts(): + listrts=[] + for each in Relationtype.objects.all(): + s=each.title + listrts.append(str(s)) + return str(listrts) + +@register.simple_tag +def get_available_objects(): + listsubjs=[] + for each in Gbobject.objects.all(): + s=each.title + listsubjs.append(str(s)) + return str(listsubjs) + + +@register.inclusion_tag('gstudio/edittitle.html') +def edit_title(objectid,objecttitle): + template='gstudio/edititle.html' + return {'template':template,'objectid':objectid,'objecttitle':objecttitle} + +@register.simple_tag +def get_add_tag(): + listtag = [] + tag = Tag.objects.all() + for each in tag: + listtag.append(each.__str__()) + return str(listtag) + + +@register.inclusion_tag('gstudio/priorpost.html') +def addpriorpost(objectid,user): + template='gstudio/priorpost.html' + gbobject = Gbobject.objects.get(id=objectid) + priorgbobject = gbobject.prior_nodes.all() + posteriorgbobject = gbobject.posterior_nodes.all() + return {'template':template,'objectid':objectid,'priorgbobject':priorgbobject,'posteriorgbobject':posteriorgbobject,'user':user} + +@register.inclusion_tag('gstudio/addingtag.html') +def addtag(viewtag,objectid,user): + template='gstudio/addingtag.html' + return {'viewtag':viewtag,'objectid':objectid,'user':user} + +@register.simple_tag +def get_pri_post_page(): + listobject = [] + gbobject = Gbobject.objects.all() + for each in gbobject: + listobject.append(each.__str__()) + return str(listobject) + +@register.inclusion_tag("gstudio/templatetags/comment_security_hash.html") +def comment_security_hash(blogentry,opts): + targ='%s:%s'%(ContentType.objects.get_for_model(blogentry).id,blogentry.id) + return {"hash":Comment.objects.get_security_hash(opts,'','',targ)} + diff --git a/gstudio/urls/__init__.py b/gstudio/urls/__init__.py index 8a4e015e..b236cde9 100644 --- a/gstudio/urls/__init__.py +++ b/gstudio/urls/__init__.py @@ -51,6 +51,7 @@ urlpatterns = patterns( url(r'pageadd/', include('gstudio.urls.pageadd')), url(r'group/',include('gstudio.urls.group')), url(r'page/',include('gstudio.urls.page')), + url(r'^resources/addreln/',include('gstudio.urls.addreln')), url(r'^resources/images/',include('gstudio.urls.image')), url(r'^resources/videos/',include('gstudio.urls.video')), url(r'^resources/documents',include('gstudio.urls.docu')), diff --git a/gstudio/urls/addreln.py b/gstudio/urls/addreln.py new file mode 100644 index 00000000..edcb1254 --- /dev/null +++ b/gstudio/urls/addreln.py @@ -0,0 +1,22 @@ +# Copyright (c) 2011, 2012 Free Software Foundation +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + + + +from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns + +urlpatterns = patterns('gstudio.views.addreln', + url(r'^form/(\d+)/$','addrelnform',name = 'addrelfrm'), + url(r'^thread/(\d+)/$', 'addreln',name='addreln'), + ) diff --git a/gstudio/urls/image.py b/gstudio/urls/image.py index f088b29f..319999ca 100644 --- a/gstudio/urls/image.py +++ b/gstudio/urls/image.py @@ -21,5 +21,9 @@ from django.conf.urls.defaults import patterns urlpatterns = patterns('gstudio.views.image', url(r'^$', 'image', name='image'), - url(r'show/(\d+)/$','show',name='showimage'), + url(r'show/(\d+)/$','show',name='showimage'), + url(r'edittitle/$','edit_title',name='edittitle'), + url(r'addpriorpost/$','addpriorpost',name='addpriorpost'), + url(r'addtag/$','addtag',name='addtag'), + url(r'deletetag/$','deletetag',name='deletetag'), ) diff --git a/gstudio/views/addreln.py b/gstudio/views/addreln.py new file mode 100644 index 00000000..763e47e9 --- /dev/null +++ b/gstudio/views/addreln.py @@ -0,0 +1,84 @@ +# Copyright (c) 2011, 2012 Free Software Foundation +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +from django.http import HttpResponse +from django.http import HttpResponseRedirect +from django.shortcuts import render_to_response +from django.template import RequestContext +from gstudio.models import Relation,Relationtype +from objectapp.models import System,Gbobject +from gstudio.models import NID +from django.template.loader import get_template +from django.template import Context + + +def addrelnform(request,meetob): + title="" + if request.method == 'POST' : + title=request.POST.get("reln","") + inverse =request.POST.get("obj","") + slug=request.POST.get("slug","") + + if request.method == 'GET' : + title=request.GET.get("reln","") + inverse=request.GET.get("obj","") + slug=request.GET.get("slug","") + if title: + ob=Relationtype() + ob.title=title + ob.inverse=inverse + ob.slug=slug + left_subjecttype=NID.objects.get(title='Page') + left_applicable_nodetypes =unicode('OT') + right_subjecttype=NID.objects.get(title='Page') + right_applicable_nodetypes =unicode('OT') + ob.left_subjecttype=left_subjecttype + ob.left_applicable_nodetypes=left_applicable_nodetypes + ob.right_subjecttype=right_subjecttype + ob.right_applicable_nodetypes=right_applicable_nodetypes + ob.save() + + variables = RequestContext(request,{'meetob':meetob}) + template = "gstudio/addrelnform.html" + return render_to_response(template, variables) + + + +def addreln(request,meetob): + a=Relation() + try: + if request.method == 'GET' : + relntype=request.GET['relnobj'] + obobj=request.GET['obobject'] + rt=Relationtype.objects.filter(title=relntype) + a.left_subject=Gbobject.objects.get(id=meetob) + obt=Gbobject.objects.filter(title=obobj) + rt=Relationtype.objects.filter(title=relntype) + if rt: + a.relationtype=Relationtype.objects.get(title=relntype) + if obt: + obt=Gbobject.objects.get(title=obobj) + a.right_subject=obt + a.save() + j=System.objects.get(id=meetob) + p=j.get_view_url + if not obobj: + return HttpResponseRedirect(p) + else: + t = get_template('gstudio/addrelnform_refresh.html') + html = t.render(Context({'meetobj':j})) + return HttpResponse(html) + except: + t = get_template('gstudio/addrelnform_refresh.html') + html = t.render(Context({'meetingobj':j})) + return HttpResponse(html) diff --git a/gstudio/views/image.py b/gstudio/views/image.py index ec1b2fc7..919b2910 100644 --- a/gstudio/views/image.py +++ b/gstudio/views/image.py @@ -16,6 +16,7 @@ from django.http import HttpResponse +from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from demo.settings import * @@ -27,6 +28,8 @@ from PIL import Image import glob, os import hashlib from django.template.defaultfilters import slugify +from django.template.loader import get_template +from django.template import Context size = 128, 128 report = "true" @@ -49,11 +52,25 @@ def image(request): addtags = request.POST.get("addtags","") texttags = unicode(request.POST.get("texttags","")) contenttext = request.POST.get("contenttext","") + fav=request.POST.get("fav","") if show != "": i=Gbobject.objects.get(id=fulid) vars=RequestContext(request,{'image':i}) template="gstudio/fullscreen.html" return render_to_response(template, vars) + if fav != "" : + list1=[] + t=Gbobject.objects.filter(title=user+"image") + if t: + t=Gbobject.objects.get(title=user+"image") + if t.get_relations(): + for each in t.get_nbh['has_favourite']: + d=each.right_subject_id + x=Gbobject.objects.get(id=d) + list1.append(x) + variables = RequestContext(request,{'images':list1,'fav':fav}) + template = "gstudio/image.html" + return render_to_response(template, variables) if rating : rate_it(int(imgid),request,int(rating)) if delete != "": @@ -213,8 +230,9 @@ def create_object(f,log,title,content,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -239,6 +257,10 @@ def show(request,imageid): addtags = request.POST.get("addtags","") texttags = unicode(request.POST.get("texttags","")) contenttext = unicode(request.POST.get("contenttext","")) + favid=request.POST.get("favid","") + favusr=request.POST.get("favusr","") + removefavid=request.POST.get("removefavid", "") + titlecontenttext=request.POST.get("titlecontenttext", "") if rating : rate_it(int(imgid),request,int(rating)) if addtags != "": @@ -247,6 +269,37 @@ def show(request,imageid): i.save() if contenttext !="": edit_description(imgid,contenttext,str(request.user)) + if favid !="": + e=0 + r = Objecttype.objects.get(title="user") + for each in r.get_nbh['contatins_members']: + if favusr+"image" == each.title: + e=1 + if e ==0 : + t=Gbobject() + t.title=favusr+"image" + t.slug=favusr+"image" + t.content=' ' + t.satus=2 + t.save() + t.objecttypes.add(Objecttype.objects.get(title="user")) + t.save() + t=Gbobject.objects.get(title=favusr+"image") + rel=Relation() + rt=Relationtype.objects.get(title="has_favourite") + rel.relationtype_id=rt.id + f1=Gbobject.objects.get(id=favid) + rel.left_subject_id=t.id + rel.right_subject_id=f1.id + rel.save() + t.save() + if removefavid !="": + objects = Gbobject.objects.get(id=removefavid) + objects.get_relations()['is_favourite_of'][0].delete() + if titlecontenttext !="": + new_ob = Gbobject.objects.get(id=int(imgid)) + new_ob.title = titlecontenttext + new_ob.save() gbobject = Gbobject.objects.get(id=imageid) vars=RequestContext(request,{'image':gbobject}) template="gstudio/fullscreen.html" @@ -279,8 +332,9 @@ def edit_description(sec_id,title,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -298,3 +352,66 @@ def md5Checksum(filePath): m.update(data) return m.hexdigest() +def edit_title(request): + print "post" + if request.method == "GET": + print "iin get" + title=request.GET['title'] + titleid=request.GET['titleid'] + nid=NID.objects.get(id=titleid) + nid.title=title + nid.save() + return HttpResponseRedirect("/gstudio/resources/images/") + +def addpriorpost(request): + titleid="" + gbid1="" + if request.method == "GET": + print "in get" + title=request.GET['title'] + titleid=request.GET['titleid'] + gbid1=Gbobject.objects.get(id=titleid) + gbid2=Gbobject.objects.get(title=title) + gbid1.prior_nodes.add(gbid2) + gbid1.save() + gbid2.posterior_nodes.add(gbid1) + gbid2.save() + gbid1=Gbobject.objects.get(id=titleid) + priorgbobject = gbid1.prior_nodes.all() + posteriorgbobject = gbid1.posterior_nodes.all() + t = get_template('gstudio/repriorpost.html') + html = t.render(Context({'priorgbobject':priorgbobject,'posteriorgbobject':posteriorgbobject,'objectid':titleid,'optionpriorpost':"priorpost"})) + return HttpResponse(html) + #return HttpResponseRedirect("gstudio/resources/image/") +def addtag(request): + i="" + if request.method == "GET": + objectid=request.GET['objectid'] + data=request.GET['data'] + i=Gbobject.objects.get(id=objectid) + i.tags=i.tags+ ","+(data) + i.save() + i=Gbobject.objects.get(id=objectid) + print i,"in addtag" + t=get_template('gstudio/repriorpost.html') + html = t.render(RequestContext(request,{'viewtag':i,'optiontag':"tag","objectid":objectid})) + return HttpResponse(html) + +def deletetag(request): + i="" + objectid="" + if request.method =="GET": + objectid=request.GET['objectid'] + data=request.GET['data'] + i=Gbobject.objects.get(id=objectid) + delval=i.tags.replace(data+",","") + delval1=delval.replace(data,"") + i.tags=delval1 + i.save() + i=Gbobject.objects.get(id=objectid) + t=get_template('gstudio/repriorpost.html') + html=t.render(RequestContext(request,{'viewtag':i,'optiontag':"tag","objectid":objectid})) + return HttpResponse(html) + + + diff --git a/gstudio/views/video.py b/gstudio/views/video.py index 6eb86d9a..a3bf12f0 100644 --- a/gstudio/views/video.py +++ b/gstudio/views/video.py @@ -82,11 +82,14 @@ def video(request): return render_to_response(template,variables) if fav != "" : list1=[] - t=Gbobject.objects.get(title=user+"video") - for each in t.get_nbh['has_favourite']: - d=each.right_subject_id - x=Gbobject.objects.get(id=d) - list1.append(x) + t=Gbobject.objects.filter(title=user+"video") + if t: + t=Gbobject.objects.get(title=user+"video") + if t.get_relations(): + for each in t.get_nbh['has_favourite']: + d=each.right_subject_id + x=Gbobject.objects.get(id=d) + list1.append(x) variables = RequestContext(request,{'vids':list1,'val':svid,'fav':fav}) template = "gstudio/video.html" return render_to_response(template, variables) @@ -230,8 +233,9 @@ def video(request): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -364,8 +368,9 @@ def video(request): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('div id="content">\n')]='<div id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() @@ -465,6 +470,7 @@ def show(request,videoid): contenttext = request.POST.get("contenttext","") contenttext = unicode(request.POST.get("contenttext","")) titlecontenttext = request.POST.get("titlecontenttext") + removefavid = request.POST.get("removefavid","") if rating : rate_it(int(vidid),request,int(rating)) @@ -492,7 +498,9 @@ def show(request,videoid): rel.right_subject_id=f1.id rel.save() t.save() - + if removefavid !="": + objects = Gbobject.objects.get(id=removefavid) + objects.get_relations()['is_favourite_of'][0].delete() if addtags != "": i=Gbobject.objects.get(id=vidid) @@ -500,12 +508,18 @@ def show(request,videoid): i.save() if contenttext !="": edit_description(vidid,contenttext,str(request.user)) - if titlecontenttext !="": - new_ob = Gbobject.objects.get(id=int(vidid)) - new_ob.title = titlecontenttext - new_ob.save() + gbobject = Gbobject.objects.get(id=videoid) - vars=RequestContext(request,{'video':gbobject}) + relation = "" + if gbobject.get_relations(): + if gbobject.get_relations()['is_favourite_of']: + rel= gbobject.get_relations()['is_favourite_of'][0] + print rel + reluser = rel._left_subjecy_cache.title + if str(reluser) == str(request.user)+str("video"): + relation = "rel" + + vars=RequestContext(request,{'video':gbobject,'relation':relation}) template="gstudio/transcript.html" return render_to_response(template,vars) @@ -537,8 +551,9 @@ def edit_description(sec_id,title,usr): output = stdout.read() data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[72:] - data3 = data2[:-3] + data2 = data1[107:] + dataa = data2[data2.index('<div id="content">\n')]='<idv id=" "\n' + data3 = data2[:-6] newdata="" for line in data3: newdata += line.lstrip() |