<?xml version="1.0" encoding="UTF-8"?>
<meta id="meta.quota" label="CONF_MESSAGE[User quota]" description="CONF_MESSAGE[Maintain the size of a given directory for each user]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
    <class_definition filename="plugins/meta.quota/QuotaComputer.php" classname="Pydio\Access\Meta\Quota\QuotaComputer"/>
    <server_settings>
        <param description="CONF_MESSAGE[Authorized quota. Use php.ini like values (20M, 2G), etc.]" label="CONF_MESSAGE[User Quota]" name="DEFAULT_QUOTA" type="string" inherit="true"/>
        <param description="CONF_MESSAGE[Store computed quota value in the user preferences, to avoid triggering computation each time it is requested. This may introduce some lag if the repository is shared by many users.]" label="CONF_MESSAGE[Cache value]" name="CACHE_QUOTA" type="boolean" default="false"/>
        <param description="Limit that will trigger an alert when approaching the end of the quota. Use a percent value" label="CONF_MESSAGE[Soft Limit (%)]"
               name="SOFT_QUOTA"
               type="integer"/>
        <param description="CONF_MESSAGE[If you want to define quotas for each user, define a custom field in the CUSTOM_DATA parameter of the conf plugin, and declare this field name here.]" label="CONF_MESSAGE[Custom Field (Deprecated)]" name="CUSTOM_DATA_FIELD" type="string"/>
        <global_param description="CONF_MESSAGE[Define if usage must be computed for this repository only, or cumulated on all the repositories of the user]" label="CONF_MESSAGE[Usage scope]" name="USAGE_SCOPE" type="select" choices="local|CONF_MESSAGE[Repository],global|CONF_MESSAGE[Cumulate repositories]" default="local"/>
    </server_settings>
    <client_settings>
        <resources>
            <i18n namespace="meta.quota" path="plugins/meta.quota/res/i18n"/>
            <js className="QuotaActions" file="plugins/meta.quota/res/build/QuotaActions.js"/>
        </resources>
    </client_settings>
   	<registry_contributions>
   		<hooks>
   			<serverCallback hookName="node.change" methodName="recomputeQuotaUsage" defer="true"/>
   			<serverCallback hookName="node.before_change" methodName="precheckQuotaUsage"/>
   			<serverCallback hookName="node.before_path_change" methodName="precheckQuotaUsage"/>
   			<serverCallback hookName="node.before_create" methodName="precheckQuotaUsage"/>
            <serverCallback methodName="loadRepositoryInfo" hookName="repository.load_info"/>
   		</hooks>
        <actions>
            <action name="monitor_quota">
                <gui iconClass="icon-tasks" text="meta.quota.1" title="meta.quota.2" hasAccessKey="false">
                    <context dir="true" recycle="true" selection="false" actionBarGroup="utils"/>
                </gui>
                <rightsContext adminOnly="false" noUser="false" read="false" userLogged="true" write="false"/>
                <processing>
                    <clientCallback module="QuotaActions.Callbacks.computeQuota"/>
                    <clientListener module="QuotaActions.Listeners.init" name="init"/>
                    <serverCallback methodName="getCurrentQuota" restParams="/" developerComment="Get current quota usage information">
                        <output type="JSON" description="A Json structure containing usage and authorized quota"/>
                    </serverCallback>
                </processing>
            </action>
        </actions>
        <client_configs>
            <component_config component="InfoPanel">
                <infoPanel mime="ajxp_root_node" reactComponent="QuotaActions.QuotaPanel"/>
            </component_config>
        </client_configs>
    </registry_contributions>
</meta>
