cookutils diff lighttpd/index.cgi @ rev 1029

lighttpd/index.cgi: sort packages on the tag page, misc tiny edits
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Feb 02 17:32:09 2018 +0200 (2018-02-02)
parents 7d37b282b4fb
children cb2fe4f46a08
line diff
     1.1 --- a/lighttpd/index.cgi	Fri Feb 02 00:51:10 2018 +0200
     1.2 +++ b/lighttpd/index.cgi	Fri Feb 02 17:32:09 2018 +0200
     1.3 @@ -78,17 +78,20 @@
     1.4  # HTML page header
     1.5  
     1.6  page_header() {
     1.7 -	local theme t='' css pretitle='' cmd
     1.8 +	local theme t='' css pretitle='' command
     1.9  	theme=$(COOKIE theme)
    1.10  	[ "$theme" == 'default' ] && theme=''
    1.11  	[ -n "$theme" ] && theme="-$theme"
    1.12  	css="cooker$theme.css"
    1.13  
    1.14  	if [ -n "$pkg" ]; then
    1.15 -		pretitle="$pkg - "
    1.16 +		case "$pkg" in
    1.17 +			~) pretitle="Tag \"$cmd\" - ";;
    1.18 +			*) pretitle="$pkg - ";;
    1.19 +		esac
    1.20  	else
    1.21 -		cmd="$(cat $command)"
    1.22 -		[ -n "$cmd" ] && pretitle="$cmd - "
    1.23 +		command="$(cat $command)"
    1.24 +		[ -n "$command" ] && pretitle="$command - "
    1.25  	fi
    1.26  
    1.27  	echo -e 'Content-Type: text/html; charset=UTF-8\n'
    1.28 @@ -1102,14 +1105,16 @@
    1.29  	</thead>
    1.30  	<tbody>
    1.31  EOT
    1.32 -	awk -F$'\t' -vtag=" $tag " -vbase="$base" '{
    1.33 +	sort $PKGS/packages.info \
    1.34 +	| awk -F$'\t' -vtag=" $tag " -vbase="$base" '{
    1.35  		if (index(" " $6 " ", tag)) {
    1.36  			url = base "/" $1 "/";
    1.37  			gsub("+", "%2B", url);
    1.38 -			printf("<tr><td><a href=\"%s\">%s</a></td><td>%s</td><td>%s</td></tr>\n", url, $1, $4, $3);
    1.39 +			printf("<tr><td><img src=\"%s/s/%s\"> ", base, $1);
    1.40 +			printf("<a href=\"%s\">%s</a></td><td>%s</td><td>%s</td></tr>\n", url, $1, $4, $3);
    1.41  		}
    1.42 -	}' $PKGS/packages.info
    1.43 -	echo '</tbody></table>'
    1.44 +	}'
    1.45 +	echo '</tbody></table></section></div>'
    1.46  	page_footer
    1.47  	exit 0
    1.48  fi