comparison src/nabble/view/naml/user_nodes.naml @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children 72765b66e2c3
comparison
equal deleted inserted replaced
-1:000000000000 0:7ecd1a4ef557
1 <macro name="user_nodes" requires="servlet">
2 <n.user_page.>
3 <n.html>
4 <head>
5 <n.user_nodes_meta/>
6 <n.title.>
7 <t>Profile of <t.author.page_user.name/></t>
8 <n.hide_if_equals. value1="[n.user_nodes_page_number/]" value2="1">
9 | <t>Page <t.number.user_nodes_page_number/></t>
10 </n.hide_if_equals.>
11 </n.title.>
12 <style type="text/css">
13 table.nodes {
14 width:100%;
15 border-collapse:collapse;
16 }
17 table.nodes td {
18 padding:.3em;
19 }
20 table.nodes td.header {
21 padding: .2em;
22 font-weight:bold;
23 }
24 div.table-title {
25 font-weight:bold;
26 font-size:120%;
27 margin: 1em .1em 1em;
28 }
29 </style>
30 </head>
31 <body>
32 <n.page_user.profile_header/>
33
34 <n.user_nodes_search_box/>
35
36 <div class="second-font table-title">
37 <t>Posts in <t.location.root_node.subject/></t>
38 </div>
39
40 <n.user_nodes_table.>
41 <n.date_column width="7em"/>
42 <n.subject_column/>
43 <n.count_column/>
44 <n.location_column/>
45 </n.user_nodes_table.>
46 </body>
47 </n.html>
48 </n.user_page.>
49 </macro>
50
51 <macro name="user_nodes_search_box" requires="user_page">
52 <div class="search-box" style="float:right;white-space:nowrap;margin-top:1em">
53 <n.root_node.page_search_box author="[n.page_user.id/]"/>
54 </div>
55 </macro>
56
57 <macro name="user_nodes_table" dot_parameter="columns">
58 <n.page_user.nodes_list.
59 start="[n.user_nodes_index_record/]"
60 length="[n.user_nodes_length/]"
61 filter="[n.user_nodes_filter_condition/]"
62 >
63 <div style="position:relative;margin:-.6em 0 .2em">
64 <n.user_nodes_pagination/>
65 <n.user_nodes_filter_control/>
66 </div>
67 <table class="nodes">
68 <n.table_header.>
69 <tr class="header-row shaded-bg-color">
70 <n.columns/>
71 </tr>
72 </n.table_header.>
73 <n.loop.>
74 <tr class="[n.alternate var='row-class' first_value='main-row' second_value='light-bg-color main-row'/]">
75 <n.columns/>
76 </tr>
77 </n.loop.>
78 </table>
79 <n.check_omitted_nodes/>
80 <n.user_nodes_pagination/>
81 </n.page_user.nodes_list.>
82 </macro>
83
84 <macro name="user_nodes_index_record">
85 <n.get_parameter name="i"/>
86 </macro>
87
88 <macro name="user_nodes_filter">
89 <n.get_parameter name="filter"/>
90 </macro>
91
92 <macro name="user_nodes_length">
93 20
94 </macro>
95
96 <macro name="user_nodes_filter_control" requires="user_page">
97 <n.put_in_head.>
98 <script type="text/javascript">
99 $(document).ready(function() {
100 function applyFilter() {
101 window.location = $('#filter').val();
102 };
103 $('#filter').change(applyFilter);
104 });
105 </script>
106 </n.put_in_head.>
107 <div class="float-left nowrap" style="margin:.3em .2em">
108 <b><t>Show</t></b>
109 <n.set_var. name='url'>
110 <n.page_user.url filter="[n.user_nodes_filter/]"/>
111 </n.set_var.>
112 <select id="filter">
113 <n.select_option value="[n.page_user.url/]" text="[t]All[/t]"/>
114 <n.select_option value="[n.page_user.url filter='apps_only'/]" selectedValue="[n.var name='url'/]" text="[t]Apps[/t]"/>
115 <n.select_option value="[n.page_user.url filter='topics_only'/]" selectedValue="[n.var name='url'/]" text="[t]Topics[/t]"/>
116 </select>
117 &nbsp;
118 <span class="weak-color" style="font-style: italic">
119 <t>Total</t>:
120 <n.one_or_many.user_nodes_count>
121 <one_text><t>item</t></one_text>
122 <many_text><t>items</t></many_text>
123 </n.one_or_many.user_nodes_count>
124 </span>
125 </div>
126 </macro>
127
128 <macro name="user_nodes_filter_condition" requires="user_page">
129 <n.if.equal value1="[n.user_nodes_filter/]" value2="apps_only">
130 <then.page_user.app_filter/>
131 <else.if.equal value1="[n.user_nodes_filter/]" value2="topics_only">
132 <then.page_user.topic_filter/>
133 <else.null/>
134 </else.if.equal>
135 </n.if.equal>
136 </macro>
137
138 <macro name="user_nodes_pagination" requires="user_page">
139 <n.paging.
140 total_rows="[n.user_nodes_count/]"
141 current_row="[n.user_nodes_index_record/]"
142 rows_per_page="[n.user_nodes_length/]"
143 >
144 <n.generic_paging>
145 <margin>.55em .2em</margin>
146 <url><n.page_user.path index_record="[n.page_row/]" filter="[n.user_nodes_filter/]"/></url>
147 </n.generic_paging>
148 </n.paging.>
149 </macro>
150
151 <macro name="user_nodes_page_number" requires="servlet">
152 <n.paging.
153 total_rows="0"
154 current_row="[n.user_nodes_index_record/]"
155 rows_per_page="[n.user_nodes_length/]"
156 >
157 <n.current_page_number/>
158 </n.paging.>
159 </macro>
160
161 <macro name="user_nodes_count" requires="user_page">
162 <n.cache. var="user_nodes_count" >
163 <n.page_user.node_count filter="[n.user_nodes_filter_condition/]"/>
164 </n.cache.>
165 </macro>
166
167 <macro name="path" parameters="index_record,filter" requires="user">
168 <n.encode_url.remove_spaces.>
169 /template/NamlServlet.jtp?macro=user_nodes&user=<n.id/>
170 <n.add_to_path name="i" value="[n.index_record/]" default_value="0"/>
171 <n.add_to_path name="filter" value="[n.filter/]"/>
172 </n.encode_url.remove_spaces.>
173 </macro>
174
175 <macro name="url" parameters="index_record,filter" requires="user">
176 <n.base_url /><n.path index_record="[n.index_record/]" filter="[n.filter/]" />
177 </macro>
178
179 <macro name="date_column" parameters="title,width">
180 <n.table_column>
181 <head>
182 <td class="header" style="[n.width_style.width/]">
183 <n.default. to="[t]Date[/t]"><n.title/></n.default.>
184 </td>
185 </head>
186 <body>
187 <td class="weak-color">
188 <n.current_node.when_created.short_format/>
189 </td>
190 </body>
191 </n.table_column>
192 </macro>
193
194 <macro name="subject_column" parameters="title,width">
195 <n.table_column>
196 <head>
197 <td class="header" colspan="2" style="[n.width_style.width/]">
198 <n.default. to="[t]Subject[/t]"><n.title/></n.default.>
199 </td>
200 </head>
201 <body>
202 <td style="width:25px;padding:.2em">
203 <n.if.current_node.is_app>
204 <then><img src="/images/forum_sm.png" class="image16"/></then>
205 <else><img src="/images/thread_sm.png" class="image16"/></else>
206 </n.if.current_node.is_app>
207 </td>
208 <td>
209 <n.current_node.node_link/>
210 <n.if.current_node.is_private>
211 <then><span class="weak-color"><t>(private)</t></span></then>
212 </n.if.current_node.is_private>
213 <n.if.current_node.is_pending>
214 <then><img src="/images/icon_pending.png" class="image16" title="[t]This post has NOT been accepted by the mailing list yet.[/t]"/></then>
215 </n.if.current_node.is_pending>
216 </td>
217 </body>
218 </n.table_column>
219 </macro>
220
221 <macro name="count_column" parameters="title,width">
222 <n.table_column>
223 <head>
224 <td class="header" style="[n.width_style.width/]">
225 <n.default. to="[t]Count[/t]"><n.title/></n.default.>
226 </td>
227 </head>
228 <body>
229 <td class="weak-color nowrap">
230 <n.if.current_node.is_app>
231 <then>
232 <n.one_or_many.current_node.topic_count>
233 <one_text><t>topic</t></one_text>
234 <many_text><t>topics</t></many_text>
235 </n.one_or_many.current_node.topic_count>
236 </then>
237 <else>
238 <n.one_or_many.current_node.replies>
239 <one_text><t>reply</t></one_text>
240 <many_text><t>replies</t></many_text>
241 </n.one_or_many.current_node.replies>
242 </else>
243 </n.if.current_node.is_app>
244 </td>
245 </body>
246 </n.table_column>
247 </macro>
248
249 <macro name="location_column" parameters="title,width">
250 <n.table_column>
251 <head>
252 <td class="header" style="[n.width_style.width/]">
253 <n.default. to="[t]Location[/t]"><n.title/></n.default.>
254 </td>
255 </head>
256 <body>
257 <td class="weak-color">
258 <n.if.not.current_node.is_app>
259 <then><n.current_node.app_or_root.node_link/></then>
260 </n.if.not.current_node.is_app>
261 </td>
262 </body>
263 </n.table_column>
264 </macro>
265
266 <macro name="check_omitted_nodes" requires="node_list, user_page">
267 <n.comment.>
268 Here we check if this page contains the correct number of rows. If this is not the case,
269 it is because the visitor doesn't have permission to view them and we must display a message.
270 The check is simple: we get the number of rows this page is meant to show (current_page_rows
271 command in pagination namespace) and subtract the number of rows displayed (current_index
272 of the node_list loop). If the result if greater than zero, then some rows were not displayed and
273 we show the message.
274 </n.comment.>
275 <n.paging.
276 total_rows="[n.user_nodes_count/]"
277 current_row="[n.user_nodes_index_record/]"
278 rows_per_page="[n.user_nodes_length/]"
279 >
280 <n.int. i="[n.current_page_rows/]">
281 <n.no_output.minus i="[n.current_index/]"/>
282 <n.if.is_greater_than i="0">
283 <then>
284 <div class="info-message" style="margin-top:.2em;padding:.7em .5em">
285 <t>Some private items have been omitted because you don't have permission to view them.</t>
286 </div>
287 </then>
288 </n.if.is_greater_than>
289 </n.int.>
290 </n.paging.>
291 </macro>
292
293 <macro name="user_nodes_meta" requires="user_page">
294 <n.if.not.equal value1="[n.user_nodes_page_number/]" value2="1">
295 <then>
296 <meta name="robots" content="noindex,follow"/>
297 </then>
298 </n.if.not.equal>
299 </macro>