Skip to content

Commit

Permalink
S2U-30 5.1.4.1 Assignments: When an assignment is created, assign it …
Browse files Browse the repository at this point in the history
…by default to the groups where the user is an instructor - Master (sakaiproject#12036)
  • Loading branch information
JuanDavid102 authored Oct 27, 2023
1 parent 88eaaa7 commit 4bff655
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3063,6 +3063,20 @@ protected String build_instructor_new_edit_assignment_context(VelocityPortlet po
}
context.put("groupsWithUserSubmission", groupsWithUserSubmission);
}
} else {
boolean instructorGroupsProp = serverConfigurationService.getBoolean("assignments.assign.to.instructor.groups", false);
Collection<Group> instructorGroups = new ArrayList<Group>();
if (instructorGroupsProp) {
try {
Site site = siteService.getSite(siteId);
User user = (User) state.getAttribute(STATE_USER);
instructorGroups = site.getGroupsWithMember(user.getId());

} catch (IdUnusedException ex){
log.warn("Site not found for site id:{}", siteId);
}
}
context.put("instructorGroups", instructorGroups);
}

// set up context variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ can be either all members of the site, all members of selected groups, or the se
#end
<input type="radio" name="$name_AssignTo" id="groups" value="$value_AssignTo_IndividualsFromGroups"
onclick="$hideGB$('#groupTableContainer').fadeIn('slow'); ASN_INE.validateGroupSelection();ASN.resizeFrame(); if($!isTimesheet){ASN.enableTimesheetSetupSection();}"
#if( $value_AssignTo == $value_AssignTo_IndividualsFromGroups && !$selectedGroupsNotFound ) checked="checked"
#if( ($value_AssignTo == $value_AssignTo_IndividualsFromGroups && !$selectedGroupsNotFound) || ($instructorGroups && $instructorGroups.size() > 0) ) checked="checked"
#elseif(!$!groupsList || $disableIndividual) disabled="disabled"
#end />
$tlang.getString("displayto.selected")
Expand Down Expand Up @@ -90,7 +90,7 @@ can be either all members of the site, all members of selected groups, or the se
</div>

## Groups multiselect, visible when Option 2 or 3 is chosen
#if( ($value_AssignTo == $value_AssignTo_Groups || $value_AssignTo == $value_AssignTo_IndividualsFromGroups) && !$selectedGroupsNotFound )
#if( (($value_AssignTo == $value_AssignTo_Groups || $value_AssignTo == $value_AssignTo_IndividualsFromGroups) && !$selectedGroupsNotFound) || ($instructorGroups && $instructorGroups.size() > 0) )
#set( $listDisplay = "block" )
#else
#set( $listDisplay = "none" )
Expand All @@ -110,6 +110,13 @@ can be either all members of the site, all members of selected groups, or the se
#set($groupDisabled = $groupsWithUserSubmission.contains($aGroup))
#end
#end
#if (!$assignmentGroups)
#foreach($instructorGroup in $instructorGroups )
#if($group.Id == $instructorGroup.Id)
#set($selected = true)
#end
#end
#end
<option value="$group.Id" #if($selected) selected #end #if($groupDisabled) disabled #end>$formattedText.escapeHtml($group.Title) #if("$!description" != "") ($description) #end</option>
#end
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,10 @@
# DEFAULT: false (use traditional entity links)
# assignment.browse.deepLink=true

# S2U-30 Assignments will be assigned by default to the instructors' groups.
# DEFAULT: False (Enabled, assigned to the instructor groups and not the site)
# assignments.assign.to.instructor.groups=true

# ######################################
# SAK-29406 Allow Assignment tool to grade with two decimal points
# ######################################
Expand Down

0 comments on commit 4bff655

Please sign in to comment.