use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.
the class LicenseAdminConfigController method doActivateLicenseType.
private void doActivateLicenseType(MultipleSelectionElement multipleSelectionElement) {
boolean doActivate = multipleSelectionElement.isAtLeastSelected(1) ? true : false;
HandlerLicenseType handlerLicenseType = (HandlerLicenseType) multipleSelectionElement.getUserObject();
LicenseHandler handler = handlerLicenseType.getHandler();
LicenseType licenseType = handlerLicenseType.getLicenseType();
if (doActivate) {
licenseService.activate(handler, licenseType);
reloadDefaultLicenseTypeEl(handler);
} else {
if (isDefaultLicenseType(handler, licenseType)) {
showWarning("error.is.default.license.type");
loadModel();
} else {
licenseService.deactivate(handler, licenseType);
reloadDefaultLicenseTypeEl(handler);
}
}
// checkboxes of enabled handlers was deactivated after deactivating a license type.
initGeneralElements();
}
use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.
the class LicenseRenderer method renderLicense.
private void renderLicense(StringOutput sb, License license, boolean small) {
LicenseType licenseType = license.getLicenseType();
long id = CodeHelper.getRAMUniqueID();
// license text link
sb.append("<a id='o_lic_").append(id).append("' href='javascript:;'><span");
if (small) {
sb.append(" class='small'");
}
sb.append(">");
sb.append(LicenseUIFactory.translate(licenseType, locale));
sb.append("</span></a>");
// popup with license informations
sb.append("<div id='o_lic_pop_").append(id).append("' style='display:none;' class='o_lic_popup'><div>");
appendStaticControl(sb, "license.popup.type", LicenseUIFactory.translate(licenseType, locale), LicenseUIFactory.getCssOrDefault(licenseType));
String licensor = license.getLicensor() != null ? license.getLicensor() : "";
appendStaticControl(sb, "license.popup.licensor", licensor);
appendStaticControl(sb, "license.popup.text", LicenseUIFactory.getFormattedLicenseText(license));
sb.append("</div>");
// JavaScript to pup up the popup
sb.append("<script type='text/javascript'>").append("/* <![CDATA[ */").append("jQuery(function() {\n").append(" o_popover('o_lic_").append(id).append("','o_lic_pop_").append(id).append("','top');\n").append("});").append("/* ]]> */").append("</script>");
}
use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.
the class LicenseSelectionConfig method getLicenseTypeValues.
public String[] getLicenseTypeValues(Locale locale) {
String[] values = new String[selectableLicenseTypes.size()];
int count = 0;
for (LicenseType licenseType : selectableLicenseTypes) {
String translation = LicenseUIFactory.translate(licenseType, locale);
translation = setSpecialTranslation(translation, licenseType, locale);
values[count++] = translation;
}
return values;
}
use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.
the class LicenseServiceImpl method loadOrCreateLicense.
@Override
public ResourceLicense loadOrCreateLicense(OLATResourceable ores) {
ResourceLicense license = licenseDao.loadByResource(ores);
if (license == null) {
LicenseType licenseType = licenseTypeDao.loadNoLicenseType();
license = licenseDao.createAndPersist(ores, licenseType);
}
return license;
}
use of org.olat.core.commons.services.license.LicenseType in project openolat by klemens.
the class LicenseServiceImpl method getDefaultLicenseType.
private LicenseType getDefaultLicenseType(LicenseHandler handler) {
String defaultLicenseTypeKey = licenseModule.getDefaultLicenseTypeKey(handler);
LicenseType defautlLicenseType = loadLicenseTypeByKey(defaultLicenseTypeKey);
if (defautlLicenseType == null) {
defautlLicenseType = licenseTypeDao.loadNoLicenseType();
}
return defautlLicenseType;
}
Aggregations