tinycm rev 99

Add Facebook page to community plugins and improve TinyCM site(s) update
author Christophe Lincoln <pankso@slitaz.org>
date Mon Feb 20 02:20:44 2017 +0100 (2017-02-20)
parents 538ed788329d
children d6c0da38715f
files TODO config.cgi plugins/blog/blog.conf plugins/cloud/cloud.conf plugins/community/community.cgi plugins/community/community.conf plugins/dashboard/dashboard.conf plugins/export/export.conf plugins/forum/forum.conf plugins/keygen/keygen.conf plugins/skel/skel.conf plugins/users/users.cgi plugins/users/users.conf tinycm
line diff
     1.1 --- a/TODO	Sun Feb 19 23:58:18 2017 +0100
     1.2 +++ b/TODO	Mon Feb 20 02:20:44 2017 +0100
     1.3 @@ -1,7 +1,7 @@
     1.4  
     1.5  
     1.6 -	* HTML5 Video player
     1.7 +	* HTML5 Video player --> MediaBox
     1.8  	* Mail integration in SHell or Python
     1.9  	* PHP content viewer for hosting without CGI support
    1.10 -	* Use tazu to manage users ? Use in option system users in /etc ?
    1.11 -	
    1.12 +	* Use tazu to manage users --> let users change passwd
    1.13 +	* Better documentation on tinycm.slitaz.org (install, plugins)
     2.1 --- a/config.cgi	Sun Feb 19 23:58:18 2017 +0100
     2.2 +++ b/config.cgi	Mon Feb 20 02:20:44 2017 +0100
     2.3 @@ -1,4 +1,5 @@
     2.4 -# CM configuration
     2.5 +#
     2.6 +# TinyCM configuration
     2.7  #
     2.8  
     2.9  # Administrator email.
    2.10 @@ -18,3 +19,17 @@
    2.11  
    2.12  # Use Mercurial repo for content and configure user name
    2.13  HG="no"
    2.14 +
    2.15 +#
    2.16 +# Plugin configuration: community.cgi
    2.17 +#
    2.18 +
    2.19 +# Wall mode: public/private
    2.20 +WALL_MODE="public"
    2.21 +
    2.22 +# Max length for messages on the Wall
    2.23 +WALL_MESSAGES_LENGTH="240"
    2.24 +
    2.25 +# Twitter user name and/or Facebook page URL name 
    2.26 +TWITTER_USER="slitaz"
    2.27 +FACEBOOK_PAGE="slitaz"
     3.1 --- a/plugins/blog/blog.conf	Sun Feb 19 23:58:18 2017 +0100
     3.2 +++ b/plugins/blog/blog.conf	Mon Feb 20 02:20:44 2017 +0100
     3.3 @@ -3,5 +3,3 @@
     3.4  PLUGIN="Blog Post"
     3.5  SHORT_DESC="A tiny Blog plugin for TinyCM"
     3.6  MAINTAINER="devel@slitaz.org"
     3.7 -
     3.8 -# Configurable variables used in plugin.cgi
     4.1 --- a/plugins/cloud/cloud.conf	Sun Feb 19 23:58:18 2017 +0100
     4.2 +++ b/plugins/cloud/cloud.conf	Mon Feb 20 02:20:44 2017 +0100
     4.3 @@ -6,5 +6,3 @@
     4.4  
     4.5  # This is a tool for auth users
     4.6  DASHBOARD_TOOLS="${DASHBOARD_TOOLS} <a href='?cloud'>Cloud</a>"
     4.7 -
     4.8 -# Configurable variables used in plugin.cgi
     5.1 --- a/plugins/community/community.cgi	Sun Feb 19 23:58:18 2017 +0100
     5.2 +++ b/plugins/community/community.cgi	Mon Feb 20 02:20:44 2017 +0100
     5.3 @@ -99,6 +99,39 @@
     5.4  EOT
     5.5  		html_footer && exit 0 ;;
     5.6  	
     5.7 +	*\ facebook\ *)
     5.8 +		d="Facebook @${FACEBOOK_PAGE}"
     5.9 +		header
    5.10 +		html_header
    5.11 +		user_box
    5.12 +		cat << EOT
    5.13 +<div id="fb-root"></div>
    5.14 +<script>(function(d, s, id) {
    5.15 +  var js, fjs = d.getElementsByTagName(s)[0];
    5.16 +  if (d.getElementById(id)) return;
    5.17 +  js = d.createElement(s); js.id = id;
    5.18 +  js.src = "//connect.facebook.net/fr_FR/sdk.js#xfbml=1&version=v2.8";
    5.19 +  fjs.parentNode.insertBefore(js, fjs);
    5.20 +}(document, 'script', 'facebook-jssdk'));</script>
    5.21 +
    5.22 +<div style="text-align: center;">
    5.23 +	<div class="fb-page"
    5.24 +		data-href="https://www.facebook.com/${FACEBOOK_PAGE}" 
    5.25 +		data-tabs="timeline" 
    5.26 +		data-width="500" 
    5.27 +		data-height="500" 
    5.28 +		data-small-header="true" 
    5.29 +		data-adapt-container-width="false" 
    5.30 +		data-hide-cover="true" 
    5.31 +		data-show-facepile="false">
    5.32 +		<blockquote cite="https://www.facebook.com/${FACEBOOK_PAGE}" class="fb-xfbml-parse-ignore">
    5.33 +			<a href="https://www.facebook.com/${FACEBOOK_PAGE}">${FACEBOOK_PAGE}</a>
    5.34 +		</blockquote>
    5.35 +	</div>
    5.36 +</div>
    5.37 +EOT
    5.38 +		html_footer && exit 0 ;;
    5.39 +		
    5.40  	*\ community\ *)
    5.41  		d="Community Tools"
    5.42  		header
    5.43 @@ -111,6 +144,7 @@
    5.44  		cat << EOT
    5.45  <a href="$script?wall">Community Wall</a>
    5.46  <a href="$script?twitter">Twitter Timeline</a>
    5.47 +<a href="$script?facebook">Facebook Page</a>
    5.48  </div>
    5.49  <h2>$d</h2>
    5.50  <p>$SHORT_DESC</p>
     6.1 --- a/plugins/community/community.conf	Sun Feb 19 23:58:18 2017 +0100
     6.2 +++ b/plugins/community/community.conf	Mon Feb 20 02:20:44 2017 +0100
     6.3 @@ -4,15 +4,5 @@
     6.4  SHORT_DESC="Small social community functions and tools for TinyCM"
     6.5  MAINTAINER="pankso@slitaz.org"
     6.6  
     6.7 +# Authenticated users
     6.8  DASHBOARD_TOOLS="${DASHBOARD_TOOLS} <a href='?community'>Community</a>"
     6.9 -
    6.10 -# Configurable variables used in community.cgi
    6.11 -
    6.12 -# Wall mode: public/private
    6.13 -WALL_MODE="public"
    6.14 -
    6.15 -# Max length for messages on the Wall
    6.16 -WALL_MESSAGES_LENGTH="240"
    6.17 -
    6.18 -# Twitter account user name 
    6.19 -TWITTER_USER="slitaz"
     7.1 --- a/plugins/dashboard/dashboard.conf	Sun Feb 19 23:58:18 2017 +0100
     7.2 +++ b/plugins/dashboard/dashboard.conf	Mon Feb 20 02:20:44 2017 +0100
     7.3 @@ -8,5 +8,3 @@
     7.4  
     7.5  # Authenticated users
     7.6  PLUGINS_TOOLS="<a href='?dashboard'>Dashboard</a> ${PLUGINS_TOOLS}"
     7.7 -
     7.8 -# Configurable variables used in plugin.cgi
     8.1 --- a/plugins/export/export.conf	Sun Feb 19 23:58:18 2017 +0100
     8.2 +++ b/plugins/export/export.conf	Mon Feb 20 02:20:44 2017 +0100
     8.3 @@ -3,5 +3,3 @@
     8.4  PLUGIN="Export Content"
     8.5  SHORT_DESC="Export Wiki and other content to HTML"
     8.6  MAINTAINER="devel@slitaz.org"
     8.7 -
     8.8 -# Configurable variables used in plugin.cgi
     9.1 --- a/plugins/forum/forum.conf	Sun Feb 19 23:58:18 2017 +0100
     9.2 +++ b/plugins/forum/forum.conf	Mon Feb 20 02:20:44 2017 +0100
     9.3 @@ -3,5 +3,3 @@
     9.4  PLUGIN="Hashtags Forum"
     9.5  SHORT_DESC="Support/discussion forum using #hashtags"
     9.6  MAINTAINER="devel@slitaz.org"
     9.7 -
     9.8 -# Configurable variables used in plugin.cgi
    10.1 --- a/plugins/keygen/keygen.conf	Sun Feb 19 23:58:18 2017 +0100
    10.2 +++ b/plugins/keygen/keygen.conf	Mon Feb 20 02:20:44 2017 +0100
    10.3 @@ -8,5 +8,3 @@
    10.4  # Example url to add in a HTML template: http://site/index.cgi?keygen
    10.5  
    10.6  DASHBOARD_TOOLS="${DASHBOARD_TOOLS} <a href='?keygen'>Keygen</a>"
    10.7 -
    10.8 -# Configurable variables used in plugin.cgi
    11.1 --- a/plugins/skel/skel.conf	Sun Feb 19 23:58:18 2017 +0100
    11.2 +++ b/plugins/skel/skel.conf	Mon Feb 20 02:20:44 2017 +0100
    11.3 @@ -4,4 +4,9 @@
    11.4  SHORT_DESC="An example plugin for TinyCM"
    11.5  MAINTAINER="devel@slitaz.org"
    11.6  
    11.7 -# Configurable variables used in plugin.cgi
    11.8 +# Authenticated users
    11.9 +PLUGINS_TOOLS="${PLUGINS_TOOLS}"
   11.10 +DASHBOARD_TOOLS="${DASHBOARD_TOOLS}"
   11.11 +
   11.12 +# Admin only in Dashboard
   11.13 +ADMIN_TOOLS="${ADMIN_TOOLS}"
    12.1 --- a/plugins/users/users.cgi	Sun Feb 19 23:58:18 2017 +0100
    12.2 +++ b/plugins/users/users.cgi	Mon Feb 20 02:20:44 2017 +0100
    12.3 @@ -15,7 +15,7 @@
    12.4  </pre>
    12.5  
    12.6  <div id="tools">
    12.7 -	<a href="$script?dashboard">Dashboard</a>
    12.8 +	$PLUGINS_TOOLS
    12.9  	<a href="$script?modprofile">$(gettext "Modify profile")</a>
   12.10  </div>
   12.11  EOT
   12.12 @@ -136,6 +136,18 @@
   12.13  			. $PEOPLE/"$(GET user)"/account.conf
   12.14  			public_people
   12.15  		fi
   12.16 +		
   12.17 +		# Messages plugin integration
   12.18 +		if [ -x "$plugins/messages/messages.cgi" ]; then
   12.19 +			if check_auth && [ "$(GET user)" != "$user" ]; then
   12.20 +				cat << EOT
   12.21 +<div id="tools">
   12.22 +<a href="$script?messages&amp;to=$(GET user)">$(gettext "Send message")</a>
   12.23 +</div>
   12.24 +EOT
   12.25 +			fi
   12.26 +		fi
   12.27 +		
   12.28  		# Display personal user profile
   12.29  		if [ -f "$PEOPLE/$USER/profile.txt" ]; then
   12.30  			echo "<h2>$(gettext "About me")</h2>"
    13.1 --- a/plugins/users/users.conf	Sun Feb 19 23:58:18 2017 +0100
    13.2 +++ b/plugins/users/users.conf	Mon Feb 20 02:20:44 2017 +0100
    13.3 @@ -10,5 +10,3 @@
    13.4  
    13.5  # Admin only in Dashboard
    13.6  ADMIN_TOOLS="${ADMIN_TOOLS} <a href='?users'>Users</a>"
    13.7 -
    13.8 -# Configurable variables used in plugin.cgi
    14.1 --- a/tinycm	Sun Feb 19 23:58:18 2017 +0100
    14.2 +++ b/tinycm	Mon Feb 20 02:20:44 2017 +0100
    14.3 @@ -55,6 +55,52 @@
    14.4  	fi
    14.5  }
    14.6  
    14.7 +# Rebuilt an up-to-date config file, plugins may need new variables
    14.8 +update_config() {
    14.9 +	echo "Updating config file: confi.cgi"
   14.10 +	. ${path}/config.cgi
   14.11 +	[ ! "$WALL_MODE" ] && WALL_MODE="public"
   14.12 +	[ ! "$WALL_MESSAGES_LENGTH" ] && WALL_MESSAGES_LENGTH="240"
   14.13 +	cat > ${path}/config.cgi << EOT
   14.14 +#
   14.15 +# TinyCM configuration
   14.16 +#
   14.17 +
   14.18 +# Administrator email.
   14.19 +ADMIN_MAIL="$ADMIN_MAIL"
   14.20 +
   14.21 +# Auth file for user
   14.22 +AUTH_FILE="$AUTH_FILE"
   14.23 +
   14.24 +# People config files
   14.25 +PEOPLE="$PEOPLE"
   14.26 +
   14.27 +# CM documents languages.
   14.28 +LANGUAGES="$LANGUAGES"
   14.29 +
   14.30 +# Online registration for user
   14.31 +ONLINE_SIGNUP="$ONLINE_SIGNUP"
   14.32 +
   14.33 +# Use Mercurial repo for content and configure user name
   14.34 +HG="$HG"
   14.35 +
   14.36 +#
   14.37 +# Plugin configuration: community.cgi
   14.38 +#
   14.39 +
   14.40 +# Wall mode: public/private
   14.41 +WALL_MODE="$WALL_MODE"
   14.42 +
   14.43 +# Max length for messages on the Wall
   14.44 +WALL_MESSAGES_LENGTH="$WALL_MESSAGES_LENGTH"
   14.45 +
   14.46 +# Twitter user name and/or Facebook page URL name 
   14.47 +TWITTER_USER="$TWITTER_USER"
   14.48 +FACEBOOK_PAGE="$FACEBOOK_PAGE"
   14.49 +EOT
   14.50 +	unset TWITTER_USER FACEBOOK_PAGE
   14.51 +}
   14.52 +
   14.53  #
   14.54  # Commands
   14.55  #
   14.56 @@ -85,7 +131,8 @@
   14.57  			exit 1
   14.58  		fi
   14.59  		echo ""
   14.60 -		boldify $(echo "Updating TinyCM installs...")
   14.61 +		boldify "Updating TinyCM install(s)..."
   14.62 +		echo ""
   14.63  		
   14.64  		# File liste of args
   14.65  		if [ -f "$path" ]; then
   14.66 @@ -97,10 +144,11 @@
   14.67  		for path in ${paths}
   14.68  		do
   14.69  			check_tiny
   14.70 -			echo "Updating: $path"
   14.71 +			echo "Updating TinyCM: $path"
   14.72  			cp -a index.cgi $path
   14.73  			cp -a lib/functions.js $path/lib
   14.74  			cp -a lib/jseditor.html $path/lib
   14.75 +			echo "Updating plugins..."
   14.76  			for plug in $(ls plugins)
   14.77  			do
   14.78  				if [ -d "$path/plugins/$plug" ]; then
   14.79 @@ -108,6 +156,7 @@
   14.80  					cp -a plugins/$plug $path/plugins
   14.81  				fi
   14.82  			done
   14.83 +			update_config
   14.84  		done && echo "" ;;
   14.85  	*)
   14.86  		usage ;;