tazpanel view index.cgi @ rev 463

Add prism.js syntax highlighter; now files can be edited "in place" without page reloading; allow ANY characters in the Wi-Fi password (bug 126); change web-app layout: main window isn't scrollable, with scrollable contents.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Apr 24 16:00:14 2015 +0300 (2015-04-24)
parents d0dbe11a2060
children 836e45b5567b
line source
1 #!/bin/sh
2 #
3 # Main CGI interface for TazPanel. In on word: KISS. Use the main CSS form
4 # command so we are faster and do not load unneeded functions. If necessary
5 # you can use the lib/ dir to handle external resources.
6 #
7 # Copyright (C) 2011-2015 SliTaz GNU/Linux - BSD License
8 #
11 # Common functions from libtazpanel
13 . lib/libtazpanel
14 get_config
16 TITLE="TazPanel"
20 # Check whether a configuration file has been modified after installation
22 file_is_modified() {
23 grep -l " $1$" $INSTALLED/*/md5sum | while read file; do
25 # Found, but can we do diff?
26 [ "$(grep -h " $1$" $file)" != "$(md5sum $1)" ] || break
27 orig=$(dirname $file)/volatile.cpio.gz
28 zcat $orig 2>/dev/null | cpio -t 2>/dev/null | grep -q "^${1#/}$" || break
30 case "$2" in
31 diff)
32 tmp=$(mktemp -d)
33 ( cd $tmp; zcat $orig | cpio -id ${1#/} )
34 diff -abu $tmp$1 $1 | sed "s|$tmp||"
35 rm -rf $tmp;;
36 button)
37 echo -n '<button name="action" value="diff" data-icon="diff">'$(_ 'Differences')'</button>';;
38 esac
39 break
40 done
41 }
45 # OK status in table
47 ok_status_t() {
48 echo '<td><span class="diff-add" data-img="ok"></span></td></tr>'
49 }
53 # Terminal prompt
55 term_prompt() {
56 if [ "$user" == 'root' ]; then
57 local color1='color31' sign='#'
58 else
59 local color1='color32' sign='$'
60 fi
61 echo -n "<span class='$color1'>$user@$(hostname)</span>:<span class='color33'>"
62 pwd | sed "s|^$HOME|~|" | tr -d '\n'; echo -n "</span>$sign "
63 }
67 #
68 # Things to do before displaying the page
69 #
71 [ -n "$(GET panel_pass)" ] &&
72 sed -i s@/:root:.*@/:root:$(GET panel_pass)@ $HTTPD_CONF
78 #
79 # Commands
80 #
82 case " $(GET) " in
85 *\ exec\ *)
86 # Execute command and display its result in a terminal-like window
88 header; TITLE=$(_ 'TazPanel - exec'); xhtml_header
90 exec="$(GET exec)"
91 font="${TERM_FONT:-monospace}"
92 palette=$(echo $TERM_PALETTE | tr A-Z a-z)
94 cat <<EOT
95 <section>
96 <header>
97 $exec
98 $(back_button "$(GET back)" "$(GET back_caption)" "$(GET back_icon)")
99 </header>
100 <div class="term_">
101 <pre class="term $palette" style="font-family: '$font'">$($exec 2>&1 | htmlize | filter_taztools_msgs)</pre>
102 </div>
103 </section>
104 EOT
105 ;;
108 *\ file\ *)
109 #
110 # Handle files
111 #
112 header
113 file="$(GET file)"
114 action="$(POST action)"; [ -z "$action" ] && action="$(GET action)" # receive 'action' both on POST or GET
115 title="$(POST title)"; [ -z "$title" ] && title="$(GET title)" # (optional)
117 case $file in
118 *.html)
119 cat $file; exit 0 ;;
120 *)
121 TITLE=$(_ 'TazPanel - File'); xhtml_header ;;
122 esac
124 case "$action" in
125 edit)
126 cat <<EOT
127 <section>
128 <header>
129 <span data-icon="edit">${title:-$file}</span>
130 <form id="editform" method="post" action="?file=$file">
131 <button data-icon="save">$(_ 'Save')</button>
132 <button name="action" value="diff" data-icon="diff">$(_ 'Differences')</button>
133 </form>
134 </header>
135 <textarea form="editform" name="content" class="wide" rows="30" autofocus>$(cat $file | htmlize)</textarea>
136 </section>
137 EOT
138 #The space before textarea gets muddled when the form is submitted.
139 #It prevents anything else from getting messed up
140 ;;
142 setvar)
143 data="$(. $(GET file) ;eval echo \$$(GET var))"
144 cat <<EOT
145 <section>
146 <header>$(GET var)</header>
147 <form method="post" action="?file=$file" class="nogap">
148 <input type="hidden" name="var" value="$(GET var)">
149 <input type="text" name="content" value="${data:-$(GET default)}">
150 <button type="submit" data-icon="save">$(_ 'Save')</button>
151 </form>
152 </section>
153 EOT
154 ;;
156 diff)
157 cat <<EOT
158 <section>
159 <pre id="diff">$(file_is_modified $file diff | syntax_highlighter diff)</pre>
160 </section>
161 EOT
162 ;;
164 *)
165 R=$(echo -en '\r')
166 if [ -n "$(POST content)" ]; then
167 if [ -n "$(POST var)" ]; then
168 sed -i "s|^\\($(POST var)=\\).*|\1\"$(POST content)\"|" $file
169 else
170 sed "s/$R /\n/g;s/$R%0//g" > $file <<EOT
171 $(POST content)
172 EOT
173 fi
174 fi
176 cat <<EOT
177 <section class="bigNoScrollable">
178 <header>
179 <span data-icon="text">${title:-$file}</span>
180 EOT
181 if [ -w "$file" ]; then
182 cat <<EOT
183 <span class="float-right">
184 <button onclick='editFile()' id="edit_button" data-icon="edit">$(_ 'Edit')</button>
185 <button onclick='saveFile("$file", "$title")' id="save_button"
186 data-icon="save" style="display:none">$(_ 'Save')</button>
187 </span>
188 <!--form>
189 <input type="hidden" name="file" value="$file"/>
190 <button name="action" value="edit" data-icon="edit">$(_ 'Edit')</button><!--
191 -->$(file_is_modified $file button)
192 </form-->
193 EOT
194 elif [ -r "$file" ]; then
195 cat <<EOT
196 <form>
197 <input type="hidden" name="file" value="$file"/>
198 $(file_is_modified $file button)
199 </form>
200 EOT
201 fi
202 cat <<EOT
203 </header>
205 <div>
206 <pre id="fileContent" class="bigScrollable">
207 EOT
208 end_code=''
209 # Handle file type by extension as a Web Server does it.
210 case "$file" in
211 *.sh|*.cgi|*/receipt|*.conf)
212 echo '<code class="language-bash">'; end_code='</code>'
213 cat | htmlize ;;
214 *.ini)
215 echo '<code class="language-ini">'; end_code='</code>'
216 cat | htmlize ;;
217 *.conf|*.lst)
218 syntax_highlighter conf ;;
219 *Xorg.0.log)
220 syntax_highlighter xlog ;;
221 *dmesg.log)
222 syntax_highlighter kernel ;;
223 *)
224 cat | htmlize ;;
225 esac < $file
226 cat <<EOT
227 $end_code</pre>
228 </div>
229 </section>
230 EOT
231 esac
232 ;;
236 *\ terminal\ *|*\ cmd\ *)
237 # Cmdline terminal
239 header; TITLE=$(_ 'TazPanel - Terminal'); xhtml_header
241 user="$REMOTE_USER"
242 HOME="$(awk -F: -vu=$user '$1==u{print $6}' /etc/passwd)"
243 historyfile="$HOME/.ash_history"
245 cmd=$(GET cmd)
246 path="$(GET path)"; path="${path:-/tmp}"; cd "$path"
248 font="${TERM_FONT:-monospace}"
249 palette=$(echo $TERM_PALETTE | tr A-Z a-z)
251 [ -n "$cmd" -a "$cmd" != "$(tail -n1 $historyfile)" ] && echo "$cmd" >> $historyfile
254 # Terminal history
256 if [ "$cmd" == 'history' ]; then
257 cat <<EOT
258 <section>
259 <header>
260 $(_ 'History')
261 <form><button name="terminal" data-icon="terminal">$(_ 'Back')</button></form>
262 </header>
263 <form>
264 <input type="hidden" name="path" value="$path"/>
265 <pre class="term $palette" style="font-family: '$font'">
266 EOT
267 htmlize < $historyfile | awk -vrun="$(_ 'run')" -vpath="$path" '
268 BEGIN { num=1 }
269 {
270 printf("%3d ", num);
271 cmd = $0
272 gsub("%", "%25", cmd); gsub("+", "%2B", cmd); gsub(" ", "+", cmd);
273 gsub("\"", "%22", cmd); gsub("!", "%21", cmd); gsub("'\''", "%27", cmd);
274 printf("<a data-icon=\"run\" href=\"?cmd=%s&path=%s\">%s</a> ", cmd, path, run);
275 printf("<input type=\"checkbox\" name=\"rm\" value=\"%d\" id=\"hist%d\">", num, num);
276 printf("<label for=\"hist%d\">%s</label>\n", num, $0);
277 num++
278 }'
279 cat <<EOT
280 </pre>
281 <footer>
282 <button name="rmhistory" data-icon="remove">$(_ 'Clear')</button>
283 </footer>
284 </form>
285 </section>
286 EOT
287 xhtml_footer
288 exit 0
289 fi
292 # Terminal window
294 cat <<EOT
295 <span id="num_hist"></span>
296 <section>
297 <pre class="term $palette" style="font-family: '$font'" onclick="document.getElementById('typeField').focus()">
298 EOT
299 if [ -n "$cmd" ]; then
300 term_prompt
301 echo "$cmd" | htmlize
302 fi
304 case "$cmd" in
305 usage|help)
306 _ 'Small non-interactive terminal emulator.'; echo
307 _ 'Run any command at your own risk, avoid interactive commands (%s)' 'nano, mc, ...'; echo
308 ;;
309 wget*)
310 dl=/var/cache/downloads
311 [ ! -d "$dl" ] && mkdir -p $dl
312 _ 'Downloading to: %s' $dl; echo
313 cd $dl; $cmd 2>&1 ;;
314 cd|cd\ *)
315 path="${cmd#cd}"; path="${path:-$HOME}";
316 path="$(realpath $path)"; cd "$path" ;;
317 ls|ls\ *)
318 $cmd -w80 --color=always 2>&1 | filter_taztools_msgs ;;
319 cat)
320 # Cmd must be used with an arg.
321 _ '%s needs an argument' "$cmd" ;;
322 mc|nano|su)
323 # List of restricted (interactive) commands
324 _ "Please, don't run interactive command \"%s\"" "$cmd"; echo; echo ;;
325 *)
326 unset HTTP_REFERER # for fooling /lib/libtaz.sh formatting utils (<hr> in the terminal is so-so)
327 export DISPLAY=:0.0 # for run X applications
328 /bin/sh -c "$cmd" 2>&1 | htmlize | filter_taztools_msgs
329 ;;
330 esac
332 cat <<EOT
333 <form id="term">
334 <div class="cmdline" id="cmdline"><span id="prompt">$(term_prompt)</span><span id="typeField"> </span></div>
335 <input type="hidden" name="path" value="$(pwd)"/>
336 <input type="hidden" name="cmd" id="cmd"/>
337 </form>
338 </pre>
339 </section>
341 <form>
342 <button name="termsettings" data-icon="settings">$(_ 'Settings')</button>
343 <button name="cmd" value="history" data-icon="history">$(_ 'History')</button>
344 </form>
346 <script type="text/javascript">
347 with (document.getElementById('typeField')) {
348 contentEditable=true;
349 focus();
350 }
351 document.onkeydown=keydownHandler;
352 EOT
354 # Export history as array.
355 # Escape "all \"quotes\" in quotes", and all '\'
356 # (because \u, \x, \c has special meaning and can produce syntax error and stop js)
357 sed 's|\\|\\\\|g; s|"|\\"|g' $historyfile | awk '
358 BEGIN{ i=1; printf("ash_history=[") }
359 { printf("\"%s\",", $0); i++ }
360 END{
361 printf("\"\"];")
362 i--; printf("cur_hist=\"%d\";max_hist=\"%d\";", i, i)
363 }'
364 cat <<EOT
365 </script>
366 EOT
367 ;;
370 *\ rmhistory\ *)
371 # Manage shell commandline history
372 user="$REMOTE_USER"
373 [ -z "$HOME" ] && HOME="$(awk -F: -vu=$user '$1==u{print $6}' /etc/passwd)"
374 historyfile="$HOME/.ash_history"
376 # Return sed command for removing history lines ('8d12d' to remove 8 and 12 lines)
377 rms=$(echo $QUERY_STRING | awk 'BEGIN{RS="&";FS="="}{if($1=="rm")printf "%dd", $2}')
379 if [ -n "$rms" ]; then
380 # Actually remove lines
381 sed -i $rms $historyfile
382 # Redirects back to the history table
383 header "HTTP/1.1 301 Moved Permanently" "Location: ?terminal&cmd=history&path=$(GET path)"
384 exit 0
385 fi
386 ;;
389 *\ termsettings\ *)
390 # Terminal settings
391 TITLE=$(_ 'TazPanel - Terminal'); header; xhtml_header;
392 user="$REMOTE_USER"
393 font="$(GET font)"; font="${font:-$TERM_FONT}"
394 palette="$(GET palette)"; palette="${palette:-$TERM_PALETTE}"
395 pal=$(echo $palette | tr A-Z a-z)
397 # Add or change settings in TazPanel config
398 if [ -z "$TERM_FONT" ]; then
399 echo -e "\n# Terminal font family\nTERM_FONT=\"$font\"" >> $CONFIG
400 else
401 sed -i "s|TERM_FONT=.*|TERM_FONT=\"$font\"|" $CONFIG
402 fi
403 if [ -z "$TERM_PALETTE" ]; then
404 echo -e "\n# Terminal color palette\nTERM_PALETTE=\"$palette\"" >> $CONFIG
405 else
406 sed -i "s|TERM_PALETTE=.*|TERM_PALETTE=\"$palette\"|" $CONFIG
407 fi
409 cat <<EOT
410 <section style="position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: 0.5rem;">
411 <header>
412 $(_ 'Terminal settings')
413 <form>
414 <button name="terminal" data-icon="terminal">$(_ 'Terminal')</button>
415 </form>
416 </header>
417 <pre class="term $pal" style="height: auto; font-family: '$font'">
418 <span class='color31'>$user@$(hostname)</span>:<span class='color33'>~</span># palette
420 $(
421 for i in $(seq 30 37); do
422 for b in 0 1; do
423 for j in $(seq 40 47); do
424 echo -n "<span class=\"color$b color$i color$j\">$i:$j</span>"
425 done
426 done
427 echo
428 done
429 )
430 </pre>
431 <footer>
432 <form class="wide">
433 $(_ 'Font:')
434 <select name="font">
435 <option value="">$(_ 'Default')</option>
436 $(fc-list :spacing=mono:lang=en family | sed '/\.pcf/d;/,/d;s|\\-|-|g' | sort -u | \
437 awk -vfont="$font" '{
438 printf("<option value=\"%s\"%s>%s</option>\n", $0, ($0 == font)?" selected":"", $0)
439 }')
440 </select>
441 $(_ 'Palette:')
442 <select name="palette">
443 $(echo -e 'Tango\nLinux\nXterm\nRxvt\nEcho' | awk -vpal="$palette" '{
444 printf("<option value=\"%s\"%s>%s</option>\n", $0, ($0 == pal)?" selected":"", $0)
445 }')
446 </select>
447 <button name="termsettings" data-icon="ok">$(_ 'Apply')</button>
448 </form>
449 </footer>
450 </section>
451 EOT
453 ;;
456 *\ top\ *)
457 header; TITLE=$(_ 'TazPanel - Process activity'); xhtml_header
459 r=$(GET refresh)
460 cat <<EOT
461 <form>
462 <p>$(_ 'Refresh:')
463 <input type="hidden" name="top"/>
464 <input type="radio" name="refresh" value="1" id="r1" $([ "$r" == 1 ] && echo checked) onchange="this.form.submit()"/>
465 <label for="r1">$(_ '1s' )</label>
466 <input type="radio" name="refresh" value="5" id="r2" $([ "$r" == 5 ] && echo checked) onchange="this.form.submit()"/>
467 <label for="r2">$(_ '5s' )</label>
468 <input type="radio" name="refresh" value="10" id="r3" $([ "$r" == 10 ] && echo checked) onchange="this.form.submit()"/>
469 <label for="r3">$(_ '10s' )</label>
470 <input type="radio" name="refresh" value="" id="r4" $([ -z "$r" ] && echo checked) onchange="this.form.submit()"/>
471 <label for="r4">$(_ 'none')</label>
472 </p>
473 </form>
474 EOT
475 [ -n "$r" ] && echo "<meta http-equiv=\"refresh\" content=\"$r\">"
477 echo '<section><div><pre class="term log">'
478 top -n1 -b | htmlize | sed \
479 -e 's|^[A-Z].*:|<span class="color1 color31">\0</span>|g' \
480 -e 's|^\ *PID|<span class="color1 color32">\0</span>|g'
481 echo '</pre></div></section>' ;;
484 *\ debug\ *)
485 header; TITLE=$(_ 'TazPanel - Debug'); xhtml_header
487 cat <<EOT
488 <h2>$(_ 'HTTP Environment')</h2>
490 <section>
491 <div>
492 <pre>$(httpinfo | syntax_highlighter conf)</pre>
493 </div>
494 </section>
495 EOT
496 ;;
499 *\ report\ *)
500 header; TITLE=$(_ 'TazPanel - System report'); xhtml_header
502 [ -d /var/cache/slitaz ] || mkdir -p /var/cache/slitaz
503 output=/var/cache/slitaz/sys-report.html
505 cat <<EOT
507 <section>
508 <header>$(_ 'Reporting to: %s' "$output")</header>
509 <table class="wide zebra">
510 <tbody>
511 <tr><td>$(_ 'Creating report header...')</td>
512 EOT
513 cat > $output <<EOT
514 <!DOCTYPE html>
515 <html xmlns="http://www.w3.org/1999/xhtml">
516 <head>
517 <meta charset="utf-8"/>
518 <title>$(_ 'SliTaz system report')</title>
519 <style type="text/css">
520 body { padding: 20px 60px; font-size: 13px; }
521 h1, h2 { color: #444; }
522 pre { background: #f1f1f1; border: 1px solid #ddd;
523 padding: 10px; border-radius: 4px; }
524 span.diff-rm { color: red; }
525 span.diff-add { color: green; }
526 </style>
527 </head>
528 <body>
529 EOT
530 cat <<EOT
531 $(ok_status_t)
532 <tr><td>$(_ 'Creating system summary...')</td>
533 EOT
534 cat >> $output <<EOT
535 <h1>$(_ 'SliTaz system report')</h1>
536 $(_ 'Date:') $(date)
537 <pre>
538 uptime : $(uptime)
539 cmdline : $(cat /proc/cmdline)
540 version : $(cat /etc/slitaz-release)
541 packages : $(ls /var/lib/tazpkg/installed | wc -l) installed
542 kernel : $(uname -r)
543 </pre>
544 EOT
545 cat <<EOT
546 $(ok_status_t)
547 <tr><td>$(_ 'Getting hardware info...')</td>
548 EOT
549 cat >> $output <<EOT
550 <h2>free</h2>
551 <pre>$(free)</pre>
553 <h2>lspci -k</h2>
554 <pre>$(lspci -k)</pre>
556 <h2>lsusb</h2>
557 <pre>$(lsusb)</pre>
559 <h2>lsmod</h2>
560 <pre>$(lsmod)</pre>
562 EOT
563 cat <<EOT
564 $(ok_status_t)
565 <tr><td>$(_ 'Getting networking info...')</td>
566 EOT
567 cat >> $output <<EOT
568 <h2>ifconfig -a</h2>
569 <pre>$(ifconfig -a)</pre>
571 <h2>route -n</h2>
572 <pre>$(route -n)</pre>
574 <h2>/etc/resolv.conf</h2>
575 <pre>$(cat /etc/resolv.conf)</pre>
576 EOT
577 cat <<EOT
578 $(ok_status_t)
579 <tr><td>$(_ 'Getting filesystems info...')</td>
580 EOT
581 cat >> $output <<EOT
582 <h2>blkid</h2>
583 <pre>$(blkid)</pre>
585 <h2>fdisk -l</h2>
586 <pre>$(fdisk -l)</pre>
588 <h2>mount</h2>
589 <pre>$(mount)</pre>
591 <h2>df -h</h2>
592 <pre>$(df -h)</pre>
594 <h2>df -i</h2>
595 <pre>$(df -i)</pre>
596 EOT
597 cat <<EOT
598 $(ok_status_t)
599 <tr><td>$(_ 'Getting boot logs...')</td>
600 EOT
601 cat >> $output <<EOT
602 <h2>$(_ 'Kernel messages')</h2>
603 <pre>$(cat /var/log/dmesg.log)</pre>
605 <h2>$(_ 'Boot scripts')</h2>
606 <pre>$(cat /var/log/boot.log | filter_taztools_msgs)</pre>
607 EOT
608 cat <<EOT
609 $(ok_status_t)
610 <tr><td>$(_ 'Creating report footer...')</td>
611 EOT
612 cat cat >> $output <<EOT
613 </body>
614 </html>
615 EOT
616 cat <<EOT
617 $(ok_status_t)
618 </tbody>
619 </table>
620 <footer>
621 <form><button name="file" value="$output" data-icon="view">$(_ 'View')</button></form>
622 </footer>
623 </section>
626 $(msg tip "$(_ 'This report can be attached with a bug report on:')
627 <a href="http://bugs.slitaz.org/" target="_blank">bugs.slitaz.org</a></p>")
628 EOT
629 ;;
632 *)
633 #
634 # Default xHTML content
635 #
636 header; xhtml_header
637 [ -n "$(GET gen_locale)" ] && new_locale=$(GET gen_locale)
638 [ -n "$(GET rdate)" ] && echo ""
639 hostname=$(hostname)
641 cat <<EOT
642 <h2>$(_ 'Host: %s' $hostname)</h2>
643 <p>$(_ 'SliTaz administration and configuration Panel')<p>
645 <form class="nogap"><!--
646 --><button name="terminal" data-icon="terminal">$(_ 'Terminal')</button><!--
647 --><button name="top" data-icon="proc" >$(_ 'Process activity')</button><!--
648 --><button name="report" data-icon="report" data-root>$(_ 'Create a report')</button><!--
649 --></form>
651 <section>
652 <header>$(_ 'Summary')</header>
653 <table>
654 <tr><td>$(_ 'Uptime:')</td>
655 <td id="uptime">$(uptime | sed 's|\([0-9.:][0-9.:]*\)|<b>\1</b>|g')</td>
656 </tr>
657 <tr><td>$(_ 'Memory in Mb:')</td>
658 <td>$(free -m | grep Mem: | \
659 awk -vline="$(gettext 'Total: %d, Used: %d, Free: %d')" \
660 '{ printf(line, $2, $3, $4) }' | \
661 sed 's|\([0-9][0-9]*\)|<b>\1</b>|g')</td>
662 </tr>
663 <tr><td>$(_ 'Linux kernel:')</td>
664 <td>$(uname -r)</td>
665 </tr>
666 </table>
667 </section>
670 <section>
671 <header>
672 $(_ 'Network status')
673 <form action="network.cgi">
674 <button data-icon="wifi">$(_ 'Network')</button>
675 </form>
676 </header>
677 $(list_network_interfaces)
678 </section>
681 <section>
682 <header>
683 $(_ 'Filesystem usage statistics')
684 <form action="hardware.cgi">
685 <button data-icon="hdd">$(_ 'Disks')</button>
686 </form>
687 </header>
688 <table class="wide zebra center">
689 EOT
690 # Disk stats (management is done as hardware.cgi)
691 df_thead
692 echo '<tbody>'
693 df -h | grep ^/dev | while read fs size used av pct mp; do
694 cat <<EOT
695 <tr>
696 <td><span data-icon="hdd">${fs#/dev/}</span></td>
697 <td>$(blkid $fs | sed '/LABEL=/!d;s/.*LABEL="\([^"]*\).*/\1/')</td>
698 <td>$(blkid $fs | sed '/TYPE=/!d;s/.*TYPE="\([^"]*\).*/\1/')</td>
699 <td>$size</td>
700 <td>$av</td>
701 <td class="meter"><meter min="0" max="100" value="$(echo $pct | cut -d% -f1)"
702 low="$DU_WARN" high="$DU_CRIT" optimum="10"></meter>
703 <span>$used - $pct</span>
704 </td>
705 <td>$mp</td>
706 <td>$(blkid $fs | sed '/UUID=/!d;s/.*UUID="\([^"]*\).*/\1/')</td>
707 </tr>
708 EOT
709 done
710 cat <<EOT
711 </tbody>
712 </table>
713 </section>
715 <section>
716 <header>
717 $(_ 'Panel Activity')
718 <form>
719 <button name="file" value="$LOG_FILE" data-icon="view">$(_ 'View')</button>
720 </form>
721 </header>
722 <div>
723 <pre id="panel-activity">
724 $(cat $LOG_FILE | tail -n 8 | sort -r | syntax_highlighter activity)</pre>
725 </div>
726 </section>
727 EOT
728 ;;
729 esac
731 xhtml_footer
732 exit 0