summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvadoot Nachankar <avadoot298@gmail.com>2014-05-15 17:52:53 +0530
committerAvadoot Nachankar <avadoot298@gmail.com>2014-05-15 17:52:53 +0530
commit6cad49a1e3d35338a215d46e75b8798e8d6de737 (patch)
tree5435348168135f8c423235dade9d25097dd50906
parent5fe9e7b0a7cb7e9be3c13a025aba22d163e57227 (diff)
downloadgnowsys-6cad49a1e3d35338a215d46e75b8798e8d6de737.tar.gz
MIS-GAPP: Modification regarding url's mapping and display.
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis.html15
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py9
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/urls/mis.py13
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py93
4 files changed, 71 insertions, 59 deletions
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis.html
index e61368a3..074cea55 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis.html
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis.html
@@ -75,8 +75,9 @@
{% else %}
<li>
{% endif %}
+
<div class="row">
- {% if each.type_of or each.name == "Caste" %}
+ {% if each.type_of or each.name == "Caste" or each.name == "Course" %}
<a class="small-8 columns" href="{% url 'mis_app_detail' groupid app_id each.pk %}" title="View all {{each.name}}'s">
{{each.name}} ({{count}})
</a>
@@ -96,18 +97,6 @@
{% endblock %}
-{% block extra_content %}
-<!-- This block shows Themes Hierarchy (landing page of Browse Topic) -->
-
- {% if app == "Browse Topic" %}
-
- {% include "ndf/theme.html" %}
-
- {% endif %}
-
-{% endblock %}
-
-
{% block body_content %}
{# template for showing apt_set_instance list #}
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py
index b474edc9..150c74b1 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py
@@ -39,10 +39,11 @@ urlpatterns = patterns('',
(r'^(?P<group_id>[^/]+)/', include('gnowsys_ndf.ndf.urls.user')),
# (r'^(?P<group_id>[^/]+)/',include('gnowsys_ndf.ndf.urls.group')),
url(r'^(?P<group_id>[^/]+)$','gnowsys_ndf.ndf.views.group.group_dashboard', name='groupchange'),
- (r'^(?P<group_id>[^/]+)/browse topic', include('gnowsys_ndf.ndf.urls.browse_topic')),
- (r'^(?P<group_id>[^/]+)/browse resource', include('gnowsys_ndf.ndf.urls.browse_resource')),
- (r'^(?P<group_id>[^/]+)/mis/', include('gnowsys_ndf.ndf.urls.mis')),
- (r'^(?P<group_id>[^/]+)/mis-po/', include('gnowsys_ndf.ndf.urls.mis')),
+ (r'^(?P<group_id>[^/]+)/browse topic/', include('gnowsys_ndf.ndf.urls.browse_topic')),
+ (r'^(?P<group_id>[^/]+)/browse resource/', include('gnowsys_ndf.ndf.urls.browse_resource')),
+
+ (r'^(?P<group_id>[^/]+)/MIS', include('gnowsys_ndf.ndf.urls.mis'), {'app_name': "MIS"}),
+ (r'^(?P<group_id>[^/]+)/MIS-PO', include('gnowsys_ndf.ndf.urls.mis'), {'app_name': "MIS-PO"}),
# (r'^(?P<group_id>[^/]+)/',include('gnowsys_ndf.ndf.urls.group')),
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/mis.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/mis.py
index 48139877..041f846e 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/urls/mis.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/mis.py
@@ -1,11 +1,12 @@
from django.conf.urls import patterns, url
urlpatterns = patterns('gnowsys_ndf.ndf.views.mis',
- url(r'^(?P<app_id>[\w-]+)$', 'mis_detail', name='mis_list'), # MIS app landing
- url(r'^(?P<app_id>[\w-]+)/(?P<app_set_id>[\w-]+)$', 'mis_detail', name='mis_app_detail'), # mis_app_detail
- url(r'^(?P<app_id>[\w-]+)/(?P<app_set_id>[\w-]+)/(?P<app_set_instance_id>[\w-]+)$', 'mis_detail', name='mis_app_instance_detail'), # mis_app_instance_detail
- url(r'^(?P<app_id>[\w-]+)/(?P<app_set_id>[\w-]+)/edit/(?P<app_set_instance_id>[\w-]+)/$', 'mis_create_edit', name='mis_app_instance_edit'), # mis_app_instance_edit
- url(r'^(?P<app_id>[\w-]+)/(?P<app_set_id>[\w-]+)/new/$', 'mis_create_edit', name='mis_app_instance_create'), # mis_app_instance_create
-
+ url(r'^$', 'mis_detail', name='mis_list'),
+ url(r'^/(?P<app_id>[\w-]+)$', 'mis_detail', name='mis_list'), # MIS app landing
+ url(r'^/(?P<app_id>[\w-]+)/(?P<app_set_id>[\w-]+)$', 'mis_detail', name='mis_app_detail'), # mis_app_detail
+ url(r'^/(?P<app_id>[\w-]+)/(?P<app_set_id>[\w-]+)/(?P<app_set_instance_id>[\w-]+)$', 'mis_detail', name='mis_app_instance_detail'), # mis_app_instance_detail
+ url(r'^/(?P<app_id>[\w-]+)/(?P<app_set_id>[\w-]+)/edit/(?P<app_set_instance_id>[\w-]+)/$', 'mis_create_edit', name='mis_app_instance_edit'), # mis_app_instance_edit
+ url(r'^/(?P<app_id>[\w-]+)/(?P<app_set_id>[\w-]+)/new/$', 'mis_create_edit', name='mis_app_instance_create'), # mis_app_instance_create
+
)
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py
index 000aee6e..39227f88 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py
@@ -16,16 +16,45 @@ from gnowsys_ndf.ndf.views.file import *
db = get_database()
collection = db['Nodes']
-def mis_detail(request, group_id, app_id, app_set_id=None, app_set_instance_id=None):
+print "\n Going in MIS-view... \n\n"
+
+def mis_detail(request, group_id, app_id=None, app_set_id=None, app_set_instance_id=None, app_name=None):
"""
custom view for custom GAPPS
"""
- app_name = "mis"
+ print "\n Coming in mis_detail view \n\n"
+ # print "\n app_name: ", app_name, "\n"
+ # app_name = "MIS"
+
+ # ins_objectid = ObjectId()
+ if ObjectId.is_valid(group_id) is False :
+ group_ins = collection.Node.one({'_type': "Group","name": group_id})
+ auth = collection.Node.one({'_type': 'Author', 'name': unicode(request.user.username) })
+ if group_ins:
+ group_id = str(group_ins._id)
+ else :
+ auth = collection.Node.one({'_type': 'Author', 'name': unicode(request.user.username) })
+ if auth :
+ group_id = str(auth._id)
+ else :
+ pass
+
+ app = None
+ if app_id is None:
+ app = collection.Node.one({'_type': "GSystemType", 'name': app_name})
+ if app:
+ app_id = str(app._id)
+ print "\n app_id: ", app_id, "\n"
+ else:
+ app = collection.Node.one({'_id': ObjectId(app_id)})
+
+ app_name = app.name
+ print "\n app_name: ", app_name, "\n"
+
app_collection_set = []
atlist = []
rtlist = []
- app = collection.Node.find_one({"_id":ObjectId(app_id)})
- App_Name = app.name
+
app_set = ""
nodes = ""
nodes_dict = ""
@@ -45,40 +74,32 @@ def mis_detail(request, group_id, app_id, app_set_id=None, app_set_instance_id=N
property_display_order = []
for eachset in app.collection_set:
- app_collection_set.append(collection.Node.one({"_id":eachset}, {'_id': 1, 'name': 1, 'type_of': 1}))
- # app_set = collection.Node.find_one({"_id":eachset})
- # app_collection_set.append({"id": str(app_set._id), "name": app_set.name, 'type_of'})
+ app_collection_set.append(collection.Node.one({"_id":eachset}, {'_id': 1, 'name': 1, 'type_of': 1}))
+ # app_set = collection.Node.find_one({"_id":eachset})
+ # app_collection_set.append({"id": str(app_set._id), "name": app_set.name, 'type_of'})
if app_set_id:
- classtype = ""
- app_set_template = "yes"
- App_Name = None
- systemtype = collection.Node.find_one({"_id":ObjectId(app_set_id)})
- systemtype_name = systemtype.name
- title = systemtype_name
-
- if request.method=="POST":
- search = request.POST.get("search","")
- classtype = request.POST.get("class","")
- nodes = list(collection.Node.find({'name':{'$regex':search, '$options': 'i'},'member_of': {'$all': [systemtype._id]}}))
- else :
- nodes = list(collection.Node.find({'member_of': {'$all': [systemtype._id]},'group_set':{'$all': [ObjectId(group_id)]}}))
-
- nodes_dict = []
- for each in nodes:
- nodes_dict.append({"id":str(each._id), "name":each.name, "created_by":User.objects.get(id=each.created_by).username, "created_at":each.created_at})
+ classtype = ""
+ app_set_template = "yes"
+ App_Name = None
+ systemtype = collection.Node.find_one({"_id":ObjectId(app_set_id)})
+ systemtype_name = systemtype.name
+ title = systemtype_name
+
+ if request.method=="POST":
+ search = request.POST.get("search","")
+ classtype = request.POST.get("class","")
+ nodes = list(collection.Node.find({'name':{'$regex':search, '$options': 'i'},'member_of': {'$all': [systemtype._id]}}))
+ else :
+ nodes = list(collection.Node.find({'member_of': {'$all': [systemtype._id]},'group_set':{'$all': [ObjectId(group_id)]}}))
+
+ nodes_dict = []
+ for each in nodes:
+ nodes_dict.append({"id":str(each._id), "name":each.name, "created_by":User.objects.get(id=each.created_by).username, "created_at":each.created_at})
else :
- ST_theme = collection.Node.one({'_type': 'GSystemType', 'name': 'Theme'})
- if ST_theme:
- nodes = list(collection.Node.find({'member_of': {'$all': [ST_theme._id]},'group_set':{'$all': [ObjectId(group_id)]}}))
-
- nodes_dict = []
- for each in nodes:
- nodes_dict.append({"id":str(each._id), "name":each.name})
-
- app_menu = "yes"
- title = app_name
+ app_menu = "yes"
+ title = app_name
if app_set_instance_id :
app_set_instance_template = "yes"
@@ -157,12 +178,12 @@ def mis_detail(request, group_id, app_id, app_set_id=None, app_set_instance_id=N
variable = RequestContext(request, {'groupid':group_id, 'app_name':app_name, 'app_id':app_id, "app_collection_set":app_collection_set,"app_set_id":app_set_id,"nodes":nodes_dict, "app_menu":app_menu, "app_set_template":app_set_template, "app_set_instance_template":app_set_instance_template, "app_set_name":app_set_name, "app_set_instance_name":app_set_instance_name, "title":title, "app_set_instance_atlist":atlist, "app_set_instance_rtlist":rtlist, 'tags':tags, 'location':location, "content":content, "system_id":system_id,"system_type":system_type,"mime_type":system_mime_type, "app_set_instance_id":app_set_instance_id
- , "node":system, 'group_id':group_id, 'app':App_Name, "property_display_order": property_display_order})
+ , "node":system, 'group_id':group_id, "property_display_order": property_display_order})
return render_to_response(template, variable)
@login_required
-def mis_create_edit(request, group_id, app_id, app_set_id=None, app_set_instance_id=None):
+def mis_create_edit(request, group_id, app_id, app_set_id=None, app_set_instance_id=None, app_name=None):
"""
create new instance of app_set of apps view for custom GAPPS
"""