tinycm rev 52
Improved added some functions
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Jan 24 23:08:48 2014 +0100 (2014-01-24) |
parents | 3ca497430ce9 |
children | 190b9ba3af06 |
files | .hgignore index.cgi plugins/cloud/cloud.cgi plugins/keygen/keygen.cgi style.css |
line diff
1.1 --- a/.hgignore Tue Jan 21 00:03:00 2014 +0100 1.2 +++ b/.hgignore Fri Jan 24 23:08:48 2014 +0100 1.3 @@ -1,2 +1,5 @@ 1.4 cache/ 1.5 content/wiki/index.txt 1.6 +content/blog/ 1.7 +content/cloud/ 1.8 +content/forum/
2.1 --- a/index.cgi Tue Jan 21 00:03:00 2014 +0100 2.2 +++ b/index.cgi Fri Jan 24 23:08:48 2014 +0100 2.3 @@ -361,17 +361,32 @@ 2.4 EOT 2.5 } 2.6 2.7 -# CM tools (edit, diff, etc). 2.8 +# CM tools (edit, diff, etc) for auth users 2.9 wiki_tools() { 2.10 - cat << EOT 2.11 + if check_auth; then 2.12 + cat << EOT 2.13 <div id="tools"> 2.14 <a href="$script?edit=$d">$(gettext "Edit document")</a> 2.15 <a href="$script?diff=$d">$(gettext "Last diff")</a> 2.16 <a href="$script?log=$d">$(gettext "File log")</a> 2.17 - <a href="$script?dashboard">$(gettext "Dashboard")</a> 2.18 - $([ "$HG" == "yes" ] && echo "<a href='$script?hg'>Hg Log</a>") 2.19 + <a href='$script?dashboard'>$(gettext 'Dashboard')</a> 2.20 +EOT 2.21 + [ "$HG" == "yes" ] && echo "<a href='$script?hg'>Hg Log</a>" 2.22 + echo "</div>" 2.23 + fi 2.24 +} 2.25 + 2.26 +# Built-in Dashboard tools and ADMIN_TOOLS from plugins 2.27 +dashboard_tools() { 2.28 + if check_auth; then 2.29 + cat << EOT 2.30 +<div id='tools'> 2.31 + <a href='$script?log'>Activity log</a> 2.32 + <a href='$script?ls'>Pages list</a> 2.33 + <a href='$script?dashboard'>Dashboard</a> 2.34 </div> 2.35 EOT 2.36 + fi 2.37 } 2.38 2.39 # Get and display Gravatar image: get_gravatar email size 2.40 @@ -504,12 +519,8 @@ 2.41 user_box 2.42 # Main activity 2.43 if [ "$d" == "log" ]; then 2.44 - echo "<h2>$(gettext "Activity")</h2>" 2.45 - if check_auth; then 2.46 - echo "<div id='tools'>" 2.47 - echo "<a href='$script?dashboard'>Dashboard</a>" 2.48 - echo "</div>" 2.49 - fi 2.50 + dashboard_tools 2.51 + echo "<h2>$(gettext "Activity log")</h2>" 2.52 echo '<pre>' 2.53 if [ -f "$cache/log/activity.log" ]; then 2.54 IFS="|" 2.55 @@ -528,7 +539,9 @@ 2.56 echo '</pre>' 2.57 html_footer && exit 0 2.58 fi 2.59 + # Document activity 2.60 get_lang 2.61 + wiki_tools 2.62 echo "<h2>$(gettext "Activity for:") <a href='$script?d=$d'>$d</a></h2>" 2.63 echo '<pre>' 2.64 if [ -f "$cache/$d/activity.log" ]; then 2.65 @@ -537,9 +550,6 @@ 2.66 gettext "No log for: $d"; echo 2.67 fi 2.68 echo '</pre>' 2.69 - if check_auth; then 2.70 - wiki_tools 2.71 - fi 2.72 html_footer ;; 2.73 2.74 *\ ls\ *) 2.75 @@ -547,19 +557,16 @@ 2.76 header 2.77 html_header 2.78 user_box 2.79 + dashboard_tools 2.80 echo "<h2>$(gettext "Pages list")</h2>" 2.81 - if check_auth; then 2.82 - echo "<div id='tools'>" 2.83 - echo "<a href='$script?dashboard'>Dashboard</a>" 2.84 - echo "</div>" 2.85 - fi 2.86 echo '<pre>' 2.87 cd ${wiki} 2.88 for d in $(find . -type f | sed s'/.\///') 2.89 do 2.90 cat << EOT 2.91 <a href="$script?d=${d%.txt}">${d%.txt}</a> : \ 2.92 -<a href="$script?rm=$d">$(gettext "Remove")</a> 2.93 +<a href="$script?rm=$d">$(gettext "Remove")</a> || \ 2.94 +<a href="$script?edit=$d">$(gettext "Edit")</a> 2.95 EOT 2.96 done 2.97 echo '</pre>' 2.98 @@ -579,6 +586,7 @@ 2.99 html_header 2.100 user_box 2.101 get_lang 2.102 + wiki_tools 2.103 echo "<h2>$(gettext "Diff for:") <a href='$script?d=$d'>$d</a></h2>" 2.104 echo '<pre>' 2.105 if [ -f "$cache/$d/$date.diff" ]; then 2.106 @@ -591,9 +599,6 @@ 2.107 gettext "No diff for: $d"; echo 2.108 fi 2.109 echo '</pre>' 2.110 - if check_auth; then 2.111 - wiki_tools 2.112 - fi 2.113 html_footer ;; 2.114 2.115 *\ login\ *) 2.116 @@ -677,7 +682,6 @@ 2.117 if check_auth && ! admin_user; then 2.118 ADMIN_TOOLS="" 2.119 fi 2.120 - echo "<h2>$d</h2>" 2.121 if check_auth; then 2.122 cat << EOT 2.123 <div id="tools"> 2.124 @@ -687,6 +691,8 @@ 2.125 $ADMIN_TOOLS 2.126 </div> 2.127 2.128 +<h2>$d</h2> 2.129 + 2.130 <pre> 2.131 Users : $users 2.132 Wiki : $docs ($wikisize) 2.133 @@ -753,6 +759,7 @@ 2.134 html_header 2.135 user_box 2.136 get_lang 2.137 + 2.138 # Generate a default index on first run 2.139 if [ ! -f "$wiki/$index.txt" ]; then 2.140 if ! default_index; then 2.141 @@ -760,12 +767,25 @@ 2.142 html_footer && exit 0 2.143 fi 2.144 fi 2.145 + 2.146 # Check cache dir 2.147 if [ ! -w "$cache" ]; then 2.148 echo "<pre class='error'>Directory : cache/ is not writable" 2.149 echo "Command : install -m 0777 -d $tiny/cache</pre>" 2.150 html_footer && exit 0 2.151 fi 2.152 + 2.153 + # Wiki tools and Hg warning if enable but not initiated 2.154 + if [ "$HG" == "yes" ] && [ ! -d "$content/.hg" ]; then 2.155 + echo '<p class="error box">' 2.156 + gettext "Mercurial is enabled but no repository found" 2.157 + echo ": <a href='?hg=init'>Hg init</a>" 2.158 + echo '</p>' 2.159 + fi 2.160 + 2.161 + # Wiki tools 2.162 + wiki_tools 2.163 + 2.164 # Wiki document 2.165 if [ ! -f "$wiki/$d.txt" ]; then 2.166 echo "<h2>$d</h2>" 2.167 @@ -778,15 +798,6 @@ 2.168 cat $wiki/$d.txt | wiki_parser 2.169 fi 2.170 fi 2.171 - if check_auth; then 2.172 - wiki_tools 2.173 - if [ "$HG" == "yes" ] && [ ! -d "$content/.hg" ]; then 2.174 - echo '<p class="error box">' 2.175 - gettext "Mercurial is enabled but no repository found" 2.176 - echo ": <a href='?hg=init'>Hg init</a>" 2.177 - echo '</p>' 2.178 - fi 2.179 - fi 2.180 html_footer ;; 2.181 esac 2.182
3.1 --- a/plugins/cloud/cloud.cgi Tue Jan 21 00:03:00 2014 +0100 3.2 +++ b/plugins/cloud/cloud.cgi Fri Jan 24 23:08:48 2014 +0100 3.3 @@ -87,11 +87,18 @@ 3.4 gettext "You must be logged in to use the Cloud." 3.5 exit 1 3.6 fi 3.7 - cat << EOT 3.8 + cat << EOT 3.9 +<div id="tools"> 3.10 + <a href="$script?cloudlog">Activity</a> 3.11 + <a href="$content/cloud">Raw files</a> 3.12 +</div> 3.13 + 3.14 <h2>Cloud files</h2> 3.15 + 3.16 <p> 3.17 $(gettext "Upload files on the cloud to share them with some other people 3.18 -or use them in your documents content.") 3.19 +or use them in your documents content. Tip: Drag and Drop files from you 3.20 +desktop.") 3.21 </p> 3.22 <div style="text-align: center;"> 3.23 <form method="post" action="plugins/cloud/cloud.cgi?upcloud&user=$user" 3.24 @@ -100,11 +107,9 @@ 3.25 <input type="submit" value="Upload" /> 3.26 </form> 3.27 </div> 3.28 -<div id="tools"> 3.29 - <a href="$script?cloudlog">Activity</a> 3.30 - <a href="$content/cloud">Raw files</a> 3.31 +<p> 3.32 <b>Files:</b> $files | <b>Size:</b> $size 3.33 -</div> 3.34 +</p> 3.35 EOT 3.36 echo '<pre>' 3.37 # List all Cloud files
4.1 --- a/plugins/keygen/keygen.cgi Tue Jan 21 00:03:00 2014 +0100 4.2 +++ b/plugins/keygen/keygen.cgi Fri Jan 24 23:08:48 2014 +0100 4.3 @@ -38,7 +38,7 @@ 4.4 *\ md5sum\ *) echo "$keygen" | md5sum | awk '{print $1}' ;; 4.5 *\ sha256sum\ *) echo "$keygen" | sha256sum | awk '{print $1}' ;; 4.6 *\ sha512sum\ *) echo "$keygen" | sha512sum | awk '{print $1}' ;; 4.7 - *) gettext "Encrypted key" ;; 4.8 + *) echo "--" ;; 4.9 esac 4.10 # Random password 4.11 cat << EOT
5.1 --- a/style.css Tue Jan 21 00:03:00 2014 +0100 5.2 +++ b/style.css Fri Jan 24 23:08:48 2014 +0100 5.3 @@ -133,7 +133,7 @@ 5.4 /* Content */ 5.5 5.6 #content { 5.7 - margin: 40px auto; 5.8 + margin: 50px auto; 5.9 padding: 0 20px; 5.10 text-align: justify; 5.11 max-width: 680px; 5.12 @@ -212,12 +212,9 @@ 5.13 background-repeat: no-repeat; 5.14 } 5.15 5.16 -#tools { 5.17 - padding-top: 10px; 5.18 - margin: 20px 0px; 5.19 - /*border-top: 1px dotted #ccc; 5.20 - position: fixed; 5.21 - bottom: 10px;*/ 5.22 +#tools { 5.23 + position: absolute; 5.24 + top: 68px; 5.25 } 5.26 #tools a { text-decoration: none; margin: 4px 6px 4px 0px; } 5.27 5.28 @@ -283,7 +280,10 @@ 5.29 5.30 /* Plugins CSS */ 5.31 5.32 -.blogpost { border-bottom: 1px dotted #ddd; } 5.33 -.post-tools { border-bottom: 1px dotted #ddd; padding: 4px 0;} 5.34 + 5.35 +.post-tools { 5.36 + border-top: 1px dotted #ddd; 5.37 + border-bottom: 1px dotted #ddd; 5.38 + padding: 4px 0; } 5.39 .post-tools a { text-decoration: none; } 5.40 .post-tools a:hover { text-decoration: underline; }