diff options
37 files changed, 1766 insertions, 179 deletions
diff --git a/demo/grappelli/static/grappelli/css/typography.css b/demo/grappelli/static/grappelli/css/typography.css index b821d7c..cdd5d3b 100644 --- a/demo/grappelli/static/grappelli/css/typography.css +++ b/demo/grappelli/static/grappelli/css/typography.css @@ -94,7 +94,7 @@ a.back { ------------------------------------------------------------------------------------------------------ */ ul, li { - list-style-type: none; + list-display-position: inherit; } diff --git a/gstudio/management/commands/sync-gbobjects.py b/gstudio/management/commands/sync-gbobjects.py index faf4274..2e8c955 100644 --- a/gstudio/management/commands/sync-gbobjects.py +++ b/gstudio/management/commands/sync-gbobjects.py @@ -13,59 +13,59 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from django.core.management.base import BaseCommand -from optparse import make_option - -import re -from datetime import datetime -from objectapp.models import Gbobject -from xmlrpclib import DateTime -from xmlrpclib import ServerProxy - -class Command(BaseCommand): - """Gets all Gbobjects for a specified server""" - option_list = BaseCommand.option_list + ( - make_option("--server", action="store", type="string", - dest="server", help="Specify an ip"),) - - def handle(self, *args, **options): - def parse_id(id=None): - def inner_parse(id): - """Gets a dict, parses and saves it""" - dict = srv.metaWeblog.dict_id(id) - pattern = "^(\d{4})(\d{2})(\d{2}).(\d{2}).(\d{2}).(\d{2})$" - - cd = DateTime().make_comparable(dict['creation_date'])[1] - lu = DateTime().make_comparable(dict['last_update'])[1] - ep = DateTime().make_comparable(dict['end_publication'])[1] - sp = DateTime().make_comparable(dict['start_publication'])[1] - - def group(value): - return value.group(1, 2, 3, 4, 5, 6) - - cd = group(re.search(pattern, cd)) - lu = group(re.search(pattern, lu)) - ep = group(re.search(pattern, ep)) - sp = group(re.search(pattern, sp)) - - def str_to_int(string): - return [int(x) for x in string] - - cd = str_to_int(cd) - lu = str_to_int(lu) - ep = str_to_int(ep) - sp = str_to_int(sp) - - dict['creation_date'] = datetime(*cd) - dict['last_update'] = datetime(*lu) - dict['end_publication'] = datetime(*ep) - dict['start_publication'] = datetime(*sp) - - Gbobject(**dict).save() - - for d in srv.metaWeblog.dict_id(): - inner_parse(d['node_ptr_id']) - - server = options["server"] - srv = ServerProxy(server, allow_none=True) - parse_id() +# from django.core.management.base import BaseCommand +# from optparse import make_option + +# import re +# from datetime import datetime +# from objectapp.models import Gbobject +# from xmlrpclib import DateTime +# from xmlrpclib import ServerProxy + +# class Command(BaseCommand): +# """Gets all Gbobjects for a specified server""" +# option_list = BaseCommand.option_list + ( +# make_option("--server", action="store", type="string", +# dest="server", help="Specify an ip"),) + +# def handle(self, *args, **options): +# def parse_id(id=None): +# def inner_parse(id): +# """Gets a dict, parses and saves it""" +# dict = srv.metaWeblog.dict_id(id) +# pattern = "^(\d{4})(\d{2})(\d{2}).(\d{2}).(\d{2}).(\d{2})$" + +# cd = DateTime().make_comparable(dict['creation_date'])[1] +# lu = DateTime().make_comparable(dict['last_update'])[1] +# ep = DateTime().make_comparable(dict['end_publication'])[1] +# sp = DateTime().make_comparable(dict['start_publication'])[1] + +# def group(value): +# return value.group(1, 2, 3, 4, 5, 6) + +# cd = group(re.search(pattern, cd)) +# lu = group(re.search(pattern, lu)) +# ep = group(re.search(pattern, ep)) +# sp = group(re.search(pattern, sp)) + +# def str_to_int(string): +# return [int(x) for x in string] + +# cd = str_to_int(cd) +# lu = str_to_int(lu) +# ep = str_to_int(ep) +# sp = str_to_int(sp) + +# dict['creation_date'] = datetime(*cd) +# dict['last_update'] = datetime(*lu) +# dict['end_publication'] = datetime(*ep) +# dict['start_publication'] = datetime(*sp) + +# Gbobject(**dict).save() + +# for d in srv.metaWeblog.dict_id(): +# inner_parse(d['node_ptr_id']) + +# server = options["server"] +# srv = ServerProxy(server, allow_none=True) +# parse_id() diff --git a/gstudio/management/commands/sync-instances.py b/gstudio/management/commands/sync-instances.py new file mode 100644 index 0000000..20607bb --- /dev/null +++ b/gstudio/management/commands/sync-instances.py @@ -0,0 +1,123 @@ +# Copyright (c) 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +from django.core.management.base import BaseCommand +from optparse import make_option + +import re +import sys +from datetime import datetime + +from objectapp.models import ObjectDoesNotExist + +# from gstudio.xmlrpc.metaweblog import class_checker +from gstudio import models as gstmodels +from objectapp import models as objmodels +import inspect + +from xmlrpclib import DateTime +from xmlrpclib import ServerProxy + +from django.db.utils import IntegrityError + +class Command(BaseCommand): + """Gets all Gbobjects from a specified server""" + option_list = BaseCommand.option_list + ( + make_option("--server", action="store", type="string", + dest="server", help="Specify IP address or URI"), + make_option("--instance", action="store", type="string", + dest="instance", help="Specify an instance"),) + + def handle(self, *args, **options): + def class_checker(m): + """Returns a dict which contains all classes of the m module""" + res = {} + for name, obj in inspect.getmembers(m): + if inspect.isclass(obj) and obj.__module__ == m.__name__: + res[name] = obj + return res + + def parse(module=None, instance=None, id=None): + """Parses and saves instances""" + try: + instances = srv.metaWeblog.show_instance(module, instance, id) + + if module == "objectapp.models": + module = objmodels + + if module == "gstudio.models": + module = gstmodels + + for i in instances: + pattern = "^(\d{4})(\d{2})(\d{2}).(\d{2}).(\d{2}).(\d{2})$" + + if "_tags_cache" in i: + del i["_tags_cache"] + + if "_state" in i: + del i["_state"] + + if "_altnames_cache" in i: + del i["_altnames_cache"] + + if "_mptt_cached_fields" in i: + del i["_mptt_cached_fields"] + + def group(value): + return value.group(1, 2, 3, 4, 5, 6) + + def str_to_int(string): + return [int(x) for x in string] + + # Weird check for DateTime objects + + for key in i.keys(): + if "make_comparable" in dir(i[key]): + dt = DateTime().make_comparable(i[key])[1] + dt = str_to_int(group(re.search(pattern, dt))) + + i[key] = datetime(*dt) + + class_checker(module)[instance](**i).save() + + except (ObjectDoesNotExist, IntegrityError): + sys.stderr.write("sync-instances.py:55: " + "Object matching query does not exist\n") + + except ValueError: + sys.stderr.write("sync-instances.py:93: " + "Object already exists\n") + + server = options["server"] + srv = ServerProxy(server, allow_none=True) + + instance = options["instance"] + + objcc = class_checker(objmodels) + gstcc = class_checker(gstmodels) + + if instance: + if instance in objkeys: + parse("objectapp.models", instance) + + if instance in gstkeys: + parse("gstudio.models", instance) + + else: + for i in objkeys: + parse("objectapp.models", i) + + for i in gstkeys: + parse("gstudio.models", i) diff --git a/gstudio/methods.py b/gstudio/methods.py index 38ceb19..ad4bcee 100644 --- a/gstudio/methods.py +++ b/gstudio/methods.py @@ -2,6 +2,9 @@ from gstudio.models import * from objectapp.models import * from django.template.defaultfilters import slugify import datetime +import os +from demo.settings import PYSCRIPT_URL_GSTUDIO + def delete(idnum): del_ob = Gbobject.objects.get(id=idnum) @@ -10,10 +13,28 @@ def delete(idnum): def make_rep_object(title,auth_id): new_ob = Gbobject() - new_ob.title = title + new_ob.content_org=title + myfile = open('/tmp/file.org', 'w') + myfile.write(new_ob.content_org) + myfile.close() + myfile = open('/tmp/file.org', 'r') + myfile.readline() + myfile = open('/tmp/file.org', 'a') + myfile.write("\n#+OPTIONS: timestamp:nil author:nil creator:nil H:3 num:nil toc:nil @:t ::t |:t ^:t -:t f:t *:t <:t") + myfile.write("\n#+TITLE: ") + myfile = open('/tmp/file.org', 'r') + stdout = os.popen(PYSCRIPT_URL_GSTUDIO) + output = stdout.read() + data = open("/tmp/file.html") + data1 = data.readlines() + data2 = data1[67:] + newdata="" + for line in data2: + newdata += line.lstrip() + new_ob.content = newdata + new_ob.title = "Re: " +title new_ob.status = 2 new_ob.slug = slugify(title) - new_ob.content = "" new_ob.save() new_ob.objecttypes.add(Objecttype.objects.get(title="Reply")) new_ob.authors.add(Author.objects.get(id=auth_id)) @@ -21,17 +42,103 @@ def make_rep_object(title,auth_id): return new_ob def make_topic_object(title,auth_id,content): + print "save" new_ob = Gbobject() - new_ob.title = title + new_ob.title = "Query: " + title + new_ob.content_org = content + myfile = open('/tmp/file.org', 'w') + myfile.write(new_ob.content_org) + myfile.close() + myfile = open('/tmp/file.org', 'r') + myfile.readline() + myfile = open('/tmp/file.org', 'a') + myfile.write("\n#+OPTIONS: timestamp:nil author:nil creator:nil H:3 num:nil toc:nil @:t ::t |:t ^:t -:t f:t *:t <:t") + myfile.write("\n#+TITLE: ") + myfile = open('/tmp/file.org', 'r') + stdout = os.popen(PYSCRIPT_URL_GSTUDIO) + output = stdout.read() + data = open("/tmp/file.html") + data1 = data.readlines() + data2 = data1[67:] + newdata="" + for line in data2: + newdata += line.lstrip() + new_ob.content = newdata new_ob.status = 2 new_ob.slug = slugify(title) - new_ob.content = content + new_ob.save() new_ob.objecttypes.add(Objecttype.objects.get(title="Topic")) new_ob.authors.add(Author.objects.get(id=auth_id)) new_ob.sites.add(Site.objects.get_current()) return new_ob +def make_sectionreply_object(content_org,title,auth_id): + 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') + myfile.write(new_ob.content_org) + myfile.close() + myfile = open('/tmp/file.org', 'r') + myfile.readline() + myfile = open('/tmp/file.org', 'a') + myfile.write("\n#+OPTIONS: timestamp:nil author:nil creator:nil H:3 num:nil toc:nil @:t ::t |:t ^:t -:t f:t *:t <:t") + myfile.write("\n#+TITLE: ") + myfile = open('/tmp/file.org', 'r') + stdout = os.popen(PYSCRIPT_URL_GSTUDIO) + output = stdout.read() + data = open("/tmp/file.html") + data1 = data.readlines() + data2 = data1[67:] + newdata="" + for line in data2: + newdata += line.lstrip() + new_ob.content = newdata + myfile = open('/tmp/file.org', 'w') + # myfile.write(new_ob.content_org) + # myfile.close() + new_ob.save() + new_ob.objecttypes.add(Objecttype.objects.get(title="Subsection")) + new_ob.authors.add(Author.objects.get(id=auth_id)) + new_ob.sites.add(Site.objects.get_current()) + return new_ob + + +def make_section_object(title,auth_id,content_org): + new_ob = Gbobject() + new_ob.title = title + new_ob.status = 2 + new_ob.slug = slugify(title) + #new_ob.content = content + new_ob.content_org = content_org + myfile = open('/tmp/file.org', 'w') + myfile.write(new_ob.content_org) + myfile.close() + myfile = open('/tmp/file.org', 'r') + myfile.readline() + myfile = open('/tmp/file.org', 'a') + myfile.write("\n#+OPTIONS: timestamp:nil author:nil creator:nil H:3 num:nil toc:nil @:t ::t |:t ^:t -:t f:t *:t <:t") + myfile.write("\n#+TITLE: ") + myfile = open('/tmp/file.org', 'r') + stdout = os.popen(PYSCRIPT_URL_GSTUDIO) + output = stdout.read() + data = open("/tmp/file.html") + data1 = data.readlines() + data2 = data1[67:] + newdata="" + for line in data2: + newdata += line.lstrip() + new_ob.content = newdata + new_ob.save() + new_ob.objecttypes.add(Objecttype.objects.get(title="Section")) + new_ob.authors.add(Author.objects.get(id=auth_id)) + new_ob.sites.add(Site.objects.get_current()) + return new_ob + + def make_relation(rep,id_no,idusr): r = make_rep_object(rep,idusr) t = Gbobject.objects.get(id=id_no) @@ -39,11 +146,25 @@ def make_relation(rep,id_no,idusr): r.prior_nodes.add(t) return True +def make_sectionrelation(rep,ptitle,id_no,idusr): + r = make_sectionreply_object(rep,ptitle,idusr) + t = Gbobject.objects.get(id=id_no) + t.posterior_nodes.add(r) + r.prior_nodes.add(t) + return True + + 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 rate_section(section_id,request,rating): + ob = Gbobject.objects.get(id=section_id) + ob.rating.add(score=rating ,user=request.user, ip_address=request.META['REMOTE_ADDR']) + return True + + def create_meeting(title,idusr,content): sys = System() @@ -76,12 +197,63 @@ def create_meeting(title,idusr,content): sys.sites.add(Site.objects.get_current()) sys1.sites.add(Site.objects.get_current()) return sys.id + +def create_wikipage(title,idusr,content_org): + sys = System() + sys.title = title + sys.status = 2 + sys.content_org= content_org + myfile = open('/tmp/file.org', 'w') + myfile.write(sys.content_org) + myfile.close() + myfile = open('/tmp/file.org', 'r') + myfile.readline() + myfile = open('/tmp/file.org', 'a') + myfile.write("\n#+OPTIONS: timestamp:nil author:nil creator:nil H:3 num:nil toc:nil @:t ::t |:t ^:t -:t f:t *:t <:t") + myfile.write("\n#+TITLE: ") + myfile = open('/tmp/file.org', 'r') + stdout = os.popen(PYSCRIPT_URL_GSTUDIO) + output = stdout.read() + data = open("/tmp/file.html") + data1 = data.readlines() + data2 = data1[67:] + newdata="" + for line in data2: + newdata += line.lstrip() + sys.content = newdata + sys.slug = slugify(title) + sys.save() + sys.systemtypes.add(Systemtype.objects.get(title="Wikipage")) + sys.authors.add(Author.objects.get(id=idusr)) + + a = Attribute() + a.title = "released button of " + title + a.slug = slugify(a.title) + a.content = a.slug + a.status = 2 + a.subject = sys + a.svalue = "False" + a.attributetype_id = Attributetype.objects.get(title="pagerelease").id + a.save() + sys1 = System() + sys1.title = "page box of " + title + sys1.status = 2 + sys1.content = "contains pages of " + title + sys1.slug = slugify(title) + sys1.save() + sys1.systemtypes.add(Systemtype.objects.get(title="page_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 + def make_att_true(meet_ob): - for each in meet_ob.subject_of.all(): - if(each.attributetype.title=='release'): - each.svalue = "true" - meet_ob.subject_of.add(each) - break + for each in meet_ob.subject_of.all(): + if(each.attributetype.title=='release'): + each.svalue = "true" + meet_ob.subject_of.add(each) + break def make_att_false(meet_ob): for each in meet_ob.subject_of.all(): @@ -89,6 +261,21 @@ def make_att_false(meet_ob): each.svalue = "" meet_ob.subject_of.add(each) break + +def make_att1_true(page_ob): + for each in page_ob.subject_of.all(): + if(each.attributetype.title=='pagerelease'): + each.svalue = "true" + page_ob.subject_of.add(each) + break + +def make_att1_false(page_ob): + for each in page_ob.subject_of.all(): + if(each.attributetype.title=='pagerelease'): + each.svalue = "" + page_ob.subject_of.add(each) + break + def schedule_time(stTime, endTime, sys_id): sys=System.objects.get(id=sys_id) atty1=Attributetype.objects.get(title='timeofstart') @@ -103,6 +290,12 @@ def schedule_time(stTime, endTime, sys_id): ats.save() sys.save() return sys.id + + +def make_title(id_no): + i = Gbobject.objects.get(id=id_no) + return "Subsection of:"+i.title + def get_time(sys_id): later = False meetover = False @@ -126,8 +319,7 @@ def get_time(sys_id): def del_comment(comment_id): ob = Gbobject.objects.get(id=int(comment_id)) for each in ob.posterior_nodes.all(): - a= each.id - del_comment(a) + del_comment(each.id) ob.delete() return True @@ -137,3 +329,10 @@ def del_topic(topic_id): del_comment(each.id) ob.delete() return True + +def del_section(section_id): + ob = Gbobject.objects.get(id=int(section_id)) + for each in ob.posterior_nodes.all(): + del_comment(each.id) + ob.delete() + return True diff --git a/gstudio/models.py b/gstudio/models.py index e708538..cd529c4 100644 --- a/gstudio/models.py +++ b/gstudio/models.py @@ -457,7 +457,6 @@ class Metatype(Node): Metatype object for Nodetype """ - description = models.TextField(_('description'), blank=True, null=True) parent = models.ForeignKey('self', null=True, blank=True, verbose_name=_('parent metatype'), related_name='children') @@ -658,7 +657,7 @@ class Metatype(Node): super(Metatype, self).save(*args, **kwargs) # Call the "real" save() method. class Edge(NID): - + metatypes = models.ManyToManyField(Metatype, verbose_name=_('member of metatypes'), related_name='member_edges', blank=True, null=True) @@ -684,8 +683,6 @@ class Nodetype(Node): Model design for publishing nodetypes. Other nodetypes inherit this class. """ - - STATUS_CHOICES = ((DRAFT, _('draft')), (HIDDEN, _('hidden')), (PUBLISHED, _('published'))) @@ -1663,6 +1660,7 @@ class Relationtype(Nodetype): ''' Properties with left and right subjects (Binary relations) are defined in this class. ''' + inverse = models.CharField(_('inverse name'), help_text=_('when subjecttypes are interchanged, what should be the name of the relation type? This is mandatory field. If the relation is symmetric, same name will do.'), max_length=255,db_index=True ) left_subjecttype = models.ForeignKey(NID,related_name="left_subjecttype_of", verbose_name='left role') left_applicable_nodetypes = models.CharField(max_length=2,choices=NODETYPE_CHOICES,default='OT', verbose_name='Applicable node types for left role') @@ -1881,6 +1879,7 @@ class Attributetype(Nodetype): The rest of the fields may be required depending on what type of field is selected for datatype. ''' + subjecttype = models.ForeignKey(NID, related_name="subjecttype_of", verbose_name='subject type name') applicable_nodetypes = models.CharField(max_length=2,choices=NODETYPE_CHOICES,default='OT', verbose_name='applicable nodetypes') dataType = models.CharField(max_length=2, choices=FIELD_TYPE_CHOICES,default='01', verbose_name='data type of value') @@ -2319,6 +2318,7 @@ class AttributeTextField(Attribute): class AttributeIntegerField(Attribute): + value = models.IntegerField(max_length=100, verbose_name='Integer') def __unicode__(self): @@ -2675,6 +2675,7 @@ class Processtype(Nodetype): A kind of nodetype for defining processes or events or temporal objects involving change. """ + changing_attributetype_set = models.ManyToManyField(Attributetype, null=True, blank=True, verbose_name=_('attribute set involved in the process'), related_name=' changing_attributetype_set_of') @@ -2714,7 +2715,6 @@ class Systemtype(Nodetype): class to organize Systems """ - nodetype_set = models.ManyToManyField(Nodetype, related_name="nodetype_set_of", verbose_name='Possible edges in the system', blank=True, null=False) relationtype_set = models.ManyToManyField(Relationtype, related_name="relationtype_set_of", verbose_name='Possible nodetypes in the system', @@ -2759,6 +2759,7 @@ class AttributeSpecification(Node): proposition but a description, which can be used as a subject in another sentence. """ + attributetype = models.ForeignKey(Attributetype, verbose_name='property name') subjects = models.ManyToManyField(NID, related_name="subjects_attrspec_of", verbose_name='subjects') metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), @@ -2804,6 +2805,7 @@ class RelationSpecification(Node): """ specifying a relation with a subject """ + relationtype = models.ForeignKey(Relationtype, verbose_name='relation name') subjects = models.ManyToManyField(NID, related_name="subjects_in_relspec", verbose_name='subjects') metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), @@ -2847,6 +2849,7 @@ class NodeSpecification(Node): """ A node specified (described) by its relations or attributes or both. """ + subject = models.ForeignKey(Node, related_name="subject_nodespec", verbose_name='subject name') relations = models.ManyToManyField(Relation, related_name="relations_in_nodespec", verbose_name='relations used to specify the domain') attributes = models.ManyToManyField(Attribute, related_name="attributes_in_nodespec", verbose_name='attributes used to specify the domain') @@ -2937,6 +2940,7 @@ class Union(Node): """ union of two classes """ + nodetypes = models.ManyToManyField(Nodetype, related_name = 'union_of', verbose_name='node types for union') metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), related_name='member_unions', @@ -2969,6 +2973,7 @@ class Complement(Node): """ complement of a class """ + nodetypes = models.ManyToManyField(Nodetype, related_name = 'complement_of', verbose_name='complementary nodes') metatypes=models.ManyToManyField(Metatype,related_name='meta_complement',verbose_name=_('Metanodes'), blank=True, null= True) @@ -3001,6 +3006,7 @@ class Intersection(Node): """ Intersection of classes """ + nodetypes = models.ManyToManyField(Nodetype, related_name = 'intersection_of', verbose_name='intersection of classes') metatypes=models.ManyToManyField(Metatype,verbose_name=_('member of metatypes'), related_name='member_intersectn', @@ -3079,6 +3085,7 @@ post_save.connect(ping_external_urls_handler, sender=Nodetype, class Peer(User): """Subclass for non-human users""" + def __unicode__(self): return self.ip diff --git a/gstudio/static/gstudio/js/addcontent.js b/gstudio/static/gstudio/js/addcontent.js new file mode 100644 index 0000000..655e2f5 --- /dev/null +++ b/gstudio/static/gstudio/js/addcontent.js @@ -0,0 +1,238 @@ + $.noConflict(); + + 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(); + + // }); + // }); + }); + $("#save").one("click",function() { + var org_data = $("#gnoweditor").val(); + document.getElementById("orgpage").value = org_data; + var encode_data = encodeURIComponent(org_data); + $('#submitsec').trigger('click'); + + }); + + $("#pagecontent1").one("click",function() { + $("#chart").hide(); + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + $("#save1").show(); + }); + $("#save1").one("click",function() { + var org_data = $("#gnoweditor").val(); + document.getElementById("orgpage1").value = org_data; + 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();} + }); + } + }); + } + }); + + } + }); + + + + + + + }); + + $("#editpagecontent").one("click",function(){ + $("#chart").hide(); + $("#savepagecontent").show(); + document.getElementById('gnoweditor').style.visibility="visible"; + + $("#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 = $("#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();} + }); + } + }); + } + }); + + } + }); + + + }); + + + $("#createsubsection").one("click",function(){ + $("#savesubsec").show(); + + $("#chart").hide(); + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + $("#gnoweditor").val(''); + 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');}); + + $("#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); + + $.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();} + }); + } + }); + } + }); + + } + }); + + }); + }); + + + diff --git a/gstudio/static/gstudio/js/replycomment.js b/gstudio/static/gstudio/js/replycomment.js new file mode 100644 index 0000000..8e33eba --- /dev/null +++ b/gstudio/static/gstudio/js/replycomment.js @@ -0,0 +1,32 @@ +$.noConflict(); +jQuery(document).ready(function($) { + $(".commenteditor").one("click",function() { + $("#chart").hide(); + $("#content").css({"width": "300px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var screentop=$(document).scrollTop(); + $(".orgitdownContainer").css({"margin-top":screentop,}); + }); + + $(".commentsavecontent").one("click",function(){ + var org_data = $("#gnoweditor").val(); + + +// document.getElementByClass("commentreptext").setAttribute("value",org_data); + var elmts = document.getElementsByClassName ("commentreptext"); + for (var i = 0; i < elmts.length; i++) { + elmts[i].setAttribute("value",org_data); + } + alert(org_data); + + }); + $(".deleteresponse").one("click",function() { + var elmts=document.getElementsByClassName("deleteresponse"); + alert("hai"); + alert(elmts.length); + + + + }); +}); diff --git a/gstudio/static/gstudio/js/replytotopic.js b/gstudio/static/gstudio/js/replytotopic.js new file mode 100644 index 0000000..7f14b31 --- /dev/null +++ b/gstudio/static/gstudio/js/replytotopic.js @@ -0,0 +1,30 @@ + $.noConflict(); + jQuery(document).ready(function($) { + $(".editor").one("click",function() { + $("#chart").hide(); + $("#content").css({"width": "300px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var screentop=$(document).scrollTop(); + $(".orgitdownContainer").css({"margin-top":screentop,}); + + }); + + + $(".savecontent").one("click",function() { + alert("Please click on Submit"); + var org_data = $("#gnoweditor").val(); + + // alert(org_data); + // document.getElementsByClassName("reptext").value = org_data; + + var elmts = document.getElementsByClassName ("reptext"); + for (var i = 0; i < elmts.length; i++) { + elmts[i].setAttribute("value",org_data); + } + + }); + + + + }); diff --git a/gstudio/static/gstudio/js/topiccomment.js b/gstudio/static/gstudio/js/topiccomment.js new file mode 100644 index 0000000..611b9d1 --- /dev/null +++ b/gstudio/static/gstudio/js/topiccomment.js @@ -0,0 +1,17 @@ + $.noConflict(); + jQuery(document).ready(function($) { + $("#topicaddcontent").one("click",function() { + $("#chart").hide(); + $("#content").css({"width": "300px",}) + document.getElementById('gnoweditor').style.visibility="visible"; + $("#gnoweditor").orgitdown(mySettings); + var screentop=$(document).scrollTop(); + $(".orgitdownContainer").css({"margin-top":screentop,}); + }); + + $("#topicaddsave").one("click",function(){ + var org_data = $("#gnoweditor").val(); + $("#contenttext").val(org_data); + $('#topicsubmit').trigger('click'); + }); + }); diff --git a/gstudio/templates/gstudio/NewPage.html b/gstudio/templates/gstudio/NewPage.html new file mode 100644 index 0000000..b73b0dc --- /dev/null +++ b/gstudio/templates/gstudio/NewPage.html @@ -0,0 +1,36 @@ +{%extends "gstudio/base.html"%} +{%load i18n %} +{% block content %} +<script src="http://code.jquery.com/jquery-latest.js"></script> + <script type="text/javascript" > + $(window).load(function() { + $("#save1").hide();}); +</script> + +{%if user.is_authenticated%} +{% if errors %} +<ul> +{% for error in errors %} +<li><font color="red">{{ error }} </font></li> +{% endfor %} +</ul> +{% endif %} +<form action="" method="post"> +{% csrf_token %} + +<p>Name of the Page: <input type="text" name="subject"></p> +<textarea name="page" id="pagecontent" rows="10" cols="50" style="display:none;"></textarea></p> + +<p><textarea name="org1" id="orgpage1" rows="10" cols="50" style="display:none;" ></textarea></p></br> +<input type="button" id="pagecontent1" name="content" value="Add Content"/> +<input type="button" name="savepage" id="save1" value="Save Page"></p> +</br> +<input type="hidden" value={{user.id}} name = "idusr"> +<input type="submit" id="submitpage" value="Submit" style="display:none;"/> +</form> +{%else%} +<p> Sorry! Login To proceed </p> + +{%endif%} +{% endblock %} + diff --git a/gstudio/templates/gstudio/NewSection1.html b/gstudio/templates/gstudio/NewSection1.html new file mode 100644 index 0000000..daf29bc --- /dev/null +++ b/gstudio/templates/gstudio/NewSection1.html @@ -0,0 +1,31 @@ + +{% extends "gstudio/base.html" %} +{% block content %} +<script src="http://code.jquery.com/jquery-latest.js"></script> + <script type="text/javascript" > + $(window).load(function() { + $("#save").hide();}); +</script> +<h1>Add a new Section</h1> +{% if errors %} +<ul> +{% for error in errors %} +<li><font color="red">{{ error }} </font></li> +{% endfor %} +</ul> +{% endif %} + +<form action="" method="post">{% csrf_token %} +<p>Title: <input type="text" name="subject"></p> +<textarea name="page" id="pagecontent" rows="10" cols="50" style="display:none;"></textarea></p> +<p><textarea name="org" id="orgpage" rows="10" cols="50" style="display:none;"></textarea></p> +</br></br> + +<input type="button" id="addcontent" name="content" value="Add Content"/> +<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="submit" id="submitsec" value="Submit" style="display:none;"/> +</form> + +{% endblock %} diff --git a/gstudio/templates/gstudio/NewTopic1.html b/gstudio/templates/gstudio/NewTopic1.html index 38a61c5..5f2db82 100644 --- a/gstudio/templates/gstudio/NewTopic1.html +++ b/gstudio/templates/gstudio/NewTopic1.html @@ -1,7 +1,20 @@ {% extends "gstudio/base.html" %} {% block content %} -<h1>Add a new Topic</h1> +<script src="http://code.jquery.com/jquery-latest.js"></script> + <script type="text/javascript" > + $(window).load(function() { + $("#content").css({ + "width": "1000px",});}); +$(window).load(function() { + $("#chart").hide();}); +$(window).load(function() { + + $("#graphcss").hide(); + }); +</script> + +<h1>Add a new Twist</h1> {% if errors %} <ul> {% for error in errors %} @@ -12,9 +25,14 @@ <form action="" method="post">{% csrf_token %} <p>Title: <input type="text" name="subject"></p> -<p>Description: <textarea name="message" rows="10" cols="50"></textarea></p> +<p>Description: <textarea name="message" id="contenttext" rows="10" cols="50" style="display:none" ></textarea></p> +<!-- style="display:none;" --> + +<input type="button" id="topicaddcontent" name="content" value="Add Description"> +<input type="button" id="topicaddsave" name="savecontent" value="Save"> + <input type="hidden" value={{user.id}} name = "idusr"> -<input type="submit" value="Submit"> +<input type="submit" id="topicsubmit" value="Submit" style="display:none"> </form> {% endblock %} diff --git a/gstudio/templates/gstudio/_header.html b/gstudio/templates/gstudio/_header.html index 08fdab2..1a5de32 100644 --- a/gstudio/templates/gstudio/_header.html +++ b/gstudio/templates/gstudio/_header.html @@ -15,8 +15,9 @@ {% if user.is_authenticated %} {% if user.is_staff %} - | <a href="{{ get_absolute_url }}/gstudio/user/{{user.username}}" title="MyBoard">Gnowledge Studio</a> + | <a href="{{ get_absolute_url }}/gstudio/user/{{user.username}}" title="My Loom Studio">Loom Studio</a> | <a href="{{ get_absolute_url }}/gstudio/resources/documents" title="My Documents">Documents</a> + | <a href="{{ get_absolute_url }}/gstudio/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> diff --git a/gstudio/templates/gstudio/nodetype_detail.html b/gstudio/templates/gstudio/nodetype_detail.html index 95cf45b..73db903 100644 --- a/gstudio/templates/gstudio/nodetype_detail.html +++ b/gstudio/templates/gstudio/nodetype_detail.html @@ -214,7 +214,7 @@ <b> Content:<nbsp> - <input type="button" id="editdata" value="Edit Content"/><ndsp><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}}"/> @@ -223,8 +223,10 @@ {% else %} <b> - Content:<nbsp> <input type="button"id="editdata" value="Edit Content"/><ndsp><nbsp> - <input type="hidden" id="objectid" value="{{object.id}}"/> + 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}}"/> diff --git a/gstudio/templates/gstudio/tags/comment.html b/gstudio/templates/gstudio/tags/comment.html index cf446fe..8e1d480 100644 --- a/gstudio/templates/gstudio/tags/comment.html +++ b/gstudio/templates/gstudio/tags/comment.html @@ -15,54 +15,166 @@ <!-- Flag1 outside {{flag}}--> {% for each in child.authors.all %} {% ifequal idusr admin_id %} - <li>{{each}} says <font style = "color:red;" size = 3>{{child.title}}</font> - <form method="post" action=".">{% csrf_token %} - <input type="text" name = "reply"> - <input type="hidden" value={{child.id}} name = "parentid"> - <input type="hidden" value={{idusr}} name="idusr"> - <input type="submit" value="Post a Reply"> - <input type="checkbox" name="del_comment" value="delete_comment"> - <input type="submit" value="delete this comment"> - </form> - {% show_comment 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 = "reply"> - <input type="hidden" value={{child.id}} name = "parentid"> - <input type="hidden" value={{idusr}} name="idusr"> - <input type="submit" value="Post a Reply"> - <input type="checkbox" name="del_comment" value="delete_comment"> - <input type="submit" value="delete this comment"> - </form> - {% show_comment 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 = "reply"> - <input type="hidden" value={{child.id}} name = "parentid"> - <input type="hidden" value={{idusr}} name="idusr"> - <input type="submit" value="Post a Reply"> - <input type="checkbox" name="del_comment" value="delete_comment"> - <input type="submit" value="delete this comment"> - </form> - {% show_comment child idusr flag admin_id attribute%} - </li> - {% endifequal %} - {% endifequal %} - {% endifequal %} - {% endfor %} - - -{% endfor %} -</ul> +<!-- If user is admin --> +<div class="response_change" id="divchange"> +<script type="text/javascript"> +i = i+1; +if (i%2 == 0) +{ +document.getElementById("divchange").setAttribute("id","div1"); +} +else +{ +document.getElementById("divchange").setAttribute("id","div2"); +} +</script> + + + <li>{{each}}'s fabric +{% if child.rating.get_rating %} +Current rating is {{ child.rating.get_rating }}<br/> {% 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" 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/> + Do you wanna rate it ? </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"/> + <input name="star1" type="radio" value=5 class="star"/> + <!--topic id and user id hidden fields--> + </br> + <input type="submit" value="Rate Response"> + </form> +</div> + + + {% show_comment child idusr flag admin_id attribute%} + + + {% else %} + {% ifequal idusr each.id %} + +<div class="response_change" id="divchange"> +<script type="text/javascript"> +i = i+1; +if (i%2 == 0) +{ +document.getElementById("divchange").setAttribute("id","div1"); +} +else +{ +document.getElementById("divchange").setAttribute("id","div2"); +} +</script> +{{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}} + <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"> + + +<br/> + Do you wanna rate it ? </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"/> + <input name="star1" type="radio" value=5 class="star"/> + <!--topic id and user id hidden fields--> + </br> + <input type="submit" value="Rate Response"> + + </form> +</div> + {% show_comment child idusr flag admin_id attribute%} + + + {% else %} + {% ifequal attribute "true" %} + +<div class="response_change" id="divchange"> +<script type="text/javascript"> +i = i+1; +if (i%2 == 0) +{ +document.getElementById("divchange").setAttribute("id","div1"); +} +else +{ +document.getElementById("divchange").setAttribute("id","div2"); +} +</script> + {{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}} + + <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/> + Rate this 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"/> + <input name="star1" type="radio" value=5 class="star"/> + <!--topic id and user id hidden fields--> + </br> + <input type="submit" value="Rate Response"> + + </form> + +</div> + + {% show_comment child idusr flag admin_id attribute%} {% endifequal %} + {% endifequal %} + {% endifequal %} + {% endfor %} + {% endfor %} +</ul> +{% endif %} diff --git a/gstudio/templates/gstudio/tags/commentpage.html b/gstudio/templates/gstudio/tags/commentpage.html new file mode 100644 index 0000000..a55f4ed --- /dev/null +++ b/gstudio/templates/gstudio/tags/commentpage.html @@ -0,0 +1,97 @@ + + + + +{% load gstudio_tags %} +{% load i18n %} +{% load tagging_tags comments i18n %} + + + + +{% 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}} + <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="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> + <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" /> + </form> + <br> + <div class="tags"> + <p class="gbobject-tags span-16 last"> + <strong>{% trans "Tags" %}</strong> : + {% tags_for_object child 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> + + </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 %} + + +{% endfor %} +</ul> +{% endif %} + + diff --git a/gstudio/templates/metadashboard/grpdashboard.html b/gstudio/templates/metadashboard/grpdashboard.html index e92f616..f6cb6c0 100644 --- a/gstudio/templates/metadashboard/grpdashboard.html +++ b/gstudio/templates/metadashboard/grpdashboard.html @@ -14,14 +14,25 @@ $(window).load(function() { $("#graphcss").hide(); }); +var i=0; </script> +<style type="text/css"> +#div2 +{ + background-color:#E8E8E8 ; +} +#div1 +{ + background-color:#F4F4F4; +} +</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> This Discussion was initiated by {{admin_m.username}}</h3> +<!-- <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> - <h>You are logged in as <font color="blue">{{user.username}}</font></h> + <!-- <h>You are logged in as <font color="blue">{{user.username}}</font></h> --> </br> {%if flag %} <div id="Release"> @@ -42,55 +53,60 @@ $(window).load(function() { <form method="post" action=".">{% csrf_token %} <!-- <input type="hidden" value="{{meet_ob.id}}" name = "meetid">--> - <input type="button" value="Add a new Topic" onClick="location.href=parseURL('topicadd1/{{meet_ob.id}}');"> + <input type="button" value="Add your twist" onClick="location.href=parseURL('topicadd1/{{meet_ob.id}}');"> </form> - -<!--direct link to identica--> +<!-- 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 --> +<!-- 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 --> +<!-- 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> <div id="R-button" style="width:44px;height:44px;cursor:pointer;"> <img id="asterisk" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAYAAACN1PRVAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQ1JREFUeNpi/P//PwO9ACMJajuA2BiL+FkgriDGABYSLANZ5EKJz5gY6AhGLaO6ZaAEoERl85WQUzCyZeVAfBeIz0DZShRYUA41B2ReGjZF/7FgZIt341CzG80CdPl36BaF4jCIWjgUORhdaJw2UMx/R2OfgYOSGYgFgfgoED8HYikon1rgHhDPAuJOIH6PqwzEFdnEYFiiMiYnGc8k0pIOSkNFiYT4fEepZbtJDMJV5FpUTmaclZNqkTER8YMvOIlOHIIEUmIHET4/Q0pb4z+echAZrCLCUXiLFVJSmyC0ZMelh2AxGIojubuQEL/vYIUvsflrNwkprBxLlUNW8ic276wi5ChGeraIAQIMAFUG5PAQfeaJAAAAAElFTkSuQmCC" width="26" height="26"> </div> - +--> </br> {% autoescape off %} {% for each in topic %} <h4><font size="5" color="red">{{each.title}}</font></h4> Posted on : {{each.creation_date}} - Posted by : + by : {% for author in each.authors.all %} {{author}} {% endfor %}</br> - Current rating is <h5>{{ each.rating.get_rating }}</h5> + <!-- Current rating is <h5>{{ each.rating.get_rating }}</h5> --> {%autoescape on%} - <font color="green">{{each.content}}</font> + {% with each.html_content|safe as each_content %} + <font color="green"> {{each_content}} </font> + {% endwith %} {% endautoescape%} <form method="post" action=".">{% csrf_token %} - Reply to the main thread : - <input type="text" name = "reply"> + + <input type="text" class="reptext" name = "reply" style="display:none"> <input type="hidden" value="{{each.id}}" name = "iden"> <input type="hidden" value="{{user.id}}" name = "idusr"> - <input type="submit" value="Reply to Topic"></br> - <!--<input name="del_topic" type="checkbox" value="delete_topic"/>Delete topic - <input type="submit" value="Delete the topic"></br> ---> - Do you wanna rate it ? </br> +<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> + + <!-- Rate this ? </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"/> <input name="star1" type="radio" value=5 class="star"/> - <!--topic id and user id hidden fields--> + <!--topic id and user id hidden fields </br> - <input type="submit" value="Rate it!!!"> + <input type="submit" value="Rate it!!!"> --> </form> <p> - Replies : + Fibers : <!-- <div id="main"> <div id="sidetree"> <div class="treeheader"> </div> diff --git a/gstudio/templates/metadashboard/pgedashboard.html b/gstudio/templates/metadashboard/pgedashboard.html new file mode 100644 index 0000000..f06063a --- /dev/null +++ b/gstudio/templates/metadashboard/pgedashboard.html @@ -0,0 +1,203 @@ +{% extends "gstudio/base.html" %} +{% load i18n comments gstudio_tags %} +{% load adminmedia grp_tags %} +{% load gstudio_tags %} +{% load pagination_tags %} +{% load i18n objectapp_tags %} +{% load tagging_tags comments i18n %} + +<!-- {% load i18n %} --> +{% block content %} +<style> +<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" /> +</style> +<script src="http://code.jquery.com/jquery-latest.js"></script> + <script type="text/javascript" > + $(window).load(function() { + $("#content").css({ + "width": "500px",});}); +$(window).load(function() { + $("#chart").hide();}); +$(window).load(function() { + + $("#graphcss").hide(); + }); +$(window).load(function() { + + $("#savepagecontent").hide(); + $("#saveseccontent").hide(); + $("#savesubsec").hide(); + $("#savesubsec1").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> + Wikipage posted on : {{page_ob.creation_date}} + by {% for author in page_ob.authors.all %} + {{author}} + {% endfor %}</br></br> + + {% with page_ob.html_content|safe as page_ob_content %} + + {{page_ob_content}} + {% endwith %} + + <input type="button" id="editpagecontent" value="Edit"/> + <input type="button" id="savepagecontent" value="Save"/></br> + <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" /> + </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> + <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;"/> + <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> + +</br> {% autoescape off %} + + {% for each in section %} + <h4><font size="5" color="red">{{each.title}}</h4></font> + Posted on : {{each.creation_date}} + by {% for author in each.authors.all %} + {{author}} + {% endfor %}</br> + {% ifequal each.rating.get_rating 0 %} + <h5> Not yet rated </h5> + {% else %} + Current rating is <h5>{{ each.rating.get_rating }}</h5> + {% endifequal %} + {%autoescape on%} + {% with each.html_content|safe as each_content %} + {{each_content}} + {% endwith %} + {% endautoescape%} + <input type="button" id="editseccontent" value="Edit"/> + <input type="button" id="saveseccontent" value="Save"/> + <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" /> + </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> + + <input type="button" id="sectionorg" value="{{each.content_org}}" style="visibility:hidden;"/> + <input type="button" id="sectionid" value="{{each.id}}" style="visibility:hidden;"/> + <form method="post" action=".">{% csrf_token %}<br/> + Create Subsection: + <input type="text" name = "replytosection" id="sectionreply" style="visibility:hidden;"/></br> + <input type="hidden" value="{{each.id}}" name = "iden"> + <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> + + </br></br><input name="del_section" type="checkbox" value="delete_section"/> + <input type="submit" value="Delete the section"></br> + Do you wanna rate it ? </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"/> + <input name="star1" type="radio" value=5 class="star"/> + <!--topic id and user id hidden fields--> + </br> + <input type="submit" value="Rate it!!!"> + </form> + <p> + Subsections : + <!-- <div id="main"> --> + <!-- <div id="sidetree"> --> + <!-- <div class="treeheader"> </div> --> + <!-- <a href="?#">Expand All</a> </div> --> + <!-- <ul class="treeview" id="tree"> --> + <!-- <li class="expandable"><div class="hitarea expandable-hitarea"></div>Expand the replies</li></ul></div> --> + {% show_commentpage each user.id flag1 admin_id attribute %} + {% endfor %} +{% endautoescape %} + +{% else %} + <h1> <p style = "color :red;">OOPS!!! Login Please!</p></h1> +{% endif %} + +{% block nodetype-comments %} +<div id="comments" class=""> + <h5>{% trans "Comments" %}</h5> + {% with page_ob.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 page_ob.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 page_ob.comments_are_open %} + <p>{% trans "Comments are closed." %}</p> + {% endif %} + {% else %} + {% if page_ob.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 ot %} +</div> + +{% paginate %} + +{% endblock %} + diff --git a/gstudio/templates/metadashboard/userdashboard.html b/gstudio/templates/metadashboard/userdashboard.html index e02f4ba..a8342b1 100644 --- a/gstudio/templates/metadashboard/userdashboard.html +++ b/gstudio/templates/metadashboard/userdashboard.html @@ -5,20 +5,20 @@ {% if user.is_authenticated %} - <h> Welcome to the GnowledgeStudio</h></br> +<!-- <h> Welcome to the GnowledgeStudio</h></br> <h>You are logged in as <font color="blue">{{user.username}}</font></h> - <p></br> -<p> Here is a list of all the groups:</p> + <p></br> --> +<p> On the loom now:</p> </br> {% for each in meetings.member_systems.all %} <a href="/gstudio/group/gnowsys-grp/{{each.id}}/">{{each.title}}</a></br> {% endfor %} - <input type="button" value="Create a new meeting" onClick="location.href=parseURL('groupadd/');"> + <input type="button" value="Want to weave a thread?" onClick="location.href=parseURL('groupadd/');"> </p> <p> </br> {% else %} - <h1> <p style = "color :black;">OOPS!!! Login Please!</p></h1> + <h1> <p style = "color :black;">Please Login</p></h1> {% endif %} diff --git a/gstudio/templates/metadashboard/wikidashboard.html b/gstudio/templates/metadashboard/wikidashboard.html new file mode 100644 index 0000000..8b9d15e --- /dev/null +++ b/gstudio/templates/metadashboard/wikidashboard.html @@ -0,0 +1,24 @@ +{% extends "gstudio/base.html" %} +{% load gstudio_tags %} +{% load i18n %} +{% 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 %} + <input type="button" value="Create a new page" onClick="location.href=parseURL('pageadd/');"> + </p> + <p> + </br> +{% else %} + <h1> <p style = "color :black;">OOPS!!! Login Please!</p></h1> +{% endif %} + + + +{% endblock %} diff --git a/gstudio/templatetags/gstudio_tags.py b/gstudio/templatetags/gstudio_tags.py index c5954ab..d79c658 100644 --- a/gstudio/templatetags/gstudio_tags.py +++ b/gstudio/templatetags/gstudio_tags.py @@ -385,3 +385,7 @@ def get_tag_cloud(steps=6, template='gstudio/tags/tag_cloud.html'): @register.inclusion_tag('gstudio/tags/comment.html') def show_comment(comment,idusr,flag,admin_id,attob): return {'comment':comment , 'idusr' : idusr, "flag" : flag, "admin_id" : admin_id , "attribute" : 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} diff --git a/gstudio/urls/__init__.py b/gstudio/urls/__init__.py index d9f65cd..efc6305 100644 --- a/gstudio/urls/__init__.py +++ b/gstudio/urls/__init__.py @@ -39,10 +39,14 @@ urlpatterns = patterns( url(r'^', include('gstudio.urls.capabilities')), url(r'^', include('gstudio.urls.nodetypes')), 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'groupadd/', include('gstudio.urls.groupadd')), + url(r'pageadd/', include('gstudio.urls.pageadd')), url(r'group/',include('gstudio.urls.group')), + url(r'page/',include('gstudio.urls.page')), url(r'^resources/images/',include('gstudio.urls.image')), url(r'^resources/videos/',include('gstudio.urls.video')), url(r'^resources/documents',include('gstudio.urls.docu')), diff --git a/gstudio/urls/page.py b/gstudio/urls/page.py new file mode 100644 index 0000000..23df1e3 --- /dev/null +++ b/gstudio/urls/page.py @@ -0,0 +1,27 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + + +"""Url for Gstudio User Dashboard""" +from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns + +urlpatterns = patterns('gstudio.views.page', + url(r'^gnowsys-page/(\d+)/$', 'pagedashboard', name='gstudio_page'), + # url(r'^later$', 'grouplater', name='gstudio_group'), + # url(r'^over$', 'groupover', + # name='gstudio_group'), + ) diff --git a/gstudio/urls/pageadd.py b/gstudio/urls/pageadd.py new file mode 100644 index 0000000..8aa4b10 --- /dev/null +++ b/gstudio/urls/pageadd.py @@ -0,0 +1,20 @@ +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +"""Url for Gstudio User Dashboard""" +from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns + +urlpatterns = patterns('gstudio.views.pageadd', + url(r'^$', 'pageadd', + name='gstudio_page'), + + ) diff --git a/gstudio/urls/sectionadd1.py b/gstudio/urls/sectionadd1.py new file mode 100644 index 0000000..592b493 --- /dev/null +++ b/gstudio/urls/sectionadd1.py @@ -0,0 +1,9 @@ +"""Url for Gstudio User Dashboard""" +from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns + +urlpatterns = patterns('gstudio.views.sectionadd1', + url(r'(\d+)', 'sectionadd1', + name='gstudio_section'), + + ) diff --git a/gstudio/urls/user.py b/gstudio/urls/user.py index 12031d3..7b73c8a 100644 --- a/gstudio/urls/user.py +++ b/gstudio/urls/user.py @@ -20,7 +20,8 @@ from django.conf.urls.defaults import url from django.conf.urls.defaults import patterns urlpatterns = patterns('gstudio.views.user', - url(r'^$', 'userdashboard', - name='gstudio_user'), + url(r'^$', 'userdashboard',name='gstudio_user'), + url(r'^wikipage/$', 'wikidashboard', name='gstudio_wiki'), + ) diff --git a/gstudio/views/group.py b/gstudio/views/group.py index 157e276..d38b5ae 100644 --- a/gstudio/views/group.py +++ b/gstudio/views/group.py @@ -54,7 +54,8 @@ def groupdashboard(request,grpid): rep = request.POST.get("reply",'') id_no = request.POST.get("iden",'') id_no1 = request.POST.get("parentid","") - idusr = request.POST.get("idusr",'') + print "topicid",id_no,"replyid",id_no1,"reply",rep + idusr = request.POST.get("idusr",'') rating = request.POST.get("star1","") flag1=request.POST.get("release","") block = request.POST.get("block","") diff --git a/gstudio/views/page.py b/gstudio/views/page.py new file mode 100644 index 0000000..e59caec --- /dev/null +++ b/gstudio/views/page.py @@ -0,0 +1,89 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +from django.http import HttpResponse +from django.http import HttpResponseRedirect +from django.template import RequestContext +from django.shortcuts import render_to_response +from gstudio.models import * +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",'') + 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","") + if section_del: + del_section(int(id_no)) + if comment_del: + del_comment(int(id_no1)) + if rating : + rate_section(int(id_no),request,int(rating)) + if addtags != "": + i=Gbobject.objects.get(id=docid) + i.tags = i.tags+ ","+str(texttags) + i.save() + + if rep : + if not id_no : + ptitle= make_title(int(id_no)) + boolean = make_sectionrelation(rep,ptitle,int(id_no1),int(idusr)) + + + elif not id_no1 : + ptitle= make_title(int(id_no)) + boolean = make_sectionrelation(rep,ptitle,int(id_no),int(idusr)) + + if boolean : + return HttpResponseRedirect("/gstudio/page/gnowsys-page/"+str(pageid)) + pageid = int(pageid) + if request.user.id == page_ob.authors.all()[0].id : + 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') + if(len(topic_type_set.get_members)): + latest_topic=topic_type_set.get_members[0] + post=latest_topic.get_absolute_url() + else: + post="no topic added yet!!" + ot=Gbobject.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 new file mode 100644 index 0000000..4f63ead --- /dev/null +++ b/gstudio/views/pageadd.py @@ -0,0 +1,41 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +from django.http import HttpResponse +from django.http import HttpResponseRedirect +from django.template import RequestContext +from django.shortcuts import render_to_response +from gstudio.models import * +from gstudio.methods import * +import datetime +def pageadd(request): + errors = [] + pageId = "" + if request.method == 'POST': + if not request.POST.get('subject', ''): + errors.append('Enter a title.') + # if not request.POST.get('org1', ''): + # errors.append('Enter a page.') + if not errors: + title=request.POST['subject'] + # content=request.POST['page'] + content_org=request.POST['org1'] + idusr=request.POST['idusr'] + pageId = create_wikipage(title,int(idusr),content_org) + if pageId : + return HttpResponseRedirect('/gstudio/page/gnowsys-page/'+ str(pageId)) + variables = RequestContext(request,{'errors' : errors, 'pageId' : pageId}) + template = "gstudio/NewPage.html" + return render_to_response(template, variables) diff --git a/gstudio/views/sectionadd1.py b/gstudio/views/sectionadd1.py new file mode 100644 index 0000000..0c5643c --- /dev/null +++ b/gstudio/views/sectionadd1.py @@ -0,0 +1,36 @@ + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + + +from django.http import HttpResponse +from django.http import HttpResponseRedirect +from django.template import RequestContext +from django.shortcuts import render_to_response +from gstudio.models import * +from gstudio.methods import * + +def sectionadd1(request,pageid): + errors = [] + if request.method == 'POST': + if not request.POST.get('subject', ''): + errors.append('Enter a title.') + if not request.POST.get('org', ''): + errors.append('Enter a page.') + if not errors: + title=request.POST['subject'] + # content=request.POST['page'] + content_org=request.POST['org'] + idusr=request.POST['idusr'] + tp = make_section_object(title,int(idusr),content_org) + System.objects.get(id=int(pageid)).system_set.all()[0].gbobject_set.add(tp) + if tp: + return HttpResponseRedirect('/gstudio/page/gnowsys-page/'+pageid) + + + variables = RequestContext(request,{'errors' : errors,'pageid' : pageid}) + template = "gstudio/NewSection1.html" + return render_to_response(template, variables) + + diff --git a/gstudio/views/user.py b/gstudio/views/user.py index 10e1ff7..9fa9b6d 100644 --- a/gstudio/views/user.py +++ b/gstudio/views/user.py @@ -32,6 +32,17 @@ def userdashboard(request,username): template = "metadashboard/logindashboard.html" return render_to_response(template,variables) +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) + diff --git a/gstudio/views/wikidashboard.py b/gstudio/views/wikidashboard.py new file mode 100644 index 0000000..ed08b9d --- /dev/null +++ b/gstudio/views/wikidashboard.py @@ -0,0 +1,61 @@ +# Copyright (c) 2011, 2012 Free Software Foundation + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + +# This project incorporates work covered by the following copyright and permission notice: + +# Copyright (c) 2009, Julien Fache +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: + +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the author nor the names of other +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. + + + +from django.http import HttpResponse +from django.http import HttpResponseRedirect +from django.template import RequestContext +from django.shortcuts import render_to_response + +def wikidashboard(request): + variables = RequestContext(request) + template = "gstudiodashboard/dashboard.html" + return render_to_response(template, variables) + + diff --git a/gstudio/xmlrpc/__init__.py b/gstudio/xmlrpc/__init__.py index 9b91635..351ca47 100644 --- a/gstudio/xmlrpc/__init__.py +++ b/gstudio/xmlrpc/__init__.py @@ -126,10 +126,13 @@ GSTUDIO_XMLRPC_METAWEBLOG = [ 'metaWeblog.setRelation'), ('gstudio.xmlrpc.metaweblog.get_gbobject_neighbourhood', 'metaWeblog.getGbobjectNeighbourhood'), - ('gstudio.xmlrpc.metaweblog.list_id', - 'metaWeblog.list_id'), - ('gstudio.xmlrpc.metaweblog.dict_id', - 'metaWeblog.dict_id')] - + # ('gstudio.xmlrpc.metaweblog.list_id', + # 'metaWeblog.list_id'), + # ('gstudio.xmlrpc.metaweblog.dict_id', + # 'metaWeblog.dict_id'), + ('gstudio.xmlrpc.metaweblog.show_id', + 'metaWeblog.show_id'), + ('gstudio.xmlrpc.metaweblog.show_instance', + 'metaWeblog.show_instance')] GSTUDIO_XMLRPC_METHODS = GSTUDIO_XMLRPC_PINGBACK + GSTUDIO_XMLRPC_METAWEBLOG diff --git a/gstudio/xmlrpc/metaweblog.py b/gstudio/xmlrpc/metaweblog.py index a77ab82..2e5e03d 100644 --- a/gstudio/xmlrpc/metaweblog.py +++ b/gstudio/xmlrpc/metaweblog.py @@ -47,6 +47,7 @@ # OF THE POSSIBILITY OF SUCH DAMAGE. """XML-RPC methods of Gstudio metaWeblog API""" import os +import sys from datetime import datetime from xmlrpclib import Fault from xmlrpclib import DateTime @@ -74,7 +75,10 @@ from django.utils.datastructures import SortedDict from gstudio.models import * from django.contrib.auth.models import User - +import inspect +from gstudio import models as gstmodels +from objectapp import models as objmodels +from objectapp.models import ObjectDoesNotExist # http://docs.nucleuscms.org/blog/12#errorcodes LOGIN_ERROR = 801 @@ -833,15 +837,104 @@ def set_relation(d,obj1,obj2) : except Relationtype.DoesNotExist : return "Relationtype Does Not Exist" -@xmlrpc_func(returns='list') -def list_id(): - """Get a list of Gbobjects' ids""" - return [id.id for id in Gbobject.objects.all()] +# Previous version of ``show_id`` and ``show_instance`` + +# @xmlrpc_func(returns='list') +# def list_id(): +# """Get a list of Gbobjects' ids""" +# return [id.id for id in Gbobject.objects.all()] + +# @xmlrpc_func(returns='struct', args=['string']) +# def dict_id(id=None): +# """Get a Gbobject as a dict or as a list of dicts""" +# if id: +# return Gbobject.objects.get(id="{0}".format(id)) +# else: +# return [dict_id(id) for id in list_id()] + +def class_checker(m): + """Returns a dict which contains all classes of the m module""" + res = {} + for name, obj in inspect.getmembers(m): + if inspect.isclass(obj) and obj.__module__ == m.__name__: + res[name] = obj + return res + +def instance_checker(m, instance, option, id=None): + cc = class_checker(m) + for i in cc.keys(): + if i == instance: + if option == "get": + return cc[i].objects.get(id="{0}".format(id)) + + if option == "all": + return [id.id for id in cc[i].objects.all()] + else: + sys.stderr.write("metaweblog.py:865-871: Wrong arguments\n") + +@xmlrpc_func(returns="struct", args=["string", "string"]) +def show_id(module=None, instance=None): + if (module == "objectapp.models" or module == objmodels) and instance: + return instance_checker(objmodels, instance, "all") + + if (module == "gstudio.models" or module == gstmodels) and instance: + return instance_checker(gstmodels, instance, "all") + + if module == None and instance == None: + def show_all(m): + res = {} + for i in class_checker(m).keys(): + res[i] = show_id(m, i) + return res + + gstres = show_all(gstmodels) + objres = show_all(objmodels) + return gstres, objres -@xmlrpc_func(returns='struct', args=['string']) -def dict_id(id=None): - """Get a Gbobject as a dict or as a list of dicts""" - if id: - return Gbobject.objects.get(id="{0}".format(id)) else: - return [dict_id(id) for id in list_id()] + sys.stderr.write("metaweblog.py:877-892: Wrong arguments\n") + +@xmlrpc_func(returns="struct", args=["string", "string", "string"]) +def show_instance(module=None, instance=None, id=None): + try: + if ((module == "objectapp.models" or module == objmodels) and + instance and id): + return instance_checker(objmodels, instance, "get", id) + + if ((module == "gstudio.models" or module == gstmodels) and + instance and id): + return instance_checker(gstmodels, instance, "get", id) + + if ((module == "objectapp.models" or module == objmodels) and + instance): + res = [] + for i in show_id(objmodels, instance): + res.append(instance_checker(objmodels, instance, "get", i)) + return res + + if ((module == "gstudio.models" or module == gstmodels) and + instance): + res = [] + for i in show_id(gstmodels, instance): + res.append(instance_checker(gstmodels, instance, "get", i)) + return res + + if module == None and instance == None and id == None: + def show_all(m, index): + res = [] + for k in show_id()[index].keys(): + for v in show_id()[index][k]: + res.append(show_instance(m, k, v)) + return res + + res = [] + res.append(show_all(gstmodels, 0)) + res.append(show_all(objmodels, 1)) + return res + + else: + sys.stderr.write("metaweblog.py:900-933: Wrong arguments\n") + + except ObjectDoesNotExist: + sys.stderr.write("metaweblog.py:900-933: " + "Object matching query does not exist\n") diff --git a/objectapp/models.py b/objectapp/models.py index 77643a2..41d6639 100644 --- a/objectapp/models.py +++ b/objectapp/models.py @@ -155,7 +155,6 @@ class Gbobject(Node): base. System and Process classes also inherit this class. """ - STATUS_CHOICES = ((DRAFT, _('draft')), (HIDDEN, _('hidden')), (PUBLISHED, _('published'))) @@ -749,8 +748,8 @@ class Gbobject(Node): return textile(self.content) elif MARKUP_LANGUAGE == 'restructuredtext': return restructuredtext(self.content) - elif not '</p>' in self.content: - return linebreaks(self.content) + # elif not '</p>' in self.content: + # return linebreaks(self.content) return self.content @@ -879,6 +878,7 @@ class Process(Gbobject): """ A store processes, events or changes described as changes in attributes and relations """ + processtypes = models.ManyToManyField(Processtype, verbose_name=_('member of process type'), related_name='member_processes', blank=True, null=True) diff --git a/objectapp/templates/objectapp/_gbobject_detail.html b/objectapp/templates/objectapp/_gbobject_detail.html index 2680c8a..a070716 100644 --- a/objectapp/templates/objectapp/_gbobject_detail.html +++ b/objectapp/templates/objectapp/_gbobject_detail.html @@ -68,6 +68,7 @@ Content:<nbsp> <input type="button" id="editdata" value="Edit Content"/><ndsp><nbsp> + <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}}"/> diff --git a/objectapp/templates/objectapp/skeleton.html b/objectapp/templates/objectapp/skeleton.html index 4da343e..2fb9eed 100644 --- a/objectapp/templates/objectapp/skeleton.html +++ b/objectapp/templates/objectapp/skeleton.html @@ -52,9 +52,9 @@ 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); --> +<!-- } --> .orgitdown .orgitdownButton2 a { background-image:url(/static/gstudio/js/orgitdown/orgitdown/sets/default/images/bold.png); } |