label browser column headings

cvs
Chris Double 2004-08-02 21:33:58 +00:00
parent 5503ce06ce
commit 5973009ed1
1 changed files with 67 additions and 39 deletions

View File

@ -55,54 +55,82 @@ USE: errors
: write-vocab-list ( -- ) : write-vocab-list ( -- )
#! Write out the HTML for the list of vocabularies #! Write out the HTML for the list of vocabularies
<select name= "vocabs" size= "20" onchange= "document.forms.main.submit()" select> [ <table> [
vocabs [ <tr> [ <th> [ "Vocabularies" write ] </th> ] </tr>
dup "current-vocab" get [ "" ] unless* = [ <tr> [
"<option selected>" write <td> [
] [ <select name= "vocabs" size= "20" onchange= "document.forms.main.submit()" select> [
"<option>" write vocabs [
] ifte dup "current-vocab" get [ "" ] unless* = [
chars>entities write "<option selected>" write
"</option>\n" write ] [
] each "<option>" write
] </select> ; ] ifte
chars>entities write
"</option>\n" write
] each
] </select>
] </td>
] </tr>
] </table> ;
: write-word-list ( vocab -- ) : write-word-list ( vocab -- )
#! Write out the HTML for the list of words in a vocabulary. #! Write out the HTML for the list of words in a vocabulary.
<select name= "words" size= "20" onchange= "document.forms.main.submit()" select> [ <table> [
words [ <tr> [ <th> [ "Words" write ] </th> ] </tr>
dup "current-word" get [ "" ] unless* str-compare 0 = [ <tr> [
"<option selected>" write <td> [
] [ <select name= "words" size= "20" onchange= "document.forms.main.submit()" select> [
"<option>" write words [
] ifte dup "current-word" get [ "" ] unless* str-compare 0 = [
chars>entities write "<option selected>" write
"</option>\n" write ] [
] each "<option>" write
] </select> ; ] ifte
chars>entities write
"</option>\n" write
] each
] </select>
] </td>
] </tr>
] </table> ;
: write-editable-word-source ( vocab word -- ) : write-editable-word-source ( vocab word -- )
#! Write the source in a manner allowing it to be edited. #! Write the source in a manner allowing it to be edited.
<textarea name= "eval" rows= "30" cols= "80" textarea> [ <table> [
1024 <string-output-stream> dup >r [ <tr> [ <td> [ "<b>Source</b>" write ] </td> ] </tr>
>r words r> swap [ over swap dup word-name rot = [ see ] [ drop ] ifte ] each drop <tr> [
] with-stream r> stream>str chars>entities write <td> [
] </textarea> <br/> <textarea name= "eval" rows= "30" cols= "80" textarea> [
"Accept" button ; 1024 <string-output-stream> dup >r [
>r words r> swap [ over swap dup word-name rot = [ see ] [ drop ] ifte ] each drop
] with-stream r> stream>str chars>entities write
] </textarea> <br/>
"Accept" button
] </td>
] </tr>
] </table> ;
: write-word-source ( vocab word -- ) : write-word-source ( vocab word -- )
#! Write the source for the given word from the vocab as HTML. #! Write the source for the given word from the vocab as HTML.
<namespace> [ <table> [
"responder" "inspect" put <tr> [ <td> [ "<b>Source</b>" write ] </td> ] </tr>
"allow-edit?" get [ "Edit" [ "edit-state" t put ] quot-href <br/> ] when <tr> [
"edit-state" get [ <td> [
write-editable-word-source <namespace> [
] [ "responder" "inspect" put
[ "allow-edit?" get [ "Edit" [ "edit-state" t put ] quot-href <br/> ] when
>r words r> swap [ over swap dup word-name rot = [ see ] [ drop ] ifte ] each drop "edit-state" get [
] with-simple-html-output write-editable-word-source
] ifte ] [
] bind drop ; [
>r words r> swap [ over swap dup word-name rot = [ see ] [ drop ] ifte ] each drop
] with-simple-html-output
] ifte
] bind drop
] </td>
] </tr>
] </table> ;
: get-vm-runtime ( -- java.lang.Runtime ) : get-vm-runtime ( -- java.lang.Runtime )
f "java.lang.Runtime" "getRuntime" jinvoke-static ; f "java.lang.Runtime" "getRuntime" jinvoke-static ;