You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorial/series/part_3.md
+55-42Lines changed: 55 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,50 +24,66 @@ In addition to the components used in [part 1](part_1.md), we will use the [obje
24
24
The complete package will have the following file structure (including the files from [part 1](part_1.md)):
25
25
26
26
```
27
-
├── acpMenu.xml
28
27
├── acptemplates
29
-
│ ├── personAdd.tpl
30
-
│ └── personList.tpl
28
+
│ ├── personAdd.tpl
29
+
│ └── personList.tpl
31
30
├── files
32
-
│ ├── acp
33
-
│ │ └── database
34
-
│ │ └── install_com.woltlab.wcf.people.php
35
-
│ └── lib
36
-
│ ├── acp
37
-
│ │ ├── form
38
-
│ │ │ ├── PersonAddForm.class.php
39
-
│ │ │ └── PersonEditForm.class.php
40
-
│ │ └── page
41
-
│ │ └── PersonListPage.class.php
42
-
│ ├── data
43
-
│ │ └── person
44
-
│ │ ├── Person.class.php
45
-
│ │ ├── PersonAction.class.php
46
-
│ │ ├── PersonEditor.class.php
47
-
│ │ └── PersonList.class.php
48
-
│ ├── page
49
-
│ │ ├── PersonListPage.class.php
50
-
│ │ └── PersonPage.class.php
51
-
│ └── system
52
-
│ ├── cache
53
-
│ │ └── runtime
54
-
│ │ └── PersonRuntimeCache.class.php
55
-
│ ├── comment
56
-
│ │ └── manager
57
-
│ │ └── PersonCommentManager.class.php
58
-
│ └── page
59
-
│ └── handler
60
-
│ └── PersonPageHandler.class.php
31
+
│ ├── acp
32
+
│ │ └── database
33
+
│ │ └── install_com.woltlab.wcf.people.php
34
+
│ └── lib
35
+
│ ├── acp
36
+
│ │ ├── form
37
+
│ │ │ ├── PersonAddForm.class.php
38
+
│ │ │ └── PersonEditForm.class.php
39
+
│ │ └── page
40
+
│ │ └── PersonListPage.class.php
41
+
│ ├── bootstrap
42
+
│ │ └── com.woltlab.wcf.people.php
43
+
│ ├── data
44
+
│ │ └── person
45
+
│ │ ├── Person.class.php
46
+
│ │ ├── PersonAction.class.php
47
+
│ │ ├── PersonEditor.class.php
48
+
│ │ └── PersonList.class.php
49
+
│ ├── event
50
+
│ │ └── gridView
51
+
│ │ └── admin
52
+
│ │ └── PersonGridViewInitialized.class.php
53
+
│ ├── page
54
+
│ │ ├── PersonListPage.class.php
55
+
│ │ └── PersonPage.class.php
56
+
│ └── system
57
+
│ ├── cache
58
+
│ │ └── runtime
59
+
│ │ └── PersonRuntimeCache.class.php
60
+
│ ├── comment
61
+
│ │ └── manager
62
+
│ │ └── PersonCommentManager.class.php
63
+
│ ├── endpoint
64
+
│ │ └── controller
65
+
│ │ └── core
66
+
│ │ └── persons
67
+
│ │ └── DeletePerson.class.php
68
+
│ ├── gridView
69
+
│ │ └── admin
70
+
│ │ └── PersonGridView.class.php
71
+
│ ├── interaction
72
+
│ │ └── admin
73
+
│ │ └── PersonInteractions.class.php
74
+
│ └── page
75
+
│ └── handler
76
+
│ └── PersonPageHandler.class.php
61
77
├── language
62
-
│ ├── de.xml
63
-
│ └── en.xml
78
+
│ ├── de.xml
79
+
│ └── en.xml
64
80
├── menuItem.xml
65
81
├── objectType.xml
66
82
├── package.xml
67
83
├── page.xml
68
84
├── templates
69
-
│ ├── person.tpl
70
-
│ └── personList.tpl
85
+
│ ├── person.tpl
86
+
│ └── personList.tpl
71
87
└── userGroupOption.xml
72
88
```
73
89
@@ -132,8 +148,8 @@ With this option, comments on individual people can be disabled.
132
148
133
149
The `PersonPage` class is similar to the `PersonEditForm` in the ACP in that it reads the id of the requested person from the request data and validates the id in `readParameters()`.
134
150
The rest of the code only handles fetching the list of comments on the requested person.
135
-
In `readData()`, this list is fetched using `CommentHandler::getCommentList()` if comments are enabled for the person.
136
-
The `assignVariables()` method assigns some additional template variables like `$commentCanAdd`, which is `1` if the active person can add comments and is `0` otherwise, `$lastCommentTime`, which contains the UNIX timestamp of the last comment, and `$likeData`, which contains data related to the likes for the disabled comments.
151
+
In `readData()`, this list is fetched using a `CommentsView` if comments are enabled for the person.
152
+
The `assignVariables()` method assigns this view as a template variables.
137
153
138
154
### `person.tpl`
139
155
@@ -144,10 +160,7 @@ The `assignVariables()` method assigns some additional template variables like `
144
160
) }}
145
161
146
162
For now, the `person` template is still very empty and only shows the comments in the content area.
147
-
The template code shown for comments is very generic and used in this form in many locations as it only sets the header of the comment list and the container `ul#personCommentList` element for the comments shown by `commentList` template.
148
-
The `ul#personCommentList` elements has five additional `data-` attributes required by the JavaScript API for comments for loading more comments or creating new ones.
149
-
The `commentListAddComment` template adds the WYSIWYG support.
150
-
The attribute `wysiwygSelector` should be the id of the comment list `personCommentList` with an additional `AddComment` suffix.
163
+
For the main part of the page we only need to call the `render()` method of the `CommentsView`.
0 commit comments