tazweb rev 141

Add real bookmark support :-)
author Christophe Lincoln <pankso@slitaz.org>
date Sat Apr 05 18:51:42 2014 +0200 (2014-04-05)
parents b3a109d2818f
children 9f71241c41e5
files Makefile README data/bookmarks.cgi data/bookmarks.txt data/home.en.html data/home.fr.html data/home.html data/home.pt.html data/home.ru.html data/style.css doc/tazweb.en.html src/main.c
line diff
     1.1 --- a/Makefile	Sat Apr 05 09:13:43 2014 +0200
     1.2 +++ b/Makefile	Sat Apr 05 18:51:42 2014 +0200
     1.3 @@ -40,23 +40,20 @@
     1.4  		msgfmt -o po/mo/$$l/LC_MESSAGES/$(PACKAGE).mo po/$$l.po; \
     1.5  	done;
     1.6  
     1.7 -
     1.8  install:
     1.9  	mkdir -p \
    1.10  		$(DESTDIR)$(DOCDIR)/$(PACKAGE) \
    1.11  		$(DESTDIR)$(PREFIX)/bin \
    1.12 +		$(DESTDIR)$(PREFIX)/var/www/cgi-bin \
    1.13  		$(DESTDIR)$(PREFIX)/share/tazweb \
    1.14  		$(DESTDIR)$(PREFIX)/share/pixmaps \
    1.15  		$(DESTDIR)$(PREFIX)/share/applications
    1.16  	install -m 0755 $(PACKAGE) $(DESTDIR)$(PREFIX)/bin
    1.17  	cp -d doc/* $(DESTDIR)$(DOCDIR)/$(PACKAGE)
    1.18 -	install -m 0644 data/tazweb.png \
    1.19 -		$(DESTDIR)$(PREFIX)/share/pixmaps
    1.20 -	install -m 0644 data/tazweb.desktop \
    1.21 -		$(DESTDIR)$(PREFIX)/share/applications
    1.22 -	cp -a data/*.html $(DESTDIR)$(PREFIX)/share/tazweb
    1.23 -	install -m 0644 data/style.css \
    1.24 -		$(DESTDIR)$(PREFIX)/share/tazweb
    1.25 +	install -m 0644 data/tazweb.png $(DESTDIR)$(PREFIX)/share/pixmaps
    1.26 +	install -m 0644 data/tazweb.desktop $(DESTDIR)$(PREFIX)/share/applications
    1.27 +	install -m 0644 data/bookmarks.txt $(DESTDIR)$(PREFIX)/share/tazweb
    1.28 +	install -m 0755 data/bookmarks.cgi $(DESTDIR)$(PREFIX)/var/www/cgi-bin
    1.29  	mkdir -p $(DESTDIR)$(PREFIX)/share/locale
    1.30  	cp -a po/mo/* $(DESTDIR)$(PREFIX)/share/locale
    1.31  
     2.1 --- a/README	Sat Apr 05 09:13:43 2014 +0200
     2.2 +++ b/README	Sat Apr 05 18:51:42 2014 +0200
     2.3 @@ -52,6 +52,7 @@
     2.4  
     2.5  Coding notes
     2.6  ------------
     2.7 +
     2.8      * To get the filename of a WebKitDownload:
     2.9        file = webkit_download_get_suggested_filename (download);
    2.10        
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/data/bookmarks.cgi	Sat Apr 05 18:51:42 2014 +0200
     3.3 @@ -0,0 +1,95 @@
     3.4 +#!/bin/sh
     3.5 +#
     3.6 +# TazWeb Bookmarks CGI handler
     3.7 +# Copyright (C) 2014 SliTaz GNU/Linux - BSD License
     3.8 +#
     3.9 +. /usr/lib/slitaz/httphelper.sh
    3.10 +
    3.11 +script="$SCRIPT_NAME"
    3.12 +home="$(GET home)"
    3.13 +user="$(basename $home)"
    3.14 +config="/home/$user/.config/tazweb"
    3.15 +bookmarks="$config/bookmarks.txt"
    3.16 +
    3.17 +# Security check
    3.18 +if [ "$REMOTE_ADDR" != "127.0.0.1" ]; then
    3.19 +	echo "Security exit" && exit 1
    3.20 +fi
    3.21 +
    3.22 +# HTML 5 header with built-in minimal CSS
    3.23 +html_header() {
    3.24 +	cat << EOT
    3.25 +<!DOCTYPE html>
    3.26 +<html lang="en">
    3.27 +<head>
    3.28 +	<meta charset="utf-8" />
    3.29 +	<title>TazWeb - Bookmarks</title>
    3.30 +	<style type="text/css">
    3.31 +		body { margin: 2% 10%; } .rm { color: #666; } ul { padding: 0; }
    3.32 +		.rm:hover { text-decoration: none; color: #B70000; }
    3.33 +		h1 { color: #666; border-bottom: 4px solid #666; }
    3.34 +		a { text-decoration: none; } a:hover { text-decoration: underline; }
    3.35 +		li { list-style-type: none; color: #666; line-height: 1.4em; padding: 0; }
    3.36 +		footer { font-size: 80%; border-top: 2px solid #666; padding: 5px 0; }
    3.37 +	</style>
    3.38 +</head>
    3.39 +<body>
    3.40 +<section id="content">
    3.41 +
    3.42 +EOT
    3.43 +}
    3.44 +
    3.45 +# HTML 5 footer
    3.46 +html_footer() {
    3.47 +	cat << EOT
    3.48 +
    3.49 +</section>
    3.50 +
    3.51 +<footer>
    3.52 +	<a href="$script?home=$home">Bookmarks</a> -
    3.53 +	<a href="$script?raw&amp;home=$home">bookmarks.txt</a>
    3.54 +</footer>
    3.55 +
    3.56 +</body>
    3.57 +</html>
    3.58 +EOT
    3.59 +}
    3.60 +
    3.61 +# Handle GET actions: continue or exit
    3.62 +
    3.63 +case " $(GET) " in
    3.64 +	*\ raw\ *)
    3.65 +		# View bookmarks file
    3.66 +		header
    3.67 +		html_header
    3.68 +		echo "<h1>TazWeb: bookmarks.txt</h1>"
    3.69 +		echo "<pre>" 
    3.70 +		cat ${bookmarks}
    3.71 +		echo "</pre>"
    3.72 +		html_footer && exit 0 ;;
    3.73 +	*\ rm\ *)
    3.74 +		# Remove a bookmark item and contine
    3.75 +		url=$(GET rm)
    3.76 +		[ "$url" ] || continue
    3.77 +		sed -i s"#.*${url}.*##" ${bookmarks}
    3.78 +		sed -i "/^$/"d ${bookmarks} ;;
    3.79 +esac
    3.80 +
    3.81 +# Show all bookmarks
    3.82 +header
    3.83 +html_header
    3.84 +echo '<h1>TazWeb Bookmarks</h1>'
    3.85 +echo '<ul>'
    3.86 +IFS="|"
    3.87 +cat ${bookmarks} | while read title url null
    3.88 +do
    3.89 +	cat << EOT
    3.90 +	<li><a class="rm" href="?rm=$url&amp;home=$home">&otimes;<a/>
    3.91 +	<a href="${url}">${title}<a/></li>
    3.92 +EOT
    3.93 +done
    3.94 +unset IFS
    3.95 +echo '</ul>'
    3.96 +html_footer
    3.97 +
    3.98 +exit 0
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/data/bookmarks.txt	Sat Apr 05 18:51:42 2014 +0200
     4.3 @@ -0,0 +1,5 @@
     4.4 +SliTaz Website|http://www.slitaz.org|
     4.5 +SliTaz ARM|http://arm.slitaz.org|
     4.6 +Wikipedia|http://wikipedia.org/|
     4.7 +Twitter|http://twitter.com|
     4.8 +Google search|http://www.google.com/|
     5.1 --- a/data/home.en.html	Sat Apr 05 09:13:43 2014 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,57 +0,0 @@
     5.4 -<!DOCTYPE html>
     5.5 -<html xmlns="http://www.w3.org/1999/xhtml">
     5.6 -<head>
     5.7 -	<title>My Web Home</title>
     5.8 -	<meta charset="utf-8" />
     5.9 -	<link rel="stylesheet" type="text/css" href="style.css" />
    5.10 -</head>
    5.11 -<body>
    5.12 -
    5.13 -<div id="header">
    5.14 -	<h1>My Web Home</h1>
    5.15 -</div>
    5.16 -
    5.17 -<!-- start:content -->
    5.18 -<div id="content">
    5.19 -
    5.20 -<!--
    5.21 -	Welcome to your personal and custom TazWeb page: a pure xHTML 5 file
    5.22 -	with some CSS for the design, you can customize it as you want. All
    5.23 -	the page style is in the file: style.css. To add a section title you
    5.24 -	can use <h2></h2> elements and <div></div> to organize content.
    5.25 --->
    5.26 -
    5.27 -<div id="cloud">
    5.28 -	<a class="tag4" href="http://www.slitaz.org/">SliTaz Website</a>
    5.29 -	<a class="tag6" href="http://scn.slitaz.org/">SCN</a>
    5.30 -	<a class="tag8" href="http://wikipedia.org/">Wikipedia</a>
    5.31 -	<a class="tag5" href="http://forum.slitaz.org/">SliTaz Forum</a>
    5.32 -	<a class="tag4" href="http://duckduckgo.com/">DuckDuckGo</a>
    5.33 -	<a class="tag4" href="http://www.google.com/">Google</a>
    5.34 -	<a class="tag6" href="http://doc.slitaz.org/">SliTaz Wiki</a>
    5.35 -	<a class="tag5" href="http://twitter.com">Twitter</a>
    5.36 -	<a class="tag2" href="http://search.yahoo.com/">Yahoo</a>
    5.37 -	<a class="tag8" href="http://tazpanel:82/">TazPanel</a>
    5.38 -</div>
    5.39 -
    5.40 -<!--
    5.41 -	The bookmarks list must finish with end:bookmarks markup since it
    5.42 -	is used by TazWeb to add a new item via the right click menu. Tip:
    5.43 -	you can add a favicon image with a bookmark URL by adding this code
    5.44 -	between <li> and <a : <img src="http://www.gnu.org/favicon.ico" />
    5.45 --->
    5.46 -
    5.47 -<h2>Bookmarks</h2>
    5.48 -<ul>
    5.49 -	<!-- start:bookmarks -->
    5.50 -	<li><a href="http://bugs.slitaz.org/">SliTaz Bug tracker</a></li>
    5.51 -	<li><a href="http://www.gnu.org/">The GNU Website</a></li>
    5.52 -	<li><a href="http://is.gd/">is.gd URL shortener</a></li>
    5.53 -	<!-- end:bookmarks -->
    5.54 -</ul>
    5.55 -
    5.56 -<!-- End content -->
    5.57 -</div>
    5.58 -
    5.59 -</body>
    5.60 -</html>
     6.1 --- a/data/home.fr.html	Sat Apr 05 09:13:43 2014 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,58 +0,0 @@
     6.4 -<!DOCTYPE html>
     6.5 -<html xmlns="http://www.w3.org/1999/xhtml">
     6.6 -<head>
     6.7 -	<title>My Web Home</title>
     6.8 -	<meta charset="utf-8" />
     6.9 -	<link rel="stylesheet" type="text/css" href="style.css" />
    6.10 -</head>
    6.11 -<body>
    6.12 -
    6.13 -<div id="header">
    6.14 -	<h1>My Web Home</h1>
    6.15 -</div>
    6.16 -
    6.17 -<!-- start:content -->
    6.18 -<div id="content">
    6.19 -
    6.20 -<!--
    6.21 -	Bienvenue sur votre page personnelle TazWeb: une page en  pur xHTML 5 
    6.22 -avec un peu de CSS pour la conception. Vous pouvez la personnaliser comme vous le souhaitez. 
    6.23 -Tout le style de la page est  dans le fichier: style.css. 
    6.24 -Pour ajouter un titre de section, vous pouvez utiliser <h2> </ h2>,
    6.25 - <div éléments et </ div> pour organiser le contenu.
    6.26 --->
    6.27 -
    6.28 -<div id="cloud">
    6.29 -	<a class="tag4" href="http://www.slitaz.org/">SliTaz Website</a>
    6.30 -	<a class="tag6" href="http://scn.slitaz.org/">SCN</a>
    6.31 -	<a class="tag8" href="http://wikipedia.org/">Wikipedia</a>
    6.32 -	<a class="tag5" href="http://forum.slitaz.org/">SliTaz Forum</a>
    6.33 -	<a class="tag4" href="http://duckduckgo.com/">DuckDuckGo</a>
    6.34 -	<a class="tag4" href="http://www.google.com/">Google</a>
    6.35 -	<a class="tag6" href="http://doc.slitaz.org/">SliTaz Wiki</a>
    6.36 -	<a class="tag5" href="http://twitter.com">Twitter</a>
    6.37 -	<a class="tag2" href="http://search.yahoo.com/">Yahoo</a>
    6.38 -	<a class="tag8" href="http://tazpanel:82/">TazPanel</a>
    6.39 -</div>
    6.40 -
    6.41 -<!--
    6.42 -La liste des signets doit être terminée avec la balise  'end:bookmarks' 
    6.43 -car elle est utilisée par TazWeb pour ajouter un nouvel élément via le menu clic droit.
    6.44 - Astuce: vous pouvez ajouter une image favicon en ajoutant ce code
    6.45 -entre <li> et <a: <img src="http://www.gnu.org/favicon.ico" />
    6.46 --->
    6.47 -
    6.48 -<h2>Bookmarks</h2>
    6.49 -<ul>
    6.50 -	<!-- start:bookmarks -->
    6.51 -	<li><a href="http://bugs.slitaz.org/">SliTaz Bug tracker</a></li>
    6.52 -	<li><a href="http://www.gnu.org/">The GNU Website</a></li>
    6.53 -	<li><a href="http://is.gd/">is.gd URL shortener</a></li>
    6.54 -	<!-- end:bookmarks -->
    6.55 -</ul>
    6.56 -
    6.57 -<!-- End content -->
    6.58 -</div>
    6.59 -
    6.60 -</body>
    6.61 -</html>
     7.1 --- a/data/home.html	Sat Apr 05 09:13:43 2014 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,1 +0,0 @@
     7.4 -home.en.html
     7.5 \ No newline at end of file
     8.1 --- a/data/home.pt.html	Sat Apr 05 09:13:43 2014 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,59 +0,0 @@
     8.4 -<!DOCTYPE html>
     8.5 -<html xmlns="http://www.w3.org/1999/xhtml">
     8.6 -<head>
     8.7 -	<title>Página inicial do TazWeb</title>
     8.8 -	<meta charset="utf-8" />
     8.9 -	<link rel="stylesheet" type="text/css" href="style.css" />
    8.10 -</head>
    8.11 -<body>
    8.12 -
    8.13 -<div id="header">
    8.14 -	<h1>Minha página inicial</h1>
    8.15 -</div>
    8.16 -
    8.17 -<!-- start:content -->
    8.18 -<div id="content">
    8.19 -
    8.20 -<!--
    8.21 -    Bemvindo à sua página personalizada do TazWeb: um arquivo xHTML5 com
    8.22 -    CSS para o design, totalmente customizável. O estilo da página está
    8.23 -    no arquivo style.css. Para adicionar uma seção pode-se utilizar a tag
    8.24 -    <h2></h2> e <div></div> para organizar o conteúdo.
    8.25 --->
    8.26 -
    8.27 -<div id="cloud">
    8.28 -	<a class="tag4" href="http://www.slitaz.org/">Website do SliTaz</a>
    8.29 -	<a class="tag6" href="http://scn.slitaz.org/">SCN</a>
    8.30 -	<a class="tag8" href="http://wikipedia.org/">Wikipedia</a>
    8.31 -	<a class="tag5" href="http://forum.slitaz.org/">Fórum do SliTaz</a>
    8.32 -	<a class="tag4" href="http://duckduckgo.com/">DuckDuckGo</a>
    8.33 -	<a class="tag4" href="http://www.google.com/">Google</a>
    8.34 -	<a class="tag6" href="http://doc.slitaz.org/">Wiki do SliTaz</a>
    8.35 -	<a class="tag5" href="http://twitter.com">Twitter</a>
    8.36 -	<a class="tag2" href="http://search.yahoo.com/">Yahoo</a>
    8.37 -	<a class="tag8" href="http://tazpanel:82/">TazPanel</a>
    8.38 -</div>
    8.39 -
    8.40 -<!--
    8.41 -    Os favoritos devem terminar antes do comentário "end:bookmarks" que é
    8.42 -    utitilizado pelo TazWeb para adicionar novos ítens com um clique no
    8.43 -    menu com o botão direito do mouse. Dica: pode-se adicionar uma imagem
    8.44 -    para favicon de um link dos favoritos adicionando-se o seguinte código
    8.45 -    entre as <li> e <a, exemplo:
    8.46 -    <img src="http://www.gnu.org/favicon.ico" />
    8.47 --->
    8.48 -
    8.49 -<h2>Favoritos</h2>
    8.50 -<ul>
    8.51 -	<!-- start:bookmarks -->
    8.52 -	<li><a href="http://bugs.slitaz.org/">Sistema de informação de bugs do SliTaz</a></li>
    8.53 -	<li><a href="http://www.gnu.org/">Website do projeto GNU</a></li>
    8.54 -	<li><a href="http://is.gd/">Encurtador de URL is.gd</a></li>
    8.55 -	<!-- end:bookmarks -->
    8.56 -</ul>
    8.57 -
    8.58 -<!-- End content -->
    8.59 -</div>
    8.60 -
    8.61 -</body>
    8.62 -</html>
     9.1 --- a/data/home.ru.html	Sat Apr 05 09:13:43 2014 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,59 +0,0 @@
     9.4 -<!DOCTYPE html>
     9.5 -<html xmlns="http://www.w3.org/1999/xhtml" lang="ru">
     9.6 -<head>
     9.7 -	<meta charset="utf-8" />
     9.8 -	<title>Моя веб-страница</title>
     9.9 -	<link rel="stylesheet" type="text/css" href="style.css" />
    9.10 -</head>
    9.11 -<body>
    9.12 -
    9.13 -<div id="header">
    9.14 -	<h1>Моя домашняя страница</h1>
    9.15 -</div>
    9.16 -
    9.17 -<!-- start:content -->
    9.18 -<div id="content">
    9.19 -
    9.20 -<!--
    9.21 -	Добро пожаловать на вашу личную и настраиваемую страницу TazWeb:
    9.22 -	перед вами файл формата xHTML 5 с небольшим добавлением CSS для дизайна,
    9.23 -	всё это вы можете настроить, как вы хотите. Все стили страницы находятся
    9.24 -	в файле style.css. Чтобы добавить название раздела, используйте теги
    9.25 -	<h2>…</h2>, а для организации содержимого используйте <div>…</div>.
    9.26 --->
    9.27 -
    9.28 -<div id="cloud">
    9.29 -	<a class="tag4" href="http://www.slitaz.org/">Сайт SliTaz</a>
    9.30 -	<a class="tag6" href="http://scn.slitaz.org/">SCN</a>
    9.31 -	<a class="tag8" href="http://wikipedia.org/">Википедия</a>
    9.32 -	<a class="tag5" href="http://forum.slitaz.org/">Форум SliTaz</a>
    9.33 -	<a class="tag4" href="http://duckduckgo.com/">DuckDuckGo</a>
    9.34 -	<a class="tag4" href="http://www.google.com/">Google</a>
    9.35 -	<a class="tag6" href="http://doc.slitaz.org/">Wiki SliTaz</a>
    9.36 -	<a class="tag5" href="http://twitter.com">Twitter</a>
    9.37 -	<a class="tag2" href="http://search.yahoo.com/">Yahoo</a>
    9.38 -	<a class="tag8" href="http://tazpanel:82/">TazPanel</a>
    9.39 -</div>
    9.40 -
    9.41 -<!--
    9.42 -	Список закладок обязательно должен заканчиваться строкой с текстом
    9.43 -	«end:bookmarks», поскольку эта строка используется TazWeb для добавления
    9.44 -	новых элементов с помощью контекстного меню. Совет: вы можете поместить
    9.45 -	значок перед адресом закладки, добавив примерно такой код между <li> и <a:
    9.46 -	<img src="http://www.gnu.org/favicon.ico" />
    9.47 --->
    9.48 -
    9.49 -<h2>Закладки</h2>
    9.50 -<ul>
    9.51 -	<!-- start:bookmarks -->
    9.52 -	<li><a href="http://bugs.slitaz.org/">Баг-трекер SliTaz</a></li>
    9.53 -	<li><img src="http://www.gnu.org/favicon.ico" /><a href="http://www.gnu.org/">Сайт GNU</a></li>
    9.54 -	<li><a href="http://is.gd/">Сокращатель ссылок is.gd</a></li>
    9.55 -	<!-- end:bookmarks -->
    9.56 -</ul>
    9.57 -
    9.58 -<!-- End content -->
    9.59 -</div>
    9.60 -
    9.61 -</body>
    9.62 -</html>
    10.1 --- a/data/style.css	Sat Apr 05 09:13:43 2014 +0200
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,46 +0,0 @@
    10.4 -/* CSS style for TazWeb page */
    10.5 -
    10.6 -body {
    10.7 -	font: 88% sans-serif, vernada, arial;
    10.8 -	margin: 0;
    10.9 -}
   10.10 -
   10.11 -h1 { margin: 0; padding: 8px;
   10.12 -	color: #fff; font-size: 20px; font-style: italic; }
   10.13 -h2 { color: #444; }
   10.14 -h3 { color: #666; font-size: 140%; }
   10.15 -ul { list-style-type: square; line-height: 140%; }
   10.16 -img { vertical-align: middle; }
   10.17 -a { color: #215090; }
   10.18 -a:hover { text-decoration: none; color: blue; }
   10.19 -
   10.20 -#header {
   10.21 -	background: #351a0a;
   10.22 -	height: 40px;
   10.23 -	border-bottom: 8px solid #d66018;
   10.24 -}
   10.25 -
   10.26 -#content {
   10.27 -	margin: 80px;
   10.28 -}
   10.29 -
   10.30 -#cloud {
   10.31 -	padding: 10px;
   10.32 -	margin: 0 0 40px;
   10.33 -	line-height: 3em;
   10.34 -	text-align: center;
   10.35 -	background: #f8f8f8;
   10.36 -	border: 1px solid #ddd;
   10.37 -	border-radius: 8px;
   10.38 -}
   10.39 -
   10.40 -#cloud a { padding: 0 6px; color: #444444; }
   10.41 -#cloud a.tag1 { font-size: 0.6em; font-weight: 100; }
   10.42 -#cloud a.tag2 { font-size: 0.8em; font-weight: 200; }
   10.43 -#cloud a.tag3 { font-size: 1.0em; font-weight: 300; }
   10.44 -#cloud a.tag4 { font-size: 1.2em; font-weight: 400; }
   10.45 -#cloud a.tag5 { font-size: 1.4em; font-weight: 500; }
   10.46 -#cloud a.tag6 { font-size: 1.6em; font-weight: 600; }
   10.47 -#cloud a.tag7 { font-size: 1.8em; font-weight: 700; }
   10.48 -#cloud a.tag8 { font-size: 2.0em; font-weight: 800; }
   10.49 -
    11.1 --- a/doc/tazweb.en.html	Sat Apr 05 09:13:43 2014 +0200
    11.2 +++ b/doc/tazweb.en.html	Sat Apr 05 18:51:42 2014 +0200
    11.3 @@ -60,39 +60,29 @@
    11.4  $ tazweb --kiosk
    11.5  </pre>
    11.6  
    11.7 -<h3>My Home Page and bookmarks</h3>
    11.8 +<h3>Home Page and bookmarks</h3>
    11.9  <p>
   11.10 -	TazWeb handles a personal page located in your Freedesktop standard
   11.11 -	configuration directory, the path is: $HOME/.config/tazweb/home.html.
   11.12 -	It lets you have a custom page with bookmarks and other content. The
   11.13 -	CSS style is defined in $HOME/.config/tazweb/style.css.
   11.14 +	TazWeb handles a home page located in your a system wide standard
   11.15 +	configuration directory, the path is: /usr/share/webhome
   11.16  </p>
   11.17  <p>
   11.18 -	The file is a simple xHTML 5 document with, by default, a list of
   11.19 -	links and a box. You can edit this file with you favorite editor
   11.20 -	and add content such as bookmarks entries or change the look and
   11.21 -	feel as you want. At first start TazWeb will create and copy your
   11.22 -	personal page and style to your config directory.
   11.23 -</p>
   11.24 -<p>
   11.25 -	To add some life to your pages you can use your own Javascript
   11.26 -	widgets or some from a third party website such as the famous
   11.27 -	<a href="http://twitter.com/about/resources/widgets">
   11.28 -	Twitter Widget</a> as seen on the SliTaz main website.
   11.29 +	The bookmark.txt file is a simple text document with, by default, a
   11.30 +	list of links. You can edit this file with you favorite editor
   11.31 +	and add bookmarks entries or use Tazweb right click menu. At first
   11.32 +	start TazWeb will create and copy your personal bookmarks file to 
   11.33 +	your config directory.
   11.34  </p>
   11.35  <p>
   11.36  	Bookmarks can be handled by TazWeb and you can easily add a bookmark to
   11.37 -	your home page with the right click menu item: <i>"Add a bookmark"</i>. To function
   11.38 -	TazWeb uses markup in your home.html document; this markup should not
   11.39 -	be removed if you want bookmarking to work since each new item will be
   11.40 -	added just before the line: <i>&lt;!-- end:bookmarks --&gt;</i>
   11.41 +	your home page with the right click menu item: <i>"Add a bookmark"</i>.
   11.42 +	Tazweb let you also manage your bookmarks via a nifty CGI web interface.
   11.43  </p>
   11.44  <p>
   11.45 -	Note: You will find the default home.html in: /usr/share/tazweb and
   11.46 +	Note: You will find the default bookmarks.txt in: /usr/share/tazweb and
   11.47  	can get an original copy with the following command in a terminal:
   11.48  </p>
   11.49  <pre>
   11.50 -$ cp -r /usr/share/tazweb $HOME/.config/tazweb
   11.51 +$ cp -f /usr/share/tazweb/bookmarks.html $HOME/.config/tazweb
   11.52  </pre>
   11.53  
   11.54  <h3>Start page and url in argument</h3>
    12.1 --- a/src/main.c	Sat Apr 05 09:13:43 2014 +0200
    12.2 +++ b/src/main.c	Sat Apr 05 18:51:42 2014 +0200
    12.3 @@ -16,9 +16,12 @@
    12.4  #include <gtk/gtk.h>
    12.5  #include <webkit/webkit.h>
    12.6  
    12.7 -#define CONFIG   g_strdup_printf("%s/.config/tazweb", g_get_home_dir())
    12.8 -#define START    "file:///usr/share/webhome/index.html"
    12.9 -#define SEARCH   "http://duckduckgo.com/?q=%s&t=slitaz"
   12.10 +#define HOME       g_get_home_dir()
   12.11 +#define CONFIG     g_strdup_printf("%s/.config/tazweb", HOME)
   12.12 +#define BMTXT      g_strdup_printf("%s/bookmarks.txt", CONFIG)
   12.13 +#define BMURL      "http://localhost/cgi-bin/bookmarks.cgi"
   12.14 +#define WEBHOME    "file:///usr/share/webhome/index.html"
   12.15 +#define SEARCH     "http://duckduckgo.com/?q=%s&t=slitaz"
   12.16  
   12.17  /* Needs AppleWebKit/531.2+ to handle all sites ? */
   12.18  static gchar *useragent = "TazWeb (X11; SliTaz GNU/Linux; U; en_US)";
   12.19 @@ -28,6 +31,7 @@
   12.20  static WebKitWebFrame *frame;
   12.21  static gint count = 0;
   12.22  static gboolean notoolbar;
   12.23 +static gboolean noquit;
   12.24  static gboolean kiosk;
   12.25  const gchar* uri;
   12.26  
   12.27 @@ -146,11 +150,19 @@
   12.28      search_web(search, webview);
   12.29  }
   12.30  
   12.31 -/* Navigation button function */
   12.32 +/* Navigation button function: */
   12.33 +static void
   12.34 +go_bookmarks_cb(GtkWidget* widget, WebKitWebView* webview)
   12.35 +{
   12.36 +	uri = g_strdup_printf("%s?home=%s", BMURL, HOME);
   12.37 +	g_assert(uri);
   12.38 +	webkit_web_view_load_uri(webview, uri);
   12.39 +}
   12.40 +
   12.41  static void
   12.42  go_home_cb(GtkWidget* widget, WebKitWebView* webview)
   12.43  {
   12.44 -	uri = g_strdup_printf("file://%s/home.html", CONFIG);
   12.45 +	uri = WEBHOME;
   12.46  	g_assert(uri);
   12.47  	webkit_web_view_load_uri(webview, uri);
   12.48  }
   12.49 @@ -168,17 +180,17 @@
   12.50  }
   12.51  
   12.52  /* Fullscreen and unfullscreen callback function */
   12.53 -static void
   12.54 -fullscreen_cb(GtkWindow* window, gpointer data)
   12.55 -{
   12.56 -	GdkWindowState state;
   12.57 -	state = gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(mainwindow)));
   12.58 +//static void
   12.59 +//fullscreen_cb(GtkWindow* window, gpointer data)
   12.60 +//{
   12.61 +	//GdkWindowState state;
   12.62 +	//state = gdk_window_get_state(gtk_widget_get_window(GTK_WIDGET(mainwindow)));
   12.63  
   12.64 -	if(state & GDK_WINDOW_STATE_FULLSCREEN)
   12.65 -		gtk_window_unfullscreen(GTK_WINDOW(mainwindow));
   12.66 -	else
   12.67 -		gtk_window_fullscreen(GTK_WINDOW(mainwindow));
   12.68 -}
   12.69 +	//if(state & GDK_WINDOW_STATE_FULLSCREEN)
   12.70 +		//gtk_window_unfullscreen(GTK_WINDOW(mainwindow));
   12.71 +	//else
   12.72 +		//gtk_window_fullscreen(GTK_WINDOW(mainwindow));
   12.73 +//}
   12.74  
   12.75  /* TazWeb doc callback function */
   12.76  static void
   12.77 @@ -249,8 +261,7 @@
   12.78  }
   12.79  
   12.80  /* Add a bookmark to home.html */
   12.81 -void
   12.82 -add_bookmark_cb(GtkWidget *widget, gpointer data)
   12.83 +void add_bookmark_cb(GtkWidget *widget, gpointer data)
   12.84  {
   12.85  	const gchar* title;
   12.86  	const gchar* buffer;
   12.87 @@ -258,10 +269,7 @@
   12.88  	title = webkit_web_view_get_title(WEBKIT_WEB_VIEW (webview));
   12.89  	uri = webkit_web_view_get_uri(WEBKIT_WEB_VIEW (webview));
   12.90  	
   12.91 -	asprintf(&buffer, "sed -i \
   12.92 -			-e '/<!-- end:bookmarks -->/ i <li><a href=\"%s\">%s</a></li>' \
   12.93 -			-e s'/^<li>/	<li>/' $HOME/.config/tazweb/home.html &",
   12.94 -			uri, title);
   12.95 +	asprintf(&buffer, "echo '%s|%s' >> %s", title, uri, BMTXT);
   12.96  	system(buffer);
   12.97  }
   12.98  
   12.99 @@ -293,8 +301,8 @@
  12.100  	item = gtk_separator_menu_item_new();
  12.101  	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
  12.102  
  12.103 -	/* Add to bookmarks */
  12.104  	if (! kiosk) {
  12.105 +		/* Add a bookmark */
  12.106  		item = gtk_image_menu_item_new_with_label(_("Add a bookmark"));
  12.107  		gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
  12.108  		gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU));
  12.109 @@ -327,10 +335,6 @@
  12.110  	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
  12.111  	g_signal_connect(item, "activate", G_CALLBACK(tazweb_doc_cb), webview);
  12.112  	
  12.113 -	/* Separator */
  12.114 -	item = gtk_separator_menu_item_new();
  12.115 -	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
  12.116 -	
  12.117  	/* Quit TazWeb */
  12.118  	item = gtk_image_menu_item_new_with_label(_("Quit TazWeb"));
  12.119  	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item),
  12.120 @@ -369,6 +373,7 @@
  12.121  			G_CALLBACK(webview_ready_cb), window);
  12.122  	g_signal_connect(webview, "close-web-view",
  12.123  			G_CALLBACK(close_webview_cb), window);
  12.124 +	
  12.125  	/* Impossible to open in new window or download in kiosk mode */
  12.126  	if (! kiosk) {
  12.127  		g_signal_connect(webview, "download-requested",
  12.128 @@ -428,7 +433,7 @@
  12.129  	
  12.130  	/* Search entry */
  12.131  	item = gtk_tool_item_new();
  12.132 -	gtk_widget_set_size_request(search, 150, 20);
  12.133 +	gtk_widget_set_size_request(search, 160, 20);
  12.134  	gtk_container_add(GTK_CONTAINER(item), search);
  12.135  	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
  12.136  	gtk_entry_set_icon_from_stock(GTK_ENTRY(search),
  12.137 @@ -438,14 +443,12 @@
  12.138  	g_signal_connect(G_OBJECT(search), "activate",
  12.139  			G_CALLBACK(search_entry_cb), webview);
  12.140  	
  12.141 -	/* The Fullscreen button */
  12.142 -	if (! kiosk) {
  12.143 -		item = gtk_tool_button_new_from_stock(GTK_STOCK_FULLSCREEN);
  12.144 -		g_signal_connect(G_OBJECT(item), "clicked",
  12.145 -				G_CALLBACK(fullscreen_cb), NULL);
  12.146 -		gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
  12.147 -	}
  12.148 -	
  12.149 +	/* Bookmark button */
  12.150 +	item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
  12.151 +	g_signal_connect(G_OBJECT(item), "clicked",
  12.152 +			G_CALLBACK(go_bookmarks_cb), webview);
  12.153 +	gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, -1);
  12.154 +
  12.155  	return toolbar;
  12.156  }
  12.157  
  12.158 @@ -492,7 +495,7 @@
  12.159  main(int argc, char* argv[])
  12.160  {
  12.161  	textdomain (GETTEXT_PACKAGE);
  12.162 -
  12.163 +	
  12.164  	while (argc > 1) {
  12.165  		if (!strcmp(argv[1],"--notoolbar")) {
  12.166  			notoolbar++;
  12.167 @@ -505,23 +508,29 @@
  12.168  			argv++;
  12.169  			useragent = argv[1];
  12.170  		}
  12.171 +		else if (!strcmp(argv[1],"--help")) {
  12.172 +			printf ("Usage: tazweb [--notoolbar|--kiosk|--useragent] [ua]\n");
  12.173 +			printf ("Bookmarks: %s\n", BMTXT);
  12.174 +			return 0;
  12.175 +		}
  12.176  		else break;
  12.177  		argc--;
  12.178  		argv++;
  12.179  	}
  12.180 +	
  12.181  	gtk_init(NULL, NULL);
  12.182  	if (!g_thread_supported())
  12.183  		g_thread_init(NULL);
  12.184 -
  12.185 +	
  12.186  	/* Get a default home.html if missing */
  12.187  	if (! g_file_test(CONFIG, G_FILE_TEST_EXISTS)) {
  12.188 -		system("mkdir -p $HOME/.config/tazweb");
  12.189 -		system("cp /usr/share/tazweb/home.html $HOME/.config/tazweb");
  12.190 -		system("cp /usr/share/tazweb/style.css $HOME/.config/tazweb");
  12.191 -	}
  12.192 +		system("install -m 0777 $HOME/.config/tazweb");
  12.193 +		system("install -m 0666 /usr/share/tazweb/bookmarks.txt \
  12.194 +			$HOME/.config/tazweb");
  12.195 +	} 
  12.196  
  12.197  	/* Load the start page file or the url in argument */
  12.198 -	uri =(char*)(argc > 1 ? argv[1] : START);
  12.199 +	uri =(char*)(argc > 1 ? argv[1] : WEBHOME);
  12.200  	if (argv[1])
  12.201  		check_requested_uri();
  12.202