From 1e961a6739139a6846ec4fc943760080b0249ddc Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 25 Mar 2005 15:45:39 +0000 Subject: [PATCH] some basic html templates for use in wrappers. these will be augmented over time git-svn-id: svn://svn.open-ils.org/ILS/trunk@397 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/templates/html/anchor | 22 +++++++++ Open-ILS/src/templates/html/bar | 7 +++ Open-ILS/src/templates/html/body | 23 +++++++++ Open-ILS/src/templates/html/box | 10 ++++ Open-ILS/src/templates/html/buffer | 23 +++++++++ Open-ILS/src/templates/html/button | 17 +++++++ Open-ILS/src/templates/html/cell | 19 ++++++++ Open-ILS/src/templates/html/center | 6 +++ Open-ILS/src/templates/html/concat | 7 +++ Open-ILS/src/templates/html/config | 12 +++++ Open-ILS/src/templates/html/div | 13 +++++ Open-ILS/src/templates/html/edge | 28 +++++++++++ Open-ILS/src/templates/html/edgebar | 28 +++++++++++ Open-ILS/src/templates/html/edgebox | 9 ++++ Open-ILS/src/templates/html/footer | 3 ++ Open-ILS/src/templates/html/form | 9 ++++ Open-ILS/src/templates/html/head | 28 +++++++++++ Open-ILS/src/templates/html/header | 21 ++++++++ Open-ILS/src/templates/html/hr | 3 ++ Open-ILS/src/templates/html/html | 12 +++++ Open-ILS/src/templates/html/html3.2 | 4 ++ Open-ILS/src/templates/html/img | 11 +++++ Open-ILS/src/templates/html/indent | 9 ++++ Open-ILS/src/templates/html/input | 20 ++++++++ Open-ILS/src/templates/html/item | 10 ++++ Open-ILS/src/templates/html/js | 19 ++++++++ Open-ILS/src/templates/html/link | 18 +++++++ Open-ILS/src/templates/html/list | 11 +++++ Open-ILS/src/templates/html/menu | 19 ++++++++ Open-ILS/src/templates/html/menubar | 17 +++++++ Open-ILS/src/templates/html/option | 14 ++++++ Open-ILS/src/templates/html/page | 11 +++++ Open-ILS/src/templates/html/rgb | 76 +++++++++++++++++++++++++++++ Open-ILS/src/templates/html/row | 14 ++++++ Open-ILS/src/templates/html/select | 15 ++++++ Open-ILS/src/templates/html/space | 17 +++++++ Open-ILS/src/templates/html/table | 18 +++++++ 37 files changed, 603 insertions(+) create mode 100644 Open-ILS/src/templates/html/anchor create mode 100644 Open-ILS/src/templates/html/bar create mode 100644 Open-ILS/src/templates/html/body create mode 100644 Open-ILS/src/templates/html/box create mode 100644 Open-ILS/src/templates/html/buffer create mode 100644 Open-ILS/src/templates/html/button create mode 100644 Open-ILS/src/templates/html/cell create mode 100644 Open-ILS/src/templates/html/center create mode 100644 Open-ILS/src/templates/html/concat create mode 100644 Open-ILS/src/templates/html/config create mode 100644 Open-ILS/src/templates/html/div create mode 100644 Open-ILS/src/templates/html/edge create mode 100644 Open-ILS/src/templates/html/edgebar create mode 100644 Open-ILS/src/templates/html/edgebox create mode 100644 Open-ILS/src/templates/html/footer create mode 100644 Open-ILS/src/templates/html/form create mode 100644 Open-ILS/src/templates/html/head create mode 100644 Open-ILS/src/templates/html/header create mode 100644 Open-ILS/src/templates/html/hr create mode 100644 Open-ILS/src/templates/html/html create mode 100644 Open-ILS/src/templates/html/html3.2 create mode 100644 Open-ILS/src/templates/html/img create mode 100644 Open-ILS/src/templates/html/indent create mode 100644 Open-ILS/src/templates/html/input create mode 100644 Open-ILS/src/templates/html/item create mode 100644 Open-ILS/src/templates/html/js create mode 100644 Open-ILS/src/templates/html/link create mode 100644 Open-ILS/src/templates/html/list create mode 100644 Open-ILS/src/templates/html/menu create mode 100644 Open-ILS/src/templates/html/menubar create mode 100644 Open-ILS/src/templates/html/option create mode 100644 Open-ILS/src/templates/html/page create mode 100644 Open-ILS/src/templates/html/rgb create mode 100644 Open-ILS/src/templates/html/row create mode 100644 Open-ILS/src/templates/html/select create mode 100644 Open-ILS/src/templates/html/space create mode 100644 Open-ILS/src/templates/html/table diff --git a/Open-ILS/src/templates/html/anchor b/Open-ILS/src/templates/html/anchor new file mode 100644 index 0000000000..488a22d80f --- /dev/null +++ b/Open-ILS/src/templates/html/anchor @@ -0,0 +1,22 @@ +[%# ARGS +-%] + + +[% ""; + text; + " "; + content; + "\n"; + ELSE; + "/>\n"; + END; + +%] diff --git a/Open-ILS/src/templates/html/bar b/Open-ILS/src/templates/html/bar new file mode 100644 index 0000000000..51331fab2b --- /dev/null +++ b/Open-ILS/src/templates/html/bar @@ -0,0 +1,7 @@ +[%# html/bar: table containing a single row + # ARGS: + # as per html/table and html/row +-%] +[% WRAPPER html/table + html/row %] +[% content %] +[% END %] \ No newline at end of file diff --git a/Open-ILS/src/templates/html/body b/Open-ILS/src/templates/html/body new file mode 100644 index 0000000000..7c48f56973 --- /dev/null +++ b/Open-ILS/src/templates/html/body @@ -0,0 +1,23 @@ +[% + + #--------------------------------------------------------------------------------- + #html/body: ... element for HTML pages + # + # ARGS: + # + # content # body content + #--------------------------------------------------------------------------------- + + ""; + + content; + + ""; + +%] diff --git a/Open-ILS/src/templates/html/box b/Open-ILS/src/templates/html/box new file mode 100644 index 0000000000..4cbeb9c28f --- /dev/null +++ b/Open-ILS/src/templates/html/box @@ -0,0 +1,10 @@ +[%# html/bar: table containing a single row and a single cell + # ARGS: + # as per html/table, html/row and html/cell +-%] +[% WRAPPER html/table; + WRAPPER html/row + html/cell width='' col=''; + content; + END; + END; +%] diff --git a/Open-ILS/src/templates/html/buffer b/Open-ILS/src/templates/html/buffer new file mode 100644 index 0000000000..7a16f0752a --- /dev/null +++ b/Open-ILS/src/templates/html/buffer @@ -0,0 +1,23 @@ +[% + + # -------------------------------------------------------- + # Inserts whitespace into a page. + # 'size' is the number of lines to output + # -------------------------------------------------------- + + IF size; + + x=0; + + WHILE x < size; + "
"; + x = x + 1; + END; + + ELSE; + + "
"; + END +%] + + diff --git a/Open-ILS/src/templates/html/button b/Open-ILS/src/templates/html/button new file mode 100644 index 0000000000..e5e833d0e1 --- /dev/null +++ b/Open-ILS/src/templates/html/button @@ -0,0 +1,17 @@ +[%# html/button: simple text button with a link like "[ this ]" + # ARGS: + # text # button text + # link # button link url + # select # flag to select item (set bold) + # left # flag to add left arrow head (e.g. prev. item) + # right # flag to add right arrow head (e.g. next item) +%] +[%- '<-' IF left %] +[%- select ? '[' : '[' -%] +  +[%- IF link %][% END %] +[%- text | replace('\s', ' ') %] +[%- IF link %][% END -%] +  +[%- select ? ']' : ']' %] +[%- '->' IF right -%] diff --git a/Open-ILS/src/templates/html/cell b/Open-ILS/src/templates/html/cell new file mode 100644 index 0000000000..edc5d10902 --- /dev/null +++ b/Open-ILS/src/templates/html/cell @@ -0,0 +1,19 @@ +[%# html/cell: an empty and orphaned HTML table cell, . . . + # ARGS: + # col # background colour (default: none) + # align # horizontal alignment (default: none) + # valign # vertical alignment (default: none) + # colspan # span multiple columns (defualt: none) + # rowspan # span multiple rows (defualt: none) + # content # box content +-%] + + +[%- content -%] + diff --git a/Open-ILS/src/templates/html/center b/Open-ILS/src/templates/html/center new file mode 100644 index 0000000000..6a9f1912d0 --- /dev/null +++ b/Open-ILS/src/templates/html/center @@ -0,0 +1,6 @@ +[% + "
"; + content; + "
"; +%] + diff --git a/Open-ILS/src/templates/html/concat b/Open-ILS/src/templates/html/concat new file mode 100644 index 0000000000..70aab0224d --- /dev/null +++ b/Open-ILS/src/templates/html/concat @@ -0,0 +1,7 @@ +[% + string = ""; + FOR word IN strings; + string = string _ word; + END; + string; +%] diff --git a/Open-ILS/src/templates/html/config b/Open-ILS/src/templates/html/config new file mode 100644 index 0000000000..b839f47389 --- /dev/null +++ b/Open-ILS/src/templates/html/config @@ -0,0 +1,12 @@ +[% USE HTML; + html = { + dtd = '-//W3C//DTD HTML 3.2 Final//EN' + + # plus various other HTML element/attributes + # body = { + # bgcolor = '#ffffff' + # } + # etc... + }; +-%] + diff --git a/Open-ILS/src/templates/html/div b/Open-ILS/src/templates/html/div new file mode 100644 index 0000000000..daf5204312 --- /dev/null +++ b/Open-ILS/src/templates/html/div @@ -0,0 +1,13 @@ +[% + ""; + content; + ""; +%] + diff --git a/Open-ILS/src/templates/html/edge b/Open-ILS/src/templates/html/edge new file mode 100644 index 0000000000..b2e8316167 --- /dev/null +++ b/Open-ILS/src/templates/html/edge @@ -0,0 +1,28 @@ +[%# html/edge: an empty table with an edged outline + # ARGS: + # edge # edge colour (default: black, '#000000') + # fill # fill colour (default: white, '#ffffff') + # border # border width (default: 2) + # content # bar content + # + other args as per html/table +-%] +[% DEFAULT + edge = '#000000' + fill = '#ffffff' + border = 2 +-%] +[% WRAPPER html/box + col = edge + pad = border + border = 0 + space = 0 ; + inwidth = width ? '100%' : '' ; + WRAPPER html/table + col = fill + space = 0 + border = 0 + width = inwidth ; + content ; + END ; + END +%] diff --git a/Open-ILS/src/templates/html/edgebar b/Open-ILS/src/templates/html/edgebar new file mode 100644 index 0000000000..0b9b545107 --- /dev/null +++ b/Open-ILS/src/templates/html/edgebar @@ -0,0 +1,28 @@ +[%# html/edgebar: a single row table with an edged outline + # ARGS: + # edge # edge colour (default: black, '#000000') + # fill # fill colour (default: white, '#ffffff') + # border # border width (default: 2) + # content # bar content + # + other args as per html/bar +-%] +[% DEFAULT + edge = '#000000' + fill = '#ffffff' + border = 2 +-%] +[% WRAPPER html/box + col = edge + pad = border + border = 0 + space = 0 ; + inwidth = width ? '100%' : '' ; + WRAPPER html/bar + col = fill + space = 0 + border = 0 + width = inwidth ; + content ; + END ; + END +%] diff --git a/Open-ILS/src/templates/html/edgebox b/Open-ILS/src/templates/html/edgebox new file mode 100644 index 0000000000..71e1172f70 --- /dev/null +++ b/Open-ILS/src/templates/html/edgebox @@ -0,0 +1,9 @@ +[%# html/edgebox: a single row, single cell table with an edge + # ARGS: + # content # box content + # + other args as per html/edgebar and html/cell +-%] +[% WRAPPER html/edgebar + html/cell %] +[% content %] +[% END %] + diff --git a/Open-ILS/src/templates/html/footer b/Open-ILS/src/templates/html/footer new file mode 100644 index 0000000000..003633f4da --- /dev/null +++ b/Open-ILS/src/templates/html/footer @@ -0,0 +1,3 @@ +[%# html/footer: standard footer for HTML pages -%] + + \ No newline at end of file diff --git a/Open-ILS/src/templates/html/form b/Open-ILS/src/templates/html/form new file mode 100644 index 0000000000..a2a5663260 --- /dev/null +++ b/Open-ILS/src/templates/html/form @@ -0,0 +1,9 @@ +[% + "\n
"; + content; + "
" +%] diff --git a/Open-ILS/src/templates/html/head b/Open-ILS/src/templates/html/head new file mode 100644 index 0000000000..6b531ef893 --- /dev/null +++ b/Open-ILS/src/templates/html/head @@ -0,0 +1,28 @@ +[%# html/head: ... element for HTML pages + # + # ARGS: + # - html.head.title # page title + # - html.head.meta # hash of metadata + # - html.headers # additional HTML headers + # TODO: + # - various other header items are not currently handled, + # e.g. base, xbase, target, script, noscript, etc., but + # you can set 'html.headers' as a general work-around + # to put extra stuff in the ... element +-%] +[% + ""; + + IF title; + "" _ title _ ""; + END; + + FOREACH item = html.head.meta; + ""; + END; + html.headers; + content; + ""; + +%] + diff --git a/Open-ILS/src/templates/html/header b/Open-ILS/src/templates/html/header new file mode 100644 index 0000000000..a5fd0f7886 --- /dev/null +++ b/Open-ILS/src/templates/html/header @@ -0,0 +1,21 @@ +[%# NOTE: this may soon be deprecated in favour of the new + # separate html/html, html/head and html/body templates + # + # html/header: standard header for HTML pages + # ARGS: + # bgcol # background colour (default: #ffffff) + # title # page title + # headers # additional HTML headers +-%] +[% DEFAULT bgcol = '#ffffff' -%] + + + + + +[% title %] +[% headers -%] + + + diff --git a/Open-ILS/src/templates/html/hr b/Open-ILS/src/templates/html/hr new file mode 100644 index 0000000000..0cb011e39c --- /dev/null +++ b/Open-ILS/src/templates/html/hr @@ -0,0 +1,3 @@ +[% + "
"; +%] diff --git a/Open-ILS/src/templates/html/html b/Open-ILS/src/templates/html/html new file mode 100644 index 0000000000..f283e4d007 --- /dev/null +++ b/Open-ILS/src/templates/html/html @@ -0,0 +1,12 @@ +[%# html/html: and ... element wrapper + # + # ARGS: + # - content # html content +-%] + + + + +[% content %] + diff --git a/Open-ILS/src/templates/html/html3.2 b/Open-ILS/src/templates/html/html3.2 new file mode 100644 index 0000000000..b9cad4b05a --- /dev/null +++ b/Open-ILS/src/templates/html/html3.2 @@ -0,0 +1,4 @@ + + +[% content %] + diff --git a/Open-ILS/src/templates/html/img b/Open-ILS/src/templates/html/img new file mode 100644 index 0000000000..a35d2e1271 --- /dev/null +++ b/Open-ILS/src/templates/html/img @@ -0,0 +1,11 @@ +[% + ""; +%] + diff --git a/Open-ILS/src/templates/html/indent b/Open-ILS/src/templates/html/indent new file mode 100644 index 0000000000..1e1dc3b865 --- /dev/null +++ b/Open-ILS/src/templates/html/indent @@ -0,0 +1,9 @@ +[%# html/indent: an indented box + # ARGS: + # width # width of table (default: 95%) + # + other args as per html/box +-%] +
+[% DEFAULT width="95%" -%] +[% INCLUDE html/box %] +
diff --git a/Open-ILS/src/templates/html/input b/Open-ILS/src/templates/html/input new file mode 100644 index 0000000000..afb6b5f3f3 --- /dev/null +++ b/Open-ILS/src/templates/html/input @@ -0,0 +1,20 @@ + +[% + + ""; + IF content; + content; + ""; + END; + +%] + diff --git a/Open-ILS/src/templates/html/item b/Open-ILS/src/templates/html/item new file mode 100644 index 0000000000..72c2e152bf --- /dev/null +++ b/Open-ILS/src/templates/html/item @@ -0,0 +1,10 @@ +[%# item: an item in a list + # ARGS: + # title # title for item + # content # item content +-%] +
  • [%- IF title && title != '*' -%] +[% title %][% "
    \n" IF content -%] +[% END -%] +[% content -%] + diff --git a/Open-ILS/src/templates/html/js b/Open-ILS/src/templates/html/js new file mode 100644 index 0000000000..ac25417409 --- /dev/null +++ b/Open-ILS/src/templates/html/js @@ -0,0 +1,19 @@ +[%# html/js + # + # ARGS: + # - content # javascript content +-%] + +[% + + ""; +%] + diff --git a/Open-ILS/src/templates/html/link b/Open-ILS/src/templates/html/link new file mode 100644 index 0000000000..3434bba418 --- /dev/null +++ b/Open-ILS/src/templates/html/link @@ -0,0 +1,18 @@ +[%# ARGS +-%] + + +[% ""; + text; + "\n"; + ELSE; + "/>\n"; + END; + +%] diff --git a/Open-ILS/src/templates/html/list b/Open-ILS/src/templates/html/list new file mode 100644 index 0000000000..b37165372b --- /dev/null +++ b/Open-ILS/src/templates/html/list @@ -0,0 +1,11 @@ +[%# list: a list of items + # ARGS: + # title # title for list + # content # list content +-%] +[% IF title -%] +[% title %] +[% END -%] +
      +[% content -%] +
    diff --git a/Open-ILS/src/templates/html/menu b/Open-ILS/src/templates/html/menu new file mode 100644 index 0000000000..70150d0914 --- /dev/null +++ b/Open-ILS/src/templates/html/menu @@ -0,0 +1,19 @@ +[%# menu: generate sequence of buttons with optional left/right/select + # ARGS: + # buttons = [ # list of buttons + # { link => 'page1.html', text => 'First Page' }, + # { link => 'page2.html', text => 'Second Page' }, + # ... + # ], + # select # item to select in range 1 to n (0: none) + # left # add left arrowhead to first item + # right # add right arrowhead to last item +-%] +[% INCLUDE html/button + link = b.link + text = b.text + left = loop.first ? left : 0 + right = loop.last ? right : 0 + select = (select == loop.count) ? select : 0 + FOREACH b = buttons +-%] diff --git a/Open-ILS/src/templates/html/menubar b/Open-ILS/src/templates/html/menubar new file mode 100644 index 0000000000..85d83b7b6c --- /dev/null +++ b/Open-ILS/src/templates/html/menubar @@ -0,0 +1,17 @@ +[%# menubar: create 2 cell edgebox with content on left and menu on right + # ARGS: + # edge # edge colour + # fill # fill colour + # border # border (edge) width + # content # menu bar content (e.g. title text) + # menu # structure for menu items, as per html/menu +-%] +[% DEFAULT content = ' ' -%] +[% WRAPPER html/edgebar -%] + +[% content %] + + + [% INCLUDE html/menu -%] + +[%- END %] diff --git a/Open-ILS/src/templates/html/option b/Open-ILS/src/templates/html/option new file mode 100644 index 0000000000..d8457b64cd --- /dev/null +++ b/Open-ILS/src/templates/html/option @@ -0,0 +1,14 @@ +[% + + ""; + IF content; + content; + ""; + END; + +%] + diff --git a/Open-ILS/src/templates/html/page b/Open-ILS/src/templates/html/page new file mode 100644 index 0000000000..4d7685f0d0 --- /dev/null +++ b/Open-ILS/src/templates/html/page @@ -0,0 +1,11 @@ +[%# html/page: and ... element wrapper + # + # ARGS: + # - html.dtd # Document Type Definition + # - content # html content +-%] +[% DEFAULT html.dtd = '-//W3C//DTD HTML 3.2 Final//EN' -%] + + +[% PROCESS html/head + html/body %] + diff --git a/Open-ILS/src/templates/html/rgb b/Open-ILS/src/templates/html/rgb new file mode 100644 index 0000000000..85fdcadff3 --- /dev/null +++ b/Open-ILS/src/templates/html/rgb @@ -0,0 +1,76 @@ +[%# html/rgb: define 'rgb' containing RGB triples for various colours -%] +[% rgb = { + # the mono crowd + black => '#000000' + grey25 => '#404040' + grey50 => '#808080' + grey75 => '#c0c0c0' + white => '#ffffff' + + red => '#ff0000' + red25 => '#400000' + red50 => '#800000' + red75 => '#c00000' + + green => '#00ff00' + green25 => '#004000' + green50 => '#008000' + green75 => '#00c000' + + blue => '#0000ff' + blue25 => '#000040' + blue50 => '#000080' + blue75 => '#0000c0' + + # v0.01 cols follow + # reds + blood => '#800000' + scarlet => '#c04040' + rose => '#f08080' + orange => '#fe7202' + + # greens + leaf => '#006400' + bud => '#66aa66' + mint => '#aaffaa' + + # blues + navy => '#202080' + marine => '#0066cc' + aqua => '#3399cc' + sky => '#66ccff' + + # lavender blues + purple => '#404080' + mauve => '#6666cc' + lilac => '#9797ff' + + } + + # sets of dark/mid/light colours + rgb.shade.grey = { + dark => rgb.grey25, + mid => rgb.grey50, + light => rgb.grey75, + } + rgb.shade.red = { + dark => rgb.red25, + mid => rgb.red50, + light => rgb.red75, + } + rgb.shade.green = { + dark => rgb.green25, + mid => rgb.green50, + light => rgb.green75, + } + rgb.shade.blue = { + dark => rgb.blue25, + mid => rgb.blue50, + light => rgb.blue75, + } + rgb.shade.lavender = { + dark => rgb.purple, + mid => rgb.mauve, + light => rgb.lilac, + } +-%] diff --git a/Open-ILS/src/templates/html/row b/Open-ILS/src/templates/html/row new file mode 100644 index 0000000000..9035da7a62 --- /dev/null +++ b/Open-ILS/src/templates/html/row @@ -0,0 +1,14 @@ +[%# row: an empty and orphaned HTML table row, . . . + # ARGS: + # col # background colour (default: none) + # valign # vertical alignment (default: none) + # align # horizontal alignment (default: none) + # content # box content +-%] + + +[%- content -%] + diff --git a/Open-ILS/src/templates/html/select b/Open-ILS/src/templates/html/select new file mode 100644 index 0000000000..ed6cb6384c --- /dev/null +++ b/Open-ILS/src/templates/html/select @@ -0,0 +1,15 @@ + +[% + + ""; + IF content; + content; + ""; + END; + +%] + diff --git a/Open-ILS/src/templates/html/space b/Open-ILS/src/templates/html/space new file mode 100644 index 0000000000..4a576e0abb --- /dev/null +++ b/Open-ILS/src/templates/html/space @@ -0,0 +1,17 @@ +[% + + # -------------------------------------------------------- + # Inserts whitespace into a page. + # 'size' is the number of lines to output + # -------------------------------------------------------- + + IF size; + x=0; + WHILE x < size; + " "; + x = x + 1; + END; + END; +%] + + diff --git a/Open-ILS/src/templates/html/table b/Open-ILS/src/templates/html/table new file mode 100644 index 0000000000..7b0095941a --- /dev/null +++ b/Open-ILS/src/templates/html/table @@ -0,0 +1,18 @@ +[%# table: an empty HTML table . . .
    + # ARGS: + # border # border width (default: 0) + # col # background colour (default: none) + # width # width of box (default: none, grow to fit content) + # pad # cellpadding (default: none) + # cellspace # cellspacing (default: none) + # content # box content +-%] + +[%- content -%] +
    -- 2.43.2