From: Matthias Schmidt Date: Tue, 20 Apr 2021 07:50:36 +0000 (+0200) Subject: Add source code for fourth part of tutorial series X-Git-Tag: 5.6.final~266^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0f534b55ae41ec4bef5b83fc911302000ccbe53b;p=GitHub%2FWoltLab%2Fwoltlab.github.io.git Add source code for fourth part of tutorial series --- diff --git a/snippets/tutorial/tutorial-series/part-4/acpMenu.xml b/snippets/tutorial/tutorial-series/part-4/acpMenu.xml new file mode 100644 index 00000000..6ccf64fd --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/acpMenu.xml @@ -0,0 +1,19 @@ + + + + + wcf.acp.menu.link.content + + + wcf\acp\page\PersonListPage + wcf.acp.menu.link.person + admin.content.canManagePeople + + + wcf\acp\form\PersonAddForm + wcf.acp.menu.link.person.list + admin.content.canManagePeople + fa-plus + + + diff --git a/snippets/tutorial/tutorial-series/part-4/acptemplates/personAdd.tpl b/snippets/tutorial/tutorial-series/part-4/acptemplates/personAdd.tpl new file mode 100644 index 00000000..4cf2ec4a --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/acptemplates/personAdd.tpl @@ -0,0 +1,19 @@ +{include file='header' pageTitle='wcf.acp.person.'|concat:$action} + +
+
+

{lang}wcf.acp.person.{$action}{/lang}

+
+ + +
+ +{@$form->getHtml()} + +{include file='footer'} diff --git a/snippets/tutorial/tutorial-series/part-4/acptemplates/personList.tpl b/snippets/tutorial/tutorial-series/part-4/acptemplates/personList.tpl new file mode 100644 index 00000000..71766eff --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/acptemplates/personList.tpl @@ -0,0 +1,75 @@ +{include file='header' pageTitle='wcf.acp.person.list'} + +
+
+

{lang}wcf.acp.person.list{/lang}

+
+ + +
+ +{hascontent} +
+ {content}{pages print=true assign=pagesLinks controller="PersonList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}{/content} +
+{/hascontent} + +{if $objects|count} +
+ + + + + + + + {event name='columnHeads'} + + + + + {foreach from=$objects item=person} + + + + + + + {event name='columns'} + + {/foreach} + +
{lang}wcf.global.objectID{/lang}{lang}wcf.person.firstName{/lang}{lang}wcf.person.lastName{/lang}
+ + {objectAction action="delete" objectTitle=$person->getTitle()} + + {event name='rowButtons'} + {#$person->personID}{$person->firstName}{$person->lastName}
+
+ + +{else} +

{lang}wcf.global.noItems{/lang}

+{/if} + +{include file='footer'} diff --git a/snippets/tutorial/tutorial-series/part-4/files/acp/database/install_com.woltlab.wcf.people.php b/snippets/tutorial/tutorial-series/part-4/files/acp/database/install_com.woltlab.wcf.people.php new file mode 100644 index 00000000..895cbe52 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/acp/database/install_com.woltlab.wcf.people.php @@ -0,0 +1,21 @@ +columns([ + ObjectIdDatabaseTableColumn::create('personID'), + NotNullVarchar255DatabaseTableColumn::create('firstName'), + NotNullVarchar255DatabaseTableColumn::create('lastName'), + SmallintDatabaseTableColumn::create('comments') + ->length(5) + ->notNull() + ->defaultValue(0), + DefaultTrueBooleanDatabaseTableColumn::create('enableComments'), + ]), +]; diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/acp/form/PersonAddForm.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/acp/form/PersonAddForm.class.php new file mode 100644 index 00000000..565274d1 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/acp/form/PersonAddForm.class.php @@ -0,0 +1,75 @@ + + * @package WoltLabSuite\Core\Acp\Form + */ +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), + ]) + ); + } +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/acp/form/PersonEditForm.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/acp/form/PersonEditForm.class.php new file mode 100644 index 00000000..47c2b765 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/acp/form/PersonEditForm.class.php @@ -0,0 +1,43 @@ + + * @package WoltLabSuite\Core\Acp\Form + */ +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(); + } + } + } +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/acp/page/PersonListPage.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/acp/page/PersonListPage.class.php new file mode 100644 index 00000000..9d57855b --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/acp/page/PersonListPage.class.php @@ -0,0 +1,37 @@ + + * @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']; +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/Person.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/Person.class.php new file mode 100644 index 00000000..d5c6d166 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/Person.class.php @@ -0,0 +1,52 @@ + + * @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 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; + } +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/PersonAction.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/PersonAction.class.php new file mode 100644 index 00000000..3f346556 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/PersonAction.class.php @@ -0,0 +1,30 @@ + + * @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']; +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/PersonEditor.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/PersonEditor.class.php new file mode 100644 index 00000000..b8d5a3ce --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/PersonEditor.class.php @@ -0,0 +1,25 @@ + + * @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; +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/PersonList.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/PersonList.class.php new file mode 100644 index 00000000..4e16a0d0 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/data/person/PersonList.class.php @@ -0,0 +1,22 @@ + + * @package WoltLabSuite\Core\Data\Person + * + * @method Person current() + * @method Person[] getObjects() + * @method Person|null search($objectID) + * @property Person[] $objects + */ +class PersonList extends DatabaseObjectList +{ +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/page/PersonListPage.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/page/PersonListPage.class.php new file mode 100644 index 00000000..5fbacd44 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/page/PersonListPage.class.php @@ -0,0 +1,31 @@ + + * @package WoltLabSuite\Core\Page + */ +class PersonListPage extends SortablePage +{ + /** + * @inheritDoc + */ + public $defaultSortField = 'lastName'; + + /** + * @inheritDoc + */ + public $objectListClassName = PersonList::class; + + /** + * @inheritDoc + */ + public $validSortFields = ['personID', 'firstName', 'lastName']; +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/page/PersonPage.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/page/PersonPage.class.php new file mode 100644 index 00000000..24be70a8 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/page/PersonPage.class.php @@ -0,0 +1,105 @@ + + * @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(); + } + } +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/system/box/PersonListBoxController.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/system/box/PersonListBoxController.class.php new file mode 100644 index 00000000..95dc305c --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/system/box/PersonListBoxController.class.php @@ -0,0 +1,69 @@ + + * @package WoltLabSuite\Core\System\Box + */ +class PersonListBoxController extends AbstractDatabaseObjectListBoxController +{ + /** + * @inheritDoc + */ + protected $conditionDefinition = 'com.woltlab.wcf.box.personList.condition'; + + /** + * @inheritDoc + */ + public $defaultLimit = 5; + + /** + * @inheritDoc + */ + protected $sortFieldLanguageItemPrefix = 'wcf.person'; + + /** + * @inheritDoc + */ + protected static $supportedPositions = [ + 'sidebarLeft', + 'sidebarRight', + ]; + + /** + * @inheritDoc + */ + public $validSortFields = [ + 'firstName', + 'lastName', + 'comments', + ]; + + /** + * @inheritDoc + */ + public function getObjectList() + { + return new PersonList(); + } + + /** + * @inheritDoc + */ + protected function getTemplate() + { + return WCF::getTPL()->fetch('boxPersonList', 'wcf', [ + 'boxPersonList' => $this->objectList, + 'boxSortField' => $this->sortField, + 'boxPosition' => $this->box->position, + ], true); + } +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/system/cache/runtime/PersonRuntimeCache.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/system/cache/runtime/PersonRuntimeCache.class.php new file mode 100644 index 00000000..1f9a67f8 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/system/cache/runtime/PersonRuntimeCache.class.php @@ -0,0 +1,26 @@ + + * @package WoltLabSuite\Core\System\Cache\Runtime + * + * @method Person[] getCachedObjects() + * @method Person getObject($objectID) + * @method Person[] getObjects(array $objectIDs) + */ +class PersonRuntimeCache extends AbstractRuntimeCache +{ + /** + * @inheritDoc + */ + protected $listClassName = PersonList::class; +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/system/comment/manager/PersonCommentManager.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/system/comment/manager/PersonCommentManager.class.php new file mode 100644 index 00000000..6cbad9d9 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/system/comment/manager/PersonCommentManager.class.php @@ -0,0 +1,90 @@ + + * @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]); + } +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/system/condition/person/PersonFirstNameTextPropertyCondition.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/system/condition/person/PersonFirstNameTextPropertyCondition.class.php new file mode 100644 index 00000000..38ae076a --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/system/condition/person/PersonFirstNameTextPropertyCondition.class.php @@ -0,0 +1,47 @@ + + * @package WoltLabSuite\Core\System\Condition + */ +class PersonFirstNameTextPropertyCondition extends AbstractObjectTextPropertyCondition +{ + /** + * @inheritDoc + */ + protected $className = Person::class; + + /** + * @inheritDoc + */ + protected $description = 'wcf.person.condition.firstName.description'; + + /** + * @inheritDoc + */ + protected $fieldName = 'personFirstName'; + + /** + * @inheritDoc + */ + protected $label = 'wcf.person.firstName'; + + /** + * @inheritDoc + */ + protected $propertyName = 'firstName'; + + /** + * @inheritDoc + */ + protected $supportsMultipleValues = true; +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/system/condition/person/PersonLastNameTextPropertyCondition.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/system/condition/person/PersonLastNameTextPropertyCondition.class.php new file mode 100644 index 00000000..8c063144 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/system/condition/person/PersonLastNameTextPropertyCondition.class.php @@ -0,0 +1,47 @@ + + * @package WoltLabSuite\Core\System\Condition + */ +class PersonLastNameTextPropertyCondition extends AbstractObjectTextPropertyCondition +{ + /** + * @inheritDoc + */ + protected $className = Person::class; + + /** + * @inheritDoc + */ + protected $description = 'wcf.person.condition.lastName.description'; + + /** + * @inheritDoc + */ + protected $fieldName = 'personLastName'; + + /** + * @inheritDoc + */ + protected $label = 'wcf.person.lastName'; + + /** + * @inheritDoc + */ + protected $propertyName = 'lastName'; + + /** + * @inheritDoc + */ + protected $supportsMultipleValues = true; +} diff --git a/snippets/tutorial/tutorial-series/part-4/files/lib/system/page/handler/PersonPageHandler.class.php b/snippets/tutorial/tutorial-series/part-4/files/lib/system/page/handler/PersonPageHandler.class.php new file mode 100644 index 00000000..353900bb --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/files/lib/system/page/handler/PersonPageHandler.class.php @@ -0,0 +1,104 @@ + + * @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(Page $page, UserOnline $user) + { + if ($user->pageObjectID !== null) { + PersonRuntimeCache::getInstance()->cacheObjectID($user->pageObjectID); + } + } +} diff --git a/snippets/tutorial/tutorial-series/part-4/language/de.xml b/snippets/tutorial/tutorial-series/part-4/language/de.xml new file mode 100644 index 00000000..8921b4c6 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/language/de.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + comments 1='1 Kommentar' other='# Kommentare'}]]> + + + + + + + + + + + + diff --git a/snippets/tutorial/tutorial-series/part-4/language/en.xml b/snippets/tutorial/tutorial-series/part-4/language/en.xml new file mode 100644 index 00000000..3f968b3b --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/language/en.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + comments 1='1 Comment' other='# Comments'}]]> + + + + + + + + + + + + diff --git a/snippets/tutorial/tutorial-series/part-4/menuItem.xml b/snippets/tutorial/tutorial-series/part-4/menuItem.xml new file mode 100644 index 00000000..bcf3e04d --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/menuItem.xml @@ -0,0 +1,11 @@ + + + + + com.woltlab.wcf.MainMenu + Personen + People + com.woltlab.wcf.people.PersonList + + + diff --git a/snippets/tutorial/tutorial-series/part-4/objectType.xml b/snippets/tutorial/tutorial-series/part-4/objectType.xml new file mode 100644 index 00000000..7947a905 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/objectType.xml @@ -0,0 +1,25 @@ + + + + + com.woltlab.wcf.person.personComment + com.woltlab.wcf.comment.commentableContent + wcf\system\comment\manager\PersonCommentManager + + + com.woltlab.wcf.personList + com.woltlab.wcf.boxController + wcf\system\box\PersonListBoxController + + + com.woltlab.wcf.people.firstName + com.woltlab.wcf.box.personList.condition + wcf\system\condition\person\PersonFirstNameTextPropertyCondition + + + com.woltlab.wcf.people.lastName + com.woltlab.wcf.box.personList.condition + wcf\system\condition\person\PersonLastNameTextPropertyCondition + + + diff --git a/snippets/tutorial/tutorial-series/part-4/objectTypeDefinition.xml b/snippets/tutorial/tutorial-series/part-4/objectTypeDefinition.xml new file mode 100644 index 00000000..82414def --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/objectTypeDefinition.xml @@ -0,0 +1,9 @@ + + + + + com.woltlab.wcf.box.personList.condition + wcf\system\condition\IObjectListCondition + + + diff --git a/snippets/tutorial/tutorial-series/part-4/package.xml b/snippets/tutorial/tutorial-series/part-4/package.xml new file mode 100644 index 00000000..ecc46fd1 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/package.xml @@ -0,0 +1,35 @@ + + + + WoltLab Suite Core Tutorial: People + Adds a simple management system for people as part of a tutorial to create packages. + 5.4.0 + 2021-04-16 + + + + WoltLab GmbH + http://www.woltlab.com + + + + com.woltlab.wcf + + + + com.woltlab.wcf + + + + + + acp/database/install_com.woltlab.wcf.people.php + + + + + + + + + diff --git a/snippets/tutorial/tutorial-series/part-4/page.xml b/snippets/tutorial/tutorial-series/part-4/page.xml new file mode 100644 index 00000000..8270c57f --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/page.xml @@ -0,0 +1,27 @@ + + + + + system + wcf\page\PersonListPage + Personen-Liste + Person List + + + Personen + + + People + + + + system + wcf\page\PersonPage + wcf\system\page\handler\PersonPageHandler + Person + Person + 1 + com.woltlab.wcf.people.PersonList + + + diff --git a/snippets/tutorial/tutorial-series/part-4/templates/boxPersonList.tpl b/snippets/tutorial/tutorial-series/part-4/templates/boxPersonList.tpl new file mode 100644 index 00000000..146ce164 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/templates/boxPersonList.tpl @@ -0,0 +1,15 @@ + diff --git a/snippets/tutorial/tutorial-series/part-4/templates/person.tpl b/snippets/tutorial/tutorial-series/part-4/templates/person.tpl new file mode 100644 index 00000000..4f6bebd2 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/templates/person.tpl @@ -0,0 +1,45 @@ +{capture assign='pageTitle'}{$person} - {lang}wcf.person.list{/lang}{/capture} + +{capture assign='contentTitle'}{$person}{/capture} + +{include file='header'} + +{if $person->enableComments} + {if $commentList|count || $commentCanAdd} +
+
+

+ {lang}wcf.person.comments{/lang} + {if $person->comments}{#$person->comments}{/if} +

+
+ + {include file='__commentJavaScript' commentContainerID='personCommentList'} + +
+
    + {include file='commentListAddComment' wysiwygSelector='personCommentListAddComment'} + {include file='commentList'} +
+
+
+ {/if} +{/if} + + + +{include file='footer'} diff --git a/snippets/tutorial/tutorial-series/part-4/templates/personList.tpl b/snippets/tutorial/tutorial-series/part-4/templates/personList.tpl new file mode 100644 index 00000000..eb193f15 --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/templates/personList.tpl @@ -0,0 +1,109 @@ +{capture assign='contentTitle'}{lang}wcf.person.list{/lang} {#$items}{/capture} + +{capture assign='headContent'} + {if $pageNo < $pages} + + {/if} + {if $pageNo > 1} + + {/if} + +{/capture} + +{capture assign='sidebarRight'} +
+
+

{lang}wcf.global.sorting{/lang}

+ +
+
+
+
+ + +
+
+ +
+ +
+
+
+
+{/capture} + +{include file='header'} + +{hascontent} +
+ {content} + {pages print=true assign=pagesLinks controller='PersonList' link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"} + {/content} +
+{/hascontent} + +{if $items} +
+
    + {foreach from=$objects item=person} +
  1. +
    + + +
    +
    +

    {$person}

    +
    + + {hascontent} +
      + {content}{event name='personData'}{/content} +
    + {/hascontent} + + {hascontent} +
    + {content} + {if $person->enableComments} +
    {lang}wcf.person.comments{/lang}
    +
    {#$person->comments}
    + {/if} + + {event name='personStatistics'} + {/content} +
    + {/hascontent} +
    +
    +
  2. + {/foreach} +
+
+{else} +

{lang}wcf.global.noItems{/lang}

+{/if} + + + +{include file='footer'} diff --git a/snippets/tutorial/tutorial-series/part-4/userGroupOption.xml b/snippets/tutorial/tutorial-series/part-4/userGroupOption.xml new file mode 100644 index 00000000..bb2e311e --- /dev/null +++ b/snippets/tutorial/tutorial-series/part-4/userGroupOption.xml @@ -0,0 +1,70 @@ + + + + + + mod + + + user + + + + + + + + + + + + + + +