Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nroer site updates #1956

Open
wants to merge 6 commits into
base: beta
Choose a base branch
from
43 changes: 23 additions & 20 deletions gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/in-line-texteditor.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% block head %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="/static/ndf/bower_components/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML" async></script> <!-- checked -->
<script src="/static/ndf/js/MediaStreamRecorder.js"></script>
<script src="/static/ndf/js/MediaStreamRecorder.js"></script>
<script src="/static/ndf/js/adapter.js"></script>

{% if user.is_authenticated %}
Expand Down Expand Up @@ -45,7 +45,7 @@

<div {% if user_access_priv == "allow" %} onclick="createDiscussion()" class="ckeditor-comment explore-button "{% else %} class="ckeditor-comment explore-button user_not_enrolled" {% endif %} id="create-discussion" data-id="{{ node.pk }}" style="margin-bottom:0;">
{% if thr_int_type %}
<i class="fa fa-comments"></i> {% if thr_int_type == "None" %} Feedback {% else %} {{thr_int_type}} {% endif %}
<i class="fa fa-comments"></i> {% if thr_int_type == "None" %} Feedback {% else %} {{thr_int_type}} {% endif %}
{% if all_replies|length > 0 %}({{all_replies|length }}) {% endif %}
{% else %}
<i class="fa fa-comments"></i> {{default_discussion_lbl}} {% if all_replies|length > 0 %} ({{all_replies|length }}) {% endif %}
Expand Down Expand Up @@ -77,7 +77,7 @@
<div clas="discussion-title row " >
<div class="discussion-title-username">
<a href="#" style="color:#ADABAB !important" title=" {{ each_reply.username }}">
{{ each_reply.contributors|join:', ' }}{% include 'ndf/rating.html' with if_comments=True nodeid=each_reply.oid %}
{{ each_reply.contributors|join:', ' }}{% include 'ndf/rating.html' with if_comments=True nodeid=each_reply.oid %}
</a>
<small style="float:right;color:#999999">{{ each_reply.last_update }}</small>
</div>
Expand Down Expand Up @@ -109,14 +109,14 @@
<div class="discussion-footer">
<a data-id='{{ each_reply.oid }}' {% if user_access_priv == "allow" %} class="reply-btn reply_res" onclick='openCKEditor($(this),"{{each_reply.oid}}")' {% else %} class="user_not_enrolled reply-btn reply_res" {% endif %} data-org-content='{{ each_reply.content }}'>
<i class="fa fa-reply"></i>
{% trans "Reply" %}
{% trans "Reply" %}
</a>
{% if request.user.id == each_reply.userid or is_gstaff or request.user.id in group_object.group_admin %}
<a class="reply-btn delete_res" data-id='{{ each_reply.oid }}' data-userid="{{each_reply.userid}}" onclick="deleteReply($(this))" style="float:right">
<i class="fa fa-trash-o"></i>
{% trans "Delete" %}
</a>
<a class="reply-btn edit_res" data-id='{{ each_reply.oid }}' data-userid="{{each_reply.userid}}" onclick='editreply($(this))' style="float:right;margin-right:10px!important">
<a class="reply-btn edit_res" data-id='{{ each_reply.oid }}' data-userid="{{each_reply.userid}}" onclick='editreply($(this))' style="float:right;margin-right:10px!important">
<i class="fa fa-pencil-square-o"></i>
{% trans "Edit" %} |
</a>
Expand Down Expand Up @@ -210,7 +210,7 @@

//$("#create-discussion").trigger("click");
}

else{ alert(data) }
}//,

Expand Down Expand Up @@ -306,7 +306,7 @@
htmlReply +="<a class='reply-btn delete_res' data-id='" + data[1]+ "'data-userid='"+ data[5] +"' onclick='deleteReply($(this))' style='float:right'><i class='fa fa-trash-o'></i> Delete"
htmlReply +="<a class='reply-btn edit_res' data-id='"+ data[1] +"' data-userid='{{each_reply.userid}}' data-userid='"+ data[5] +"' onclick='editreply($(this))' style='float:right;margin-right:10px!important'><i class='fa fa-pencil-square-o'></i> Edit |"
}
+"</div>"
+"</div>"
+"</div>"
+"</div>";
return htmlReply;
Expand Down Expand Up @@ -354,7 +354,7 @@
$("#orgitdownreps").val(""); // make textarea empty
if(priorNodeId == "{{ node.pk }}") // main reply
{

//sample format of data = [0:"status_info", 1:"reply_id", 2:"prior_node", 3:"html_content", 4:"org_content", 5:"user_id", 6:"user_name", 7:"created_at" ]
// add reply text content after #replies-area
var parent_margin_level = $(sourceObj).closest("div").attr("class");
Expand All @@ -364,16 +364,16 @@
else // sub-reply
{
parent_margin_level = $(sourceObj).attr("data-reply-level");
child_margin_level = parseInt(parent_margin_level) + 1;
child_margin_level = parseInt(parent_margin_level) + 1;


$(sourceObj).after(createReplyHTML('margin-left:'+((child_margin_level-1)*48)+'px', data,parseInt(parent_margin_level)+1));

}
// updating tab-text
old_count = old_count + 1
updateDiscussionTabText();

}
else if( data[0] == "no_content" ){

Expand All @@ -388,12 +388,12 @@
alert(" {% trans 'Please provide the reply content.' %}")
} // --- END of IF-ELSE
// $.ajax({
// url: "{% url 'get_gin_line_template' group_id node.pk %}",
// url: "{% url 'get_gin_line_template' group_id node.pk %}",
// type: "GET",
// datatype: "html",

// success: function(data) {

// alert(data);
// $(".comment-sections:visible").html(data);
// }
Expand Down Expand Up @@ -506,7 +506,7 @@
if(checkCurrEdit()){
return false;
}

var parent_div = sourceObj.parent();

parent_div.append("<a class='reply-btn save_res' onclick='save_reply($(this))' data-id='" + curr_data_id + "' style='float:right;margin-right:10px!important'><i class='fa fa-floppy-o'></i> Save</a>");
Expand Down Expand Up @@ -535,8 +535,8 @@
setCurrNodeEdit(1);
// $(sourceObj).append(data);
},
});
});


}

Expand Down Expand Up @@ -567,7 +567,7 @@
edit_res = curr_thread.closest('.edit_res');
reply_res = curr_thread.closest('.reply_res');
delete_res = curr_thread.closest('.delete_res');

content_thread.show();
reply_res.show();
edit_res.show();
Expand All @@ -594,7 +594,10 @@
}
};
}, 10000);
</script>


function check_user_access_policy(obj){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use widget_user_access_modal which does this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any update on this?

alert("Please login to rate this resource");
return false;
}

</script>
2 changes: 1 addition & 1 deletion gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/lms.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
{% if not group_object.project_config.resource_name %}{% trans "Resources" %}{% else %}{{group_object.project_config.resource_name}} {% endif %}</a> </li>
{% if group_object.name != "help"%}
<li>
<a href="{% url 'course_gallery' group_id %}" {% if title == 'gallery' or title == "asset_gallery_detail" %} class="selected" {% endif %} tabindex="4" title="Upload and share your files such as images, audios, videos, spreadsheets"> <i class="fi-photo "></i>{% if 'Group' in group_object_member_of_names_list %} {% trans "E-Library" %} {% else %} {% trans "Gallery" %}{% endif %}</a>
<a href="{% url 'course_gallery' group_id %}" {% if title == 'gallery' or title == "asset_gallery_detail" %} class="selected" {% endif %} tabindex="4" title="Upload and share your files such as images, audios, videos, spreadsheets"> <i class="fi-photo "></i>{% if 'Group' in group_object_member_of_names_list and group_object.name != "home" %} {% trans "Gallery" %} {% else %} {% trans "E-Library" %}{% endif %}</a>
</li>


Expand Down
4 changes: 4 additions & 0 deletions gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/rating.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<!-- <div id="rating-bar" class="show-on-hover"> -->
{% block body_content %}
<script src="/static/ndf/js/rating.js"></script>
<script src="/static/ndf/js/gstudio-functions.js"></script>
{% if if_comments %}
{% get_node nodeid as node %}

Expand All @@ -15,7 +16,10 @@

<form style="display: inline-block" id="form-for-{{node.pk}}">
<!-- Sets the rating values as data attributes -->
<input type="hidden" name="csrf_token" class="csrf_token" value= "{{csrf_token}}">
<input type="hidden" name="group_id" class="group_id" value= "{{group_id}}">
<input type="hidden" name="is_contributor" class="is-contributor-{{node.pk}}" "{% if request.user.id in node.contributors %}" value= "True" "{% endif %}">
<input type="hidden" name="is_authenticated" class="is_authenticated" "{% if user.is_authenticated %}" value="True" "{% else %}" value= "False" "{% endif %}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_authenticated flag can be checked on templates using block-tags and also in views. why would we need a hidden variable for this?

<input type="hidden" name="user_access_priv" class="user_access_priv" value= "{{user_access_priv}}">
<span datat-tooltip title="Your rating" class="lbl_tag" style="display: inline-block">
<div id="rating-area-{{node.pk}}" {% if user_access_priv == "allow" %} data-node="{{node}}" data-avg-rating="{{ratings.avg}}" data-votes="{{ratings.tot}}" class="rating-bar rating-bar-{{node.pk}}" data-user-rating="{{ratings.user_rating}}" {% else %} class=" rating-bar rating-bar-{{node.pk}}show user_not_enrolled" {% endif %}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h5>{% trans 'Search User by name : ' %}</h5>
</div>
</div>
<div class="row">
<input type="button" class="radius button search_stud_btn asset-save-button" style="width: 8rem;"value="Find Students" />
<input type="button" class="radius button search_stud_btn asset-save-button" style="width: 10rem;"value="Find Members" />
</div>
</div>
<div id="student_count_div"></div>
Expand Down
2 changes: 1 addition & 1 deletion gnowsys-ndf/gnowsys_ndf/ndf/views/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -5826,7 +5826,7 @@ def forbid_private_group(request, group_obj):
try:
if group_obj.access_policy == u'PRIVATE' or group_obj.group_type == u'PRIVATE':
from gnowsys_ndf.ndf.templatetags.ndf_tags import user_access_policy
access_flag = user_access_policy(group_obj, request.user)
access_flag = user_access_policy(group_obj._id, request.user)
if access_flag == "disallow":
# print "\naccess_flag: ", access_flag, len(access_flag)
raise PermissionDenied()
Expand Down