Skip to content
Snippets Groups Projects
Commit 11f02052 authored by srosse's avatar srosse
Browse files
parents da8c2a10 a0c28c56
No related branches found
No related tags found
No related merge requests found
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.modules.appointments.ui;
import static org.olat.core.gui.translator.TranslatorHelper.translateAll;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement;
import org.olat.core.gui.components.form.flexible.impl.FormBasicController;
import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.course.editor.NodeEditController;
import org.olat.course.nodes.AppointmentsCourseNode;
import org.olat.modules.ModuleConfiguration;
/**
*
* Initial date: 13 Apr 2020<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class AppointmentsConfigController extends FormBasicController {
private static final String KEY_COACH = "role.coach";
private static final String[] EDIT_TOPIC_KEYS = new String[] { KEY_COACH };
private static final String[] EDIT_APPOINTMENT_KEYS = new String[] { KEY_COACH };
private MultipleSelectionElement editTopicEl;
private MultipleSelectionElement editAppointmentEl;
private ModuleConfiguration config;
public AppointmentsConfigController(UserRequest ureq, WindowControl wControl, AppointmentsCourseNode courseNode) {
super(ureq, wControl, LAYOUT_BAREBONE);
config = courseNode.getModuleConfiguration();
initForm(ureq);
}
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FormLayoutContainer rightsCont = FormLayoutContainer.createDefaultFormLayout("rights", getTranslator());
formLayout.add(rightsCont);
rightsCont.setFormTitle(translate("user.rights"));
editTopicEl = uifactory.addCheckboxesVertical("config.edit.topic", rightsCont, EDIT_TOPIC_KEYS,
translateAll(getTranslator(), EDIT_TOPIC_KEYS), 1);
editTopicEl.select(KEY_COACH, config.getBooleanSafe(AppointmentsCourseNode.CONFIG_COACH_EDIT_TOPIC));
editTopicEl.addActionListener(FormEvent.ONCHANGE);
editAppointmentEl = uifactory.addCheckboxesVertical("config.edit.appointment", rightsCont,
EDIT_APPOINTMENT_KEYS, translateAll(getTranslator(), EDIT_APPOINTMENT_KEYS), 1);
editAppointmentEl.select(KEY_COACH,
config.getBooleanSafe(AppointmentsCourseNode.CONFIG_COACH_EDIT_APPOINTMENT));
editAppointmentEl.addActionListener(FormEvent.ONCHANGE);
}
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == editTopicEl) {
doUserRights(ureq);
} else if (source == editAppointmentEl) {
doUserRights(ureq);
}
super.formInnerEvent(ureq, source, event);
}
private void doUserRights(UserRequest ureq) {
config.setBooleanEntry(AppointmentsCourseNode.CONFIG_COACH_EDIT_TOPIC, editTopicEl.isAtLeastSelected(1));
config.setBooleanEntry(AppointmentsCourseNode.CONFIG_COACH_EDIT_APPOINTMENT, editAppointmentEl.isAtLeastSelected(1));
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
@Override
protected void formOK(UserRequest ureq) {
//
}
@Override
protected void doDispose() {
//
}
}
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.modules.appointments.ui;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.tabbedpane.TabbedPane;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.tabbable.ActivateableTabbableDefaultController;
import org.olat.course.nodes.AppointmentsCourseNode;
/**
*
* Initial date: 13 Apr 2020<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class AppointmentsEditController extends ActivateableTabbableDefaultController {
private static final String PANE_TAB_CONFIG = "pane.tab.config";
private static final String[] paneKeys = { PANE_TAB_CONFIG };
private TabbedPane tabPane;
private AppointmentsConfigController configCtrl;
public AppointmentsEditController(UserRequest ureq, WindowControl wControl, AppointmentsCourseNode courseNode) {
super(ureq, wControl);
configCtrl = new AppointmentsConfigController(ureq, wControl, courseNode);
listenTo(configCtrl);
}
@Override
public String[] getPaneKeys() {
return paneKeys;
}
@Override
public TabbedPane getTabbedPane() {
return tabPane;
}
@Override
protected void doDispose() {
//
}
@Override
protected void event(UserRequest ureq, Component source, Event event) {
//
}
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == configCtrl) {
fireEvent(ureq, event);
}
}
@Override
public void addTabs(TabbedPane tabbedPane) {
tabPane = tabbedPane;
tabbedPane.addTab(translate(PANE_TAB_CONFIG), configCtrl.getInitialComponent());
}
}
...@@ -191,7 +191,7 @@ public class OpencastAdminController extends FormBasicController { ...@@ -191,7 +191,7 @@ public class OpencastAdminController extends FormBasicController {
courseNodeSpacerEl.setVisible(enabled); courseNodeSpacerEl.setVisible(enabled);
courseNodeEnabledEl.setVisible(enabled); courseNodeEnabledEl.setVisible(enabled);
authDelegateTypeEl.setVisible(enabled); authDelegateTypeEl.setVisible(enabled);
boolean authDelegateRoles = authDelegateTypeEl.isOneSelected() && Type.Roles == Type.valueOf(authDelegateTypeEl.getSelectedValue()); boolean authDelegateRoles = authDelegateTypeEl.isOneSelected() && Type.Roles == Type.valueOf(authDelegateTypeEl.getSelectedKey());
authDelegateRolesEl.setVisible(enabled && authDelegateRoles); authDelegateRolesEl.setVisible(enabled && authDelegateRoles);
rolesAdminEl.setVisible(enabled); rolesAdminEl.setVisible(enabled);
rolesCoachEl.setVisible(enabled); rolesCoachEl.setVisible(enabled);
...@@ -203,7 +203,7 @@ public class OpencastAdminController extends FormBasicController { ...@@ -203,7 +203,7 @@ public class OpencastAdminController extends FormBasicController {
if (source == enabledEl) { if (source == enabledEl) {
updateUI(); updateUI();
} else if (source == authDelegateTypeEl) { } else if (source == authDelegateTypeEl) {
boolean authDelegateRoles = authDelegateTypeEl.isOneSelected() && Type.Roles == Type.valueOf(authDelegateTypeEl.getSelectedValue()); boolean authDelegateRoles = authDelegateTypeEl.isOneSelected() && Type.Roles == Type.valueOf(authDelegateTypeEl.getSelectedKey());
authDelegateRolesEl.setVisible(authDelegateRoles); authDelegateRolesEl.setVisible(authDelegateRoles);
} else if (source == checkApiConnectionButton) { } else if (source == checkApiConnectionButton) {
doCheckApiConnection(); doCheckApiConnection();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment