tazbug view web/plugins/textmode/textmode.cgi @ rev 137
Update all plugins to use new storage paths
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Feb 22 14:59:49 2017 +0100 (2017-02-22) |
parents | 7bf28563c0f6 |
children | 2a172aca8228 |
line source
1 #!/bin/sh
2 #
3 # TazBug Plugin - Textmode will output plain data to be used by remote client
4 #
6 if [ "$(GET textmode)" ]; then
7 header "Content-type: text/plain; charset=UTF-8"
9 separator() {
10 echo "-------------------------------------------------------------------------------"
11 }
13 case " $(GET) " in
15 *\ stats\ *)
16 echo "Bugs count : $(ls_bugs | wc -l)"
17 echo "Messages count : $(find $bugdir -name msg.* | wc -l)"
18 echo "Database size : $(du -sh $bugdir | awk '{print $1}')" ;;
20 *\ search\ *)
21 for bug in $(ls_bugs)
22 do
23 set_bugdir "$bug"
24 result=$(fgrep -i -h "$(GET search)" $bugdir/$bug/*)
25 if [ "$result" ]; then
26 found=$(($found + 1))
27 . ${bugdir}/${bug}/bug.conf
28 echo "Bug: $bug - $BUG"
29 fi
30 done
31 if [ "$found" == "" ]; then
32 echo "No result found for: $(GET search)"
33 else
34 separator && echo "$found result(s) found"
35 fi ;;
37 *\ id\ *)
38 # Show bug information and description
39 id=$(GET id)
40 set_bugdir "$id"
41 if [ -f "$bugdir/$id/bug.conf" ]; then
42 . ${bugdir}/${id}/bug.conf
43 cat << EOT
44 Bug : $id - $STATUS - $PRIORITY
45 Title : $BUG
46 Info : $DATE - Creator: $CREATOR
47 $(separator)
48 $(cat $bugdir/$id/desc.txt)
49 EOT
50 else
51 echo "Can't find bug ID: $id" && exit 0
52 fi ;;
54 *)
55 cat << EOT
56 Tazbug Textmode plugin
57 $(separator)
58 $(date)
60 Functions:
61 &stats Display bug tracker stats
62 &search= Search for bugs by pattern
63 &id= Show bug info and description
64 EOT
65 ;;
66 esac
67 exit 0
68 fi