diff options
author | supriya <supriya@dragbox.(none)> | 2012-09-26 15:49:52 +0530 |
---|---|---|
committer | supriya <supriya@dragbox.(none)> | 2012-09-26 15:49:52 +0530 |
commit | 94535d4adc3a4960795d22e3b229a8375de10b74 (patch) | |
tree | 8d77de86b443495d67360dcd40786f2b8208d334 /gstudio | |
parent | cad11e2f7ed848cdfd7779451bb0f4f931e062c3 (diff) | |
download | gnowsys-94535d4adc3a4960795d22e3b229a8375de10b74.tar.gz |
all modules integrated
Diffstat (limited to 'gstudio')
53 files changed, 2397 insertions, 992 deletions
diff --git a/gstudio/createhtml.py b/gstudio/createhtml.py index 7841408..666cc74 100755 --- a/gstudio/createhtml.py +++ b/gstudio/createhtml.py @@ -6,7 +6,7 @@ import commands def main(argv): #f_name =sys.argv[1] - f_name = "/tmp/file.org" + f_name = sys.argv[2]+sys.argv[1] s1='commands.getoutput("emacs --batch ' s2=" --eval '" s3="(org-export-as-html nil)'" diff --git a/gstudio/forms.py b/gstudio/forms.py index eee5ec1..0cf9ccc 100644 --- a/gstudio/forms.py +++ b/gstudio/forms.py @@ -20,10 +20,18 @@ from django.forms import ModelForm from django.forms import * from django.contrib.admin import widgets from registration.forms import * +from recaptcha import fields as recaptcha_fields +from registration.forms import RegistrationForm + +class RecaptchaRegistrationForm(RegistrationForm): + recaptcha = recaptcha_fields.ReCaptchaField() + class UserRegistrationForm(RegistrationForm): first_name = forms.CharField() last_name = forms.CharField() + recaptcha = recaptcha_fields.ReCaptchaField() + class MetatypeForm(ModelForm): diff --git a/gstudio/methods.py b/gstudio/methods.py index bdcc5ad..b0b75d3 100644 --- a/gstudio/methods.py +++ b/gstudio/methods.py @@ -4,6 +4,7 @@ from django.template.defaultfilters import slugify import datetime import os from demo.settings import PYSCRIPT_URL_GSTUDIO +from demo.settings import FILE_URL def delete(idnum): @@ -11,28 +12,42 @@ def delete(idnum): del_ob.delete() return True -def make_rep_object(title,auth_id): +def make_rep_object(title,auth_id,usr): new_ob = Gbobject() - new_ob.content_org=title - myfile = open('/tmp/file.org', 'w') + new_ob.title = "Re: " + new_ob.slug=slugify(new_ob.title) + new_ob.save() + titleid = "Re:"+str(new_ob.id) + contorg = unicode(title) + fname=slugify(titleid)+"-"+usr + new_ob.content_org=contorg.encode('utf8') + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'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 = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + myfile = open(os.path.join(FILE_URL,fname+ext),'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) + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) output = stdout.read() - data = open("/tmp/file.html") + + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[67:] + data2 = data1[72:] + data3 = data2[:-3] newdata="" - for line in data2: + for line in data3: newdata += line.lstrip() new_ob.content = newdata - new_ob.title = "Re: " +title + new_ob.title = "Re: " new_ob.status = 2 new_ob.slug = slugify(title) new_ob.save() @@ -41,27 +56,73 @@ def make_rep_object(title,auth_id): new_ob.sites.add(Site.objects.get_current()) return new_ob -def make_topic_object(title,auth_id,content): - print "save" +def edit_section(sec_id,title,usr): + new_ob = Gbobject.objects.get(id=int(sec_id)) + contorg = unicode(title) + new_ob.content_org=contorg.encode('utf8') + ssid=new_ob.get_ssid.pop() + fname=str(ssid)+"-"+usr + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(new_ob.content_org) + myfile.close() + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r') + + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() + data = open(os.path.join(FILE_URL,fname+html)) + data1 = data.readlines() + data2 = data1[72:] + data3 = data2[:-3] + newdata="" + for line in data3: + newdata += line.lstrip() + new_ob.content = newdata + new_ob.save() + return True + + +def make_topic_object(title,auth_id,content,usr): new_ob = Gbobject() - new_ob.title = "Query: " + title - new_ob.content_org = content - myfile = open('/tmp/file.org', 'w') + new_ob.title = "Twist: " + title + contorg = unicode(content) + fname=slugify(title)+"-"+usr + new_ob.content_org=contorg.encode('utf8') + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'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 = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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) + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) output = stdout.read() - data = open("/tmp/file.html") + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[67:] + data2 = data1[72:] + data3 = data2[:-3] newdata="" - for line in data2: + for line in data3: newdata += line.lstrip() new_ob.content = newdata new_ob.status = 2 @@ -73,28 +134,39 @@ def make_topic_object(title,auth_id,content): new_ob.sites.add(Site.objects.get_current()) return new_ob -def make_sectionreply_object(content_org,title,auth_id): +def make_sectionreply_object(content_org,title,auth_id,usr): new_ob = Gbobject() new_ob.title = title new_ob.status = 2 new_ob.slug = slugify(title) - new_ob.content_org = content_org - myfile = open('/tmp/file.org', 'w') + contorg = unicode(content_org) + fname=slugify(title)+"-"+usr + + new_ob.content_org=contorg.encode('utf8') + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') myfile.write(new_ob.content_org) myfile.close() - myfile = open('/tmp/file.org', 'r') - myfile.readline() - myfile = open('/tmp/file.org', 'a') + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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) + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) output = stdout.read() - data = open("/tmp/file.html") + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[67:] + data2 = data1[72:] + data3 = data2[:-3] newdata="" - for line in data2: + for line in data3: newdata += line.lstrip() new_ob.content = newdata myfile = open('/tmp/file.org', 'w') @@ -107,29 +179,39 @@ def make_sectionreply_object(content_org,title,auth_id): return new_ob -def make_section_object(title,auth_id,content_org): +def make_section_object(title,auth_id,content_org,usr): new_ob = Gbobject() new_ob.title = title new_ob.status = 2 new_ob.slug = slugify(title) + fname=slugify(title)+"-"+usr #new_ob.content = content - new_ob.content_org = content_org - myfile = open('/tmp/file.org', 'w') + contorg = unicode(content_org) + new_ob.content_org=contorg.encode('utf8') + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') myfile.write(new_ob.content_org) myfile.close() - myfile = open('/tmp/file.org', 'r') - myfile.readline() - myfile = open('/tmp/file.org', 'a') + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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) + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) output = stdout.read() - data = open("/tmp/file.html") + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[67:] + data2 = data1[72:] + data3 = data2[:-3] newdata="" - for line in data2: + for line in data3: newdata += line.lstrip() new_ob.content = newdata new_ob.save() @@ -139,15 +221,18 @@ def make_section_object(title,auth_id,content_org): return new_ob -def make_relation(rep,id_no,idusr): - r = make_rep_object(rep,idusr) +def make_relation(rep,id_no,idusr,usr): + r = make_rep_object(rep,idusr,usr) t = Gbobject.objects.get(id=id_no) t.posterior_nodes.add(r) r.prior_nodes.add(t) + r.title="Re:"+str(r.id)+t.title + r.slug=slugify(r.title) + r.save() return True -def make_sectionrelation(rep,ptitle,id_no,idusr): - r = make_sectionreply_object(rep,ptitle,idusr) +def make_sectionrelation(rep,ptitle,id_no,idusr,usr): + r = make_sectionreply_object(rep,ptitle,idusr,usr) t = Gbobject.objects.get(id=id_no) t.posterior_nodes.add(r) r.prior_nodes.add(t) @@ -166,11 +251,39 @@ def rate_section(section_id,request,rating): -def create_meeting(title,idusr,content): +def create_meeting(title,idusr,content,usr): sys = System() sys.title = title sys.status = 2 - sys.content = content + contorg = unicode(content) + sys.content_org=contorg.encode('utf8') + fname=slugify(title)+"-"+usr + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(sys.content_org) + myfile.close() + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) +# myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() + data = open(os.path.join(FILE_URL,fname+html)) + data1 = data.readlines() + data2 = data1[72:] + data3 = data2[:-3] + newdata="" + for line in data3: + newdata += line.lstrip() + sys.content = newdata sys.slug = slugify(title) sys.save() sys.systemtypes.add(Systemtype.objects.get(title="Meeting")) @@ -189,38 +302,48 @@ def create_meeting(title,idusr,content): sys1.title = "message box of " + title sys1.status = 2 sys1.content = "contains messages of " + title - sys1.slug = slugify(title) + sys1.slug = "message_box_of_" + slugify(title) sys1.save() sys1.systemtypes.add(Systemtype.objects.get(title="message_box")) sys.system_set.add(sys1) sys.member_set.add(Author.objects.get(id=idusr)) sys.sites.add(Site.objects.get_current()) sys1.sites.add(Site.objects.get_current()) - return sys.id + return sys.id -def create_wikipage(title,idusr,content_org): + + +def create_wikipage(title,idusr,content_org,usr): sys = System() sys.title = title sys.status = 2 contorg = unicode(content_org) - sys.content_org = contorg.encode('utf8') - - myfile = open('/tmp/file.org', 'w') + sys.content_org=contorg.encode('utf8') + ext='.org' + html='.html' + fname=slugify(title)+"-"+usr + myfile = open(os.path.join(FILE_URL,fname+ext),'w') myfile.write(sys.content_org) myfile.close() - myfile = open('/tmp/file.org', 'r') - myfile.readline() - myfile = open('/tmp/file.org', 'a') + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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) + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) output = stdout.read() - data = open("/tmp/file.html") + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() - data2 = data1[67:] + data2 = data1[72:] + data3 = data2[:-3] newdata="" - for line in data2: + for line in data3: newdata += line.lstrip() sys.content = newdata sys.slug = slugify(title) @@ -241,7 +364,7 @@ def create_wikipage(title,idusr,content_org): sys1.title = "page box of " + title sys1.status = 2 sys1.content = "contains pages of " + title - sys1.slug = slugify(title) + sys1.slug = "page_box_of_" + slugify(title) sys1.save() sys1.systemtypes.add(Systemtype.objects.get(title="page_box")) sys.system_set.add(sys1) @@ -338,3 +461,126 @@ def del_section(section_id): del_comment(each.id) ob.delete() return True + +def edit_topic(topic_id,title,usr): + ob=Gbobject.objects.get(id=int(topic_id)) + contorg = unicode(title) + ob.content_org=contorg.encode('utf8') + ssid=ob.get_ssid.pop() + fname=str(ssid)+"-"+usr + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(ob.content_org) + myfile.close() + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() + data = open(os.path.join(FILE_URL,fname+html)) + data1 = data.readlines() + data2 = data1[72:] + data3 = data2[:-3] + newdata="" + for line in data3: + newdata += line.lstrip() + ob.content = newdata + ob.save() + return True + +def edit_thread(thread_id,title,usr): + ob=System.objects.get(id=int(thread_id)) + contorg = unicode(title) + ssid=ob.get_ssid.pop() + fname=str(ssid)+"-"+usr + ob.content_org=contorg.encode('utf8') + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(ob.content_org) + myfile.close() + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() + data = open(os.path.join(FILE_URL,fname+html)) + data1 = data.readlines() + data2 = data1[72:] + data3 = data2[:-3] + newdata="" + for line in data3: + newdata += line.lstrip() + ob.content = newdata + ob.save() + + return True + +def edit_nodetype(iden,rep,usr): + nid = NID.objects.get(id = iden) + ssid=nid.get_ssid.pop() + fname=str(ssid)+"-"+usr + refobj = nid.ref + refobj.content_org = rep + #orgcontent = request.GET["content_org"] + ext='.org' + html='.html' + #usr=str(request.user) + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(refobj.content_org) + myfile.close() + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + + myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() + data = open(os.path.join(FILE_URL,fname+html)) + data1 = data.readlines() + data2 = data1[72:] + data3 = data2[:-3] + newdata="" + for line in data3: + newdata += line.lstrip() + refobj.content= newdata + refobj.save() + return True + +def check_release_or_not(meet_ob): + fl = 0 + for each in meet_ob.subject_of.all(): + if (each.attributetype.title=='release' and each.svalue=='true'): + fl=1 + return fl + +def get_factory_loom_OTs(): + retlist=[] + for each in Objecttype.objects.all(): + if each.parent: + if ((each.parent.title=='Factory_Object') and (str(each.slug)[0:4]=='loom')): + retlist.append(each.title) + return retlist diff --git a/gstudio/static/gstudio/js/addcontent.js b/gstudio/static/gstudio/js/addcontent.js index 655e2f5..5c0c4bc 100644 --- a/gstudio/static/gstudio/js/addcontent.js +++ b/gstudio/static/gstudio/js/addcontent.js @@ -1,34 +1,52 @@ + $.noConflict(); + var isWikipage=false; + var editWikipage=false; + var objid; + var isSection=false; + var editSection=false; + var isSubsection=false; + var editSubsection=false; + var isNode=false; + function subsecsave(objid){ + var org_data = $("#gnoweditor").val(); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + $("#sectionreply"+objid).val(decode_data); + $("#subsecsubmit"+objid).trigger('click'); + $(".savesubsec1").hide(); + + } + jQuery(document).ready(function($) { $("#addcontent").one("click",function(){ - //var abc = document.getElementById('pageid1').value; - //window.location.replace('sectionadd1/'+abc); - $("#save").show(); - $("#chart").hide(); - // var orgdata = document.getElementById('orgcontent').value; - document.getElementById('gnoweditor').style.visibility="visible"; - - $("#gnoweditor").orgitdown(mySettings); - - var orgtext = $("#gnoweditor").val(); + isSection=true; + $("#addcontent").hide(); + //$("#save").show(); + $("#chart").hide(); + $("#content").css({"width":"300px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var orgtext = $("#gnoweditor").val(); - // }); - // }); }); $("#save").one("click",function() { var org_data = $("#gnoweditor").val(); document.getElementById("orgpage").value = org_data; var encode_data = encodeURIComponent(org_data); $('#submitsec').trigger('click'); - + $("#save").hide(); }); $("#pagecontent1").one("click",function() { + isWikipage=true; $("#chart").hide(); document.getElementById('gnoweditor').style.visibility="visible"; $("#gnoweditor").orgitdown(mySettings); - $("#save1").show(); + //$("#save1").show(); + $("#pagecontent1").hide(); + $("#content").css({"width":"300px",}) }); $("#save1").one("click",function() { var org_data = $("#gnoweditor").val(); @@ -36,157 +54,155 @@ var encode_data = encodeURIComponent(org_data); $('#submitpage').trigger('click'); - }); - $("#editseccontent").one("click",function(){ - $("#saveseccontent").show(); - - $("#chart").hide(); - document.getElementById('gnoweditor').style.visibility="visible"; - $("#gnoweditor").orgitdown(mySettings); - var a = document.getElementById('sectionorg').value; - $("#gnoweditor").val(a); - var screenTop = $(document).scrollTop(); - $(".orgitdownContainer").css({ - "margin-top":screenTop,}); - }); - $("#saveseccontent").one("click",function(){ - var org_data = $("#gnoweditor").val(); - var id = document.getElementById("sectionid").value - document.getElementById("sectionorg").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();} - }); - } - }); - } - }); - - } - }); - - - - - - - }); - $("#editsubsec").one("click",function(){ - $("#savesubsec1").show(); - - $("#chart").hide(); - document.getElementById('gnoweditor').style.visibility="visible"; - $("#gnoweditor").orgitdown(mySettings); - var a = document.getElementById('subsecorg').value; - $("#gnoweditor").val(a); - var screenTop = $(document).scrollTop(); - $(".orgitdownContainer").css({ - "margin-top":screenTop,}); - - }); - $("#savesubsec1").one("click",function(){ - var org_data = $("#gnoweditor").val(); - var id = document.getElementById("subsecid").value - document.getElementById("subsecorg").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();} - }); - } - }); - } - }); - - } - }); - - - - + }); + $(".editseccontent").one("click",function(){ + editSection=true; + // $(".saveseccontent").show(); + $("#content img").css({"max-width":"600px",}) + $("#content").css({"width":"600px",}) + $("#chart").hide(); + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var a = this.name; + $("#gnoweditor").val(a); + var elmts = document.getElementsByClassName("editval"); + for (var i = 0; i < elmts.length; i++){ + elmts[i].setAttribute("value","edited");} + var screenTop = $(document).scrollTop(); + $(".orgitdownContainer").css({ + "margin-top":screenTop,}); + $("#newsection1").hide(); + $(".editseccontent").hide(); + $(".createsubsection").hide(); + $("#rating").hide(); + $(".chkbox").hide(); + $(".deletesec").hide(); + $(".tag").hide(); + $(".tagtext").hide(); + $(".editpagecontent").hide(); + $(".editsubsec").hide(); + }); + $(".saveseccontent").one("click",function(){ + var org_data = $("#gnoweditor").val(); + var elmts = document.getElementsByClassName("reptext"); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + for (var i = 0; i < elmts.length; i++){ + elmts[i].setAttribute("value",decode_data);} + $(".submitresponse").trigger('click'); + $(".saveseccontent").hide(); + + }); - - }); - - $("#editpagecontent").one("click",function(){ - $("#chart").hide(); - $("#savepagecontent").show(); - document.getElementById('gnoweditor').style.visibility="visible"; + $(".editsubsec").one("click",function(){ + editSubsection=true; + var each_id=$(this).attr("id"); + $("#chart").hide(); + $("#content img").css({"max-width":"600px",}) + + $("#content").css({"width":"600px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var org_data=$("#subsec"+each_id).val(); + $("#edit"+each_id).val("edited"); + $("#sectionreply"+each_id).val(org_data); + $("#gnoweditor").val(org_data); + var screenTop = $(document).scrollTop(); + $(".orgitdownContainer").css({ + "margin-top":screenTop,}); + //$("#save"+each_id).show(); + objid=each_id; + $(".editsubsec").hide(); + $(".submitsubsec1").hide(); + $(".tag").hide(); + $(".tagtext").hide(); + $(".editpagecontent").hide(); + $("#newsection1").hide(); + $(".editseccontent").hide(); + $(".createsubsection").hide(); + $("#rating").hide(); + $(".chkbox").hide(); + $(".deletesec").hide(); + }); + $(".editpagecontent").one("click",function(){ + editWikipage=true; + $("#chart").hide(); + $(".editpagecontent").hide(); + // $(".savepagecontent").show(); + $("#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 elmts = document.getElementsByClassName("editval"); + for (var i = 0; i < elmts.length; i++){ + elmts[i].setAttribute("value","edited");} + var screenTop = $(document).scrollTop(); + $(".orgitdownContainer").css({ + "margin-top":screenTop,}); + $(".tag").hide(); + $(".tagtext").hide(); + $("#newsection1").hide(); + $(".createsubsection").hide(); + $("#rating").hide(); + $(".chkbox").hide(); + $(".deletesec").hide(); + $(".editseccontent").hide(); + $(".editsubsec").hide(); + - $("#gnoweditor").orgitdown(mySettings); - var a = document.getElementById('pageorg').value; - $("#gnoweditor").val(a); - var screenTop = $(document).scrollTop(); - $(".orgitdownContainer").css({ - "margin-top":screenTop,}); + }); + $(".savepagecontent").one("click",function(){ + var org_data = $("#gnoweditor").val(); + var elmts = document.getElementsByClassName("reptext"); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + for (var i = 0; i < elmts.length; i++){ + elmts[i].setAttribute("value",decode_data);} + $(".pagedit").trigger('click'); + $(".savepagecontent").hide(); + + }); + $("#editnodecontent").one("click",function(){ + isNode=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(); + $("#nodedit").hide(); - }); - $("#savepagecontent").one("click",function(){ - // var org = $("#gnoweditor").val(); - // $("#sectionorg").val(org); - // var test = $("#sectionorg").val(); - // alert(test); - var org_data = $("#gnoweditor").val(); - var id = document.getElementById("pageid").value - document.getElementById("pageorg").value = org_data; - var encode_data = encodeURIComponent(org_data); - //$("#gnoweditor").val(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();} - }); - } - }); - } - }); - - } - }); + }); + $("#savenodecontent").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); + $("#nodedit").trigger('click'); + $("#nodedit").hide(); + + }); + $(".createsubsection").one("click",function(){ + isSubsection=true; + //$(".savesubsec").show(); + //$(".submitsubsec").show(); + $(".createsubsection").hide(); - }); - - - $("#createsubsection").one("click",function(){ - $("#savesubsec").show(); - + $("#content img").css({"max-width":"600px",}) + $("#content").css({"width":"600px",}) $("#chart").hide(); document.getElementById('gnoweditor').style.visibility="visible"; $("#gnoweditor").orgitdown(mySettings); @@ -194,20 +210,25 @@ var screenTop = $(document).scrollTop(); $(".orgitdownContainer").css({ "margin-top":screenTop,}); - + }); - $("#savesubsec").one("click",function() { - var org_data = $("#gnoweditor").val(); - document.getElementById("sectionreply").value = org_data; - var encode_data = encodeURIComponent(org_data); - $('#submitsubsec').trigger('click');}); + $(".savesubsec").one("click",function() { + var org_data = $("#gnoweditor").val(); + var elmts = document.getElementsByClassName("reptext"); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + for (var i = 0; i < elmts.length; i++){ + elmts[i].setAttribute("value",decode_data);} + $(".savesubsec").hide(); + $(".submitsubsec").trigger('click'); + }); $("#savecontent").one("click",function() { var org_data = $("#gnoweditor").val(); var id = document.getElementById("objectid").value document.getElementById("orgcontent").value = org_data; var encode_data = encodeURIComponent(org_data); - + $("#savecontent").hide(); $.ajax({ url: '/nodetypes/ajax/contentorgadd/?id=' + id + '&contentorg=' + encode_data, success: function(data) { @@ -228,11 +249,11 @@ } }); - } - }); + } + }); - }); }); + }); - + diff --git a/gstudio/static/gstudio/js/loomscripts.js b/gstudio/static/gstudio/js/loomscripts.js new file mode 100644 index 0000000..45d7f37 --- /dev/null +++ b/gstudio/static/gstudio/js/loomscripts.js @@ -0,0 +1,201 @@ + $.noConflict(); +var isThread=false; +var editThread=false; +var isTwist=false; +var editTwist=false; +var isResponse=false; +var objid; +var twistid; +var responseid; +function saveclick(objid){ + $("#add"+objid).show(); + var org_data = $("#gnoweditor").val(); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + $("#text"+objid).val(decode_data); + $("#submit"+objid).trigger('click'); + $(".commenteditor").hide(); + $(".editcontent").hide(); +}//closing saveclick + + + + +jQuery(document).ready(function($) { + $(".commenteditor").one("click",function() { + var a=$(this).attr("id"); + $("#chart").hide(); + $("#content img").css({"max-width": "600px",}) + $("#content").css({"width": "600px",}) + + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var screentop=$(document).scrollTop(); + $(".orgitdownContainer").css({"margin-top":screentop,}); + $("#save"+a).show(); + $(".commenteditor").hide(); + $(".chkdel").hide(); + $(".submitdelete").hide(); + $(".rating").hide(); + $(".editor").hide(); + $(".topicchk").hide(); + $(".topicdelete").hide(); + $(".editcontent").hide(); + + }); + +}); +function topicsaveclick(objid){ + var org_data = $("#gnoweditor").val(); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + $("#topictext"+objid).val(decode_data); + $("#topicsubmit"+objid).trigger('click'); + $(".editor").hide(); + $(".editcontent").hide(); +}//closing saveclick + jQuery(document).ready(function($) { + $(".editor").one("click",function() { + isResponse=true; + var a=$(this).attr("id"); + $("#chart").hide(); + $("#content img").css({"max-width": "600px",}) + + $("#content").css({"width": "600px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var screentop=$(document).scrollTop(); + $(".orgitdownContainer").css({"margin-top":screentop,}); + responseid=a; + //$("#save"+a).show(); + $(".editor").hide(); + $(".topicchk").hide(); + $(".topicdelete").hide(); + $(".editcontent").hide(); + $(".commenteditor").hide(); + $(".chkdel").hide(); + $(".submitdelete").hide(); + $(".rating").hide(); + }); + +}); + + +jQuery(document).ready(function($) { + $(".editcontent").one("click",function() { + editTwist=true; + var each_id = $(this).attr("id"); + $("#chart").hide(); + $("#content img").css({"max-width": "600px",}) + + $("#content").css({"width": "600px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var org_data=$("#commentdata"+each_id).val(); + $("#edit"+each_id).val("edited"); + $("#topictext"+each_id).val(org_data); + var screentop=$(document).scrollTop(); + $(".orgitdownContainer").css({"margin-top":screentop,}); + $("#gnoweditor").val(org_data); + twistid=each_id; + //$("#save"+each_id).show(); + $(".editcontent").hide(); + $(".editor").hide(); + $(".submitdelete").hide(); + $(".commenteditor").hide(); + $(".rating").hide(); + $(".topicdelete").hide(); + $(".chkdel").hide(); + $(".topicchk").hide(); + }); + + + }); + + $.noConflict(); + jQuery(document).ready(function($) { + $("#topicaddcontent").one("click",function() { + isTwist=true; + $("#chart").hide(); + $("#content img").css({"max-width": "600px",}) + + $("#content").css({"width": "600px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var screentop=$(document).scrollTop(); + $(".orgitdownContainer").css({"margin-top":screentop,}); + // $("#topicaddsave").show(); + }); + + $("#topicaddsave").one("click",function(){ + var org_data = $("#gnoweditor").val(); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + $("#contenttext").val(decode_data); + $('#topicsubmit').trigger('click'); + $("#topicaddsave").hide(); + }); + + $("#addthreadcontent").one("click",function() { + isThread=true; + $("#chart").hide(); + $("#content img").css({"max-width": "600px",}) + + $("#content").css({"width": "600px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var screentop=$(document).scrollTop(); + $(".orgitdownContainer").css({"margin-top":screentop,}); + $("#addthreadcontent").hide(); + // $("#threadsave").show(); + }); + + $("#threadsave").one("click",function(){ + var org_data = $("#gnoweditor").val(); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + $("#threadcontent").val(decode_data); + $('.orgitdownContainer').hide(); + $("#threadsave").hide(); + $("#addthreadcontent").show(); + }); + + }); +jQuery(document).ready(function($) { + $("#threadedit").one("click",function() { + editThread=true; + $("#chart").hide(); + $("#content img").css({"max-width": "600px",}) + + $("#content").css({"width": "600px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + + + var screentop=$(document).scrollTop(); + $(".orgitdownContainer").css({"margin-top":screentop,}); + var id=document.getElementById("threadid").value; + var org_data=document.getElementById("threadcontent"+id).value; + $("#gnoweditor").val(org_data); + $("#threadedit").hide(); + $(".editor").hide(); + $(".editcontent").hide(); + $("#addthreadcontent").hide(); + $("#twistaddbtn").hide(); + $("#Release *").hide(); + //$("#editthreadsave").show(); + }); + + $("#editthreadsave").one("click",function() { + var id=document.getElementById("threadid").value; + var org_data=$("#gnoweditor").val(); + $("#threadcontent"+id).val(org_data); + $('.orgitdownContainer').hide(); + $("#threadsave").hide(); + $("#threadedit"+id).val("editthread"); + $(".commenteditor").hide(); + $(".editcontent").hide(); + $("#subeditresp").trigger('click'); + }); +}); + diff --git a/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js b/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js index c766300..6e207a0 100755..100644 --- a/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js @@ -438,7 +438,7 @@ } return selection; } - function save() { + function save1() { var org_data = $("#gnoweditor").val(); var id = document.getElementById("objectid").value document.getElementById("orgcontent").value = org_data; @@ -466,6 +466,48 @@ } });} + function close() { + $(".orgitdownContainer").hide(); + location.reload();} + function save() { + if (isWikipage){ + $("#save1").trigger('click');} + if (isNode){ + $("#savenodecontent").trigger('click');} + + if (editWikipage){ + $(".savepagecontent").trigger('click');} + if (isSection){ + $("#save").trigger('click');} + if (editSection){ + $(".saveseccontent").trigger('click');} + if (editSubsection){ + subsecsave(objid);} + if (isSubsection){ + $(".savesubsec").trigger('click');} + + if (isThread){ + $("#threadsave").trigger('click');} + if (editThread){ + $("#editthreadsave").trigger('click');} + if (isTwist){ + $("#topicaddsave").trigger('click');} + if (editTwist){ + topicsaveclick(twistid);} + if (isResponse){ + topicsaveclick(responseid);} + + if (editImage){ + $("#save").trigger('click');} + if (isImage){ + $("#save").trigger('click'); + $("#descriptionsave").trigger('click'); + $("#save"+objid).trigger('click');} + if (isVideotitle){ + $("#titlesave").trigger('click');} + + } + // open preview window function preview() { if (typeof options.previewHandler === 'function') { diff --git a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/images/close.jpeg b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/images/close.jpeg Binary files differnew file mode 100644 index 0000000..5c5297c --- /dev/null +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/images/close.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 25b118e..17121d7 100644 --- a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/set.js +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/org/set.js @@ -14,7 +14,8 @@ var mySettings = { onAltEnter: {keepDefault:false, replaceWith:'\n* '}, onAltrightArrow: {keepDefault:false, replaceWith:'*'}, markupSet: [ - {name:'Save', key:'S',call:'save' }, + {name:'Save',call:'save' }, + {separator:'---------------' }, {name:'Bold', key:'B', openWith:'*', closeWith:'*' }, {name:'Italic', key:'I', openWith:'/', closeWith:'/' }, {name:'Stroke through', key:'S', openWith:'+', closeWith:'+' }, @@ -22,10 +23,12 @@ 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:'[[http:fileName.jpg]]' }, + {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:'Clean', className:'clean', replaceWith:function(orgitdown) { return orgitdown.selection.replace(/<(.*?)>/g, "") } }, - {name:'Preview', className:'preview', call:'preview'} + {separator:'---------------' }, + {name:'Close',call:'close' } + + //{name:'Clean', className:'clean', replaceWith:function(orgitdown) { return orgitdown.selection.replace(/<(.*?)>/g, "") } } + //{name:'Preview', className:'preview', call:'preview'} ] } diff --git a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/savedata.js b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/savedata.js index eaf728c..7b3d5cd 100644 --- a/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/savedata.js +++ b/gstudio/static/gstudio/js/orgitdown/orgitdown/sets/savedata.js @@ -6,8 +6,12 @@ document.getElementById('gnoweditor').style.visibility="visible"; $("#gnoweditor").orgitdown(mySettings); $("#gnoweditor").val(orgdata); + $("#editdata").hide(); + $("#savecontent").show(); + }); + }); diff --git a/gstudio/templates/gstudio/NewGroup.html b/gstudio/templates/gstudio/NewGroup.html index 829c4fa..df0009d 100644 --- a/gstudio/templates/gstudio/NewGroup.html +++ b/gstudio/templates/gstudio/NewGroup.html @@ -1,4 +1,5 @@ {%extends "gstudio/base.html"%} +{% load gstudio_tags %} {%load i18n %} {%block extrahead%} <script type="text/javascript"> @@ -7,9 +8,51 @@ $('#id_value_1').datepicker(); $('#id_value_2').datepicker(); }); + function slnchange() + { + var a= document.getElementById("opt"); + var b=a.options[a.selectedIndex].value; + var currentDate = new Date(); + var endd=new Date(); + var dat=parseInt(currentDate.getMonth(),10)+1 + var d=dat+"/"+currentDate.getDate()+"/"+currentDate.getFullYear() + $('#id_value_1').datepicker().val(d); + $('#id_hr1').val('0'); + $('#id_hr2').val('0'); + $('#id_min1').val('0'); + $('#id_min2').val('0'); + if (b=='Quiz'){ + endd.setDate(currentDate.getDate()+5); + var d=dat+"/"+endd.getDate()+"/"+endd.getFullYear(); + $('#id_value_2').datepicker().val(d); + } + else if(b=='Online Meeting') + { + endd.setHours(currentDate.getHours()+6); + var d=dat+"/"+endd.getDate()+"/"+endd.getFullYear() + $('#id_value_2').datepicker().val(d); + } + else if(b=='Discussion Forum') + { + var y=parseInt(currentDate.getFullYear(),10)+100; + var d =dat+"/"+endd.getDate()+"/"+y; + $('#id_value_2').datepicker().val(d) + } + else + { + obj = document.getElementById('opt'); + obj.value =""; + } + } </script> {%endblock%} {% block content %} +<style type="text/css"> +#content +{ + width:1000px; +} +</style> {%if user.is_authenticated%} {% if errors %} <ul> @@ -20,32 +63,47 @@ {% endif %} <form action="" method="post"> {% csrf_token %} -<p>Name of the Group: <input type="text" name="subject"></p> -<p>Brief Description: <textarea name="message" rows="10" cols="50"></textarea></p> +<p><font size ="3" >Name of the Thread:</font> <input type="text" name="subject"></p> +<p><font size ="3" >Substance:</font> </p> +<textarea id="threadcontent" name="message" rows="10" cols="50" style="display:none"></textarea> + +<input type="button" id="addthreadcontent" name="content" value="Add Description"> +<input type="button" id="threadsave" name="savecontent" value="Save" style="display:none"> </br> -<p>If you want to leave any instructions for the participants you may mention them above as well </p> -Please Set the time + +{% get_factory_looms as abc %} + +<p><font size ="3" >Type:</font></p> +<select id="opt" onchange="slnchange()" > + {% for each in abc %} + <option value="{{each}}" >{{each}}</option> +{% endfor %} +</select> +<br/> + +<font size ="3" >Please Set the time +<p>Creating a thread will require to schedule it for an indefinite period of time. So in this case, please enter end time of say 50 years from now</p></font> </br> -Starts at time: +<font size ="3" >Start time:</font> </br> <span class="datetimeshortcuts"> <a href="javascript:DateTimeShortcuts.openCalendar(0);"id = "calendarlink0"></a> </span> - Date: <input id="id_value_1" type="text" class="vTimeField hasTimepicker" name="stDate" size ="8"> - Hours:<input type = "text" name = "hours1"> - Minutes:<input type = "text" name = "minutes1"> <hr> - <p><b>Note</b>The group will be accessible to members (except the creator)only after the scheduled start time</p> - Ends at time: </br> - Date: <input id="id_value_2" type="text" class="vTimeField hasTimepicker" name="endDate" size ="8"> - Hours:<input type = "text" name = "hours2"> - Minutes:<input type = "text" name = "minutes2"> -<p>After this time the group posts remain but the activity is frozen<p> + <font size ="2" > Date:</font> <input id="id_value_1" type="text" class="vTimeField hasTimepicker" name="stDate" size ="8"> + <font size ="2" >Hours:</font><input id = "id_hr1" type = "text" name = "hours1"> + <font size ="2" >Minutes:</font><input id = "id_min1" type = "text" name = "minutes1"><br/> + <font size ="3" ><p><b>Note</b> The thread will be accessible to members (except the creator)only after the scheduled start time</p></font> + <font size ="3" > End time: </font> </br> + <font size ="2" >Date: </font><input id="id_value_2" type="text" class="vTimeField hasTimepicker" name="endDate" size ="8"> + <font size ="2" >Hours:</font><input id = "id_hr2" type = "text" name = "hours2"> + <font size ="2" >Minutes:</font><input id = "id_min2" type = "text" name = "minutes2"> +<font size ="3" ><p>After this time the threads remain but it will be inactive<p></font> <input type="hidden" value={{user.id}} name = "idusr"> +<input type="hidden" value={{user.username}} name = "usr"> <input type="submit" value="Submit"> </form> -<p>Creating a group will require to schedule it for an indefinite period of time. So in this case, please enter end time of say 50 years from now</p> {%else%} -<p> Sorry! Login To proceed </p> +<font size ="3" ><p> Please Login </p></font> {%endif%} {% endblock %} diff --git a/gstudio/templates/gstudio/NewPage.html b/gstudio/templates/gstudio/NewPage.html index b73b0dc..9d4caa5 100644 --- a/gstudio/templates/gstudio/NewPage.html +++ b/gstudio/templates/gstudio/NewPage.html @@ -26,6 +26,7 @@ <input type="button" name="savepage" id="save1" value="Save Page"></p> </br> <input type="hidden" value={{user.id}} name = "idusr"> +<input type="hidden" value={{user.username}} name = "usr"> <input type="submit" id="submitpage" value="Submit" style="display:none;"/> </form> {%else%} diff --git a/gstudio/templates/gstudio/NewSection1.html b/gstudio/templates/gstudio/NewSection1.html index daf29bc..a9c59ff 100644 --- a/gstudio/templates/gstudio/NewSection1.html +++ b/gstudio/templates/gstudio/NewSection1.html @@ -6,6 +6,7 @@ $(window).load(function() { $("#save").hide();}); </script> + <h1>Add a new Section</h1> {% if errors %} <ul> @@ -25,6 +26,7 @@ <input type="button" name="savepage" id="save" value="Save Page"></p></br> <input type="hidden" value={{pageid}} id="sectionid"> <input type="hidden" value={{user.id}} name = "idusr"> +<input type="hidden" value={{user.username}} name = "usr"> <input type="submit" id="submitsec" value="Submit" style="display:none;"/> </form> diff --git a/gstudio/templates/gstudio/NewTopic1.html b/gstudio/templates/gstudio/NewTopic1.html index 5f2db82..7974cc5 100644 --- a/gstudio/templates/gstudio/NewTopic1.html +++ b/gstudio/templates/gstudio/NewTopic1.html @@ -12,6 +12,8 @@ $(window).load(function() { $("#graphcss").hide(); }); +$("#topicaddsave").hide(); +$("#topicsubmit").hide(); </script> <h1>Add a new Twist</h1> @@ -24,14 +26,15 @@ $(window).load(function() { {% endif %} <form action="" method="post">{% csrf_token %} -<p>Title: <input type="text" name="subject"></p> -<p>Description: <textarea name="message" id="contenttext" rows="10" cols="50" style="display:none" ></textarea></p> +<p>Name : <input type="text" name="subject"></p> +<p>Substance: <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="button" id="topicaddcontent" name="content" value="Add Substance"> +<input type="button" id="topicaddsave" name="savecontent" value="Save" style="display:none"> <input type="hidden" value={{user.id}} name = "idusr"> +<input type="hidden" value={{user.username}} name = "usr"> <input type="submit" id="topicsubmit" value="Submit" style="display:none"> </form> diff --git a/gstudio/templates/gstudio/_header.html b/gstudio/templates/gstudio/_header.html index 1a5de32..123b05d 100644 --- a/gstudio/templates/gstudio/_header.html +++ b/gstudio/templates/gstudio/_header.html @@ -13,14 +13,17 @@ --> <!-- | <a href="{{ get_absolute_url }}/objects" title="Objects">Objects</a>--> - {% if user.is_authenticated %} - {% if user.is_staff %} - | <a href="{{ get_absolute_url }}/gstudio/user/{{user.username}}" title="My Loom Studio">Loom Studio</a> + | <a href="{{ get_absolute_url }}/gstudio/user" title="Loom Studio">Loom</a> + | <a href="{{ get_absolute_url }}/gstudio/user/wikipage" title="Wikipages">Wikipages</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/resources/images" title="Images">Images</a> | <a href="{{ get_absolute_url }}/gstudio/resources/videos" title="My Videos">Videos</a> - | <a href="{{ get_absolute_url }}/admin" title="Admin Dashboard">Admin Dashboard</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 %} + + | <a href="{{ get_absolute_url }}/admin" title="Admin Dashboard">Dashboard</a> {% endif %} {% endif %} @@ -58,9 +61,9 @@ <!-- Documentation --> {% url django-admindocs-docroot as docsroot %} {% if docsroot %} - <li><a href="{{ docsroot }}" title="Documentation">{% trans 'Documentation' %}</a></li> + <!-- <li><a href="{{ docsroot }}" title="Documentation">{% trans 'Documentation' %}</a></li>--> {% endif %} - <li><a href="http://github.com/gnowgi/django-gstudio" title="Code">Code</a></li> + <li><a href="https://gitorious.org/gnowsys-studio" title="Code">Code</a></li> {% endblock %} </ul> {% else %} diff --git a/gstudio/templates/gstudio/_nodetype_detail.html b/gstudio/templates/gstudio/_nodetype_detail.html index 7f56f40..fc5d95f 100644 --- a/gstudio/templates/gstudio/_nodetype_detail.html +++ b/gstudio/templates/gstudio/_nodetype_detail.html @@ -1,20 +1,106 @@ {% load tagging_tags comments i18n %} +{% load i18n gstudio_tags %} <div id="nodetype-{{ object.pk }}" class="hnodetype{% if object.featured %} featured{% endif %} span-16 last"> <div class="nodetype-header span-16 last"> - <h2 class="nodetype-title"> - <a href="{{ object.get_absolute_url }}" title="{{ object.title }}" rel="bookmark"> - {{ object.title }} - </a> - <a href="{{ object.ref.get_edit_url }}" target="_blank" >[edit]</a> + <h2 class="nodetype-title"> + {% ifequal object.ref.get_nbh.member_of|slugify 'nodetype-ot-document' %} + <a href="/gstudio/resources/documents/show/{{object.id}}">{{object.title}}</a> <font size="2" color="black"> is a Document</font> + {% else %} + {% ifequal object.ref.get_nbh.member_of|slugify 'nodetype-ot-image' %} + <a href="/gstudio/resources/images/show/{{object.id}}">{{object.title}}</a> <font size="2" color="black"> is an Image</font> + + {% else %} + {% ifequal object.ref.get_nbh.member_of|slugify 'nodetype-ot-video' %} + <a href="/gstudio/resources/videos/show/{{object.id}}">{{object.title}}</a> <font size="2" color="black"> is a Video</font> + {% else %} + {% ifequal object.ref.get_nbh.member_of|slugify 'nodetype-ot-topic' %} + <a href="/gstudio/{% show_nodesystem object.id %}">{{object.title}}</a> <font size="2" color="black">is a Topic of a Loom-thread</font> + {% else %} + {% ifequal object.ref.get_nbh.member_of|slugify 'nodetype-ot-section' %} + <a href="/gstudio/{% show_nodesystem object.id %}">{{object.title}}</a> <font size="2" color="black"> is a Section of a wiki-page</font> + {% else %} + {% ifequal object.ref.get_nbh.member_of|slugify 'nodetype-ot-reply' %} + + {% for eachobject in object.ref.prior_nodes.all %} + {% if eachobject.ref.prior_nodes.all %} + {% for eachobject1 in eachobject.ref.prior_nodes.all %} + {% if eachobject1.ref.prior_nodes.all %} + {% for eachobject2 in eachobject1.ref.prior_nodes.all %} + <a href="/gstudio/{% show_nodesystem eachobject2.id %}">{{object.title}}</a> <font size="2" color="black">is a Reply</font> + {% endfor %} + {% else %} + <a href="/gstudio/{% show_nodesystem eachobject1.id %}">{{object.title}}</a> <font size="2" color="black">is a Reply </font> + {% endif %} + {% endfor %} + {% else %} + <a href="/gstudio/{% show_nodesystem eachobject.id %}">{{object.title}}</a> <font size="2" color="black"> is a Reply </font> + {% endif %} + + {% endfor %} + {% else %} + {% ifequal object.ref.get_nbh.member_of|slugify 'nodetype-ot-subsection' %} + {% for eachobject in object.ref.prior_nodes.all %} + <a href="/gstudio/{% show_nodesystem eachobject.id %}">{{object.title}}</a> <font size="2" color="black"> is a Subsection of a Section wiki-page</font> + {% endfor %} + {% else %} +<a href="{{ object.get_absolute_url }}" title="{{ object.title }}" rel="bookmark" id = "{{object.id}}awikiloom"> {{ object.title }} </a><font size="2" color="black"> +<script type="text/javascript" > +var a = "{% show_nodesystem object.id %}" +if (a != "") +{ +document.getElementById("{{object.id}}awikiloom").setAttribute("href","/gstudio/"+a); +space = a.replace( "/", " " ); +b = space.match("group") +c = space.match("page") +if(b == "group"){ +document.write("is a Loom thread" ); +} +if(c == "page"){ +document.write("is a Wiki page" ); +} + +} +else +{ +var e; +e = "{{ object.nodemodel}}"; +if(e == "Gbobject") +{document.write("is an Object"); +} +else +{ +document.write("is a {{object.nodemodel}}"); +} +} +</script> +</font> + + + +{% endifequal %} +{% endifequal %} +{% endifequal %} + {% endifequal %} + {% endifequal %} + {% endifequal %} + {% endifequal %} + + + +<!-- <a href="{{ object.ref.get_edit_url }}" target="_blank" >[edit]</a> --> + </h2> + + + <p class="nodetype-info"> - {% if object.authors.count %} + {% if object.ref.authors.count %} {% trans "Contributed by" %} - {% for author in object.authors.all %} + {% for author in object.ref.authors.all %} <span class="vcard author"> <a href="{% url gstudio_author_detail author %}" class="fn nickname url" rel="author" title="{% blocktrans with author as author %}Show {{ author }} nodetypes{% endblocktrans %}">{{ author }}</a> diff --git a/gstudio/templates/gstudio/docu.html b/gstudio/templates/gstudio/docu.html index bb66363..8519321 100644 --- a/gstudio/templates/gstudio/docu.html +++ b/gstudio/templates/gstudio/docu.html @@ -3,12 +3,14 @@ {% load adminmedia grp_tags %} {% load i18n comments gstudio_tags %} {% load i18n objectapp_tags %} + {% block title %}Documents{% endblock %} {% block content %} {% load tagging_tags comments i18n %} <script src="{% admin_media_prefix %}jquery/jquery-1.6.2.min.js" type="text/javascript"></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" > + var isVideotitle=false; $(window).load(function() { $("#content").css({ "width": "600px",});}); @@ -20,10 +22,11 @@ $(window).load(function() { }); var i = 0; jQuery(document).ready(function($) { + isImage=true; $("#commenteditor").click(function(){ document.getElementById('gnoweditor').style.visibility="visible"; $("#gnoweditor").orgitdown(mySettings); - document.getElementById('descriptionsave').style.visibility="visible"; + <!--document.getElementById('descriptionsave').style.visibility="visible";--> $("#commenteditor").hide(); }); @@ -36,14 +39,17 @@ jQuery(document).ready(function($) { }); }); jQuery(document).ready(function($) { - $(".editcontent").click(function(){ + $(".doceditcontent").click(function(){ + isImage=true; + var a = $(this).attr("id"); + objid=a; document.getElementById('gnoweditor').style.visibility="visible"; $("#gnoweditor").val($("#editortext"+a).val()); $("#gnoweditor").orgitdown(mySettings); var screentop=$(document).scrollTop(); $(".orgitdownContainer").css({"margin-top":screentop,}); - document.getElementById('save'+a).style.visibility="visible"; +<!-- document.getElementById('save'+a).style.visibility="visible";--> $("#"+a).hide(); }); $(".commentsavecontent").click(function(){ @@ -71,7 +77,7 @@ position:absolute; margin-left:52%; } </style> -{% if user.is_authenticated %} + {% autopaginate documents 8 %} <h2 style="color: teal;">Document Library</h2> <br> @@ -94,12 +100,13 @@ margin-left:52%; <input type="submit" value="Search"> </form> </div> - +{% if user.is_authenticated %} <div id="divpost"> <form enctype="multipart/form-data" method="post" action="">{% csrf_token %} <br/> <h4 style="color: black;">Post File:</h4> -<font size="3">File:</font> <input type=file name="doc[]" multiple="multiple" /><br><br> +<font size="2">Title:</font> <input type="text" name="title1"><br/> +<font size="2">File:</font> <input type=file name="doc[]" multiple="multiple" /><br><br> Description: <input type="button" id="commenteditor" value="Add Content" > <input type="button" class="commentsavecontent" id="descriptionsave" value="Save" style="visibility:hidden" /> <input type=text name="contenttext" id="descriptioncommenttext" style="visibility:hidden" /> @@ -108,13 +115,17 @@ Description: <input type="button" id="commenteditor" value="Add Con <input type="submit" value="Post"> </form> </div> - +{% endif %} </div> <br> <br> <br> <br> <h4 style="color: teal;">Documents Listing</h4> +{% if reportid %} +<h2><font color="red">this document is already uploaded on this site</font></h2> +<a href="/gstudio/resources/documents/show/{{ reportid }}/"> <font size="4">to see this image click here</font></a><br/><br/><br/> +{% endif %} {% for document in documents %} @@ -136,18 +147,16 @@ Description: <input type="button" id="commenteditor" value="Add Con {{document_content}} {% endwith %} {% endautoescape%}</font> -{% for author in image.authors.all %} - {% ifequal author.username user.username %} +{% if user.is_authenticated %} <input type="hidden" name="docid" value={{document.id}}> -<input type="button" class="editcontent" id="{{document.id}}" value="Edit"/> +<input type="button" class="doceditcontent" id="{{document.id}}" value="Edit"/> <input type="submit" class="commentsavecontent" id="save{{document.id}}" value="Save" style="visibility:hidden" /> <input type="hidden" name="commenttext" class="commenttext" id="commenttext{{document.id}}" style="visibility:hidden" /> <input type="hidden" id="editortext{{document.id}}" style="visibility:hidden" value="{{document.content_org}}"> - {% endifequal %} -{% endfor %} +{% endif %} </form> <br> -<font color = 'black'>Download: </font><a href="{% admin_media_prefix %}img/{{document.title}}">Click to download!!</a> +<font color = 'black'>Download: </font><a href="{% admin_media_prefix %}img/{{document.altnames}}">Click to download!!</a> <br> {% for author in document.authors.all %} {% ifequal author.username user.username %} @@ -177,6 +186,7 @@ Description: <input type="button" id="commenteditor" value="Add Con <font color = 'black'>Total Number of votes is: <font color='teal'><b>{{ document.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"/> @@ -193,6 +203,7 @@ Description: <input type="button" id="commenteditor" value="Add Con <input type="text" value="" name="texttags" /> <input type="submit" value="Add Tags" name="addtags" /> </form> +{% endif %} <br> <div class="tags"> <p class="gbobject-tags span-16 last"> @@ -212,11 +223,7 @@ Description: <input type="button" id="commenteditor" value="Add Con {% endfor %}<br> -{% else %} - -<h2 style="color: indigo;">Sorry you need to log in to see this content !</h2> - -{% endif %} + <h2> {% paginate %}</h2> diff --git a/gstudio/templates/gstudio/fulldocument.html b/gstudio/templates/gstudio/fulldocument.html new file mode 100644 index 0000000..b4d5d43 --- /dev/null +++ b/gstudio/templates/gstudio/fulldocument.html @@ -0,0 +1,177 @@ +{% extends "gstudio/base.html" %} +{% load adminmedia grp_tags %} +{% load i18n comments gstudio_tags %} +{% load tagging_tags comments i18n %} + {% block title %}{{ doc.title }}{% endblock %} +{% block content %} +<script src="{% admin_media_prefix %}jquery/jquery-1.6.2.min.js" type="text/javascript"></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" > + $(window).load(function() { + $("#content").css({ + "width": "600px",});}); +$(window).load(function() { + $("#chart").hide();}); +$(window).load(function() { + + $("#graphcss").hide(); + }); +jQuery(document).ready(function($) { + $("#editcontent").click(function(){ + isImage=true; + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").val($("#editortext").val()); + $("#content img").css({"max-width":"600px",}) + + + $("#gnoweditor").orgitdown(mySettings); + <!--document.getElementById('save').style.visibility="visible";--> + $("#editcontent").hide(); + + }); + $("#save").click(function(){ + var org_data = $("#gnoweditor").val(); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + $("#commenttext").val(decode_data); + + }); +}); +</script> +</script> +<link href="{% admin_media_prefix %}css/base.css" rel="stylesheet" type="text/css" /> +<link rel="stylesheet" type="text/css" media="screen, projection" href="{{ STATIC_URL }}gstudio/css/screen.css" /> +<link rel="shortcut icon" href="{{ STATIC_URL }}gstudio/img/favicon.ico" /> + + +<br/> +<form method="post" action="">{% csrf_token %} +<h2><font color = 'teal'>{{doc.title}}</font></h2> +<br/> +<font color = 'black'>Posted By : </font> +{% for author in doc.authors.all %} + <font color = 'teal'>{{author}}</font> +{% endfor %} +<br> + +<font color = 'black'>Posted At : </font><font color = 'teal'>{{doc.creation_date}}</font> +<br/> +<font color = 'black'>Download: </font><a href="{% admin_media_prefix %}img/{{doc.title}}">Click to download!!</a> +<br> +<font color = 'black'>Description:</font> +{%autoescape on%} +{% with doc.html_content|safe as doc_content %} + {{doc_content}} +{% endwith %} +{% endautoescape%} + + + +{% if user.is_authenticated %} +<input type="hidden" name="docid" value={{doc.id}}> +<input type="button" id="editcontent" value="Edit"/> + +<input type="submit" class="commentsavecontent" id="save" value="Save" style="visibility:hidden" /> +<input type="hidden" name="contenttext" id="commenttext" style="visibility:hidden" /> +<input type="hidden" id="editortext" style="visibility:hidden" value="{{doc.content_org}}"> +{% endif %} +</form> + +<br/> +{% ifequal doc.rating.get_rating 0 %} + +<font color = 'black'>Current rating is: <font color = 'teal'> No rating yet </font></font> +{% else %} +<font color = 'black'>Average Current rating is: <font color = 'teal'> {{ doc.rating.get_rating }} </font></font><br/> +<font color = 'black'>Total Number of votes is: <font color='teal'><b>{{ doc.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="docid" value={{doc.id}}> +<input type="submit" value="Rate it!!!"> +</form> +<br/> + +<form method="post" action="">{% csrf_token %} +<input type="hidden" name="docid" value={{doc.id}}> +<input type="text" value="" name="texttags" /> +<input type="submit" 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 doc 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/><br/> +{% block nodetype-comments %} +<div id="comments" class=""> + <h5>{% trans "Comments" %}</h5> + {% with doc.comments as comment_list %} + {% if comment_list.count %} + <ol id="comment-list" class="span-15 last"> + {% for comment in comment_list %} + <li id="comment_{{ comment.pk }}" class="comment vcard {% cycle box1,box2 %}{% if comment.user in doc.authors.all %} post-author{% endif %} span-15 last"> + <div class="span-2"> + <img src="{% get_gravatar comment.email 60 "G" %}" class="gravatar photo" alt="{{ comment.user_name }}"/> + </div> + <div class="comment-body span-13 last"> + <div class="comment-author span-13 last"> + {% if comment.url %} + <a href="{{ comment.url }}" class="fn url" title = "{{ comment.user_name }}">{{ comment.user_name }}</a> + {% else %} + {{ comment.user_name }} + {% endif %} + {% trans "on" %} {{ comment.submit_date|date:"SHORT_DATETIME_FORMAT" }} + </div> + <div class="span-13 last"> + {{ comment.comment|linebreaks }} + </div> + </div> + </li> + {% endfor %} + </ol> + {% if not doc.comments_are_open %} + <p>{% trans "Comments are closed." %}</p> + {% endif %} + {% else %} + {% if doc.comments_are_open %} + <p>{% trans "No comments yet." %}</p> + {% else %} + <p>{% trans "Comments are closed." %}</p> + {% endif %} + {% endif %} + {% endwith %} +</div> +{% endblock %} + + +<div class="commentForm span-16 last"> + {% render_comment_form for doc %} +</div> + + + + +<br> +<hr width="100%" style="height:5px;" color="black"/> +<br> + +{% endblock %} diff --git a/gstudio/templates/gstudio/fullscreen.html b/gstudio/templates/gstudio/fullscreen.html index e08a09d..7090c96 100644 --- a/gstudio/templates/gstudio/fullscreen.html +++ b/gstudio/templates/gstudio/fullscreen.html @@ -2,6 +2,7 @@ {% load adminmedia grp_tags %} {% load i18n comments gstudio_tags %} {% load tagging_tags comments i18n %} + {% block title %}{{ image.title }}{% endblock %} {% block content %} <script src="{% admin_media_prefix %}jquery/jquery-1.6.2.min.js" type="text/javascript"></script> <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/sets/org/set.js"></script> @@ -9,19 +10,24 @@ <script type="text/javascript" > $(window).load(function() { $("#content").css({ - "width": "600px",});}); + "width": "600px",}); + $("img").css({"max-width":"1000px",}) + }); $(window).load(function() { $("#chart").hide();}); $(window).load(function() { $("#graphcss").hide(); }); +var editImage=false; jQuery(document).ready(function($) { $("#editcontent").click(function(){ + editImage=true; document.getElementById('gnoweditor').style.visibility="visible"; $("#gnoweditor").val($("#editortext").val()); $("#gnoweditor").orgitdown(mySettings); - document.getElementById('save').style.visibility="visible"; + $("#content img").css({"max-width":"600px",}) + <!--document.getElementById('save').style.visibility="visible";--> $("#editcontent").hide(); }); @@ -38,8 +44,8 @@ jQuery(document).ready(function($) { <link href="{% admin_media_prefix %}css/base.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" media="screen, projection" href="{{ STATIC_URL }}gstudio/css/screen.css" /> <link rel="shortcut icon" href="{{ STATIC_URL }}gstudio/img/favicon.ico" /> - -<img src="{% admin_media_prefix %}img/{{image.image}}" > +<a href="{% admin_media_prefix %}img/{{image.image}}"> +<img src="{% admin_media_prefix %}img/{{image.image|cut:'.jpg'|cut:'.png'|cut:'.JPG'|cut:'.JPEG'|cut:'.svg'|cut:'.tif'|cut:'.gif'|cut:'.ogv'}}_display_1024"></a> <br/> <form method="post" action="">{% csrf_token %} <font color = 'black'>Name : </font><font color = 'teal'>{{image.title}}</font> @@ -52,25 +58,23 @@ jQuery(document).ready(function($) { <font color = 'black'>Posted At : </font><font color = 'teal'>{{image.creation_date}}</font> <br/> -<font color = 'black'>Description:</font><font color = 'teal'> +<font color = 'black'>Description:</font> {%autoescape on%} {% with image.html_content|safe as image_content %} {{image_content}} {% endwith %} {% endautoescape%} -</font> -{% for author in image.authors.all %} - {% ifequal author.username user.username %} + +{% if user.is_authenticated %} <input type="hidden" name="imgid" value={{image.id}}> <input type="button" id="editcontent" value="Edit"/> <input type="submit" class="commentsavecontent" id="save" value="Save" style="visibility:hidden" /> <input type="hidden" name="contenttext" id="commenttext" style="visibility:hidden" /> <input type="hidden" id="editortext" style="visibility:hidden" value="{{image.content_org}}"> - {% endifequal %} -{% endfor %} +{% endif %} </form> <br/> @@ -82,6 +86,7 @@ jQuery(document).ready(function($) { <font color = 'black'>Total Number of votes is: <font color='teal'><b>{{ image.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"/> @@ -100,6 +105,7 @@ jQuery(document).ready(function($) { <input type="text" value="" name="texttags" /> <input type="submit" value="Add Tags" name="addtags" /> </form> +{% endif %} <br/> <div class="tags"> <p class="gbobject-tags span-16 last"> diff --git a/gstudio/templates/gstudio/home.html b/gstudio/templates/gstudio/home.html index 44680fd..f1e7a02 100644 --- a/gstudio/templates/gstudio/home.html +++ b/gstudio/templates/gstudio/home.html @@ -44,7 +44,7 @@ margin-left: 75%; } - .bottom h3 { + .homebottom h3 { background-color: #C4EBF4; padding: 0.5em; font-size: 1em; @@ -55,28 +55,29 @@ font-weight: normal; } - .bottom{ + .homebottom{ margin-top:9%; margin-left:11%; + height: 212px; } + .authors { - width: 20%; - position:absolute; - margin-left: 3%; - } - - .recentsnodetype{ - width:22%; - position:absolute; - margin-left:24%; + margin-left: 0; + position: absolute; + width: 300px; } - - - .comments{ - width:22%; - position:absolute; - margin-left:47%; + .recentsnodetype { + margin-left: 314px; + position: absolute; + width: 400px; } + .comments { + margin-left: 729px; + position: absolute; + width: 300px; + } + + .tags .tag_1 { font-size: 1em; color: #001e2d; } .tags .tag_2 { font-size: 1.125em; color: #00334c; } .tags .tag_3 { font-size: 2em; color: #005b89; } @@ -123,12 +124,12 @@ {% include "gstudio/_header.html" %} </div> <div class="tags" align="center" id="tag"> - <h2>{% trans "Tag Cloud" %}</h2> + <!--<h2>{% trans "Tag Cloud" %}</h2>--> {% get_tag_cloud %} </div> </center> <div id="main"> - <center><font size="23" color="#4d659e"><b>{{ site }}</b></font></center> + <center><font size="23" color="#4d659e"><b>{{ site }}</b></font><br/><span id="tagline">a project of <a href="http://lab.gnowledge.org/" target="_blank">gnowledge lab</a>, <a href="http://www.hbcse.tifr.res.in" target="_blank">Homi Bhabha Centre for Science Education</a>, <a href="http://www.tifr.res.in" target="_blank"> TIFR</a></span></center> <form action="{% url gstudio_nodetype_search %}" method="get"> <input id="searchtext" class="classtext" type="text" value="{{ pattern }}" name="pattern" onfocus="this.value=''" style="border: 5; padding: 0pt; margin: 0pt; height: 30px; width: 40%; margin-left:30%; margin-bottom:18px; margin-top:4%" /> <input class="searchbutton" type="submit" value="Search" title="Search" /> @@ -138,22 +139,43 @@ </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> - <div class="bottom"> + <div class="homebottom"> <div class="authors"> - <h3>{% trans "Recent Authors" %}</h3> - {% get_authors %} + <h3>{% trans "Recents Authors" %}</h3> + {% get_authors 12 %} </div> <div class="recentsnodetype"> <h3>{% trans "Recent Objects" %}</h3> -{% get_recent_gbobjects %} +{% get_recent_gbobjects 12%} </div> <div class="comments"> <h3>{% trans "Recent Comments" %}</h3> - {% get_recent_comments 5 %} + {% get_recent_comments 12 %} </div> </div> + <div id="footer" align="center" style="margin-top:100px"> + <p> + + a project of <a href="http://lab.gnowledge.org/" target="_blank">gnowledge lab</a>,<a href="http://www.hbcse.tifr.res.in" target="_blank">Homi Bhabha Centre for Science Education</a>, <a href="http://www.tifr.res.in" target="_blank">TIFR</a><br> + +</p> + <p> + + <a rel="license" + href="http://creativecommons.org/licenses/by-sa/3.0/" title="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative + Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png"/></a> All material is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/" title = "http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a> unless mentioned otherwise. + <br/> + Powered by <a href="http://www.djangoproject.com" title="https://www.djangoproject.com/">Django</a> + and <a href="https://gitorious.org/gnowsys-studio" title="https://gitorious.org/gnowsys-studio">Gstudio + {{ GSTUDIO_VERSION }}</a>. + </p> + <center> + <a href="http://atlas.gnowledge.org/softwares"><img src="/static/gstudio/img/community.png"></a></center> + </div> + + </body> </html> diff --git a/gstudio/templates/gstudio/image.html b/gstudio/templates/gstudio/image.html index fa6ccbd..c8ba9b2 100644 --- a/gstudio/templates/gstudio/image.html +++ b/gstudio/templates/gstudio/image.html @@ -4,17 +4,18 @@ {% load pagination_tags %} {% load adminmedia grp_tags %} {% load i18n %} + {% block title %}Images{% endblock %} {% block content %} <script src="{% admin_media_prefix %}jquery/jquery-1.6.2.min.js" type="text/javascript"></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" > $(window).load(function(){ +var isImage=false; $("#content").css({"width": "600px"});}); $(window).load(function() { $("#chart").hide();}); $(window).load(function() { - $("#graphcss").hide(); }); @@ -22,9 +23,10 @@ var i = 0; jQuery(document).ready(function($) { $("#commenteditor").click(function(){ + isImage=true; document.getElementById('gnoweditor').style.visibility="visible"; $("#gnoweditor").orgitdown(mySettings); - document.getElementById('save').style.visibility="visible"; + <!--document.getElementById('save').style.visibility="visible";--> $("#commenteditor").hide(); }); @@ -63,7 +65,7 @@ margin-left:52%; } </style> -{% if user.is_authenticated %} + {% autopaginate images 10 %} <h2 style="color: teal;">Image Library</h2> @@ -86,7 +88,7 @@ margin-left:52%; <input type="submit" value="Search"> </form> </div> - +{% if user.is_authenticated %} <div id="divpost"> <form enctype="multipart/form-data" method="post" action=""> {% csrf_token %} @@ -103,8 +105,13 @@ Description: <input type="button" id="commenteditor" value="Add Con </form> </div> +{% endif %} </div> <br> +{% if reportid %} +<h2><font color="red">this image is already uploaded on this site</font></h2> +<a href="/gstudio/resources/images/show/{{ reportid }}/"> <font size="4">to see this image click here</font></a><br/><br/><br/> +{% endif %} <div> <h4 style="color: teal;">IMAGES</h4> {% for image in images %} @@ -129,8 +136,13 @@ document.getElementById("divimage").setAttribute("id","div2"); <input type="hidden" name="fulid" value={{image.id}}> <!-- <input type="submit" value="Show" name="Show">--> - <a href="/gstudio/resources/images/show/{{image.id}}/"><font size="4"><u>Show</u></font></a> +<a href="/gstudio/resources/images/show/{{image.id}}/"> +{% for author in image.authors.all %} + <img src="{% admin_media_prefix %}img/{{image.image|cut:'.jpg'|cut:'.png'|cut:'.JPG'|cut:'.JPEG'|cut:'.svg'|cut:'.tif'|cut:'.gif'|cut:'.ogv'}}-thumbnail"> + +{% endfor %} +</a> <!-- <p> --> <!-- <img src="{% admin_media_prefix %}img/{{image.title}}" width="300" height="225" alt="{{ image.title }}" > --> @@ -206,11 +218,7 @@ document.getElementById("divimage").setAttribute("id","div2"); {% endfor %} </div> -{% else %} - -<h2 style="color: indigo;">Sorry you need to log in to see this content !</h2> - -{% endif %} + <h2> {% paginate %}</h2> diff --git a/gstudio/templates/gstudio/more.html b/gstudio/templates/gstudio/more.html index 3b4f034..1ddffb2 100644 --- a/gstudio/templates/gstudio/more.html +++ b/gstudio/templates/gstudio/more.html @@ -8,7 +8,7 @@ <style type="text/css"> #more_body{ - background: #B3B3B3; + background: white; } #header { background: none repeat scroll 0 0 #2B3959; @@ -52,155 +52,67 @@ <tbody> <tr> - <h1 class="documentFirstHeading"> - <center><span id="parent-fieldname-title" class=""><font size="23px"> - Welcome to Gnowledge Network! </font> - </span></center> - </h1><br/><br/><br/> - <h2><font size="6px">Introduction </font></h2><br/> - <ul><li>This site is based on a simple idea that we - can build collaboratively a road map of knowledge by specifying the - prerequisites of concepts, activities, experiences and statements. The resulting road map can be used as a scaffolding to describe each node network by linking the node to other nodes in terms of relations and attributes. - <br/> - </li> - <li>Look at <a href="http://atlas.gnowledge.org/Data/display/12675_depmap.svg" class="external-link">this map to get an idea of a dependency map based on prerequisites.</a></li> - <li>Look at this one to get an idea of how a node can be described as a map (Link required??). <br></li> - <li>You will agree that such maps will be very useful to teachers and - students. Over a period of time, with your collaboration, we can build a - complete roadmap of all knowledge which will help to generate a non-linear curriculum framework.</li> - <li>Read <a href="http://atlas.gnowledge.org/help">Help Document</a> to begin contributing.</li> - </ul> - <br/><br/><br/> - - <h2><font size="6px">What you can do?</font></h2><br/> - <ul><li>You can specify the prerequisites for any concept or an activity - at this site. Or view the existing prerequisites that are already - defined by the community. <br> - </li> - <li>We simply add a concept as a - node (if it does not exist already) and specify a semantic dependency - (meaning dependency) relation between one node and another.</li> - <li>Ask yourself the following set of questions:</li> - <ul><li>To understand a concept what do you expect the learner must already know?</li> - <li>To understand a concept what do you expect the learner must do?</li> - <li>To impart a skill what what other activities the learner must do?</li><li>To impart a skill what other concepts the learner must already know?</li></ul> - </ul> - <p>Answers to these questions can be specified in this community portal by establishing links between concepts and activities.</p> - <br/><br/><br/> - <h2><font size="6px">What we will get out of this?</font></h2><br/> - <ul><li>a globally useful resource for teachers and students to know the learning track (learning path) for any concept or skill. <br></li> - <li>teachers and authors of textbooks can use these maps to prepare course materials or sequence their curriculum.</li> - <li>students get to know what they need to know in order to learn something.</li><li>researchers can use the data for analyzing the properties of knowledge structures.<br></li> - <li>a network of concepts and activities that can be used, modified, published and shared by the entire community.</li><li>a visual map of knowledge and a road map for learning and teaching.</li> - <li>a knowledge base that can be used to profile different domains of knowledge.</li><li>the - resulting map will show us, as it were, the 'cities' (on which we - depend on most), 'towns' (on which we depend but not as much as the - cities), 'villages' (on which we depend least), continents (domains that - contain inter-related cities, towns and villages), etc. <br></li><li>a sequence to automatically guide learners in a machine guided online tutoring system, for example.</li> - <li>a - network analysis linking the number of nodes and links, plots, - analyses, statistics, distribution properties etc. (very soon as the - data set increases, we will publish the results on this site. You can access the data dumps (sans privacy information) very soon, so that you can analyze the data yourself.)<br></li> - <li>and we are sure it will have many other uses as well. If you foresee some please discuss with us in the list community@gnowledge.org. Or write or upload a document in the sandbox fodler (follow the link) and send us an email in the list.<br></li></ul> - <br/><br/><br/> - <h2><font size="6px">Yes! You do not have to write essays here.</font></h2><br/> - <ul><li>We can get all the above mentioned goodies without writing any - essays or do so much of research. We do not define concepts either! Just - ask yourself the questions mentioned above and provide the answer if - you have them. We simply make the dependency relations explicit for all - concepts that all of us know. Soon we will be able to do this in all - languages of the world (Our software developers are working on this.).</li></ul> - <br/><br/><br/> - <h2><font size="6px">So, how to get it going? </font></h2><br/> - <ol><li>Join as a member. Use the join link on the right corner of the site.<br></li> - <li>Use the 'Login' link if you are already a member.<br></li> - <li>Search for a concept or activity using the search form present on the right side of the header or the "<a href="http://localhost:8081/depmap/viewall?val=1">view or edit</a>" - link. (We started this site recently and data set is very small, so - don't be surprised if your favorite concepts and activities are not - found here.)<br></li> - <li>Add a non-existing node. By default it will be - taken as a concept, but if you want it to be an activity, use the check - box. If a node already exists, you will see a message: "Object already - exists". Then you can visit that node and then decide what more you can - do. <br></li> - <li>Then add appropriate dependency links. For adding - dependency link, click on the "Add" button below the relation names - "Depends on" or its inverse name "Required for".</li> - <li>If you think - that the existing relation is not accurate, you can remove the link - using the "Delete" tab. Or discuss in the mailing list on the issue and - resolve the conflict.<br></li> - <li>Remember! You cannot add a relation - unless a concept node already exists. So, if you don't find the node - you are looking for, add one and link it.<br></li> - <li>Remember, all of - us are making only one single map collaboratively. All contributions - are recorded against your login name with date and time of contribution. - <br></li> - <li>Please see below the ownership and license information to know who owns the data made by you.</li></ol> - - <br/><br/><br/> - <h2><font size="6px">Spread the word around the world! </font></h2><br/> - <ul><li>Well! The site is meant for you. We made this simplest web - application so that the whole world gets the benefit. The outcome of - this simplest exercise will be a very useful semantic dependency map for - learning and teaching any topic. The knowledge base built on this site - is available for every one. For making the maps in other languages we - have to only add translations to each node. We will soon add this - function to have the map in all languages. However, if you want to add - concepts in your own language, you can build them right away, and may - add the translation links latter when the feature is made available.<br></li></ul> - <br/><br/><br/> - <h2><font size="6px">License</font></h2><br/> - The network and the content produced is published under <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License" class="external-link">Creative Commons Attribution ShareAlike 3.0</a> - <p> </p> - <ul><li> What does this license imply?</li> - <ul><li>you have the freedom to use the maps for any purpose.</li> - <li>you can make modifications to them.<br></li><li>you - can distribute or publish or sell them provided you grant the same - freedoms to others as well, i.e., release them again under the terms of - the same license. Please write to us if you have any query on your rights to use them. - </li></ul> - </ul> - <br/><br/><br/> - <h2><font size="6px">We are slowly adding more features!</font></h2><br/> - <p>After depMap (dependency map) we will soon have other kinds of maps as follows:</p> - <ul><li>typeMap (what is a type of what, what is a sub-type of what) for taxonomy<br></li> - <li>partMap (what is a part of what, and what consists of what) for part-whole relation<br></li> - <li>reactionMap (what is a product of what, and what is a reactant of what) for how matter changes<br></li> - <li>causeMap (what is a cause of what, and what is an effect of what) for cause-effect map<br></li> - <li>testsMap (what is a preTest and what is a postTest of each node in the map) for assessment<br></li> - <li>and so on. If you have another good suggestion tell us, we will try to add that in future. So, write to us or upload your suggestion in the sandbox (you need to register to do this.).<br></li></ul> - <br/><br/><br/> - <h2><font size="6px">Tell us if you have any feedback!</font></h2><br/> - <ul><li>We will make improvements to the user interface to make the - process easy. If you have good ideas you can tell us, or if you have - skills or willing to contribute you can collaborate in building the - software of this portal as well. If you know how to help us build the site, you are welcome. Send us - a patch and if it works and gels with the rest of the site your - contribution will be in.<br></li></ul> - <blockquote> - <blockquote>join the room glab@conference.jabber.org to talk to other developers.</blockquote> - </blockquote> - <ul><li> - <div id="text-6"> - <ul><li> - join the mailing list atlas-dev@gnowledge.org at - <a href="http://gnowledge.org/cgi-bin/mailman/listinfo/atlas-dev">http://gnowledge.org/cgi-bin/mailman/listinfo/atlas-dev</a> - </li> + +<p>This site is an initiative of +the <a href="http://www.hbcse.tifr.res.in/">Homi Bhabha Centre for +Science Education, TIFR</a> , Mumbai, India for establishing +collaboration among students, teachers, researchers or anyone else +interested, to shape education and research in strikingly different +ways. Why is the platform called "metaStudio" is described in another +article. However, if you join at this portal as a registered user, it +does not imply that you endorse the idea of <a href="/groups/studio" +target="_self" title="studio based education">studio based +education.</a> Please read the <a href="/about/terms" target="_self" +title="terms">terms</a> of using the site before registration at the +site. Please do read the articles in the <a href="/about" +target="_self" title="about">About section</a> from the menu, as well. +If you have any queries, please do not hesitate to write to us. + +<h1>What facilities does this platform offer?</h1> + +<p>The site offers a few simple ways of collaboration</p> + +<ul> + +<li>a wiki: you can create wiki style pages collaboratively on topics and subjects of your choice. </li> + +<li>a loom studio: to form a thread and discuss, seek responses from members. </li> + + +<li>upload useful resources such as lessons, documents, pictures, videos, articles, software etc (You will get points for your contributions). </li> + + +<li>start collaborative research projects on any area of interest under the<a> Creative Commons license.</a></li> + +</ul> + +<h1>Our Protocol: Creative Commons using open standards</h1> + +<p>As a project inspired by <a href="http://www.gnu.org/philosophy/" target="_blank" title="free software philosophy">free software philosophy</a> , this site encourages the members to adhere to the principles that <strong>protect freedom, sharing, collaboration and socially acceptable protocols.</strong></p> + +<ul> + +<li>when you upload resources (digital documents and software) please ensure that you are uploading them under the <a href="/content/article/13" target="_self" title="creative commons">Creative Commons license or other copy left license or public domain. <br /></a></li> + +<li>ensure that the documents uploaded are encoded in <a href="http://en.wikipedia.org/wiki/Open_standard" target="_self" title="open standards">open standards (non-proprietary).</a></li> + +</ul> + +<h1>Join Us</h1> + +<p>Explore our web site and see how you can use our infrastructure to further your own research and educational activities. <a href="/register" title="Sign up!">Create your own account</a>. <a href="/contribute">Become a contributor</a> by sharing your work, message, criticism, questions, responses, tools, or anything you seem useful and interesting to the community.</p> + +<ul> + <li> - see our code at svn co <a href="https://svn.gnowledge.org/svn/repo/labcode/atlasv2/atlas">https://svn.gnowledge.org/svn/repo/labcode/atlasv2/atlas</a></li></ul> + see our code + at <a href="http://savannah.gnu.org/projects/gnowsys/">Savannah + or gitorious or + github</a></li></ul> </div> <p>The site uses <a href="http://www.gnu.org/software/gnowsys/" class="external-link">GNOWSYS (Gnowledge Networking and Organizing System)</a> - as a backend. GNOWSYS uses gnowql (gnowledge query library) as API. - Some documentation about how you can learn gnowql is available <a href="http://lab.gnowledge.org/Software/gnowsys_rc1/documentation-of-new-gnowql" class="external-link">here</a>.</p> - </li><li>Use the 'contact' link above to write to us. If you have any feature request, we will try to add the feature. </li><li><a href="http://gnowledge.org/cgi-bin/mailman/listinfo/community" class="external-link">Join the mailing list here </a> to be in touch with other contributors where you can<br></li> - <ul><li>discuss with them pertaining to the activities on this portal<br></li><li>resolve conflicts if any</li><li>schedule periodic online workshops though collaborative online conferences</li><li>share your experiences <br></li><li>and so on.</li></ul> - </ul> - This site is made and maintained by the <a href="http://trac.gnowledge.org/trac">gnowledge.org lab</a> of Homi Bhabha Centre for Science Educatioin, TIFR.<a href="http://localhost:8081/depmap/" class="external-link"><br></a> - <p> </p> - - + as a backend.</p> + </li> </tr> @@ -211,12 +123,11 @@ <p>A project of <a href="http://www.hbcse.tifr.res.in" target="_blank">Homi Bhabha Centre for Science Education</a>, <a href="http://www.tifr.res.in" target="_blank">TIFR</a><br> - <!--Plone and its visual design is Copyright 2000 - 2006 by Alexander Limi, Alan Runyan, Vidar Andersen.--> </p> <p> - All text is available under the terms of the <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License" class="external-link">Creative Commons Attribution ShareAlike 3.0</a>. + All resources are available under the terms of the <a href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License" class="external-link">Creative Commons Attribution ShareAlike 3.0</a> unless otherwise mentioned. </p> <p> diff --git a/gstudio/templates/gstudio/nodes_search.html b/gstudio/templates/gstudio/nodes_search.html index 7fbc53d..87c9e16 100644 --- a/gstudio/templates/gstudio/nodes_search.html +++ b/gstudio/templates/gstudio/nodes_search.html @@ -24,9 +24,16 @@ {% endif %} {% for object in object_list %} + {% ifequal object.title|truncatewords:"3" 'page box of ...' %} + + {% else %} + {% ifequal object.title|truncatewords:"3" 'message box of ...' %} + {% else %} {% with object.html_content|truncatewords_html:100|safe as object_content %} {% include "gstudio/_nodetype_detail.html" %} {% endwith %} +{% endifequal %} +{% endifequal %} {% empty %} <p class="notice">{% trans "Nothing found." %}</p> {% endfor %} diff --git a/gstudio/templates/gstudio/nodetype_detail.html b/gstudio/templates/gstudio/nodetype_detail.html index 73db903..d3a31e0 100644 --- a/gstudio/templates/gstudio/nodetype_detail.html +++ b/gstudio/templates/gstudio/nodetype_detail.html @@ -28,6 +28,15 @@ <link rel="alternate" type="application/rss+xml" title="{% trans "RSS Feed of trackbacks on" %} '{{ object.title }}'" href="{% url gstudio_nodetype_trackback_feed year month day object.slug %}" /> {% endwith %} +<script type="text/javascript" > +$(window).load(function() { + + $("#savenodecontent").hide(); + $("#nodedit").hide(); + +}); +</script> + {% endblock %} @@ -38,14 +47,14 @@ <a href="{{ object.get_absolute_url }}" title="{{ object.title }}" rel="bookmark"> {{ object.title }} </a> - <a href="{{ object.ref.get_edit_url }}" target="_blank" title = "edit">[edit]</a> +<!-- <a href="{{ object.ref.get_edit_url }}" target="_blank" title = "edit">[edit]</a> --> </h2> <div class="History"> <table border="1" cellspacing="0"> - + <b>Versions: </b> {% for sid in object.ref.get_ssid %} @@ -212,25 +221,39 @@ <!-- <\!-- Content -\-> --> {% if object.content %} <b> - Content:<nbsp> + Content:<nbsp></b> + <div id="nodetype"> + <form method="post" action="/gstudio/{{object.id}}/">{% csrf_token %} + <input type="hidden" id="reptext" name="replytosection" id="sectionreply" style="visibility:hidden;"/></br> + <input type="hidden" id="editval" name="edit" value="edited"/> + <input type="hidden" value="{{object.id}}" name = "iden"> + <input type="hidden" value="{{user.username}}" name ="usr"> + <input type="hidden" value="{{user.id}}" name = "idusr"> + <input type="button" id="editnodecontent" name="{{object.content_org}}" value="Edit"/> + <input type="button" id="savenodecontent" name="{{object.id}}" value="Save"/></br> + <input type="submit" id="nodedit" value="Submit"/> + </form> + </div> - <input type="button" id="editdata" value="Edit Content"/> <input type="button" id="savecontent" value="Save Content"/><ndsp><nbsp> - <input type="hidden" id="objectid" value="{{object.id}}"/> - <input type="hidden" id="title" value="{{object.title}}"/> - <input type="hidden" id="orgcontent" value="{{object.content_org}}"/> - </b> + {{object_content}}<br/> {% else %} <b> - Content:<nbsp> - <input type="button"id="editdata" value="Edit Content"/> - <input type="button" id="savecontent" value="Save Content"/><ndsp><nbsp> - <input type="hidden" id="objectid" value="{{object.id}}"/> - - <input type="hidden" id="title" value="{{object.title}}"/> - <input type="hidden" id="orgcontent" value="{{object.content_org}}"/> - </b> + Content:<nbsp> </b> + <div id="nodetype"> + <form method="post" action="/gstudio/{{object.id}}/">{% csrf_token %} + <input type="hidden" id="reptext" name="replytosection" id="sectionreply" style="visibility:hidden;"/></br> + <input type="hidden" id="editval" name="edit" value="edited"/> + <input type="hidden" value="{{object.id}}" name = "iden"> + <input type="hidden" value="{{user.username}}" name ="usr"> + <input type="hidden" value="{{user.id}}" name = "idusr"> + <input type="button" id="editnodecontent" name="{{object.content_org}}" value="Edit"/> + <input type="button" id="savenodecontent" name="{{object.id}}" value="Save"/></br> + <input type="submit" id="nodedit" value="Submit"/> + </form> + </div> + {{object_content}}<br/> {% endif %} diff --git a/gstudio/templates/gstudio/nodetype_search.html b/gstudio/templates/gstudio/nodetype_search.html index 7fbc53d..08d2d4b 100644 --- a/gstudio/templates/gstudio/nodetype_search.html +++ b/gstudio/templates/gstudio/nodetype_search.html @@ -24,9 +24,18 @@ {% endif %} {% for object in object_list %} + {% ifequal object.title|truncatewords:"3" 'page box of ...' %} + + {% else %} + {% ifequal object.title|truncatewords:"3" 'message box of ...' %} + {% else %} + {% with object.html_content|truncatewords_html:100|safe as object_content %} {% include "gstudio/_nodetype_detail.html" %} {% endwith %} +{% endifequal %} +{% endifequal %} + {% empty %} <p class="notice">{% trans "Nothing found." %}</p> {% endfor %} diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html index cddc112..60bb4a1 100644 --- a/gstudio/templates/gstudio/skeleton.html +++ b/gstudio/templates/gstudio/skeleton.html @@ -51,9 +51,12 @@ display: block; position: absolute; } -<!-- .orgitdown .orgitdownButton1 a { --> -<!-- background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/org/images/save.jpeg); --> -<!-- } --> +.orgitdown .orgitdownButton1 a { + background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/org/images/save.jpeg); + margin-left:10px; + margin-top:1px; +} + .orgitdown .orgitdownButton2 a { background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/bold.png); } @@ -79,11 +82,12 @@ } .orgitdown .orgitdownButton9 a { - background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/clean.png); + background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/org/images/close.jpeg); } -.orgitdown .preview a { + +<!--.orgitdown .preview a { background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/preview.png); -} +}--> .orgitdown * { margin:0px; padding:0px; @@ -108,6 +112,11 @@ width:450px; margin-top:30px; } + +<!-- #content img { --> +<!-- max-width:600px; --> +<!-- } --> + .orgitdownEditor { font:12px 'Courier New', Courier, monospace; padding:5px 5px 5px 35px; @@ -240,7 +249,7 @@ {% block stylesheets %} <link href="{% admin_media_prefix %}css/base.css" rel="stylesheet" type="text/css" /> {% if LANGUAGE_BIDI %} - <link href="{% block stylesheet_rtl %}{% admin_media_prefix %}css/rtl.css{% endblock %}" rel="stylesheet" type="text/css" /> + <link href="{% block stylesheet_rtl %}{% admin_media_prefix %}css/rtl.css{% endblock %}" rel="stylesheet" type="text/css" /> {% endif %} <link href="{% admin_media_prefix %}jquery/ui/css/custom-theme/jquery-ui-1.8.custom.css" rel="stylesheet" type="text/css" media="screen" title="no title" charset="utf-8" /> <link href="{% admin_media_prefix %}css/jquery-ui-grappelli-extensions.css" rel="stylesheet" type="text/css" /> @@ -249,7 +258,12 @@ {% block javascripts %} <script type="text/javascript"> // GLOBALS + var isImage=false; + var editImage=false; + var objid; var grappelli = {}, + + // TODO: klemens: drop ADMIN_URL ADMIN_URL = "{% url admin:index %}", MODEL_URL_ARRAY = {% get_content_types %}, DATE_FORMAT = "{% get_date_format %}", TIME_FORMAT = "{% get_time_format %}", DATETIME_FORMAT = "{% get_datetime_format %}"; @@ -283,20 +297,13 @@ <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/replytotopic.js"></script> - <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/replycomment.js"></script> + <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/loomscripts.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="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/orgitdown/orgitdown/sets/savedata.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> @@ -305,6 +312,7 @@ <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/jquery.orgitdown.js"></script> <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/addcontent.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> --> <!-- <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/sets/org/set.js"></script> --> @@ -377,8 +385,7 @@ {% endblock %} </div> - <textarea id="gnoweditor" style="visibility:hidden;"> - </textarea> + <textarea id="gnoweditor" style="visibility:hidden;"></textarea> {% block graph %} <div id="graphcss"> @@ -816,7 +823,12 @@ return relations; </div> - <div id="footer"> + <div id="footer" align="center"> + <p> + + A project of <a href="http://lab.gnowledge.org/" target="_blank">gnowledge lab</a>,<a href="http://www.hbcse.tifr.res.in" target="_blank">Homi Bhabha Centre for Science Education</a>, <a href="http://www.tifr.res.in" target="_blank">TIFR</a><br> + +</p> <p> <a rel="license" @@ -824,12 +836,13 @@ return relations; Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png"/></a> All material is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/" title = "http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a> unless mentioned otherwise. <br/> Powered by <a href="http://www.djangoproject.com" title="https://www.djangoproject.com/">Django</a> - and <a href="https://github.com/gnowgi/gnowsys-studio" title="https://github.com/gnowgi/gnowsys-studio">Gstudio + and <a href="https://gitorious.org/gnowsys-studio" title="https://gitorious.org/gnowsys-studio">Gstudio {{ GSTUDIO_VERSION }}</a>. </p> + <center> + <a href="http://atlas.gnowledge.org/softwares"><img src="/static/gstudio/img/community.png"></a></center> </div> </body> </html> - diff --git a/gstudio/templates/gstudio/tags/comment.html b/gstudio/templates/gstudio/tags/comment.html index 8e1d480..efb462f 100644 --- a/gstudio/templates/gstudio/tags/comment.html +++ b/gstudio/templates/gstudio/tags/comment.html @@ -1,13 +1,12 @@ - - - - - {% load gstudio_tags %} {% load i18n %} - - +<script type="text/javascript"> +$(window).load(function() { +$(".commentsavecontent").hide(); +$(".postreply").hide(); +}); +</script> {% if comment.posterior_nodes.count %} <!--<ul style="display: none;">--> <ul> @@ -27,32 +26,31 @@ else { document.getElementById("divchange").setAttribute("id","div2"); } + </script> - <li>{{each}}'s fabric + <li>{{each}}'s Response {% if child.rating.get_rating %} -Current rating is {{ child.rating.get_rating }}<br/> +<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 %} - <input type="text" class="commentreptext"id="{{child.id}}" name = "reply" style="visibility:hidden"> - <input type="hidden" value={{child.id}} name = "parentid"> + <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"> - <!-- <input type="hidden" value="{{child.id}}" name = "iden"> --> - <!-- <input type="text" id="commentreptext" name = "reply" style="visibility:hidden"> --> - - <br/><br/><br/><br/> - - <input type="button" class="commenteditor" id="{{ child.id }}" value="Reply"> - <input type="button" class="commentsavecontent" id="{{child.id}}" value="Save"> - <input type="submit" id="postreply" value="Post a Reply"> - <input type="checkbox" id="chk" name="del_comment" value="delete_comment"> - <input type="submit" value="delete" onclick="setcheck()"> + + <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)"> <br/> - Do you wanna rate it ? </br> - <input name="star1" type="radio" value=1 class="star"/> +<div class="rating"> + Rate the response </br> + <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"/> @@ -60,7 +58,7 @@ Current rating is {{ child.rating.get_rating }}<br/> <!--topic id and user id hidden fields--> </br> <input type="submit" value="Rate Response"> - +</div> </form> </div> @@ -87,28 +85,24 @@ document.getElementById("divchange").setAttribute("id","div2"); {% if child.rating.get_rating %} Current rating is {{ child.rating.get_rating }}<br/> {% endif %} - <font style = "color:red;" size ="3"></font>{{child.content}} + <font style = "color:red;" size ="3">{{child.content}}</font> <form method="post" action="">{% csrf_token %} - <input type="text" class="commentreptext" id="{{child.id}}" name="reply" style="visibility:hidden"> - <input type="hidden" class="parent" value="{{child.id}}" name="parentid"> - <input type="hidden" value="{{idusr}}" name="idusr"> -<!-- <input type="hidden" value="{{child.id}}" name="iden"> --> - <!-- <input type="text" id="commentreptext" name = "reply" style="visibility:hidden"> --> - - - <br/><br/><br/><br/> - - <input type="button" class="commenteditor" id="{{ child.id }}" value="Reply"> - <input type="button" class="commentsavecontent" id="{{child.id}}" value="Save"> - <input type="submit" class="postreply" value="Post a Reply"> - <input type="checkbox" class="chk" name="del_comment" value="delete_comment"> - <input type="button" class="deleteresponse" value="delete" style="display:none"> - <input type="submit" class="deleteresp" value="delete"> + <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"> + <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)"> <br/> - Do you wanna rate it ? </br> +<div class="rating"> + Rate the response </br> <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"/> @@ -117,7 +111,7 @@ Current rating is {{ child.rating.get_rating }}<br/> <!--topic id and user id hidden fields--> </br> <input type="submit" value="Rate Response"> - +</div> </form> </div> {% show_comment child idusr flag admin_id attribute%} @@ -138,25 +132,25 @@ else document.getElementById("divchange").setAttribute("id","div2"); } </script> - {{each}}'s Response <br/> +{{each}}'s Response <br/> {% if child.rating.get_rating %} Current rating is {{ child.rating.get_rating }}<br/> {% endif %} - <font style = "color:red;" size = 3></font>{{child.content}} + <font style = "color:red;" size = 3>{{child.content}}</font> <form method="post" action=".">{% csrf_token %} - <input type="text" class="commentreptext"id="{{child.id}}" name = "reply" style="visibility:hidden"> - <input type="hidden" value="{{child.id}}" name = "parentid"> - <input type="hidden" value="{{idusr}}" name="idusr"> - <input type="hidden" value="{{child.id}}" name = "iden"> - <!-- <input type="text" id="commentreptext" name = "reply" style="visibility:hidden"> --> -<br/><br/><br/><br/> - - <input type="button" class="commenteditor" id="{{ child.id }}" value="Reply"> - <input type="button" class="commentsavecontent" id="{{child.id}}" value="Save"> - <input type="submit" id="postreply" value="Post a Reply" style="display:none"> - <input type="checkbox" id="chk" name="del_comment" value="delete_comment"> - <input type="submit" value="delete this comment""> <br/> + <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"> + + <br/> + {% if idusr %} + <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 this response </br> <input name="star1" type="radio" value=1 class="star"/> <input name="star1" type="radio" value=2 class="star"/> @@ -166,12 +160,13 @@ Current rating is {{ child.rating.get_rating }}<br/> <!--topic id and user id hidden fields--> </br> <input type="submit" value="Rate Response"> - +</div> + {% endif %} </form> - + </div> - {% show_comment child idusr flag admin_id attribute%} {% endifequal %} + {% show_comment child idusr flag admin_id attribute%} {% endifequal %} {% endifequal %} {% endifequal %} {% endfor %} diff --git a/gstudio/templates/gstudio/tags/commentpage.html b/gstudio/templates/gstudio/tags/commentpage.html index a55f4ed..c5bb1f1 100644 --- a/gstudio/templates/gstudio/tags/commentpage.html +++ b/gstudio/templates/gstudio/tags/commentpage.html @@ -8,38 +8,34 @@ - {% if comment.posterior_nodes.count %} <!--<ul style="display: none;">--> <ul> {% for child in comment.posterior_nodes.all %} <!-- Flag1 outside {{flag}}--> {% for each in child.authors.all %} - {% ifequal idusr admin_id %} - <font style = "color:red;" size = 3><li>{{child.title}}</font></br> {{child.content}} + + </br><h3><font size="5"><li>{{child.title}}</font></h3></br> + <font size="3"> {{child.content}}</font> + {% if idusr %} <form method="post" action=".">{% csrf_token %} - <!-- <textarea name = "replytosection" id="replytosection" rows="10" cols="50"></textarea> --> - <!-- <p>org --> - <!-- <textarea name = "orgreply" id="orgreplysection" rows="10" cols="50"></textarea> --> - <!-- </p> --> - <!-- <input type="hidden" value="{{child.id}}" name ="parentid"> --> - <input type="hidden" value="{{idusr}}" name="idusr"> - <input type="hidden" value="{{child.id}}" name="parentid"> - <!-- <input type="button" id="createsubsection" value="Create Sub"> --> - <!-- <input type="submit" value="Create Subsection"> --> - <!-- <input type="button" value="Reply" id="reply"></br> --> - <!-- <input type="button" name="savereply" id="savereply" value="Save Reply"></p></br> --> - <input type="button" id="editsubsec" value="Edit"/> - <input type="button" id="savesubsec1" value="Save"/> - <input type="button" id="subsecorg" value="{{child.content_org}}" style="visibility:hidden;"/> + <input type="hidden" class="reptext" name = "replytosection" id="sectionreply{{child.id}}" style="visibility:hidden;"/></br> + <input type="hidden" value="{{idusr}}" name="idusr"> + <input type="hidden" value="{{child.id}}" id="hidden{{child.id}}" name="parentid"> + <input type="button" class="editsubsec" name="{{child.content_org}}" id="{{child.id}}" value="Edit"/> + <input type="button" class="savesubsec1" name="{{each.id}}" id="save{{child.id}}" value="Save" onclick="subsecsave(document.getElementById('hidden{{child.id}}').value)"/> + <input type="button" id="subsec{{child.id}}" value="{{child.content_org}}" style="visibility:hidden;"/> <input type="button" id="subsecid" value="{{child.id}}" style="visibility:hidden;"/> - <input type="checkbox" name="del_comment" value="delete_comment"> - <input type="submit" value="Delete this Subsection"></br> + <input type="hidden" class="editval" id="edit{{child.id}}" name="edit" value="empty"/> + <!-- <input type="checkbox" name="del_comment" value="delete_comment"> --> + <!--<input type="submit" value="Delete this Subsection">--> + <input type="submit" class="submitsubsec1" id="subsecsubmit{{child.id}}" value="Submit"> <form method="post" action="">{% csrf_token %} <input type="hidden" name="docid" value={{child.id}}> - <input type="text" value="" name="texttags" /> - <input type="submit" value="Add Tags" name="addtags" /> + <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"> @@ -57,36 +53,7 @@ </form> {% show_commentpage child idusr flag admin_id attribute%} </li> - {% else %} - {% ifequal idusr each.id %} - <li>{{each}} says <font style = "color:red;" size = 3>{{child.title}}</font> - <form method="post" action=".">{% csrf_token %} - <input type="text" name = "replytosection"> - <input type="hidden" value={{child.id}} name = "parentid"> - <input type="hidden" value={{idusr}} name="idusr"> - <input type="submit" value="Reply to section"> - <input type="checkbox" name="del_comment" value="delete_comment"> - <input type="submit" value="delete this comment"> - </form> - {% show_commentpage child idusr flag admin_id attribute%} - </li> - {% else %} - {% ifequal attribute "true" %} - - <li>{{each}} says <font style = "color:red;" size = 3>{{child.title}}</font> - <form method="post" action=".">{% csrf_token %} - <input type="text" name = "replytosection"> - <input type="hidden" value={{child.id}} name = "parentid"> - <input type="hidden" value={{idusr}} name="idusr"> - <input type="submit" value="Reply to section"> - <input type="checkbox" name="del_comment" value="delete_comment"> - <input type="submit" value="delete this comment"> - </form> - {% show_commentpage child idusr flag admin_id attribute%} - </li> - {% endifequal %} - {% endifequal %} - {% endifequal %} + {% endfor %} diff --git a/gstudio/templates/gstudio/transcript.html b/gstudio/templates/gstudio/transcript.html index d86810e..d13074f 100644 --- a/gstudio/templates/gstudio/transcript.html +++ b/gstudio/templates/gstudio/transcript.html @@ -11,6 +11,7 @@ <script type="text/javascript"> // GLOBALS var grappelli = {}, + // TODO: klemens: drop ADMIN_URL ADMIN_URL = "{% url admin:index %}", MODEL_URL_ARRAY = {% get_content_types %}, DATE_FORMAT = "{% get_date_format %}", TIME_FORMAT = "{% get_time_format %}", DATETIME_FORMAT = "{% get_datetime_format %}"; @@ -31,6 +32,22 @@ <script type="text/javascript" > + var isWikipage=false; + var isSection=false; + var isSubsection=false; + var editSubsection=false; + var editSection=false; + var editWikipage=false; + var isTwist=false; + var isThread=false; + var isResponse=false; + var editTwist=false; + var editThread=false; + var editResponse=false; + var editImage=false; + var isImage=false; + var isVideotitle=false; + var isNode=false; $(window).load(function() { $("#content").css({ "width": "600px"});}); @@ -44,19 +61,40 @@ $(window).load(function() { var i = 0; jQuery(document).ready(function($) { $("#editcontent").click(function(){ + isImage=true; document.getElementById('gnoweditor').style.visibility="visible"; $("#gnoweditor").val($("#editortext").val()); $("#gnoweditor").orgitdown(mySettings); - document.getElementById('save').style.visibility="visible"; + $("#content img").css({"max-width":"600px",}) + + + <!--document.getElementById('save').style.visibility="visible";--> $("#editcontent").hide(); + }); + $("#save").click(function(){ var org_data = $("#gnoweditor").val(); var encode_data = encodeURIComponent(org_data); var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); $("#commenttext").val(decode_data); }); + $("#titleeditcontent").click(function(){ + isVideotitle=true; + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").val($("#titleeditortext").val()); + $("#gnoweditor").orgitdown(mySettings); + <!--document.getElementById('titlesave').style.visibility="visible";--> + $("#titleeditcontent").hide(); + + }); + $("#titlesave").click(function(){ + var org_data = $("#gnoweditor").val(); + var encode_data = encodeURIComponent(org_data); + var decode_data = decodeURIComponent(encode_data.replace(/\+/g, " ")); + $("#titlecommenttext").val(decode_data); + }) }); </script> <script type="text/javascript"> @@ -78,7 +116,15 @@ $('#pandoravideo').pandoravideo(); <b>Download:</b> <a href={{video.rurl}} target="_blank">Right click to download</a><br/> <form method="post" action="">{% csrf_token %} <font color='black'>Name:</font> -<font color='teal'>{{ video.title }}</font><br/> +<font color='teal'>{% if video.title %}{{video.title}}{% else %}{{video.altnames}}{% endif %}</font> +{% if user.is_authenticated %} +<input type="hidden" name="vidid" value={{video.id}}> +<input type="button" id="titleeditcontent" name="{% if video.title %}{{video.title}}{% else %}{{video.altnames}}{% endif %}" value="Edit a title"/> +<input type="submit" 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="{% if video.title %}{{video.title}}{% else %}{{video.altnames}}{% endif %}"> +{% endif %} +<br/> <font color = 'black'>Posted By : </font> {% for author in video.get_nbh.posted_by %} <font color = 'teal'>{{ author }}</font> @@ -106,22 +152,20 @@ $('#pandoravideo').pandoravideo(); <br> <input type="hidden" name="contentname" value="{{ video.content }}" /> <input type="hidden" name="ratename" value="{{ video.rating.get_rating }}" /> -<font color = 'black'>Description:</font><font color = 'teal'> +<font color = 'black'>Description:</font> {%autoescape on%} {% with video.html_content|safe as video_content %} {{video_content}} {% endwith %} -{% endautoescape%}</font> +{% endautoescape%} -{% for author in video.get_nbh.posted_by %} - {% ifequal author user.username %} +{% if user.is_authenticated %} <input type="hidden" name="vidid" value={{video.id}}> <input type="button" id="editcontent" name="{{video.content}}" value="Edit"/> <input type="submit" class="commentsavecontent" id="save" value="Save" style="visibility:hidden" /> <input type="hidden" name="contenttext" id="commenttext" style="visibility:hidden" /> <input type="hidden" id="editortext" style="visibility:hidden" value="{{video.content_org}}"> - {% endifequal %} -{% endfor %} +{% endif %} </form> <br/> @@ -133,6 +177,7 @@ $('#pandoravideo').pandoravideo(); <font color = 'black'>Total Number of votes is: <font color='teal'><b>{{ video.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"/> @@ -156,6 +201,7 @@ $('#pandoravideo').pandoravideo(); <input type="text" value="" name="texttags" /> <input type="submit" value="Add Tags" name="addtags" /> </form> +{% endif %} <br/> <br/> <div class="tags"> diff --git a/gstudio/templates/gstudio/version_diff.html b/gstudio/templates/gstudio/version_diff.html index 843c3ad..82086e8 100644 --- a/gstudio/templates/gstudio/version_diff.html +++ b/gstudio/templates/gstudio/version_diff.html @@ -378,8 +378,8 @@ </tr> <tr><td> <form method="get" action="/nodetypes/display/revert" > -<input type="submit" value="Revert" name="{{ ssid1 }}"></input></td> -<td><input type="submit" value="Revert" name="{{ ssid2 }}"></input></td> +<input type="submit" value="Revert to {{ nt.id }}.{{ version_no1 }}" name="{{ ssid1 }}"></input></td> +<td><input type="submit" value="Revert to {{ nt.id }}.{{ version_no2 }}" name="{{ ssid2 }}"></input></td> </form></tr> </table> </body> diff --git a/gstudio/templates/gstudio/video.html b/gstudio/templates/gstudio/video.html index f88572b..c50b6df 100644 --- a/gstudio/templates/gstudio/video.html +++ b/gstudio/templates/gstudio/video.html @@ -3,7 +3,7 @@ {% load i18n %} {% load adminmedia grp_tags %} {% load i18n comments gstudio_tags %} - + {% block title %}Videos{% endblock %} {% block content %} <script src="{% admin_media_prefix %}jquery/jquery-1.6.2.min.js" type="text/javascript"></script> <script type="text/javascript" src="{{STATIC_URL}}gstudio/js/orgitdown/orgitdown/sets/org/set.js"></script> @@ -21,9 +21,10 @@ $(window).load(function() { var i = 0; jQuery(document).ready(function($) { $("#commenteditor").click(function(){ + isImage=true; document.getElementById('gnoweditor').style.visibility="visible"; $("#gnoweditor").orgitdown(mySettings); - document.getElementById('save').style.visibility="visible"; + <!--document.getElementById('save').style.visibility="visible";--> $("#commenteditor").hide(); }); @@ -74,7 +75,7 @@ background: green; } </style> -{% if user.is_authenticated %} + {% autopaginate vids 10 %} @@ -99,16 +100,22 @@ background: green; <input type="submit" name="spe" value="Search by User"> </form> <br> +{% if user.is_authenticated %} <form method="post" action="/gstudio/resources/videos/"> {% csrf_token %} <input type="hidden" name="user" value={{user.username}}> <input type="submit" name="fav" value="View Favourites"> </form> +{% endif %} </div> + +{% if user.is_authenticated %} <div id="divpost"> <form enctype="multipart/form-data" method="post" action=""> {% csrf_token %} -<p><h4 style="color: black;">Submit Videos:</h4>Video: <input type="file" name="clip" multiple="multiple" /></p><br/> +<p><h4 style="color: black;">Submit Videos:</h4> +Title: <input type="text" name="title1"><br/><br/> +Video: <input type="file" name="clip" multiple="multiple" /></p><br/> Description: <input type="button" id="commenteditor" value="Add Content" > <input type="button" class="commentsavecontent" id="save" value="Save" style="visibility:hidden" /> <input type=text name="contenttext" id="commenttext" style="visibility:hidden" /> @@ -144,19 +151,27 @@ document.getElementById('headvideo').style.visibility="visible"; </script> </form> </div> +{% endif %} </div> + <br/> <br/> <br/> <br/> <br/> <br/> +{% if reportid %} +<h2><font color="red">this image is already uploaded on this site</font></h2> +<a href="/gstudio/resources/images/show/{{ reportid }}/"> <font size="4">to see this image click here</font></a><br/><br/><br/> +{% endif %} <h2 id="headvideo" style="visibility:hidden;">Processing And Uploading Video</h2> <div id="showingprocess" style="visibility:hidden;"> <div id="inner"> </div> </div> + + {% if fav %} <h2 style="color: teal;">Favourite Videos</h2><br/> {% else %} @@ -180,7 +195,7 @@ document.getElementById("divvideo").setAttribute("id","div2"); } </script> -<font size="4">{{video.title}}</font> +<font size="4">{% if video.title %}{{video.title}}{% else %}{{video.altnames}}{% endif %}</font> <form enctype="multipart/form-data" method="post" action="" target="_blank"> {% csrf_token %} <input type="hidden" name = "full" value ={{video.slug}}> @@ -243,11 +258,7 @@ document.getElementById("divvideo").setAttribute("id","div2"); </div> <br> -{% else %} - -<h2 style="color: indigo;">Sorry you need to log in to see this content !</h2> - -{% endif %} + <h2> {% paginate %}</h2> diff --git a/gstudio/templates/metadashboard/grpdashboard.html b/gstudio/templates/metadashboard/grpdashboard.html index f6cb6c0..6ad36ac 100644 --- a/gstudio/templates/metadashboard/grpdashboard.html +++ b/gstudio/templates/metadashboard/grpdashboard.html @@ -1,18 +1,24 @@ {% extends "gstudio/base.html" %} {% load gstudio_tags %} -{% load i18n %} -{% block content %} +{% load pagination_tags %} +{% load adminmedia grp_tags %} +{% load i18n comments gstudio_tags %} +{% load tagging_tags comments i18n %} +{% block content %} <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript" > $(window).load(function() { $("#content").css({ - "width": "1000px",});}); + "width": "620px",});}); $(window).load(function() { $("#chart").hide();}); $(window).load(function() { - $("#graphcss").hide(); + $("#graphcss").hide(); +$(".savecontent").hide(); +$(".submitresponse").hide(); +$("#editthreadsave").hide(); }); var i=0; </script> @@ -27,40 +33,83 @@ var i=0; } </style> -{% if user.is_authenticated %} + <!-- <input type="button" value="Home" onClick="location.href=parseURL('/gstudio/user/{{user.username}}');"> <h>Hello Welcome to the {{ meet_ob.title }}</h></br> --> - <h3> {{admin_m.username}}'s initial twist to the thread</h3> + <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> - {%if flag %} - <div id="Release"> + +<h2>{{meet_ob.title}}</h2> +{% 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 %} +<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"> +<input type="button" id="threadorg" value={{meet_ob.title}} style="visibility:hidden;" name="edittitle"> +<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> +</form> + + +{% if flag %} +{% check_release meet_ob as release %} +{% if not release %} + <div id="Release"> <form method="post" action=".">{% csrf_token %} - <input type="submit" value="Release Replies"> + <input type="submit" value="Release responses"> <input type="hidden" value="hits" name = "release"> </form> </div> +{% else %} <div> <form method="post" action=".">{% csrf_token %} - <input type="submit" value="Block Replies"> + <input type="submit" value="Block responses"> <input type="hidden" value="hits" name = "block"> </form> </div> {% endif %} </br> +{% 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> + <br/> <form method="post" action=".">{% csrf_token %} <!-- <input type="hidden" value="{{meet_ob.id}}" name = "meetid">--> - <input type="button" value="Add your twist" onClick="location.href=parseURL('topicadd1/{{meet_ob.id}}');"> + <input type="button" id="twistaddbtn" value="Add your twist" onClick="location.href=parseURL('topicadd1/{{meet_ob.id}}');"> </form> -<!-- direct link to identica +{% endif %} +<!-- direct link to identica <a href="http://www.addtoany.com/add_to/identi_ca?linkurl=ur url&linkname={{post}} via" ><img src="http://www.tildehash.com/identishare/share.png" ></img></a> - +--> <!-- Twitter syndicating button <a href="https://twitter.com/share" class="twitter-share-button" data-url="https://127.0.0.1:8000/chat/" data-via="{{user.title}}" data-lang="en" data-text="{{post}}" data-related="anywhereTheJavascriptAPI" data-count="none">Tweet</a> - +--> <!-- Diaspora syndicating button <script type="text/javascript" src="https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael-min.js"></script> <input id="diasporacontent" value="{{post}}" type="hidden" name="diaspora"></input> @@ -70,7 +119,7 @@ var i=0; --> </br> {% autoescape off %} {% for each in topic %} - <h4><font size="5" color="red">{{each.title}}</font></h4> + <h4><font size="5" >{{each.title}}</font></h4> Posted on : {{each.creation_date}} by : {% for author in each.authors.all %} @@ -79,22 +128,38 @@ var i=0; <!-- Current rating is <h5>{{ each.rating.get_rating }}</h5> --> {%autoescape on%} {% with each.html_content|safe as each_content %} - <font color="green"> {{each_content}} </font> + <font size ="3" > {{each_content}} </font> {% endwith %} {% endautoescape%} + <div> <form method="post" action=".">{% csrf_token %} - <input type="text" class="reptext" name = "reply" style="display:none"> + <input type="hidden" class="reptext" id="topictext{{ each.id }}" name = "reply" style="display:none"> + <input type="hidden" id="hidden{{ each.id }}" value="{{ each.id }}" name ="hiddenid"> + <input type="hidden" id="commentdata{{each.id}}" value="{{each.content_org}}"> + <input type="hidden" value={{user.username}} name = "usr"> <input type="hidden" value="{{each.id}}" name = "iden"> <input type="hidden" value="{{user.id}}" name = "idusr"> -<br/><br/><br/> - <input type="button" class="editor" id="{{each.id}}" value="Add a Fiber"> - <input type="button" class="savecontent" id="{{each.id}}" value="Save"> - - <input type="submit" value="Submit"></br> - <input name="del_topic" type="checkbox" value="delete_topic"/> - <input type="submit" value="Delete the twist"></br> +<br/> {% if user.is_authenticated %} + <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 %} + <input class="topicchk" id="chk{{ each.id }}" name="del_topic" type="checkbox" value="delete_topic"/> + <input type="submit" class="topicdelete" id="delete{{ each.id }}" value="Delete the twist"></br> + {% else %} + {% for author in each.authors.all %} + {% ifequal user.id author.id %} + <input class="topicchk" id="chk{{ each.id }}" name="del_topic" type="checkbox" value="delete_topic"/> + <input type="submit" class="topicdelete" id="delete{{ each.id }}" value="Delete the twist"></br> + {% endifequal %} + {% endfor %} + {% endifequal %} + <!-- Rate this ? </br> <input name="star1" type="radio" value=1 class="star"/> <input name="star1" type="radio" value=2 class="star"/> @@ -104,9 +169,32 @@ var i=0; <!--topic id and user id hidden fields </br> <input type="submit" value="Rate it!!!"> --> - </form> + </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 %} + <br/> <p> - Fibers : + Responses : <!-- <div id="main"> <div id="sidetree"> <div class="treeheader"> </div> @@ -118,8 +206,6 @@ var i=0; The discussion freezes at {{endtime}} {% endautoescape %} -{% else %} - <h1> <p style = "color :red;">OOPS!!! Login Please!</p></h1> -{% endif %} + {% endblock %} diff --git a/gstudio/templates/metadashboard/pgedashboard.html b/gstudio/templates/metadashboard/pgedashboard.html index f06063a..1e48755 100644 --- a/gstudio/templates/metadashboard/pgedashboard.html +++ b/gstudio/templates/metadashboard/pgedashboard.html @@ -16,7 +16,7 @@ <script type="text/javascript" > $(window).load(function() { $("#content").css({ - "width": "500px",});}); + "width": "1000px",});}); $(window).load(function() { $("#chart").hide();}); $(window).load(function() { @@ -25,16 +25,22 @@ $(window).load(function() { }); $(window).load(function() { - $("#savepagecontent").hide(); + $(".savepagecontent").hide(); $("#saveseccontent").hide(); $("#savesubsec").hide(); $("#savesubsec1").hide(); - + $(".submitresponse").hide(); + $(".saveseccontent").hide(); + $(".savesubsec").hide(); + $(".submitsubsec").hide(); + $(".pagedit").hide() +$(".savesubsec1").hide(); + $(".submitsubsec1").hide(); }); </script> -{% if user.is_authenticated %} + {% autopaginate section 1 %} <!-- <input type="button" value="Home" onClick="location.href=parseURL('/gstudio/user/wikipage/{{user.username}}');"> --> <h1>{{ page_ob.title }}</h1> @@ -44,41 +50,51 @@ $(window).load(function() { {% endfor %}</br></br> {% with page_ob.html_content|safe as page_ob_content %} - - {{page_ob_content}} + <font size="3"> + {{page_ob_content}}</font> {% endwith %} - - <input type="button" id="editpagecontent" value="Edit"/> - <input type="button" id="savepagecontent" value="Save"/></br> + {% if user.is_authenticated %} + <form method="post" action="">{% csrf_token %} + <input type="hidden" class="reptext" name="replytosection" id="sectionreply" style="visibility:hidden;"/></br> + <input type="hidden" class="editval" name="edit" value="empty"/> + <input type="hidden" value="{{page_ob.id}}" name = "iden"> + <input type="hidden" value="{{user.username}}" name ="usr"> + <input type="hidden" value="{{user.id}}" name = "idusr"> + <input type="button" class="editpagecontent" name="{{page_ob.content_org}}" value="Edit"/> + <input type="button" class="savepagecontent" name="{{page_ob.id}}" value="Save"/></br> + <input type="submit" class="pagedit" value="Submit"/> + </form> + <form method="post" action="">{% csrf_token %} - <input type="hidden" name="docid" value={{page_ob.id}}> - <input type="text" value="" name="texttags" /> - <input type="submit" value="Add Tags" name="addtags" /> + <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 %}" + <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> + {% empty %} + <span>{% trans "No tags" %}</span> + {% endfor %} + </p> </div> - <input type="button" id="pageid" value="{{page_ob.id}}" style="visibility:hidden;"/> - <input type="button" id="pageorg" value="{{page_ob.content_org}}" style="visibility:hidden;"/> + </br> + {% 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="hidden" id="pageid1" value="{{page_ob.id}}"/> </form> - + {% endif %} </br> {% autoescape off %} {% for each in section %} - <h4><font size="5" color="red">{{each.title}}</h4></font> + <h4><font size="6">{{each.title}}</h4></font> Posted on : {{each.creation_date}} by {% for author in each.authors.all %} {{author}} @@ -90,16 +106,27 @@ $(window).load(function() { {% endifequal %} {%autoescape on%} {% with each.html_content|safe as each_content %} - {{each_content}} + <font size="3"> + {{each_content}}</font> {% endwith %} {% endautoescape%} - <input type="button" id="editseccontent" value="Edit"/> - <input type="button" id="saveseccontent" value="Save"/> + {% if user.is_authenticated %} + <form method="post" action="">{% csrf_token %} + <input type="hidden" class="reptext" name = "replytosection" id="sectionreply" 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="hidden" class="editval" name="edit" value="empty"/> + <input type="button" class="editseccontent" name="{{each.content_org}}" value="Edit"/> + <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" value="" name="texttags" /> - <input type="submit" value="Add Tags" name="addtags" /> + <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"> @@ -113,20 +140,22 @@ $(window).load(function() { {% endfor %} </p> </div> - - <input type="button" id="sectionorg" value="{{each.content_org}}" style="visibility:hidden;"/> - <input type="button" id="sectionid" value="{{each.id}}" style="visibility:hidden;"/> + {% if user.is_authenticated %} <form method="post" action=".">{% csrf_token %}<br/> Create Subsection: - <input type="text" name = "replytosection" id="sectionreply" style="visibility:hidden;"/></br> + <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" id="createsubsection"> - <input type="button" value="save" id="savesubsec"> - <input type="submit" id="submitsubsec" value="submit" style="visibility:hidden;"></br> + <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}}"> + <input type="submit" class="submitsubsec" value="Submit" ></br> - </br></br><input name="del_section" type="checkbox" value="delete_section"/> - <input type="submit" value="Delete the section"></br> + </br></br><input name="del_section" class="chkbox" type="checkbox" value="delete_section"/> + <input type="submit" class="deletesec" value="Delete the section"></br> + <div id="rating"> Do you wanna rate it ? </br> <input name="star1" type="radio" value=1 class="star"/> <input name="star1" type="radio" value=2 class="star"/> @@ -134,9 +163,12 @@ $(window).load(function() { <input name="star1" type="radio" value=4 class="star"/> <input name="star1" type="radio" value=5 class="star"/> <!--topic id and user id hidden fields--> - </br> + <input type="submit" value="Rate it!!!"> + </div> </form> + {% endif %} + </br> <p> Subsections : <!-- <div id="main"> --> @@ -149,9 +181,6 @@ $(window).load(function() { {% endfor %} {% endautoescape %} -{% else %} - <h1> <p style = "color :red;">OOPS!!! Login Please!</p></h1> -{% endif %} {% block nodetype-comments %} <div id="comments" class=""> diff --git a/gstudio/templates/metadashboard/userdashboard.html b/gstudio/templates/metadashboard/userdashboard.html index a8342b1..c12c122 100644 --- a/gstudio/templates/metadashboard/userdashboard.html +++ b/gstudio/templates/metadashboard/userdashboard.html @@ -4,22 +4,21 @@ {% block content %} -{% if user.is_authenticated %} + <!-- <h> Welcome to the GnowledgeStudio</h></br> <h>You are logged in as <font color="blue">{{user.username}}</font></h> <p></br> --> -<p> On the loom now:</p> +<p><font size ="3" > On the loom now:</font></p> </br> {% for each in meetings.member_systems.all %} - <a href="/gstudio/group/gnowsys-grp/{{each.id}}/">{{each.title}}</a></br> + <font size ="3" ><a href="/gstudio/group/gnowsys-grp/{{each.id}}/">{{each.title}}</a> </font></br> {% endfor %} +{% if user.is_authenticated %} <input type="button" value="Want to weave a thread?" onClick="location.href=parseURL('groupadd/');"> - </p> - <p> - </br> -{% else %} - <h1> <p style = "color :black;">Please Login</p></h1> {% endif %} + + </br> + diff --git a/gstudio/templates/metadashboard/wikidashboard.html b/gstudio/templates/metadashboard/wikidashboard.html index 8b9d15e..1af53ce 100644 --- a/gstudio/templates/metadashboard/wikidashboard.html +++ b/gstudio/templates/metadashboard/wikidashboard.html @@ -4,20 +4,20 @@ {% block content %} -{% if user.is_authenticated %} + <p> Here is a list of all the pages:</p> </br> {% for each in pages.member_systems.all %} <a href="/gstudio/page/gnowsys-page/{{each.id}}/">{{each.title}}</a></br> {% endfor %} + {% if user.is_authenticated %} <input type="button" value="Create a new page" onClick="location.href=parseURL('pageadd/');"> + {% endif %} </p> <p> </br> -{% else %} - <h1> <p style = "color :black;">OOPS!!! Login Please!</p></h1> -{% endif %} + diff --git a/gstudio/templatetags/gstudio_tags.py b/gstudio/templatetags/gstudio_tags.py index d79c658..0ead510 100644 --- a/gstudio/templatetags/gstudio_tags.py +++ b/gstudio/templatetags/gstudio_tags.py @@ -48,7 +48,10 @@ from gstudio.templatetags.zbreadcrumbs import retrieve_breadcrumbs from django.http import HttpResponseRedirect from gstudio.CNL import * - +from gstudio.methods import check_release_or_not +import os +from settings import STATIC_URL +from gstudio.methods import * register = Library() VECTORS = None @@ -389,3 +392,45 @@ def show_comment(comment,idusr,flag,admin_id,attob): @register.inclusion_tag('gstudio/tags/commentpage.html') def show_commentpage(comment,idusr,flag,admin_id,attob): return {'comment':comment , 'idusr' : idusr, "flag" : flag, "admin_id" : admin_id , "attribute" : attob} + + +@register.simple_tag +def show_nodesystem(object_id): + search=object_id + nbh="" + url="" + for each in System.objects.all(): + sysid=each.id + for eachsys in each.systemtypes.all(): + if eachsys.title=="Meeting": + url="group/gnowsys-grp/" + objecttitle = "TWIST" + elif eachsys.title=="Wikipage": + url="page/gnowsys-page/" + objecttitle = "WIKIPAGE" + for eachob in each.system_set.all(): + if eachob.gbobject_set.all(): + for eachgbob in eachob.gbobject_set.all(): + if search==eachgbob.id: + nbh=url+str(sysid) + + if search==sysid: + nbh=url+str(sysid) + + return nbh + +@register.assignment_tag +def check_release(meeting): + var = check_release_or_not(meeting) + return var + +@register.assignment_tag +def get_static_url(): + var = os.path.join(os.path.dirname(__file__),STATIC_URL) + return var + +@register.assignment_tag +def get_factory_looms(): + fs = [] + fs = get_factory_loom_OTs() + return fs diff --git a/gstudio/urls/__init__.py b/gstudio/urls/__init__.py index efc6305..8a4e015 100644 --- a/gstudio/urls/__init__.py +++ b/gstudio/urls/__init__.py @@ -19,6 +19,10 @@ from django.conf.urls.defaults import url from django.conf.urls.defaults import include from django.conf.urls.defaults import patterns +from django.conf.urls.defaults import * +from registration.views import register + +from gstudio.forms import RecaptchaRegistrationForm urlpatterns = patterns( '', @@ -41,8 +45,8 @@ urlpatterns = patterns( url(r'topicadd1/', include('gstudio.urls.topicadd1')), url(r'sectionadd1/', include('gstudio.urls.sectionadd1')), url(r'^login', include('gstudio.urls.login')), - url(r'user/(\w+)/$','gstudio.views.user.userdashboard'), - url(r'user/wikipage/(\w+)/$','gstudio.views.user.wikidashboard'), + url(r'user/$','gstudio.views.user.userdashboard'),#/(\w+) + url(r'user/wikipage/$','gstudio.views.user.wikidashboard'),#/(\w+) url(r'groupadd/', include('gstudio.urls.groupadd')), url(r'pageadd/', include('gstudio.urls.pageadd')), url(r'group/',include('gstudio.urls.group')), @@ -53,3 +57,10 @@ urlpatterns = patterns( ) + +urlpatterns += patterns('', + url(r'^register/$', register, + {'form_class': RecaptchaRegistrationForm}, + name='registration.views.register'), + (r'', include('registration.urls')), +) diff --git a/gstudio/urls/docu.py b/gstudio/urls/docu.py index d872bcd..13c2e47 100644 --- a/gstudio/urls/docu.py +++ b/gstudio/urls/docu.py @@ -20,5 +20,5 @@ from django.conf.urls.defaults import patterns urlpatterns = patterns('gstudio.views.docu', url(r'^$', 'docu', name='docu'), - + url(r'show/(\d+)/$','show',name='showdocument'), ) diff --git a/gstudio/urls/image.py b/gstudio/urls/image.py index 8836ffd..f088b29 100644 --- a/gstudio/urls/image.py +++ b/gstudio/urls/image.py @@ -21,5 +21,5 @@ 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'), ) diff --git a/gstudio/urls/video.py b/gstudio/urls/video.py index e6ed0f9..5c49802 100644 --- a/gstudio/urls/video.py +++ b/gstudio/urls/video.py @@ -21,5 +21,5 @@ from django.conf.urls.defaults import patterns urlpatterns = patterns('gstudio.views.video', url(r'^$', 'video', name='video'), - url(r'show/(\d+)/$','show',name='showvideo'), + url(r'show/(\d+)/$','show',name='showvideo'), ) diff --git a/gstudio/views/ajaxviews.py b/gstudio/views/ajaxviews.py index e763020..a55cf4e 100644 --- a/gstudio/views/ajaxviews.py +++ b/gstudio/views/ajaxviews.py @@ -351,33 +351,41 @@ def AjaxAddContentOrg(request): def AjaxCreateFile(request): + usr=str(request.user) iden = request.GET["id"] orgcontent = request.GET["content_org"] - myfile = open('/tmp/file.org', 'w') - myfile.write(orgcontent) + ext='.org' + html='.html' + myfile = open(os.path.join('/tmp/',usr+ext),'w') + myfile.write(new_ob.content_org) myfile.close() - myfile = open('/tmp/file.org', 'r') + myfile = open(os.path.join('/tmp/',usr+ext),'r') myfile.readline() - myfile = open('/tmp/file.org', 'a') + myfile = open(os.path.join('/tmp/',usr+ext),'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') + myfile = open(os.path.join('/tmp/',usr+ext),'r') return HttpResponse("test sucess") def AjaxCreateHtml(request): - stdout = os.popen(PYSCRIPT_URL_GSTUDIO) + usr=str(request.user) + ext='.org' + stdout = os.popen("%s %s"%(PYSCRIPT_URL_GSTUDIO,usr+ext)) output = stdout.read() return HttpResponse("sucess") def AjaxAddContent(request): + usr=str(request.user) + html='.html' iden = request.GET["id"] nid = NID.objects.get(id = iden) refobj = nid.ref - data = open("/tmp/file.html") + data = open(os.path.join('/tmp/',usr+html)) data1 = data.readlines() - data2 = data1[67:] + data2 = data1[72:] + data3 = data2[:-3] newdata="" - for line in data2: + for line in data3: newdata += line.lstrip() refobj.content= newdata refobj.save() diff --git a/gstudio/views/docu.py b/gstudio/views/docu.py index 1d0f7f8..b544765 100644 --- a/gstudio/views/docu.py +++ b/gstudio/views/docu.py @@ -22,13 +22,18 @@ from demo.settings import * from gstudio.models import * from objectapp.models import * from gstudio.methods import * +import hashlib +from django.template.defaultfilters import slugify +import os +report = "true" def docu(request): p=Objecttype.objects.get(title="Document") q=p.get_nbh['contains_members'] if request.method=="POST": + title = request.POST.get("title1","") user = request.POST.get("user","") - content= request.POST.get("contenttext","") + content= unicode(request.POST.get("contenttext","")) sdoc = request.POST.get("sdoc","") dn = request.POST.get("dn","") sub3 = request.POST.get("mydropdown","") @@ -36,7 +41,7 @@ def docu(request): docid = request.POST.get("docid","") delete = request.POST.get("delete","") addtags = request.POST.get("addtags","") - texttags = request.POST.get("texttags","") + texttags = unicode(request.POST.get("texttags","")) contenttext = request.POST.get("commenttext","") if rating : rate_it(int(docid),request,int(rating)) @@ -69,21 +74,25 @@ def docu(request): if addtags != "": i=Gbobject.objects.get(id=docid) - i.tags = i.tags+ ","+str(texttags) + i.tags = i.tags+ ","+(texttags) i.save() if contenttext !="": - edit_description(docid,contenttext) + edit_description(docid,contenttext,str(request.user)) a=[] + reportid='' for each in request.FILES.getlist("doc[]",""): a.append(each) if a != "": for f in a: - save_file(f) - create_object(f,user,content) - vars=RequestContext(request,{'documents':q}) + report,imageeachid = save_file(f) + if report == "false": + reportid = imageeachid + else: + create_object(f,user,content,str(request.user),title) + vars=RequestContext(request,{'documents':q,'reportid':reportid}) template="gstudio/docu.html" return render_to_response(template, vars) s=Nodetype.objects.get(title="Document") @@ -93,17 +102,41 @@ def docu(request): return render_to_response(template, vars) def save_file(file, path=""): + report = "true" + imageeachid = '' filename = file._get_name() - fd = open('%s/%s' % (MEDIA_ROOTNEW2, str(path) + str(filename)), 'wb') + slugfile = str(filename) + slugfile=slugfile.replace(' ','_') + fd = open('%s/%s' % (MEDIA_ROOTNEW2, str(path) + str(slugfile)), 'wb') for chunk in file.chunks(): fd.write(chunk) fd.close() + global md5_checksum + md5_checksum = md5Checksum(MEDIA_ROOTNEW2+"/"+str(slugfile)) + attype = Attributetype.objects.get(title="md5_checksum_document") + att = Attribute.objects.all() + flag = 0 + for each in att: + if each.attributetype.id == attype.id: + if each.svalue == md5_checksum : + flag = 1 + imageeachid = each.subject.id + if flag == 1: + report = "false" + + return report,imageeachid -def create_object(file,log,content): + +def create_object(file,log,content,usr,title): p=Gbobject() - p.title=file._get_name() - p.rurl=MEDIA_ROOTNEW2+"p.title" + filename=file._get_name() + slugfile = str(filename) + slugfile=slugfile.replace(' ','_') + p.title = title + p.altnames = slugfile + #p.rurl= #MEDIA_ROOTNEW2+"p.title" final = '' + fname=slugify(p.title)+"-"+usr for each1 in p.title: if each1==".": final=final+'-' @@ -112,7 +145,8 @@ def create_object(file,log,content): else: final = final+each1 p.slug=final - p.content_org=content + contorg=unicode(content) + p.content_org=contorg.encode('utf8') p.status=2 p.save() p.sites.add(Site.objects.get_current()) @@ -124,18 +158,24 @@ def create_object(file,log,content): p.objecttypes.add(Objecttype.objects.get(id=q.id)) p.save() new_ob = content - myfile = open('/tmp/file.org', 'w') - myfile.write(new_ob) - 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") + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(p.content_org) + myfile.close() + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() data2 = data1[72:] data3 = data2[:-3] @@ -144,28 +184,65 @@ def create_object(file,log,content): newdata += line.lstrip() p.content = newdata p.save() + a=Attribute() + a.attributetype=Attributetype.objects.get(title="md5_checksum_document") + a.subject=p + a.svalue=md5_checksum + a.save() def rate_it(topic_id,request,rating): ob = Gbobject.objects.get(id=topic_id) ob.rating.add(score=rating ,user=request.user, ip_address=request.META['REMOTE_ADDR']) return True +def show(request,documentid): + if request.method=="POST": + rating = request.POST.get("star1","") + docid = request.POST.get("docid","") + addtags = request.POST.get("addtags","") + texttags = unicode(request.POST.get("texttags","")) + contenttext = unicode(request.POST.get("contenttext","")) + if rating : + rate_it(int(docid),request,int(rating)) + if addtags != "": + i=Gbobject.objects.get(id=docid) + i.tags = i.tags+ ","+(texttags) + i.save() + if contenttext !="": + edit_description(docid,contenttext,str(request.user)) + gbobject = Gbobject.objects.get(id=documentid) + vars=RequestContext(request,{'doc':gbobject}) + template="gstudio/fulldocument.html" + return render_to_response(template,vars) + -def edit_description(sec_id,title): + +def edit_description(sec_id,title,usr): new_ob = Gbobject.objects.get(id=int(sec_id)) - 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") + contorg=unicode(title) + new_ob.content_org=contorg.encode('utf8') + ssid=new_ob.get_ssid.pop() + fname=str(ssid)+"-"+usr + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(new_ob.content_org) + myfile.close() + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() data2 = data1[72:] data3 = data2[:-3] @@ -175,3 +252,13 @@ def edit_description(sec_id,title): new_ob.content = newdata new_ob.save() return True + +def md5Checksum(filePath): + fh = open(filePath, 'rb') + m = hashlib.md5() + while True: + data = fh.read(8192) + if not data: + break + m.update(data) + return m.hexdigest() diff --git a/gstudio/views/group.py b/gstudio/views/group.py index d38b5ae..4a436ed 100644 --- a/gstudio/views/group.py +++ b/gstudio/views/group.py @@ -54,31 +54,50 @@ def groupdashboard(request,grpid): rep = request.POST.get("reply",'') id_no = request.POST.get("iden",'') id_no1 = request.POST.get("parentid","") - print "topicid",id_no,"replyid",id_no1,"reply",rep idusr = request.POST.get("idusr",'') - rating = request.POST.get("star1","") + usr = request.POST.get("usr",'') + rating = request.POST.get("star1","") flag1=request.POST.get("release","") block = request.POST.get("block","") topic_del = request.POST.get("del_topic", "") comment_del = request.POST.get("del_comment", "") - - if topic_del: + editable=request.POST.get("edit","") + editval=request.POST.get("editval","") + edittitle=request.POST.get("edittitle","") + editcontent=request.POST.get("editcont","") + editiden=request.POST.get("editiden","") + docid = request.POST.get("docid","") + addtags = request.POST.get("addtags","") + texttags = unicode(request.POST.get("texttags","")) + if editval=='editthread': + edit_thread(editiden,editcontent,str(request.user)) + if editable=='edited': + if id_no : + edit_topic(id_no,rep,usr) + elif id_no1 : + edit_topic(id_no1,rep,str(request.user)) + if topic_del: del_topic(int(id_no)) if comment_del: del_comment(int(id_no1)) + if addtags != "": + i=Gbobject.objects.get(id=int(docid)) + i.tags = i.tags+ ","+(texttags) + i.save() if flag1: boolean1 = True make_att_true(meeting_ob) if block : make_att_false(meeting_ob) if rating : - rate_it(int(id_no),request,int(rating)) - if rep : + rate_it(int(id_no1),request,int(rating)) + if rep and editable!='edited': if not id_no : - boolean = make_relation(rep,int(id_no1),int(idusr)) + + boolean = make_relation(rep,int(id_no1),int(idusr),str(request.user)) elif not id_no1 : - boolean = make_relation(rep,int(id_no),int(idusr)) + boolean = make_relation(rep,int(id_no),int(idusr),usr) if boolean : return HttpResponseRedirect("/gstudio/group/gnowsys-grp/"+str(grpid)) grpid = int(grpid) @@ -98,7 +117,9 @@ def groupdashboard(request,grpid): post=latest_topic.get_absolute_url() else: post="no topic added yet!!" - variables = RequestContext(request,{'topic' : Topic , 'meet_ob' : meeting_ob, "flag" : flag, "flag1" : boolean1, "admin_id" : admin_id, "attribute" : attob, 'admin_m':admin_m, 'endtime':endtime, 'post':post}) + ot=Gbobject.objects.get(id=grpid) + meeting_ob = System.objects.get(id=grpid) + variables = RequestContext(request,{'ot' : ot,'topic' : Topic , 'meet_ob' : meeting_ob, "flag" : flag, "flag1" : boolean1, "admin_id" : admin_id, "attribute" : attob, 'admin_m':admin_m, 'endtime':endtime, 'post':post}) template = "metadashboard/grpdashboard.html" return render_to_response(template, variables) diff --git a/gstudio/views/groupadd.py b/gstudio/views/groupadd.py index d0c7242..e32a101 100644 --- a/gstudio/views/groupadd.py +++ b/gstudio/views/groupadd.py @@ -30,6 +30,7 @@ def groupadd(request): stDate = (request.POST["stDate"]).split("/") endDate=(request.POST["endDate"]).split("/") hours1 = int(request.POST["hours1"]) + usr = request.POST.get("usr",'') minutes1 = int(request.POST["minutes1"]) hours2 = int(request.POST["hours2"]) minutes2 = int(request.POST["minutes2"]) @@ -38,9 +39,9 @@ def groupadd(request): if not errors: title=request.POST['subject'] - content=request.POST['message'] + content=unicode(request.POST['message']) idusr=request.POST['idusr'] - meetId = create_meeting(title,int(idusr),content) + meetId = create_meeting(title,int(idusr),content,usr) schedule_time(time1, time2, meetId) if meetId : return HttpResponseRedirect('/gstudio/group/gnowsys-grp/'+ str(meetId)) diff --git a/gstudio/views/image.py b/gstudio/views/image.py index 4b1c3f4..ec1b2fc 100644 --- a/gstudio/views/image.py +++ b/gstudio/views/image.py @@ -23,13 +23,20 @@ from gstudio.models import * from objectapp.models import * import os from gstudio.methods import * +from PIL import Image +import glob, os +import hashlib +from django.template.defaultfilters import slugify +size = 128, 128 +report = "true" +md5_checksum = "" def image(request): p=Objecttype.objects.get(title="Image") q=p.get_nbh['contains_members'] if request.method=="POST": title = request.POST.get("title1","") - content= request.POST.get("contenttext","") + content= unicode(request.POST.get("contenttext","")) simg = request.POST.get("simg","") sub3 = request.POST.get("mydropdown","") user = request.POST.get("user","") @@ -40,7 +47,7 @@ def image(request): fulid = request.POST.get("fulid","") show = request.POST.get("Show","") addtags = request.POST.get("addtags","") - texttags = request.POST.get("texttags","") + texttags = unicode(request.POST.get("texttags","")) contenttext = request.POST.get("contenttext","") if show != "": i=Gbobject.objects.get(id=fulid) @@ -79,27 +86,34 @@ def image(request): if addtags != "": i=Gbobject.objects.get(id=imgid) - i.tags = i.tags+ ","+str(texttags) + i.tags = i.tags+ ","+(texttags) i.save() a=[] + reportid='' for each in request.FILES.getlist("image[]",""): a.append(each) if a != "": i=0 for f in a: if i==0: - save_file(f,title,user) - create_object(f,user,title,content) - i=i+1 + report,imageeachid = save_file(f,title,user) + if report == "false": + reportid = imageeachid + else: + create_object(f,user,title,content,str(request.user)) + i=i+1 else: - save_file(f,title+'_'+str(i),user) - create_object(f,user,title+'_'+str(i),content) - i=i+1 + report,imageeachid = save_file(f,title+'_'+str(i),user) + if report == "false": + reportid = imageeachid + else: + create_object(f,user,title+'_'+str(i),content,str(request.user)) + i=i+1 p=Objecttype.objects.get(title="Image") q=p.get_nbh['contains_members'] - vars=RequestContext(request,{'images':q}) + vars=RequestContext(request,{'images':q,'reportid':reportid,'report':report}) template="gstudio/image.html" return render_to_response(template, vars) vars=RequestContext(request,{'images':q,'val':""}) @@ -107,31 +121,67 @@ def image(request): return render_to_response(template, vars) def save_file(file,title, user, path=""): + report = "true" + imageeachid = '' filename = title + slugfile = str(file) + slugfile=slugfile.replace(' ','_') os.system("mkdir -p "+ MEDIA_ROOTNEW2+"/"+user) - fd = open('%s/%s/%s' % (MEDIA_ROOTNEW2, str(user),str(path) + str(file)), 'wb') + fd = open('%s/%s/%s' % (MEDIA_ROOTNEW2, str(user),str(path) + str(slugfile)), 'wb') for chunk in file.chunks(): fd.write(chunk) fd.close() + global md5_checksum + md5_checksum = md5Checksum(MEDIA_ROOTNEW2+"/"+ str(user)+"/"+slugfile) + attype = Attributetype.objects.get(title="md5_checksum_image") + att = Attribute.objects.all() + flag = 0 + for each in att: + if each.attributetype.id == attype.id: + if each.svalue == md5_checksum : + flag = 1 + imageeachid = each.subject.id + if flag == 1: + report = "false" + else: + for infile in glob.glob(MEDIA_ROOTNEW2+"/"+str(user)+"/"+str(slugfile)): + file, ext = os.path.splitext(infile) + im = Image.open(infile) + imm = Image.open(infile) + im.thumbnail(size, Image.ANTIALIAS) + im.save(file + "-thumbnail", "JPEG") + width, height = imm.size + sizem = 1024,height + if int(width) > 1024: + imm.thumbnail(sizem, Image.ANTIALIAS) + imm.save(file + "_display_1024","JPEG") + else: + imm.thumbnail(imm.size,Image.ANTIALIAS) + imm.save(file + "_display_1024","JPEG") + return report,imageeachid + -def create_object(f,log,title,content): +def create_object(f,log,title,content,usr): p=Gbobject() filename = str(f) + filename=filename.replace(' ','_') p.title=title + fname=slugify(title)+"-"+usr p.image=log+"/"+filename - final = '' - for each1 in filename: - if each1==" ": - final=final+'-' - else: - final = final+each1 - i=0 - dirname = "" - while final[i] != ".": - dirname = dirname + final[i] - i=i+1 - p.slug=dirname - p.content_org=content + #final = '' + #for each1 in filename: + # if each1==" ": + # final=final+'-' + # else: + # final = final+each1 + #i=0 + #dirname = "" + #while final[i] != ".": + # dirname = dirname + final[i] + # i=i+1 + p.slug=slugify(filename) + contorg=unicode(content) + p.content_org=contorg.encode('utf8') p.status=2 p.save() p.sites.add(Site.objects.get_current()) @@ -143,18 +193,25 @@ def create_object(f,log,title,content): p.objecttypes.add(Objecttype.objects.get(id=q.id)) p.save() new_ob = content - myfile = open('/tmp/file.org', 'w') - myfile.write(new_ob) + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(p.content_org) myfile.close() - myfile = open('/tmp/file.org', 'r') - myfile.readline() - myfile = open('/tmp/file.org', 'a') + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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) + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) output = stdout.read() - data = open("/tmp/file.html") + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() data2 = data1[72:] data3 = data2[:-3] @@ -163,6 +220,12 @@ def create_object(f,log,title,content): newdata += line.lstrip() p.content = newdata p.save() + a=Attribute() + a.attributetype=Attributetype.objects.get(title="md5_checksum_image") + a.subject=p + a.svalue=md5_checksum + a.save() + def rate_it(topic_id,request,rating): ob = Gbobject.objects.get(id=topic_id) @@ -174,36 +237,47 @@ def show(request,imageid): rating = request.POST.get("star1","") imgid = request.POST.get("imgid","") addtags = request.POST.get("addtags","") - texttags = request.POST.get("texttags","") - contenttext = request.POST.get("contenttext","") + texttags = unicode(request.POST.get("texttags","")) + contenttext = unicode(request.POST.get("contenttext","")) if rating : rate_it(int(imgid),request,int(rating)) if addtags != "": i=Gbobject.objects.get(id=imgid) - i.tags = i.tags+ ","+str(texttags) + i.tags = i.tags+ ","+(texttags) i.save() if contenttext !="": - edit_description(imgid,contenttext) + edit_description(imgid,contenttext,str(request.user)) gbobject = Gbobject.objects.get(id=imageid) vars=RequestContext(request,{'image':gbobject}) template="gstudio/fullscreen.html" return render_to_response(template,vars) -def edit_description(sec_id,title): +def edit_description(sec_id,title,usr): new_ob = Gbobject.objects.get(id=int(sec_id)) - new_ob.content_org = title - myfile = open('/tmp/file.org', 'w') + contorg=unicode(title) + ssid=new_ob.get_ssid.pop() + fname=str(ssid)+"-"+usr + new_ob.content_org=contorg.encode('utf8') + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') myfile.write(new_ob.content_org) myfile.close() - myfile = open('/tmp/file.org', 'r') - myfile.readline() - myfile = open('/tmp/file.org', 'a') + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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) + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() - data = open("/tmp/file.html") + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() data2 = data1[72:] data3 = data2[:-3] @@ -213,3 +287,14 @@ def edit_description(sec_id,title): new_ob.content = newdata new_ob.save() return True + +def md5Checksum(filePath): + fh = open(filePath, 'rb') + m = hashlib.md5() + while True: + data = fh.read(8192) + if not data: + break + m.update(data) + return m.hexdigest() + diff --git a/gstudio/views/nodetypes.py b/gstudio/views/nodetypes.py index 2762e06..fe301eb 100644 --- a/gstudio/views/nodetypes.py +++ b/gstudio/views/nodetypes.py @@ -58,6 +58,10 @@ from django.views.generic.date_based import archive_month from django.views.generic.date_based import archive_day from django.views.generic.date_based import object_detail +from gstudio.methods import * +from demo.settings import PYSCRIPT_URL_GSTUDIO +from demo.settings import FILE_URL + from gstudio.models import Nodetype from gstudio.views.decorators import protect_nodetype from gstudio.views.decorators import update_queryset @@ -79,5 +83,17 @@ def nodetype_shortlink(request, object_id): Redirect to the 'get_absolute_url' of a nodetype, accordingly to 'object_id' argument """ + if request.method == "POST" : + boolean = False + rep = request.POST.get("replytosection",'') + id_no = request.POST.get("iden",'') + # id_no1 = request.POST.get("parentid","") + idusr = request.POST.get("idusr",'') + usr = request.POST.get("usr",'') + editable = request.POST.get("edit","") + if editable=="edited": + edit_nodetype(id_no,rep,usr) + + nodetype = get_object_or_404(Nodetype, pk=object_id) return redirect(nodetype, permanent=True) diff --git a/gstudio/views/page.py b/gstudio/views/page.py index e59caec..3482ccb 100644 --- a/gstudio/views/page.py +++ b/gstudio/views/page.py @@ -22,26 +22,27 @@ from gstudio.methods import * def pagedashboard(request,pageid): pageid = int(pageid) - # boolean1 = False flag= False page_ob = System.objects.get(id=pageid) if request.method == "POST" : boolean = False rep = request.POST.get("replytosection",'') - print "rep" ,rep -# content_org = request.POST.get("orgreply",'') id_no = request.POST.get("iden",'') id_no1 = request.POST.get("parentid","") - print"id",id_no1 idusr = request.POST.get("idusr",'') + usr = request.POST.get("usr",'') rating = request.POST.get("star1","") - # # flag1=request.POST.get("pagerelease","") - # # block = request.POST.get("block","") section_del = request.POST.get("del_section", "") comment_del = request.POST.get("del_comment", "") docid = request.POST.get("docid","") addtags = request.POST.get("addtags","") - texttags = request.POST.get("texttags","") + texttags = unicode(request.POST.get("texttags","")) + editable = request.POST.get("edit","") + if editable=="edited": + if id_no: + edit_section(id_no,rep,usr) + elif id_no1: + edit_section(id_no1,rep,str(request.user)) if section_del: del_section(int(id_no)) if comment_del: @@ -50,19 +51,16 @@ def pagedashboard(request,pageid): rate_section(int(id_no),request,int(rating)) if addtags != "": i=Gbobject.objects.get(id=docid) - i.tags = i.tags+ ","+str(texttags) + i.tags = i.tags+ ","+(texttags) i.save() - if rep : + if rep and editable!='edited': if not id_no : - ptitle= make_title(int(id_no)) - boolean = make_sectionrelation(rep,ptitle,int(id_no1),int(idusr)) - - + ptitle= make_title(int(id_no1)) + boolean = make_sectionrelation(rep,ptitle,int(id_no1),int(idusr),usr) elif not id_no1 : ptitle= make_title(int(id_no)) - boolean = make_sectionrelation(rep,ptitle,int(id_no),int(idusr)) - + boolean = make_sectionrelation(rep,ptitle,int(id_no),int(idusr),usr) if boolean : return HttpResponseRedirect("/gstudio/page/gnowsys-page/"+str(pageid)) pageid = int(pageid) @@ -70,10 +68,6 @@ def pagedashboard(request,pageid): flag = True Section = page_ob.system_set.all()[0].gbobject_set.all() admin_id = page_ob.authors.all()[0].id #a list of topics - # # for each in page_ob.subject_of.all(): - # # if each.attributetype.title=='pagerelease': - # # attob = each.svalue - # # break admin_m = page_ob.authors.all()[0] topic_type_set=Objecttype.objects.get(title='Section') @@ -83,7 +77,9 @@ def pagedashboard(request,pageid): else: post="no topic added yet!!" ot=Gbobject.objects.get(id=pageid) - + page_ob = System.objects.get(id=pageid) variables = RequestContext(request, {'ot' : ot,'section' : Section,'page_ob' : page_ob,'admin_m':admin_m,"flag" : flag,"admin_id" : admin_id,'post':post}) + template = "metadashboard/pgedashboard.html" return render_to_response(template, variables) + diff --git a/gstudio/views/pageadd.py b/gstudio/views/pageadd.py index d51017c..1537fc7 100644 --- a/gstudio/views/pageadd.py +++ b/gstudio/views/pageadd.py @@ -29,11 +29,23 @@ def pageadd(request): # if not request.POST.get('org1', ''): # errors.append('Enter a page.') if not errors: - title=unicode(request.POST['subject']) + title=request.POST['subject'] # content=request.POST['page'] content_org=unicode(request.POST['org1']) idusr=request.POST['idusr'] - pageId = create_wikipage(title,int(idusr),content_org) + usr = request.POST.get("usr",'') + editable= request.POST.get("edit","") + # print content_org,"content" + + if editable=='edited': + + #if id_no: + edit_section(idusr,content_org,usr) + # elif id_no1: + # edit_section(id_no1,rep) + + + pageId = create_wikipage(title,int(idusr),content_org,usr) if pageId : return HttpResponseRedirect('/gstudio/page/gnowsys-page/'+ str(pageId)) variables = RequestContext(request,{'errors' : errors, 'pageId' : pageId}) diff --git a/gstudio/views/sectionadd1.py b/gstudio/views/sectionadd1.py index 8bc3dd1..55ba6ff 100644 --- a/gstudio/views/sectionadd1.py +++ b/gstudio/views/sectionadd1.py @@ -19,11 +19,12 @@ def sectionadd1(request,pageid): if not request.POST.get('org', ''): errors.append('Enter a page.') if not errors: - title=unicode(request.POST['subject']) + title=request.POST['subject'] # content=request.POST['page'] content_org=unicode(request.POST['org']) idusr=request.POST['idusr'] - tp = make_section_object(title,int(idusr),content_org) + usr=request.POST['usr'] + tp = make_section_object(title,int(idusr),content_org,usr) System.objects.get(id=int(pageid)).system_set.all()[0].gbobject_set.add(tp) if tp: return HttpResponseRedirect('/gstudio/page/gnowsys-page/'+pageid) diff --git a/gstudio/views/topicadd.py b/gstudio/views/topicadd.py index 31e780e..044a374 100644 --- a/gstudio/views/topicadd.py +++ b/gstudio/views/topicadd.py @@ -32,7 +32,7 @@ def topicadd(request): if not request.POST.get('message', ''): errors.append('Enter a message.') if not errors: - title=unicode(request.POST['subject']) + title=request.POST['subject'] content=unicode(request.POST['message']) idusr=request.POST['idusr'] boolean = make_topic_object(title,int(idusr),content) diff --git a/gstudio/views/topicadd1.py b/gstudio/views/topicadd1.py index dc1865f..bb866d8 100644 --- a/gstudio/views/topicadd1.py +++ b/gstudio/views/topicadd1.py @@ -33,9 +33,10 @@ def topicadd1(request,grpid): errors.append('Enter a message.') if not errors: title=request.POST['subject'] - content=request.POST['message'] + content=unicode(request.POST['message']) idusr=request.POST['idusr'] - tp = make_topic_object(title,int(idusr),content) + usr=request.POST['usr'] + tp = make_topic_object(title,int(idusr),content,usr) System.objects.get(id=int(grpid)).system_set.all()[0].gbobject_set.add(tp) if tp: return HttpResponseRedirect('/gstudio/group/gnowsys-grp/'+grpid) diff --git a/gstudio/views/user.py b/gstudio/views/user.py index 9fa9b6d..d49df25 100644 --- a/gstudio/views/user.py +++ b/gstudio/views/user.py @@ -21,27 +21,27 @@ from django.template import RequestContext from django.shortcuts import render_to_response from gstudio.methods import * -def userdashboard(request,username): - if request.user.username == username : +def userdashboard(request):#,username): + # if request.user.username == username : meetings = Systemtype.objects.get(title="Meeting") variables = RequestContext(request,{"meetings" : meetings }) template = "metadashboard/userdashboard.html" return render_to_response(template, variables) - else : - variables = RequestContext(request) - template = "metadashboard/logindashboard.html" - return render_to_response(template,variables) + #else : + # variables = RequestContext(request) + # template = "metadashboard/logindashboard.html" + # return render_to_response(template,variables) -def wikidashboard(request,username): - if request.user.username == username : +def wikidashboard(request):#,username): + #if request.user.username == username : pages = Systemtype.objects.get(title="Wikipage") variables = RequestContext(request,{"pages" : pages }) template = "metadashboard/wikidashboard.html" return render_to_response(template, variables) - else : - variables = RequestContext(request) - template = "metadashboard/logindashboard.html" - return render_to_response(template,variables) + #else : + # variables = RequestContext(request) + # template = "metadashboard/logindashboard.html" + # return render_to_response(template,variables) diff --git a/gstudio/views/video.py b/gstudio/views/video.py index 0bd39b7..6eb86d9 100644 --- a/gstudio/views/video.py +++ b/gstudio/views/video.py @@ -27,19 +27,26 @@ from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from demo.settings import * from gstudio.methods import * from django.contrib.auth import authenticate - +from django.template.defaultfilters import slugify +import hashlib +report = "true" +global md5_checksum +md5_checksum = "" def video(request): api=ox.api.API("http://wetube.gnowledge.org/api") p=Objecttype.objects.get(title="Video") q=p.get_nbh['contains_members'] sd = request.user + usr=str(request.user) + title = "" message = '' sd = str(sd) password = request.POST.get("upload","") content= request.POST.get("contenttext","") if request.method == 'POST': + title = request.POST.get("title1","") clip = request.FILES.get("clip","") - content= request.POST.get("contenttext","") + content= unicode(request.POST.get("contenttext","")) svid = request.POST.get("svid","") sub1 = request.POST.get("norm","") sub2 = request.POST.get("spe","") @@ -61,7 +68,7 @@ def video(request): wename = request.POST.get("wename","") titlename = request.POST.get("titlename","") addtags = request.POST.get("addtags","") - texttags = request.POST.get("texttags","") + texttags = unicode(request.POST.get("texttags","")) password = request.POST.get("videopassword","") if rate == '0': rate = 'No rating yet' @@ -114,95 +121,128 @@ def video(request): if addtags != "": i=Gbobject.objects.get(id=vidid) - i.tags = i.tags+ ","+str(texttags) + i.tags = i.tags+ ","+(texttags) i.save() if clip != "": api.signup({'username':user,'password':password,'email':useremail}) - save_file(clip,user) - clipname = clip._get_name() - i=0 - dirname = "" - while clipname[i] != ".": - dirname = dirname + clipname[i] - i=i+1 - y=str(dirname) - x=str(clipname[0]).upper() - CreateConfig(user,password) - # os.system("pandora_client config") - os.system("pandora_client add_volume "+ user+" "+MEDIA_ROOTNEW+"/"+user ) - os.system("pandora_client scan") - os.system("pandora_client sync") - os.system("pandora_client upload") + report,imageeachid = save_file(clip,user) + if report == "false": + reportid = imageeachid + q=p.get_nbh['contains_members'] + variables = RequestContext(request,{'vids':q,'reportid':reportid}) + template = "gstudio/video.html" + return render_to_response(template, variables) + else: + clipname = clip._get_name() + i=0 + dirname = "" + while clipname[i] != ".": + dirname = dirname + clipname[i] + i=i+1 + y=str(dirname) + x=str(clipname[0]).upper() + CreateConfig(user,password) + # os.system("pandora_client config") + os.system("pandora_client add_volume "+ user+" "+MEDIA_ROOTNEW+"/"+user ) + os.system("pandora_client scan") + os.system("pandora_client sync") + os.system("pandora_client upload") wclip= api.find({'sort': [{'key': 'title','operator': '+'}],'query': {'conditions': [{'key': 'title','value': y,'operator': '='}],'operator': '&'},'keys': ['id', 'title','user','duration','sourcedescription','created'],'range': [0,100]}) for each in wclip['data']['items']: - m=Gbobject() - m.title=each['title'].lower() - m.rurl="http://wetube.gnowledge.org/"+each['id']+'/480p.webm' - m.slug=each['id'] - m.content_org=content - m.status=2 - m.save() - m.sites.add(Site.objects.get_current()) - m.save() - m.objecttypes.add(Objecttype.objects.get(id=p.id)) - m.save() - a=Attribute() - a.attributetype=Attributetype.objects.get(title="posted_by") - a.subject=m - a.svalue=user - a.save() - a1=Attribute() - a1.attributetype=Attributetype.objects.get(title="time_limit") - a1.subject=m - a1.svalue=each['duration'] - a1.save() - a2=Attribute() - a2.attributetype=Attributetype.objects.get(title="creation_day") - a2.subject=m - a2.svalue=each['created'] - a2.save() - a3=Attribute() - a3.attributetype=Attributetype.objects.get(title="source") - a3.subject=m - a3.svalue=each['sourcedescription'] - a3.save() - a4=Attribute() - a4.attributetype=Attributetype.objects.get(title="map_link") - a4.subject=m - l=each['sourcedescription'] - final='' - for each in l: - if each==" ": - final=final+'+' - else: - final=final+each - a4.svalue=final - a4.save() - m.save() - new_ob = content - myfile = open('/tmp/file.org', 'w') - myfile.write(new_ob) - 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[72:] - data3 = data2[:-3] - newdata="" - for line in data3: - newdata += line.lstrip() - m.content = newdata - m.save() - + flag=0 + for vid in q: + if vid.title==each['title'].lower(): + flag=1 + if vid.altnames==each['title'].lower(): + flag=1 + if flag==0: + print "in 1 for video" + m=Gbobject() + m.title = title + m.altnames=each['title'].lower() + fname=slugify(title)+"-"+usr + m.title=each['title'].lower() + m.rurl="http://wetube.gnowledge.org/"+each['id']+'/480p.webm' + m.slug=each['id'] + contorg=unicode(content) + m.content_org=contorg.encode('utf8') + m.status=2 + m.save() + m.sites.add(Site.objects.get_current()) + m.save() + m.objecttypes.add(Objecttype.objects.get(id=p.id)) + m.save() + a=Attribute() + a.attributetype=Attributetype.objects.get(title="posted_by") + a.subject=m + a.svalue=user + a.save() + a1=Attribute() + a1.attributetype=Attributetype.objects.get(title="time_limit") + a1.subject=m + a1.svalue=each['duration'] + a1.save() + a2=Attribute() + a2.attributetype=Attributetype.objects.get(title="creation_day") + a2.subject=m + a2.svalue=each['created'] + a2.save() + a3=Attribute() + a3.attributetype=Attributetype.objects.get(title="source") + a3.subject=m + a3.svalue=each['sourcedescription'] + a3.save() + a4=Attribute() + a4.attributetype=Attributetype.objects.get(title="map_link") + a4.subject=m + l=each['sourcedescription'] + final='' + for each in l: + if each==" ": + final=final+'+' + else: + final=final+each + a4.svalue=final + a4.save() + m.save() + new_ob = content + usr=str(request.user) + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(m.content_org) + myfile.close() + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() + data = open(os.path.join(FILE_URL,fname+html)) + data1 = data.readlines() + data2 = data1[72:] + data3 = data2[:-3] + newdata="" + for line in data3: + newdata += line.lstrip() + m.content = newdata + m.save() + a=Attribute() + a.attributetype=Attributetype.objects.get(title="md5_checksum_document") + a.subject=m + a.svalue=md5_checksum + a.save() + if sub3 != "": @@ -248,12 +288,20 @@ def video(request): for vid in q: if vid.title==each['title'].lower(): flag=1 + if vid.altnames==each['title'].lower(): + flag=1 if flag==0: m=Gbobject() - m.title=each['title'].lower() + if title: + m.title = title + else: + m.title = each['title'].lower() + m.altnames=each['title'].lower() + fname=slugify(title)+"-"+str(usr) m.rurl="http://wetube.gnowledge.org/"+each['id']+'/480p.webm' m.slug=each['id'] - m.content=content + contorg=unicode(content) + m.content_org=contorg.encode('utf8') m.status=2 m.save() m.sites.add(Site.objects.get_current()) @@ -293,6 +341,42 @@ def video(request): a4.svalue=final a4.save() m.save() + new_ob = content + usr=str(request.user) + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(m.content_org) + myfile.close() + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) + output = stdout.read() + data = open(os.path.join(FILE_URL,fname+html)) + data1 = data.readlines() + data2 = data1[72:] + data3 = data2[:-3] + newdata="" + for line in data3: + newdata += line.lstrip() + m.content = newdata + m.save() + a=Attribute() + a.attributetype=Attributetype.objects.get(title="md5_checksum_document") + a.subject=m + a.svalue=md5_checksum + a.save() + svid="" q=p.get_nbh['contains_members'] variables = RequestContext(request,{'vids':q,'val':svid}) @@ -300,6 +384,8 @@ def video(request): return render_to_response(template, variables) def save_file(file, user,path=""): + report = "true" + imageeachid = '' filename = file._get_name() i=0 dirname = "" @@ -320,7 +406,20 @@ def save_file(file, user,path=""): for chunk in file.chunks(): fd.write(chunk) fd.close() - return + fd.close() + global md5_checksum + md5_checksum = md5Checksum(MEDIA_ROOTNEW+"/"+ str(fileuser)+"/"+str(filename[0]).upper()+"/"+str(dirname)+"/"+str(filename)) + attype = Attributetype.objects.get(title="md5_checksum_document") + att = Attribute.objects.all() + flag = 0 + for each in att: + if each.attributetype.id == attype.id: + if each.svalue == md5_checksum : + flag = 1 + imageeachid = each.subject.id + if flag == 1: + report = "false" + return report,imageeachid @@ -362,8 +461,10 @@ def show(request,videoid): favid=request.POST.get("favid","") favusr=request.POST.get("favusr","") addtags = request.POST.get("addtags","") - texttags = request.POST.get("texttags","") + texttags = unicode(request.POST.get("texttags","")) contenttext = request.POST.get("contenttext","") + contenttext = unicode(request.POST.get("contenttext","")) + titlecontenttext = request.POST.get("titlecontenttext") if rating : rate_it(int(vidid),request,int(rating)) @@ -395,31 +496,46 @@ def show(request,videoid): if addtags != "": i=Gbobject.objects.get(id=vidid) - i.tags = i.tags+ ","+str(texttags) + i.tags = i.tags+ ","+(texttags) i.save() if contenttext !="": - edit_description(vidid,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}) template="gstudio/transcript.html" return render_to_response(template,vars) -def edit_description(sec_id,title): +def edit_description(sec_id,title,usr): new_ob = Gbobject.objects.get(id=int(sec_id)) - new_ob.content_org = title - myfile = open('/tmp/file.org', 'w') + contorg=unicode(title) + ssid=new_ob.get_ssid.pop() + fname=str(ssid)+"-"+usr + new_ob.content_org=contorg.encode('utf8') + ext='.org' + html='.html' + myfile = open(os.path.join(FILE_URL,fname+ext),'w') myfile.write(new_ob.content_org) myfile.close() - myfile = open('/tmp/file.org', 'r') - myfile.readline() - myfile = open('/tmp/file.org', 'a') + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + rfile=myfile.readlines() + scontent="".join(rfile) + newcontent=scontent.replace("\r","") + myfile = open(os.path.join(FILE_URL,fname+ext),'w') + myfile.write(newcontent) + + #myfile.readline() + myfile = open(os.path.join(FILE_URL,fname+ext),'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) + myfile = open(os.path.join(FILE_URL,fname+ext),'r') + stdout = os.popen("%s %s %s"%(PYSCRIPT_URL_GSTUDIO,fname+ext,FILE_URL)) output = stdout.read() - data = open("/tmp/file.html") + data = open(os.path.join(FILE_URL,fname+html)) data1 = data.readlines() data2 = data1[72:] data3 = data2[:-3] @@ -429,3 +545,13 @@ def edit_description(sec_id,title): new_ob.content = newdata new_ob.save() return True + +def md5Checksum(filePath): + fh = open(filePath, 'rb') + m = hashlib.md5() + while True: + data = fh.read(8192) + if not data: + break + m.update(data) + return m.hexdigest() diff --git a/gstudio/xmlrpc/metaweblog.py b/gstudio/xmlrpc/metaweblog.py index 2e5e03d..4c97f8b 100644 --- a/gstudio/xmlrpc/metaweblog.py +++ b/gstudio/xmlrpc/metaweblog.py @@ -67,6 +67,7 @@ from gstudio.models import Nodetype from gstudio.models import Metatype from gstudio.models import NID from objectapp.models import Gbobject +from objectapp.models import Gbobject, System, Process from gstudio.settings import PROTOCOL from gstudio.settings import UPLOAD_TO from gstudio.managers import DRAFT, PUBLISHED |