Skip to content
Snippets Groups Projects
Commit fc297fdd authored by uhensler's avatar uhensler
Browse files

OO-2834: Format the quota bytes in the admin environment

parent 4c429ff4
No related branches found
No related tags found
No related merge requests found
Showing
with 80 additions and 26 deletions
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.admin.quota;
import java.util.Locale;
import org.olat.core.gui.components.table.CustomCellRenderer;
import org.olat.core.gui.render.Renderer;
import org.olat.core.gui.render.StringOutput;
import org.olat.core.util.Formatter;
/**
* Render the bytes of the quota in a human readable format.
*
* Initial date: 12.07.2017<br>
* @author uhensler, urs.hensler@frentix.com, http://www.frentix.com
*
*/
public class QuotaByteRenderer implements CustomCellRenderer {
@Override
public void render(StringOutput sb, Renderer renderer, Object val, Locale locale, int alignment, String action) {
if (val instanceof Long) {
Long kBytes = (Long) val;
Long bytes = kBytes * 1000L;
sb.append(Formatter.formatBytes(bytes))
.append(" (")
.append(kBytes)
.append(")");
}
}
}
......@@ -30,6 +30,8 @@ import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.panel.Panel;
import org.olat.core.gui.components.table.ColumnDescriptor;
import org.olat.core.gui.components.table.CustomRenderColumnDescriptor;
import org.olat.core.gui.components.table.DefaultColumnDescriptor;
import org.olat.core.gui.components.table.StaticColumnDescriptor;
import org.olat.core.gui.components.table.Table;
......@@ -83,8 +85,10 @@ public class QuotaController extends BasicController {
quotaTableModel = new QuotaTableModel();
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.path", 0, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.quota", 1, null, getLocale()));
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.limit", 2, null, getLocale()));
tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.quota", 1, null, getLocale(),
ColumnDescriptor.ALIGNMENT_LEFT, new QuotaByteRenderer()));
tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.limit", 2, null, getLocale(),
ColumnDescriptor.ALIGNMENT_LEFT, new QuotaByteRenderer()));
tableCtr.addColumnDescriptor(new StaticColumnDescriptor("qf.edit", "table.action", translate("edit")));
tableCtr.addColumnDescriptor(new StaticColumnDescriptor("qf.del", "table.action", translate("delete")));
tableCtr.setTableDataModel(quotaTableModel);
......
......@@ -19,6 +19,6 @@ qf.noquota=Tento adres\u00E1\u0159 nem\u00E1 specifikovanou kv\u00F3tu. Jsou u\u
qf.path=Cesta
qf.quota=Kv\u00F3ta (KB)
qf.title=Administrace kv\u00F3t
table.header.limit=Upload limit KB
table.header.limit=Upload limit (KB)
table.header.path=Cesta
table.header.quota=Kv\u00F3ta KB
table.header.quota=Kv\u00F3ta (KB)
......@@ -19,6 +19,6 @@ qf.noquota=Denne mappe har ingen specifik kvota. Den f\u00F8lgende standardkvota
qf.path=Stinavn
qf.quota=Kvota (KB)
qf.title=Kvota administration
table.header.limit=Upload begr\u00E6nsning i KB
table.header.limit=Upload begr\u00E6nsning (KB)
table.header.path=Stinavn
table.header.quota=Kvota KB
table.header.quota=Kvota (KB)
......@@ -22,7 +22,7 @@ qf.noquota=Dieser Ordner hat keine spezifische Quota. Die untenstehenden Default
qf.path=Pfad
qf.quota=Quota (KB)
qf.title=Quotaverwaltung
table.header.limit=Upload Limite KB
table.header.limit=Upload Limite (KB)
table.header.path=Pfad
table.header.quota=Quota KB
table.header.quota=Quota (KB)
warning.qd.not.enough.privilege=Sie haben nicht die Berechtigungen Quota zu editieren.
......@@ -21,6 +21,6 @@ qf.noquota=\u039F \u03C6\u03AC\u03BA\u03B5\u03BB\u03BF\u03C2 \u03B4\u03B5\u03BD
qf.path=\u0394\u03B9\u03B1\u03B4\u03C1\u03BF\u03BC\u03AE
qf.quota=\u038C\u03C1\u03B9\u03B1 (KB)
qf.title=\u0394\u03B9\u03B1\u03C7\u03B5\u03AF\u03C1\u03B9\u03C3\u03B7 \u039F\u03C1\u03AF\u03C9\u03BD
table.header.limit=\u038C\u03C1\u03B9\u03BF Upload [KB]
table.header.limit=\u038C\u03C1\u03B9\u03BF Upload (KB)
table.header.path=\u0394\u03B9\u03B1\u03B4\u03C1\u03BF\u03BC\u03AE
table.header.quota=\u038C\u03C1\u03B9\u03BF [KB]
table.header.quota=\u038C\u03C1\u03B9\u03BF (KB)
......@@ -22,7 +22,7 @@ qf.noquota=This folder has no specific quota. The following default quotas will
qf.path=Path
qf.quota=Quota (KB)
qf.title=Quota management
table.header.limit=Upload limit KB
table.header.limit=Upload limit (KB)
table.header.path=Path
table.header.quota=Quota KB
table.header.quota=Quota (KB)
warning.qd.not.enough.privilege=You don't have the privileges to edit quotas.
......@@ -19,6 +19,6 @@ qf.noquota=Esta carpeta no tiene cuota espec\u00EDfica. Se est\u00E1n utilizando
qf.path=Ruta
qf.quota=Cuota (KB)
qf.title=Gesti\u00F3n de cuota
table.header.limit=L\u00EDmite de subida en KB
table.header.limit=L\u00EDmite de subida en (KB)
table.header.path=Ruta
table.header.quota=Cuota KB
table.header.quota=Cuota (KB)
......@@ -19,6 +19,6 @@ qf.noquota=This folder has no specific quota. The following default quotas are u
qf.path=Path
qf.quota=Quota (KB)
qf.title=Quota management
table.header.limit=Upload limit KB
table.header.limit=Upload limit (KB)
table.header.path=Path
table.header.quota=Quota KB
table.header.quota=Quota (KB)
......@@ -22,7 +22,7 @@ qf.noquota=Questa cartella non ha una quota specifica. Vengono utilizzate le quo
qf.path=Percorso
qf.quota=Quota (KB)
qf.title=Gestione delle quote
table.header.limit=Limite di caricamento KB
table.header.limit=Limite di caricamento (KB)
table.header.path=Percorso
table.header.quota=Quota KB
table.header.quota=Quota (KB)
warning.qd.not.enough.privilege=Privilegi insufficienti per modificare le quote.
......@@ -21,6 +21,6 @@ qf.noquota=\u3053\u306E\u30D5\u30A9\u30EB\u30C0\u306B\u306F\u3001\u30AF\u30AA\u3
qf.path=\u30D1\u30B9
qf.quota=\u30AF\u30AA\u30FC\u30BF (KB)
qf.title=\u30AF\u30AA\u30FC\u30BF\u7BA1\u7406
table.header.limit=\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5236\u9650 KB
table.header.limit=\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u5236\u9650 (KB)
table.header.path=\u30D1\u30B9
table.header.quota=\u30AF\u30AA\u30FC\u30BF KB
table.header.quota=\u30AF\u30AA\u30FC\u30BF (KB)
......@@ -19,6 +19,6 @@ qf.noquota=Aplankas neturi nustatytos kvotos. Bus naudojamos kvotos pagal nutyl\
qf.path=Kelias
qf.quota=Kvota KB
qf.title=Kvot\u0173 valdymas
table.header.limit=Nusiuntimo limitas KB
table.header.limit=Nusiuntimo limitas (KB)
table.header.path=Kelias
table.header.quota=Kvota KB
table.header.quota=Kvota (KB)
......@@ -21,6 +21,6 @@ qf.noquota=Deze map heeft geen specifieke quota. De volgende default quota's zul
qf.path=Pad
qf.quota=Quota (KB)
qf.title=Quota beheer
table.header.limit=Upload limiet KB
table.header.limit=Upload limiet (KB)
table.header.path=Pad
table.header.quota=Quota KB
table.header.quota=Quota (KB)
......@@ -19,6 +19,6 @@ qf.noquota=Kjo dosje nuk ka ndonj\u00EB kuot\u00EB t\u00EB ve\u00E7ant\u00EB. N\
qf.path=Dosje
qf.quota=Kuota (KB)
qf.title=Menaxhimi i kuot\u00EBs
table.header.limit=Kufiri i ngarkimi n\u00EB KB
table.header.limit=Kufiri i ngarkimi n\u00EB (KB)
table.header.path=Dosje
table.header.quota=Q\=Kuota KB
table.header.quota=Q\=Kuota (KB)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment