diff options
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/base.html | 2 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/create_partner.html | 216 | ||||
-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/partner.html | 134 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/partner_list.html | 111 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/repository.html | 37 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py | 6 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/urls/e-book.py | 5 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/urls/group.py | 2 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/urls/partner.py | 6 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/views/e-book.py | 47 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/views/group.py | 29 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py | 17 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/views/partner.py | 179 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/settings.py | 2 |
16 files changed, 759 insertions, 46 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/create_partner.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/create_partner.html new file mode 100644 index 0000000..6db8515 --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/create_partner.html @@ -0,0 +1,216 @@ + +{% extends "ndf/base.html" %} +{% load i18n %} +{% load ndf_tags %} + +{% block title %} Create a new partner {% endblock %} + +{% block meta_content %} +{% endblock %} + +{% block related_content %} + {% if groups %} + <b>{% trans "Existing Partners:" %}</b> + + {% get_existing_groups_excluding_username as groups%} + {% for items in groups %} + <br>{{items.name|truncatechars:25}} + {% endfor %} + {% endif %} +{% endblock %} + +{% block body_content %} + + <h2>{% trans "Create a new partner" %}</h2><br> + + <form data-abide id="create_group" class="row" method="post" action="{% url 'create_partner' group_id %}"> + {% csrf_token %} + + <div class="small-12 columns" style='display:table; border:1px; border-spacing:10px; '> + <div style='display:table-row;' > + <div style='display:table-cell;'> + <font size="3">{% trans "Name of the Partner" %}</font> + </div> + <div style='display:table-cell;'> + <input type="text" id="group_name" name="groupname" placeholder="Enter partner Name" required> + <small class="error">{% trans "Name is required and must be a string" %}</small> + <label id="message" style="display:none; color:red"></label> + </div> + + <div style='display:table-cell;'> + <font size="3" >{% trans "Partner Type" %}</font> + </div> + <div style='display:table-cell;'> + <select name="group_type" class="gtype"> + <option id="PUBLIC">{% trans "PUBLIC" %}</option> + <option id="PRIVATE">{% trans "PRIVATE" %}</option> + <option id="ANONYMOUS">{% trans "ANONYMOUS" %}</option> + </select> + </div> + </div> + + <div style='display:table-row;'> + <div style='display:table-cell;'> + <font size="3" >{% trans "Partner Editing policy" %}</font> + </div> + <div style='display:table-cell;'> + <select name="edit_policy" class="editp"> + <option id="EDITABLE_NON_MODERATED">{% trans "EDITABLE_NON_MODERATED" %}</option> + <option id="EDITABLE_MODERATED">{% trans "EDITABLE_MODERATED" %}</option> + <option id="NON_EDITABLE">{% trans "NON_EDITABLE" %}</option> + </select> + </div> + <div style='display:table-cell;'> + <font size="3" >{% trans "Partner Subscription policy" %}</font> + </div> + <div style='display:table-cell;'> + <select name="subscription" class="subscptn"> + <option id="OPEN">{% trans "OPEN" %}</option> + <option id="BY_REQUEST">{% trans "BY_REQUEST" %}</option> + <option id="BY_INVITATION">{% trans "BY_INVITATION" %}</option> + </select> + </div> + </div> + <div style='display:table-row;'> + <div style='display:table-cell;'> + <font size="3" >{% trans "Group Encryption policy" %}</font> + </div> + <div style='display:table-cell;'> + <select name="encryption" class="encr" disabled> + <option id="NOT_ENCRYPTED">{% trans "NOT_ENCRYPTED" %}</option> + <option id="ENCRYPTED">{% trans "ENCRYPTED" %}</option> + </select> + </div> + + <div style='display:table-cell;'> + <font size="3" >{% trans "Group Existance visibility" %}</font> + </div> + <div style='display:table-cell;'> + <select name="existance" class="existance" disabled> + <option id="ANNOUNCED">{% trans "ANNOUNCED" %}</option> + <option id="NOT_ANNOUNCED">{% trans "NOT_ANNOUNCED" %}</option> + </select> + </div> + </div> + <div style='display:table-row;'> + <div style='display:table-cell;' colspan='2'> + <!-- <input type="button" id="savegrp" value="Create Group" class="button" onClick="check_values()"> + <input type="submit" id="grpsubmit" value="Create Group" class="button" style="visibility:hidden" > --> + <input type="submit" value="Create Partner" id="grpsubmit" class="button"> + </div> + </div> + <!-- <input type="hidden" id="nodes_list" value="{{nodes_list}}"> --> + </div> + </form> +{% endblock %} + +{% block head %} +<script type="text/javascript"> + /* + function check_group_name() + { + var gname=$("#group_name").val(); + $.ajax({ + url: '/home/group/check_group/', + data: {gname:gname}, + success: function(data){ + if (data=="success"){ + alert("group already exists"); + $("#group_name").val(""); + $("#group_name").focus(); + } + } + }); //end_ajax + } + + function check_values() + { + check_group_name(); + var gpname = $("#group_name").val(); + if (gpname == "") + { + alert("Group name can not be empty") + $("#group_name").focus(); + } + else + { + $("#grpsubmit").trigger("click"); + } + } + */ + + $(document).ready(function() + { + /* + $("#group_name").change(function(){ + var name = $("#group_name").val().trim(); + var nodes = $("#nodes_list").val(); + if (nodes.indexOf(name) > 0) + { + $("#message").css("display", "block"); + $("#message").html("Name '"+ name +"' already exist .. Please choose another name"); + $("#group_name").val(""); + } + else + { + $("#message").css("display", "none"); + } + }); + */ + + // New Form: Conditional Display + $(".login-mode").change(function(){ + /* Hide other options if anonymous login is allowed */ + $("#closed-group").slideToggle(); + }); + + $("#member-mode").slideToggle(); + $("[name='join-mode']").change(function(){ + /* Hide invitation options if open membership */ + $("#member-mode").slideToggle(); + }); + + $("[name='edit-mode']").change(function(){ + /* Hide moderation options if editing is disabled */ + $("#moderate-mode").slideToggle(); + }); + + // $("#group_name").focusout(function(){ + // check_group_name(); + // }); //end_focusout + }); //end_document_ready + +</script> +{% endblock %} + +{% block script %} + + $("#node_search_form").parent().hide(); + + // method to provide autocomplete/intellisence of forum names + + $("#create_partner").submit(function(event){ + var name = $("#group_name").val().trim().toLowerCase(); + var nodes = {{nodes_list|safe}} + + if (name != "") + { + if (nodes.indexOf(name) != -1) + { + $("#message").css("display", "block"); + $("#message").text("Group '"+ name +"' already exist. Please choose another name"); + event.preventDefault(); + } + } + else if (name == ""){ + $("#message").css("display", "block"); + $("#message").text("Group name cannot be empty."); + event.preventDefault(); + } + else + { + $("#message").css("display", "none"); + } + }); + +{% 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/partner.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/partner.html new file mode 100644 index 0000000..09afc6b --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/partner.html @@ -0,0 +1,134 @@ +{% extends "ndf/base.html" %} +{% load i18n %} +{% load ndf_tags %} +{% load pagination_tags %} +{% get_group_name groupid as group_name_tag %} + +{% block title %} Partner {% endblock %} + +{% block meta_content %} +<h2 class="subheader">{% trans "Partners" %}</h2> +{% endblock %} + + +{% block help_content %} + +{% endblock %} + + +{% block search_content %} + {% include "ndf/node_search_base.html" %} +{% endblock %} + + +{% block related_content %} + {% if user.is_authenticated %} + {% user_access_policy groupid request.user as user_access %} + {% if user_access == "allow" %} + <br/> + <div class="create card"> + <div class="group"> + <br/> + <a class="button medium" href="{% url 'create_partner' group_name_tag %}"> + <span class="fi-plus"> {% trans "New Partner" %}</span> + </a> + </div> + </div> + {% endif %} + {% endif %} +{% endblock %} + + +{% block body_content %} +{% get_group_name groupid as group_name_tag %} +<header class="row"> + <dl class="tabs" data-tab data-options="deep_linking:true"> + <dd class="active"><a href="#panel2-1"><i class="fi-eye"></i> All Partners {% if group_nodes_count %}({{ group_nodes_count }}){% endif %}</a></dd> + <!--<dd><a href="#panel2-3"><i class="fi-trophy"></i> Popular Groups</a></dd>--> + </dl> +</header> + +<div class="content row"> + +{% if searching and group_nodes_count > 0 %} + + <div class="small-12 columns end"> + <p>{% trans "Search Results:" %} <span class="label success round">Found {{group_nodes_count}} {{title|lower}}{{group_nodes_count|pluralize}}.</span></p> + </div> + +{% elif searching and group_nodes_count == 0 %} + <div class="small-12 columns"> + <p>{% trans "Search Results:" %} <span class="label alert">No {{title|lower}}{{group_nodes_count|pluralize}} matched your search criteria!!!</span></p> + </div> + +{% endif %} + +<ul class="small-block-grid-1 medium-block-grid-2 large-block-grid-4"> + + <!-- Existing card list--> + {% get_group_type request.path request.user as group_type %} + {% group_type_info groupid request.user as grouptype %} + + {% autopaginate group_nodes 23 %} + + {% for node in group_nodes %} + {% if node.name != request.user.username %} + + <li class="card"> + {% if grouptype == "Moderated" %} + {% if node.status == "DRAFT" %} + <div class="draft group"> + {% elif node.status == "PUBLISHED" %} + <div class="published group"> + {% endif %} + {% else %} + <div class='{% if node.status == "PUBLISHED" %}published{% endif %} group'> + {% endif %} + + <a href="{% url 'partnerlist' node.pk %}"> + <div class="row"> + <div class="small-10 columns"> + <b> + {{ node.name }}{% if node.collection_set %} <i class="fi-page-multiple"></i> {% endif %} + </b> + </div> + </div> + + <span style="font-size:12px;">{{ node.html_content|default_if_none:"Add some description."|safe|striptags|truncatechars:75 }}</span><br/> + + <footer> + <div class="age"> + {{ node.agency_type}} created {{node.created_at|timesince}} ago by <span class="user" href="{% url 'dashboard' node.created_by %}" data-gnow="">{{node.user_details_dict.created_by}}</span> + </div> + <span><strong>{{node.author_set|length}}</strong> Members</span> + {% get_group_resources node as obj_count %} + <span class="right"><strong>{{obj_count}}</strong> Objects</span> + </footer> + </a> + + <div class="label-list small-12 columns"> + {% for tag in node.tags|slice:":3" %} + <a href="{% url 'tag_info' groupid tag %}"><span class="label" style="background-color:yellow;">{{tag}}</span></a> + {% endfor %} + </div> + + </div> + </li> + {% endif %} + + {% empty %} + {% if not searching %} + <div class="row"> + <div class="small-12 columns"> + {% blocktrans %} <h5>There are no partners created yet. <b>Be the first to create a Partner!</b></h5> {% endblocktrans %} + </div> + </div> + {% endif %} + + {% endfor %} + +</ul> + +{% paginate %} + +{% endblock %} diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/partner_list.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/partner_list.html new file mode 100644 index 0000000..091f423 --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/partner_list.html @@ -0,0 +1,111 @@ +{% extends "ndf/base.html" %} +{% load i18n %} +{% load ndf_tags %} +{% load pagination_tags %} +{% get_group_name groupid as group_name_tag %} + +{% block title %} Partner {% endblock %} + +{% block meta_content %} +<h2 class="subheader">{% trans "Partners" %}</h2> +{% endblock %} + + +{% block help_content %} + +{% endblock %} + + +{% block search_content %} + {% include "ndf/node_search_base.html" %} +{% endblock %} + + +{% block related_content %} + {% if user.is_authenticated %} + {% user_access_policy groupid request.user as user_access %} + {% if user_access == "allow" %} + <br/> + <div class="create card"> + <div class="group"> + <br/> + <a class="button medium" href="{% url 'create_partner' group_name_tag %}"> + <span class="fi-plus"> {% trans "New Partner" %}</span> + </a> + </div> + </div> + {% endif %} + {% endif %} +{% endblock %} + + +{% block body_content %} +<ul class="small-block-grid-1 medium-block-grid-2 large-block-grid-4"> + + <!-- Existing card list--> + {% get_group_type request.path request.user as group_type %} + {% group_type_info groupid request.user as grouptype %} + + {% autopaginate group_nodes 23 %} + + {% for node in group_nodes %} + {% if node.name != request.user.username %} + + <li class="card"> + {% if grouptype == "Moderated" %} + {% if node.status == "DRAFT" %} + <div class="draft group"> + {% elif node.status == "PUBLISHED" %} + <div class="published group"> + {% endif %} + {% else %} + <div class='{% if node.status == "PUBLISHED" %}published{% endif %} group'> + {% endif %} + + <a href="{% url 'groupchange' node.pk %}"> + <div class="row"> + <div class="small-10 columns"> + <b> + {{ node.name }}{% if node.collection_set %} <i class="fi-page-multiple"></i> {% endif %} + </b> + </div> + </div> + + <span style="font-size:12px;">{{ node.html_content|default_if_none:"Add some description."|safe|striptags|truncatechars:75 }}</span><br/> + + <footer> + <div class="age"> + {{ node.agency_type}} created {{node.created_at|timesince}} ago by <span class="user" href="" data-gnow="">{{node.user_details_dict.created_by}}</span> + </div> + <span><strong>{{node.author_set|length}}</strong> Members</span> + {% get_group_resources node as obj_count %} + <span class="right"><strong>{{obj_count}}</strong> Objects</span> + </footer> + </a> + + <div class="label-list small-12 columns"> + {% for tag in node.tags|slice:":3" %} + <a href="{% url 'tag_info' groupid tag %}"><span class="label" style="background-color:yellow;">{{tag}}</span></a> + {% endfor %} + </div> + + </div> + </li> + {% endif %} + + {% empty %} + {% if not searching %} + <div class="row"> + <div class="small-12 columns"> + {% blocktrans %} <h5>There are no partners created yet. <b>Be the first to create a Partner!</b></h5> {% endblocktrans %} + </div> + </div> + {% endif %} + + {% endfor %} + +</ul> + +{% paginate %} + +{% endblock %} 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 7d2726d..3da4907 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py +++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py @@ -45,6 +45,7 @@ urlpatterns = patterns('', (r'^(?P<group_id>[^/]+)/video', include('gnowsys_ndf.ndf.urls.video')), (r'^(?P<group_id>[^/]+)/page', include('gnowsys_ndf.ndf.urls.page')), (r'^(?P<group_id>[^/]+)/group', include('gnowsys_ndf.ndf.urls.group')), + (r'^(?P<group_id>[^/]+)/partner', include('gnowsys_ndf.ndf.urls.partner')), (r'^(?P<group_id>[^/]+)/forum', include('gnowsys_ndf.ndf.urls.forum')), (r'^(?P<group_id>[^/]+)/quiz', include('gnowsys_ndf.ndf.urls.quiz')), (r'^(?P<group_id>[^/]+)/course', include('gnowsys_ndf.ndf.urls.course')), @@ -59,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')), @@ -100,7 +102,9 @@ urlpatterns = patterns('', url(r'^(?P<group_id>[^/]+)/visualize', include('gnowsys_ndf.ndf.urls.visualise_urls')), url(r'^(?P<group_id>[^/]+)/$', 'gnowsys_ndf.ndf.views.group.group_dashboard', name='groupchange'), - + # ---listing sub partners--- + url(r'^(?P<group_id>[^/]+)/partners$', 'gnowsys_ndf.ndf.views.partner.partner_list', name='partnerlist'), + # --------end of listing sub partners-------- # -- tags -- url(r'^(?P<group_id>[^/]+)/tags$', 'gnowsys_ndf.ndf.views.methods.tag_info', name='tag_info'), url(r'^(?P<group_id>[^/]+)/tags/(?P<tagname>[^/]+)$', 'gnowsys_ndf.ndf.views.methods.tag_info', name='tag_info'), 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/urls/group.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/group.py index d4ec1b5..fe7803a 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/urls/group.py +++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/group.py @@ -9,7 +9,7 @@ urlpatterns = patterns('gnowsys_ndf.ndf.views.group', url(r'^/switch_group/(?P<node_id>[\w-]+)$', 'switch_group', name='switch_group'), url(r'^/app_selection/', 'app_selection', name='app_selection'), url(r'^/create_sub_group/', 'create_sub_group', name='create_sub_group'), - url(r'^/(?P<groups_category>[\w-]+)/nroer_groups/?$', 'nroer_groups', name='nroer_groups'), + #url(r'^/(?P<groups_category>[\w-]+)/nroer_groups/?$', 'nroer_groups', name='nroer_groups'), url(r'^/(?P<app_id>[\w-]+)/value/(?P<agency_type>[\w-]+)/?$', 'group', name='groups_by_agency_type'), ) diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/partner.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/partner.py new file mode 100644 index 0000000..03cdcd1 --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/partner.py @@ -0,0 +1,6 @@ +from django.conf.urls import patterns, url + +urlpatterns = patterns('gnowsys_ndf.ndf.views.partner', + url(r'^/create_partner/', 'create_partner', name='create_partner'), + url(r'^/(?P<groups_category>[\w-]+)', 'nroer_groups', name='nroer_groups'), + ) 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/group.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/group.py index 5de22ad..17c456f 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/views/group.py +++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/group.py @@ -753,32 +753,3 @@ def create_sub_group(request,group_id): print "Exception in create subgroup "+str(e) -@get_execution_time -def nroer_groups(request, group_id, groups_category): - group_name, group_id = get_group_name_id(group_id) - - mapping = GSTUDIO_NROER_MENU_MAPPINGS - - # loop over nroer menu except "Repository" - for each_item in GSTUDIO_NROER_MENU[1:]: - temp_key_name = each_item.keys()[0] - if temp_key_name == groups_category: - groups_names_list = each_item.get(groups_category, []) - - # mapping for the text names in list - groups_names_list = [mapping.get(i) for i in groups_names_list] - break - - group_nodes = node_collection.find({ '_type': "Group", - '_id': {'$nin': [ObjectId(group_id)]}, - 'name': {'$nin': ["home"], '$in': groups_names_list}, - 'group_type': "PUBLIC" - })#.sort('last_update', -1) - - group_nodes_count = group_nodes.count() if group_nodes else 0 - - return render_to_response("ndf/group.html", - {'group_nodes': group_nodes, - 'group_nodes_count': group_nodes_count, - 'groupid': group_id, 'group_id': 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/ndf/views/partner.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/partner.py new file mode 100644 index 0000000..a6d21f3 --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/partner.py @@ -0,0 +1,179 @@ +''' -- imports from python libraries -- ''' +# import os -- Keep such imports here +import json + +''' -- imports from installed packages -- ''' +from django.http import HttpResponseRedirect +from django.http import HttpResponse +from django.core.urlresolvers import reverse +from django.shortcuts import render_to_response # , render +from django.template import RequestContext +# from django.template.defaultfilters import slugify +from django.contrib.auth.decorators import login_required +from django.contrib.auth.models import User + +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, GROUP_AGENCY_TYPES, GSTUDIO_NROER_MENU, GSTUDIO_NROER_MENU_MAPPINGS + +# from gnowsys_ndf.ndf.models import GSystemType, GSystem, Group, Triple +from gnowsys_ndf.ndf.models import node_collection, triple_collection +from gnowsys_ndf.ndf.views.ajax_views import set_drawer_widget +from gnowsys_ndf.ndf.templatetags.ndf_tags import get_existing_groups, get_all_user_groups +from gnowsys_ndf.ndf.views.methods import * + +# ###################################################################################################################################### + +gst_group = node_collection.one({"_type": "GSystemType", 'name': GAPPS[2]}) +get_all_usergroups=get_all_user_groups() +at_apps_list=node_collection.one({'$and':[{'_type':'AttributeType'},{'name':'apps_list'}]}) +ins_objectid = ObjectId() +app=gst_group + +# ###################################################################################################################################### +# V I E W S D E F I N E D F O R P A R T N E R ' +# ###################################################################################################################################### + +@login_required +@get_execution_time +def create_partner(request,group_id): + ins_objectid = ObjectId() + if ins_objectid.is_valid(group_id) is False : + group_ins = node_collection.find_one({'_type': "Group","name": group_id}) + auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) }) + if group_ins: + group_id = str(group_ins._id) + else: + auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) }) + if auth: + group_id = str(auth._id) + else : + pass + + if request.method == "POST": + colg = node_collection.collection.Group() + Mod_colg = node_collection.collection.Group() + + cname = request.POST.get('groupname', "").strip() + colg.altnames = cname + colg.name = unicode(cname) + colg.member_of.append(gst_group._id) + usrid = int(request.user.id) + + colg.created_by = usrid + if usrid not in colg.author_set: + colg.author_set.append(usrid) + + colg.modified_by = usrid + if usrid not in colg.contributors: + colg.contributors.append(usrid) + + colg.group_type = request.POST.get('group_type', "") + colg.edit_policy = request.POST.get('edit_policy', "") + colg.subscription_policy = request.POST.get('subscription', "") + colg.visibility_policy = request.POST.get('existance', 'ANNOUNCED') + colg.disclosure_policy = request.POST.get('member', 'DISCLOSED_TO_MEM') + colg.encryption_policy = request.POST.get('encryption', 'NOT_ENCRYPTED') + colg.agency_type = "Partner" + colg.save() + + if colg.edit_policy == "EDITABLE_MODERATED": + Mod_colg.altnames = cname + "Mod" + Mod_colg.name = cname + "Mod" + Mod_colg.group_type = "PRIVATE" + + Mod_colg.created_by = usrid + if usrid not in Mod_colg.author_set: + Mod_colg.author_set.append(usrid) + + Mod_colg.modified_by = usrid + if usrid not in Mod_colg.contributors: + Mod_colg.contributors.append(usrid) + + Mod_colg.prior_node.append(colg._id) + Mod_colg.save() + + colg.post_node.append(Mod_colg._id) + colg.save() + + auth = node_collection.one({'_type': 'Author', 'name': unicode(request.user.username) }) + + has_shelf_RT = node_collection.one({'_type': 'RelationType', 'name': u'has_shelf' }) + + shelves = [] + shelf_list = {} + + if auth: + shelf = triple_collection.find({'_type': 'GRelation', 'subject': ObjectId(auth._id), 'relation_type.$id': has_shelf_RT._id }) + + if shelf: + for each in shelf: + shelf_name = node_collection.one({'_id': ObjectId(each.right_subject)}) + shelves.append(shelf_name) + + shelf_list[shelf_name.name] = [] + for ID in shelf_name.collection_set: + shelf_item = node_collection.one({'_id': ObjectId(ID) }) + shelf_list[shelf_name.name].append(shelf_item.name) + + else: + shelves = [] + return render_to_response("ndf/groupdashboard.html", {'groupobj': colg, 'appId': app._id, 'node': colg, 'user': request.user, + 'groupid': colg._id, 'group_id': colg._id, + 'shelf_list': shelf_list,'shelves': shelves + },context_instance=RequestContext(request)) + + + available_nodes = node_collection.find({'_type': u'Group', 'member_of': ObjectId(gst_group._id) }) + nodes_list = [] + for each in available_nodes: + nodes_list.append(str((each.name).strip().lower())) + return render_to_response("ndf/create_partner.html", {'groupid': group_id, 'appId': app._id, 'group_id': group_id, 'nodes_list': nodes_list},RequestContext(request)) + + +def partner_list(request,group_id): + group_name, group_id = get_group_name_id(group_id) + + get_grp=node_collection.one({'_id':ObjectId(group_id)}) + collection_set=[] + for each in get_grp.collection_set: + node=node_collection.one({'_id':each}) + collection_set.append(node) + return render_to_response("ndf/partner_list.html", + {'group_nodes': collection_set, + 'groupid': group_id, 'group_id': group_id + }, context_instance=RequestContext(request)) + + +@get_execution_time +def nroer_groups(request, group_id, groups_category): + group_name, group_id = get_group_name_id(group_id) + + mapping = GSTUDIO_NROER_MENU_MAPPINGS + + # loop over nroer menu except "Repository" + for each_item in GSTUDIO_NROER_MENU[1:]: + temp_key_name = each_item.keys()[0] + if temp_key_name == groups_category: + groups_names_list = each_item.get(groups_category, []) + + # mapping for the text names in list + groups_names_list = [mapping.get(i) for i in groups_names_list] + break + + group_nodes = node_collection.find({ '_type': "Group", + '_id': {'$nin': [ObjectId(group_id)]}, + 'name': {'$nin': ["home"], '$in': groups_names_list}, + 'group_type': "PUBLIC" + })#.sort('last_update', -1) + + group_nodes_count = group_nodes.count() if group_nodes else 0 + return render_to_response("ndf/partner.html", + {'group_nodes': group_nodes, + 'group_nodes_count': group_nodes_count, + 'groupid': group_id, 'group_id': 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", |