component file sharing (management): add values of quota and used size on result form
This commit is contained in:
parent
3da29896df
commit
3c12c4f797
2 changed files with 9 additions and 7 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Libervia plugin to manage file sharing component through ad-hoc commands
|
||||||
# SAT plugin to detect language (experimental)
|
|
||||||
# Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
|
# Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
|
@ -19,14 +18,14 @@
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from wokkel import data_form
|
||||||
|
from twisted.internet import defer
|
||||||
|
from twisted.words.protocols.jabber import jid
|
||||||
from sat.core.i18n import _, D_
|
from sat.core.i18n import _, D_
|
||||||
from sat.core import exceptions
|
from sat.core import exceptions
|
||||||
from sat.core.constants import Const as C
|
from sat.core.constants import Const as C
|
||||||
from sat.core.log import getLogger
|
from sat.core.log import getLogger
|
||||||
from sat.tools.common import utils
|
from sat.tools.common import utils
|
||||||
from wokkel import data_form
|
|
||||||
from twisted.internet import defer
|
|
||||||
from twisted.words.protocols.jabber import jid
|
|
||||||
|
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -474,7 +473,9 @@ class FileSharingManagement(object):
|
||||||
except exceptions.PermissionError:
|
except exceptions.PermissionError:
|
||||||
raise WorkflowError(self._err(_("forbidden")))
|
raise WorkflowError(self._err(_("forbidden")))
|
||||||
status = self._c.STATUS.COMPLETED
|
status = self._c.STATUS.COMPLETED
|
||||||
payload = None
|
form = data_form.Form("result")
|
||||||
|
form.makeFields({"quota": quota, "user": size_used})
|
||||||
|
payload = form.toElement()
|
||||||
note = (
|
note = (
|
||||||
self._c.NOTE.INFO,
|
self._c.NOTE.INFO,
|
||||||
_("You are currently using {size_used} on {size_quota}").format(
|
_("You are currently using {size_used} on {size_quota}").format(
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,8 @@ def dataDict2dataForm(data_dict):
|
||||||
- an optional "namespace" key with form namespace
|
- an optional "namespace" key with form namespace
|
||||||
- a mandatory "fields" key with list of fields as follow:
|
- a mandatory "fields" key with list of fields as follow:
|
||||||
- "type" is mostly the same as data_form.Field.fieldType
|
- "type" is mostly the same as data_form.Field.fieldType
|
||||||
- "var", "label", and "value" follow same attribude in data_form.Field
|
- "name" is used to set the "var" attribute of data_form.Field
|
||||||
|
- "label", and "value" follow same attribude in data_form.Field
|
||||||
- "xhtml" is used for "xml" fields with child in the C.NS_XHTML namespace
|
- "xhtml" is used for "xml" fields with child in the C.NS_XHTML namespace
|
||||||
- "options" are list of dict with optional "label" and mandatory "value"
|
- "options" are list of dict with optional "label" and mandatory "value"
|
||||||
following suitable attributes from data_form.Option
|
following suitable attributes from data_form.Option
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue