SAKIII-4306 All managers can be removed from worlds #1295

Closed
wants to merge 9 commits into
from

Conversation

Projects
None yet
2 participants

croby was assigned Nov 22, 2011

jsloane added some commits Nov 22, 2011

@jsloane jsloane SAKIII-4306 resolve merge conflict f22ee14
@jsloane jsloane SAKIII-4306 display gritter error instead of disabling the button 4fa97fd
@jsloane jsloane Merge branch 'master' of github.com:sakaiproject/3akai-ux into SAKIII…
…-4306

* 'master' of github.com:sakaiproject/3akai-ux: (21 commits)
  SAKIII-4302 Creating message bundle message for joining a joinable group immediately. Turning on message on joinbuttons to match behavior of clicking the plus icon on group item rows in Search and others memberships.
  SAKIII-4299 Consolidating a selector
  SAKIII-4299 add unit test to check for alt attributes on form input elements
  SAKIII-3832 Wording change and reordering the bundle
  SAKIII-3832 wrap group and user actions on carousel in fieldsets
  NOJIRA - Some wording changes
  NOJIRA - Modifying some translated text
  SAKIII-4324 dont add files with 0 size to the upload queue
  SAKIII-4318 Modify content preview widget to initialise in a more generic way
  SAKIII-4317
  SAKIII-4281 Fix height of text
  SAKIII-4317 sakai_user was undefined
  SAKIII-4336 setting zindex for newuploadcontent jqm
  SAKIII-4317 Add documentation to API function
  SAKIII-4312 fixing sendmessage widget with rss widget
  SAKIII-4330 set accept link to open join requests widget
  SAKIII-4344 set sakai:fileextension for d&d upload
  SAKIII-4317 Initialise content comments widget in a more generic way
  SAKIII-4281 Fix wrapping of buttons in contacts header
  SAKIII-4281 Fix wrapping of buttons in memberships page
  ...
2bb54eb
@jsloane jsloane SAKIII-4306 resolving merge conflicts 1568442

@croby croby commented on an outdated diff Nov 28, 2011

dev/lib/sakai/sakai.api.groups.js
+ /**
+ * Determines whether the current user is allowed to leave the group
+ *
+ * @param groupid {String} id of the group to check
+ * @param {Object} meData the data from sakai.api.User.data.me
+ * @param {Function} callback Function to be called on complete - callback
+ */
+ isAllowedToLeave : function(groupid, meData, callback) {
+ sakaiGroupsAPI.getMembers(groupid,"",function(membersSuccess, memberData){
+ sakaiGroupsAPI.getGroupAuthorizableData(groupid, function(membershipSuccess, membershipData){
+ var leaveAllowed = false;
+ if (!sakaiGroupsAPI.isCurrentUserAManager(groupid, meData, membershipData.properties)) {
+ // Members are always allowed to leave the group, managers should always be present and cannot leave when they are the last one in the group
+ leaveAllowed = true;
+ } else {
+ var roles = $.parseJSON(membershipData.properties["sakai:roles"]);
@croby

croby Nov 28, 2011

Contributor

Please use the sakai.api.Groups.getManagerCount function for this. Line 469 below is throwing an error due to the new world templates work

@croby croby commented on an outdated diff Nov 28, 2011

devwidgets/mymemberships/javascript/mymemberships.js
@@ -352,11 +363,17 @@ require(["jquery", "sakai/sakai.api.core"], function($, sakai) {
});
$(".s3d-actions-delete", $rootel).live("click", function() {
- var msg = sakai.api.i18n.getValueForKey("ARE_YOU_SURE_YOU_WANT_TO_LEAVE","mymemberships").replace("{groupname}",'<span class="s3d-bold">'+$(this).data("sakai-entityname")+'</span>');
- $("#mymemberships_are_you_sure").html(msg);
- $("#mymemberships_delete_membership_confirm").data("sakai-entityid", $(this).data("sakai-entityid"));
- $("#mymemberships_delete_membership_confirm").data("sakai-entityname", $(this).data("sakai-entityname"));
- $("#mymemberships_delete_membership_dialog").jqmShow();
+ if ($(this).hasClass("mymemberhips_disabled_leave")) {
+ sakai.api.Util.notification.show(sakai.api.i18n.getValueForKey("GROUP_MEMBERSHIP"),
+ sakai.api.i18n.getValueForKey("UNABLE_TO_LEAVE", "mymemberships").replace("{groupname}", $(this).data("sakai-entityname")),
+ sakai.api.Util.notification.type.ERROR);
+ } else {
+ var msg = sakai.api.i18n.getValueForKey("ARE_YOU_SURE_YOU_WANT_TO_LEAVE", "mymemberships").replace("{groupname}", '<span class="s3d-bold">' + $(this).data("sakai-entityname") + '</span>');
+ $("#mymemberships_are_you_sure").html(msg);
+ $("#mymemberships_delete_membership_confirm").data("sakai-entityid", $(this).data("sakai-entityid"));
@croby

croby Nov 28, 2011

Contributor

This should be .attr("data-sakai-entityid") for both of these and both below

Contributor

croby commented Nov 29, 2011

Verified & Merged

croby closed this Nov 29, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment