Update code of third part of tutorial series
authorMatthias Schmidt <gravatronics@live.com>
Tue, 20 Apr 2021 11:20:35 +0000 (13:20 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 20 Apr 2021 11:20:35 +0000 (13:20 +0200)
25 files changed:
snippets/tutorial/tutorial-series/part-3/acpMenu.xml
snippets/tutorial/tutorial-series/part-3/acptemplates/personAdd.tpl
snippets/tutorial/tutorial-series/part-3/acptemplates/personList.tpl
snippets/tutorial/tutorial-series/part-3/files/acp/database/install_com.woltlab.wcf.people.php [new file with mode: 0644]
snippets/tutorial/tutorial-series/part-3/files/lib/acp/form/PersonAddForm.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/acp/form/PersonEditForm.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/acp/page/PersonListPage.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/data/person/Person.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/data/person/PersonAction.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/data/person/PersonEditor.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/data/person/PersonList.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/page/PersonListPage.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/page/PersonPage.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/system/cache/runtime/PersonRuntimeCache.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/system/comment/manager/PersonCommentManager.class.php
snippets/tutorial/tutorial-series/part-3/files/lib/system/page/handler/PersonPageHandler.class.php
snippets/tutorial/tutorial-series/part-3/install.sql [deleted file]
snippets/tutorial/tutorial-series/part-3/language/de.xml
snippets/tutorial/tutorial-series/part-3/language/en.xml
snippets/tutorial/tutorial-series/part-3/menuItem.xml
snippets/tutorial/tutorial-series/part-3/objectType.xml
snippets/tutorial/tutorial-series/part-3/package.xml
snippets/tutorial/tutorial-series/part-3/page.xml
snippets/tutorial/tutorial-series/part-3/templates/person.tpl
snippets/tutorial/tutorial-series/part-3/userGroupOption.xml

index 8ad2af2cf7af4569a9fc03bb76857ebe7ca5dc0c..6ccf64fdbe0f830d0f6c16503e0c6642144944dd 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/acpMenu.xsd">
+<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/5.4/acpMenu.xsd">
        <import>
                <acpmenuitem name="wcf.acp.menu.link.person">
                        <parent>wcf.acp.menu.link.content</parent>
index 0e3690717aa08822e57db6b9f6df5f716a4e9d87..4cf2ec4a7d77e24bf8eb2af81cb5af637792a5d3 100644 (file)
        </nav>
 </header>
 
-{include file='formNotice'}
-
-<form method="post" action="{if $action == 'add'}{link controller='PersonAdd'}{/link}{else}{link controller='PersonEdit' object=$person}{/link}{/if}">
-       <div class="section">
-               <dl{if $errorField == 'firstName'} class="formError"{/if}>
-                       <dt><label for="firstName">{lang}wcf.person.firstName{/lang}</label></dt>
-                       <dd>
-                               <input type="text" id="firstName" name="firstName" value="{$firstName}" required autofocus maxlength="255" class="long">
-                               {if $errorField == 'firstName'}
-                                       <small class="innerError">
-                                               {if $errorType == 'empty'}
-                                                       {lang}wcf.global.form.error.empty{/lang}
-                                               {else}
-                                                       {lang}wcf.acp.person.firstName.error.{$errorType}{/lang}
-                                               {/if}
-                                       </small>
-                               {/if}
-                       </dd>
-               </dl>
-               
-               <dl{if $errorField == 'lastName'} class="formError"{/if}>
-                       <dt><label for="lastName">{lang}wcf.person.lastName{/lang}</label></dt>
-                       <dd>
-                               <input type="text" id="lastName" name="lastName" value="{$lastName}" required maxlength="255" class="long">
-                               {if $errorField == 'lastName'}
-                                       <small class="innerError">
-                                               {if $errorType == 'empty'}
-                                                       {lang}wcf.global.form.error.empty{/lang}
-                                               {else}
-                                                       {lang}wcf.acp.person.lastName.error.{$errorType}{/lang}
-                                               {/if}
-                                       </small>
-                               {/if}
-                       </dd>
-               </dl>
-               
-               <dl>
-                       <dt></dt>
-                       <dd>
-                               <label><input name="enableComments" type="checkbox" value="1"{if $enableComments} checked{/if}> {lang}wcf.person.enableComments{/lang}</label>
-                               <small>{lang}wcf.person.enableComments.description{/lang}</small>
-                       </dd>
-               </dl>
-               
-               {event name='dataFields'}
-       </div>
-       
-       {event name='sections'}
-       
-       <div class="formSubmit">
-               <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
-               {csrfToken}
-       </div>
-</form>
+{@$form->getHtml()}
 
 {include file='footer'}
index fc7dc36e24fbbf7b71312c34ea0ad251cd83fd2b..71766eff5a05d7043891dc14be4a018476b5a3a1 100644 (file)
@@ -21,8 +21,8 @@
 {/hascontent}
 
 {if $objects|count}
-       <div class="section tabularBox" id="personTableContainer">
-               <table class="table">
+       <div class="section tabularBox">
+               <table class="table jsObjectActionContainer" data-object-action-class-name="wcf\data\person\PersonAction">
                        <thead>
                                <tr>
                                        <th class="columnID columnPersonID{if $sortField == 'personID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='PersonList'}pageNo={@$pageNo}&sortField=personID&sortOrder={if $sortField == 'personID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
                        
                        <tbody class="jsReloadPageWhenEmpty">
                                {foreach from=$objects item=person}
-                                       <tr class="jsPersonRow">
+                                       <tr class="jsObjectActionObject" data-object-id="{@$person->getObjectID()}">
                                                <td class="columnIcon">
                                                        <a href="{link controller='PersonEdit' object=$person}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 fa-pencil"></span></a>
-                                                       <span class="icon icon16 fa-times jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$person->personID}" data-confirm-message-html="{lang __encode=true}wcf.acp.person.delete.confirmMessage{/lang}"></span>
+                                                       {objectAction action="delete" objectTitle=$person->getTitle()}
                                                        
                                                        {event name='rowButtons'}
                                                </td>
        <p class="info">{lang}wcf.global.noItems{/lang}</p>
 {/if}
 
-<script data-relocate="true">
-       $(function() {
-               new WCF.Action.Delete('wcf\\data\\person\\PersonAction', '.jsPersonRow');
-       });
-</script>
-
 {include file='footer'}
diff --git a/snippets/tutorial/tutorial-series/part-3/files/acp/database/install_com.woltlab.wcf.people.php b/snippets/tutorial/tutorial-series/part-3/files/acp/database/install_com.woltlab.wcf.people.php
new file mode 100644 (file)
index 0000000..895cbe5
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+use wcf\system\database\table\column\DefaultTrueBooleanDatabaseTableColumn;
+use wcf\system\database\table\column\NotNullVarchar255DatabaseTableColumn;
+use wcf\system\database\table\column\ObjectIdDatabaseTableColumn;
+use wcf\system\database\table\column\SmallintDatabaseTableColumn;
+use wcf\system\database\table\DatabaseTable;
+
+return [
+    DatabaseTable::create('wcf1_person')
+        ->columns([
+            ObjectIdDatabaseTableColumn::create('personID'),
+            NotNullVarchar255DatabaseTableColumn::create('firstName'),
+            NotNullVarchar255DatabaseTableColumn::create('lastName'),
+            SmallintDatabaseTableColumn::create('comments')
+                ->length(5)
+                ->notNull()
+                ->defaultValue(0),
+            DefaultTrueBooleanDatabaseTableColumn::create('enableComments'),
+        ]),
+];
index 7e6de521059e5d48d93f81e2395710eb67980c1b..565274d19956ec8a250678fddf71d2828db3cdf5 100644 (file)
 <?php
+
 namespace wcf\acp\form;
+
 use wcf\data\person\PersonAction;
-use wcf\form\AbstractForm;
-use wcf\system\exception\UserInputException;
-use wcf\system\request\LinkHandler;
-use wcf\system\WCF;
-use wcf\util\StringUtil;
+use wcf\form\AbstractFormBuilderForm;
+use wcf\system\form\builder\container\FormContainer;
+use wcf\system\form\builder\field\BooleanFormField;
+use wcf\system\form\builder\field\TextFormField;
 
 /**
  * Shows the form to create a new person.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Acp\Form
+ *
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Acp\Form
  */
-class PersonAddForm extends AbstractForm {
-       /**
-        * @inheritDoc
-        */
-       public $activeMenuItem = 'wcf.acp.menu.link.person.add';
-       
-       /**
-        * is `1` if comments are enabled for the person, otherwise `0`
-        * @var integer
-        */
-       public $enableComments = 1;
-       
-       /**
-        * first name of the person
-        * @var string
-        */
-       public $firstName = '';
-       
-       /**
-        * last name of the person
-        * @var string
-        */
-       public $lastName = '';
-       
-       /**
-        * @inheritDoc
-        */
-       public $neededPermissions = ['admin.content.canManagePeople'];
-       
-       /**
-        * @inheritDoc
-        */
-       public function assignVariables() {
-               parent::assignVariables();
-               
-               WCF::getTPL()->assign([
-                       'action' => 'add',
-                       'enableComments' => $this->enableComments,
-                       'firstName' => $this->firstName,
-                       'lastName' => $this->lastName
-               ]);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function readFormParameters() {
-               parent::readFormParameters();
-               
-               $this->enableComments = isset($_POST['enableComments']) ? 1 : 0;
-               if (isset($_POST['firstName'])) $this->firstName = StringUtil::trim($_POST['firstName']);
-               if (isset($_POST['lastName'])) $this->lastName = StringUtil::trim($_POST['lastName']);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function save() {
-               parent::save();
-               
-               $this->objectAction = new PersonAction([], 'create', [
-                       'data' => array_merge($this->additionalFields, [
-                               'enableComments' => $this->enableComments,
-                               'firstName' => $this->firstName,
-                               'lastName' => $this->lastName
-                       ])
-               ]);
-               $returnValues = $this->objectAction->executeAction();
-               
-               $this->saved();
-               
-               // reset values
-               $this->enableComments = 1;
-               $this->firstName = '';
-               $this->lastName = '';
-               
-               // show success message
-               WCF::getTPL()->assign([
-                       'success' => true,
-                       'objectEditLink' => LinkHandler::getInstance()->getControllerLink(PersonEditForm::class, ['id' => $returnValues['returnValues']->personID]),
-               ]);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function validate() {
-               parent::validate();
-               
-               // validate first name
-               if (empty($this->firstName)) {
-                       throw new UserInputException('firstName');
-               }
-               if (mb_strlen($this->firstName) > 255) {
-                       throw new UserInputException('firstName', 'tooLong');
-               }
-               
-               // validate last name
-               if (empty($this->lastName)) {
-                       throw new UserInputException('lastName');
-               }
-               if (mb_strlen($this->lastName) > 255) {
-                       throw new UserInputException('lastName', 'tooLong');
-               }
-       }
+class PersonAddForm extends AbstractFormBuilderForm
+{
+    /**
+     * @inheritDoc
+     */
+    public $activeMenuItem = 'wcf.acp.menu.link.person.add';
+
+    /**
+     * @inheritDoc
+     */
+    public $formAction = 'create';
+
+    /**
+     * @inheritDoc
+     */
+    public $neededPermissions = ['admin.content.canManagePeople'];
+
+    /**
+     * @inheritDoc
+     */
+    public $objectActionClass = PersonAction::class;
+
+    /**
+     * @inheritDoc
+     */
+    public $objectEditLinkController = PersonEditForm::class;
+
+    /**
+     * @inheritDoc
+     */
+    public function createForm()
+    {
+        parent::createForm();
+
+        $this->form->appendChild(
+            FormContainer::create('data')
+                ->label('wcf.global.form.data')
+                ->appendChildren([
+                    TextFormField::create('firstName')
+                        ->label('wcf.person.firstName')
+                        ->required()
+                        ->autoFocus()
+                        ->maximumLength(255),
+
+                    TextFormField::create('lastName')
+                        ->label('wcf.person.lastName')
+                        ->required()
+                        ->maximumLength(255),
+
+                    BooleanFormField::create('enableComments')
+                        ->label('wcf.person.enableComments')
+                        ->description('wcf.person.enableComments.description')
+                        ->value(true),
+                ])
+        );
+    }
 }
index 1cb63335f2b1689c35775733b5448eaa573c8ddc..47c2b7650089156233252d2fe666353f7d5bdf1c 100644 (file)
@@ -1,93 +1,43 @@
 <?php
+
 namespace wcf\acp\form;
+
 use wcf\data\person\Person;
-use wcf\data\person\PersonAction;
-use wcf\form\AbstractForm;
 use wcf\system\exception\IllegalLinkException;
-use wcf\system\WCF;
 
 /**
  * Shows the form to edit an existing person.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Acp\Form
+ *
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Acp\Form
  */
-class PersonEditForm extends PersonAddForm {
-       /**
-        * @inheritDoc
-        */
-       public $activeMenuItem = 'wcf.acp.menu.link.person';
-       
-       /**
-        * edited person object
-        * @var Person
-        */
-       public $person = null;
-       
-       /**
-        * id of the edited person
-        * @var integer
-        */
-       public $personID = 0;
-       
-       /**
-        * @inheritDoc
-        */
-       public function assignVariables() {
-               parent::assignVariables();
-               
-               WCF::getTPL()->assign([
-                       'action' => 'edit',
-                       'person' => $this->person
-               ]);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function readData() {
-               parent::readData();
-               
-               if (empty($_POST)) {
-                       $this->enableComments = $this->person->enableComments;
-                       $this->firstName = $this->person->firstName;
-                       $this->lastName = $this->person->lastName;
-               }
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function readParameters() {
-               parent::readParameters();
-               
-               if (isset($_REQUEST['id'])) $this->personID = intval($_REQUEST['id']);
-               $this->person = new Person($this->personID);
-               if (!$this->person->personID) {
-                       throw new IllegalLinkException();
-               }
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function save() {
-               AbstractForm::save();
-               
-               $this->objectAction = new PersonAction([$this->person], 'update', [
-                       'data' => array_merge($this->additionalFields, [
-                               'enableComments' => $this->enableComments,
-                               'firstName' => $this->firstName,
-                               'lastName' => $this->lastName
-                       ])
-               ]);
-               $this->objectAction->executeAction();
-               
-               $this->saved();
-               
-               // show success message
-               WCF::getTPL()->assign('success', true);
-       }
+class PersonEditForm extends PersonAddForm
+{
+    /**
+     * @inheritDoc
+     */
+    public $activeMenuItem = 'wcf.acp.menu.link.person';
+
+    /**
+     * @inheritDoc
+     */
+    public $formAction = 'update';
+
+    /**
+     * @inheritDoc
+     */
+    public function readParameters()
+    {
+        parent::readParameters();
+
+        if (isset($_REQUEST['id'])) {
+            $this->formObject = new Person($_REQUEST['id']);
+
+            if (!$this->formObject->getObjectID()) {
+                throw new IllegalLinkException();
+            }
+        }
+    }
 }
index a16f28dd5e90e599528c0a0f3e1c9c6a628faa03..9d57855b7eb116875efb5950063536c381bf7430 100644 (file)
@@ -1,34 +1,37 @@
 <?php
+
 namespace wcf\acp\page;
+
 use wcf\data\person\PersonList;
 use wcf\page\SortablePage;
 
 /**
  * Shows the list of people.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Acp\Page
+ *
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Acp\Page
  */
-class PersonListPage extends SortablePage {
-       /**
-        * @inheritDoc
-        */
-       public $activeMenuItem = 'wcf.acp.menu.link.person.list';
-       
-       /**
-        * @inheritDoc
-        */
-       public $neededPermissions = ['admin.content.canManagePeople'];
-       
-       /**
-        * @inheritDoc
-        */
-       public $objectListClassName = PersonList::class;
-       
-       /**
-        * @inheritDoc
-        */
-       public $validSortFields = ['personID', 'firstName', 'lastName'];
+class PersonListPage extends SortablePage
+{
+    /**
+     * @inheritDoc
+     */
+    public $activeMenuItem = 'wcf.acp.menu.link.person.list';
+
+    /**
+     * @inheritDoc
+     */
+    public $neededPermissions = ['admin.content.canManagePeople'];
+
+    /**
+     * @inheritDoc
+     */
+    public $objectListClassName = PersonList::class;
+
+    /**
+     * @inheritDoc
+     */
+    public $validSortFields = ['personID', 'firstName', 'lastName'];
 }
index eaeb108565560de99afa78b6eba7402b3777bce7..d5c6d16601a85b7ca35d4f05f0b96a1f8575af32 100644 (file)
@@ -1,48 +1,52 @@
 <?php
+
 namespace wcf\data\person;
+
 use wcf\data\DatabaseObject;
-use wcf\data\ILinkableObject;
-use wcf\system\request\IRouteController;
+use wcf\data\ITitledLinkObject;
+use wcf\page\PersonPage;
 use wcf\system\request\LinkHandler;
 
 /**
  * Represents a person.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Data\Person
- * 
- * @property-read      integer         $personID               unique id of the person
- * @property-read      string          $firstName              first name of the person
- * @property-read      string          $lastName               last name of the person
- * @property-read      integer         $comments               number of comments on the person
- * @property-read      integer         $enableComments         is `1` if comments are enabled for the person, otherwise `0`
+ *
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Data\Person
+ *
+ * @property-read   integer     $personID   unique id of the person
+ * @property-read   string      $firstName  first name of the person
+ * @property-read   string      $lastName   last name of the person
+ * @property-read   int         $enableComments     is `1` if comments are enabled for the person, otherwise `0`
  */
-class Person extends DatabaseObject implements ILinkableObject, IRouteController {
-       /**
-        * Returns the first and last name of the person if a person object is treated as a string.
-        * 
-        * @return      string
-        */
-       public function __toString() {
-               return $this->getTitle();
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function getLink() {
-               return LinkHandler::getInstance()->getLink('Person', [
-                       'forceFrontend' => true,
-                       'object' => $this
-               ]);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function getTitle() {
-               return $this->firstName . ' ' . $this->lastName;
-       }
+class Person extends DatabaseObject implements ITitledLinkObject
+{
+    /**
+     * Returns the first and last name of the person if a person object is treated as a string.
+     *
+     * @return  string
+     */
+    public function __toString()
+    {
+        return $this->getTitle();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function getLink()
+    {
+        return LinkHandler::getInstance()->getControllerLink(PersonPage::class, [
+            'object' => $this,
+        ]);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function getTitle()
+    {
+        return $this->firstName . ' ' . $this->lastName;
+    }
 }
index d76b926758de1e05a360206fc4efefd752602148..3f34655613dc06c9cf574eaa630b9b636f54648a 100644 (file)
@@ -1,27 +1,30 @@
 <?php
+
 namespace wcf\data\person;
+
 use wcf\data\AbstractDatabaseObjectAction;
 
 /**
  * Executes person-related actions.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Data\Person
  *
- * @method     Person          create()
- * @method     PersonEditor[]  getObjects()
- * @method     PersonEditor    getSingleObject()
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Data\Person
+ *
+ * @method  Person      create()
+ * @method  PersonEditor[]  getObjects()
+ * @method  PersonEditor    getSingleObject()
  */
-class PersonAction extends AbstractDatabaseObjectAction {
-       /**
-        * @inheritDoc
-        */
-       protected $permissionsDelete = ['admin.content.canManagePeople'];
-       
-       /**
-        * @inheritDoc
-        */
-       protected $requireACP = ['delete'];
+class PersonAction extends AbstractDatabaseObjectAction
+{
+    /**
+     * @inheritDoc
+     */
+    protected $permissionsDelete = ['admin.content.canManagePeople'];
+
+    /**
+     * @inheritDoc
+     */
+    protected $requireACP = ['delete'];
 }
index 3890bc1009c8b88fb087f1bb31bf063436f48198..b8d5a3ce73cbcaccf6eb04a7e87258fd7dadce3d 100644 (file)
@@ -1,22 +1,25 @@
 <?php
+
 namespace wcf\data\person;
+
 use wcf\data\DatabaseObjectEditor;
 
 /**
  * Provides functions to edit people.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Data\Person
- * 
- * @method static      Person  create(array $parameters = [])
- * @method             Person  getDecoratedObject()
- * @mixin              Person
+ *
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Data\Person
+ *
+ * @method static   Person  create(array $parameters = [])
+ * @method      Person  getDecoratedObject()
+ * @mixin       Person
  */
-class PersonEditor extends DatabaseObjectEditor {
-       /**
-        * @inheritDoc
-        */
-       protected static $baseClass = Person::class;
+class PersonEditor extends DatabaseObjectEditor
+{
+    /**
+     * @inheritDoc
+     */
+    protected static $baseClass = Person::class;
 }
index bedf543c5f51e666dec76f3937908e93e2e8a384..4e16a0d0e2ae4bcdcb4e41d166b3adc731a74ede 100644 (file)
@@ -1,18 +1,22 @@
 <?php
+
 namespace wcf\data\person;
+
 use wcf\data\DatabaseObjectList;
 
 /**
  * Represents a list of people.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Data\Person
- * 
- * @method     Person          current()
- * @method     Person[]        getObjects()
- * @method     Person|null     search($objectID)
- * @property   Person[]        $objects
+ *
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Data\Person
+ *
+ * @method  Person      current()
+ * @method  Person[]    getObjects()
+ * @method  Person|null search($objectID)
+ * @property    Person[]    $objects
  */
-class PersonList extends DatabaseObjectList {}
+class PersonList extends DatabaseObjectList
+{
+}
index 839b3e2a035f8ac8cb4517159fed7eb39f448b14..5fbacd4412ad607ff29998c7160b3d30028d74fd 100644 (file)
@@ -1,28 +1,31 @@
 <?php
+
 namespace wcf\page;
+
 use wcf\data\person\PersonList;
 
 /**
  * Shows the list of people.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Page
+ *
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Page
  */
-class PersonListPage extends SortablePage {
-       /**
-        * @inheritDoc
-        */
-       public $defaultSortField = 'lastName';
-       
-       /**
-        * @inheritDoc
-        */
-       public $objectListClassName = PersonList::class;
-       
-       /**
-        * @inheritDoc
-        */
-       public $validSortFields = ['personID', 'firstName', 'lastName'];
+class PersonListPage extends SortablePage
+{
+    /**
+     * @inheritDoc
+     */
+    public $defaultSortField = 'lastName';
+
+    /**
+     * @inheritDoc
+     */
+    public $objectListClassName = PersonList::class;
+
+    /**
+     * @inheritDoc
+     */
+    public $validSortFields = ['personID', 'firstName', 'lastName'];
 }
index d68c0d730992fc59e3aa380b427b99a3aacf02ab..24be70a83b3d55ecbd2e124fa0f88a8dce40a868 100644 (file)
@@ -1,5 +1,7 @@
 <?php
+
 namespace wcf\page;
+
 use wcf\data\person\Person;
 use wcf\system\comment\CommentHandler;
 use wcf\system\comment\manager\PersonCommentManager;
@@ -8,82 +10,96 @@ use wcf\system\WCF;
 
 /**
  * Shows the details of a certain person.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\Page
+ *
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Page
  */
-class PersonPage extends AbstractPage {
-       /**
-        * list of comments
-        * @var StructuredCommentList
-        */
-       public $commentList;
-       
-       /**
-        * person comment manager object
-        * @var PersonCommentManager
-        */
-       public $commentManager;
-       
-       /**
-        * id of the person comment object type
-        * @var integer
-        */
-       public $commentObjectTypeID = 0;
-       
-       /**
-        * shown person
-        * @var Person
-        */
-       public $person;
-       
-       /**
-        * id of the shown person
-        * @var integer
-        */
-       public $personID = 0;
-       
-       /**
-        * @inheritDoc
-        */
-       public function assignVariables() {
-               parent::assignVariables();
-               
-               WCF::getTPL()->assign([
-                       'commentCanAdd' => WCF::getSession()->getPermission('user.person.canAddComment'),
-                       'commentList' => $this->commentList,
-                       'commentObjectTypeID' => $this->commentObjectTypeID,
-                       'lastCommentTime' => $this->commentList ? $this->commentList->getMinCommentTime() : 0,
-                       'likeData' => (MODULE_LIKE && $this->commentList) ? $this->commentList->getLikeData() : [],
-                       'person' => $this->person
-               ]);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function readData() {
-               parent::readData();
-               
-               if ($this->person->enableComments) {
-                       $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.person.personComment');
-                       $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor();
-                       $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->person->personID);
-               }
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function readParameters() {
-               parent::readParameters();
-               
-               if (isset($_REQUEST['id'])) $this->personID = intval($_REQUEST['id']);
-               $this->person = new Person($this->personID);
-               if (!$this->person->personID) {
-                       throw new IllegalLinkException();
-               }
-       }
+class PersonPage extends AbstractPage
+{
+    /**
+     * list of comments
+     * @var StructuredCommentList
+     */
+    public $commentList;
+
+    /**
+     * person comment manager object
+     * @var PersonCommentManager
+     */
+    public $commentManager;
+
+    /**
+     * id of the person comment object type
+     * @var integer
+     */
+    public $commentObjectTypeID = 0;
+
+    /**
+     * shown person
+     * @var Person
+     */
+    public $person;
+
+    /**
+     * id of the shown person
+     * @var integer
+     */
+    public $personID = 0;
+
+    /**
+     * @inheritDoc
+     */
+    public function assignVariables()
+    {
+        parent::assignVariables();
+
+        WCF::getTPL()->assign([
+            'commentCanAdd' => WCF::getSession()->getPermission('user.person.canAddComment'),
+            'commentList' => $this->commentList,
+            'commentObjectTypeID' => $this->commentObjectTypeID,
+            'lastCommentTime' => $this->commentList ? $this->commentList->getMinCommentTime() : 0,
+            'likeData' => MODULE_LIKE && $this->commentList ? $this->commentList->getLikeData() : [],
+            'person' => $this->person,
+        ]);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function readData()
+    {
+        parent::readData();
+
+        if ($this->person->enableComments) {
+            $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID(
+                'com.woltlab.wcf.person.personComment'
+            );
+            $this->commentManager = CommentHandler::getInstance()->getObjectType(
+                $this->commentObjectTypeID
+            )->getProcessor();
+            $this->commentList = CommentHandler::getInstance()->getCommentList(
+                $this->commentManager,
+                $this->commentObjectTypeID,
+                $this->person->personID
+            );
+        }
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function readParameters()
+    {
+        parent::readParameters();
+
+        if (isset($_REQUEST['id'])) {
+            $this->personID = \intval($_REQUEST['id']);
+        }
+        $this->person = new Person($this->personID);
+        if (!$this->person->personID) {
+            throw new IllegalLinkException();
+        }
+    }
 }
index db63fdeeef615e487be983d28ceb63c23c753cb9..1f9a67f8d8a6ac715825b66cd17386ef72d7acaa 100644 (file)
@@ -1,24 +1,26 @@
 <?php
+
 namespace wcf\system\cache\runtime;
+
 use wcf\data\person\Person;
 use wcf\data\person\PersonList;
 
 /**
  * Runtime cache implementation for people.
  *
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\System\Cache\Runtime
- * @since      3.0
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\Cache\Runtime
  *
- * @method     Person[]        getCachedObjects()
- * @method     Person          getObject($objectID)
- * @method     Person[]        getObjects(array $objectIDs)
+ * @method  Person[]    getCachedObjects()
+ * @method  Person      getObject($objectID)
+ * @method  Person[]    getObjects(array $objectIDs)
  */
-class PersonRuntimeCache extends AbstractRuntimeCache {
-       /**
-        * @inheritDoc
-        */
-       protected $listClassName = PersonList::class;
+class PersonRuntimeCache extends AbstractRuntimeCache
+{
+    /**
+     * @inheritDoc
+     */
+    protected $listClassName = PersonList::class;
 }
index 0b35af2302790b60184cd42e2298b15041451e3d..6cbad9d9efb8508049f3696f5c3bbba6d438850b 100644 (file)
@@ -1,5 +1,7 @@
 <?php
+
 namespace wcf\system\comment\manager;
+
 use wcf\data\person\Person;
 use wcf\data\person\PersonEditor;
 use wcf\system\cache\runtime\PersonRuntimeCache;
@@ -8,76 +10,81 @@ use wcf\system\WCF;
 /**
  * Comment manager implementation for people.
  *
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\System\Comment\Manager
+ * @author  Matthias Schmidt
+ * @copyright   2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\Comment\Manager
  */
-class PersonCommentManager extends AbstractCommentManager {
-       /**
-        * @inheritDoc
-        */
-       protected $permissionAdd = 'user.person.canAddComment';
-       
-       /**
-        * @inheritDoc
-        */
-       protected $permissionAddWithoutModeration = 'user.person.canAddCommentWithoutModeration';
-       
-       /**
-        * @inheritDoc
-        */
-       protected $permissionCanModerate = 'mod.person.canModerateComment';
-       
-       /**
-        * @inheritDoc
-        */
-       protected $permissionDelete = 'user.person.canDeleteComment';
-       
-       /**
-        * @inheritDoc
-        */
-       protected $permissionEdit = 'user.person.canEditComment';
-       
-       /**
-        * @inheritDoc
-        */
-       protected $permissionModDelete = 'mod.person.canDeleteComment';
-       
-       /**
-        * @inheritDoc
-        */
-       protected $permissionModEdit = 'mod.person.canEditComment';
-       
-       /**
-        * @inheritDoc
-        */
-       public function getLink($objectTypeID, $objectID) {
-               return PersonRuntimeCache::getInstance()->getObject($objectID)->getLink();
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function isAccessible($objectID, $validateWritePermission = false) {
-               return PersonRuntimeCache::getInstance()->getObject($objectID) !== null;
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function getTitle($objectTypeID, $objectID, $isResponse = false) {
-               if ($isResponse) {
-                       return WCF::getLanguage()->get('wcf.person.commentResponse');
-               }
-               
-               return WCF::getLanguage()->getDynamicVariable('wcf.person.comment');
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function updateCounter($objectID, $value) {
-               (new PersonEditor(new Person($objectID)))->updateCounters(['comments' => $value]);
-       }
+class PersonCommentManager extends AbstractCommentManager
+{
+    /**
+     * @inheritDoc
+     */
+    protected $permissionAdd = 'user.person.canAddComment';
+
+    /**
+     * @inheritDoc
+     */
+    protected $permissionAddWithoutModeration = 'user.person.canAddCommentWithoutModeration';
+
+    /**
+     * @inheritDoc
+     */
+    protected $permissionCanModerate = 'mod.person.canModerateComment';
+
+    /**
+     * @inheritDoc
+     */
+    protected $permissionDelete = 'user.person.canDeleteComment';
+
+    /**
+     * @inheritDoc
+     */
+    protected $permissionEdit = 'user.person.canEditComment';
+
+    /**
+     * @inheritDoc
+     */
+    protected $permissionModDelete = 'mod.person.canDeleteComment';
+
+    /**
+     * @inheritDoc
+     */
+    protected $permissionModEdit = 'mod.person.canEditComment';
+
+    /**
+     * @inheritDoc
+     */
+    public function getLink($objectTypeID, $objectID)
+    {
+        return PersonRuntimeCache::getInstance()->getObject($objectID)->getLink();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function isAccessible($objectID, $validateWritePermission = false)
+    {
+        return PersonRuntimeCache::getInstance()->getObject($objectID) !== null;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function getTitle($objectTypeID, $objectID, $isResponse = false)
+    {
+        if ($isResponse) {
+            return WCF::getLanguage()->get('wcf.person.commentResponse');
+        }
+
+        return WCF::getLanguage()->getDynamicVariable('wcf.person.comment');
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function updateCounter($objectID, $value)
+    {
+        (new PersonEditor(new Person($objectID)))->updateCounters(['comments' => $value]);
+    }
 }
index 58819b63f0b34ce3044b7a252c9d067c23ea2d28..353900bba59d04953a7acf00e97d0228b6ca595e 100644 (file)
@@ -1,5 +1,7 @@
 <?php
+
 namespace wcf\system\page\handler;
+
 use wcf\data\page\Page;
 use wcf\data\person\PersonList;
 use wcf\data\user\online\UserOnline;
@@ -9,88 +11,94 @@ use wcf\system\WCF;
 
 /**
  * Page handler implementation for person page.
- * 
- * @author     Matthias Schmidt
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    WoltLabSuite\Core\System\Page\Handler
+ *
+ * @author  Matthias Schmidt
+ * @copyright   2001-2019 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\Page\Handler
  */
-class PersonPageHandler extends AbstractLookupPageHandler implements IOnlineLocationPageHandler {
-       use TOnlineLocationPageHandler;
-       
-       /**
-        * @inheritDoc
-        */
-       public function getLink($objectID) {
-               return PersonRuntimeCache::getInstance()->getObject($objectID)->getLink();
-       }
-       
-       /**
-        * Returns the textual description if a user is currently online viewing this page.
-        *
-        * @see IOnlineLocationPageHandler::getOnlineLocation()
-        *
-        * @param       Page            $page           visited page
-        * @param       UserOnline      $user           user online object with request data
-        * @return      string
-        */
-       public function getOnlineLocation(Page $page, UserOnline $user) {
-               if ($user->pageObjectID === null) {
-                       return '';
-               }
-               
-               $person = PersonRuntimeCache::getInstance()->getObject($user->pageObjectID);
-               if ($person === null) {
-                       return '';
-               }
-               
-               return WCF::getLanguage()->getDynamicVariable('wcf.page.onlineLocation.'.$page->identifier, ['person' => $person]);
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function isValid($objectID = null) {
-               return PersonRuntimeCache::getInstance()->getObject($objectID) !== null;
-       }
-       
-       /**
-        * @inheritDoc
-        */
-       public function lookup($searchString) {
-               $conditionBuilder = new PreparedStatementConditionBuilder(false, 'OR');
-               $conditionBuilder->add('person.firstName LIKE ?', ['%' . $searchString . '%']);
-               $conditionBuilder->add('person.lastName LIKE ?', ['%' . $searchString . '%']);
-               
-               $personList = new PersonList();
-               $personList->getConditionBuilder()->add($conditionBuilder, $conditionBuilder->getParameters());
-               $personList->readObjects();
-               
-               $results = [];
-               foreach ($personList as $person) {
-                       $results[] = [
-                               'image' => 'fa-user',
-                               'link' => $person->getLink(),
-                               'objectID' => $person->personID,
-                               'title' => $person->getTitle()
-                       ];
-               }
-               
-               return $results;
-       }
-       
-       /**
-        * Prepares fetching all necessary data for the textual description if a user is currently online
-        * viewing this page.
-        * 
-        * @see IOnlineLocationPageHandler::prepareOnlineLocation()
-        *
-        * @param       Page            $page           visited page
-        * @param       UserOnline      $user           user online object with request data
-        */
-       public function prepareOnlineLocation(/** @noinspection PhpUnusedParameterInspection */Page $page, UserOnline $user) {
-               if ($user->pageObjectID !== null) {
-                       PersonRuntimeCache::getInstance()->cacheObjectID($user->pageObjectID);
-               }
-       }
+class PersonPageHandler extends AbstractLookupPageHandler implements IOnlineLocationPageHandler
+{
+    use TOnlineLocationPageHandler;
+
+    /**
+     * @inheritDoc
+     */
+    public function getLink($objectID)
+    {
+        return PersonRuntimeCache::getInstance()->getObject($objectID)->getLink();
+    }
+
+    /**
+     * Returns the textual description if a user is currently online viewing this page.
+     *
+     * @see IOnlineLocationPageHandler::getOnlineLocation()
+     *
+     * @param   Page        $page       visited page
+     * @param   UserOnline  $user       user online object with request data
+     * @return  string
+     */
+    public function getOnlineLocation(Page $page, UserOnline $user)
+    {
+        if ($user->pageObjectID === null) {
+            return '';
+        }
+
+        $person = PersonRuntimeCache::getInstance()->getObject($user->pageObjectID);
+        if ($person === null) {
+            return '';
+        }
+
+        return WCF::getLanguage()->getDynamicVariable('wcf.page.onlineLocation.' . $page->identifier, ['person' => $person]);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function isValid($objectID = null)
+    {
+        return PersonRuntimeCache::getInstance()->getObject($objectID) !== null;
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public function lookup($searchString)
+    {
+        $conditionBuilder = new PreparedStatementConditionBuilder(false, 'OR');
+        $conditionBuilder->add('person.firstName LIKE ?', ['%' . $searchString . '%']);
+        $conditionBuilder->add('person.lastName LIKE ?', ['%' . $searchString . '%']);
+
+        $personList = new PersonList();
+        $personList->getConditionBuilder()->add($conditionBuilder, $conditionBuilder->getParameters());
+        $personList->readObjects();
+
+        $results = [];
+        foreach ($personList as $person) {
+            $results[] = [
+                'image' => 'fa-user',
+                'link' => $person->getLink(),
+                'objectID' => $person->personID,
+                'title' => $person->getTitle(),
+            ];
+        }
+
+        return $results;
+    }
+
+    /**
+     * Prepares fetching all necessary data for the textual description if a user is currently online
+     * viewing this page.
+     *
+     * @see IOnlineLocationPageHandler::prepareOnlineLocation()
+     *
+     * @param   Page        $page       visited page
+     * @param   UserOnline  $user       user online object with request data
+     */
+    public function prepareOnlineLocation(Page $page, UserOnline $user)
+    {
+        if ($user->pageObjectID !== null) {
+            PersonRuntimeCache::getInstance()->cacheObjectID($user->pageObjectID);
+        }
+    }
 }
diff --git a/snippets/tutorial/tutorial-series/part-3/install.sql b/snippets/tutorial/tutorial-series/part-3/install.sql
deleted file mode 100644 (file)
index af5dfcb..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-DROP TABLE IF EXISTS wcf1_person;
-CREATE TABLE wcf1_person (
-       personID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-       firstName VARCHAR(255) NOT NULL,
-       lastName VARCHAR(255) NOT NULL,
-       comments SMALLINT(5) NOT NULL DEFAULT 0,
-       enableComments TINYINT(1) NOT NULL DEFAULT 1
-);
index 1cf1af38b9b218a63c1c1c2ad1ed2863359c882a..506326d4372f7acee2e6549bfa98926c5f700e7c 100644 (file)
@@ -1,15 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/language.xsd" languagecode="de">
+<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/5.4/language.xsd" languagecode="de">
        <category name="wcf.acp.group">
                <item name="wcf.acp.group.option.admin.content.canManagePeople"><![CDATA[Kann Personen verwalten]]></item>
-               
                <item name="wcf.acp.group.option.category.mod.person"><![CDATA[Personen]]></item>
                <item name="wcf.acp.group.option.category.user.person"><![CDATA[Personen]]></item>
-               
                <item name="wcf.acp.group.option.mod.person.canDeleteComment"><![CDATA[Kann Kommentare löschen]]></item>
                <item name="wcf.acp.group.option.mod.person.canEditComment"><![CDATA[Kann Kommentare bearbeiten]]></item>
                <item name="wcf.acp.group.option.mod.person.canModerateComment"><![CDATA[Kann Kommentare moderieren]]></item>
-               
                <item name="wcf.acp.group.option.user.person.canAddComment"><![CDATA[Kann Kommentare erstellen]]></item>
                <item name="wcf.acp.group.option.user.person.canDeleteComment"><![CDATA[Kann eigene Kommentare löschen]]></item>
                <item name="wcf.acp.group.option.user.person.canEditComment"><![CDATA[Kann eigene Kommentare bearbeiten]]></item>
        
        <category name="wcf.acp.person">
                <item name="wcf.acp.person.add"><![CDATA[Person hinzufügen]]></item>
-               <item name="wcf.acp.person.delete.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} die Person <span class="confirmationObject">{$person}</span> wirklich löschen?]]></item>
                <item name="wcf.acp.person.edit"><![CDATA[Person bearbeiten]]></item>
-               <item name="wcf.acp.person.firstName.error.tooLong"><![CDATA[Der Vorname darf nicht länger als 255 Zeichen sein.]]></item>
-               <item name="wcf.acp.person.lastName.error.tooLong"><![CDATA[Der Nachname darf nicht länger als 255 Zeichen sein.]]></item>
                <item name="wcf.acp.person.list"><![CDATA[Personen]]></item>
        </category>
        
        <category name="wcf.page">
-               <item name="wcf.page.onlineLocation.com.woltlab.wcf.people.Person"><![CDATA[Person <a href="{$person->getLink()}">{$person}</a>]]></item>
+               <item name="wcf.page.onlineLocation.com.woltlab.wcf.people.Person"><![CDATA[Person {anchor object=$person}]]></item>
        </category>
        
        <category name="wcf.person">
index a7155b5ff5f0b3c261e62ba715845b70f0bfbc08..e9f5dd6f04fbbd0a5a54adb0c72a778648e1acd9 100644 (file)
@@ -1,20 +1,17 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/language.xsd" languagecode="en">
+<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/5.4/language.xsd" languagecode="en">
        <category name="wcf.acp.group">
                <item name="wcf.acp.group.option.admin.content.canManagePeople"><![CDATA[Can manage people]]></item>
-               
                <item name="wcf.acp.group.option.category.mod.person"><![CDATA[People]]></item>
                <item name="wcf.acp.group.option.category.user.person"><![CDATA[People]]></item>
-               
                <item name="wcf.acp.group.option.mod.person.canDeleteComment"><![CDATA[Can delete comments]]></item>
                <item name="wcf.acp.group.option.mod.person.canEditComment"><![CDATA[Can edit comments]]></item>
                <item name="wcf.acp.group.option.mod.person.canModerateComment"><![CDATA[Can moderate comments]]></item>
-               
                <item name="wcf.acp.group.option.user.person.canAddComment"><![CDATA[Can create comments]]></item>
                <item name="wcf.acp.group.option.user.person.canDeleteComment"><![CDATA[Can delete their comments]]></item>
                <item name="wcf.acp.group.option.user.person.canEditComment"><![CDATA[Can edit their comments]]></item>
        </category>
-       
+
        <category name="wcf.acp.menu">
                <item name="wcf.acp.menu.link.person"><![CDATA[People]]></item>
                <item name="wcf.acp.menu.link.person.add"><![CDATA[Add Person]]></item>
        
        <category name="wcf.acp.person">
                <item name="wcf.acp.person.add"><![CDATA[Add Person]]></item>
-               <item name="wcf.acp.person.delete.confirmMessage"><![CDATA[Do you really want to delete the person <span class="confirmationObject">{$person}</span>?]]></item>
                <item name="wcf.acp.person.edit"><![CDATA[Edit Person]]></item>
-               <item name="wcf.acp.person.firstName.error.tooLong"><![CDATA[The first name must not be longer than 255 characters.]]></item>
-               <item name="wcf.acp.person.lastName.error.tooLong"><![CDATA[The last name must not be longer than 255 characters.]]></item>
                <item name="wcf.acp.person.list"><![CDATA[People]]></item>
        </category>
-       
+
        <category name="wcf.page">
-               <item name="wcf.page.onlineLocation.com.woltlab.wcf.people.Person"><![CDATA[Person <a href="{$person->getLink()}">{$person}</a>]]></item>
+               <item name="wcf.page.onlineLocation.com.woltlab.wcf.people.Person"><![CDATA[Person {anchor object=$person}]]></item>
        </category>
        
        <category name="wcf.person">
index 378a2973eff701f20d840e6081ae3626bfb16ead..bcf3e04d0c93db6f35dde00bea2a81200ac7a78a 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/menuItem.xsd">
+<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/5.4/menuItem.xsd">
        <import>
                <item identifier="com.woltlab.wcf.people.PersonList">
                        <menu>com.woltlab.wcf.MainMenu</menu>
index acce43145ad98a7087ac939405f427bd2ea15e00..d8c50e0a1e2e2772d4f077695656176925f8c014 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/objectType.xsd">
+<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/5.4/objectType.xsd">
        <import>
                <type>
                        <name>com.woltlab.wcf.person.personComment</name>
index 651911545443a2b45717bba0f4e4e79c4b0dd15d..ecc46fd173a228bec1beb1d71621af52bb217fcf 100644 (file)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<package name="com.woltlab.wcf.people" xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/package.xsd">
+<package name="com.woltlab.wcf.people" xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/5.4/package.xsd">
        <packageinformation>
                <packagename>WoltLab Suite Core Tutorial: People</packagename>
                <packagedescription>Adds a simple management system for people as part of a tutorial to create packages.</packagedescription>
-               <version>3.1.0</version>
-               <date>2018-03-30</date>
+               <version>5.4.0</version>
+               <date>2021-04-16</date>
        </packageinformation>
        
        <authorinformation>
        </authorinformation>
        
        <requiredpackages>
-               <requiredpackage minversion="3.1.0">com.woltlab.wcf</requiredpackage>
+               <requiredpackage minversion="5.4.0 Alpha 1">com.woltlab.wcf</requiredpackage>
        </requiredpackages>
        
        <excludedpackages>
-               <excludedpackage version="3.2.0 Alpha 1">com.woltlab.wcf</excludedpackage>
+               <excludedpackage version="6.0.0 Alpha 1">com.woltlab.wcf</excludedpackage>
        </excludedpackages>
        
-       <compatibility>
-               <api version="2018" />
-       </compatibility>
-       
        <instructions type="install">
                <instruction type="acpTemplate" />
                <instruction type="file" />
-               <instruction type="sql" />
+               <instruction type="database">acp/database/install_com.woltlab.wcf.people.php</instruction>
                <instruction type="template" />
                <instruction type="language" />
-               <instruction type="objectType" />
                
                <instruction type="acpMenu" />
                <instruction type="page" />
index 0e1ea88c16f46352ab94c257444a00627088f354..8270c57ff6d3e361f3ef66d0c9d8c9a80fd99ea5 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/page.xsd">
+<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/5.4/page.xsd">
        <import>
                <page identifier="com.woltlab.wcf.people.PersonList">
                        <pageType>system</pageType>
index 8ccd8f900f03a23eafac5fb893a29ecc2ce1f470..4f6bebd2a0cc6b08d2d5f170aff067f27f40805e 100644 (file)
@@ -8,19 +8,22 @@
        {if $commentList|count || $commentCanAdd}
                <section id="comments" class="section sectionContainerList">
                        <header class="sectionHeader">
-                               <h2 class="sectionTitle">{lang}wcf.person.comments{/lang}{if $person->comments} <span class="badge">{#$person->comments}</span>{/if}</h2>
+                               <h2 class="sectionTitle">
+                                       {lang}wcf.person.comments{/lang}
+                                       {if $person->comments}<span class="badge">{#$person->comments}</span>{/if}
+                               </h2>
                        </header>
                        
                        {include file='__commentJavaScript' commentContainerID='personCommentList'}
                        
                        <div class="personComments">
-                               <ul id="personCommentList" class="commentList containerList"
-                                       data-can-add="{if $commentCanAdd}true{else}false{/if}" 
-                                       data-object-id="{@$person->personID}"
-                                       data-object-type-id="{@$commentObjectTypeID}"
-                                       data-comments="{if $person->comments}{@$commentList->countObjects()}{else}0{/if}"
-                                       data-last-comment-time="{@$lastCommentTime}"
-                               >
+                               <ul id="personCommentList" class="commentList containerList" {*
+                                       *}data-can-add="{if $commentCanAdd}true{else}false{/if}" {*
+                                       *}data-object-id="{@$person->personID}" {*
+                                       *}data-object-type-id="{@$commentObjectTypeID}" {*
+                                       *}data-comments="{if $person->comments}{@$commentList->countObjects()}{else}0{/if}" {*
+                                       *}data-last-comment-time="{@$lastCommentTime}" {*
+                               *}>
                                        {include file='commentListAddComment' wysiwygSelector='personCommentListAddComment'}
                                        {include file='commentList'}
                                </ul>
index 044394af4080b7877d53a01d59a0a0d265b623a4..bb2e311efc5adf4def9a14049e129d2caf17aa73 100644 (file)
@@ -1,18 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/tornado/userGroupOption.xsd">
+<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/5.4/userGroupOption.xsd">
        <import>
                <categories>
                        <category name="mod.person">
                                <parent>mod</parent>
                        </category>
-                       
                        <category name="user.person">
                                <parent>user</parent>
                        </category>
                </categories>
                
                <options>
-                       <!-- admin.content -->
                        <option name="admin.content.canManagePeople">
                                <categoryname>admin.content</categoryname>
                                <optiontype>boolean</optiontype>
@@ -20,9 +18,6 @@
                                <admindefaultvalue>1</admindefaultvalue>
                                <usersonly>1</usersonly>
                        </option>
-                       <!-- /admin.content -->
-                       
-                       <!-- mod.person -->
                        <option name="mod.person.canModerateComment">
                                <categoryname>mod.person</categoryname>
                                <optiontype>boolean</optiontype>
@@ -44,9 +39,6 @@
                                <moddefaultvalue>1</moddefaultvalue>
                                <usersonly>1</usersonly>
                        </option>
-                       <!-- /mod.person -->
-                       
-                       <!-- user.person -->
                        <option name="user.person.canAddComment">
                                <categoryname>user.person</categoryname>
                                <optiontype>boolean</optiontype>
@@ -73,7 +65,6 @@
                                <admindefaultvalue>1</admindefaultvalue>
                                <usersonly>1</usersonly>
                        </option>
-                       <!-- /user.person -->
                </options>
        </import>
 </data>