@Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { setFormTitle("qf.edit"); if (quota != null && quota.getQuotaKB() != null) { quotaKB = uifactory.addIntegerElement( "qf_quota", "qf.quota", quota.getQuotaKB().intValue(), formLayout); } else { quotaKB = uifactory.addIntegerElement( "qf_quota", "qf.quota", (int) FolderConfig.getDefaultQuotaKB(), formLayout); } quotaKB.setMandatory(true); if (quota != null && quota.getUlLimitKB() != null) { ulLimitKB = uifactory.addIntegerElement( "qf_limit", "qf.limit", quota.getUlLimitKB().intValue(), formLayout); } else { ulLimitKB = uifactory.addIntegerElement( "qf_limit", "qf.limit", (int) FolderConfig.getLimitULKB(), formLayout); } ulLimitKB.setMandatory(true); }
/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) */ public void event(UserRequest ureq, Component source, Event event) { initQuotaForm(ureq, currentQuota); if (source == delQuotaButton) { boolean deleted = QuotaManager.getInstance().deleteCustomQuota(currentQuota); if (deleted) { myContent.remove(quotaForm.getInitialComponent()); myContent.contextPut("editQuota", Boolean.FALSE); showInfo("qf.deleted", currentQuota.getPath()); fireEvent(ureq, Event.CHANGED_EVENT); } else { showError("qf.cannot.del.default"); } } else if (source == cancelButton) { fireEvent(ureq, Event.CANCELLED_EVENT); } }