Commit 69204960 authored by Dave Cooper's avatar Dave Cooper
Browse files

finished Custom User Interfaces manual chapter.

parent 3efc72c9
(in-package :gwl-user)
(define-object president (base-html-sheet)
:input-slots
((name "Carter") (term 1976) (table-border 1))
:functions
((write-html-sheet
() (with-cl-who (:indent t)
(:html (:head (:title (fmt "Info on President: ~a"
(the name))))
(:body ((:table :border (the table-border))
(:tr (:th "Name") (:th "Term"))
(:tr (:td (str (the name)))
(:td (str (the term)))))))))))
;;
;; Access the above example with
;; http://localhost:9000/make?object=gwl-user::president
;;
<html>
<head>
<title>Info on President: Carter
</title>
</head>
<body>
<table border="1">
<tr> <th>Name</th>
<th>Term</th>
</tr>
<tr> <td>Carter</td>
<td>1976</td>
</tr>
</table>
</body></html>
(in-package :gwl-user)
(define-object presidents (base-html-sheet)
:input-slots
((presidents (list (list :name "Ford"
:term 1974)
(list :name "Carter"
:term 1976)
(list :name "Clinton"
:term 1992)
(list :name "Bush"
:term 2000)
(list :name "Obama"
:term 2008)))
(table-border 1))
:functions
((write-html-sheet
()
(with-cl-who (:indent t)
(let ((title (format nil "Info on ~a Presidents:"
(length (the presidents)))))
(htm
(:html
(:head (:title (str title)))
(:body
(:p (:c (:h3 (str title))))
((:table :border (the table-border))
(:tr (:th "Name") (:th "Term"))
(dolist (president (the presidents))
(htm
(:tr (:td (str (getf president :name)))
(:td (str (getf president :term)))))))))))))))
;;
;; Access the above example with
;; http://localhost:9000/make?object=gwl-user::presidents
;;
(in-package :gwl-user)
(define-object presidents-with-pages (base-html-sheet)
:input-slots
((presidents (list (list :name "Ford" :term 1974)
(list :name "Carter" :term 1976)
(list :name "Clinton" :term 1992)
(list :name "Bush" :term 2000)
(list :name "Obama" :term 2008)))
(table-border 1))
:objects
((president-pages :type 'president-page
:sequence (:size (length (the presidents)))
:name (getf (nth (the-child index) (the presidents))
:name)
:term (getf (nth (the-child index) (the presidents))
:term)))
:functions
((write-html-sheet
()
(with-cl-who (:indent t)
(let ((title (format nil "Info on ~a Presidents:"
(length (the presidents)))))
(htm
(:html
(:head (:title (str title)))
(:body
(:p (:c (:h3 (str title))))
(:ol
(dolist (page (list-elements (the president-pages)))
(htm
(:li
(the-object
page
(write-self-link :display-string
(the-object page name)))))))))))))))
;;
;; Access the above example with
;; http://localhost:9000/make?object=gwl-user::presidents-with-pages
;;
(in-package :gwl-user)
(define-object president-page (base-html-sheet)
:input-slots
(name term)
:functions
((write-html-sheet
()
(with-cl-who ()
(let ((title (format nil "Term for President ~a:"
(the name))))
(htm
(:html
(:head (:title (str title)))
(:body
(the (write-back-link :display-string "&lt;Back"))
(:p (:c (:h3 (str title))))
(:p (str (the term)))))))))))
(in-package :gwl-user)
(define-object revenue-lookup-old-school (base-ajax-sheet)
:input-slots
((revenue-data '(2003 25000
2004 34000
2005 21000
2006 37000
2007 48000
2008 54000
2009 78000)))
:functions
((write-html-sheet
()
(with-cl-who ()
(when *developing?* (str (the development-links)))
(with-html-form (:cl-who? t)
(:p (str (the table-border html-string)))
(:p (str (the cell-padding html-string)))
(:p (str (the selected-year html-string)))
(:p ((:input :type :submit :value " OK "))))
(:p ((:table :border (the table-border value)
:cellpadding (the cell-padding value))
(:tr (:th (fmt "Revenue for Year ~a:"
(the selected-year value)))
(:td (str (getf (the revenue-data)
(the selected-year value))))))))))
:objects
((table-border :type 'menu-form-control
:size 1 :choice-list '(0 1)
:default 0)
(cell-padding :type 'menu-form-control
:size 1 :choice-list '(0 3 6 9 12)
:default 0)
(selected-year :type 'menu-form-control
:size 1 :choice-list (plist-keys (the revenue-data))
:default (first (the-child choice-list)))))
(publish-gwl-app "/revenue-lookup-old-school"
"gwl-user::revenue-lookup-old-school")
;;
;; Access the above example with
;; http://localhost:9000/make?object=gwl-user::revenue-lookup-old-school
;;
(in-package :gwl-user)
(define-object revenue-lookup (base-ajax-sheet)
:input-slots
((revenue-data '(2003 25000
2004 34000
2005 21000
2006 37000
2007 48000
2008 54000
2009 78000)))
:computed-slots
((main-sheet-body
(with-cl-who-string ()
(str (the main-section main-div)))))
:objects
((table-border :type 'menu-form-control
:size 1
:choice-list '(0 1)
:default 0
:ajax-submit-on-change? t)
(cell-padding :type 'menu-form-control
:size 1
:choice-list '(0 3 6 9 12)
:default 0
:ajax-submit-on-change? t)
(selected-year :type 'menu-form-control
:size 1
:choice-list (plist-keys (the revenue-data))
:default (first (the-child choice-list))
:ajax-submit-on-change? t)
(main-section
:type 'sheet-section
:inner-html (with-cl-who-string ()
(:p (str (the development-links)))
(:p (str (the table-border html-string)))
(:p (str (the cell-padding html-string)))
(:p (str (the selected-year html-string)))
(:p ((:table :border (the table-border value)
:cellpadding (the cell-padding value))
(:tr (:th (fmt "Revenue for Year ~a:"
(the selected-year value)))
(:td (str (getf (the revenue-data)
(the selected-year value)))))))))))
(publish-gwl-app "/revenue-lookup"
"gwl-user::revenue-lookup")
(in-package :gwl-user)
(define-object box-with-inputs (base-ajax-sheet)
:computed-slots
((use-raphael? t)
(main-sheet-body
(with-cl-who-string ()
(:p (when *developing?* (str (the development-links))))
(:p (str (the inputs-section main-div)))
(:table
(:tr
(dolist (viewport (list-elements (the viewport-sections)))
(htm (:td (:td (str (the-object viewport main-div)))))))))))
:objects
((box :type 'box
:height (the inputs-section box-height value)
:width (the inputs-section box-width value)
:length (the inputs-section box-length value))
(inputs-section :type 'inputs-section)
(viewport-sections
:type 'base-ajax-graphics-sheet
:sequence (:size 2)
:view-direction-default (ecase (the-child index)
(0 :top) (1 :trimetric))
:image-format-default :raphael
:display-list-objects (list (the box))
:length 250 :width 250)))
(define-object inputs-section (sheet-section)
:computed-slots
((inner-html (with-cl-who-string ()
(:p (str (the box-length html-string)))
(:p (str (the box-width html-string)))
(:p (str (the box-height html-string))))))
:objects
((box-length :type 'text-form-control
:default 25
:ajax-submit-on-change? t)
(box-width :type 'text-form-control
:default 35
:ajax-submit-on-change? t)
(box-height :type 'text-form-control
:default 45
:ajax-submit-on-change? t)))
(publish-gwl-app "/box-with-inputs"
"gwl-user::box-with-inputs")
;;
;; Access the above example with
;; http://localhost:9000/make?object=gwl-user::box-with-inputs
;;
......@@ -208,18 +208,40 @@
\newlabel{fig:gwl-2-image}{{8.5}{49}{Mixing Static HTML and Dynamic Content\relax }{figure.8.5}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.2.3}Linking to Multiple Pages}{49}{subsection.8.2.3}}
\newlabel{subsec:linkingtomultiplepages}{{8.2.3}{49}{Linking to Multiple Pages\relax }{subsection.8.2.3}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.2.4}Form Controls and Fillout-Forms}{49}{subsection.8.2.4}}
\newlabel{subsec:formcontrolsandfillout-forms}{{8.2.4}{49}{Form Controls and Fillout-Forms\relax }{subsection.8.2.4}{}}
\@writefile{toc}{\contentsline {subsubsection}{Form Controls}{49}{section*.9}}
\newlabel{subsubsec:formcontrols}{{8.2.4}{49}{Form Controls\relax }{section*.9}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {8.6}{\ignorespaces Linking to Multiple Pages}}{50}{figure.8.6}}
\newlabel{fig:gwl-3}{{8.6}{50}{Linking to Multiple Pages\relax }{figure.8.6}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {8.7}{\ignorespaces Linking to Multiple Pages}}{50}{figure.8.7}}
\newlabel{fig:gwl-3a}{{8.7}{50}{Linking to Multiple Pages\relax }{figure.8.7}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {8.8}{\ignorespaces Linking to Multiple Pages}}{51}{figure.8.8}}
\newlabel{fig:gwl-3-image}{{8.8}{51}{Linking to Multiple Pages\relax }{figure.8.8}{}}
\@writefile{toc}{\contentsline {chapter}{\numberline {9}More Common Lisp for Gendl}{53}{chapter.9}}
\@writefile{toc}{\contentsline {subsubsection}{Fillout Forms}{51}{section*.10}}
\newlabel{subsubsec:filloutforms}{{8.2.4}{51}{Fillout Forms\relax }{section*.10}{}}
\@writefile{toc}{\contentsline {section}{\numberline {8.3}Partial Page Updates with gdlAjax}{51}{section.8.3}}
\newlabel{sec:partialpageupdateswithgdlajax}{{8.3}{51}{Partial Page Updates with gdlAjax\relax }{section.8.3}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {8.9}{\ignorespaces Form Controls and Fillout Forms}}{52}{figure.8.9}}
\newlabel{fig:gwl-3b}{{8.9}{52}{Form Controls and Fillout Forms\relax }{figure.8.9}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {8.10}{\ignorespaces Form Controls and Fillout Forms}}{53}{figure.8.10}}
\newlabel{fig:gwl-3b-image}{{8.10}{53}{Form Controls and Fillout Forms\relax }{figure.8.10}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.3.1}Steps to Create a gdlAjax Application}{53}{subsection.8.3.1}}
\newlabel{subsec:stepstocreateagdlajaxapplication}{{8.3.1}{53}{Steps to Create a gdlAjax Application\relax }{subsection.8.3.1}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {8.3.2}Including Graphics}{54}{subsection.8.3.2}}
\newlabel{subsec:includinggraphics}{{8.3.2}{54}{Including Graphics\relax }{subsection.8.3.2}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {8.11}{\ignorespaces Partial Page Updates with GdlAjax}}{55}{figure.8.11}}
\newlabel{fig:gwl-4}{{8.11}{55}{Partial Page Updates with GdlAjax\relax }{figure.8.11}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {8.12}{\ignorespaces Including Graphics in a Web Page}}{56}{figure.8.12}}
\newlabel{fig:gwl-5}{{8.12}{56}{Including Graphics in a Web Page\relax }{figure.8.12}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {8.13}{\ignorespaces Including Graphics}}{57}{figure.8.13}}
\newlabel{fig:gwl-5-image}{{8.13}{57}{Including Graphics\relax }{figure.8.13}{}}
\@writefile{toc}{\contentsline {chapter}{\numberline {9}More Common Lisp for Gendl}{59}{chapter.9}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\newlabel{chap:morecommonlispforgendl}{{9}{53}{More Common Lisp for Gendl\relax }{chapter.9}{}}
\@writefile{toc}{\contentsline {chapter}{\numberline {10}Advanced Gendl}{55}{chapter.10}}
\newlabel{chap:morecommonlispforgendl}{{9}{59}{More Common Lisp for Gendl\relax }{chapter.9}{}}
\@writefile{toc}{\contentsline {chapter}{\numberline {10}Advanced Gendl}{61}{chapter.10}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\newlabel{chap:advancedgendl}{{10}{55}{Advanced Gendl\relax }{chapter.10}{}}
\newlabel{chap:upgradenotes}{{10}{57}{Upgrade Notes\relax }{chapter*.9}{}}
\newlabel{chap:advancedgendl}{{10}{61}{Advanced Gendl\relax }{chapter.10}{}}
\newlabel{chap:upgradenotes}{{10}{63}{Upgrade Notes\relax }{chapter*.11}{}}
This is makeindex, version 2.15 [TeX Live 2011] (kpathsea + Thai support).
This is makeindex, version 2.15 [TeX Live 2012] (kpathsea + Thai support).
Scanning input file tutorial.idx....done (37 entries accepted, 0 rejected).
Sorting entries....done (208 comparisons).
Generating output file tutorial.ind....done (81 lines written, 0 warnings).
......
This diff is collapsed.
......@@ -58,5 +58,9 @@
\BOOKMARK [2][-]{subsection.8.2.1}{A Simple Static Page Example}{section.8.2}% 58
\BOOKMARK [2][-]{subsection.8.2.2}{A Simple Dynamic Page which Mixes HTML and Common Lisp/GenDL}{section.8.2}% 59
\BOOKMARK [2][-]{subsection.8.2.3}{Linking to Multiple Pages}{section.8.2}% 60
\BOOKMARK [0][-]{chapter.9}{More Common Lisp for Gendl}{}% 61
\BOOKMARK [0][-]{chapter.10}{Advanced Gendl}{}% 62
\BOOKMARK [2][-]{subsection.8.2.4}{Form Controls and Fillout-Forms}{section.8.2}% 61
\BOOKMARK [1][-]{section.8.3}{Partial Page Updates with gdlAjax}{chapter.8}% 62
\BOOKMARK [2][-]{subsection.8.3.1}{Steps to Create a gdlAjax Application}{section.8.3}% 63
\BOOKMARK [2][-]{subsection.8.3.2}{Including Graphics}{section.8.3}% 64
\BOOKMARK [0][-]{chapter.9}{More Common Lisp for Gendl}{}% 65
\BOOKMARK [0][-]{chapter.10}{Advanced Gendl}{}% 66
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment