Skip to content

Commit

Permalink
SAK-47073-1 Checkbox option in Calendar to create Tasks from events h…
Browse files Browse the repository at this point in the history
…as been removed (sakaiproject#10419)
  • Loading branch information
druiz309 authored Apr 13, 2022
1 parent 54a461a commit e5440b8
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 44 deletions.
1 change: 0 additions & 1 deletion calendar/calendar-bundles/resources/calendar.properties
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ new.adddrop = Add/remove attachments
new.post = Save Event
new.hours = Hours
new.minutes = Minutes
new.createtask = Create a task on student's dashboard

#Revise Vm
rev.revising = Editing event...
Expand Down
1 change: 0 additions & 1 deletion calendar/calendar-bundles/resources/calendar_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ new.adddrop=A\u00f1adir/bajar adjuntos
new.post=Guardar evento
new.hours=Horas
new.minutes=Minutos
new.createtask=Crear una tarea en el widget de Tareas

#Revise Vm
rev.revising=Revisando asunto del horario...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ public class CalendarAction
private static final String FORM_ALIAS = "alias";
private static final String FORM_ICAL_ENABLE = "icalEnable";
private static final String ICAL_EXTENSION = ".ics";

private static final String CREATE_TASK = "createTask";

/** state selected view */
private static final String STATE_SELECTED_VIEW = "state_selected_view";
Expand Down Expand Up @@ -4735,9 +4733,6 @@ public void doAdd(RunData runData, Context context) {
type = runData.getParameters().getString("eventType");
String location = "";
location = runData.getParameters().getString("location");
String taskCreation = "";
taskCreation = runData.getParameters().getString("createTask");
boolean createTask = CREATE_TASK.equals(taskCreation);

String calId = state.getPrimaryCalendarReference();
try {
Expand Down Expand Up @@ -4916,32 +4911,31 @@ else if( event_startTime.before(now_time) && state.getIsPastAlertOff() ) {

// Create task
String reference = "/calendar/dashboard/" + calendarObj.getContext() + Entity.SEPARATOR + calendarObj.getId() + Entity.SEPARATOR + edit.getId();
if (createTask) {
Task task = new Task();
task.setSiteId(calendarObj.getContext());
task.setReference(reference);
task.setSystem(true);
task.setDescription(title);
Date dueDate = new Date(event_startTime.getTime());
task.setDue(dueDate == null ? null : dueDate.toInstant());
Set<String> users = new HashSet();
if (CalendarEvent.EventAccess.SITE.equals(access)) {
Site site = SiteService.getSite(calendarObj.getContext());
users = site.getUsersIsAllowed("section.role.student");
} else if (CalendarEvent.EventAccess.GROUPED.equals(access)){
Set<String> groupRefs = new HashSet<>();
for (Group group : groups) {
groupRefs.add(group.getReference());
users.addAll(group.getMembers().stream()
.map(m -> m.getUserId()).collect(Collectors.toSet()));
}
task.setGroups(groupRefs);
}
if (users.size() == 0) {
users.add(UserDirectoryService.getCurrentUser().getId());
Task task = new Task();
task.setSiteId(calendarObj.getContext());
task.setReference(reference);
task.setSystem(true);
task.setDescription(title);
Date dueDate = new Date(event_startTime.getTime());
task.setDue(dueDate == null ? null : dueDate.toInstant());
Set<String> users = new HashSet();
if (CalendarEvent.EventAccess.SITE.equals(access)) {
Site site = SiteService.getSite(calendarObj.getContext());
users = site.getUsersIsAllowed("section.role.student");
} else if (CalendarEvent.EventAccess.GROUPED.equals(access)){
Set<String> groupRefs = new HashSet<>();
for (Group group : groups) {
groupRefs.add(group.getReference());
users.addAll(group.getMembers().stream()
.map(m -> m.getUserId()).collect(Collectors.toSet()));
}
taskService.createTask(task, users, Priorities.HIGH);
task.setGroups(groupRefs);
}
if (users.size() == 0) {
users.add(UserDirectoryService.getCurrentUser().getId());
}
taskService.createTask(task, users, Priorities.HIGH);

} catch (IdUnusedException e) {
addAlert(sstate, rb.getString("java.alert.noexist"));
log.debug(".doAdd(): " + e);
Expand Down Expand Up @@ -5076,9 +5070,6 @@ public void doUpdate(RunData runData, Context context)
type = runData.getParameters().getString("eventType");
String location = "";
location = runData.getParameters().getString("location");
String taskCreation = "";
taskCreation = runData.getParameters().getString("createTask");
boolean createTask = CREATE_TASK.equals(taskCreation);

String calId = state.getPrimaryCalendarReference();
try
Expand Down Expand Up @@ -5340,7 +5331,7 @@ else if (scheduleTo.equals("groups"))
Date dueDate = new Date(timeObj.getTime());
task.setDue(dueDate == null ? null : dueDate.toInstant());
taskService.saveTask(task);
} else if (createTask) {
} else {
Task task = new Task();
task.setSiteId(calendarObj.getContext());
task.setReference(reference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,11 +710,7 @@ $(function() {
<p class="act labelindnt">
<input type="submit" name="eventSubmit_doEditfrequency" value="$tlang.getString("new.setfreq")" />
</p>

<p class="shorttext">
<input type="checkbox" name="createTask" id="createTask" value="createTask" checked/>
<label for="createTask">$tlang.getString("new.createtask")</label>
</p>

<p class="shorttext">
<label for="eventType">
$tlang.getString("new.itemtype")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,7 @@ $(function() {
<p class="act">
<input type="submit" name="eventSubmit_doEditfrequency" value="$tlang.getString('new.setfreq') " />
</p>
<p class="shorttext">
<input type="checkbox" name="createTask" id="createTask" value="createTask"/>
<label for="createTask">$tlang.getString("new.createtask")</label>
</p>

<p class="shorttext">
<label for="eventType">
$tlang.getString("new.itemtype")
Expand Down

0 comments on commit e5440b8

Please sign in to comment.