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 ) : get-live-updater-js* ( stream -- string )
#! Read all lines from the stream, creating a string of the result. #! 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 ) : get-live-updater-js ( filename -- string )
#! Return the liveUpdater javascript code as a string. #! Return the liveUpdater javascript code as a string.

View File

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

View File

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