Skip to content

Commit

Permalink
Instructional Offering Configuration: New GWT-based Page
Browse files Browse the repository at this point in the history
- Instructional Offering Configuration page rewritten to GWT to make the page faster and more reliable
  - to use the old (Struts2-based) page, set unitime.legacy.course.instr_offering_config to true

- also, when managing department is changed, only remove preferences that no longer apply (e.g., keep global room feature/group preferences)
  - former behavior (clear all room-related preferences) set unitime.legacy.course.clear_preferences to true
- also applies to Multiple Class Setup page (but in both cases, only when the new GWT-based page is used)
  • Loading branch information
tomas-muller committed May 3, 2024
1 parent 5a7e04e commit fcf8377
Show file tree
Hide file tree
Showing 18 changed files with 3,134 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
@Result(name = "showConfigDetail", type = "tiles", location = "instructionalOfferingDetail.tiles"),
@Result(name = "addConfig", type = "redirect", location = "/instructionalOfferingConfigEdit.action",
params = { "form.instrOfferingId", "${form.instrOfferingId}", "uid", "${form.ctrlCrsOfferingId}", "op", "${op}"}),
@Result(name = "addConfigGWT", type = "redirect", location = "/gwt.action",
params = { "page", "instrOfferingConfig", "offering", "${form.instrOfferingId}", "op", "${op}"}),
@Result(name = "showInstructionalOfferings", type = "redirect", location = "/instructionalOfferingSearch.action",
params = { "backType", "InstructionalOffering", "backId", "${form.instrOfferingId}",
"anchor", "back"}),
Expand Down Expand Up @@ -195,15 +197,21 @@ public String execute() throws Exception {
// Add Configuration
if (op.equals(MSG.actionAddConfiguration())) {
sessionContext.checkPermission(form.getInstrOfferingId(), "InstructionalOffering", Right.InstrOfferingConfigAdd);
return "addConfig";
if (ApplicationProperty.LegacyInstrOfferingConfig.isTrue())
return "addConfig";
else
return "addConfigGWT";
}

// Make Offering 'Offered'
if(op.equals(MSG.actionMakeOffered())) {
sessionContext.checkPermission(form.getInstrOfferingId(), "InstructionalOffering", Right.OfferingMakeOffered);
doMakeOffered();
// Redirect to config edit
return "addConfig";
if (ApplicationProperty.LegacyInstrOfferingConfig.isTrue())
return "addConfig";
else
return "addConfigGWT";
}

// Make Offering 'Not Offered'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3106,7 +3106,19 @@ public enum ApplicationProperty {
@DefaultValue("false")
@Description("Multiple Class Setup: switch the user interface back to the old (Struts-based) class setup page")
LegacyClassSetup("unitime.legacy.course.multiple_class_setup"),


@Type(Boolean.class)
@Since(4.8)
@DefaultValue("false")
@Description("Instructional Offering Config: switch the user interface back to the old (Struts-based) offering configuration page")
LegacyInstrOfferingConfig("unitime.legacy.course.instr_offering_config"),

@Type(Boolean.class)
@Since(4.8)
@DefaultValue("false")
@Description("Multiple Class Setup & Instructional Offering Config: when set to true, clear out all prefrences when a managing department is updated (except of time preferences which can be weakened)")
ClearPreferencesWhenManagingDepartmentIsChanged("unitime.legacy.course.clear_preferences"),

@Type(Boolean.class)
@DefaultValue("false")
@Description("Departments: switch the user interface back to the old (Struts-based) departments pages")
Expand Down
2 changes: 2 additions & 0 deletions JavaSource/org/unitime/timetable/gwt/client/Components.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.unitime.timetable.gwt.client.instructor.survey.InstructorSurveyWidget;
import org.unitime.timetable.gwt.client.instructor.survey.OfferingDetailWidget;
import org.unitime.timetable.gwt.client.offerings.AssignInstructorsButton;
import org.unitime.timetable.gwt.client.offerings.InstrOfferingConfigButton;
import org.unitime.timetable.gwt.client.offerings.MultipleClassSetupButton;
import org.unitime.timetable.gwt.client.page.UniTimeBack;
import org.unitime.timetable.gwt.client.page.UniTimeMenuBar;
Expand Down Expand Up @@ -89,6 +90,7 @@ public enum Components {
instructorSurvey("UniTimeGWT:InstructorSurvey", true, new ComponentFactory() { public void insert(RootPanel panel) { new InstructorSurveyWidget().insert(panel); } }),
instructorSurveyOffering("UniTimeGWT:InstructorSurveyOffering", true, new ComponentFactory() { public void insert(RootPanel panel) { new OfferingDetailWidget().insert(panel); } }),
multipleClassSetup("UniTimeGWT:MultipleClassSetupButton", true, new ComponentFactory() { public void insert(RootPanel panel) { new MultipleClassSetupButton(true).insert(panel); } }),
instrOfferingConfig("UniTimeGWT:InstrOfferingConfigButton", true, new ComponentFactory() { public void insert(RootPanel panel) { new InstrOfferingConfigButton(true).insert(panel); } }),
;

private String iId;
Expand Down
5 changes: 5 additions & 0 deletions JavaSource/org/unitime/timetable/gwt/client/Pages.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.unitime.timetable.gwt.client.limitandprojectionsnapshot.LimitAndProjectionSnapshotPage;
import org.unitime.timetable.gwt.client.offerings.AssignClassInstructorsPage;
import org.unitime.timetable.gwt.client.offerings.CourseOfferingEdit;
import org.unitime.timetable.gwt.client.offerings.InstrOfferingConfigPage;
import org.unitime.timetable.gwt.client.offerings.MultipleClassSetupPage;
import org.unitime.timetable.gwt.client.pointintimedata.PointInTimeDataReportsPage;
import org.unitime.timetable.gwt.client.reservations.ReservationEdit;
Expand Down Expand Up @@ -296,6 +297,10 @@ public enum Pages {
public Widget create() { return new MultipleClassSetupPage(); }
public String name(GwtMessages messages) { return messages.pageMultipleClassSetup(); }
}),
instrOfferingConfig(new PageFactory() {
public Widget create() { return new InstrOfferingConfigPage(); }
public String name(GwtMessages messages) { return messages.pageInstrOfferingConfig(); }
}),
;

private PageFactory iFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.unitime.timetable.gwt.client.offerings;

import org.unitime.localization.messages.CourseMessages;
import org.unitime.timetable.gwt.client.ToolBox;
import org.unitime.timetable.gwt.client.aria.AriaButton;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.RootPanel;

/**
* @author Tomas Muller
*/
public class InstrOfferingConfigButton extends AriaButton {
protected static final CourseMessages MESSAGES = GWT.create(CourseMessages.class);
private Long iConfigId = null;

public InstrOfferingConfigButton(boolean editable) {
super(MESSAGES.actionEditConfiguration());
setTitle(MESSAGES.titleEditConfiguration());
addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ToolBox.open(GWT.getHostPageBaseURL() + "gwt.jsp?page=instrOfferingConfig&id=" + iConfigId);
}
});
setVisible(editable);
setEnabled(editable);
}

public void insert(final RootPanel panel) {
iConfigId = Long.valueOf(panel.getElement().getInnerText());
panel.getElement().setInnerText(null);
panel.add(this);
panel.setVisible(true);
}
}
Loading

0 comments on commit fcf8377

Please sign in to comment.