Resolve PIP GUI-related todos
authorMatthias Schmidt <gravatronics@live.com>
Sun, 28 Oct 2018 06:28:32 +0000 (07:28 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 28 Oct 2018 06:28:32 +0000 (07:28 +0100)
See #2545

wcfsetup/install/files/lib/system/package/plugin/ObjectTypePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/TemplateListenerPackageInstallationPlugin.class.php
wcfsetup/install/lang/en.xml

index 99b4bf784858814e3af827a2c76ec974178d11f9..7be047035229c66c8ec2e52c4e9c65216cb8e4ea 100644 (file)
@@ -31,6 +31,7 @@ use wcf\system\form\builder\field\IntegerFormField;
 use wcf\system\form\builder\field\ItemListFormField;
 use wcf\system\form\builder\field\SingleSelectionFormField;
 use wcf\system\form\builder\field\TextFormField;
+use wcf\system\form\builder\field\validation\FormFieldValidatorUtil;
 use wcf\system\form\builder\IFormDocument;
 use wcf\system\Regex;
 use wcf\system\WCF;
@@ -450,8 +451,11 @@ class ObjectTypePackageInstallationPlugin extends AbstractXMLPackageInstallation
                                TextFormField::create('notificationObjectTypeCategory')
                                        ->objectProperty('category')
                                        ->label('wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category')
-                                       ->description('wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.description'),
-                                       // TODO: validator
+                                       ->description('wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.description')
+                                       ->addValidator(FormFieldValidatorUtil::getDotSeparatedStringValidator(
+                                               'wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category',
+                                               3
+                                       )),
                                
                                BooleanFormField::create('notificationObjectTypeSupportsReactions')
                                        ->objectProperty('supportsReactions')
index 47dd2bd046cae859b5abd98bd3f262eaecb29e60..98aa4879b59f7924459c6faffac02372535621c2 100644 (file)
@@ -767,6 +767,12 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                
                $page->appendChild($document->createElement('pageType', $data['pageType']));
                
+               $this->appendElementChildren(
+                       $page,
+                       ['controller' => '',],
+                       $form
+               );
+               
                foreach ($formData['name_i18n'] as $languageID => $name) {
                        $name = $document->createElement('name', $this->getAutoCdataValue($name));
                        $name->setAttribute('language', LanguageFactory::getInstance()->getLanguage($languageID)->languageCode);
@@ -774,16 +780,23 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        $page->appendChild($name);
                }
                
-               // TODO: use `appendElementChildren`
-               $optionalElements = [
-                       'controller', 'handler', 'controllerCustomURL', 'hasFixedParent',
-                       'parent', 'options', 'permissions', 'cssClassName', 'allowSpidersToIndex',
-                       'excludeFromLandingPage', 'availableDuringOfflineMode', 'requireObjectID'
-               ];
-               
-               foreach ($optionalElements as $property) {
-                       if (!empty($data[$property])) {
-                               $page->appendChild($document->createElement($property, (string)$data[$property]));
+               $this->appendElementChildren(
+                       $page,
+                       [
+                               'handler' => '',
+                               'controllerCustomURL' => '',
+                               'hasFixedParent' => 0,
+                               'parent' => '',
+                               'options' => '',
+                               'permissions' => '',
+                               'cssClassName' => '',
+                               'allowSpidersToIndex' => 0,
+                               'excludeFromLandingPage' => 0,
+                               'availableDuringOfflineMode' => 0,
+                               'requireObjectID' => 0
+                       ],
+                       $form
+               );
                        }
                }
                
index cfa39d58af3930bc391ab64510f61aefa9653b68..c05155e9c2bbd783fdf3712baa1773d92ff3287d 100644 (file)
@@ -326,7 +326,6 @@ class TemplateListenerPackageInstallationPlugin extends AbstractXMLPackageInstal
                                        }
                                })),
                        
-                       // TODO: use field with code support
                        MultilineTextFormField::create('templateCode')
                                ->objectProperty('templatecode')
                                ->label('wcf.acp.pip.templateListener.templateCode')
index a701302fe9844b81d21e08adb3a8f2d1fd60fbcb..205b3a103537c0e959f0ba8e58aaee43ddcd420d 100644 (file)
@@ -1781,7 +1781,9 @@ If you have <strong>already bought the licenses for the listed apps</strong>, th
                <item name="wcf.acp.pip.objectType.com.woltlab.wcf.condition.userSearch.data.title"><![CDATA[User Search Condition Data]]></item>
                <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.data.title"><![CDATA[Notification Object Type Data]]></item>
                <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category"><![CDATA[Category]]></item>
-               <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.description"><![CDATA[The category is used to group events on the notification settings page.]]></item>
+               <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.description"><![CDATA[The category is used to group events on the notification settings page. The category consists of at least three segments that are separated by dots. Each segment may only contain the following characters: [A-z0-9-_].]]></item>
+               <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.error.invalidSegments"><![CDATA[The following segments are invalid: {implode from=$invalidSegments key=segmentNumber item=segment}{if $segment !== ''}<code>{$segment}</code>{else}(empty){/if} (segment {#$segmentNumber + 1}){/implode}.]]></item>
+               <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.error.tooFewSegments"><![CDATA[The category only contains {#$segmentCount} segment{if $segmentCount > 1}s{/if}.]]></item>
                <item name="wcf.acp.pip.objectType.com.woltlab.wcf.rebuildData.data.title"><![CDATA[Rebuild Data Worker Data]]></item>
                <item name="wcf.acp.pip.objectType.com.woltlab.wcf.rebuildData.niceValue"><![CDATA[Nice Value]]></item>
                <item name="wcf.acp.pip.objectType.com.woltlab.wcf.rebuildData.niceValue.description"><![CDATA[The nice value is used to determine the order in which the rebuild data workers are shown and thus in which order they should be executed. Workers with lower nice value are shown first.]]></item>