Search in sources :

Example 11 with InfoMessage

use of org.olat.commons.info.InfoMessage in project OpenOLAT by OpenOLAT.

the class InfoMessageFrontendManagerImpl method updateInfoMessagesOfIdentity.

@Override
public void updateInfoMessagesOfIdentity(BusinessGroupRef businessGroup, IdentityRef identity) {
    List<InfoMessage> infoMessages = infoMessageManager.loadInfoMessagesOfIdentity(businessGroup, identity);
    for (InfoMessage infoMessage : infoMessages) {
        Identity author = infoMessage.getAuthor();
        if (author != null && author.getKey().equals(identity.getKey())) {
            ((InfoMessageImpl) infoMessage).setAuthor(null);
        }
        Identity modifier = infoMessage.getModifier();
        if (modifier != null && modifier.getKey().equals(identity.getKey())) {
            infoMessage.setModifier(null);
        }
        infoMessageManager.saveInfoMessage(infoMessage);
    }
}
Also used : InfoMessage(org.olat.commons.info.InfoMessage) InfoMessageImpl(org.olat.commons.info.model.InfoMessageImpl) Identity(org.olat.core.id.Identity)

Example 12 with InfoMessage

use of org.olat.commons.info.InfoMessage in project OpenOLAT by OpenOLAT.

the class InfoMessageFrontendManagerImpl method removeInfoMessagesAndSubscriptionContext.

@Override
public void removeInfoMessagesAndSubscriptionContext(BusinessGroup group) {
    List<InfoMessage> messages = infoMessageManager.loadInfoMessageByResource(group, InfoMessageFrontendManager.businessGroupResSubPath, null, null, null, 0, 0);
    List<String> pathToDelete = new ArrayList<>();
    for (InfoMessage im : messages) {
        infoMessageManager.deleteInfoMessage(im);
        if (StringHelper.containsNonWhitespace(im.getAttachmentPath())) {
            pathToDelete.add(im.getAttachmentPath());
        }
    }
    String resName = group.getResourceableTypeName();
    Long resId = group.getResourceableId();
    SubscriptionContext subscriptionContext = new SubscriptionContext(resName, resId, "");
    infoSubscriptionManager.deleteSubscriptionContext(subscriptionContext);
    deleteAttachments(pathToDelete);
}
Also used : InfoMessage(org.olat.commons.info.InfoMessage) ArrayList(java.util.ArrayList) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext)

Example 13 with InfoMessage

use of org.olat.commons.info.InfoMessage in project OpenOLAT by OpenOLAT.

the class InfoMessagesWebService method getInfoMessageWebservice.

@Path("{infoMessageKey}")
public InfoMessageWebService getInfoMessageWebservice(@PathParam("infoMessageKey") Long infoMessageKey) {
    InfoMessageFrontendManager messageManager = CoreSpringFactory.getImpl(InfoMessageFrontendManager.class);
    InfoMessage msg = messageManager.loadInfoMessage(infoMessageKey);
    return new InfoMessageWebService(msg);
}
Also used : InfoMessageFrontendManager(org.olat.commons.info.InfoMessageFrontendManager) InfoMessage(org.olat.commons.info.InfoMessage) Path(javax.ws.rs.Path)

Example 14 with InfoMessage

use of org.olat.commons.info.InfoMessage in project OpenOLAT by OpenOLAT.

the class InfoDisplayController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == newInfoLink) {
        InfoMessage msg = infoMessageManager.createInfoMessage(ores, resSubPath, businessPath, getIdentity());
        start = new CreateInfoStep(ureq, sendMailOptions, msg);
        newInfoWizard = new StepsMainRunController(ureq, getWindowControl(), start, new FinishedCallback(), new CancelCallback(), translate("create_message"), "o_sel_info_messages_create_wizard");
        listenTo(newInfoWizard);
        getWindowControl().pushAsModalDialog(newInfoWizard.getInitialComponent());
    } else if (deleteLinks.contains(source)) {
        InfoMessage msg = (InfoMessage) source.getUserObject();
        popupDelete(ureq, msg);
    } else if (editLinks.contains(source)) {
        InfoMessage msg = (InfoMessage) source.getUserObject();
        popupEdit(ureq, msg);
    } else if (source == oldMsgsLink) {
        maxResults = -1;
        after = null;
        loadMessages();
    } else if (source == newMsgsLink) {
        maxResults = maxResultsConfig;
        after = afterConfig;
        loadMessages();
    } else {
        super.formInnerEvent(ureq, source, event);
    }
}
Also used : InfoMessage(org.olat.commons.info.InfoMessage) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController)

Example 15 with InfoMessage

use of org.olat.commons.info.InfoMessage in project OpenOLAT by OpenOLAT.

the class InfoPeekViewController method init.

private void init(UserRequest ureq) {
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(translate("peekview.noInfos"));
    tableConfig.setDisplayTableHeader(false);
    tableConfig.setCustomCssClass("o_portlet_table");
    tableConfig.setDisplayRowCount(false);
    tableConfig.setPageingEnabled(false);
    tableConfig.setDownloadOffered(false);
    tableConfig.setSortingEnabled(false);
    removeAsListenerAndDispose(tableController);
    tableController = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
    tableController.addColumnDescriptor(new CustomRenderColumnDescriptor("peekview.title", 0, null, ureq.getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new InfoNodeRenderer()));
    String resSubPath = courseNode.getIdent();
    List<InfoMessage> infos = infoService.loadInfoMessageByResource(ores, resSubPath, null, null, null, 0, 5);
    InfosTableModel model = new InfosTableModel(infos);
    tableController.setTableDataModel(model);
    listenTo(tableController);
}
Also used : CustomRenderColumnDescriptor(org.olat.core.gui.components.table.CustomRenderColumnDescriptor) InfoMessage(org.olat.commons.info.InfoMessage) TableController(org.olat.core.gui.components.table.TableController) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration)

Aggregations

InfoMessage (org.olat.commons.info.InfoMessage)24 OLATResourceable (org.olat.core.id.OLATResourceable)8 InfoMessageFrontendManager (org.olat.commons.info.InfoMessageFrontendManager)6 Identity (org.olat.core.id.Identity)6 ArrayList (java.util.ArrayList)4 Document (org.apache.lucene.document.Document)4 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)4 SearchResourceContext (org.olat.search.service.SearchResourceContext)4 InfoMessageDocument (org.olat.search.service.document.InfoMessageDocument)4 Date (java.util.Date)2 HashMap (java.util.HashMap)2 PUT (javax.ws.rs.PUT)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 BaseSecurity (org.olat.basesecurity.BaseSecurity)2 InfoMessageImpl (org.olat.commons.info.model.InfoMessageImpl)2 DBQuery (org.olat.core.commons.persistence.DBQuery)2 NotificationsManager (org.olat.core.commons.services.notifications.NotificationsManager)2 Publisher (org.olat.core.commons.services.notifications.Publisher)2 SubscriptionInfo (org.olat.core.commons.services.notifications.SubscriptionInfo)2