From 8f7f99e67c5b595c22798e4b5dac0d3104874ec0 Mon Sep 17 00:00:00 2001 From: Albert Coronado Date: Wed, 7 Jun 2017 10:36:36 +0200 Subject: [PATCH] commit --- docroot/WEB-INF/liferay-hook.xml | 4 ++ .../WEB-INF/liferay-plugin-package.properties | 2 +- docroot/WEB-INF/liferay-portlet.xml | 2 +- .../src/content/Language_ca.properties | 68 +++++++++---------- .../lsug/quota/event/QuotaStartupAction.java | 5 +- .../QuotaServerNotificationHandler.java | 2 +- .../service/impl/QuotaLocalServiceImpl.java | 6 ++ docroot/html/sites-quota/view.jsp | 6 +- 8 files changed, 54 insertions(+), 41 deletions(-) diff --git a/docroot/WEB-INF/liferay-hook.xml b/docroot/WEB-INF/liferay-hook.xml index 3813e47..32ff118 100644 --- a/docroot/WEB-INF/liferay-hook.xml +++ b/docroot/WEB-INF/liferay-hook.xml @@ -30,4 +30,8 @@ /document_library/upload_multiple_file_entries org.lsug.quota.QuotaEditFileEntryAction + + /document_library/view_file_entry + org.lsug.quota.QuotaEditFileEntryAction + \ No newline at end of file diff --git a/docroot/WEB-INF/liferay-plugin-package.properties b/docroot/WEB-INF/liferay-plugin-package.properties index ecca418..a36e99e 100644 --- a/docroot/WEB-INF/liferay-plugin-package.properties +++ b/docroot/WEB-INF/liferay-plugin-package.properties @@ -8,7 +8,7 @@ change-log= page-url=http://www.liferay.com/community/user-groups/spain/welcome author=LSUG licenses=LGPL -liferay-versions=6.2.3,6.2.10 +liferay-versions=6.2+ portal-dependency-jars=\ jstl-api.jar,\ diff --git a/docroot/WEB-INF/liferay-portlet.xml b/docroot/WEB-INF/liferay-portlet.xml index 6d65c36..06e9a68 100644 --- a/docroot/WEB-INF/liferay-portlet.xml +++ b/docroot/WEB-INF/liferay-portlet.xml @@ -7,7 +7,7 @@ /html/server-quota/icon.png /org/lsug/quota/portlet/notification/quota-server-user-notification-definition.xml org.lsug.quota.portlet.notification.QuotaServerNotificationHandler - server + configuration 2.5 false false diff --git a/docroot/WEB-INF/src/content/Language_ca.properties b/docroot/WEB-INF/src/content/Language_ca.properties index 36bef1a..baec63c 100644 --- a/docroot/WEB-INF/src/content/Language_ca.properties +++ b/docroot/WEB-INF/src/content/Language_ca.properties @@ -1,34 +1,34 @@ -alerts-enabled=Alerts Enabled -allocated-space=Allocated Space -enable-alerts=Enable Alerts -enable-quota=Enable Quota -free-space=Free Space -quota-alert=Quota Alerts (%) -quota-assigned=Allocated Quota (MB) -quota-control=Quota Control -quota-enabled=Quota Enabled -quota-status=Quota Status -quota-used=Used Quota -quota-unlimited=Cuota ilimitada -send-alert-when-reach=Send alert when reach -server-capacity=Server Capacity (Hard Disk) -server-description=Quota Control Portlet allows to enable the management of space quota usage.\nIf quota control is enabled, you'll be able to manage quota control for each instance. When you add quota control you can enable if you want to send mail alerts to portal and instance administrators, quota space assigned to the site (in Gb) and at what percentage the alerts have to be sent. -server-quota-title=Server Quota Management -site-name=Site Name -sites-quota-description=Sites Quota Management -total-quota=Total Quota -used-space=Used Space -user-sites=User sites -server-current-used-size-diagram-title=Current used size (by instance) -user-site-current-used-size-diagram-title=User quota -user-site-no-quota-enabled=There is no disk quota enabled for this user -sites-quota-enabled-sites-used-diagram-title=Current used size (enabled quota sites) -assigned-quota-less-than-current=Assigned quota is less than current used quota. -unused-space=Free space -quota-from-instance-x-above-the-alert=The instance {0} is above the quota alert -quota-from-site-x-above-the-alert=The site {0} is above the quota alert -quota-from-user-x-above-the-alert={0} user site has reached the quota alert threshold -javax.portlet.title.serverquotaportlet_WAR_quotacontrolportlet=Server quota -javax.portlet.title.sitesquotaportlet_WAR_quotacontrolportlet=Sites quota -javax.portlet.title.myquotaportlet_WAR_quotacontrolportlet=My user quota -javax.portlet.title.siteconfigurationquotaportlet_WAR_quotacontrolportlet=Site quota \ No newline at end of file +alerts-enabled=Alertes activades +allocated-space=Espai assignat +enable-alerts=Activar alertes +enable-quota=Activar quota +free-space=Espai lliure +quota-alert=Alerta de quota (%) +quota-assigned=Quota assignada (MB) +quota-control=Control de quota +quota-enabled=Quota activada +quota-status=Estat de quota +quota-used=Quota utilitzada +quota-unlimited=Quota il.limitada +send-alert-when-reach=Enviar una alerta quan s'arribi +server-capacity=Capacitat del servidor(Hard Disk) +server-description=Control de quota permet habilitar la gestiķ de l'ús que es fa de l'espai per fitxers.\nSi s'activa, podrās gestionar quotes per cada instancia i lloc web. En afegir una quota podrās habilitar l'enviament de mails i alertes al portal i administradors i configurar l'espai assignat a un lloc web(en Gb) i a partir de quin percentatge s'enviarā l'alerta. +server-quota-title=Gestiķ de quotes al servidor +site-name=Nom del lloc +sites-quota-description=Gestiķ de quotes al servidor +total-quota=Quota total +used-space=Espai utilitzat +user-sites=Llocs web d'usuaris +server-current-used-size-diagram-title=Espai utilitzat(per instāncia) +user-site-current-used-size-diagram-title=Quota d'usuari +user-site-no-quota-enabled=No hi ha quota de disc per aquest usuari +sites-quota-enabled-sites-used-diagram-title=Espai utilitzat(habilitat per llocs web) +assigned-quota-less-than-current=La quota assignada es inferior a la quota utilitzada. +unused-space=Espai lliure +quota-from-instance-x-above-the-alert=La instāncia {0} estā per sobre l'alerta assignada +quota-from-site-x-above-the-alert=El lloc web {0} estā  per sobre la quota assignada +quota-from-user-x-above-the-alert={0} lloc web ha arribat a l'alerta de quota +javax.portlet.title.serverquotaportlet_WAR_quotacontrolportlet=Quota de servidor +javax.portlet.title.sitesquotaportlet_WAR_quotacontrolportlet=Quota de lloc web +javax.portlet.title.myquotaportlet_WAR_quotacontrolportlet=La meva quota d'usuari +javax.portlet.title.siteconfigurationquotaportlet_WAR_quotacontrolportlet=Quota de lloc web diff --git a/docroot/WEB-INF/src/org/lsug/quota/event/QuotaStartupAction.java b/docroot/WEB-INF/src/org/lsug/quota/event/QuotaStartupAction.java index 989c91f..0875329 100644 --- a/docroot/WEB-INF/src/org/lsug/quota/event/QuotaStartupAction.java +++ b/docroot/WEB-INF/src/org/lsug/quota/event/QuotaStartupAction.java @@ -104,7 +104,10 @@ protected void doRun(long companyId) throws Exception { if (quota == null) { long quotaUsed = QuotaLocalServiceUtil.calculateSiteUsedQuota(classPK); - QuotaLocalServiceUtil.addQuota(companyId, classNameId, classPK, 0, 0, quotaUsed, Constants.QUOTA_INACTIVE); + + QuotaLocalServiceUtil.createDefaultQuota(companyId, classNameId, group.getClassPK()); + QuotaLocalServiceUtil.decrementQuota(classNameId, group.getClassPK(), quotaUsed); + sitesQuotaAdded++; } diff --git a/docroot/WEB-INF/src/org/lsug/quota/portlet/notification/QuotaServerNotificationHandler.java b/docroot/WEB-INF/src/org/lsug/quota/portlet/notification/QuotaServerNotificationHandler.java index fbe0945..b5225ec 100644 --- a/docroot/WEB-INF/src/org/lsug/quota/portlet/notification/QuotaServerNotificationHandler.java +++ b/docroot/WEB-INF/src/org/lsug/quota/portlet/notification/QuotaServerNotificationHandler.java @@ -54,7 +54,7 @@ protected String getBody(UserNotificationEvent userNotificationEvent, String body = jsonObject.getString("body"); String webId = CompanyLocalServiceUtil.getCompany(classPK).getWebId(); - String title = QuotaUtil.getResource(serviceContext.getLiferayPortletRequest(), + String title = QuotaUtil.getResource(serviceContext.getLocale(), "quota-from-instance-x-above-the-alert", HtmlUtil.escape(webId)); return StringUtil.replace( diff --git a/docroot/WEB-INF/src/org/lsug/quota/service/impl/QuotaLocalServiceImpl.java b/docroot/WEB-INF/src/org/lsug/quota/service/impl/QuotaLocalServiceImpl.java index 57a88ab..1f19d8d 100644 --- a/docroot/WEB-INF/src/org/lsug/quota/service/impl/QuotaLocalServiceImpl.java +++ b/docroot/WEB-INF/src/org/lsug/quota/service/impl/QuotaLocalServiceImpl.java @@ -23,6 +23,7 @@ import com.liferay.portal.kernel.notifications.NotificationEventFactoryUtil; import com.liferay.portal.kernel.notifications.UserNotificationManagerUtil; import com.liferay.portal.kernel.util.OrderByComparator; +import com.liferay.portal.kernel.util.PropsUtil; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.workflow.WorkflowConstants; import com.liferay.portal.model.Company; @@ -31,6 +32,7 @@ import com.liferay.portal.model.UserGroupRole; import com.liferay.portal.model.UserNotificationDeliveryConstants; import com.liferay.portal.service.UserNotificationEventLocalServiceUtil; +import com.liferay.portal.service.persistence.PortalPreferencesUtil; import com.liferay.portlet.documentlibrary.model.DLFileEntry; import com.liferay.portlet.documentlibrary.model.DLFileVersion; import com.liferay.util.portlet.PortletProps; @@ -82,6 +84,10 @@ public Quota createDefaultQuota(long companyId, long classNameId, long quotaAssigned = 0; long quotaUsed = 0; int quotaStatus = 0; + + if ( PropsUtil.get("lsug.quota.portlet.default.alert")!=null ) if ( !PropsUtil.get("lsug.quota.portlet.default.alert").equals("") ) quotaAlert=Integer.parseInt( PropsUtil.get("lsug.quota.portlet.default.alert") ); + if ( PropsUtil.get("lsug.quota.portlet.default.assigned")!=null ) if ( !PropsUtil.get("lsug.quota.portlet.default.assigned").equals("") ) quotaAssigned=Integer.parseInt( PropsUtil.get("lsug.quota.portlet.default.assigned") ); + if ( PropsUtil.get("lsug.quota.portlet.default.status")!=null ) if ( !PropsUtil.get("lsug.quota.portlet.default.status").equals("") ) quotaStatus=Integer.parseInt( PropsUtil.get("lsug.quota.portlet.default.status") ); quota = quotaLocalService.addQuota(companyId, classNameId, classPK, quotaAlert, quotaAssigned, quotaUsed, quotaStatus); diff --git a/docroot/html/sites-quota/view.jsp b/docroot/html/sites-quota/view.jsp index 5ea8111..ac835f0 100644 --- a/docroot/html/sites-quota/view.jsp +++ b/docroot/html/sites-quota/view.jsp @@ -32,9 +32,9 @@ modelVar="quota" escapedModel="<%= true %>"> - - <%= GroupLocalServiceUtil.getGroup(quota.getClassPK()).getDescriptiveName(locale) %> - + + <%= GroupLocalServiceUtil.getGroup(quota.getClassPK()).getDescriptiveName(locale) %> +