summaryrefslogtreecommitdiff
path: root/gnowsys-ndf
diff options
context:
space:
mode:
authorKedar Aitawdekar <kedar2a@gmail.com>2015-06-09 11:50:02 +0530
committerKedar Aitawdekar <kedar2a@gmail.com>2015-06-09 11:50:02 +0530
commit27076aac098504d88734ff709d20278fe1d91473 (patch)
tree1bde1a873131bb98f685ac79cc9e9ea649afb981 /gnowsys-ndf
parentc1a116e134e08e25bc2b386c449e889d5bf6b4d3 (diff)
parentdd28cf1fefdcd38fbb97213aab993c7d73b670cb (diff)
downloadgnowsys-27076aac098504d88734ff709d20278fe1d91473.tar.gz
Merge branch 'mongokit' of http://github.com/gnowledge/gstudio into mongokit-curation-workflow
Diffstat (limited to 'gnowsys-ndf')
-rw-r--r--gnowsys-ndf/gnowsys_ndf/factory_type.py4
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/models.py32
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/adminDashboardCreate.html48
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis_report.html377
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_edit_base.html17
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/translation_page.html27
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templatetags/ndf_tags.py3
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/urls/ajax-urls.py9
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/views/adminDesignerDashboard.py15
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/views/ajax_views.py640
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py8
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py2
12 files changed, 444 insertions, 738 deletions
diff --git a/gnowsys-ndf/gnowsys_ndf/factory_type.py b/gnowsys-ndf/gnowsys_ndf/factory_type.py
index 26ffd77..1fbffb5 100644
--- a/gnowsys-ndf/gnowsys_ndf/factory_type.py
+++ b/gnowsys-ndf/gnowsys_ndf/factory_type.py
@@ -173,8 +173,8 @@ factory_relation_types = [
},
{'translation_of': {
- 'subject_type':['Page','Topic','Theme','theme_item','File','GAPP'],
- 'object_type':['Page','Topic','Theme','theme_item','File','GAPP'],
+ 'subject_type':['Page','Topic','Theme','theme_item','File','GAPP','factory_types','Binary'],
+ 'object_type':['Page','Topic','Theme','theme_item','File','GAPP','factory_types','Binary'],
'inverse_name':'translation_of',
'meta_type':'factory_types'
}
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/models.py b/gnowsys-ndf/gnowsys_ndf/ndf/models.py
index 8996df3..2572d13 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/models.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/models.py
@@ -1574,7 +1574,6 @@ class Triple(DjangoDocument):
def save(self, *args, **kwargs):
is_new = False
-
if "_id" not in self:
is_new = True # It's a new document, hence yet no ID!"
@@ -1620,19 +1619,8 @@ class Triple(DjangoDocument):
left_subject_member_of_list = subject_document.member_of
relation_type_name = self.relation_type['name']
-
- if META_TYPE[3] in self.relation_type.member_of_names_list:
- # If Binary relationship found
- # Single relation: ObjectId()
- # Multi relation: [ObjectId(), ObjectId(), ...]
- right_subject_document = node_collection.one({'_id': self.right_subject})
-
- right_subject_member_of_list = right_subject_document.member_of
- right_subject_name = right_subject_document.name
-
- self.name = "%(subject_name)s -- %(relation_type_name)s -- %(right_subject_name)s" % locals()
-
- else:
+ if META_TYPE[4] in self.relation_type.member_of_names_list:
+ # print META_TYPE[3], self.relation_type.member_of_names_list,"!!!!!!!!!!!!!!!!!!!!!"
# Relationship Other than Binary one found; e.g, Triadic
# Single relation: [ObjectId(), ObjectId(), ...]
# Multi relation: [[ObjectId(), ObjectId(), ...], [ObjectId(), ObjectId(), ...], ...]
@@ -1641,7 +1629,7 @@ class Triple(DjangoDocument):
right_subject_name_list = []
right_subject_name_list_append = right_subject_name_list.append
-
+ print self.right_subject,"%%%%%%%%%%%%%",type(self.right_subject)
for each in self.right_subject:
# Here each is an ObjectId
right_subject_document = node_collection.one({
@@ -1663,7 +1651,21 @@ class Triple(DjangoDocument):
# with other comma-separated values from another list(s)
object_type_list = list(chain.from_iterable(object_type_list))
right_subject_member_of_list = list(chain.from_iterable(right_subject_member_of_list))
+
+
+ else:
+ #META_TYPE[3] in self.relation_type.member_of_names_list:
+ # If Binary relationship found
+ # Single relation: ObjectId()
+ # Multi relation: [ObjectId(), ObjectId(), ...]
+ right_subject_document = node_collection.one({'_id': self.right_subject})
+ right_subject_member_of_list = right_subject_document.member_of
+ right_subject_name = right_subject_document.name
+
+ self.name = "%(subject_name)s -- %(relation_type_name)s -- %(right_subject_name)s" % locals()
+
+
name_value = self.name
left_intersection = set(subject_type_list) & set(left_subject_member_of_list)
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/adminDashboardCreate.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/adminDashboardCreate.html
index 28c32a4..6170ba5 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/adminDashboardCreate.html
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/adminDashboardCreate.html
@@ -19,9 +19,15 @@
<div class="large-12 columns">
<table class="large-6 columns">
<div class="row">
-<div class="large-6 columns text-center">{{node.language|default_if_none:""}}</div>
+<div class="large-6 columns text-center">{{node.language|default_if_none:"en"}}</div>
-<div class="large-6 columns"><select name="language" id="lan">{% for each in lan %}<option id="{{each}}" value="{{each}}">{{each}}</option>{% endfor %}</select>
+<div class="large-6 columns">
+<select name="lan" id="lan">
+{% get_language_info_list for LANGUAGES as languages %}
+{% for language in languages %}
+<option value={{ language.code }}>{{ language.name }}</option>
+{% endfor %}
+</select>
</div>
<hr style="height:5px;background-color: #0B6580;" />
</div>
@@ -153,21 +159,21 @@
<input type="submit" name="submit" class="button" id="save-node-type" value="Submit">
</form>
-{% if translate %}
-<div class="text-right small-9">
-{% if node %}
- Languages
- <br></br>
- {% get_possible_translations node as tran %}
- {% for each in tran %}
- {% for k,v in each.items %}
- <li><a href="{% url 'adminDesignerDashboardClassEdit' class_name k %}?translate=True">{{v}}</a></li>
- {% endfor %}
- {% endfor %}
-{% endif %}
-</div>
+<!-- {% if translate %} -->
+<!-- <div class="text-right small-9"> -->
+<!-- {% if node %} -->
+<!-- Languages -->
+<!-- <br></br> -->
+<!-- {% get_possible_translations node as tran %} -->
+<!-- {% for each in tran %} -->
+<!-- {% for k,v in each.items %} -->
+<!-- <li><a href="{% url 'adminDesignerDashboardClassEdit' class_name k %}?translate=True">{{v}}</a></li> -->
+<!-- {% endfor %} -->
+<!-- {% endfor %} -->
+<!-- {% endif %} -->
+<!-- </div> -->
-{% endif %}
+<!-- {% endif %}lan -->
{% endblock %}
@@ -198,11 +204,11 @@
}
}
- if(flag == 1)
- {
- alert("* mandatory fields required");
- event.preventDefault();
- }
+ <!-- if(flag == 1) -->
+ <!-- { -->
+ <!-- alert("* mandatory fields requiredss"); -->
+ <!-- event.preventDefault(); -->
+ <!-- } -->
});
{% endblock %}
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis_report.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis_report.html
index 097dc4e..a72419d 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis_report.html
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/mis_report.html
@@ -60,8 +60,6 @@
</div>
</div>
-
-
<fieldset>
<legend>
<label>{% trans 'Filters' %}</label>
@@ -154,16 +152,22 @@
$("select#univ_list").attr("disabled",true).empty();
$("select#colg_list").attr("disabled",true).empty();
$("select#state_list").prop("selectedIndex", 0);
+ $("#report1").html('')
+ $("#report2").html('')
$("#ac_year_list").val('')
if (sel_type == "Student"){
$(".ac_year").removeClass("hide");
$(".event_duration").addClass("hide")
}
- else{
+ else if(sel_type == "Event") {
$(".ac_year").addClass("hide").val('');
$(".event_duration").removeClass("hide")
}
+ else{
+ $(".ac_year").addClass("hide").val('');
+ $(".event_duration").addClass("hide")
+ }
});
$("select#state_list").change(function() {
// Get selected State's value (ObjectId) and selected-index
@@ -316,292 +320,97 @@
$(document).on("click", ".total_val", function() {
gst_name = $("#fetchDataOf").val()
query_data = $(this).attr('data-query');
+ $.ajax({
+ url:"{% url 'get_detailed_report' groupid %}",
- if(gst_name == "Student"){
- $.ajax({
- url:"{% url 'get_students' groupid %}",
-
- data: {
- 'query': query_data,
- 'gst_name':gst_name,
- 'csrfmiddlewaretoken': "{{csrf_token}}"
- },
-
- type: "POST",
-
- dataType: "json",
-
- success: function(data) {
- success_state = data["success"];
- $("#alertModalLabel").text(data["message"]);
-
- if (success_state) {
- // $("#report2").html(data["students_data_review"]);
-
- groupid_val = data["groupid"];
- app_id_val = data["app_id"];
- app_set_id_val = data["app_set_id"];
- var caption_college = ""
- var caption_university = ""
- filename = data["filename"];
- if (data.hasOwnProperty("university")){
- university = data["university"];
- caption_university = '<h4>' + university + '</h4>';
- }
- if (data.hasOwnProperty("college")){
- college = data["college"];
- caption_college = '<h3>' + college + '</h3>';
- }
- students_count = data["students_count"];
- column_headers = data["column_headers"];
- students_data_set = data["students_data_set"];
- dataTable_columns_set = [];
- download_link = "{% static 'filename' %}".replace('filename', filename);
-
- if (parseInt(students_count) <= 0) {
- c = '<div class="row">' +
- '<div class="large-4 large-centered columns">' +
- '<p class="alert-box alert radius text-center text-size-15">No records match the given criteria !!!</p>' +
- '</div>' +
- '</div>'
- $("#report2").html(c);
- }
+ data: {
+ 'query': query_data,
+ 'gst_name':gst_name,
+ 'csrfmiddlewaretoken': "{{csrf_token}}"
+ },
- else {
- // Define table
- student_data_table = '<table cellpadding="0" cellspacing="0" border="0" class="display" id="student_data_table">' +
- '<caption>' +
- caption_college +
- caption_university +
- '<h6>Total No. of Students Registered: <b>' + students_count + '</b></h6>' +
- '<a href="' + download_link + '" download="">' +
- '<span class="fi-download large">&nbsp;&nbsp;&nbsp;Download Students\' data (CSV)</span>' +
- '</a>' +
- '</caption>' +
- '</table>';
- $("#report2").html(student_data_table);
-
- // Prepare title & data headers used in dataTable
- $.each(column_headers, function(index, v) {
- d = {};
- d["data"] = v[0];
- d["title"] = v[1];
- dataTable_columns_set.push(d);
- });
-
- // Set defintion dataTable
- sce_dt_var = $("#student_data_table").dataTable({
- "data": students_data_set,
- "columns": dataTable_columns_set,
- "createdRow": function ( row, data, index ) {
- // Attaching Student's ObjectId to each row (i.e., assigning to it's id attribute)
- s_id = data["stud_id"];
- $(row).attr("id", s_id);
- edit_url = "{% url 'mis:mis_app_instance_edit' 'groupid' 'app_id' 'app_set_id' 'stud_id' %}".replace("groupid", groupid_val).replace("app_id", app_id_val).replace("app_set_id", app_set_id_val).replace("stud_id", s_id);
- name = data['Name']
-
- $(row).find("td:nth-child(3)").html("<a href='" + edit_url + "'>"+name+"</a>");
- }
- });
- }
- }
- else {
- $("#alertModal").removeClass("success").removeClass("warning");
- $("#alertModal").addClass("alert");
- $("#alertModal").foundation('reveal', 'open');
- }
- },
- });
- }
- else if (gst_name == "Event"){
- $.ajax({
- url:"{% url 'get_events' groupid %}",
-
- data: {
- 'query': query_data,
- 'gst_name':gst_name,
- 'csrfmiddlewaretoken': "{{csrf_token}}"
- },
-
- type: "POST",
-
- dataType: "json",
-
- success: function(data) {
- success_state = data["success"];
- $("#alertModalLabel").text(data["message"]);
-
- if (success_state) {
- // $("#report2").html(data["students_data_review"]);
-
- groupid_val = data["groupid"];
- app_id_val = data["app_id"];
- app_set_id_val = data["app_set_id"];
- var caption_college = ""
- var caption_university = ""
- filename = data["filename"];
- if (data.hasOwnProperty("university")){
- university = data["university"];
- caption_university = '<h4>' + university + '</h4>';
- }
- if (data.hasOwnProperty("college")){
- college = data["college"];
- caption_college = '<h3>' + college + '</h3>';
- }
- students_count = data["students_count"];
- column_headers = data["column_headers"];
- students_data_set = data["students_data_set"];
- dataTable_columns_set = [];
- download_link = "{% static 'filename' %}".replace('filename', filename);
-
- if (parseInt(students_count) <= 0) {
- c = '<div class="row">' +
- '<div class="large-4 large-centered columns">' +
- '<p class="alert-box alert radius text-center text-size-15">No records match the given criteria !!!</p>' +
- '</div>' +
- '</div>'
- $("#report2").html(c);
- }
+ type: "POST",
- else {
- // Define table
- student_data_table = '<table cellpadding="0" cellspacing="0" border="0" class="display" id="student_data_table">' +
- '<caption>' +
- caption_college +
- caption_university +
- '<h6>Total No. of Students Registered: <b>' + students_count + '</b></h6>' +
- '<a href="' + download_link + '" download="">' +
- '<span class="fi-download large">&nbsp;&nbsp;&nbsp;Download Students\' data (CSV)</span>' +
- '</a>' +
- '</caption>' +
- '</table>';
- $("#report2").html(student_data_table);
-
- // Prepare title & data headers used in dataTable
- $.each(column_headers, function(index, v) {
- d = {};
- d["data"] = v[0];
- d["title"] = v[1];
- dataTable_columns_set.push(d);
- });
-
- // Set defintion dataTable
- sce_dt_var = $("#student_data_table").dataTable({
- "data": students_data_set,
- "columns": dataTable_columns_set,
- "columnDefs": [{ "width": "15%", "targets": 0 }],
- "createdRow": function ( row, data, index ) {
- // Attaching Student's ObjectId to each row (i.e., assigning to it's id attribute)
- s_id = data["stud_id"];
- $(row).attr("id", s_id);
- detail_url = "{% url 'event_app_instance_detail' groupid 'app_set_id' 'stud_id' %}".replace("groupid", groupid_val).replace("app_set_id", app_set_id_val).replace("stud_id", s_id);
- $(row).find("td:nth-child(3)").html("<a href='" + detail_url + "' target='_blank'>"+data['Name']+"</a>");
- }
- });
- }
- }
- else {
- $("#alertModal").removeClass("success").removeClass("warning");
- $("#alertModal").addClass("alert");
- $("#alertModal").foundation('reveal', 'open');
- }
- },
- });
- }
- else if (gst_name == "Voluntary Teacher"){
- $.ajax({
- url:"{% url 'get_voluntary_teachers' groupid %}",
-
- data: {
- 'query': query_data,
- 'gst_name':gst_name,
- 'csrfmiddlewaretoken': "{{csrf_token}}"
- },
-
- type: "POST",
-
- dataType: "json",
-
- success: function(data) {
- success_state = data["success"];
- $("#alertModalLabel").text(data["message"]);
-
- if (success_state) {
- // $("#report2").html(data["students_data_review"]);
-
- groupid_val = data["groupid"];
- app_id_val = data["app_id"];
- app_set_id_val = data["app_set_id"];
- var caption_college = ""
- var caption_university = ""
- filename = data["filename"];
- if (data.hasOwnProperty("university")){
- university = data["university"];
- caption_university = '<h4>' + university + '</h4>';
- }
- if (data.hasOwnProperty("college")){
- college = data["college"];
- caption_college = '<h3>' + college + '</h3>';
- }
- students_count = data["students_count"];
- column_headers = data["column_headers"];
- students_data_set = data["students_data_set"];
- dataTable_columns_set = [];
- download_link = "{% static 'filename' %}".replace('filename', filename);
-
- if (parseInt(students_count) <= 0) {
- c = '<div class="row">' +
- '<div class="large-4 large-centered columns">' +
- '<p class="alert-box alert radius text-center text-size-15">No records match the given criteria !!!</p>' +
- '</div>' +
- '</div>'
- $("#report2").html(c);
- }
+ dataType: "json",
- else {
- // Define table
- student_data_table = '<table cellpadding="0" cellspacing="0" border="0" class="display" id="student_data_table">' +
- '<caption>' +
- caption_college +
- caption_university +
- '<h6>Total No. of Students Registered: <b>' + students_count + '</b></h6>' +
- '<a href="' + download_link + '" download="">' +
- '<span class="fi-download large">&nbsp;&nbsp;&nbsp;Download Students\' data (CSV)</span>' +
- '</a>' +
- '</caption>' +
- '</table>';
- $("#report2").html(student_data_table);
-
- // Prepare title & data headers used in dataTable
- $.each(column_headers, function(index, v) {
- d = {};
- d["data"] = v[0];
- d["title"] = v[1];
- dataTable_columns_set.push(d);
- });
-
- // Set defintion dataTable
- sce_dt_var = $("#student_data_table").dataTable({
- "data": students_data_set,
- "columns": dataTable_columns_set,
- "columnDefs": [{ "width": "15%", "targets": 1 }],
- "createdRow": function ( row, data, index ) {
- // Attaching Student's ObjectId to each row (i.e., assigning to it's id attribute)
- s_id = data["stud_id"];
- $(row).attr("id", s_id);
- }
- });
- }
- }
- else {
- $("#alertModal").removeClass("success").removeClass("warning");
- $("#alertModal").addClass("alert");
- $("#alertModal").foundation('reveal', 'open');
- }
- },
- });
+ success: function(data) {
+ success_state = data["success"];
+ $("#alertModalLabel").text(data["message"]);
- }
+ if (success_state) {
+ // $("#report2").html(data["students_data_review"]);
+
+ groupid_val = data["groupid"];
+ app_id_val = data["app_id"];
+ app_set_id_val = data["app_set_id"];
+ var caption_college = ""
+ var caption_university = ""
+ filename = data["filename"];
+ if (data.hasOwnProperty("university")){
+ university = data["university"];
+ caption_university = '<h4>' + university + '</h4>';
+ }
+ if (data.hasOwnProperty("college")){
+ college = data["college"];
+ caption_college = '<h3>' + college + '</h3>';
+ }
+ students_count = data["students_count"];
+ column_headers = data["column_headers"];
+ students_data_set = data["students_data_set"];
+ dataTable_columns_set = [];
+ download_link = "{% static 'filename' %}".replace('filename', filename);
+
+ if (parseInt(students_count) <= 0) {
+ c = '<div class="row">' +
+ '<div class="large-4 large-centered columns">' +
+ '<p class="alert-box alert radius text-center text-size-15">No records match the given criteria !!!</p>' +
+ '</div>' +
+ '</div>'
+ $("#report2").html(c);
+ }
+
+ else {
+ // Define table
+ student_data_table = '<table cellpadding="0" cellspacing="0" border="0" class="display" id="student_data_table">' +
+ '<caption>' +
+ caption_college +
+ caption_university +
+ '<h6>No. of '+ gst_name +'s: <b>' + students_count + '</b></h6>' +
+ '<a href="' + download_link + '" download="">' +
+ '<span class="fi-download large">&nbsp;&nbsp;&nbsp;Download '+gst_name+'\' data (CSV)</span>' +
+ '</a>' +
+ '</caption>' +
+ '</table>';
+ $("#report2").html(student_data_table);
+
+ // Prepare title & data headers used in dataTable
+ $.each(column_headers, function(index, v) {
+ d = {};
+ d["data"] = v[0];
+ d["title"] = v[1];
+ dataTable_columns_set.push(d);
+ });
+
+ // Set defintion dataTable
+ sce_dt_var = $("#student_data_table").dataTable({
+ "data": students_data_set,
+ "columns": dataTable_columns_set,
+ "columnDefs": [{ "width": "15%", "targets": 1 }],
+ "createdRow": function ( row, data, index ) {
+ // Attaching Student's ObjectId to each row (i.e., assigning to it's id attribute)
+ s_id = data["stud_id"];
+ $(row).attr("id", s_id);
+ }
+ });
+ }
+ }
+ else {
+ $("#alertModal").removeClass("success").removeClass("warning");
+ $("#alertModal").addClass("alert");
+ $("#alertModal").foundation('reveal', 'open');
+ }
+ },
+ });
})
$(document).on("click", "#get_reports_btn", function() {
data_dict = {};
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_edit_base.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_edit_base.html
index 5ab0519..dfb34b7 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_edit_base.html
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_edit_base.html
@@ -96,7 +96,7 @@ i.remove-tag{
<a>{% block prior_node_tab %} {% trans "Requires" %} {% endblock %}</a>
</dd>
<!-- change name of collection tab overide block in your code -->
- <dd class="collection_tab" data-reveal-id="{% if node %}{% if is_group == False %}publish_resource{% endif %}{% endif %}" title="Click here to add/edit collection">
+ <dd class="collection_tab" data-reveal-id="{% if not node %}{% if is_group == False %}publish_resource{% endif %}{% endif %}" title="Click here to add/edit collection">
<a>{% block collection_tab %} {% trans "Collection" %} {% endblock %}</a>
</dd>
<!-- change name of metadata tab overide block in your code -->
@@ -117,14 +117,14 @@ i.remove-tag{
</div>
{% csrf_token %}
-
+ {% comment %}
<div id="publish_resource" class="reveal-modal" data-reveal style="width:500px;">
Do you want to create:<br/><br/>
<input class="collection" type="radio" name="coll" value="homogeneous"> &nbsp;Homogeneous Collection<br/>
<input class="collection" type="radio" name="coll" value="heterogeneous"> &nbsp;Heterogeneous Collection
<a class="close-reveal-modal">&#215;</a>
</div>
-
+ {% endcomment %}
<div id="node-details-edit-div" class="tabs-content" >
<div class="active content row contents" id="panel-name-description">
@@ -708,16 +708,15 @@ $(document).ready(function(){
});
});
-
- {% if is_group or not node %}
+ {% if is_group or node or not node %}
$(".collection_tab").click(function() {
- var collection = "heterogeneous";
+ var collection = "heterogeneous";
+
{% else %}
$(".collection").click(function() {
- var collection = this.value;
+ var collection = this.value;
{% endif %}
-
- $("#publish_resource").foundation('reveal', 'close');
+ $("#publish_resource").foundation('reveal', 'close');
$("input[type='radio'][name='col']").attr("checked", false);
$("input[type='radio'][name='coll']").attr("checked", false);
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/translation_page.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/translation_page.html
index 4639df3..c48fa1f 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/translation_page.html
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/translation_page.html
@@ -32,7 +32,6 @@ $("#lan option[value='{{v}}']").remove();
</script>
-
<div class="large-12 columns">
<table class="large-6 columns">
<div class="row">
@@ -58,9 +57,9 @@ $("#lan option[value='{{v}}']").remove();
<div class="row">
<div class="medium-8 columns">
{% if "Theme" in node.member_of_names_list %}
-{% trans "Theme" %} : {{node.name}}</br></br>
+<b>{% trans "Theme" %} :</b> {{node.name}}</br></br>
{% else %}
-{% trans "Page Name" %} : {{node.name}}</br></br>
+<b>{% trans "Page Name" %} :</b> {{node.name}}</br></br>
{% endif %}
</div>
</div>
@@ -69,12 +68,12 @@ $("#lan option[value='{{v}}']").remove();
<div class="medium-8 columns">
{% if "Theme" not in node.member_of_names_list %}
- Description: </br></br>
-<textarea name="content" class="field left">{{node.content_org|default_if_none:""}}</textarea>
- </div></div>
+ <b>Description:</b> </br></br>
+<div name="content" class="field left" >{{node.content_org|default_if_none:""}}</div>
+ </div></div></br>
<div class="row">
<div class="medium-8 columns">
-{% trans "Tags: " %} </br></br>
+<b>{% trans "Tags: " %}</b> </br></br>
{{node.tags|join:', '|default_if_none:""}}
{% endif %}
@@ -89,11 +88,11 @@ $("#lan option[value='{{v}}']").remove();
<div class="row">
<div class="medium-8 columns">
{% if "Theme" in node.member_of_names_list %}
-<label>{% trans "Theme" %}</label>
+<label style="font-weight: bold">{% trans "Theme" %}</label>
<input id="name_id" name="name" type="text" value="{{node.name}}" placeholder="Enter name..." required>
<small class="error">{% trans "Please give your page a descriptive name. It's helpful for others and for yourself." %}</small>
{% else %}
-<label>{% trans "Page Name" %}</label>
+<label style="font-weight: bold">{% trans "Page Name" %}</label>
<input id="name_id" name="name" type="text" value="{{node.name}}" placeholder="Enter name..." required>
<small class="error">{% trans "Please give your page a descriptive name. It's helpful for others and for yourself." %}</small>
{% endif %}
@@ -104,7 +103,7 @@ $("#lan option[value='{{v}}']").remove();
<div class="large-12 columns">
{% if "Theme" not in node.member_of_names_list %}
-<label>{% trans "Description" %}</label>
+<label style="font-weight: bold">{% trans "Description" %}</label>
{% include "ndf/add_editor.html" with var_name="content_org" var_placeholder="Enter the content here" var_value=node.content_org|default_if_none:"" %}
{% endif %}
@@ -115,7 +114,7 @@ $("#lan option[value='{{v}}']").remove();
<div class="large-6 columns">
{% if "Theme" not in node.member_of_names_list %}
-<span data-tooltip class="has-tip" title="Tags help identify similiar work easily. You can add as many labels as you wish using a comma ','"><label>{% trans "Tag" %}{{node.tags|pluralize|default_if_none:"s"}}</label>
+<span data-tooltip class="has-tip" title="Tags help identify similiar work easily. You can add as many labels as you wish using a comma ','"><label style="font-weight: bold">{% trans "Tag" %}{{node.tags|pluralize|default_if_none:"s"}}</label>
</span>
<input type = "hidden" name="access_policy" value="{{node.access_policy}}">
<input id="tags_id" name="tags" type="text" value="{{node.tags|join:', '|default_if_none:""}}" placeholder="Separate tags with commas...">
@@ -160,8 +159,8 @@ $("#lan option[value='{{v}}']").remove();
<div class="medium-8 columns">
Description: </br></br>
-<textarea name="content" class="field left">{{each.content_org|default_if_none:""}}</textarea>
- </div>
+<div name="content" class="field left">{{each.content_org|default_if_none:""}</div>
+ </div></br>
{% endif %}
</div>
@@ -181,7 +180,7 @@ $("#lan option[value='{{v}}']").remove();
<div class="row">
{% if "Theme" not in each.member_of_names_list and "theme_item" not in each.member_of_names_list and "Topic" not in each.member_of_names_list %}
<div class="large-12 columns">
-<label>{% trans "Description" %}</label>
+<label style="font-weight: bold">{% trans "Description" %}</label>
{% with each as nodeobj %}
{% include "ndf/add_editor.html" with var_name=each var_placeholder="Enter the content here" var_value=each.content_org|default_if_none:"" %}
{% endwith %}
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templatetags/ndf_tags.py b/gnowsys-ndf/gnowsys_ndf/ndf/templatetags/ndf_tags.py
index 9dc6781..adc2616 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/templatetags/ndf_tags.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templatetags/ndf_tags.py
@@ -541,6 +541,7 @@ def list_widget(fields_name, fields_type, fields_value, template1='ndf/option_wi
drawer1['en']='en'
drawer1['mar']='mar'
else:
+ #drawer = node_collection.find({"_type":types,'name':{'$nin':[u'Voluntary Teacher']}})
drawer = node_collection.find({"_type":types})
for each in drawer:
drawer1[str(each._id)]=each
@@ -2185,7 +2186,7 @@ def str_to_dict(str1):
else:
# if v != [] and v != "None":
if v:
- if User.objects.filter(id = userid).exists():
+ if User.objects.filter(id = v).exists():
user = User.objects.get(id = v)
if user:
dict_format[k] = user.get_username()
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/ajax-urls.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/ajax-urls.py
index c93ebe4..9e279cb 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/urls/ajax-urls.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/ajax-urls.py
@@ -42,15 +42,13 @@ urlpatterns = patterns('gnowsys_ndf.ndf.views.ajax_views',
url(r'^get_data_for_batch_drawer/', 'get_data_for_batch_drawer', name='get_data_for_batch_drawer'),
# Ajax-urls required for MIS --------------------------------
-
- url(r'^get_voluntary_teachers/', 'get_voluntary_teachers', name='get_voluntary_teachers'),
- url(r'^get_events/', 'get_events', name='get_events'),
+
+ url(r'^get_detailed_report/', 'get_detailed_report', name='get_detailed_report'),
url(r'^get_universities/', 'get_universities', name='get_universities'),
url(r'^get_students_for_batches/', 'get_students_for_batches', name='get_students_for_batches'),
url(r'^get_anncourses_allstudents/', 'get_anncourses_allstudents', name='get_anncourses_allstudents'),
url(r'^get_courses/', 'get_courses', name='get_courses'),
url(r'^get_batches_with_acourse/', 'get_batches_with_acourse', name='get_batches_with_acourse'),
-
url(r'^get_announced_courses_with_ctype/', 'get_announced_courses_with_ctype', name='get_announced_courses_with_ctype'),
url(r'^get_colleges/(?P<app_id>[\w-]+)$', 'get_colleges', name='get_colleges'),
url(r'^get_districts/', 'get_districts', name='get_districts'),
@@ -58,7 +56,6 @@ urlpatterns = patterns('gnowsys_ndf.ndf.views.ajax_views',
url(r'^get_students/', 'get_students', name='get_students'),
url(r'^get_students_for_approval/', 'get_students_for_approval', name='get_students_for_approval'),
url(r'^approve_students/', 'approve_students', name='approve_students'),
-
url(r'^get_statewise_data/', 'get_statewise_data', name='get_statewise_data'),
url(r'^get_college_wise_students_data/', 'get_college_wise_students_data', name='get_college_wise_students_data'),
url(r'^rechedule_event/(?P<node>[\w-]+)$','reschedule_task',name='reschedule_task'),
@@ -83,7 +80,7 @@ urlpatterns = patterns('gnowsys_ndf.ndf.views.ajax_views',
url(r'^edit_task_content/', 'edit_task_content', name='edit_task_content'),
url(r'^insert_picture/', 'insert_picture', name="insert_picture"),
#url for infinite scroll down
- url(r'^page_scroll/(?P<page>[^/]+)$', 'page_scroll', name='page_scroll'),
+ url(r'^page_scroll/(?P<page>[^/]+)$', 'page_scroll', name='page_scroll'),
url(r'^check_date/(?P<node>[\w-]+)$', 'check_date', name='check_date'),
url(r'^save_time/(?P<node>[\w-]+)$', 'save_time', name='save_time'),
)
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/adminDesignerDashboard.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/adminDesignerDashboard.py
index b948e99..5ae43f3 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/views/adminDesignerDashboard.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/adminDesignerDashboard.py
@@ -23,6 +23,7 @@ def adminDesignerDashboardClass(request, class_name='GSystemType'):
nodes = node_collection.find({'name':{'$regex':search,'$options': 'i' },'_type':classtype}).sort('last_update', -1)
else :
nodes = node_collection.find({'_type':class_name}).sort('last_update', -1)
+
objects_details = []
for each in nodes:
@@ -37,8 +38,8 @@ def adminDesignerDashboardClass(request, class_name='GSystemType'):
for members in each.member_of:
member.append(node_collection.one({ '_id': members}).name+" - "+str(members))
- for coll in each.collection_set:
- collection_list.append(node_collection.one({ '_id': coll}).name+" - "+str(coll))
+ # for coll in each.collection_set:
+ # collection_list.append(node_collection.one({ '_id': coll}).name+" - "+str(coll))
if class_name in ("GSystemType"):
for at_set in each.attribute_type_set:
@@ -143,7 +144,8 @@ def adminDesignerDashboardClassCreate(request, class_name='GSystemType', node_id
if translate:
if key in ("name","inverse_name"):
new_instance_type[key] = unicode(request.POST.get(key+"_trans",""))
-
+ language= request.POST.get('lan')
+ new_instance_type.language=language
else:
new_instance_type[key] = unicode(request.POST.get(key,""))
@@ -197,6 +199,13 @@ def adminDesignerDashboardClassCreate(request, class_name='GSystemType', node_id
if user_id not in new_instance_type.contributors:
new_instance_type.contributors.append(user_id)
+ parent_node=node_collection.one({'_id':ObjectId(node_id)})
+ if translate and class_name == "RelationType":
+ new_instance_type.subject_type = parent_node.subject_type
+ new_instance_type.object_type = parent_node.object_type
+ if translate and class_name == "AttributeType":
+ new_instance_type.data_type = parent_node.data_type
+ new_instance_type.subject_type = parent_node.subject_type
new_instance_type.save()
if translate:
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/ajax_views.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/ajax_views.py
index 2b157fa..70f70a4 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/views/ajax_views.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/ajax_views.py
@@ -2265,7 +2265,6 @@ def get_students(request, group_id):
app_id = request.POST.get("app_id", None)
app_set_id = request.POST.get("app_set_id", None)
stud_reg_year = str(request.POST.get("reg_year", None))
- query_rcvd = str(request.POST.get("query", ''))
university_id = request.POST.get("student_belongs_to_university",None)
college_id = request.POST.get("student_belongs_to_college",None)
@@ -2273,14 +2272,6 @@ def get_students(request, group_id):
widget_for = []
query = {}
- if query_rcvd:
- query = eval(query_rcvd)
- groupid = group_id
- gapp_gst = node_collection.one({'name':"GAPP"})
- mis_gapp = node_collection.one({'member_of':gapp_gst._id,'name':"MIS"})
- app_id = mis_gapp._id
- app_set_id = node_collection.one({'_type':"GSystemType",'name':"Student"})._id
-
person_gs = node_collection.collection.GSystem()
person_gs.member_of.append(person_gst._id)
person_gs.get_neighbourhood(person_gs.member_of)
@@ -2305,85 +2296,83 @@ def get_students(request, group_id):
# Fetch field(s) from POST object
# if request.POST.has_key("student_belongs_to_university"):
# university_id = query_data = request.POST.get("student_belongs_to_university", "")
- if not query_rcvd:
- for each in widget_for:
- field_name = each["name"]
-
- if each["_type"] == "BaseField":
- if field_name in request.POST:
- query_data = request.POST.get(field_name, "")
- query_data = parse_template_data(each["data_type"], query_data)
- if field_name == "name":
- query.update({field_name: {'$regex': query_data, '$options': "i"}})
- else:
- query.update({field_name: query_data})
-
- elif each["_type"] == "AttributeType":
- if field_name in request.POST:
- query_data = request.POST.get(field_name, "")
- query_data = parse_template_data(each["data_type"], query_data)
- query.update({"attribute_set."+field_name: query_data})
-
- # elif each["_type"] == "RelationType":
- # if request.POST.has_key(field_name):
- # print field_name,"\n\n"
- # query_data = request.POST.get(field_name, "")
- # query_data = parse_template_data(each["data_type"], query_data, field_instance=each)
- # print query_data,"\n\n"
-
- # if field_name == "student_belongs_to_university":
- # university_id = query_data
- # else:
- # query.update({"relation_set."+field_name: query_data})
-
- student = node_collection.one({'_type': "GSystemType", 'name': "Student"}, {'_id': 1})
- query["member_of"] = student._id
-
- date_lte = datetime.datetime.strptime("31/12/" + stud_reg_year, "%d/%m/%Y")
- date_gte = datetime.datetime.strptime("1/1/" + stud_reg_year, "%d/%m/%Y")
- query["attribute_set.registration_date"] = {'$gte': date_gte, '$lte': date_lte}
+ for each in widget_for:
+ field_name = each["name"]
+
+ if each["_type"] == "BaseField":
+ if field_name in request.POST:
+ query_data = request.POST.get(field_name, "")
+ query_data = parse_template_data(each["data_type"], query_data)
+ if field_name == "name":
+ query.update({field_name: {'$regex': query_data, '$options': "i"}})
+ else:
+ query.update({field_name: query_data})
+
+ elif each["_type"] == "AttributeType":
+ if field_name in request.POST:
+ query_data = request.POST.get(field_name, "")
+ query_data = parse_template_data(each["data_type"], query_data)
+ query.update({"attribute_set."+field_name: query_data})
+
+ # elif each["_type"] == "RelationType":
+ # if request.POST.has_key(field_name):
+ # print field_name,"\n\n"
+ # query_data = request.POST.get(field_name, "")
+ # query_data = parse_template_data(each["data_type"], query_data, field_instance=each)
+ # print query_data,"\n\n"
+
+ # if field_name == "student_belongs_to_university":
+ # university_id = query_data
+ # else:
+ # query.update({"relation_set."+field_name: query_data})
+
+ student = node_collection.one({'_type': "GSystemType", 'name': "Student"}, {'_id': 1})
+ query["member_of"] = student._id
+
+ date_lte = datetime.datetime.strptime("31/12/" + stud_reg_year, "%d/%m/%Y")
+ date_gte = datetime.datetime.strptime("1/1/" + stud_reg_year, "%d/%m/%Y")
+ query["attribute_set.registration_date"] = {'$gte': date_gte, '$lte': date_lte}
+ college_groupid = None
+ if college_id:
+ # Get selected college's groupid, where given college should belongs to MIS_admin group
+ college_groupid = node_collection.one({'_id': ObjectId(college_id), 'group_set': mis_admin._id, 'relation_set.has_group': {'$exists': True}},
+ {'relation_set.has_group': 1, 'name': 1}
+ )
+ response_dict["college"] = college_groupid.name
+
+ if college_groupid:
+ for each in college_groupid.relation_set:
+ if "has_group" in each.keys():
+ college_groupid = each["has_group"][0]
+ break
+ else:
college_groupid = None
- if college_id:
- # Get selected college's groupid, where given college should belongs to MIS_admin group
- college_groupid = node_collection.one({'_id': ObjectId(college_id), 'group_set': mis_admin._id, 'relation_set.has_group': {'$exists': True}},
- {'relation_set.has_group': 1, 'name': 1}
- )
- response_dict["college"] = college_groupid.name
+ groupid = ObjectId(groupid)
+ group_set_to_check = []
+
+ if groupid == mis_admin._id:
+ # It means group is either a college group or MIS_admin group
+ # In either case append MIS_admin group's ObjectId
+ # and if college_groupid exists, append it's ObjectId too!
if college_groupid:
- for each in college_groupid.relation_set:
- if "has_group" in each.keys():
- college_groupid = each["has_group"][0]
- break
+ group_set_to_check.append(college_groupid)
else:
- college_groupid = None
+ group_set_to_check.append(mis_admin._id)
- groupid = ObjectId(groupid)
- group_set_to_check = []
+ else:
+ # Otherwise, append given group's ObjectId
+ group_set_to_check.append(groupid)
- if groupid == mis_admin._id:
- # It means group is either a college group or MIS_admin group
- # In either case append MIS_admin group's ObjectId
- # and if college_groupid exists, append it's ObjectId too!
- if college_groupid:
- group_set_to_check.append(college_groupid)
- else:
- group_set_to_check.append(mis_admin._id)
+ if university_id:
+ university_id = ObjectId(university_id)
+ university = node_collection.one({'_id': university_id}, {'name': 1})
+ if university:
+ response_dict["university"] = university.name
+ query.update({'relation_set.student_belongs_to_university': university_id})
- else:
- # Otherwise, append given group's ObjectId
- group_set_to_check.append(groupid)
-
- if university_id:
- university_id = ObjectId(university_id)
- university = node_collection.one({'_id': university_id}, {'name': 1})
- if university:
- response_dict["university"] = university.name
- query.update({'relation_set.student_belongs_to_university': university_id})
-
- query.update({'group_set': {'$in': group_set_to_check}})
- query.update({'status': u"PUBLISHED"})
- # till here
+ query.update({'group_set': {'$in': group_set_to_check}})
+ query.update({'status': u"PUBLISHED"})
rec = node_collection.collection.aggregate([{'$match': query},
{'$project': {'_id': 0,
'stud_id': '$_id',
@@ -2550,6 +2539,7 @@ def get_students(request, group_id):
response_dict["message"] = error_message
return HttpResponse(json.dumps(response_dict, cls=NodeJSONEncoder))
+
@get_execution_time
def get_statewise_data(request, group_id):
"""
@@ -5020,8 +5010,9 @@ def event_assginee(request, group_id, app_set_instance_id=None):
for j in event_node.attribute_set:
if unicode('reschedule_attendance') in j.keys():
reschedule_dates = j['reschedule_attendance']
- reschedule_dates["reschedule_allow"] = False
- create_gattribute(ObjectId(app_set_instance_id),reschedule_attendance,reschedule_dates)
+ if attendancesession != str(1):
+ reschedule_dates["reschedule_allow"] = False
+ create_gattribute(ObjectId(app_set_instance_id),reschedule_attendance,reschedule_dates)
if attendancesession == str(1):
event_status = node_collection.one({"_type":"AttributeType","name":"event_status"})
create_gattribute(ObjectId(app_set_instance_id),event_status,unicode('Completed'))
@@ -5579,9 +5570,10 @@ def get_universities(request, group_id):
return HttpResponse(json.dumps({'message': error_message}))
+
# MIS Reports
@get_execution_time
-def get_events(request, group_id):
+def get_detailed_report(request, group_id):
"""
This view returns list of students along with required data based on selection criteria
to student_data_review.html
@@ -5595,305 +5587,168 @@ def get_events(request, group_id):
message - Basestring giving the error/information message
"""
response_dict = {'success': False, 'message': ""}
- all_students_text = ""
+ column_header = []
group_name, group_id = get_group_name_id(group_id)
+ app_set_id = None
try:
if request.is_ajax() and request.method == "POST":
- # groupid = request.POST.get("groupid", None)
- # app_id = request.POST.get("app_id", None)
- # app_set_id = request.POST.get("app_set_id", None)
- # stud_reg_year = str(request.POST.get("reg_year", None))
query_rcvd = str(request.POST.get("query", ''))
- # university_id = request.POST.get("student_belongs_to_university",None)
- # college_id = request.POST.get("student_belongs_to_college",None)
-
- person_gst = node_collection.one({'_type': "GSystemType", 'name': "Classroom Session"}, {'name': 1, 'type_of': 1})
-
- widget_for = []
- query = {}
+ gst_name = str(request.POST.get("gst_name", ''))
+ if gst_name == "Event":
+ gst_name = "Classroom Session"
+ person_gst = node_collection.one({'_type': "GSystemType", 'name': gst_name})
+ gapp_gst = node_collection.one({'name':"GAPP"})
+ mis_gapp = node_collection.one({'member_of':gapp_gst._id,'name':"MIS"})
+ app_id = mis_gapp._id
result_set = None
if query_rcvd:
query = eval(query_rcvd)
- groupid = group_id
- gapp_gst = node_collection.one({'name':"GAPP"})
- mis_gapp = node_collection.one({'member_of':gapp_gst._id,'name':"MIS"})
- app_id = mis_gapp._id
- app_set_id = person_gst._id
- person_gs = node_collection.collection.GSystem()
- person_gs.member_of.append(person_gst._id)
- person_gs.get_neighbourhood(person_gs.member_of)
- # university_gst = node_collection.one({'_type': "GSystemType", 'name': "University"})
mis_admin = node_collection.one({"_type": "Group", "name": "MIS_admin"}, {"_id": 1})
+ if person_gst.name == "Voluntary Teacher":
+ column_header = [u'University', u'College',u'Name', u'Email ID', u'Phone', u'Street',u'Events']
+
+ rec = node_collection.collection.aggregate([{'$match': query},
+ {'$project': {'_id': 0,
+ 'stud_id': '$_id',
+ 'Name': '$name',
+ 'Email ID': '$attribute_set.email_id',
+ 'Phone': '$attribute_set.mobile_number',
+ 'Street': '$attribute_set.town_city',
+ 'Events': '$relation_set.coordinator_of_event'
+ }},
+ {'$sort': {'Name': 1}}
+ ])
+ elif person_gst.name == "Classroom Session":
+ app_set_id = person_gst._id
+ column_header = [u'Name', u'Course', u'VT',u'University', u'College', u'NUSSD Course',u'Module', u'Session', u'Start', u'End', u'Batch', u'Status',u'Attendance']
+
+ rec = node_collection.collection.aggregate([{'$match': query},
+ {'$project': {'_id': 0,
+ 'stud_id': '$_id',
+ 'Name': '$name',
+ 'Course': '$attribute_set.nussd_course_type',
+ 'VT': '$relation_set.event_coordinator',
+ 'Session': '$relation_set.session_of',
+ 'Start': '$attribute_set.start_time',
+ 'End': '$attribute_set.end_time',
+ 'Batch': "$relation_set.event_has_batch",
+ 'Status': '$attribute_set.event_status',
+ 'Attendees': "$relation_set.has_attendees",
+ 'Attended': "$relation_set.has_attended",
+ }},
+ {'$sort': {'Start': 1}}
+ ])
+ elif person_gst.name == "Student":
+ column_header = [u"Enrollment Code", u'Name', u'Reg# Date', u'Gender', u'Birth Date', u'Religion', u'Email ID', u'Languages Known', u'Caste', u'Contact Number (Mobile)', u'Alternate Number / Landline', u'House / Street', u'Village', u'Taluka', u'Town / City', u'District', u'State', u'Pin Code', u'Year of Passing 12th Standard', u'Degree Name / Highest Degree', u'Year of Study', u'Stream / Degree Specialization', u'College Enrolment Number / Roll No', u'College ( Graduation )', u'Are you registered for NSS?','University']
+ rec = node_collection.collection.aggregate([{'$match': query},
+ {'$project': {'_id': 0,
+ 'stud_id': '$_id',
+ 'Enrollment Code': '$attribute_set.enrollment_code',
+ 'Name': '$name',
+ # 'First Name': '$attribute_set.first_name',
+ # 'Middle Name': '$attribute_set.middle_name',
+ # 'Last Name': '$attribute_set.last_name',
+ 'Reg# Date': '$attribute_set.registration_date',
+ 'Gender': '$attribute_set.gender',
+ 'Birth Date': '$attribute_set.dob',
+ 'Religion': '$attribute_set.religion',
+ 'Email ID': '$attribute_set.email_id',
+ 'Languages Known': '$attribute_set.languages_known',
+ 'Caste': '$relation_set.student_of_caste_category',
+ 'Contact Number (Mobile)': '$attribute_set.mobile_number',
+ 'Alternate Number / Landline': '$attribute_set.alternate_number',
+ 'House / Street': '$attribute_set.house_street',
+ 'Village': '$attribute_set.village',
+ 'Taluka': '$attribute_set.taluka',
+ 'Town / City': '$attribute_set.town_city',
+ 'District': '$relation_set.person_belongs_to_district',
+ 'State': '$relation_set.person_belongs_to_state',
+ 'Pin Code': '$attribute_set.pin_code',
+ 'Year of Passing 12th Standard': '$attribute_set.12_passing_year',
+ 'Degree Name / Highest Degree': '$attribute_set.degree_name',
+ 'Year of Study': '$attribute_set.degree_year',
+ 'Stream / Degree Specialization': '$attribute_set.degree_specialization',
+ 'College Enrolment Number / Roll No': '$attribute_set.college_enroll_num',
+ 'College ( Graduation )': '$relation_set.student_belongs_to_college',
+ 'University': '$relation_set.student_belongs_to_university',
+ 'Are you registered for NSS?': '$attribute_set.is_nss_registered'
+ }},
+ {'$sort': {'Enrollment Code': 1}}
+ ])
- rec = node_collection.collection.aggregate([{'$match': query},
- {'$project': {'_id': 0,
- 'stud_id': '$_id',
- 'Name': '$name',
- 'Course': '$attribute_set.nussd_course_type',
- 'VT': '$relation_set.event_coordinator',
- 'Session': '$relation_set.session_of',
- 'Start': '$attribute_set.start_time',
- 'End': '$attribute_set.end_time',
- 'Batch':"$relation_set.event_has_batch",
- 'Status': '$attribute_set.event_status',
- }},
- {'$sort': {'Name': 1}}
- ])
json_data = []
filename = ""
- column_header = []
course_section_node_id = course_subsection_node = None
result_set = rec["result"]
+ # print "\n\n result_set",result_set
if result_set:
# old_dict = result_set[0]
for old_dict in result_set:
if old_dict:
- if u"Session" in old_dict:
- course_subsection_node = node_collection.one({'_id': ObjectId(old_dict['Session'][0][0])})
- if course_subsection_node:
- course_section_node_id = course_subsection_node.prior_node[0]
- old_dict.update({'Module': [[course_section_node_id]]})
- if course_section_node_id:
- course_section_node = node_collection.one({'_id': ObjectId(course_section_node_id)})
- nussd_course_node = course_section_node.prior_node[0]
- old_dict.update({'NUSSD Course': [[nussd_course_node]]})
- if u"stud_id" in old_dict:
- event_node = node_collection.one({'_id': ObjectId(old_dict['stud_id'])})
- if event_node:
- colg_group_id = event_node.group_set[0]
- colg_group_node = node_collection.one({'_id':ObjectId(colg_group_id)})
- if colg_group_node.relation_set:
- for rel in colg_group_node.relation_set:
- if rel and 'group_of' in rel:
- colg_node_id = rel['group_of'][0]
- colg_node = node_collection.one({'_id': ObjectId(colg_node_id)},{'name':1,'relation_set':1})
- colg_node_name = colg_node.name
- old_dict.update({'College': colg_node_name})
- if colg_node.relation_set:
- for rel in colg_node.relation_set:
- if rel and 'college_affiliated_to' in rel:
- univ_id = rel['college_affiliated_to'][0]
- old_dict.update({'University': [[univ_id]]})
- result_set[0] = old_dict
-
- if result_set:
- for each_dict in result_set:
- new_dict = {}
- for each_key in each_dict:
- if each_dict[each_key]:
- if type(each_dict[each_key]) == list:
- data = each_dict[each_key][0]
- else:
- data = each_dict[each_key]
-
- if type(data) == list:
- # Perform parsing
- if type(data) == list:
- # Perform parsing
- if type(data[0]) in [unicode, basestring, int]:
- new_dict[each_key] = ', '.join(str(d) for d in data)
-
- elif type(data[0]) in [ObjectId]:
- # new_dict[each_key] = str(data)
- d_list = []
- for oid in data:
- d = node_collection.one({'_id': oid}, {'name': 1})
- d_list.append(str(d.name))
- new_dict[each_key] = ', '.join(str(n) for n in d_list)
-
- elif type(data) == datetime.datetime:
- new_dict[each_key] = data.strftime("%d/%m/%Y")
-
- elif type(data) == long:
- new_dict[each_key] = str(data)
-
- elif type(data) == bool:
- if data:
- new_dict[each_key] = "Yes"
- else:
- new_dict[each_key] = "No"
-
- else:
- new_dict[each_key] = str(data)
-
- else:
- # Perform parsing
- if type(data) == list:
- # Perform parsing
- if type(data[0]) in [unicode, basestring, int]:
- new_dict[each_key] = ', '.join(str(d) for d in data)
- elif type(data[0]) in [ObjectId]:
- new_dict[each_key] = str(data)
-
- elif type(data) == datetime.datetime:
- new_dict[each_key] = data.strftime("%d/%m/%Y")
-
- elif type(data) == long:
- new_dict[each_key] = str(data)
-
- elif type(data) == bool:
- if data:
- new_dict[each_key] = "Yes"
- else:
- new_dict[each_key] = "No"
+ if person_gst.name == "Voluntary Teacher":
+ if u"stud_id" in old_dict:
+ vt_node = node_collection.one({'_id': ObjectId(old_dict['stud_id'])})
+ if vt_node:
+ for rel in vt_node.relation_set:
+ if rel and 'trainer_of_college' in rel:
+ colg_node_id = rel['trainer_of_college'][0]
+ colg_node = node_collection.one({'_id': ObjectId(colg_node_id)},{'name':1,'relation_set':1})
+ colg_node_name = colg_node.name
+ old_dict.update({'College': colg_node_name})
+ if colg_node.relation_set:
+ for rel in colg_node.relation_set:
+ if rel and 'college_affiliated_to' in rel:
+ univ_id = rel['college_affiliated_to'][0]
+ old_dict.update({'University': [[univ_id]]})
+ if person_gst.name == "Classroom Session":
+ if u'Attendees' in old_dict:
+ if old_dict['Attendees']:
+ old_dict['Attendees'] = len(old_dict['Attendees'][0])
+ else:
+ old_dict['Attendees'] = "Not Applicable"
+ if u'Attended' in old_dict:
+ if old_dict['Attended']:
+ old_dict['Attended'] = len(old_dict['Attended'][0])
+ else:
+ old_dict['Attended'] = "Not Applicable"
+ if old_dict['Attended'] != "Not Applicable" and old_dict['Attendees'] != "Not Applicable":
+ attendance_percent = (old_dict['Attended']/float(old_dict['Attendees']))*100
+ old_dict['Attendance'] = str(round(attendance_percent,2))+" %"
else:
- new_dict[each_key] = str(data)
-
- else:
- new_dict[each_key] = ""
-
- json_data.append(new_dict)
-
- # Start: CSV file processing -------------------------------------------
- column_header = [u'Name', u'Course', u'VT',u'University', u'College', u'NUSSD Course',u'Module', u'Session', u'Start', u'End', u'Batch', u'Status']
-
- t = time.strftime("%c").replace(":", "_").replace(" ", "_")
- filename = "csv/" + "events_data_" + t + ".csv"
- filepath = os.path.join(STATIC_ROOT, filename)
- filedir = os.path.dirname(filepath)
- if not os.path.exists(filedir):
- os.makedirs(filedir)
- with open(filepath, 'wb') as csv_file:
- fw = csv.DictWriter(csv_file, delimiter=',', fieldnames=column_header)
- fw.writerow(dict((col,col) for col in column_header))
- for row in json_data:
- v = {}
- v["stud_id"] = row.pop("stud_id")
- fw.writerow(row)
- row.update(v)
- # End: CSV file processing --------------------------------------------
-
- # Column headers to be displayed on html
- column_headers = [
- # ('University', 'University'),
- # ('College ( Graduation )', 'College'),
- ("University", "University"),
- ("College", "College"),
- ("Name", "Name"),
- ("Course", "Course"),
- ("VT", "VT"),
- ("NUSSD Course", "NUSSD Course"),
- ("Module", "Module"),
- ('Session', 'Session'),
- ('Start', 'Start'),
- ('End', 'End'),
- ('Batch', 'Batch'),
- ('Status', 'Status'),
- ]
- # college = node_collection.one({'_id': ObjectId(college_id)}, {"name": 1})
- students_count = len(json_data)
- response_dict["success"] = True
- response_dict["groupid"] = group_id
- response_dict["app_id"] = app_id
- response_dict["app_set_id"] = app_set_id
- response_dict["filename"] = filename
- response_dict["students_count"] = students_count
- response_dict["column_headers"] = column_headers
- response_dict["students_data_set"] = json_data
- return HttpResponse(json.dumps(response_dict, cls=NodeJSONEncoder))
-
- else:
- error_message = "StudentFindError: Either not an ajax call or not a POST request!!!"
- response_dict["message"] = error_message
- return HttpResponse(json.dumps(response_dict, cls=NodeJSONEncoder))
-
- except OSError as oe:
- error_message = "StudentFindError: " + str(oe) + "!!!"
- response_dict["message"] = error_message
- return HttpResponse(json.dumps(response_dict, cls=NodeJSONEncoder))
-
- except Exception as e:
- error_message = "StudentFindError: " + str(e) + "!!!"
- response_dict["message"] = error_message
- return HttpResponse(json.dumps(response_dict, cls=NodeJSONEncoder))
-
-
-# MIS Reports
-@get_execution_time
-def get_voluntary_teachers(request, group_id):
- """
- This view returns list of students along with required data based on selection criteria
- to student_data_review.html
-
- Arguments:
- group_id - ObjectId of the currently selected group
-
- Returns:
- A dictionary consisting of following key-value pairs:-
- success - Boolean giving the state of ajax call
- message - Basestring giving the error/information message
- """
- response_dict = {'success': False, 'message': ""}
- all_students_text = ""
- group_name, group_id = get_group_name_id(group_id)
- try:
- if request.is_ajax() and request.method == "POST":
- # groupid = request.POST.get("groupid", None)
- # app_id = request.POST.get("app_id", None)
- # app_set_id = request.POST.get("app_set_id", None)
- # stud_reg_year = str(request.POST.get("reg_year", None))
- query_rcvd = str(request.POST.get("query", ''))
- # university_id = request.POST.get("student_belongs_to_university",None)
- # college_id = request.POST.get("student_belongs_to_college",None)
-
- person_gst = node_collection.one({'_type': "GSystemType", 'name': "Voluntary Teacher"}, {'name': 1, 'type_of': 1})
-
- widget_for = []
- query = {}
- result_set = None
- if query_rcvd:
- query = eval(query_rcvd)
- groupid = group_id
- gapp_gst = node_collection.one({'name':"GAPP"})
- mis_gapp = node_collection.one({'member_of':gapp_gst._id,'name':"MIS"})
- app_id = mis_gapp._id
- app_set_id = person_gst._id
-
- person_gs = node_collection.collection.GSystem()
- person_gs.member_of.append(person_gst._id)
- person_gs.get_neighbourhood(person_gs.member_of)
- # university_gst = node_collection.one({'_type': "GSystemType", 'name': "University"})
- mis_admin = node_collection.one({"_type": "Group", "name": "MIS_admin"}, {"_id": 1})
-
-
- rec = node_collection.collection.aggregate([{'$match': query},
- {'$project': {'_id': 0,
- 'stud_id': '$_id',
- 'Name': '$name',
- 'Email ID': '$attribute_set.email_id',
- 'Phone': '$attribute_set.mobile_number',
- 'Street': '$attribute_set.town_city',
- 'Events':'$relation_set.coordinator_of_event'
- }},
- {'$sort': {'Name': 1}}
- ])
- json_data = []
- filename = ""
- column_header = []
- course_section_node_id = course_subsection_node = None
- result_set = rec["result"]
- if result_set:
- # old_dict = result_set[0]
- for old_dict in result_set:
- if old_dict:
- if u"stud_id" in old_dict:
- vt_node = node_collection.one({'_id': ObjectId(old_dict['stud_id'])})
- if vt_node:
- for rel in vt_node.relation_set:
- if rel and 'trainer_of_college' in rel:
- colg_node_id = rel['trainer_of_college'][0]
- colg_node = node_collection.one({'_id': ObjectId(colg_node_id)},{'name':1,'relation_set':1})
- colg_node_name = colg_node.name
- old_dict.update({'College': colg_node_name})
- if colg_node.relation_set:
- for rel in colg_node.relation_set:
- if rel and 'college_affiliated_to' in rel:
- univ_id = rel['college_affiliated_to'][0]
- old_dict.update({'University': [[univ_id]]})
- result_set[0] = old_dict
+ old_dict['Attendance'] = "Pending"
+
+ del old_dict['Attended']
+ del old_dict['Attendees']
+ if u"Session" in old_dict:
+ course_subsection_node = node_collection.one({'_id': ObjectId(old_dict['Session'][0][0])})
+ if course_subsection_node:
+ course_section_node_id = course_subsection_node.prior_node[0]
+ old_dict.update({'Module': [[course_section_node_id]]})
+ if course_section_node_id:
+ course_section_node = node_collection.one({'_id': ObjectId(course_section_node_id)})
+ nussd_course_node = course_section_node.prior_node[0]
+ old_dict.update({'NUSSD Course': [[nussd_course_node]]})
+ if u"stud_id" in old_dict:
+ event_node = node_collection.one({'_id': ObjectId(old_dict['stud_id'])})
+ if event_node:
+ colg_group_id = event_node.group_set[0]
+ colg_group_node = node_collection.one({'_id':ObjectId(colg_group_id)})
+ if colg_group_node.relation_set:
+ for rel in colg_group_node.relation_set:
+ if rel and 'group_of' in rel:
+ colg_node_id = rel['group_of'][0]
+ colg_node = node_collection.one({'_id': ObjectId(colg_node_id)},{'name':1,'relation_set':1})
+ colg_node_name = colg_node.name
+ old_dict.update({'College': colg_node_name})
+ if colg_node.relation_set:
+ for rel in colg_node.relation_set:
+ if rel and 'college_affiliated_to' in rel:
+ univ_id = rel['college_affiliated_to'][0]
+ old_dict.update({'University': [[univ_id]]})
+ result_set[0] = old_dict
if result_set:
for each_dict in result_set:
@@ -5965,10 +5820,9 @@ def get_voluntary_teachers(request, group_id):
json_data.append(new_dict)
# Start: CSV file processing -------------------------------------------
- column_header = [u'University', u'College',u'Name', u'Email ID', u'Phone', u'Street',u'Events']
t = time.strftime("%c").replace(":", "_").replace(" ", "_")
- filename = "csv/" + "voluntary_teachers_" + t + ".csv"
+ filename = "csv/" + gst_name + "_" + t + ".csv"
filepath = os.path.join(STATIC_ROOT, filename)
filedir = os.path.dirname(filepath)
if not os.path.exists(filedir):
@@ -5983,17 +5837,47 @@ def get_voluntary_teachers(request, group_id):
row.update(v)
# End: CSV file processing --------------------------------------------
- # Column headers to be displayed on html
- column_headers = [
- ('University', 'University'),
- ('College', 'College'),
- ("Name", "Name"),
- ("Email ID", "Email ID"),
- ("Phone", "Phone"),
- ("Street", "Street"),
- ("Events", "Events"),
- ]
- # college = node_collection.one({'_id': ObjectId(college_id)}, {"name": 1})
+ if person_gst.name == "Voluntary Teacher":
+ # Column headers to be displayed on html
+ column_headers = [
+ ('University', 'University'),
+ ('College', 'College'),
+ ("Name", "Name"),
+ ("Email ID", "Email ID"),
+ ("Phone", "Phone"),
+ ("Street", "Street"),
+ ("Events", "Events"),
+ ]
+ elif person_gst.name == "Classroom Session":
+ column_headers = [
+ ("University", "University"),
+ ("College", "College"),
+ ("Name", "Name"),
+ ("Course", "Course"),
+ ("VT", "VT"),
+ ("NUSSD Course", "NUSSD Course"),
+ ("Module", "Module"),
+ ('Session', 'Session'),
+ ('Start', 'Start'),
+ ('End', 'End'),
+ ('Batch', 'Batch'),
+ ('Status', 'Status'),
+ ('Attendance', 'Attendance'),
+
+ ]
+ elif person_gst.name == "Student":
+ column_headers = [
+ ('University', 'University'),
+ ('College ( Graduation )', 'College'),
+ ("Name", "Name"),
+ ("Enrollment Code", "Enr Code"),
+ ("Email ID", "Email ID"),
+ ('Year of Study', 'Year of Study'),
+ ('Contact Number (Mobile)', 'Phone'),
+ ('Degree Name / Highest Degree', 'Degree'),
+ ('House / Street', 'Street')
+ ]
+
students_count = len(json_data)
response_dict["success"] = True
response_dict["groupid"] = group_id
@@ -6006,16 +5890,16 @@ def get_voluntary_teachers(request, group_id):
return HttpResponse(json.dumps(response_dict, cls=NodeJSONEncoder))
else:
- error_message = "StudentFindError: Either not an ajax call or not a POST request!!!"
+ error_message = "ReportFetchError: Either not an ajax call or not a POST request!!!"
response_dict["message"] = error_message
return HttpResponse(json.dumps(response_dict, cls=NodeJSONEncoder))
except OSError as oe:
- error_message = "StudentFindError: " + str(oe) + "!!!"
+ error_message = "ReportFetchError: " + str(oe) + "!!!"
response_dict["message"] = error_message
return HttpResponse(json.dumps(response_dict, cls=NodeJSONEncoder))
except Exception as e:
- error_message = "StudentFindError: " + str(e) + "!!!"
+ error_message = "ReportFetchError: " + str(e) + "!!!"
response_dict["message"] = error_message
return HttpResponse(json.dumps(response_dict, cls=NodeJSONEncoder))
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py
index b8c1aca..d66e654 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py
@@ -612,9 +612,7 @@ def get_node_common_fields(request, node, group_id, node_type, coll_set=None):
else:
name = request.POST.get('name', '').strip()
content_org = request.POST.get('content_org')
- tags = request.POST.get('tags','')
- # print "tags: --------- ", tags
-
+ tags = request.POST.get('tags')
language = request.POST.get('lan')
sub_theme_name = request.POST.get("sub_theme_name", '')
add_topic_name = request.POST.get("add_topic_name", '')
@@ -856,6 +854,8 @@ def build_collection(node, check_collection, right_drawer_list, checked):
for each in nlist:
if each not in node.collection_set:
node.collection_set.append(each)
+ node.status = u"PUBLISHED"
+ node.save()
# After adding it to collection_set also make the 'node' as prior node for added collection element
node_collection.collection.update({'_id': ObjectId(each), 'prior_node': {'$nin':[node._id]} },{'$push': {'prior_node': ObjectId(node._id)}})
@@ -1933,7 +1933,6 @@ def create_grelation(subject_id, relation_type_node, right_subject_id_or_list, *
"""
gr_node = None
multi_relations = False
-
try:
subject_id = ObjectId(subject_id)
@@ -1947,6 +1946,7 @@ def create_grelation(subject_id, relation_type_node, right_subject_id_or_list, *
gr_node.status = u"PUBLISHED"
gr_node.save()
+
gr_node_name = gr_node.name
info_message = "%(relation_type_text)s: GRelation (%(gr_node_name)s) " % locals() \
+ "created successfully.\n"
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py
index f3a8cd3..fc0e815 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/mis.py
@@ -865,7 +865,7 @@ def get_mis_reports(request, group_id, **kwargs):
if each_rel and "organization_belongs_to_state" in each_rel:
statename = each_rel["organization_belongs_to_state"]
# print "\n\n statename", statename
- print "\n\nquery",query
+ # print "\n\nquery",query
rec = node_collection.collection.aggregate([
{
'$match': query