tinycm rev 48

Bunch of small fixes and improvments
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jan 19 15:53:39 2014 +0100 (2014-01-19)
parents aff0e20fbd3e
children 5aa9e5f4125f
files index.cgi plugins/blog/blog.cgi plugins/cloud/cloud.cgi plugins/export/export.cgi tools/serv.sh
line diff
     1.1 --- a/index.cgi	Sun Jan 19 09:42:05 2014 +0000
     1.2 +++ b/index.cgi	Sun Jan 19 15:53:39 2014 +0100
     1.3 @@ -110,7 +110,7 @@
     1.4  <p>
     1.5  This is the default index page of your TinyCM, you can login then start to
     1.6  edit and adding some content. You can read the help about text formating
     1.7 -and functions: <a href='?d=en/help'>Help page</a>
     1.8 +and functions: [Help page|en/help]
     1.9  </p>
    1.10  
    1.11  EOT
    1.12 @@ -547,20 +547,30 @@
    1.13  		header
    1.14  		html_header
    1.15  		user_box
    1.16 -		echo "<h2>$(gettext "Document list")</h2>"
    1.17 +		echo "<h2>$(gettext "Pages list")</h2>"
    1.18  		if check_auth; then
    1.19  			echo "<div id='tools'>"
    1.20  			echo "<a href='$script?dashboard'>Dashboard</a>"
    1.21  			echo "</div>"
    1.22 -		fi 
    1.23 +		fi
    1.24  		echo '<pre>'
    1.25  		cd ${wiki}
    1.26  		for d in $(find . -type f | sed s'/.\///')
    1.27  		do
    1.28 -			echo "<a href='$script?d=${d%.txt}'>${d%.txt}</a>"
    1.29 +			cat << EOT
    1.30 +<a href="$script?d=${d%.txt}">${d%.txt}</a> : \
    1.31 +<a href="$script?rm=$d">$(gettext "Remove")</a>
    1.32 +EOT
    1.33  		done
    1.34  		echo '</pre>'
    1.35  		html_footer ;;
    1.36 +	
    1.37 +	*\ rm\ *)
    1.38 +		[ ! check_auth ] && header "Location: Location: $script"
    1.39 +		d="$(GET rm)"
    1.40 +		rm ${wiki}/"${d}"
    1.41 +		rm -rf ${cache}/"${d%.txt}"
    1.42 +		header "Location: $script?ls" ;;
    1.43  		
    1.44  	*\ diff\ *)
    1.45  		d="$(GET diff)"
    1.46 @@ -672,7 +682,7 @@
    1.47  			cat << EOT
    1.48  <div id="tools">
    1.49  	<a href='$script?log'>Activity log</a>
    1.50 -	<a href='$script?ls'>List files</a>
    1.51 +	<a href='$script?ls'>Pages list</a>
    1.52  	$DASHBOARD_TOOLS
    1.53  	$ADMIN_TOOLS
    1.54  </div>
     2.1 --- a/plugins/blog/blog.cgi	Sun Jan 19 09:42:05 2014 +0000
     2.2 +++ b/plugins/blog/blog.cgi	Sun Jan 19 15:53:39 2014 +0100
     2.3 @@ -23,7 +23,7 @@
     2.4  	cat << EOT
     2.5  	- <a href="$script?blogedit&amp;d=${d}">$(gettext "Edit it!")</a>
     2.6  EOT
     2.7 -#<a href="$script?blogrm&amp;d=${d}">$(gettext "Remove")</a>
     2.8 +#<a href="$script?blogrm=${d}">$(gettext "Remove")</a>
     2.9  }
    2.10  
    2.11  # Display blog post: show_posts nb
    2.12 @@ -35,7 +35,7 @@
    2.13  	if [ -f "${PEOPLE}/${author}/account.conf" ]; then
    2.14  		. ${PEOPLE}/${author}/account.conf
    2.15  	else
    2.16 -		echo ERROR: ${PEOPLE}/${author}/account.conf
    2.17 +		echo "ERROR: ${PEOPLE}/${author}/account.conf"
    2.18  	fi
    2.19  	echo "<div class=\"blogpost\">"
    2.20  	cat ${blog}/${d}.txt | sed -e '/AUTHOR=/'d -e '/DATE=/'d | wiki_parser
    2.21 @@ -44,8 +44,8 @@
    2.22  	<a href="$script?user=$USER">$(get_gravatar $MAIL 24)</a>
    2.23  	<span class="date">$date</span>
    2.24  EOT
    2.25 -	# Post tools for auth users
    2.26 -	if admin_user; then
    2.27 +	# Post tools for admin users
    2.28 +	if check_auth && admin_user; then
    2.29  		post_tools
    2.30  		echo "</div>"
    2.31  	else
    2.32 @@ -86,7 +86,6 @@
    2.33  		header
    2.34  		html_header
    2.35  		user_box
    2.36 -		# Blog tools for auth users
    2.37  		if ! check_auth && admin_user; then
    2.38  			gettext "You must be admin to create a new Blog post"
    2.39  			html_footer && exit 0
    2.40 @@ -97,7 +96,7 @@
    2.41  			last=$(ls -r $blog | head -n 1)
    2.42  			nb=${last%.txt}
    2.43  			d=$(($nb + 1))
    2.44 -			conf=$(echo -e "\n\nAUTHOR=\"$user\"\nDATE=\"$date\"\n\n====Title====")
    2.45 +			conf=$(echo -e "\n\nAUTHOR=\"$user\"\nDATE=\"$date\"\n\n==== Title ====")
    2.46  		fi		
    2.47  		cat << EOT
    2.48  <h2>$(gettext "Blog post"): $d</h2>
    2.49 @@ -105,7 +104,7 @@
    2.50  <div id="edit">
    2.51  	<form method="get" action="$script" name="editor">
    2.52  		<input type="hidden" name="blogsave" value="$d" />
    2.53 -		<textarea name="content">$conf $(cat "$blog/$d.txt")</textarea>
    2.54 +		<textarea name="content">${conf}$(cat "$blog/$d.txt")</textarea>
    2.55  		<input type="submit" value="$(gettext "Post content")" />
    2.56  		$(gettext "Code Helper:")
    2.57  		$(cat lib/jseditor.html)
    2.58 @@ -136,8 +135,7 @@
    2.59  		header
    2.60  		html_header
    2.61  		user_box
    2.62 -		#echo "<h2>$(gettext "Latest blog posts")</h2>"
    2.63 -		# Blog tools for auth users
    2.64 +		# Blog tools for admin users
    2.65  		if check_auth && admin_user; then
    2.66  			blog_tools
    2.67  		fi
     3.1 --- a/plugins/cloud/cloud.cgi	Sun Jan 19 09:42:05 2014 +0000
     3.2 +++ b/plugins/cloud/cloud.cgi	Sun Jan 19 15:53:39 2014 +0100
     3.3 @@ -48,7 +48,7 @@
     3.4  	*\ cloudlog\ *)
     3.5  		# Display Cloud activity
     3.6  		d="Cloud activity"
     3.7 -		[ ! check_auth ] && header "Location: $WEB_URL"
     3.8 +		[ ! check_auth ] && header "Location: $script"
     3.9  		# Clean-up logfile
    3.10  		if [ "$(GET clean)" ]; then
    3.11  			rm -f ${cloudlog} && touch ${cloudlog}
     4.1 --- a/plugins/export/export.cgi	Sun Jan 19 09:42:05 2014 +0000
     4.2 +++ b/plugins/export/export.cgi	Sun Jan 19 15:53:39 2014 +0100
     4.3 @@ -100,7 +100,8 @@
     4.4  			rm -rf $tmp/export/$$
     4.5  			echo '</pre>'
     4.6  			dl_link ;;
     4.7 -		*\ export\ ) html_footer && exit 0 ;;
     4.8 +		*\ export\ )
     4.9 +			html_footer && exit 0 ;;
    4.10  		*)
    4.11  			echo '<pre>'
    4.12  			gettext "Export not yet implemented for"; echo ": $(GET export)"
     5.1 --- a/tools/serv.sh	Sun Jan 19 09:42:05 2014 +0000
     5.2 +++ b/tools/serv.sh	Sun Jan 19 15:53:39 2014 +0100
     5.3 @@ -4,6 +4,7 @@
     5.4  #
     5.5  
     5.6  port=8084
     5.7 +cd tools 2/dev/null || continue
     5.8  
     5.9  echo "Starting server on port: $port"
    5.10  echo "URL: http://localhost:$port/"