comparison doc/design.txt @ 1244:8dd4f736370b

merge from maintenance branch
author Richard Jones <richard@users.sourceforge.net>
date Thu, 03 Oct 2002 06:56:30 +0000
parents d870139aeb5c
children 6fede2aa6a12
comparison
equal deleted inserted replaced
1243:3a028d2f7830 1244:8dd4f736370b
1133 1133
1134 Displaying Properties 1134 Displaying Properties
1135 ~~~~~~~~~~~~~~~~~~~~~ 1135 ~~~~~~~~~~~~~~~~~~~~~
1136 1136
1137 Properties appear in the user interface in three contexts: 1137 Properties appear in the user interface in three contexts:
1138 in indices, in editors, and as filters. For each type of 1138 in indices, in editors, and as search filters. For each type of
1139 property, there are several display possibilities. For example, 1139 property, there are several display possibilities. For example,
1140 in an index view, a string property may just be printed as 1140 in an index view, a string property may just be printed as
1141 a plain string, but in an editor view, that property should 1141 a plain string, but in an editor view, that property should
1142 be displayed in an editable field. 1142 be displayed in an editable field.
1143 1143
1144 The display of a property is handled by functions in 1144 The display of a property is handled by functions in
1145 a displayers module. Each function accepts at 1145 the ``cgi.templating`` module.
1146 least three standard arguments -- the database, class name, 1146
1147 and item id -- and returns a chunk of HTML. 1147 Displayer functions are triggered by ``tal:content`` or ``tal:replace``
1148 1148 tag attributes in templates. The value of the attribute
1149 Displayer functions are triggered by <display> 1149 provides an expression for calling the displayer function.
1150 tags in templates. The call attribute of the tag 1150 For example, the occurrence of::
1151 provides a Python expression for calling the displayer 1151
1152 function. The three standard arguments are inserted in 1152 tal:content="context/status/plain"
1153 front of the arguments given. For example, the occurrence of::
1154
1155 <display call="plain('status', max=30)">
1156 1153
1157 in a template triggers a call to:: 1154 in a template triggers a call to::
1158 1155
1159 plain(db, "issue", 13, "status", max=30) 1156 context['status'].plain()
1160 1157
1161 1158 where the context would be an item of the "issue" class. The displayer
1162 when displaying issue 13 in the "issue" class. The displayer
1163 functions can accept extra arguments to further specify 1159 functions can accept extra arguments to further specify
1164 details about the widgets that should be generated. By defining new 1160 details about the widgets that should be generated.
1165 displayer functions, the user interface can be highly customized.
1166 1161
1167 Some of the standard displayer functions include: 1162 Some of the standard displayer functions include:
1168 1163
1169 ========= ==================================================================== 1164 ========= ====================================================================
1170 Function Description 1165 Function Description
1172 plain display a String property directly; 1167 plain display a String property directly;
1173 display a Date property in a specified time zone with an option 1168 display a Date property in a specified time zone with an option
1174 to omit the time from the date stamp; for a Link or Multilink 1169 to omit the time from the date stamp; for a Link or Multilink
1175 property, display the key strings of the linked items (or the 1170 property, display the key strings of the linked items (or the
1176 ids if the linked class has no key property) 1171 ids if the linked class has no key property)
1177 field display a property like the 1172 field display a property like the plain displayer above, but in a text
1178 plain displayer above, but in a text field 1173 field to be edited
1179 to be edited 1174 menu for a Link property, display a menu of the available choices
1180 menu for a Link property, display
1181 a menu of the available choices
1182 link for a Link or Multilink property,
1183 display the names of the linked items, hyperlinked to the
1184 issue views on those items
1185 count for a Multilink property, display
1186 a count of the number of links in the list
1187 reldate display a Date property in terms
1188 of an interval relative to the current date (e.g. "+ 3w", "- 2d").
1189 download show a Link("file") or Multilink("file")
1190 property using links that allow you to download files
1191 checklist for a Link or Multilink property,
1192 display checkboxes for the available choices to permit filtering
1193 ========= ==================================================================== 1175 ========= ====================================================================
1194 1176
1195 TODO: See the htmltemplate pydoc for a complete list of the functions 1177 See the `customisation`_ documentation for the complete list.
1196 1178
1197 1179
1198 Index Views 1180 Index Views
1199 ~~~~~~~~~~~ 1181 ~~~~~~~~~~~
1182
1183 XXX The following needs to be clearer
1200 1184
1201 An index view contains two sections: a filter section 1185 An index view contains two sections: a filter section
1202 and an index section. 1186 and an index section.
1203 The filter section provides some widgets for selecting 1187 The filter section provides some widgets for selecting
1204 which issues appear in the index. The index section is 1188 which issues appear in the index. The index section is
1208 """"""""""""""""""""" 1192 """""""""""""""""""""
1209 1193
1210 An index view specifier looks like this (whitespace 1194 An index view specifier looks like this (whitespace
1211 has been added for clarity):: 1195 has been added for clarity)::
1212 1196
1213 /issue?status=unread,in-progress,resolved&amp; 1197 /issue?status=unread,in-progress,resolved&
1214 topic=security,ui&amp; 1198 topic=security,ui&
1215 :group=priority&amp; 1199 :group=priority&
1216 :sort=-activity&amp; 1200 :sort=-activity&
1217 :filters=status,topic&amp; 1201 :filters=status,topic&
1218 :columns=title,status,fixer 1202 :columns=title,status,fixer
1219 1203
1220 1204
1221 The index view is determined by two parts of the 1205 The index view is determined by two parts of the
1222 specifier: the layout part and the filter part. 1206 specifier: the layout part and the filter part.
1254 layout specifier. The layout specifier in the above 1238 layout specifier. The layout specifier in the above
1255 example is the default layout to be provided with 1239 example is the default layout to be provided with
1256 the default bug-tracker schema described above in 1240 the default bug-tracker schema described above in
1257 section 4.4. 1241 section 4.4.
1258 1242
1259 Filter Section
1260 """"""""""""""
1261
1262 The template for a filter section provides the
1263 filtering widgets at the top of the index view.
1264 Fragments enclosed in ``<property>...</property>``
1265 tags are included or omitted depending on whether the
1266 view specifier requests a filter for a particular property.
1267
1268 Here's a simple example of a filter template::
1269
1270 <property name=status>
1271 <display call="checklist('status')">
1272 </property>
1273 <br>
1274 <property name=priority>
1275 <display call="checklist('priority')">
1276 </property>
1277 <br>
1278 <property name=fixer>
1279 <display call="menu('fixer')">
1280 </property>
1281
1282 Index Section 1243 Index Section
1283 """"""""""""" 1244 """""""""""""
1284 1245
1285 The template for an index section describes one row of 1246 The template for an index section describes one row of
1286 the index table. 1247 the index table.
1291 to display the values of the issue's properties. 1252 to display the values of the issue's properties.
1292 1253
1293 Here's a simple example of an index template:: 1254 Here's a simple example of an index template::
1294 1255
1295 <tr> 1256 <tr>
1296 <property name=title> 1257 <td tal:condition="request/show/title" tal:content="contex/title"></td>
1297 <td><display call="plain('title', max=50)"></td> 1258 <td tal:condition="request/show/status" tal:content="contex/status"></td>
1298 </property> 1259 <td tal:condition="request/show/fixer" tal:content="contex/fixer"></td>
1299 <property name=status>
1300 <td><display call="plain('status')"></td>
1301 </property>
1302 <property name=fixer>
1303 <td><display call="plain('fixer')"></td>
1304 </property>
1305 </tr> 1260 </tr>
1306 1261
1307 Sorting 1262 Sorting
1308 """"""" 1263 """""""
1309 1264
1338 1293
1339 Here's an example of a basic editor template:: 1294 Here's an example of a basic editor template::
1340 1295
1341 <table> 1296 <table>
1342 <tr> 1297 <tr>
1343 <td colspan=2> 1298 <td colspan=2 tal:content="python:context.title.field(size='60')"></td>
1344 <display call="field('title', size=60)">
1345 </td>
1346 </tr> 1299 </tr>
1347 <tr> 1300 <tr>
1348 <td> 1301 <td tal:content="context/fixer/field"></td>
1349 <display call="field('fixer', size=30)"> 1302 <td tal:content="context/status/menu"></td>
1350 </td>
1351 <td>
1352 <display call="menu('status')>
1353 </td>
1354 </tr> 1303 </tr>
1355 <tr> 1304 <tr>
1356 <td> 1305 <td tal:content="context/nosy/field"></td>
1357 <display call="field('nosy', size=30)"> 1306 <td tal:content="context/priority/menu"></td>
1358 </td>
1359 <td>
1360 <display call="menu('priority')>
1361 </td>
1362 </tr> 1307 </tr>
1363 <tr> 1308 <tr>
1364 <td colspan=2> 1309 <td colspan=2>
1365 <display call="note()"> 1310 <textarea name=":note" rows=5 cols=60></textarea>
1366 </td> 1311 </td>
1367 </tr> 1312 </tr>
1368 </table> 1313 </table>
1369 1314
1370 As shown in the example, the editor template can also 1315 As shown in the example, the editor template can also include a ":note" field,
1371 request the display of a "note" field, which is a 1316 which is a text area for entering a note to go along with a change.
1372 text area for entering a note to go along with a change.
1373 1317
1374 When a change is submitted, the system automatically 1318 When a change is submitted, the system automatically
1375 generates a message describing the changed properties. 1319 generates a message describing the changed properties.
1376 The message displays all of the property values on the 1320 The message displays all of the property values on the
1377 issue and indicates which ones have changed. 1321 issue and indicates which ones have changed.
1381 priority: critical 1325 priority: critical
1382 status: unread -> in-progress 1326 status: unread -> in-progress
1383 fixer: (none) 1327 fixer: (none)
1384 keywords: parrot,plumage,perch,nailed,dead 1328 keywords: parrot,plumage,perch,nailed,dead
1385 1329
1386 If a note is given in the "note" field, the note is 1330 If a note is given in the ":note" field, the note is
1387 appended to the description. The message is then added 1331 appended to the description. The message is then added
1388 to the issue's message spool (thus triggering the standard 1332 to the issue's message spool (thus triggering the standard
1389 detector to react by sending out this message to the nosy list). 1333 detector to react by sending out this message to the nosy list).
1390 1334
1391 Spool Section 1335 Spool Section
1537 1481
1538 if db.security.hasItemPermission('issue', itemid, assignedto=userid): 1482 if db.security.hasItemPermission('issue', itemid, assignedto=userid):
1539 # all ok 1483 # all ok
1540 1484
1541 Code in the core will make use of these methods, as should code in auditors in 1485 Code in the core will make use of these methods, as should code in auditors in
1542 custom templates. The htmltemplate will implement a new tag, ``<require>`` 1486 custom templates. The HTML templating may access the access controls through
1543 which has the form:: 1487 the *user* attribute of the *request* variable. It exposes a ``hasPermission()``
1544 1488 method::
1545 <require permission="name,name,name" assignedto="$userid" status="open"> 1489
1546 HTML to display if the user has the permission. 1490 tal:condition="python:request.user.hasPermission('Edit', 'issue')"
1547 <else> 1491
1548 HTML to display if the user does not have the permission. 1492 or, if the *context* is *issue*, then the following is the same::
1549 </require> 1493
1550 1494 tal:condition="python:request.user.hasPermission('Edit')"
1551 where: 1495
1552
1553 - the permission attribute gives a comma-separated list of permission names.
1554 These are checked in turn using ``hasPermission`` and requires one to
1555 be OK.
1556 - the other attributes are lookups on the item using ``hasItemPermission``. If
1557 the attribute value is "$userid" then the current user's userid is tested.
1558
1559 Any of these tests must pass or the ``<require>`` check will fail. The section
1560 of html within the side of the ``<else>`` that fails is remove from processing.
1561 1496
1562 Authentication of Users 1497 Authentication of Users
1563 ~~~~~~~~~~~~~~~~~~~~~~~ 1498 ~~~~~~~~~~~~~~~~~~~~~~~
1564 1499
1565 Users must be authenticated correctly for the above controls to work. This is 1500 Users must be authenticated correctly for the above controls to work. This is
1603 A combination of existing and new Roles, Permissions and auditors could 1538 A combination of existing and new Roles, Permissions and auditors could
1604 be used here. 1539 be used here.
1605 privacy - issues that are only visible to some users 1540 privacy - issues that are only visible to some users
1606 A new property is added to the issue which marks the user or group of 1541 A new property is added to the issue which marks the user or group of
1607 users who are allowed to view and edit the issue. An auditor will check 1542 users who are allowed to view and edit the issue. An auditor will check
1608 for edit access, and the htmltemplate <require> tag can check for view 1543 for edit access, and the template user object can check for view access.
1609 access.
1610 1544
1611 1545
1612 Deployment Scenarios 1546 Deployment Scenarios
1613 -------------------- 1547 --------------------
1614 1548
1636 1570
1637 - Added Boolean and Number types 1571 - Added Boolean and Number types
1638 - Added section Hyperdatabase Implementations 1572 - Added section Hyperdatabase Implementations
1639 - "Item" has been renamed to "Issue" to account for the more specific nature 1573 - "Item" has been renamed to "Issue" to account for the more specific nature
1640 of the Class. 1574 of the Class.
1641 1575 - New Templating
1642 1576 - Access Controls
1577
1578 ------------------
1579
1580 Back to `Table of Contents`_
1581
1582 .. _`Table of Contents`: index.html
1583 .. _customisation: customizing.html
1584

Roundup Issue Tracker: http://roundup-tracker.org/