summaryrefslogtreecommitdiff
path: root/gstudio/views
diff options
context:
space:
mode:
authorsupriya <supriya@dragbox.(none)>2012-08-07 11:41:01 +0530
committersupriya <supriya@dragbox.(none)>2012-08-07 11:41:01 +0530
commita97d8967426bda55381e0f235b26e51777228f5a (patch)
tree532dda45192f6b7dc03b716f21174702c880966a /gstudio/views
parente08547938d44b756fd1af529429f208214c36522 (diff)
downloadgnowsys-a97d8967426bda55381e0f235b26e51777228f5a.tar.gz
Wikipage added to gstudio
Diffstat (limited to 'gstudio/views')
-rw-r--r--gstudio/views/page.py79
-rw-r--r--gstudio/views/pageadd.py41
-rw-r--r--gstudio/views/sectionadd1.py36
-rw-r--r--gstudio/views/user.py11
-rw-r--r--gstudio/views/wikidashboard.py61
5 files changed, 228 insertions, 0 deletions
diff --git a/gstudio/views/page.py b/gstudio/views/page.py
new file mode 100644
index 0000000..71111ff
--- /dev/null
+++ b/gstudio/views/page.py
@@ -0,0 +1,79 @@
+# 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","")
+ 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", "")
+ 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 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!!"
+
+ variables = RequestContext(request, {'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)
+
+