use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.
the class BusinessGroupMainRunController method doChat.
private void doChat(UserRequest ureq) {
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLCHAT);
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
addToHistory(ureq, bwControl);
CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
collabToolCtr = collabTools.createChatController(ureq, bwControl, businessGroup, isAdmin);
if (collabToolCtr == null) {
showWarning("groupchat.not.available");
mainPanel.setContent(new Panel("empty"));
} else {
mainPanel.setContent(collabToolCtr.getInitialComponent());
}
}
use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.
the class OverviewBusinessGroupListController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty()) {
if (currentCtrl == null) {
if (isGuestOnly) {
updateOpenGroups(ureq);
segmentView.select(openGroupsLink);
} else {
boolean markedEmpty = updateMarkedGroups(ureq).isEmpty();
if (markedEmpty) {
updateMyGroups(ureq);
segmentView.select(myGroupsLink);
} else {
segmentView.select(markedGroupsLink);
}
}
}
addToHistory(ureq, currentCtrl);
} else {
ContextEntry entry = entries.get(0);
String segment = entry.getOLATResourceable().getResourceableTypeName();
List<ContextEntry> subEntries = entries.subList(1, entries.size());
if ("Favorits".equals(segment)) {
if (isGuestOnly) {
updateOpenGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(openGroupsLink);
} else {
updateMarkedGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(markedGroupsLink);
}
} else if ("AllGroups".equals(segment)) {
if (isGuestOnly) {
updateOpenGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(openGroupsLink);
} else {
updateMyGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(myGroupsLink);
}
} else if ("OwnedGroups".equals(segment)) {
updateOpenGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(openGroupsLink);
} else if ("Search".equals(segment) && searchOpenLink != null) {
updateSearch(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(searchOpenLink);
} else {
// default all groups
if (isGuestOnly) {
updateOpenGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(openGroupsLink);
} else {
updateMyGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
segmentView.select(myGroupsLink);
}
}
}
}
use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.
the class OLATAuthManager method sendConfirmationEmail.
private void sendConfirmationEmail(Identity doer, Identity identity) {
String prefsLanguage = identity.getUser().getPreferences().getLanguage();
Locale locale = I18nManager.getInstance().getLocaleOrDefault(prefsLanguage);
Translator translator = Util.createPackageTranslator(OLATAuthenticationController.class, locale);
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("changepw", 0l));
String changePwUrl = BusinessControlFactory.getInstance().getAsURIString(Collections.singletonList(ce), false);
String[] args = new String[] { // 0: changed users username
identity.getName(), // 1: changed users email address
UserManager.getInstance().getUserDisplayEmail(identity, locale), // 2: Name (first and last name) of user who changed the password
userManager.getUserDisplayName(doer.getUser()), // 3: configured support email address
WebappHelper.getMailConfig("mailSupport"), // 4: direct link to change password workflow (e.g. https://xx.xx.xx/olat/url/changepw/0)
changePwUrl };
String subject = translator.translate("mail.pwd.subject", args);
String body = translator.translate("mail.pwd.body", args);
MailContext context = new MailContextImpl(null, null, "[Identity:" + identity.getKey() + "]");
MailBundle bundle = new MailBundle();
bundle.setContext(context);
bundle.setToId(identity);
bundle.setContent(subject, body);
mailManager.sendMessage(bundle);
}
use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.
the class OLATAuthenticationController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
ContextEntry entry = entries.get(0);
String type = entry.getOLATResourceable().getResourceableTypeName();
if ("changepw".equals(type)) {
String email = null;
if (entries.size() > 1) {
email = entries.get(1).getOLATResourceable().getResourceableTypeName();
}
openChangePassword(ureq, email);
} else if ("registration".equals(type)) {
if (registrationModule.isSelfRegistrationEnabled() && registrationModule.isSelfRegistrationLinkEnabled()) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
openRegistration(ureq).activate(ureq, subEntries, entry.getTransientState());
}
}
}
use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.
the class WikiHandler method createLaunchController.
@Override
public MainLayoutController createLaunchController(RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
// first handle special case: disabled wiki for security (XSS Attacks) reasons
BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
if (!securityModule.isWikiEnabled()) {
return RepositoyUIFactory.createRepoEntryDisabledDueToSecurityMessageController(ureq, wControl);
}
// check role
boolean isOLatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
boolean isGuestOnly = ureq.getUserSession().getRoles().isGuestOnly();
boolean isResourceOwner = false;
if (isOLatAdmin) {
isResourceOwner = true;
} else {
isResourceOwner = reSecurity.isOwner();
}
OLATResource res = re.getOlatResource();
BusinessControl bc = wControl.getBusinessControl();
final ContextEntry ce = bc.popLauncherContextEntry();
SubscriptionContext subsContext = new SubscriptionContext(res, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
final WikiSecurityCallback callback = new WikiSecurityCallbackImpl(null, isOLatAdmin, isGuestOnly, false, isResourceOwner, subsContext);
RepositoryEntryRuntimeController runtime = new RepositoryEntryRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {
@Override
public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
Controller controller;
if (ce != null) {
// jump to a certain context
OLATResourceable ores = ce.getOLATResourceable();
String typeName = ores.getResourceableTypeName();
String page = typeName.substring("page=".length());
controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, page);
} else {
controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, null);
}
return new OLATResourceableListeningWrapperController(uureq, wwControl, entry.getOlatResource(), controller, null, uureq.getIdentity());
}
});
return runtime;
}
Aggregations