use of org.olat.core.gui.control.generic.title.TitleInfo in project OpenOLAT by OpenOLAT.
the class CollaborationTools method createForumController.
/**
* @param ureq
* @param wControl
* @param isAdmin
* @param subsContext the subscriptioncontext if subscriptions to this forum
* should be possible
* @return a forum controller
*/
public Controller createForumController(UserRequest ureq, WindowControl wControl, boolean isAdmin, boolean isGuestOnly, final SubscriptionContext subsContext) {
final boolean isAdm = isAdmin;
final boolean isGuest = isGuestOnly;
Forum forum = getForum();
Translator trans = Util.createPackageTranslator(this.getClass(), ureq.getLocale());
TitleInfo titleInfo = new TitleInfo(null, trans.translate("collabtools.named.hasForum"));
titleInfo.setSeparatorEnabled(true);
Controller forumController = ForumUIFactory.getTitledForumController(ureq, wControl, forum, new ForumCallback() {
@Override
public boolean mayUsePseudonym() {
return false;
}
@Override
public boolean mayOpenNewThread() {
return true;
}
@Override
public boolean mayReplyMessage() {
return true;
}
@Override
public boolean mayEditOwnMessage() {
return true;
}
@Override
public boolean mayDeleteOwnMessage() {
return true;
}
@Override
public boolean mayEditMessageAsModerator() {
return isAdm;
}
@Override
public boolean mayDeleteMessageAsModerator() {
return isAdm;
}
@Override
public boolean mayArchiveForum() {
return !isGuest;
}
@Override
public boolean mayFilterForUser() {
return isAdm;
}
@Override
public SubscriptionContext getSubscriptionContext() {
return subsContext;
}
}, titleInfo);
return forumController;
}
use of org.olat.core.gui.control.generic.title.TitleInfo in project OpenOLAT by OpenOLAT.
the class TitledWrapperHelper method getWrapper.
public static Controller getWrapper(UserRequest ureq, WindowControl wControl, Controller controller, CourseNode courseNode, String iconCssClass) {
String displayOption = courseNode.getDisplayOption();
if (CourseNode.DISPLAY_OPTS_CONTENT.equals(displayOption)) {
// don't change anything
} else if (CourseNode.DISPLAY_OPTS_SHORT_TITLE_CONTENT.equals(displayOption)) {
if (StringHelper.containsNonWhitespace(courseNode.getShortTitle())) {
TitleInfo titleInfo = new TitleInfo(null, courseNode.getShortTitle(), null, courseNode.getIdent());
titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
if (StringHelper.containsNonWhitespace(iconCssClass)) {
titleInfo.setIconCssClass(iconCssClass);
}
controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
}
} else if (CourseNode.DISPLAY_OPTS_TITLE_CONTENT.equals(displayOption)) {
if (StringHelper.containsNonWhitespace(courseNode.getLongTitle())) {
TitleInfo titleInfo = new TitleInfo(null, courseNode.getLongTitle(), null, courseNode.getIdent());
titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
if (StringHelper.containsNonWhitespace(iconCssClass)) {
titleInfo.setIconCssClass(iconCssClass);
}
controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
}
} else if (CourseNode.DISPLAY_OPTS_SHORT_TITLE_DESCRIPTION_CONTENT.equals(displayOption)) {
String title = courseNode.getShortTitle();
String description = null;
if (StringHelper.containsNonWhitespace(courseNode.getLearningObjectives())) {
if (StringHelper.containsNonWhitespace(title)) {
description = courseNode.getLearningObjectives();
}
}
if (StringHelper.containsNonWhitespace(title) || StringHelper.containsNonWhitespace(description)) {
TitleInfo titleInfo = new TitleInfo(null, title, description, courseNode.getIdent());
titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
if (StringHelper.containsNonWhitespace(iconCssClass)) {
titleInfo.setIconCssClass(iconCssClass);
}
controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
}
} else if (CourseNode.DISPLAY_OPTS_TITLE_DESCRIPTION_CONTENT.equals(displayOption)) {
String title = courseNode.getLongTitle();
String description = null;
if (StringHelper.containsNonWhitespace(courseNode.getLearningObjectives())) {
description = courseNode.getLearningObjectives();
}
if (StringHelper.containsNonWhitespace(title) || StringHelper.containsNonWhitespace(description)) {
TitleInfo titleInfo = new TitleInfo(null, title, description, courseNode.getIdent());
titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
if (StringHelper.containsNonWhitespace(iconCssClass)) {
titleInfo.setIconCssClass(iconCssClass);
}
controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
}
}
return controller;
}
use of org.olat.core.gui.control.generic.title.TitleInfo in project openolat by klemens.
the class TitledWrapperHelper method getWrapper.
public static Controller getWrapper(UserRequest ureq, WindowControl wControl, Controller controller, CourseNode courseNode, String iconCssClass) {
String displayOption = courseNode.getDisplayOption();
if (CourseNode.DISPLAY_OPTS_CONTENT.equals(displayOption)) {
// don't change anything
} else if (CourseNode.DISPLAY_OPTS_SHORT_TITLE_CONTENT.equals(displayOption)) {
if (StringHelper.containsNonWhitespace(courseNode.getShortTitle())) {
TitleInfo titleInfo = new TitleInfo(null, courseNode.getShortTitle(), null, courseNode.getIdent());
titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
if (StringHelper.containsNonWhitespace(iconCssClass)) {
titleInfo.setIconCssClass(iconCssClass);
}
controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
}
} else if (CourseNode.DISPLAY_OPTS_TITLE_CONTENT.equals(displayOption)) {
if (StringHelper.containsNonWhitespace(courseNode.getLongTitle())) {
TitleInfo titleInfo = new TitleInfo(null, courseNode.getLongTitle(), null, courseNode.getIdent());
titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
if (StringHelper.containsNonWhitespace(iconCssClass)) {
titleInfo.setIconCssClass(iconCssClass);
}
controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
}
} else if (CourseNode.DISPLAY_OPTS_SHORT_TITLE_DESCRIPTION_CONTENT.equals(displayOption)) {
String title = courseNode.getShortTitle();
String description = null;
if (StringHelper.containsNonWhitespace(courseNode.getLearningObjectives())) {
if (StringHelper.containsNonWhitespace(title)) {
description = courseNode.getLearningObjectives();
}
}
if (StringHelper.containsNonWhitespace(title) || StringHelper.containsNonWhitespace(description)) {
TitleInfo titleInfo = new TitleInfo(null, title, description, courseNode.getIdent());
titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
if (StringHelper.containsNonWhitespace(iconCssClass)) {
titleInfo.setIconCssClass(iconCssClass);
}
controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
}
} else if (CourseNode.DISPLAY_OPTS_TITLE_DESCRIPTION_CONTENT.equals(displayOption)) {
String title = courseNode.getLongTitle();
String description = null;
if (StringHelper.containsNonWhitespace(courseNode.getLearningObjectives())) {
description = courseNode.getLearningObjectives();
}
if (StringHelper.containsNonWhitespace(title) || StringHelper.containsNonWhitespace(description)) {
TitleInfo titleInfo = new TitleInfo(null, title, description, courseNode.getIdent());
titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
if (StringHelper.containsNonWhitespace(iconCssClass)) {
titleInfo.setIconCssClass(iconCssClass);
}
controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
}
}
return controller;
}
use of org.olat.core.gui.control.generic.title.TitleInfo in project openolat by klemens.
the class UserCommentDisplayController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == replyLink) {
// Init reply workflow
replyCommentFormCtr = new UserCommentFormController(ureq, getWindowControl(), userComment, null, ores, resSubPath);
listenTo(replyCommentFormCtr);
User parentUser = userComment.getCreator().getUser();
String title = translate("comments.coment.reply.title", new String[] { parentUser.getProperty(UserConstants.FIRSTNAME, null), parentUser.getProperty(UserConstants.LASTNAME, null) });
TitleInfo titleInfo = new TitleInfo(null, title);
replyTitledWrapperCtr = new TitledWrapperController(ureq, getWindowControl(), replyCommentFormCtr, null, titleInfo);
listenTo(replyTitledWrapperCtr);
replyCmc = new CloseableModalController(getWindowControl(), "close", replyTitledWrapperCtr.getInitialComponent());
replyCmc.activate();
} else if (source == deleteLink) {
// Init delete workflow
List<String> buttonLabels = new ArrayList<String>();
boolean hasReplies = false;
for (UserComment comment : allComments) {
if (comment.getParent() != null && comment.getParent().getKey().equals(userComment.getKey())) {
hasReplies = true;
break;
}
}
if (hasReplies) {
buttonLabels.add(translate("comments.button.delete.without.replies"));
buttonLabels.add(translate("comments.button.delete.with.replies"));
} else {
buttonLabels.add(translate("delete"));
}
buttonLabels.add(translate("cancel"));
String deleteText;
if (hasReplies) {
deleteText = translate("comments.dialog.delete.with.replies");
} else {
deleteText = translate("comments.dialog.delete");
}
deleteDialogCtr = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("comments.dialog.delete.title"), deleteText, buttonLabels);
listenTo(deleteDialogCtr);
deleteDialogCtr.activate();
// Add replies info as user object to retrieve it later when evaluating the events
deleteDialogCtr.setUserObject(Boolean.valueOf(hasReplies));
}
}
use of org.olat.core.gui.control.generic.title.TitleInfo in project openolat by klemens.
the class CollaborationTools method createForumController.
/**
* @param ureq
* @param wControl
* @param isAdmin
* @param subsContext the subscriptioncontext if subscriptions to this forum
* should be possible
* @return a forum controller
*/
public Controller createForumController(UserRequest ureq, WindowControl wControl, boolean isAdmin, boolean isGuestOnly, final SubscriptionContext subsContext) {
final boolean isAdm = isAdmin;
final boolean isGuest = isGuestOnly;
Forum forum = getForum();
Translator trans = Util.createPackageTranslator(this.getClass(), ureq.getLocale());
TitleInfo titleInfo = new TitleInfo(null, trans.translate("collabtools.named.hasForum"));
titleInfo.setSeparatorEnabled(true);
Controller forumController = ForumUIFactory.getTitledForumController(ureq, wControl, forum, new ForumCallback() {
@Override
public boolean mayUsePseudonym() {
return false;
}
@Override
public boolean mayOpenNewThread() {
return true;
}
@Override
public boolean mayReplyMessage() {
return true;
}
@Override
public boolean mayEditOwnMessage() {
return true;
}
@Override
public boolean mayDeleteOwnMessage() {
return true;
}
@Override
public boolean mayEditMessageAsModerator() {
return isAdm;
}
@Override
public boolean mayDeleteMessageAsModerator() {
return isAdm;
}
@Override
public boolean mayArchiveForum() {
return !isGuest;
}
@Override
public boolean mayFilterForUser() {
return isAdm;
}
@Override
public SubscriptionContext getSubscriptionContext() {
return subsContext;
}
}, titleInfo);
return forumController;
}
Aggregations