tazbug rev 98

Use desc.txt for bug description
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 10 14:54:49 2017 +0100 (2017-02-10)
parents 8c3d1f530e15
children f3aff0cd7229
files web/bugs.cgi
line diff
     1.1 --- a/web/bugs.cgi	Thu Feb 09 18:35:56 2017 +0100
     1.2 +++ b/web/bugs.cgi	Fri Feb 10 14:54:49 2017 +0100
     1.3 @@ -2,7 +2,7 @@
     1.4  #
     1.5  # TazBug Web interface
     1.6  #
     1.7 -# Copyright (C) 2012-2014 SliTaz GNU/Linux - BSD License
     1.8 +# Copyright (C) 2012-2017 SliTaz GNU/Linux - BSD License
     1.9  #
    1.10  . /usr/lib/slitaz/httphelper
    1.11  
    1.12 @@ -299,7 +299,7 @@
    1.13  </p>
    1.14  
    1.15  <pre>
    1.16 -$(echo "$DESC" | wiki_parser)
    1.17 +$(cat $bugdir/$id/desc.txt | wiki_parser)
    1.18  </pre>
    1.19  
    1.20  <div id="tools">
    1.21 @@ -385,7 +385,8 @@
    1.22  		USER="$user"
    1.23  	fi
    1.24  	mkdir -p $bugdir/$count
    1.25 -	sed "s/$(echo -en '\r') /\n/g" > $bugdir/$count/bug.tmp << EOT
    1.26 +	# bug.conf
    1.27 +	sed "s/$(echo -en '\r') /\n/g" > $bugdir/$count/bug.conf << EOT
    1.28  # SliTaz Bug configuration
    1.29  
    1.30  BUG="$(GETfiltered bug)"
    1.31 @@ -394,11 +395,13 @@
    1.32  CREATOR="$USER"
    1.33  DATE="$date"
    1.34  PKGS="$(GETfiltered pkgs)"
    1.35 -
    1.36 -DESC="$(GETfiltered desc)"
    1.37  EOT
    1.38 -	fold -s -w 80 $bugdir/$count/bug.tmp > $bugdir/$count/bug.conf
    1.39 -	rm -f $bugdir/$count/bug.tmp
    1.40 +	# desc.txt
    1.41 +	sed "s/$(echo -en '\r') /\n/g" > $bugdir/$count/desc.tmp << EOT
    1.42 +$(GETfiltered desc)
    1.43 +EOT
    1.44 +	fold -s -w 80 $bugdir/$count/desc.tmp > $bugdir/$count/desc.txt
    1.45 +	rm -f $bugdir/$count/*.tmp
    1.46  }
    1.47  
    1.48  # New bug page for the web interface
    1.49 @@ -446,16 +449,45 @@
    1.50  }
    1.51  
    1.52  
    1.53 -# Edit/Save a bug configuration file
    1.54 +# Edit/Save a bug
    1.55  edit_bug() {
    1.56 +	. $bugdir/$id/bug.conf
    1.57  	cat << EOT
    1.58  <h2>$(eval_gettext 'Edit Bug $bug')</h2>
    1.59  <div id="edit">
    1.60  
    1.61  <form method="get" action="$script">
    1.62 -	<textarea name="bugconf">$(cat $bugdir/$bug/bug.conf)</textarea>
    1.63 -	<input type="hidden" name="bug" value="$bug" />
    1.64 -	<input type="submit" value="$(gettext 'Save configuration')" />
    1.65 +	<input type="hidden" name="savebug" />
    1.66 +	<input type="hidden" name="id" value="$id" />
    1.67 +	<input type="hidden" name="creator" value="$CREATOR" />
    1.68 +	<input type="hidden" name="date" value="$DATE" />
    1.69 +	<table>
    1.70 +		<tbody>
    1.71 +			<tr>
    1.72 +				<td>$(gettext "Bug title")</td>
    1.73 +				<td><input type="text" name="bug" value="$BUG" /></td>
    1.74 +			</tr>
    1.75 +			<tr>
    1.76 +				<td>$(gettext "Description")</td>
    1.77 +				<td><textarea name="desc">$(cat $bugdir/$id/desc.txt)</textarea></td>
    1.78 +			</tr>
    1.79 +			<tr>
    1.80 +				<td>$(gettext "Packages")</td>
    1.81 +				<td><input type="text" name="pkgs" value="$PKGS" /></td>
    1.82 +			</tr>
    1.83 +			<tr>
    1.84 +				<td>$(gettext "Priority")</td>
    1.85 +				<td>
    1.86 +					<select name="priority">
    1.87 +						<option value="$PRIORITY">$PRIORITY</option>
    1.88 +						<option value="standard">$(gettext "Standard")</option>
    1.89 +						<option value="critical">$(gettext "Critical")</option>
    1.90 +					</select>
    1.91 +					<input type="submit" value="$(gettext 'Save configuration')" />
    1.92 +				</td>
    1.93 +			</tr>
    1.94 +		</tbody>
    1.95 +	</table>
    1.96  </form>
    1.97  
    1.98  </div>
    1.99 @@ -463,13 +495,24 @@
   1.100  }
   1.101  
   1.102  save_bug() {
   1.103 -	bug="$(GET bug)"
   1.104 -	content="$(GET bugconf)"
   1.105 -	sed "s|\"|'|" | sed "s/$(echo -en '\r') /\n/g" > $bugdir/$bug/bug.tmp << EOT
   1.106 -$content
   1.107 +	id="$(GET id)"
   1.108 +	# bug.conf
   1.109 +	sed "s/$(echo -en '\r') /\n/g" > $bugdir/$id/bug.conf << EOT
   1.110 +# SliTaz Bug configuration
   1.111 +
   1.112 +BUG="$(GETfiltered bug)"
   1.113 +STATUS="OPEN"
   1.114 +PRIORITY="$(GET priority)"
   1.115 +CREATOR="$(GET creator)"
   1.116 +DATE="$(GET date)"
   1.117 +PKGS="$(GETfiltered pkgs)"
   1.118  EOT
   1.119 -	fold -s -w 80 $bugdir/$bug/bug.tmp > $bugdir/$bug/bug.conf
   1.120 -	rm -f $bugdir/$bug/bug.tmp
   1.121 +	# desc.txt
   1.122 +	sed "s/$(echo -en '\r') /\n/g" > $bugdir/$id/desc.tmp << EOT
   1.123 +$(GETfiltered desc)
   1.124 +EOT
   1.125 +	fold -s -w 80 $bugdir/$id/desc.tmp > $bugdir/$id/desc.txt
   1.126 +	rm -f $bugdir/$id/*.tmp
   1.127  }
   1.128  
   1.129  # Close a fixed bug
   1.130 @@ -660,7 +703,7 @@
   1.131  		fi
   1.132  		html_footer ;;
   1.133  	*\ newbug\ *)
   1.134 -		# Add a bug from web interface.
   1.135 +		# Create a bug from web interface.
   1.136  		header
   1.137  		html_header
   1.138  		user_box
   1.139 @@ -671,7 +714,7 @@
   1.140  		fi
   1.141  		html_footer ;;
   1.142  	*\ addbug\ *)
   1.143 -		# Add a bug from web interface.
   1.144 +		# Save a new bug from web interface.
   1.145  		header
   1.146  		html_header
   1.147  		if check_auth; then
   1.148 @@ -679,18 +722,19 @@
   1.149  			js_redirection_to "$script?id=$count"
   1.150  		fi ;;
   1.151  	*\ edit\ *)
   1.152 -		bug="$(GET edit)"
   1.153 +		# Edit existing bug
   1.154 +		id="$(GET edit)"
   1.155  		header
   1.156  		html_header
   1.157  		user_box
   1.158  		edit_bug
   1.159  		html_footer ;;
   1.160 -	*\ bugconf\ *)
   1.161 +	*\ savebug\ *)
   1.162  		header
   1.163  		html_header
   1.164  		if check_auth; then
   1.165  			save_bug
   1.166 -			js_redirection_to "$script?id=$bug"
   1.167 +			js_redirection_to "$script?id=$id"
   1.168  		fi ;;
   1.169  	*\ id\ *)
   1.170  		# Empty deleted messages to keep msg count working.