tazpkg rev 758
pkgs.cgi: use data-icon for packages icons; fix and add button "Toggle all" to all packages lists.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Mar 27 14:31:21 2015 +0200 (2015-03-27) |
parents | 0dd5c5995b4f |
children | 47f112cf1ad0 |
files | tazpanel/pkgs.cgi |
line diff
1.1 --- a/tazpanel/pkgs.cgi Fri Mar 27 10:33:13 2015 +0200 1.2 +++ b/tazpanel/pkgs.cgi Fri Mar 27 14:31:21 2015 +0200 1.3 @@ -33,7 +33,7 @@ 1.4 1.5 pkg_info_link() 1.6 { 1.7 - echo "<a class=\"$2\" href=\"?info=${1//+/%2B}\">$1</a>" | sed 's| class=""||' 1.8 + echo "<a data-icon=\"$2\" href=\"?info=${1//+/%2B}\">$1</a>" | sed 's| data-icon=""||' 1.9 } 1.10 1.11 1.12 @@ -320,7 +320,7 @@ 1.13 if (PKG && PKG != $1) { 1.14 if (SEL) { 1.15 if (DSCL) DSC = DSCL 1.16 - printf "<tr><td><input type=\"checkbox\" name=\"pkg\" value=\"%s\"><a class=\"pkg%s%s\" href=\"?info=%s\">%s</a></td><td>%s</td><td>%s</td><td><a href=\"%s\"></a></td></tr>\n", PKG, INS, BLK, gensub(/\+/, "%2B", "g", PKG), PKG, VER, DSC, WEB 1.17 + printf "<tr><td><input type=\"checkbox\" name=\"pkg\" value=\"%s\"><a data-icon=\"pkg%s%s\" href=\"?info=%s\">%s</a></td><td>%s</td><td>%s</td><td><a href=\"%s\"></a></td></tr>\n", PKG, INS, BLK, gensub(/\+/, "%2B", "g", PKG), PKG, VER, DSC, WEB 1.18 } 1.19 VER = DSC = WEB = DSCL = INS = BLK = SEL = "" 1.20 } 1.21 @@ -398,10 +398,10 @@ 1.22 i18n_desc $pkg 1.23 cat << EOT 1.24 <tr> 1.25 - <td><input type="checkbox" name="pkg" value="$pkg" /><a class="pkg" href="?info=${pkg//+/%2B}">$pkg</a></td> 1.26 + <td><input type="checkbox" name="pkg" value="$pkg" /><a data-icon="pkg" href="?info=${pkg//+/%2B}">$pkg</a></td> 1.27 <td>$VERSION</td> 1.28 <td>$SHORT_DESC</td> 1.29 - <td><a class="w" href="$WEB_SITE"></a></td> 1.30 + <td><a data-img="web" href="$WEB_SITE"></a></td> 1.31 </tr> 1.32 EOT 1.33 done 1.34 @@ -482,10 +482,16 @@ 1.35 <h2>$(_ 'Packages list')</h2> 1.36 <p>$title</p> 1.37 1.38 -<form class="wide actions"> 1.39 - $(_ 'Selection:') 1.40 - $([ "$my" != 'my' ] && show_button do=Install) 1.41 - $(show_button do=Remove) 1.42 +<div>$(_ 'Selection:'; 1.43 + { 1.44 + [ "$my" != 'my' ] && show_button do=Install 1.45 + show_button do=Remove 1.46 + } | sed 's|button |button form="pkglist" |g') 1.47 + <button data-icon="toggle" onclick="checkBoxes(window)">$(_ 'Toggle all')</button> 1.48 + <div class="float-right">$(show_button recharge)</div> 1.49 +</div> 1.50 + 1.51 +<form id="pkglist" class="wide"> 1.52 EOT 1.53 for i in $(repo_list ""); do 1.54 show_list ${my#no} 1.55 @@ -511,11 +517,12 @@ 1.56 cat << EOT 1.57 <h2>$(_ 'Search packages')</h2> 1.58 1.59 -<form class="wide"> 1.60 -<div id="actions"> 1.61 - $(_ 'Selection:'; show_button do=Install do=Remove) 1.62 - <a href="$(cat $PANEL/lib/checkbox.js)">$(_ 'Toogle all')</a> 1.63 +<div>$(_ 'Selection:'; 1.64 + show_button do=Install do=Remove | sed 's|button |button form="pkglist" |g') 1.65 + <button data-icon="toggle" onclick="checkBoxes(window)">$(_ 'Toggle all')</button> 1.66 </div> 1.67 + 1.68 +<form id="pkglist" class="wide"> 1.69 EOT 1.70 if [ -n "$(GET files)" ]; then 1.71 cat <<EOT 1.72 @@ -590,12 +597,13 @@ 1.73 cat << EOT 1.74 <h2>$(_ 'Up packages')</h2> 1.75 1.76 -<form> 1.77 -<div id="actions"> 1.78 - $(_ 'Selection:'; show_button do=Install do=Remove) 1.79 - <button class="button" onclick="$(cat $PANEL/lib/checkbox.js)">$(_ 'Toogle all')</button> 1.80 +<div>$(_ 'Selection:'; 1.81 + show_button do=Install do=Remove | sed 's|button |button form="pkglist" |g') 1.82 + <button data-icon="toggle" onclick="checkBoxes(window)">$(_ 'Toggle all')</button> 1.83 <div class="float-right">$(show_button recharge)</div> 1.84 </div> 1.85 + 1.86 +<form id="pkglist" class="wide"> 1.87 EOT 1.88 # Ask tazpkg to make "packages.up" file 1.89 tazpkg up --check >/dev/null 1.90 @@ -702,12 +710,11 @@ 1.91 </form> 1.92 </header> 1.93 1.94 - <div> 1.95 <table class="wide zebra summary"> 1.96 <tbody> 1.97 <tr><td><b>$(_ 'Name')</b></td><td>$PACKAGE</td></tr> 1.98 <tr><td><b>$(_ 'Version')</b></td><td>$VERSION</td></tr> 1.99 - <tr><td><b>$(_ 'Category')</b></td><td><a href="?cat=$CATEGORY">$CATEGORY</a></td></tr> 1.100 + <tr><td><b>$(_ 'Category')</b></td><td><a href="?list&cat=$CATEGORY">$CATEGORY</a></td></tr> 1.101 <tr><td><b>$(_ 'Description')</b></td><td>$SHORT_DESC</td></tr> 1.102 $([ -n "$MAINTAINER" ] && echo "<tr><td><b>$(_ 'Maintainer')</b></td><td>$MAINTAINER</td></tr>") 1.103 $([ -n "$LICENSE" ] && echo "<tr><td><b>$(_ 'License')</b></td><td><a href=\"?license=$pkg\">$LICENSE</a></td></tr>") 1.104 @@ -718,7 +725,6 @@ 1.105 $(show_info_links "$SUGGESTED" "$(_ 'Suggested')" 'info') 1.106 </tbody> 1.107 </table> 1.108 -</div> 1.109 </section> 1.110 EOT 1.111 1.112 @@ -1119,11 +1125,13 @@ 1.113 cat << EOT 1.114 <h2 data-icon="tag">$(_ 'Tag "%s"' $tag)</h2> 1.115 1.116 -<form> 1.117 -<div id="actions"> 1.118 - $(_ 'Selection:'; show_button do=Install do=Remove) 1.119 +<div>$(_ 'Selection:'; 1.120 + show_button do=Install do=Remove | sed 's|button |button form="pkglist" |g') 1.121 + <button data-icon="toggle" onclick="checkBoxes(window)">$(_ 'Toggle all')</button> 1.122 <div class="float-right">$(show_button tags)</div> 1.123 </div> 1.124 + 1.125 +<form id="pkglist" class="wide"> 1.126 EOT 1.127 for i in $(repo_list ""); do 1.128 show_list all 1.129 @@ -1150,7 +1158,7 @@ 1.130 for i in $(cat $PKGS_DB/blocked-packages.list); do 1.131 awk -F$'\t' -vp="$i" '{ 1.132 if ($1 == p) 1.133 - printf "<tr><td><input type=\"checkbox\" name=\"pkg\" value=\"%s\"><a class=\"pkgib\" href=\"?info=%s\">%s</a></td><td>%s</td><td>%s</td><td><a href=\"%s\"></a></td></tr>\n", $1, gensub(/\+/, "%2B", "g", $1), $1, $2, $4, $5 1.134 + printf "<tr><td><input type=\"checkbox\" name=\"pkg\" value=\"%s\"><a data-icon=\"pkgib\" href=\"?info=%s\">%s</a></td><td>%s</td><td>%s</td><td><a href=\"%s\"></a></td></tr>\n", $1, gensub(/\+/, "%2B", "g", $1), $1, $2, $4, $5 1.135 }' $PKGS_DB/installed.info 1.136 done 1.137 echo '</tbody></table></form>'