Search in sources :

Example 1 with RoomPoll

use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.

the class CreatePollDialog method updateModel.

public void updateModel(AjaxRequestTarget target) {
    RoomPoll p = new RoomPoll();
    User u = userDao.get(getUserId());
    p.setCreator(u);
    p.setRoom(roomDao.get(roomId));
    p.setType(RoomPoll.Type.yesNo);
    form.setModelObject(p);
    target.add(form);
}
Also used : User(org.apache.openmeetings.db.entity.user.User) RoomPoll(org.apache.openmeetings.db.entity.room.RoomPoll)

Example 2 with RoomPoll

use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.

the class PollResultsDialog method onInitialize.

@Override
protected void onInitialize() {
    getTitle().setObject(getString("37"));
    cancel = new DialogButton("cancel", getString("lbl.cancel"));
    close = new DialogButton("close", getString("1418"));
    delete = new DialogButton("delete", getString("1420"));
    add(closeConfirm = new MessageDialog("closeConfirm", getString("1418"), getString("1419"), DialogButtons.YES_NO, DialogIcon.WARN) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
            if (button != null && button.match(YES)) {
                Long id = dispForm.getModelObject().getId();
                pollDao.close(roomId);
                selForm.updateModel(handler);
                RoomPoll p = pollDao.get(id);
                selForm.select.setModelObject(p);
                dispForm.updateModel(p, true, handler);
                sendRoom(new RoomMessage(roomId, findParent(MainPanel.class).getClient(), RoomMessage.Type.pollUpdated));
            }
        }
    });
    add(deleteConfirm = new MessageDialog("deleteConfirm", getString("1420"), getString("1421"), DialogButtons.YES_NO, DialogIcon.WARN) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
            if (button != null && button.match(YES)) {
                pollDao.delete(dispForm.getModelObject());
                selForm.updateModel(handler);
                dispForm.updateModel(selForm.select.getModelObject(), true, handler);
                sendRoom(new RoomMessage(roomId, findParent(MainPanel.class).getClient(), RoomMessage.Type.pollUpdated));
            }
        }
    });
    super.onInitialize();
}
Also used : DialogButton(com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton) MainPanel(org.apache.openmeetings.web.common.MainPanel) RoomMessage(org.apache.openmeetings.db.util.ws.RoomMessage) IPartialPageRequestHandler(org.apache.wicket.core.request.handler.IPartialPageRequestHandler) MessageDialog(com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog) RoomPoll(org.apache.openmeetings.db.entity.room.RoomPoll)

Example 3 with RoomPoll

use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.

the class BackupExport method exportPoll.

/*
	 * ##################### Polls
	 */
private void exportPoll(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
    List<RoomPoll> list = pollManager.get();
    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);
    registry.bind(RoomPoll.Type.class, PollTypeConverter.class);
    bindDate(registry, list, RoomPoll::getCreated);
    writeList(serializer, zos, "roompolls.xml", "roompolls", list);
    progressHolder.setProgress(75);
}
Also used : RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Strategy(org.simpleframework.xml.strategy.Strategy) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Registry(org.simpleframework.xml.convert.Registry) Persister(org.simpleframework.xml.core.Persister) RoomPoll(org.apache.openmeetings.db.entity.room.RoomPoll) Serializer(org.simpleframework.xml.Serializer)

Example 4 with RoomPoll

use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.

the class BackupImport method importPolls.

/*
	 * ##################### Import Room Polls
	 */
private void importPolls(File f) throws Exception {
    log.info("File explorer item import complete, starting room poll import");
    Registry registry = new Registry();
    Strategy strategy = new RegistryStrategy(registry);
    RegistryMatcher matcher = new RegistryMatcher();
    Serializer serializer = new Persister(strategy, matcher);
    matcher.bind(Integer.class, IntegerTransform.class);
    registry.bind(User.class, new UserConverter(userDao, userMap));
    registry.bind(Room.class, new RoomConverter(roomDao, roomMap));
    registry.bind(RoomPoll.Type.class, PollTypeConverter.class);
    registry.bind(Date.class, DateConverter.class);
    List<RoomPoll> list = readList(serializer, f, "roompolls.xml", "roompolls", RoomPoll.class);
    for (RoomPoll rp : list) {
        rp.setId(null);
        if (rp.getRoom() == null || rp.getRoom().getId() == null) {
            // room was deleted
            continue;
        }
        if (rp.getCreator() == null || rp.getCreator().getId() == null) {
            rp.setCreator(null);
        }
        for (RoomPollAnswer rpa : rp.getAnswers()) {
            if (rpa.getVotedUser() == null || rpa.getVotedUser().getId() == null) {
                rpa.setVotedUser(null);
            }
        }
        pollDao.update(rp);
    }
}
Also used : UserConverter(org.apache.openmeetings.backup.converter.UserConverter) RoomConverter(org.apache.openmeetings.backup.converter.RoomConverter) RoomPollAnswer(org.apache.openmeetings.db.entity.room.RoomPollAnswer) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Strategy(org.simpleframework.xml.strategy.Strategy) RegistryMatcher(org.simpleframework.xml.transform.RegistryMatcher) Registry(org.simpleframework.xml.convert.Registry) Persister(org.simpleframework.xml.core.Persister) RoomPoll(org.apache.openmeetings.db.entity.room.RoomPoll) Serializer(org.simpleframework.xml.Serializer)

Example 5 with RoomPoll

use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.

the class PollsSubMenu method init.

public void init() {
    pollsMenu = new RoomMenuItem(mp.getString("menu.polls"), null, false);
    pollQuickMenuItem = new RoomMenuItem(mp.getString("menu.polls.quick.title"), mp.getString("menu.polls.quick.descr"), false) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            qpollManager.start(room.getClient());
        }
    };
    pollCreateMenuItem = new RoomMenuItem(mp.getString("24"), mp.getString("1483"), false) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            createPoll.updateModel(target);
            createPoll.open(target);
        }
    };
    pollVoteMenuItem = new RoomMenuItem(mp.getString("32"), mp.getString("1485"), false) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            RoomPoll rp = pollDao.getByRoom(room.getRoom().getId());
            if (rp != null) {
                vote.updateModel(target, rp);
                vote.open(target);
            }
        }
    };
    pollResultMenuItem = new RoomMenuItem(mp.getString("37"), mp.getString("1484"), false) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            pollResults.updateModel(target, room.getClient().hasRight(Room.Right.moderator));
            pollResults.open(target);
        }
    };
    mp.add(quickPollAction);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) RoomMenuItem(org.apache.openmeetings.web.common.menu.RoomMenuItem) RoomPoll(org.apache.openmeetings.db.entity.room.RoomPoll)

Aggregations

RoomPoll (org.apache.openmeetings.db.entity.room.RoomPoll)6 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 DialogButton (com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton)1 MessageDialog (com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog)1 RoomConverter (org.apache.openmeetings.backup.converter.RoomConverter)1 UserConverter (org.apache.openmeetings.backup.converter.UserConverter)1 RoomPollAnswer (org.apache.openmeetings.db.entity.room.RoomPollAnswer)1 User (org.apache.openmeetings.db.entity.user.User)1 RoomMessage (org.apache.openmeetings.db.util.ws.RoomMessage)1 MainPanel (org.apache.openmeetings.web.common.MainPanel)1 RoomMenuItem (org.apache.openmeetings.web.common.menu.RoomMenuItem)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 IPartialPageRequestHandler (org.apache.wicket.core.request.handler.IPartialPageRequestHandler)1 RegistryMatcher (org.simpleframework.xml.transform.RegistryMatcher)1