diff options
author | sunnychaudhari <yuvaraj.chaudhari1@gmail.com> | 2015-04-01 14:22:22 +0530 |
---|---|---|
committer | sunnychaudhari <yuvaraj.chaudhari1@gmail.com> | 2015-04-01 14:22:22 +0530 |
commit | a9bfe48300d14a251b385df87454232ced58922a (patch) | |
tree | d45473030b58fe563d1f0c57d0a12755ac8f7cf5 /gnowsys-ndf | |
parent | 3707b067d8dbb8b0cd1905aa2cb8a49e0a1fe2af (diff) | |
parent | a963c5c670a5f638109d181e65d7d8cab0ef3508 (diff) | |
download | gnowsys-a9bfe48300d14a251b385df87454232ced58922a.tar.gz |
Merge pull request #1113 from kedar2a/mongokit-dev
E-Book flow added. Populating repository content from gst object.
Diffstat (limited to 'gnowsys-ndf')
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/base.html | 2 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course.html | 18 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/ebook.html | 8 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html | 4 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/repository.html | 37 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py | 1 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/urls/e-book.py | 5 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/views/e-book.py | 47 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py | 17 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/settings.py | 2 |
10 files changed, 119 insertions, 22 deletions
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/base.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/base.html index 7025ff7..288579b 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/base.html +++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/base.html @@ -342,7 +342,7 @@ {% if group_name_tag == "home" %} <!-- NROER level-two menu --> - {% if request.path|length > 6 %} + {% if request.path|length > 6 and "repository" not in request.path %} <ul class="button-group nroer-menu"> {% for each_gapp in nroer_menu.gapps %} {% for k, v in each_gapp.items %} diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course.html index 3ff890b..6e73468 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course.html +++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course.html @@ -14,15 +14,19 @@ {% block meta_content %} <h2 class="subheader">{% trans "Courses" %}</h2> - {% if user.is_authenticated %} - {% user_access_policy groupid request.user as user_access %} - {% if user_access == "allow" %} + {% if site.SITE_NAME != "NROER" %} - <a class="small button" href="{% url 'create_edit' group_name_tag %}"> - <span class="fi-plus"> {% trans "New" %} {{title}} </span> - </a> + {% if user.is_authenticated %} + {% user_access_policy groupid request.user as user_access %} + {% if user_access == "allow" %} + + <a class="small button" href="{% url 'create_edit' group_name_tag %}"> + <span class="fi-plus"> {% trans "New" %} {{title}} </span> + </a> + + {% endif %} + {% endif %} - {% endif %} {% endif %} {% endblock %} diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/ebook.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/ebook.html new file mode 100644 index 0000000..aca76e8 --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/ebook.html @@ -0,0 +1,8 @@ +{% extends "ndf/base.html" %} + +{% load ndf_tags %} + +{% block title %} Repository {% endblock %} + +{% block body_content %} +{% endblock %}
\ No newline at end of file diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html index 579a907..77eb1ce 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html +++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html @@ -140,6 +140,8 @@ {% endif %} <!-- Pandora --> + {% comment %} + <!-- {% if site.SITE_VIDEO == 'pandora_and_local' %} <dd data-filetype="Videos"> @@ -148,6 +150,8 @@ </a> </dd><br/> {% endif %} + --> + {% endcomment %} {% if site.SITE_VIDEO == 'pandora' %} <dd data-filetype="Videos"> diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/repository.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/repository.html index 84d07ec..cbdef4f 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/repository.html +++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/repository.html @@ -7,9 +7,9 @@ {% block style %} .app-card{ - min-width: 10rem; + width: 12rem; min-height: 20rem; - margin-left: 5vh; + margin: 20px 1vh; background-color: #efefef; border: thin solid lightgray; float: left; @@ -17,9 +17,10 @@ } .app-card:hover{ - box-shadow: 0px 0px 20px gray; + box-shadow: 0px 0px 15px gray; border: thin solid lightgray; - transition: ease 0.5s; + border-radius: 5px; + transition: ease 0.6s; } .icons{ @@ -27,17 +28,16 @@ font-size: 7em; z-index: 0; opacity: 0.2; - top: 30%; + top: 40%; } -<!-- - .elibrary{ - background: url("watermark.png") no-repeat 0 70%; - } - --> + {% endblock %} {% block body_content %} - <ul class="inline-list"> + + {% comment %} + <!-- + <ul class="inline-list"> {% for each_gapp in gapps_dict %} <li> <a class="app-card text-center" @@ -49,4 +49,19 @@ </li> {% endfor %} </ul> + --> + {% endcomment %} + + <ul class="inline-list"> + {% for each_gapp in gapps_obj_list %} + <li> + <a class="app-card text-center" href="{% url each_gapp.name|lower group_id %}"> + <i class="icons {{ each_gapp.url }}"></i> + <h4><small>{{ each_gapp.altnames }}</small></h4> + <hr/> + <p>{{ each_gapp.content|safe }}</p> + </a> + </li> + {% endfor %} + </ul> {% endblock %}
\ No newline at end of file diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py index 0ac1cb7..3da4907 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py +++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py @@ -60,6 +60,7 @@ urlpatterns = patterns('', (r'^(?P<group_id>[^/]+)/ratings', include('gnowsys_ndf.ndf.urls.ratings')), (r'^(?P<group_id>[^/]+)/topics', include('gnowsys_ndf.ndf.urls.topics')), (r'^(?P<group_id>[^/]+)/e-library', include('gnowsys_ndf.ndf.urls.e-library')), + (r'^(?P<group_id>[^/]+)/e-book', include('gnowsys_ndf.ndf.urls.e-book')), (r'^(?P<group_id>[^/]+)/term', include('gnowsys_ndf.ndf.urls.term')), (r'^(?P<group_id>[^/]+)/event', include('gnowsys_ndf.ndf.urls.event')), (r'^(?P<group_id>[^/]+)/data-review', include('gnowsys_ndf.ndf.urls.data_review')), diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/e-book.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/e-book.py new file mode 100644 index 0000000..3370118 --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/e-book.py @@ -0,0 +1,5 @@ +from django.conf.urls import patterns, url + +urlpatterns = patterns('gnowsys_ndf.ndf.views.e-book', + url(r'^[/]$', 'ebook_listing', name='e-book'), + ) diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/e-book.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/e-book.py new file mode 100644 index 0000000..422a7be --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/e-book.py @@ -0,0 +1,47 @@ +''' -- imports from installed packages -- ''' +from django.shortcuts import render_to_response +from django.template import RequestContext +# from django.core.urlresolvers import reverse +from mongokit import paginator + + +try: + from bson import ObjectId +except ImportError: # old pymongo + from pymongo.objectid import ObjectId + +''' -- imports from application folders/files -- ''' +from gnowsys_ndf.settings import GAPPS +from gnowsys_ndf.ndf.models import Node, GRelation,GSystemType,File,Triple +from gnowsys_ndf.ndf.models import node_collection +from gnowsys_ndf.ndf.views.file import * +from gnowsys_ndf.ndf.views.methods import get_group_name_id, cast_to_data_type,get_execution_time + + +GST_FILE = node_collection.one({'_type':'GSystemType', 'name': "File"}) +ebook_gst = node_collection.one({'_type':'GSystemType', 'name': "E-Book"}) +GST_IMAGE = node_collection.one({'_type':'GSystemType', 'name': GAPPS[3]}) +GST_VIDEO = node_collection.one({'_type':'GSystemType', 'name': GAPPS[4]}) +e_library_GST = node_collection.one({'_type':'GSystemType', 'name': 'E-Library'}) +pandora_video_st = node_collection.one({'_type':'GSystemType', 'name': 'Pandora_video'}) +app = node_collection.one({'_type':'GSystemType', 'name': 'E-Library'}) + +@get_execution_time +def ebook_listing(request, group_id, page_no=1): + + # all_ebook = node_collection.find({"_type": "File", "attribute_set.educationaluse": "Ebook"}) + # all_ebook = node_collection.find({"_type": "File", "member_of": {"$in":[gst_ebook._id]} }) + + + # return render_to_response("ndf/page_list.html", + # {'title': "E-Book", + # 'appId':app._id, + # 'shelf_list': shelf_list,'shelves': shelves, + # 'searching': True, 'query': search_field, + # 'page_nodes': all_ebook, 'groupid':group_id, 'group_id':group_id + # }, + # context_instance=RequestContext(request) ) + + return render_to_response("ndf/ebook.html", + {"group_id": group_id, "groupid": group_id}, + context_instance = RequestContext(request)) diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py index 422e0c1..0bce9cb 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py +++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py @@ -3866,10 +3866,23 @@ def repository(request, group_id): It's an NROER repository. Which will hold the list of apps. ''' - # [i.values()[0] for i in GSTUDIO_NROER_GAPPS] + gapp_metatype = node_collection.one({"_type": "MetaType", "name": "GAPP"}) + + gapps_list = [i.values()[0] for i in GSTUDIO_NROER_GAPPS] + # print gapps_list + + gapps_obj_list = [] + + for each_gapp in gapps_list: + gapp_obj = node_collection.one({ '_type':'GSystemType', + 'name': {"$regex": each_gapp, "$options": "i"}, + "member_of": {"$in": [gapp_metatype._id]} + }) + gapps_obj_list.append(gapp_obj) return render_to_response("ndf/repository.html", - { "gapps_dict" : GSTUDIO_NROER_GAPPS, + { "gapps_obj_list": gapps_obj_list, + "gapps_dict" : GSTUDIO_NROER_GAPPS, 'group_id': group_id, 'groupid': group_id }, context_instance=RequestContext(request) diff --git a/gnowsys-ndf/gnowsys_ndf/settings.py b/gnowsys-ndf/gnowsys_ndf/settings.py index 4169cda..dc914c1 100644 --- a/gnowsys-ndf/gnowsys_ndf/settings.py +++ b/gnowsys-ndf/gnowsys_ndf/settings.py @@ -561,7 +561,7 @@ GSTUDIO_TASK_TYPES = ["Bug", "Feature", "Support", "UI Feature", "Other"] GSTUDIO_NROER_MENU = [{"Repository":[]}, {"Partners":["States", "Institutions", "Individuals"]}, {"Groups":["Teachers", "Interest Groups", "Schools"]}] -GSTUDIO_NROER_GAPPS = [ {"Curated Zone": "topics"}, {"eBooks": ""}, {"eCourses": "course"}, {"Events": "event"}, {"eLibrary": "e-library"} ] +GSTUDIO_NROER_GAPPS = [ {"Curated Zone": "topics"}, {"eBooks": "e-book"}, {"eCourses": "course"}, {"Events": "event"}, {"eLibrary": "e-library"} ] GSTUDIO_NROER_MENU_MAPPINGS = { "States": "State Partner", "Institutions": "Institutional Partner", "Individuals": "Individual Partner", |