use of org.olat.modules.fo.Message in project openolat by klemens.
the class SelectThreadStepForm method loadModel.
private void loadModel() {
Identity identity = guestOnly ? null : getIdentity();
Message messageToMove = (Message) getFromRunContext(SendMailStepForm.MESSAGE_TO_MOVE);
messageToMove = messageToMove.getThreadtop() == null ? messageToMove : messageToMove.getThreadtop();
List<ForumThread> threads = forumManager.getForumThreads(forum, identity);
if (!foCallback.mayEditMessageAsModerator()) {
for (Iterator<ForumThread> threadIt = threads.iterator(); threadIt.hasNext(); ) {
ForumThread next = threadIt.next();
if (Status.getStatus(next.getStatusCode()).isHidden()) {
threadIt.remove();
} else if (messageToMove.getKey().equals(next.getKey())) {
threadIt.remove();
}
}
}
threadTableModel.setObjects(threads);
threadTableModel.sort(new SortKey(ThreadListCols.thread.name(), true));
threadTable.reloadData();
threadTable.reset();
}
use of org.olat.modules.fo.Message in project openolat by klemens.
the class SelectThreadStepForm method doSelect.
private void doSelect(UserRequest ureq, ForumThread row) {
long parentMessageKey = row.getKey();
Message parentMessage = forumManager.getMessageById(parentMessageKey);
Boolean newThread = (Boolean) getFromRunContext(SendMailStepForm.NEW_THREAD);
if (newThread != null && newThread) {
return;
} else {
addToRunContext(SendMailStepForm.PARENT_MESSAGE, parentMessage);
formOK(ureq);
}
}
use of org.olat.modules.fo.Message in project openolat by klemens.
the class MessageListController method doEditMessage.
private void doEditMessage(UserRequest ureq, MessageView message) {
// user has clicked on button 'edit'
boolean userIsMsgCreator = message.isAuthor();
boolean children = forumManager.countMessageChildren(message.getKey()) > 0;
if (foCallback.mayEditMessageAsModerator() || (userIsMsgCreator && !children)) {
Message reloadedMessage = forumManager.loadMessage(message.getKey());
if (reloadedMessage == null) {
showWarning("error.message.deleted");
reloadModel(ureq, null);
} else {
editMessageCtrl = new MessageEditController(ureq, getWindowControl(), forum, foCallback, reloadedMessage, null, EditMode.edit);
listenTo(editMessageCtrl);
String title = translate("msg.update");
cmc = new CloseableModalController(getWindowControl(), "close", editMessageCtrl.getInitialComponent(), true, title);
listenTo(editMessageCtrl);
cmc.activate();
}
} else if ((userIsMsgCreator) && (children == true)) {
// user is author of the current message but it has already at least
// one child
showWarning("may.not.save.msg.as.author");
} else {
// user isn't author of the current message
showInfo("may.not.edit.msg");
}
}
use of org.olat.modules.fo.Message in project openolat by klemens.
the class MessageListController method doArchiveThread.
private void doArchiveThread(UserRequest ureq, Message currMsg) {
Message m = currMsg.getThreadtop();
Long topMessageId = (m == null) ? currMsg.getKey() : m.getKey();
VFSContainer forumContainer = forumManager.getForumContainer(forum.getKey());
ForumDownloadResource download = new ForumDownloadResource("Forum", forum, foCallback, topMessageId, forumContainer, getLocale());
ureq.getDispatchResult().setResultingMediaResource(download);
}
use of org.olat.modules.fo.Message in project openolat by klemens.
the class MessageListController method doExportForumItem.
private void doExportForumItem(UserRequest ureq, MessageView messageToMove) {
if (foCallback.mayEditMessageAsModerator()) {
StepRunnerCallback finish = new FinishCallback();
Translator trans = Util.createPackageTranslator(Step_1_SelectCourse.class, getLocale());
Step start = new Step_1_SelectCourse(ureq);
Message message = forumManager.getMessageById(messageToMove.getKey());
String wizardTitle = trans.translate("title.wizard.movethread", new String[] { message.getTitle() });
exportCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, wizardTitle, "o_sel_bulk_assessment_wizard");
StepsRunContext runContext = exportCtrl.getRunContext();
// can be threadtop message
runContext.put(SendMailStepForm.MESSAGE_TO_MOVE, message);
// starting thread
runContext.put(SendMailStepForm.START_THREADTOP, message.getThreadtop() == null ? message : message.getThreadtop());
// get start course
PropertyManager propertyManager = PropertyManager.getInstance();
Long forumResourceableId = forum.getResourceableId();
Property forumproperty = propertyManager.getPropertyByLongValue(forumResourceableId, FOCourseNode.FORUM_KEY);
if (forumproperty != null) {
Long resourcetypeId = forumproperty.getResourceTypeId();
String resourcetypeName = forumproperty.getResourceTypeName();
OLATResourceable olatResourceable = olatManager.findResourceable(resourcetypeId, resourcetypeName);
RepositoryEntry startCourse = repositoryManager.lookupRepositoryEntry(olatResourceable, false);
if (startCourse != null) {
runContext.put(SendMailStepForm.START_COURSE, startCourse);
}
}
listenTo(exportCtrl);
getWindowControl().pushAsModalDialog(exportCtrl.getInitialComponent());
} else {
showWarning("may.not.move.message");
}
}
Aggregations