<?xml version="1.0" encoding="UTF-8"?>
<ajxp_plugin label="CONF_MESSAGE[Notification Center]" description="CONF_MESSAGE[Handle users watches and notifications]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
    <class_definition classname="Pydio\Notification\Core\NotificationCenter" filename="plugins/core.notifications/NotificationCenter.php"/>
    <client_settings>
        <resources>
            <i18n namespace="notification.tpl.short" path="plugins/core.notifications/templates/short"/>
            <i18n namespace="notification.tpl.long" path="plugins/core.notifications/templates/long"/>
            <i18n namespace="notification.tpl.group" path="plugins/core.notifications/templates/group"/>
            <i18n namespace="notification.tpl.block" path="plugins/core.notifications/templates/block"/>
            <i18n namespace="notification.tpl.location" path="plugins/core.notifications/templates/location"/>
            <i18n namespace="notification_center" path="plugins/core.notifications/res/i18n"/>
            <js className="PydioNotifications" file="plugins/core.notifications/res/build/PydioNotifications.js" depends="React,PydioComponents"/>
        </resources>
    </client_settings>
    <server_settings>
        <param name="activate_notifications" scope="user" description="CONF_MESSAGE[Activate desktop notifications]" label="CONF_MESSAGE[Desktop Notifications]" type="button" choices="run_client_action:activateDesktopNotifications" expose="true" editable="true"/>
        <global_param name="USER_EVENTS" description="CONF_MESSAGE[Display a new entry with all events happening on a user workspaces, and alerts. An SQL database must be setup for the FEED_DRIVER configuration.]" label="CONF_MESSAGE[User events and alerts]" type="boolean" default="false"/>
        <global_param name="SHOW_WORKSPACES_ACTIVITY" label="CONF_MESSAGE[Display Workspaces Activity]" description="CONF_MESSAGE[Display workspaces activity to the users in the right-hand information panel]" type="boolean" default="true"/>
        <global_param type="plugin_instance:feed" name="UNIQUE_FEED_INSTANCE" group="CONF_MESSAGE[Instance Params]" label="CONF_MESSAGE[Feed Instance]" description="CONF_MESSAGE[Choose the plugin]" mandatory="true" default="feed.sql"/>
    </server_settings>
    <registry_contributions>
        <actions>
            <action name="get_my_feed">
                <processing>
                    <serverCallback methodName="loadUserFeed"/>
                </processing>
            </action>
            <action name="feed">
                <rightsContext adminOnly="false" noUser="false" read="false" userLogged="only" write="false"/>
                <processing>
                    <serverCallback methodName="loadUserFeed" restParams="/feed_type/path+" developerComment="Load an activity feed for the given node. Filtered by what the current user is authorized to see">
                        <input_param name="path" type="path" description="Optional filter to get activity on a file or a folder"/>
                        <input_param name="format" type="string" description="html, json, xml, array (internal value)"/>
                        <input_param name="feed_type" type="string" description="notif, alert or all"/>
                        <input_param name="offset" type="integer" description="Offset for pagination"/>
                        <input_param name="limit" type="integer" description="Limit for pagination"/>
                        <input_param name="merge_description" type="boolean" description="Wether to merge notification title and description in text"/>
                        <input_param name="merge_description_as_label" type="boolean" description="Wether to merge notification title and description in title"/>
                        <input_param name="current_repository" type="boolean"
                                     description="Wether to get activity from current repository (true), or compute all from authorized repositories for user (false)"/>
                    </serverCallback>
                </processing>
            </action>
            <action name="clear_feed">
                <processing><serverCallback methodName="clearUserFeed" restParams="/context_type/context_value">
                    <input_param name="context_type" type="string" description="all|repository|user"/>
                    <input_param name="context_value" type="string" description="Either empty, or a repo ID, or a userId depending on the context_type"/>
                </serverCallback></processing>
            </action>
            <action name="dismiss_user_alert">
                <gui text="notification_center.7" title="notification_center.7" iconClass="mdi mdi-close-circle" src="notification_center/ICON_SIZE/feed.png" accessKey="" hasAccessKey="false">
                    <context selection="true" dir="" recycle="true" actionBar="true" actionBarGroup="inline-notifications" contextMenu="false" infoPanel="false"/>
                    <selectionContext dir="true" file="true" recycle="false" unique="true"/>
                </gui>
                <rightsContext adminOnly="false" noUser="true" read="false" userLogged="only" write="false"/>
                <processing>
                    <clientCallback module="PydioCoreActions.Callbacks.dismissUserAlert"/>
                    <serverCallback methodName="dismissUserAlert" restParams="/alert_id/occurences" developerComment="Dismiss one or more occurences of alerts">
                        <input_param name="alert_id" type="integer" description="Id passed in /feed action list"/>
                        <input_param name="occurences" type="integer" description="1 or more"/>
                    </serverCallback>
                </processing>
            </action>
            <action name="update_alerts_last_read">
                <processing>
                    <serverCallback methodName="updateAlertsLastRead" restParams="/repository_scope">
                        <input_param name="repository_scope" type="string" description="all|repositoryId"/>
                    </serverCallback>
                </processing>
            </action>
            <action name="load_user_recent_items">
                <processing>
                    <serverCallback methodName="loadRecentItemsList" restParams="/"/>
                </processing>
            </action>
            <action name="activateDesktopNotifications">
                <gui src="" iconClass="icon-rss" text="notification_center.1" title="notification_title.2">
                    <context dir="true" recycle="true" selection="false"/>
                </gui>
                <processing>
                    <clientCallback module="PydioCoreActions.Callbacks.activateDesktopNotifications"/>
                </processing>
            </action>
        </actions>
        <hooks>
            <serverCallback methodName="persistChangeHookToFeed" hookName="node.change" defer="true"/>
            <serverCallback methodName="persistReadHookToRecentList" hookName="node.read"/>
            <serverCallback methodName="persistNotificationToAlerts" hookName="msg.notification"/>
            <serverCallback methodName="loadRepositoryInfo" hookName="repository.load_info"/>
            <serverCallback methodName="shareAssignRight" hookName="node.share.assign_right"/>
        </hooks>
        <client_configs>
            <component_config component="InfoPanel">
                <infoPanel mime="ajxp_root_node,generic_dir,generic_file" reactComponent="PydioNotifications.ActivityPanel"/>
            </component_config>
            <component_config component="AjxpReactComponent::left_navigator">
                <additional_content
                        id="navigation_alerts"
                        position="0"
                        type="ListProvider"
                        options='{"title":"notification_center.3", "titleClassName":"colorcode-alert", "startOpen":true, "dataModelBadge":{"property":"metadata","metadata_sum":"event_occurence", "className":"alerts_number_badge"}, "fit":"content","silentLoading":true,"actionBarGroups":["inline-notifications"],"nodeProviderProperties":{"get_action":"get_my_feed", "connexion_discrete":true, "format":"xml", "current_repository":"true", "feed_type":"alert", "merge_description":"false"},"reloadOnServerMessage":"tree/reload_user_feed", "connexion_discrete":true, "tipAttribute":"event_description_long", "emptyChildrenMessage":"notification_center.8"}'/>
            </component_config>
        </client_configs>
    </registry_contributions>
    <dependencies>
        <activePlugin pluginName="core.conf"/>
    </dependencies>
</ajxp_plugin>
