add settings and activity info.xml elements (#444)

This commit is contained in:
Bernhard Posselt 2017-03-18 22:03:24 +01:00 коммит произвёл GitHub
Родитель 4f186a24b1
Коммит 9ee3b1a248
5 изменённых файлов: 148 добавлений и 1 удалений

Просмотреть файл

@ -229,6 +229,30 @@ A full blown example would look like this (needs to be utf-8 encoded):
<command>A\Php\Class</command>
</commands>
<ocsid>123</ocsid>
<settings>
<admin>OCA\Theming\Settings\Admin</admin>
<admin-section>OCA\Theming\Settings\Section</admin-section>
</settings>
<activity>
<settings>
<setting>OCA\Files\Activity\Settings\FavoriteAction</setting>
<setting>OCA\Files\Activity\Settings\FileChanged</setting>
<setting>OCA\Files\Activity\Settings\FileCreated</setting>
<setting>OCA\Files\Activity\Settings\FileDeleted</setting>
<setting>OCA\Files\Activity\Settings\FileFavorite</setting>
<setting>OCA\Files\Activity\Settings\FileRestored</setting>
</settings>
<filters>
<filter>OCA\Files\Activity\Filter\FileChanges</filter>
<filter>OCA\Files\Activity\Filter\Favorites</filter>
</filters>
<providers>
<provider>OCA\Files\Activity\FavoriteProvider</provider>
<provider>OCA\Files\Activity\Provider</provider>
</providers>
</activity>
</info>
The following tags are validated and used in the following way:
@ -397,6 +421,21 @@ ocsid
* if not provided in your info.xml then the app will not be available for Nextcloud 9 and 10
* if you do not have an id yet, create an app on the apps.owncloud.com app store and use that id. This ensures that the id is unique and unused. You can delete the app afterwards if you do not want to publish your app on both stores.
* deprecated; Support will be moved once 9 an 10 run out of support
activity/settings/setting
* optional
* must contain a php class which implements OCP\Activity\ISetting and is used to add additional settings ui elements to the activity app
activity/filters/filter
* optional
* must contain a php class which implements OCP\Activity\IFilter and is used to add additional filters to the activity app
activity/providers/provider
* optional
* must contain a php class which implements OCP\Activity\IProvider and is used to react to events from the activity app
settings/admin
* optional
* must contain a php class which implements OCP\Settings\ISettings and returns the form to render for the global settings area
settings/admin-section
* optional
* must contain a php class which implements OCP\Settings\ISection and returns data to render navigation entries in the global settings area
The following character maximum lengths are enforced:

Просмотреть файл

@ -47,6 +47,10 @@
minOccurs="0" maxOccurs="1"/>
<xs:element name="ocsid" type="xs:int" minOccurs="0"
maxOccurs="1"/>
<xs:element name="settings" type="settings" minOccurs="0"
maxOccurs="1"/>
<xs:element name="activity" type="activity" minOccurs="0"
maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniqueNameL10n">
@ -212,7 +216,8 @@
<xs:simpleType name="semver">
<xs:restriction base="limited-string">
<xs:pattern value="(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?"/>
<xs:pattern
value="(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?"/>
</xs:restriction>
</xs:simpleType>
@ -334,6 +339,46 @@
</xs:sequence>
</xs:complexType>
<xs:complexType name="settings">
<xs:sequence>
<xs:element name="admin" type="php-class" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="admin-section" type="php-class" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="activity">
<xs:sequence>
<xs:element name="settings" type="activity-settings" minOccurs="0"
maxOccurs="1"/>
<xs:element name="filters" type="activity-filters" minOccurs="0" maxOccurs="1"/>
<xs:element name="providers" type="activity-providers" minOccurs="0"
maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="activity-settings">
<xs:sequence>
<xs:element name="setting" type="php-class" minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="activity-filters">
<xs:sequence>
<xs:element name="filter" type="php-class" minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="activity-providers">
<xs:sequence>
<xs:element name="provider" type="php-class" minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- dependencies -->
<xs:complexType name="dependencies">
<xs:sequence>

Просмотреть файл

@ -38,6 +38,8 @@
<xsl:copy-of select="two-factor-providers"/>
<xsl:copy-of select="commands"/>
<xsl:copy-of select="ocsid"/>
<xsl:apply-templates select="settings"/>
<xsl:apply-templates select="activity"/>
<!-- copy invalid elements to fail if they are present -->
<xsl:copy-of select="standalone"/>
@ -50,6 +52,21 @@
</info>
</xsl:template>
<xsl:template match="activity">
<activity>
<xsl:copy-of select="admin"/>
<xsl:copy-of select="admin-section"/>
</activity>
</xsl:template>
<xsl:template match="settings">
<settings>
<xsl:copy-of select="settings"/>
<xsl:copy-of select="filters"/>
<xsl:copy-of select="providers"/>
</settings>
</xsl:template>
<xsl:template match="documentation">
<documentation>
<xsl:copy-of select="user"/>

Просмотреть файл

@ -0,0 +1,40 @@
<?xml version="1.0"?>
<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../release/info.xsd">
<id>news</id>
<name>News</name>
<summary>An RSS/Atom feed reader</summary>
<description>An RSS/Atom feed reader</description>
<version>8.8.2</version>
<licence>agpl</licence>
<author>Bernhard Posselt</author>
<category>multimedia</category>
<bugs>https://github.com/nextcloud/news/issues</bugs>
<activity>
<filters>
<filter>OCA\Files\Activity\Filter\FileChanges</filter>
<filter>OCA\Files\Activity\Filter\Favorites</filter>
</filters>
<settings>
<setting>OCA\Files\Activity\Settings\FavoriteAction</setting>
<setting>OCA\Files\Activity\Settings\FileChanged</setting>
<setting>OCA\Files\Activity\Settings\FileCreated</setting>
<setting>OCA\Files\Activity\Settings\FileDeleted</setting>
<setting>OCA\Files\Activity\Settings\FileFavorite</setting>
<setting>OCA\Files\Activity\Settings\FileRestored</setting>
</settings>
<providers>
<provider>OCA\Files\Activity\FavoriteProvider</provider>
<provider>OCA\Files\Activity\Provider</provider>
</providers>
</activity>
<dependencies>
<owncloud min-version="9.0" max-version="9.0"/>
</dependencies>
<settings>
<admin-section>OCA\Theming\Settings\Section</admin-section>
<admin>OCA\Theming\Settings\Admin</admin>
</settings>
</info>

Просмотреть файл

@ -66,6 +66,12 @@ class ParserTest(TestCase):
self.config.pre_info_xslt,
self.config.info_xslt)
def test_parse_settings_and_activity(self):
xml = self._get_contents('data/infoxmls/settings-and-activity.xml')
parse_app_metadata(xml, self.config.info_schema,
self.config.pre_info_xslt,
self.config.info_xslt)
def test_parse_pre_release(self):
xml = self._get_contents('data/infoxmls/prerelease.xml')
result = parse_app_metadata(xml, self.config.info_schema,