/* along with Busy. If not, see <http://www.gnu.org/licenses/>.*/
div#INTRO {
- float: top;
margin: .5em;
padding: 0em .5em .5em .5em;
background-color: #F7F7F7;
- border-style: solid dashed dashed dashed;
+ border-style: solid solid solid solid;
border-width: 1px;
border-color: #AAF;
}
-
-#introtext h1 {
- text-align: center;
- font: normal bold 2em sans-serif;
- margin: 0em 0em 0em 0em;
- border-style: none none solid none;
+div.NEWS {
+ margin: 1em .5em;
+ padding: 0em .5em .5em .5em;
+ background-color: #F7F7F7;
+ border-style: solid dashed dashed dashed;
border-width: 1px;
-}
-#introtext h1 + h2{
- margin: .5em 0em .3em 0em;
-}
-#introtext h2 {
- text-align: left;
- font: normal bold 1.5em sans-serif;
- margin: .3em 0em .3em 0em;
- border-style: none none solid none;
- border-width: 1px; border-color: #AAF;
-}
-#introtext h2 + p { margin: 0em; }
-#introtext h3 {
- text-align: left;
- font-size: 1.2em;
- margin: .6em 0em .3em 0em;
-}
-#introtext h3 + p { margin: 0em; }
-#introtext h4 {
- text-align: left;
- font-size: 1em;
- margin: .6em 0em .3em 0em;
-}
-#introtext h4 + p { margin: 0em; }
-#introtext p {
- margin: .6em 0em;
-}
-#introtext ul {
- text-indent: 0em;
- margin: .3em 0em;
- padding: 0em 4ex;
-}
-#introtext ul ol {font-size: .9em; margin: 0em;}
-#introtext ol {
- text-indent: 0em;
- margin: .3em 0em;
- padding: 0em 4ex;
-}
-#introtext ol ul {font-size: .9em; margin: 0em;}
-#introtext pre {
- background-color: #EEE;
- padding: .5em;
- border-style: solid; border-width: 1px;
border-color: #AAF;
}
+
+.wikitext h2 { font-size: 1.5em; margin: .3em 0em; }
+.wikitext h3 { font-size: 1.2em; }
<div id="MAIN">
<div id="INTRO">
- <div id="introtext">
+ <div id="introtext"><div class="wikitext">
$([ -r "Home/intro" ] && _wiki "Home/intro")
$($ADM && echo "<hr><a class='function' href='#' onclick='javascript:hide_screen(\"introtext\");show_screen(\"introedit\");'>Edit</a>" )
- </div>
+ </div></div>
HomeEND
$ADM && cat <<HomeEND
<div id="introedit" style="display: none;">
- <form action="/write/introedit.cgi" method="post" accept-charset="UTF-8">
- <textarea name="intro" rows="10">$([ -r "Home/intro" ] && cat Home/intro)</textarea><br>
+ <form action="/write/introedit.cgi?i=intro" method="post" accept-charset="UTF-8">
+ <textarea name="text" rows="10">$([ -r "Home/intro" ] && cat Home/intro)</textarea><br>
<input type="submit">
<a class="function" href="#" onclick="javascript:hide_screen('introedit');show_screen('introtext');">Cancel</a>
</form>
</div>
HomeEND
-cat <<HomeEND
+echo '</div>'
+
+$ADM && cat <<HomeEND
+ <div class="NEWS">
+ <a id="new" class='function' href='#add' onclick='javascript:hide_screen("new");show_screen("add");'>Add News</a>
+ <div id="add" style="display: none;">
+ <form action="/write/introedit.cgi?i=news" method="post" accept-charset="UTF-8">
+ <textarea name="text" rows="10">$([ -r "$each" ] && cat $each)</textarea><br>
+ <input type="submit">
+ <a class="function" href="#new" onclick="javascript:hide_screen('add');show_screen('new');">Cancel</a>
+ </form>
</div>
+ </div>
+HomeEND
- $(stat -c '' Home/<0000000000-9999999999>-<000-999>.news && for each in $(ls -c News/<0000000000-9999999999>-<000-999>); do
- echo '<div id="NEWS">'
- _wiki "$each"
- echo '</div>'
- done)
+stat -c '' Home/<0000000000-9999999999>_<000-999>.news && for each in $(ls -c Home/<0000000000-9999999999>_<000-999>.news); do
+ info="$(sed 's:Home/::;s:.news::' <<<"$each")"
+ cat <<HomeEND
+ <div class="NEWS">
+ <div id="news_$info"><div class="wikitext">
+ $([ -r "$each" ] && _wiki "$each")
+ $($ADM && echo "<hr><a class='function' href='#edit_$info' onclick='javascript:hide_screen(\"news_$info\");show_screen(\"edit_$info\");'>Edit</a>" )
+ </div></div>
+HomeEND
+ $ADM && cat <<HomeEND
+ <div id="edit_$info" style="display: none;">
+ <form action="/write/introedit.cgi?i=$info" method="post" accept-charset="UTF-8">
+ <textarea name="text" rows="10">$([ -r "$each" ] && cat $each)</textarea><br>
+ <input type="submit">
+ <a class="function" href="#news_$info" onclick="javascript:hide_screen('edit_$info');show_screen('news_$info');">Cancel</a>
+ </form>
+ </div>
+HomeEND
+ echo '</div>'
+done
+
+cat <<HomeEND
</div>
<div id="RIGHT">
</div>
# You should have received a copy of the GNU Affero General Public License
# along with Busy. If not, see <http://www.gnu.org/licenses/>.
+info="$(egrep -o '(^|&)i=([0-9]{10}_[0-9]{3}|intro|news)(&|$)' <<<"${QUERY_STRING}" |sed 's:&::g;s:i=::')"
+[ "$info" = "news" ] && info="$(date +%s)_$(apg -M N -a 1 -n 1 -m 3 -x 3)"
+[ "$info" != "intro" ] && info="${info}.news"
+
if [ -n "${CONTENT_LENGTH}" -a "${CONTENT_LENGTH}" -gt 0 ]; then
(head -c "${CONTENT_LENGTH}"; echo)|sed 's/&/\n/g' |while read line; do
- if (echo "${line}" | egrep -xq 'intro=.+'); then
- intro="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
- intro=$(echo -e "${intro}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g')
+ if (echo "${line}" | egrep -xq 'text=.+'); then
+ text="$(cut -d= -f2- <<<"${line}" |sed 's/+/ /g;s/%/\\x/g')"
+ text=$(echo -e "${text}" |sed 's/\t/ /g;s/\r//g;s/\\/\\\\/g')
elif (echo "${line}" | egrep -xq 'cancel=.+'); then
cancel=true
fi
done
fi
-[ -z "$cancel" ] && grep -qx "${REMOTE_USER}" ../auth/admin.user && echo -e "${intro}" >"../Home/intro"
+[ -z "$cancel" ] && grep -qx "${REMOTE_USER}" ../auth/admin.user && echo -e "${text}" >"../Home/$info"
echo -n "Location: http://${HTTP_HOST}/?p=Home\n\n"