tazpanel rev 538
Speed-up interface: cache xhtml header; need to use 'tazpanel cc' to clean cache when TazPanel menu changes (in post-install and post-remove functions for TazPanel modules)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sun Aug 30 23:46:37 2015 +0300 (2015-08-30) |
parents | 34508d2309a6 |
children | 71e797397c58 |
files | Makefile lib/libtazpanel styles/default/header.html tazpanel |
line diff
1.1 --- a/Makefile Sun Aug 30 23:04:04 2015 +0300 1.2 +++ b/Makefile Sun Aug 30 23:46:37 2015 +0300 1.3 @@ -79,6 +79,10 @@ 1.4 mkdir -p $(DESTDIR)/usr/share/fonts/TTF 1.5 ln -fs $(PANEL)/styles/default/tazpanel.ttf $(DESTDIR)/usr/share/fonts/TTF/tazpanel.ttf 1.6 1.7 + # TazPanel cache directory, rw access for all 1.8 + install -m 0777 -d $(DESTDIR)/var/cache/tazpanel 1.9 + 1.10 + 1.11 install_extra: 1.12 mkdir -p \ 1.13 $(DESTDIR)$(PANEL)/menu.d/boot \
2.1 --- a/lib/libtazpanel Sun Aug 30 23:04:04 2015 +0300 2.2 +++ b/lib/libtazpanel Sun Aug 30 23:46:37 2015 +0300 2.3 @@ -255,14 +255,23 @@ 2.4 2.5 xhtml_header() { 2.6 [ -n "$(GET noheader)" ] && return 2.7 - SUBTITLE="$1" 2.8 - . ${PANEL}$HEADER 2.9 - cat <<EOT 2.10 + 2.11 + local subtitle="$1" header="/var/cache/tazpanel/header.$(id -un)" 2.12 + 2.13 + # Cache header 2.14 + if [ ! -f "$header" ]; then 2.15 + SUBTITLE='@@SUBTITLE@@' 2.16 + . ${PANEL}$HEADER > "$header" 2.17 + cat >> "$header" <<EOT 2.18 <script type="text/javascript"> 2.19 document.cookie = "guiuser=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; 2.20 document.cookie = "guiuser=$GUI_USER"; 2.21 </script> 2.22 EOT 2.23 + fi 2.24 + sed "s|@@SUBTITLE@@|$subtitle|" "$header" 2.25 + 2.26 + # Show debug output 2.27 if [ "$DEBUG" -eq 1 ]; then 2.28 local i j x 2.29 args='' 2.30 @@ -293,6 +302,7 @@ 2.31 2.32 xhtml_footer() { 2.33 [ -n "$(GET noheader)" ] && return 2.34 + 2.35 export TEXTDOMAIN='tazpkg' 2.36 . ${PANEL}$FOOTER 2.37 }
3.1 --- a/styles/default/header.html Sun Aug 30 23:04:04 2015 +0300 3.2 +++ b/styles/default/header.html Sun Aug 30 23:46:37 2015 +0300 3.3 @@ -1,6 +1,6 @@ 3.4 # Header of TazPanel html page 3.5 3.6 -rootclass='user'; [ $(id -u) == '0' ] && rootclass='root' 3.7 +rootclass='user'; [ $(id -u) -eq 0 ] && rootclass='root' 3.8 TEXTDOMAIN_original="${TEXTDOMAIN:-tazpanel}" 3.9 export TEXTDOMAIN='tazpanel' 3.10
4.1 --- a/tazpanel Sun Aug 30 23:04:04 2015 +0300 4.2 +++ b/tazpanel Sun Aug 30 23:46:37 2015 +0300 4.3 @@ -46,6 +46,7 @@ 4.4 boot, hardware, help, index, installer, live, network, settings, pkgs 4.5 If <app> is empty, index page will open in the browser. 4.6 You can also open sub-pages, so "pkgs#list" will open packages list. 4.7 + cc Clean cache: remove interface's header from cache 4.8 4.9 EOT 4.10 ;; 4.11 @@ -72,6 +73,8 @@ 4.12 status ;; 4.13 restart) 4.14 tazpanel stop; sleep 1; tazpanel start;; 4.15 + cc) 4.16 + find /var/cache/tazpanel -name 'header.*' -delete;; 4.17 *) 4.18 . /etc/slitaz/applications.conf 4.19 USER_CONFIG="$HOME/.config/slitaz/applications.conf"