Search in sources :

Example 6 with PrivateMessage

use of org.apache.openmeetings.db.entity.user.PrivateMessage in project openmeetings by apache.

the class MainPanel method onInitialize.

@Override
protected void onInitialize() {
    menu = new MenuPanel("menu", getMainMenu());
    add(topControls.setOutputMarkupPlaceholderTag(true).setMarkupId("topControls"));
    add(contents.add(getClient() == null || panel == null ? EMPTY : panel).setOutputMarkupId(true).setMarkupId("contents"));
    topControls.add(menu.setVisible(false), topLinks.setVisible(false).setOutputMarkupPlaceholderTag(true).setMarkupId("topLinks"));
    topLinks.add(new AjaxLink<Void>("messages") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            updateContents(PROFILE_MESSAGES, target);
        }
    });
    topLinks.add(new AjaxLink<Void>("profile") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            updateContents(PROFILE_EDIT, target);
        }
    });
    final AboutDialog about = new AboutDialog("aboutDialog");
    topLinks.add(new AjaxLink<Void>("about") {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            about.open(target);
        }
    });
    if (getApplication().getDebugSettings().isDevelopmentUtilitiesEnabled()) {
        add(new DebugBar("dev").setOutputMarkupId(true));
    } else {
        add(new EmptyPanel("dev").setVisible(false));
    }
    add(new OmAjaxClientInfoBehavior());
    add(about, chat = new ChatPanel("chatPanel"));
    add(newMessage = new MessageDialog("newMessageDialog", new CompoundPropertyModel<>(new PrivateMessage())) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
            BasePanel bp = getCurrentPanel();
            if (send.equals(button) && bp != null) {
                bp.onNewMessageClose(handler);
            }
        }
    });
    add(userInfo = new UserInfoDialog("userInfoDialog", newMessage));
    add(new AbstractDefaultAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void respond(AjaxRequestTarget target) {
            userInfo.open(target, getParam(getComponent(), PARAM_USER_ID).toLong());
        }

        @Override
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);
            response.render(new PriorityHeaderItem(getNamedFunction("showUserInfo", this, explicit(PARAM_USER_ID))));
        }
    });
    add(new AbstractDefaultAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void respond(AjaxRequestTarget target) {
            ContactsHelper.addUserToContactList(getParam(getComponent(), PARAM_USER_ID).toLong());
        }

        @Override
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);
            response.render(new PriorityHeaderItem(getNamedFunction("addContact", this, explicit(PARAM_USER_ID))));
        }
    });
    add(new AbstractDefaultAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void respond(AjaxRequestTarget target) {
            newMessage.reset(true).open(target, getParam(getComponent(), PARAM_USER_ID).toOptionalLong());
        }

        @Override
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);
            response.render(new PriorityHeaderItem(getNamedFunction("privateMessage", this, explicit(PARAM_USER_ID))));
        }
    });
    add(inviteUser = new InviteUserToRoomDialog("invite-to-room"));
    add(new AbstractDefaultAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void respond(AjaxRequestTarget target) {
            inviteUser.open(target, getParam(getComponent(), PARAM_USER_ID).toLong());
        }

        @Override
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);
            response.render(new PriorityHeaderItem(getNamedFunction("inviteUser", this, explicit(PARAM_USER_ID))));
        }
    });
    topLinks.add(new ConfirmableAjaxBorder("logout", getString("310"), getString("634")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            getSession().invalidate();
            setResponsePage(Application.get().getSignInPageClass());
        }
    });
    super.onInitialize();
}
Also used : DebugBar(org.apache.wicket.devutils.debugbar.DebugBar) DialogButton(com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton) AboutDialog(org.apache.openmeetings.web.user.AboutDialog) EmptyPanel(org.apache.wicket.markup.html.panel.EmptyPanel) IPartialPageRequestHandler(org.apache.wicket.core.request.handler.IPartialPageRequestHandler) ChatPanel(org.apache.openmeetings.web.user.chat.ChatPanel) InviteUserToRoomDialog(org.apache.openmeetings.web.user.InviteUserToRoomDialog) MenuPanel(org.apache.openmeetings.web.common.menu.MenuPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserInfoDialog(org.apache.openmeetings.web.user.UserInfoDialog) PriorityHeaderItem(org.apache.wicket.markup.head.PriorityHeaderItem) AbstractDefaultAjaxBehavior(org.apache.wicket.ajax.AbstractDefaultAjaxBehavior) IHeaderResponse(org.apache.wicket.markup.head.IHeaderResponse) MessageDialog(org.apache.openmeetings.web.user.MessageDialog) PrivateMessage(org.apache.openmeetings.db.entity.user.PrivateMessage) Component(org.apache.wicket.Component)

Example 7 with PrivateMessage

use of org.apache.openmeetings.db.entity.user.PrivateMessage in project openmeetings by apache.

the class BackupExport method exportPrivateMsg.

/*
	 * ##################### Private Messages
	 */
private void exportPrivateMsg(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
    List<PrivateMessage> list = privateMessageDao.get(0, Integer.MAX_VALUE);
    Registry registry = new Registry();
    Strategy strategy = new RegistryStrategy(registry);
    Serializer serializer = new Persister(strategy);
    registry.bind(User.class, UserConverter.class);
    registry.bind(Room.class, RoomConverter.class);
    bindDate(registry, list, PrivateMessage::getInserted);
    writeList(serializer, zos, "privateMessages.xml", "privatemessages", list);
    progressHolder.setProgress(50);
}
Also used : RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Strategy(org.simpleframework.xml.strategy.Strategy) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) PrivateMessage(org.apache.openmeetings.db.entity.user.PrivateMessage) Registry(org.simpleframework.xml.convert.Registry) Persister(org.simpleframework.xml.core.Persister) Serializer(org.simpleframework.xml.Serializer)

Example 8 with PrivateMessage

use of org.apache.openmeetings.db.entity.user.PrivateMessage in project openmeetings by apache.

the class PrivateMessageDao method addPrivateMessage.

public Long addPrivateMessage(String subject, String message, User from, User to, User owner, boolean isContactRequest, Long userContactId) {
    try {
        PrivateMessage privateMessage = new PrivateMessage();
        privateMessage.setInserted(new Date());
        privateMessage.setSubject(subject);
        privateMessage.setMessage(message);
        privateMessage.setFrom(from);
        privateMessage.setTo(to);
        privateMessage.setOwner(owner);
        privateMessage.setFolderId(INBOX_FOLDER_ID);
        privateMessage.setIsRead(false);
        privateMessage.setIsContactRequest(isContactRequest);
        privateMessage.setUserContactId(userContactId);
        privateMessage = em.merge(privateMessage);
        return privateMessage.getFolderId();
    } catch (Exception e) {
        log.error("[addPrivateMessage]", e);
    }
    return null;
}
Also used : PrivateMessage(org.apache.openmeetings.db.entity.user.PrivateMessage) Date(java.util.Date)

Aggregations

PrivateMessage (org.apache.openmeetings.db.entity.user.PrivateMessage)8 DialogButton (com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton)2 Date (java.util.Date)2 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)2 Room (org.apache.openmeetings.db.entity.room.Room)2 User (org.apache.openmeetings.db.entity.user.User)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 Serializer (org.simpleframework.xml.Serializer)2 Registry (org.simpleframework.xml.convert.Registry)2 RegistryStrategy (org.simpleframework.xml.convert.RegistryStrategy)2 Persister (org.simpleframework.xml.core.Persister)2 Strategy (org.simpleframework.xml.strategy.Strategy)2 WysiwygEditor (com.googlecode.wicket.jquery.ui.plugins.wysiwyg.WysiwygEditor)1 DefaultWysiwygToolbar (com.googlecode.wicket.jquery.ui.plugins.wysiwyg.toolbar.DefaultWysiwygToolbar)1 LocalDateTime (java.time.LocalDateTime)1 ArrayList (java.util.ArrayList)1 RoomConverter (org.apache.openmeetings.backup.converter.RoomConverter)1 UserConverter (org.apache.openmeetings.backup.converter.UserConverter)1 MeetingMember (org.apache.openmeetings.db.entity.calendar.MeetingMember)1 Invitation (org.apache.openmeetings.db.entity.room.Invitation)1