tinycm rev 15
index.cgi: fixes and small improvments
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Jan 04 18:49:08 2014 +0100 (2014-01-04) |
parents | 81cc9819e295 |
children | 340dbb6265cd |
files | images/empty.png images/image.png index.cgi style.css |
line diff
1.1 Binary file images/empty.png has changed
2.1 Binary file images/image.png has changed
3.1 --- a/index.cgi Sat Jan 04 08:59:32 2014 +0000 3.2 +++ b/index.cgi Sat Jan 04 18:49:08 2014 +0100 3.3 @@ -2,7 +2,7 @@ 3.4 # 3.5 # TinyCM - Small, fast and elegent CGI/SHell Content Manager 3.6 # 3.7 -# Copyright (C) 2012 SliTaz GNU/Linux - BSD License 3.8 +# Copyright (C) 2012-2014 SliTaz GNU/Linux - BSD License 3.9 # 3.10 . /usr/lib/slitaz/httphelper 3.11 3.12 @@ -19,7 +19,7 @@ 3.13 plugins="plugins" 3.14 tmp="/tmp/tinycm" 3.15 sessions="$tmp/sessions" 3.16 -script=$SCRIPT_NAME 3.17 +script="$SCRIPT_NAME" 3.18 3.19 # Content negotiation for Gettext 3.20 IFS="," 3.21 @@ -272,13 +272,13 @@ 3.22 -e s"#''\([^']*\)''#<em>\1</em>#"g \ 3.23 -e s"#__\([^']*\)__#<u>\1</u>#"g \ 3.24 -e s"#\[\([^]]*\)|\($doc\)\]#<a href='$script?d=\2'>\1</a>#"g \ 3.25 - -e s"#http://\([^']*\).png#<img src='\0' />#"g \ 3.26 + -e s"#http://\([^']*\).png#<img src='\0'> \/>#"g \ 3.27 -e s"#http://\([^']*\).*# <a href='\0'>\1</a>#"g 3.28 #-e s"/^$/<br \/>/"g 3.29 } 3.30 3.31 link_user() { 3.32 - echo "<a href='$script?user=$user'>$user</a>" 3.33 + echo "<a href='$(basename $script)?user=$user'>$user</a>" 3.34 } 3.35 3.36 # Save a document. Do we need more than 1 backup and diff ? 3.37 @@ -432,12 +432,14 @@ 3.38 gettext "You must be logged in to edit pages" 3.39 fi 3.40 html_footer ;; 3.41 + 3.42 *\ save\ *) 3.43 d="$(GET save)" 3.44 if check_auth; then 3.45 save_document 3.46 fi 3.47 header "Location: $script?d=$d" ;; 3.48 + 3.49 *\ log\ *) 3.50 d="$(GET log)" 3.51 header 3.52 @@ -456,6 +458,7 @@ 3.53 wiki_tools 3.54 fi 3.55 html_footer ;; 3.56 + 3.57 *\ diff\ *) 3.58 d="$(GET diff)" 3.59 date="last" 3.60 @@ -479,6 +482,7 @@ 3.61 wiki_tools 3.62 fi 3.63 html_footer ;; 3.64 + 3.65 *\ login\ *) 3.66 # The login page 3.67 d="Login" 3.68 @@ -489,6 +493,7 @@ 3.69 user_box 3.70 login_page 3.71 html_footer ;; 3.72 + 3.73 *\ signup\ *) 3.74 # The login page 3.75 d="$(gettext "Sign Up")" 3.76 @@ -502,6 +507,7 @@ 3.77 gettext "Online registration is disabled" 3.78 fi 3.79 html_footer ;; 3.80 + 3.81 *\ logout\ *) 3.82 # Set a Cookie in the past to logout. 3.83 expires="Expires=Wed, 01-Jan-1980 00:00:00 GMT" 3.84 @@ -509,8 +515,10 @@ 3.85 rm -f "$sessions/$user" 3.86 header "Location: $script" "Set-Cookie: auth=none; $expires; HttpOnly" 3.87 fi ;; 3.88 + 3.89 *\ user\ *) 3.90 # User profile 3.91 + d="$(GET user)" 3.92 header 3.93 html_header 3.94 user_box 3.95 @@ -524,6 +532,7 @@ 3.96 public_people 3.97 fi 3.98 html_footer ;; 3.99 + 3.100 *\ dashboard\ *) 3.101 # For now simply list plugins and users info. We could have a 3.102 # dashbord only for ADMINS found in the config file. The dashboard 3.103 @@ -537,8 +546,8 @@ 3.104 size="$(du -sh $wiki | awk '{print $1}')" 3.105 echo "<h2>$d</h2>" 3.106 if check_auth; then 3.107 - echo "<p>$(gettext "Users:") $users</p>" 3.108 - echo "<p>$(gettext "Documents:") $docs ($size)</p>" 3.109 + echo "<p><b>$(gettext "Users:")</b> $users" 3.110 + echo "| <b>$(gettext "Documents:")</b> $docs ($size)</p>" 3.111 [ "$HG" != "yes" ] && echo $(gettext "Hg is disabled") 3.112 echo "<h3>$(gettext "Plugins")</h3>" 3.113 echo '<pre>' 3.114 @@ -552,6 +561,7 @@ 3.115 gettext "You must be logged in to view the dashboard." 3.116 fi 3.117 html_footer ;; 3.118 + 3.119 *\ hg\ *) 3.120 header 3.121 [ "$HG" != "yes" ] && gettext "Hg is disabled" && exit 0 3.122 @@ -578,6 +588,7 @@ 3.123 esac 3.124 hg_log 3.125 html_footer ;; 3.126 + 3.127 *) 3.128 # Display requested page 3.129 d="$(GET d)" 3.130 @@ -586,6 +597,7 @@ 3.131 html_header 3.132 user_box 3.133 get_lang 3.134 + # Generate a default index on first run. 3.135 if [ ! -f "$wiki/$index.txt" ]; then 3.136 default_index 3.137 fi
4.1 --- a/style.css Sat Jan 04 08:59:32 2014 +0000 4.2 +++ b/style.css Sat Jan 04 18:49:08 2014 +0100 4.3 @@ -148,6 +148,8 @@ 4.4 padding: 10px; 4.5 } 4.6 4.7 +pre img { padding: 4px; } 4.8 + 4.9 .error { color: red; } 4.10 .ok { color: green; } 4.11 4.12 @@ -211,7 +213,7 @@ 4.13 4.14 #tools { 4.15 padding-top: 10px; 4.16 - margin-top: 40px; 4.17 + margin-top: 20px; 4.18 /*border-top: 1px dotted #ccc; 4.19 position: fixed; 4.20 bottom: 10px;*/