From: Matthias Schmidt Date: Mon, 3 May 2021 06:26:23 +0000 (+0200) Subject: Add missing filenames as code box titles X-Git-Tag: 5.6.final~248 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9f06c72b8dc394b798acd9ea2f09ea0860d44ca8;p=GitHub%2FWoltLab%2Fwoltlab.github.io.git Add missing filenames as code box titles --- diff --git a/docs/migration/wsc31/form-builder.md b/docs/migration/wsc31/form-builder.md index ab828b65..7eaacdcb 100644 --- a/docs/migration/wsc31/form-builder.md +++ b/docs/migration/wsc31/form-builder.md @@ -7,36 +7,48 @@ This form is the perfect first examples as it is very simple with only two text As a reminder, here are the two relevant PHP files and the relevant template file: -```php ---8<-- "migration/wsc-31/formBuilder/PersonAddForm_old.class.php" -``` - -```php ---8<-- "migration/wsc-31/formBuilder/PersonEditForm_old.class.php" -``` - -```php ---8<-- "migration/wsc-31/formBuilder/personAdd_old.tpl" -``` +{jinja{ codebox( +title="files/lib/acp/form/PersonAddForm.class.php", +language="php", +filepath="migration/wsc-31/formBuilder/PersonAddForm_old.class.php" +) }} + +{jinja{ codebox( +title="files/lib/acp/form/PersonEditForm.class.php", +language="php", +filepath="migration/wsc-31/formBuilder/PersonEditForm_old.class.php" +) }} + +{jinja{ codebox( +title="acptemplates/personAdd.tpl", +language="smarty", +filepath="migration/wsc-31/formBuilder/personAdd_old.tpl" +) }} Updating the template is easy as the complete form is replace by a single line of code: -```php ---8<-- "migration/wsc-31/formBuilder/personAdd_new.tpl" -``` +{jinja{ codebox( +title="acptemplates/personAdd.tpl", +language="smarty", +filepath="migration/wsc-31/formBuilder/personAdd_new.tpl" +) }} `PersonEditForm` also becomes much simpler: only the edited `Person` object must be read: -```php ---8<-- "migration/wsc-31/formBuilder/PersonEditForm_new.class.php" -``` +{jinja{ codebox( +title="files/lib/acp/form/PersonEditForm.class.php", +language="php", +filepath="migration/wsc-31/formBuilder/PersonEditForm_new.class.php" +) }} Most of the work is done in `PersonAddForm`: -```php ---8<-- "migration/wsc-31/formBuilder/PersonAddForm_new.class.php" -``` +{jinja{ codebox( +title="files/lib/acp/form/PersonAddForm.class.php", +language="php", +filepath="migration/wsc-31/formBuilder/PersonAddForm_new.class.php" +) }} But, as you can see, the number of lines almost decreased by half. All changes are due to extending `AbstractFormBuilderForm`: diff --git a/docs/tutorial/series/part_4.md b/docs/tutorial/series/part_4.md index 94ac35f1..3ecb3376 100644 --- a/docs/tutorial/series/part_4.md +++ b/docs/tutorial/series/part_4.md @@ -77,9 +77,13 @@ By extending `AbstractDatabaseObjectListBoxController`, we only have to provide 5. `getObjectList()` returns an instance of `DatabaseObjectList` that is used to read the listed objects. `getObjectList()` itself must not call `readObjects()`, as `AbstractDatabaseObjectListBoxController` takes care of calling the method after adding the conditions and setting the sort order. 6. `getTemplate()` returns the contents of the box relying on the `boxPersonList` template here: - ```smarty - --8<-- "tutorial/tutorial-series/part-4/templates/boxPersonList.tpl" - ``` + + {jinja{ codebox( + title="templates/boxPersonList.tpl", + language="smarty", + filepath="tutorial/tutorial-series/part-4/templates/boxPersonList.tpl" + ) }} + The template relies on a `.sidebarItemList` element, which is generally used for sidebar listings. (If different box positions were supported, we either have to generate different output by considering the value of `$boxPosition` in the template or by using different templates in `getTemplate()`.) One specific piece of code is the `$__boxPersonDescription` variable, which supports an optional description below the person's name relying on the optional language item `wcf.person.boxList.description.{$boxSortField}`. diff --git a/docs/tutorial/series/part_5.md b/docs/tutorial/series/part_5.md index 12f84425..5ce0d698 100644 --- a/docs/tutorial/series/part_5.md +++ b/docs/tutorial/series/part_5.md @@ -218,26 +218,34 @@ As we store the name of the user who create a new piece of information and store 1. If the user is renamed, the value of `username` stored with the person information has to be updated, which can be achieved by a simple event listener that only has to specify the name of relevant database table if `AbstractUserActionRenameListener` is extended: - ```php - --8<-- "tutorial//tutorial-series/part-5/files/lib/system/event/listener/PersonUserActionRenameListener.class.php" - ``` + {jinja{ codebox( + title="files/lib/system/event/listener/PersonUserActionRenameListener.class.php", + language="php", + filepath="tutorial/tutorial-series/part-5/files/lib/system/event/listener/PersonUserActionRenameListener.class.php" + ) }} 2. If users are merged, all pieces of information need to be assigned to the target user of the merging. Again, we only have to specify the name of relevant database table if `AbstractUserMergeListener` is extended: - ```php - --8<-- "tutorial/tutorial-series/part-5/files/lib/system/event/listener/PersonUserMergeListener.class.php" - ``` + {jinja{ codebox( + title="files/lib/system/event/listener/PersonUserMergeListener.class.php", + language="php", + filepath="tutorial/tutorial-series/part-5/files/lib/system/event/listener/PersonUserMergeListener.class.php" + ) }} 3. If the option to prune stored ip addresses after a certain period of time is enabled, we also have to prune them in the person information database table. Here we also only have to specify the name of the relevant database table and provide the mapping from the `ipAddress` column to the `time` column: - ```php - --8<-- "tutorial/tutorial-series/part-5/files/lib/system/event/listener/PersonPruneIpAddressesCronjobListener.class.php" - ``` -4. The ip addresses in the person information database table also have to be considered for the user data export which can also be done with minimal effort by providing the name of the relevant database table: - - ```php - --8<-- "tutorial/tutorial-series/part-5/files/lib/system/event/listener/PersonUserExportGdprListener.class.php" - ``` + {jinja{ codebox( + title="files/lib/system/event/listener/PersonPruneIpAddressesCronjobListener.class.php", + language="php", + filepath="tutorial/tutorial-series/part-5/files/lib/system/event/listener/PersonPruneIpAddressesCronjobListener.class.php" + ) }} +4. The ip addresses in the person information database table also have to be considered for the user data export which can also be done with minimal effort by providing the name of the relevant database table: + + {jinja{ codebox( + title="files/lib/system/event/listener/PersonUserExportGdprListener.class.php", + language="php", + filepath="tutorial/tutorial-series/part-5/files/lib/system/event/listener/PersonUserExportGdprListener.class.php" + ) }} Lastly, we present the updated `eventListener.xml` file with new entries for all of these event listeners: