Code

added nicer popup windows for topic, nosy, etc (has add/remove buttons)
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 27 Mar 2003 01:36:19 +0000 (01:36 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 27 Mar 2003 01:36:19 +0000 (01:36 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1641 57a73879-2fb5-44c3-a270-3262357dd7e2

CHANGES.txt
doc/index.txt
roundup/templates/classic/html/_generic.help
roundup/templates/classic/html/issue.item
roundup/templates/classic/html/keyword.item

index bc05c6815bda5fa1fe86c4b40718d57674dda7e8..5425e843034e8b14eb74e2d940f62ef99d345bb9 100644 (file)
@@ -56,6 +56,8 @@ Feature:
 - Class.find() may now find unset Links (sf bug 700620)
 - more flexibility in classhelp link labelling (sf feature 608204)
 - added command-line functionality for roundup-adming (sf feature 687664)
+- added nicer popup windows for topic, nosy, etc (has add/remove buttons)
+  thanks Gus Gollings
 
 
 Fixed:
index dd30c86a1d7eea52cebc1d68659b5a12b9a84758..1ad2b988e7f6085ddb8be6a33ad65ec01f43dea1 100644 (file)
@@ -57,6 +57,7 @@ Titus Brown,
 Roch'e Compaan,
 Hernan Martinez Foffani,
 Ajit George,
+Gus Gollings,
 Dan Grassi,
 Engelbert Gruber,
 Juergen Hermann,
index 9cb15354aff5c8f6dfb189eb70a7416ff9b31b28..0749525bbe8a1d9a75c7e026c5383626c498189c 100644 (file)
@@ -2,15 +2,90 @@
 <head>
 <link rel="stylesheet" type="text/css" href="_file/style.css">
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8;">
+<script language="JavaScript" 
+        tal:condition="python:request.form.has_key('property')"
+        tal:content="structure string:
+
+// this is the name of the field in the original form that we're working on
+field = '${request/form/property/value}';
+
+function listClose() {
+  window.close();
+}
+        
+function listClear() {
+  window.opener.document.itemSynopsis[field].value = '';
+}
+        
+function pick(opt) {
+  if (window.opener && !window.opener.closed) {
+    window.opener.document.itemSynopsis[field].value = opt;
+  }
+}
+        
+// add a value to the form field
+function add(opt) {
+  val = window.opener.document.itemSynopsis[field].value;
+  if (/^\s*$$/.test(val)) {
+    newval = opt;   // existing is all whitespace, so just replace
+  } else {
+    newval = val + ', ' + opt;
+  }
+  pick(newval);
+}
+        
+// remove a value from the form field
+function remove(opt) {
+  // ((opt(,\s*)?)|(,\s*opt))
+  replaceStr = new String('(('+opt+'(,\\s*)?)|(,\\s*'+opt+'))');
+  re = new RegExp(replaceStr);
+
+  str = window.opener.document.itemSynopsis[field].value;
+
+  // replace occurences with empty string
+  newstr = str.replace(re, '');
+  pick(newstr);
+}
+">
+</script>
 </head>
+
 <body class="body" marginwidth="0" marginheight="0">
+<form>
+<div style="padding:10px;text-align:center;">
+ <script language="javascript">
+  // put up a 'reset' button if the field has values when we pop up this window
+
+  // this is the name of the field in the original form that we're working on
+  orig = window.opener.document.itemSynopsis[field].value;
+  if (/[^\s]/.test(orig)) {
+    reset = '<input type="button" onclick="pick(orig);" ' +
+      'value="Reset to original values" /> | ';
+    document.write(reset);
+  }
+ </script>
+ <input type="button"
+        tal:attributes="value string:Clear all ${request/form/property/value} values"
+        onclick="listClear();" /> | 
+ <input type="button" onclick="listClose();" value="Close this window" />
+</div>
 
 <table class="classhelp"
        tal:define="props python:request.form['properties'].value.split(',')">
-<tr><th tal:repeat="prop props" tal:content="prop"></th></tr>
+<tr>
+ <th tal:condition="python:request.form.has_key('property')">add/remove</th>
+ <th tal:repeat="prop props" tal:content="prop"></th>
+</tr>
 <tr tal:repeat="item context/list">
+ <td tal:condition="python:request.form.has_key('property')">
+ <input type="button" tal:define="opt python: item[props[0]]" 
+         tal:attributes="onclick string:add('${opt}')" value=" + ">
+ <input type="button" tal:define="opt python: item[props[0]]" 
+         tal:attributes="onclick string:remove('${opt}')" value=" - " />
+ </td>
  <td tal:repeat="prop props" tal:content="structure python:item[prop]"></td>
 </tr>
 </table>
-
+</form>
 </body>
+</html>
index 18bb6231c7d0ac2c9448560554ce7a30be9175f5..8db909bff82633cc2b8fca432ffeba1d70a9d8bd 100644 (file)
@@ -19,7 +19,7 @@
 You are not allowed to view this page.
 </span>
 
-<form method="POST" onSubmit="return submit_once()"
+<form method="POST" name="itemSynopsis" onSubmit="return submit_once()"
       enctype="multipart/form-data" tal:condition="context/is_edit_ok">
 
 <input type="hidden" name=":template" value="item">
@@ -42,7 +42,7 @@ You are not allowed to view this page.
  <th nowrap>Superseder</th>
  <td>
   <span tal:replace="structure python:context.superseder.field(showid=1, size=20)" />
-  <span tal:replace="structure python:db.issue.classhelp('id,title')" />
+  <span tal:replace="structure python:db.issue.classhelp('id,title', property='superseder')" />
   <span tal:condition="context/superseder" tal:repeat="sup context/superseder">
    <br>View: <a tal:attributes="href string:issue${sup/id}"
                 tal:content="sup/id"></a>
@@ -52,7 +52,7 @@ You are not allowed to view this page.
  <td>
   <span tal:replace="structure context/nosy/field" />
   <span tal:replace="structure
-python:db.user.classhelp('username,realname,address,phone')" /><br>
+python:db.user.classhelp('username,realname,address', property='nosy', width='600')" /><br>
  </td>
 </tr>
 
@@ -62,7 +62,7 @@ python:db.user.classhelp('username,realname,address,phone')" /><br>
  <th nowrap>Topics</th>
  <td>
   <span tal:replace="structure context/topic/field" />
-  <span tal:replace="structure db/keyword/classhelp" />
+  <span tal:replace="structure python:db.keyword.classhelp(property='topic')" />
  </td>
 </tr>
 
index 04d0878aa5850f8a768aa1b141953017547dae57..4572370865abc26e78c4e705625818573d07ae53 100644 (file)
@@ -32,6 +32,7 @@
       enctype="multipart/form-data">
 
  <input type="hidden" name=":required" value="name">
+ <input type="hidden" name=":template" value="item">
 
  <table class="form">
   <tr>