Skip to content

Commit 8aaf65d

Browse files
author
Richard Jones
committed
added nicer popup windows for topic, nosy, etc (has add/remove buttons)
1 parent a7c77c7 commit 8aaf65d

File tree

5 files changed

+85
-6
lines changed

5 files changed

+85
-6
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Feature:
5656
- Class.find() may now find unset Links (sf bug 700620)
5757
- more flexibility in classhelp link labelling (sf feature 608204)
5858
- added command-line functionality for roundup-adming (sf feature 687664)
59+
- added nicer popup windows for topic, nosy, etc (has add/remove buttons)
60+
thanks Gus Gollings
5961

6062

6163
Fixed:

doc/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Titus Brown,
5757
Roch'e Compaan,
5858
Hernan Martinez Foffani,
5959
Ajit George,
60+
Gus Gollings,
6061
Dan Grassi,
6162
Engelbert Gruber,
6263
Juergen Hermann,

roundup/templates/classic/html/_generic.help

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,90 @@
22
<head>
33
<link rel="stylesheet" type="text/css" href="_file/style.css">
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;">
5+
<script language="JavaScript"
6+
tal:condition="python:request.form.has_key('property')"
7+
tal:content="structure string:
8+
9+
// this is the name of the field in the original form that we're working on
10+
field = '${request/form/property/value}';
11+
12+
function listClose() {
13+
window.close();
14+
}
15+
16+
function listClear() {
17+
window.opener.document.itemSynopsis[field].value = '';
18+
}
19+
20+
function pick(opt) {
21+
if (window.opener && !window.opener.closed) {
22+
window.opener.document.itemSynopsis[field].value = opt;
23+
}
24+
}
25+
26+
// add a value to the form field
27+
function add(opt) {
28+
val = window.opener.document.itemSynopsis[field].value;
29+
if (/^\s*$$/.test(val)) {
30+
newval = opt; // existing is all whitespace, so just replace
31+
} else {
32+
newval = val + ', ' + opt;
33+
}
34+
pick(newval);
35+
}
36+
37+
// remove a value from the form field
38+
function remove(opt) {
39+
// ((opt(,\s*)?)|(,\s*opt))
40+
replaceStr = new String('(('+opt+'(,\\s*)?)|(,\\s*'+opt+'))');
41+
re = new RegExp(replaceStr);
42+
43+
str = window.opener.document.itemSynopsis[field].value;
44+
45+
// replace occurences with empty string
46+
newstr = str.replace(re, '');
47+
pick(newstr);
48+
}
49+
">
50+
</script>
551
</head>
52+
653
<body class="body" marginwidth="0" marginheight="0">
54+
<form>
55+
<div style="padding:10px;text-align:center;">
56+
<script language="javascript">
57+
// put up a 'reset' button if the field has values when we pop up this window
58+
59+
// this is the name of the field in the original form that we're working on
60+
orig = window.opener.document.itemSynopsis[field].value;
61+
if (/[^\s]/.test(orig)) {
62+
reset = '<input type="button" onclick="pick(orig);" ' +
63+
'value="Reset to original values" /> | ';
64+
document.write(reset);
65+
}
66+
</script>
67+
<input type="button"
68+
tal:attributes="value string:Clear all ${request/form/property/value} values"
69+
onclick="listClear();" /> |
70+
<input type="button" onclick="listClose();" value="Close this window" />
71+
</div>
772

873
<table class="classhelp"
974
tal:define="props python:request.form['properties'].value.split(',')">
10-
<tr><th tal:repeat="prop props" tal:content="prop"></th></tr>
75+
<tr>
76+
<th tal:condition="python:request.form.has_key('property')">add/remove</th>
77+
<th tal:repeat="prop props" tal:content="prop"></th>
78+
</tr>
1179
<tr tal:repeat="item context/list">
80+
<td tal:condition="python:request.form.has_key('property')">
81+
<input type="button" tal:define="opt python: item[props[0]]"
82+
tal:attributes="onclick string:add('${opt}')" value=" + ">
83+
<input type="button" tal:define="opt python: item[props[0]]"
84+
tal:attributes="onclick string:remove('${opt}')" value=" - " />
85+
</td>
1286
<td tal:repeat="prop props" tal:content="structure python:item[prop]"></td>
1387
</tr>
1488
</table>
15-
89+
</form>
1690
</body>
91+
</html>

roundup/templates/classic/html/issue.item

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
You are not allowed to view this page.
2020
</span>
2121

22-
<form method="POST" onSubmit="return submit_once()"
22+
<form method="POST" name="itemSynopsis" onSubmit="return submit_once()"
2323
enctype="multipart/form-data" tal:condition="context/is_edit_ok">
2424

2525
<input type="hidden" name=":template" value="item">
@@ -42,7 +42,7 @@ You are not allowed to view this page.
4242
<th nowrap>Superseder</th>
4343
<td>
4444
<span tal:replace="structure python:context.superseder.field(showid=1, size=20)" />
45-
<span tal:replace="structure python:db.issue.classhelp('id,title')" />
45+
<span tal:replace="structure python:db.issue.classhelp('id,title', property='superseder')" />
4646
<span tal:condition="context/superseder" tal:repeat="sup context/superseder">
4747
<br>View: <a tal:attributes="href string:issue${sup/id}"
4848
tal:content="sup/id"></a>
@@ -52,7 +52,7 @@ You are not allowed to view this page.
5252
<td>
5353
<span tal:replace="structure context/nosy/field" />
5454
<span tal:replace="structure
55-
python:db.user.classhelp('username,realname,address,phone')" /><br>
55+
python:db.user.classhelp('username,realname,address', property='nosy', width='600')" /><br>
5656
</td>
5757
</tr>
5858

@@ -62,7 +62,7 @@ python:db.user.classhelp('username,realname,address,phone')" /><br>
6262
<th nowrap>Topics</th>
6363
<td>
6464
<span tal:replace="structure context/topic/field" />
65-
<span tal:replace="structure db/keyword/classhelp" />
65+
<span tal:replace="structure python:db.keyword.classhelp(property='topic')" />
6666
</td>
6767
</tr>
6868

roundup/templates/classic/html/keyword.item

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
enctype="multipart/form-data">
3333

3434
<input type="hidden" name=":required" value="name">
35+
<input type="hidden" name=":template" value="item">
3536

3637
<table class="form">
3738
<tr>

0 commit comments

Comments
 (0)