Various changes to get cont-responder examples working with 0.76

cvs
Chris Double 2005-07-25 22:34:59 +00:00
parent 7b470868c1
commit 95a4fbb25f
3 changed files with 67 additions and 66 deletions

View File

@ -34,7 +34,7 @@ USE: lists
: get-live-updater-js* ( stream -- string )
#! Read all lines from the stream, creating a string of the result.
dup stream-readln dup [ , "\n" , get-live-updater-js* ] [ drop stream-close ] ifte ;
dup stream-readln dup [ % "\n" % get-live-updater-js* ] [ drop stream-close ] ifte ;
: get-live-updater-js ( filename -- string )
#! Return the liveUpdater javascript code as a string.

View File

@ -45,63 +45,63 @@ USE: sequences
: todo-stylesheet ( -- string )
#! Return the stylesheet for the todo list
[
"table.list {" ,
" text-align:center;" ,
" font-family: Verdana;" ,
" font-weight: normal;" ,
" font-size: 11px;" ,
" color: #404040;" ,
" background-color: #fafafa;" ,
" border: 1px #6699cc solid;" ,
" border-collapse: collapse;" ,
" boder-spacing: 0px;" ,
"}" ,
"tr.heading {" ,
" border-bottom: 2px solid #6699cc;" ,
" border-left: 1px solix #6699cc;" ,
" background-color: #BEC8D1;" ,
" text-align: left;" ,
" text-indent: 0px;" ,
" font-family: verdana;" ,
" font-weight: bold;" ,
" color: #404040;" ,
"}" ,
"tr.item {" ,
" border-bottom: 1px solid #9cf;" ,
" border-top: 0px;" ,
" border-left: 1px solid #9cf;" ,
" border-right: 0px;" ,
" text-align: left;" ,
" text-indent: 2px;" ,
" font-family: verdana, sans-serif, arial;" ,
" font-weight: normal;" ,
" color: #404040;" ,
" background-color: #fafafa;" ,
"}" ,
"tr.complete {" ,
" border-bottom: 1px solid #9cf;" ,
" border-top: 0px;" ,
" border-left: 1px solid #9cf;" ,
" border-right: 0px;" ,
" text-align: left;" ,
" text-indent: 2px;" ,
" font-family: verdana, sans-serif, arial;" ,
" font-weight: normal;" ,
" color: #404040;" ,
" background-color: #ccc;" ,
"}" ,
"td.lbl {" ,
" font-weight: bold; text-align: right;" ,
"}" ,
"tr.required {" ,
" background: #FCC;" ,
"}" ,
"input:focus {" ,
" background: yellow;" ,
"}" ,
"textarea:focus {" ,
" background: yellow;" ,
"}" ,
"table.list {" %
" text-align:center;" %
" font-family: Verdana;" %
" font-weight: normal;" %
" font-size: 11px;" %
" color: #404040;" %
" background-color: #fafafa;" %
" border: 1px #6699cc solid;" %
" border-collapse: collapse;" %
" boder-spacing: 0px;" %
"}" %
"tr.heading {" %
" border-bottom: 2px solid #6699cc;" %
" border-left: 1px solix #6699cc;" %
" background-color: #BEC8D1;" %
" text-align: left;" %
" text-indent: 0px;" %
" font-family: verdana;" %
" font-weight: bold;" %
" color: #404040;" %
"}" %
"tr.item {" %
" border-bottom: 1px solid #9cf;" %
" border-top: 0px;" %
" border-left: 1px solid #9cf;" %
" border-right: 0px;" %
" text-align: left;" %
" text-indent: 2px;" %
" font-family: verdana, sans-serif, arial;" %
" font-weight: normal;" %
" color: #404040;" %
" background-color: #fafafa;" %
"}" %
"tr.complete {" %
" border-bottom: 1px solid #9cf;" %
" border-top: 0px;" %
" border-left: 1px solid #9cf;" %
" border-right: 0px;" %
" text-align: left;" %
" text-indent: 2px;" %
" font-family: verdana, sans-serif, arial;" %
" font-weight: normal;" %
" color: #404040;" %
" background-color: #ccc;" %
"}" %
"td.lbl {" %
" font-weight: bold; text-align: right;" %
"}" %
"tr.required {" %
" background: #FCC;" %
"}" %
"input:focus {" %
" background: yellow;" %
"}" %
"textarea:focus {" %
" background: yellow;" %
"}" %
] make-string ;
: todo-stylesheet-url ( -- url )
@ -234,7 +234,7 @@ USE: sequences
: get-todo-filename ( database-path <todo> -- filename )
#! Get the filename containing the todo list details.
[ swap , todo-username , ".todo" , ] make-string ;
[ swap % todo-username % ".todo" % ] make-string ;
: add-default-todo-item ( <todo> -- )
#! Add a default todo item. This is a workaround for the
@ -473,7 +473,7 @@ USE: sequences
: show-todo-list ( -- )
#! Show the current todo list.
[
[ "todo" get todo-username , "'s To Do list" , ] make-string
[ "todo" get todo-username % "'s To Do list" % ] make-string
[ include-todo-stylesheet ]
[
"todo" get write-item-table

View File

@ -36,6 +36,7 @@ USE: prettyprint
USE: hashtables
USE: sequences
USE: http
USE: unparser
: <todo> ( user password -- <todo> )
#! Create an empty todo list
@ -93,13 +94,13 @@ USE: http
: read-todo ( -- <todo> )
#! Read a todo list from the current input stream.
read-line url-decode read-line url-decode <todo>
read-line str>number [
readln url-decode readln url-decode <todo>
readln str>number [
dup
<namespace> [
read-line url-decode "yes" = "complete?" set
read-line url-decode "priority" set
read-line url-decode "description" set
readln url-decode "yes" = "complete?" set
readln url-decode "priority" set
readln url-decode "description" set
] extend add-todo-item
] times ;
@ -149,7 +150,7 @@ USE: http
: priority-comparator ( item1 item2 -- bool )
#! Return true if item1 is a higher priority than item2
>r item-priority r> item-priority string> ;
>r item-priority r> item-priority lexi> ;
: todo-items ( <todo> -- alist )
#! Return a list of items for the given todo list.