use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.
the class InvitationForm method create.
protected Invitation create(User u) {
Invitation i = new Invitation(getModelObject());
i.setId(null);
i.setUpdated(null);
i.setUsed(false);
i.setPassword(CryptProvider.get().hash(i.getPassword()));
i.setValidFrom(getDate(from.getModelObject().minusMinutes(5), timeZoneId.getModelObject()));
i.setValidTo(getDate(to.getModelObject(), timeZoneId.getModelObject()));
i.setInvitee(u);
i.setHash(UUID.randomUUID().toString());
if (Type.contact == u.getType()) {
u.setLanguageId(lang.getModelObject());
}
return inviteDao.update(i);
}
use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.
the class InvitationForm method onInitialize.
@Override
protected void onInitialize() {
add(subject, message);
recipients.setLabel(Model.of(getString("216"))).setRequired(true).add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
url.setModelObject(null);
updateButtons(target);
}
}).setOutputMarkupId(true);
add(new AjaxCheckBox("passwordProtected") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
InvitationForm.this.getModelObject().setPasswordProtected(getConvertedInput());
passwd.setEnabled(getConvertedInput());
target.add(passwd);
}
});
RadioGroup<Valid> valid = new RadioGroup<>("valid");
valid.add(new AjaxFormChoiceComponentUpdatingBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
boolean dateEnabled = InvitationForm.this.getModelObject().getValid() == Valid.Period;
target.add(from.setEnabled(dateEnabled), to.setEnabled(dateEnabled), timeZoneId.setEnabled(dateEnabled));
}
});
add(valid.add(new Radio<>("one", Model.of(Valid.OneTime)), new Radio<>("period", Model.of(Valid.Period)), new Radio<>("endless", Model.of(Valid.Endless))));
add(passwd);
Invitation i = getModelObject();
passwd.setLabel(Model.of(getString("110"))).setOutputMarkupId(true).setEnabled(i.isPasswordProtected());
add(from.setOutputMarkupId(true), to.setOutputMarkupId(true), timeZoneId.setOutputMarkupId(true));
timeZoneId.add(new AjaxFormComponentUpdatingBehavior("change") {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
// no-op added to preserve selection
}
});
add(url.setOutputMarkupId(true));
add(lang, feedback);
super.onInitialize();
}
use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.
the class HashPage method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
StringValue secure = p.get(HASH);
StringValue invitation = p.get(INVITATION_HASH);
WebSession ws = WebSession.get();
ws.checkHashes(secure, invitation);
String errorMsg = getString("invalid.hash");
recContainer.setVisible(false);
add(new EmptyPanel(PANEL_MAIN).setVisible(false));
if (!invitation.isEmpty()) {
Invitation i = ws.getInvitation();
if (i == null) {
errorMsg = getString("error.hash.invalid");
} else if (!i.isAllowEntry()) {
FastDateFormat sdf = FormatHelper.getDateTimeFormat(i.getInvitee());
errorMsg = Valid.OneTime == i.getValid() ? getString("error.hash.used") : String.format("%s %s - %s, %s", getString("error.hash.period"), sdf.format(i.getValidFrom()), sdf.format(i.getValidTo()), i.getInvitee().getTimeZoneId());
} else {
Recording rec = i.getRecording();
if (rec != null) {
vi.setVisible(!i.isPasswordProtected());
vp.setVisible(!i.isPasswordProtected());
if (!i.isPasswordProtected()) {
vi.update(null, rec);
vp.update(null, rec);
}
recContainer.setVisible(true);
error = false;
}
Room r = i.getRoom();
if (r != null && !r.isDeleted()) {
createRoom(r.getId());
if (i.isPasswordProtected() && rp != null) {
mp.getChat().setVisible(false);
rp.setOutputMarkupPlaceholderTag(true).setVisible(false);
}
}
}
} else if (!secure.isEmpty()) {
Long recId = getRecordingId(), roomId = ws.getRoomId();
if (recId == null && roomId == null) {
errorMsg = getString("1599");
} else if (recId != null) {
recContainer.setVisible(true);
Recording rec = recDao.get(recId);
vi.update(null, rec);
vp.update(null, rec);
error = false;
} else {
createRoom(roomId);
}
}
StringValue swf = p.get(SWF);
StringValue app = swf.isEmpty() ? p.get(APP) : swf;
if (!app.isEmpty()) {
if (APP_TYPE_NETWORK.equals(app.toString())) {
replace(new NetTestPanel(PANEL_MAIN).add(AttributeModifier.append("class", "app")));
error = false;
}
if (APP_TYPE_SETTINGS.equals(app.toString())) {
replace(new VideoSettings(PANEL_MAIN).replace(new OmWebSocketPanel("ws-panel") {
private static final long serialVersionUID = 1L;
private WsClient c = null;
@Override
protected void onConnect(ConnectedMessage message) {
c = new WsClient(message.getSessionId(), message.getKey().hashCode());
}
@Override
protected IWsClient getWsClient() {
return c;
}
}).add(new OmAjaxClientInfoBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onClientInfo(AjaxRequestTarget target, WebClientInfo info) {
super.onClientInfo(target, info);
target.appendJavaScript(String.format("VideoSettings.init(%s);VideoSettings.open();", VideoSettings.getInitJson("noclient")));
}
}));
error = false;
}
}
add(recContainer.add(vi.setShowShare(false).setOutputMarkupPlaceholderTag(true), vp.setOutputMarkupPlaceholderTag(true)), new InvitationPasswordDialog("i-pass", this));
remove(urlParametersReceivingBehavior);
add(new MessageDialog("access-denied", getString("invalid.hash"), errorMsg, DialogButtons.OK, DialogIcon.ERROR) {
private static final long serialVersionUID = 1L;
@Override
public void onConfigure(JQueryBehavior behavior) {
super.onConfigure(behavior);
behavior.setOption("autoOpen", error);
behavior.setOption("resizable", false);
}
@Override
public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
// no-op
}
});
}
use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.
the class InvitationPasswordDialog method onConfigure.
@Override
public void onConfigure(JQueryBehavior behavior) {
super.onConfigure(behavior);
Invitation i = WebSession.get().getInvitation();
behavior.setOption("autoOpen", i != null && i.isPasswordProtected());
behavior.setOption("resizable", false);
}
use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.
the class AppointmentLogic method sendReminder.
// --------------------------------------------------------------------------------------------
private void sendReminder(User u, Appointment a) {
Invitation i = new Invitation();
i.setInvitedBy(u);
i.setInvitee(u);
i.setAppointment(a);
i.setRoom(a.getRoom());
sendReminder(u, a, i);
}
Aggregations