55# The issues are contained in a todo.db file, as a sequence of lines of
66# tab-separated fields:
77#
8- # - number
8+ # - username (of user who created the entry)
99# - priority (a number)
1010# - one-line description
1111# - reference (preferrably a URL)
@@ -21,6 +21,7 @@ HTML=`dirname $0`/../DOC/todo.srb
2121DATEFRM=" +%d %b %Y"
2222ARCH=` uname`
2323PAGER=${PAGER:- more}
24+ WHO=` whoami`
2425
2526
2627pr ()
@@ -58,8 +59,10 @@ list_issues ()
5859{
5960 (
6061 IFS=' '
61- while read num prio desc ref own date1 date2 comment res; do
62- pr " Number : $num "
62+ i=0
63+ while read who prio desc ref own date1 date2 comment res; do
64+ i=` expr $i + 1`
65+ pr " Number : $i "
6366 pr " Priority : $prio "
6467 pr " Description : $desc "
6568 pr " Reference : $ref "
@@ -77,9 +80,11 @@ list_unresolved ()
7780{
7881 (
7982 IFS=' '
80- while read num prio desc ref own date1 date2 comment res; do
83+ i=0
84+ while read who prio desc ref own date1 date2 comment res; do
85+ i=` expr $i + 1`
8186 if [ " $res " = " -" ]; then
82- pr " Number : $num "
87+ pr " Number : $i "
8388 pr " Priority : $prio "
8489 pr " Description : $desc "
8590 pr " Reference : $ref "
@@ -103,16 +108,18 @@ generate_html ()
103108 echo " <tr><td colspan=5> "
104109 (
105110 IFS=' '
106- while read num prio desc ref own date1 date2 comment res; do
107- echo " <tr valign=center bgcolor='#ffffbb'>"
111+ i=0
112+ while read who prio desc ref own date1 date2 comment res; do
113+ i=` expr $i + 1`
114+ echo " <tr valign=center bgcolor='#ffffbb'><!-- $who -->"
108115 pr " <td style='background:#44a'> <span style='color:red'>\c"
109- i =0;
110- while [ $i -lt $prio ]; do
116+ j =0;
117+ while [ $j -lt " $prio " ]; do
111118 pr " *\c"
112- i =` expr $i + 1`
119+ j =` expr $j + 1`
113120 done
114121 echo " </span>"
115- echo " <td align=right style='background:#44a'><strong style='color:white;font-size:larger'>$num </strong> "
122+ echo " <td align=right style='background:#44a'><strong style='color:white;font-size:larger'>$i </strong> "
116123 echo " <td> $own "
117124 echo " <td> $date1 "
118125 echo " <td> $date2 "
@@ -128,46 +135,12 @@ generate_html ()
128135 echo " <th colspan=2 align=right>Comment: <td colspan=3>$comment "
129136 echo " <tr valign=baseline>"
130137 echo " <th colspan=2 align=right>Resolution: <td colspan=3>$res "
131- # echo "<tr><td colspan=5> "
132138 done < $ISSUES
133139 )
134140 echo " </table>"
135141 echo " <p>Last update: " ` ls -l $ISSUES | cut -c 42-47` \
136142 " (HTML version generated: " ` date " $DATEFRM " ` " )"
137143 return
138-
139- echo " <table border>"
140- echo " <tr>"
141- echo " <th>#"
142- echo " <th>Prio"
143- echo " <th>Description"
144- echo " <th>Reference"
145- echo " <th>Owner"
146- echo " <th>Archived on"
147- echo " <th>Resolved on"
148- echo " <th>Comments"
149- echo " <th>Resolution"
150- (
151- IFS=' '
152- while read num prio desc ref own date1 date2 comment res; do
153- echo " <tr valign=baseline>"
154- echo " <td>$num "
155- echo " <td>$prio "
156- echo " <td>$desc "
157- case " $ref " in
158- http:* | ftp:* ) echo " <td><a href='$ref '>here</a>" ;;
159- * ) echo " <td>$ref " ;;
160- esac
161- echo " <td>$own "
162- echo " <td>$date1 "
163- echo " <td>$date2 "
164- echo " <td>$comment "
165- echo " <td>$res "
166- done < $ISSUES
167- )
168- pr " </table>"
169- pr " <p>Last update: " ` ls -l $ISSUES | cut -c 42-47` \
170- " (HTML version generated: " ` date " $DATEFRM " ` " )"
171144}
172145
173146add_issue ()
@@ -182,15 +155,12 @@ add_issue ()
182155 fi
183156 ref=` echo $ref | tr " & " " " `
184157 desc=` echo $desc | tr " & " " " `
185- num=` wc -l $ISSUES | cut -c1-9`
186- num=` expr $num + 1`
187158 date=` date " $DATEFRM " `
188159 cp $ISSUES $ISSUES .bak
189160 (
190161 cat $ISSUES .bak
191- pr " $num \t0\t$desc \t$ref \t-\t$date \t-\t-\t-"
192- ) | sort -k 2nr,3 -k 1n,2 > $ISSUES
193- # generate_html >$HTML
162+ pr " $WHO 0 $desc $ref - $date - - -"
163+ ) > $ISSUES
194164}
195165
196166resolve_issue ()
@@ -212,17 +182,19 @@ resolve_issue ()
212182 cp $ISSUES $ISSUES .bak
213183 (
214184 IFS=' '
215- while read num1 prio desc ref own date1 date2 comment res1; do
216- if [ " $num1 " != " $num " ]; then
217- pr " $num1 $prio $desc $ref $own $date1 $date2 $comment $res1 "
185+ i=0
186+ while read who prio desc ref own date1 date2 comment res1; do
187+ i=` expr $i + 1`
188+ if [ " $i " != " $num " ]; then
189+ pr " $who $prio $desc $ref $own $date1 $date2 $comment $res1 "
218190 elif [ " $res1 " = " -" ]; then
219- pr " $num1 $prio $desc $ref $own $date1 $date $comment $res "
191+ pr " $who $prio $desc $ref $own $date1 $date $comment $res "
220192 else
193+ pr " $who $prio $desc $ref $own $date1 $date2 $comment $res1 "
221194 pr " Error: Issue was already resolved. Not changed." >&2
222195 fi
223196 done < $ISSUES .bak > $ISSUES
224197 )
225- # generate_html >$HTML
226198}
227199
228200add_comment ()
@@ -244,16 +216,17 @@ add_comment ()
244216 cp $ISSUES $ISSUES .bak
245217 (
246218 IFS=' '
247- while read num1 prio desc ref own date1 date2 comment1 res; do
248- if [ " $num1 " = " $num " ]; then
219+ i=0
220+ while read who prio desc ref own date1 date2 comment1 res; do
221+ i=` expr $i + 1`
222+ if [ " $i " = " $num " ]; then
249223 if [ " $comment1 " = " -" ]; then comment1=; fi
250- pr " $num1 $prio $desc $ref $own $date1 $date2 $comment1 $comment ($date ). $res "
224+ pr " $who $prio $desc $ref $own $date1 $date2 $comment1 $comment ($date ). $res "
251225 else
252- pr " $num1 $prio $desc $ref $own $date1 $date2 $comment1 $res "
226+ pr " $who $prio $desc $ref $own $date1 $date2 $comment1 $res "
253227 fi
254228 done < $ISSUES .bak > $ISSUES
255229 )
256- # generate_html >$HTML
257230}
258231
259232add_owner ()
@@ -274,15 +247,16 @@ add_owner ()
274247 cp $ISSUES $ISSUES .bak
275248 (
276249 IFS=' '
277- while read num1 prio desc ref own1 date1 date2 comment res; do
278- if [ " $num1 " = " $num " ]; then
279- pr " $num1 $prio $desc $ref $own $date1 $date2 $comment $res "
250+ i=0
251+ while read who prio desc ref own1 date1 date2 comment res; do
252+ i=` expr $i + 1`
253+ if [ " $i " = " $num " ]; then
254+ pr " $who $prio $desc $ref $own $date1 $date2 $comment $res "
280255 else
281- pr " $num1 $prio $desc $ref $own1 $date1 $date2 $comment $res "
256+ pr " $who $prio $desc $ref $own1 $date1 $date2 $comment $res "
282257 fi
283258 done < $ISSUES .bak > $ISSUES
284259 )
285- # generate_html >$HTML
286260}
287261
288262remove_owner ()
@@ -298,15 +272,16 @@ remove_owner ()
298272 cp $ISSUES $ISSUES .bak
299273 (
300274 IFS=' '
301- while read num1 prio desc ref own1 date1 date2 comment res; do
302- if [ " $num1 " = " $num " ]; then
303- pr " $num1 $prio $desc $ref - $date1 $date2 $comment $res "
275+ i=0
276+ while read who prio desc ref own1 date1 date2 comment res; do
277+ i=` expr $i + 1`
278+ if [ " $i " = " $num " ]; then
279+ pr " $who $prio $desc $ref - $date1 $date2 $comment $res "
304280 else
305- pr " $num1 $prio $desc $ref $own1 $date1 $date2 $comment $res "
281+ pr " $who $prio $desc $ref $own1 $date1 $date2 $comment $res "
306282 fi
307283 done < $ISSUES .bak > $ISSUES
308284 )
309- # generate_html >$HTML
310285}
311286
312287inc_prio ()
@@ -322,16 +297,17 @@ inc_prio ()
322297 cp $ISSUES $ISSUES .bak
323298 (
324299 IFS=' '
325- while read num1 prio desc ref own1 date1 date2 comment res; do
326- if [ " $num1 " = " $num " ]; then
300+ i=0
301+ while read who prio desc ref own1 date1 date2 comment res; do
302+ i=` expr $i + 1`
303+ if [ " $i " = " $num " ]; then
327304 prio=` expr $prio + 1`
328- pr " $num1 $prio $desc $ref $own1 $date1 $date2 $comment $res "
305+ pr " $who $prio $desc $ref $own1 $date1 $date2 $comment $res "
329306 else
330- pr " $num1 $prio $desc $ref $own1 $date1 $date2 $comment $res "
307+ pr " $who $prio $desc $ref $own1 $date1 $date2 $comment $res "
331308 fi
332- done < $ISSUES .bak | sort -k 2nr,3 -k 1n,2 > $ISSUES
309+ done < $ISSUES .bak > $ISSUES
333310 )
334- # generate_html >$HTML
335311}
336312
337313dec_prio ()
@@ -347,16 +323,17 @@ dec_prio ()
347323 cp $ISSUES $ISSUES .bak
348324 (
349325 IFS=' '
350- while read num1 prio desc ref own1 date1 date2 comment res; do
351- if [ " $num1 " = " $num " ]; then
326+ i=0
327+ while read who prio desc ref own1 date1 date2 comment res; do
328+ i=` expr $i + 1`
329+ if [ " $i " = " $num " ]; then
352330 prio=` expr $prio - 1`
353- pr " $num1 $prio $desc $ref $own1 $date1 $date2 $comment $res "
331+ pr " $who $prio $desc $ref $own1 $date1 $date2 $comment $res "
354332 else
355- pr " $num1 $prio $desc $ref $own1 $date1 $date2 $comment $res "
333+ pr " $who $prio $desc $ref $own1 $date1 $date2 $comment $res "
356334 fi
357- done < $ISSUES .bak | sort -k 2nr,3 -k 1n,2 > $ISSUES
335+ done < $ISSUES .bak > $ISSUES
358336 )
359- # generate_html >$HTML
360337}
361338
362339interactive ()
0 commit comments