tazpanel rev 15

Add libtazpanel for common functions
author Christophe Lincoln <pankso@slitaz.org>
date Sun Apr 03 17:44:21 2011 +0200 (2011-04-03)
parents 2ea20065417a
children 969ebe1eaa22
files lib/libtazpanel
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/libtazpanel	Sun Apr 03 17:44:21 2011 +0200
     1.3 @@ -0,0 +1,40 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Common functions for TazPanel CGI and cmdline interface
     1.7 +#
     1.8 +
     1.9 +# We need a config file first
    1.10 +get_config() {
    1.11 +	CONFIG="/etc/slitaz/tazpanel.conf"
    1.12 +	[ -f $CONFIG ] && . $CONFIG
    1.13 +	[ -f tazpanel.conf ] && . tazpanel.conf
    1.14 +	[ ! -f $PANEL/lib/libtazpanel ] && \
    1.15 +		echo "No config file or libtazpanel found: $CONFIG" && \
    1.16 +		exit 1
    1.17 +}
    1.18 +
    1.19 +#
    1.20 +# xHTML 5 (header and footer skel are from the style)
    1.21 +#
    1.22 +
    1.23 +xhtml_header() {
    1.24 +	cat $HEADER | sed s/'- %TITLE%'/"$TITLE"/
    1.25 +}
    1.26 +
    1.27 +xhtml_footer() {
    1.28 +	cat $FOOTER
    1.29 +}
    1.30 +
    1.31 +table_start() {
    1.32 +	cat << EOT
    1.33 +<table>
    1.34 +	<tbody>
    1.35 +EOT
    1.36 +}
    1.37 +
    1.38 +table_end () {
    1.39 +	cat << EOT
    1.40 +	</tbody>
    1.41 +</table>
    1.42 +EOT
    1.43 +}