wok-next rev 3461
mirror-tools/search.cgi: add receipt object
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jun 16 09:22:41 2009 +0200 (2009-06-16) |
parents | c7e7f915b4f1 |
children | bc0a71a7371e |
files | mirror-tools/stuff/var/www/pkgs/search.cgi |
line diff
1.1 --- a/mirror-tools/stuff/var/www/pkgs/search.cgi Tue Jun 16 09:10:38 2009 +0200 1.2 +++ b/mirror-tools/stuff/var/www/pkgs/search.cgi Tue Jun 16 09:22:41 2009 +0200 1.3 @@ -29,6 +29,9 @@ 1.4 tags=*) 1.5 SEARCH=${i#*=} 1.6 OBJECT=Tags;; 1.7 + receipt=*) 1.8 + SEARCH=${i#*=} 1.9 + OBJECT=Receipt;; 1.10 filelist=*) 1.11 SEARCH=${i#*=} 1.12 OBJECT=File_list;; 1.13 @@ -51,6 +54,7 @@ 1.14 File) selected_file="selected";; 1.15 Desc) selected_desc="selected";; 1.16 Tags) selected_tags="selected";; 1.17 +Receipt) selected_receipt="selected";; 1.18 File_list) selected_file_list="selected";; 1.19 Depends) selected_depends="selected";; 1.20 esac 1.21 @@ -77,6 +81,7 @@ 1.22 file="File" 1.23 desc="Description" 1.24 tags="Tags" 1.25 +receipt="Receipt" 1.26 file_list="File list" 1.27 depends="Depends" 1.28 search="Search" 1.29 @@ -91,6 +96,7 @@ 1.30 case "$LANG" in 1.31 1.32 fr) package="Paquet" 1.33 + receipt="Recette" 1.34 depends="Dépendances" 1.35 search="Recherche" 1.36 result="Recherche de : $SEARCH" 1.37 @@ -156,24 +162,25 @@ 1.38 cat << _EOT_ 1.39 1.40 <div style="text-align: center; padding: 20px;"> 1.41 -<form method="POST" action="search.cgi"> 1.42 - <input type="hidden" name="lang" value="$LANG"> 1.43 +<form method="post" action="search.cgi"> 1.44 + <input type="hidden" name="lang" value="$LANG" /> 1.45 <select name="object"> 1.46 <option value="Package">$package</option> 1.47 <option $selected_desc value="Desc">$desc</option> 1.48 <option $selected_tags value="Tags">$tags</option> 1.49 + <option $selected_receipt value="Receipt">$receipt</option> 1.50 <option $selected_depends value="Depends">$depends</option> 1.51 <option $selected_file value="File">$file</option> 1.52 <option $selected_file_list value="File_list">$file_list</option> 1.53 </select> 1.54 <strong>:</strong> 1.55 - <input type="text" name="query" size="32" value="$SEARCH"> 1.56 + <input type="text" name="query" size="32" value="$SEARCH" /> 1.57 <select name="version"> 1.58 <option value="cooking">$cooking</option> 1.59 <option $selected_stable value="stable">$stable</option> 1.60 <option $selected_1 value="1.0">1.0</option> 1.61 </select> 1.62 - <input type="submit" name="search" value="$search"> 1.63 + <input type="submit" name="search" value="$search" /> 1.64 </form> 1.65 </div> 1.66 _EOT_ 1.67 @@ -329,6 +336,18 @@ 1.68 done 1.69 } 1.70 1.71 +# Check package exists 1.72 +package_exist() 1.73 +{ 1.74 + [ -f $WOK/$1/receipt ] && return 0 1.75 + cat << _EOT_ 1.76 + 1.77 +<h3>$noresult</h3> 1.78 +<pre class="package"> 1.79 +_EOT_ 1.80 + return 1 1.81 +} 1.82 + 1.83 # Display search form and result if requested. 1.84 if [ "$REQUEST_METHOD" != "POST" ]; then 1.85 xhtml_header 1.86 @@ -368,7 +387,7 @@ 1.87 _EOT_ 1.88 search_form 1.89 if [ "$OBJECT" = "Depends" ]; then 1.90 - if [ -f $WOK/$SEARCH/receipt ]; then 1.91 + if package_exist $SEARCH ; then 1.92 cat << _EOT_ 1.93 1.94 <h3>$deptree</h3> 1.95 @@ -396,12 +415,6 @@ 1.96 _EOT_ 1.97 ALL_DEPS="" 1.98 rdep_scan $SEARCH 1.99 - else 1.100 - cat << _EOT_ 1.101 - 1.102 -<h3>$noresult</h3> 1.103 -<pre class="package"> 1.104 -_EOT_ 1.105 fi 1.106 elif [ "$OBJECT" = "File" ]; then 1.107 cat << _EOT_ 1.108 @@ -426,7 +439,7 @@ 1.109 echo " $file" 1.110 done 1.111 elif [ "$OBJECT" = "File_list" ]; then 1.112 - cat << _EOT_ 1.113 + package_exist $SEARCH && cat << _EOT_ 1.114 1.115 <h3>$result</h3> 1.116 <pre class="package"> 1.117 @@ -462,6 +475,19 @@ 1.118 <a href="$SLITAZ_VERSION/$CATEGORY.html#$PACKAGE">$PACKAGE</a> : $SHORT_DESC 1.119 _EOT_ 1.120 done 1.121 + elif [ "$OBJECT" = "Receipt" ]; then 1.122 + package_exist $SEARCH && cat << _EOT_ 1.123 + 1.124 +<h3>$result</h3> 1.125 +<pre class="package"> 1.126 +<pre> 1.127 +$(if [ -f $WOK/$SEARCH/taz/*/receipt ]; then 1.128 + cat $WOK/$SEARCH/taz/*/receipt 1.129 + else 1.130 + cat $WOK/$SEARCH//receipt 1.131 + fi | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g') 1.132 +</pre> 1.133 +_EOT_ 1.134 else 1.135 cat << _EOT_ 1.136