htmlgrid 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. data/History.txt +6 -0
  2. data/LICENCE.txt +515 -0
  3. data/Manifest.txt +82 -0
  4. data/README.txt +30 -0
  5. data/Rakefile +28 -0
  6. data/ext/htmlgrid/MANIFEST +3 -0
  7. data/ext/htmlgrid/Makefile +150 -0
  8. data/ext/htmlgrid/extconf.rb +33 -0
  9. data/ext/htmlgrid/grid.c +881 -0
  10. data/ext/htmlgrid/grid.o +0 -0
  11. data/ext/htmlgrid/htmlgrid.c +30 -0
  12. data/ext/htmlgrid/htmlgrid.o +0 -0
  13. data/ext/htmlgrid/htmlgrid.so +0 -0
  14. data/ext/htmlgrid/include/grid.h +79 -0
  15. data/ext/htmlgrid/include/htmlgrid.h +33 -0
  16. data/install.rb +1098 -0
  17. data/lib/htmlgrid/booleanvalue.rb +41 -0
  18. data/lib/htmlgrid/button.rb +36 -0
  19. data/lib/htmlgrid/centeredcomposite.rb +47 -0
  20. data/lib/htmlgrid/component.rb +232 -0
  21. data/lib/htmlgrid/composite.rb +350 -0
  22. data/lib/htmlgrid/datevalue.rb +39 -0
  23. data/lib/htmlgrid/div.rb +37 -0
  24. data/lib/htmlgrid/divcomposite.rb +52 -0
  25. data/lib/htmlgrid/divform.rb +35 -0
  26. data/lib/htmlgrid/divlist.rb +26 -0
  27. data/lib/htmlgrid/divtemplate.rb +12 -0
  28. data/lib/htmlgrid/dojotoolkit.rb +173 -0
  29. data/lib/htmlgrid/errormessage.rb +70 -0
  30. data/lib/htmlgrid/form.rb +93 -0
  31. data/lib/htmlgrid/formlist.rb +42 -0
  32. data/lib/htmlgrid/grid.rb +286 -0
  33. data/lib/htmlgrid/image.rb +43 -0
  34. data/lib/htmlgrid/infomessage.rb +41 -0
  35. data/lib/htmlgrid/input.rb +59 -0
  36. data/lib/htmlgrid/inputcheckbox.rb +41 -0
  37. data/lib/htmlgrid/inputcurrency.rb +36 -0
  38. data/lib/htmlgrid/inputdate.rb +38 -0
  39. data/lib/htmlgrid/inputfile.rb +40 -0
  40. data/lib/htmlgrid/inputradio.rb +37 -0
  41. data/lib/htmlgrid/inputtext.rb +37 -0
  42. data/lib/htmlgrid/javascript.rb +22 -0
  43. data/lib/htmlgrid/label.rb +90 -0
  44. data/lib/htmlgrid/labeltext.rb +35 -0
  45. data/lib/htmlgrid/link.rb +54 -0
  46. data/lib/htmlgrid/list.rb +170 -0
  47. data/lib/htmlgrid/namedcomponent.rb +52 -0
  48. data/lib/htmlgrid/pass.rb +38 -0
  49. data/lib/htmlgrid/passthru.rb +44 -0
  50. data/lib/htmlgrid/popuplink.rb +66 -0
  51. data/lib/htmlgrid/reset.rb +36 -0
  52. data/lib/htmlgrid/richtext.rb +26 -0
  53. data/lib/htmlgrid/select.rb +53 -0
  54. data/lib/htmlgrid/span.rb +37 -0
  55. data/lib/htmlgrid/spancomposite.rb +45 -0
  56. data/lib/htmlgrid/spanlist.rb +15 -0
  57. data/lib/htmlgrid/staticinput.rb +40 -0
  58. data/lib/htmlgrid/submit.rb +36 -0
  59. data/lib/htmlgrid/template.rb +130 -0
  60. data/lib/htmlgrid/text.rb +36 -0
  61. data/lib/htmlgrid/textarea.rb +49 -0
  62. data/lib/htmlgrid/ulcomposite.rb +49 -0
  63. data/lib/htmlgrid/ullist.rb +15 -0
  64. data/lib/htmlgrid/urllink.rb +65 -0
  65. data/lib/htmlgrid/value.rb +36 -0
  66. data/test/rebuild.rb +39 -0
  67. data/test/stub/cgi.rb +44 -0
  68. data/test/suite.rb +32 -0
  69. data/test/test_component.rb +138 -0
  70. data/test/test_composite.rb +201 -0
  71. data/test/test_datevalue.rb +60 -0
  72. data/test/test_form.rb +123 -0
  73. data/test/test_formlist.rb +111 -0
  74. data/test/test_grid.rb +395 -0
  75. data/test/test_input.rb +70 -0
  76. data/test/test_label.rb +116 -0
  77. data/test/test_list.rb +146 -0
  78. data/test/test_select.rb +78 -0
  79. data/test/test_template.rb +97 -0
  80. data/test/test_text.rb +63 -0
  81. data/usage-en.txt +112 -0
  82. data/widget/Tooltip.js +85 -0
  83. metadata +180 -0
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com
24
+ #
25
+ # Span -- oddb -- 12.08.2003 -- mhuggler@ywesee.com
26
+
27
+ require 'htmlgrid/component'
28
+
29
+ module HtmlGrid
30
+ class Span < Component
31
+ def to_html(context)
32
+ context.span(@attributes) {
33
+ super << dynamic_html(context)
34
+ }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
+ #
25
+ # Template -- htmlgrid -- 23.10.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/composite'
28
+
29
+ module HtmlGrid
30
+ class SpanComposite < TagComposite
31
+ def to_html(context)
32
+ res = ''
33
+ @grid.each_with_index { |span, idx|
34
+ res << context.span(tag_attributes(idx)) {
35
+ if(span.respond_to?(:to_html))
36
+ span.to_html(context)
37
+ else
38
+ span
39
+ end
40
+ }
41
+ }
42
+ res
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # HtmlGrid::SpanList -- davaz.com -- 04.05.2006 -- mhuggler@ywesee.com
4
+
5
+ require 'htmlgrid/spancomposite'
6
+
7
+ module HtmlGrid
8
+ class SpanList < HtmlGrid::SpanComposite
9
+ def compose
10
+ @model.each { |item|
11
+ super(item)
12
+ }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
+ #
25
+ # StaticInput -- htmlgrid -- 26.11.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/input'
28
+
29
+ module HtmlGrid
30
+ class StaticInput < NamedComponent
31
+ LABEL = false
32
+ def init
33
+ super
34
+ @attributes['value'] = @lookandfeel.lookup(@name)
35
+ end
36
+ def to_html(context)
37
+ context.input(@attributes)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
+ #
25
+ # Submit -- htmlgrid -- 25.11.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/staticinput'
28
+
29
+ module HtmlGrid
30
+ class Submit < StaticInput
31
+ def init
32
+ super
33
+ @attributes['type'] = 'submit'
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
+ #
25
+ # Template -- htmlgrid -- 19.11.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/composite'
28
+
29
+ module HtmlGrid
30
+ module TemplateMethods
31
+ CONTENT = nil
32
+ FOOT = nil
33
+ HEAD = nil
34
+ META_TAGS = []
35
+ LEGACY_INTERFACE = true
36
+ CSS_FILES = []
37
+ JAVASCRIPTS = []
38
+ def css_link(context, path=@lookandfeel.resource(:css))
39
+ properties = {
40
+ "rel" => "stylesheet",
41
+ "type" => "text/css",
42
+ "href" => path,
43
+ }
44
+ context.link(properties)
45
+ end
46
+ def css_links(context, path=@lookandfeel.resource(:css))
47
+ links = self.class.const_get(:CSS_FILES).collect { |key|
48
+ css_link(context, @lookandfeel.resource(key))
49
+ }
50
+ links.push(css_link(context, path)) if(path)
51
+ links.join
52
+ end
53
+ def content(model, session=nil)
54
+ __standard_component(model, self::class::CONTENT)
55
+ end
56
+ def dynamic_html_headers(context)
57
+ ''
58
+ end
59
+ def foot(model, session=nil)
60
+ __standard_component(model, self::class::FOOT)
61
+ end
62
+ def head(model, session=nil)
63
+ __standard_component(model, self::class::HEAD)
64
+ end
65
+ def __standard_component(model, klass)
66
+ if(klass.is_a?(Class))
67
+ klass.new(model, @session, self)
68
+ end
69
+ end
70
+ def html_head(context, &block)
71
+ context.head {
72
+ if(block_given?)
73
+ block.call
74
+ end.to_s <<
75
+ title(context) <<
76
+ meta_tags(context) <<
77
+ other_html_headers(context) <<
78
+ css_links(context) <<
79
+ javascripts(context)
80
+ }
81
+ end
82
+ def javascripts(context)
83
+ jscripts = self.class.const_get(:JAVASCRIPTS).collect { |key|
84
+ properties = {
85
+ "language" => "JavaScript",
86
+ "type" => "text/javascript",
87
+ "src" => @lookandfeel.resource_global(:javascript, "#{key}.js"),
88
+ }
89
+ context.script(properties)
90
+ }
91
+ jscripts.join
92
+ end
93
+ def meta_tags(context)
94
+ self::class::META_TAGS.inject('') { |inj, properties|
95
+ inj << context.meta(properties)
96
+ }
97
+ end
98
+ def onload=(script)
99
+ @attributes['onload'] = script
100
+ end
101
+ def other_html_headers(context)
102
+ dynamic_html_headers(context)
103
+ end
104
+ def template_html(context, &block)
105
+ args = {}
106
+ if(dtd = @lookandfeel.lookup(:DOCTYPE))
107
+ args.store('DOCTYPE', dtd)
108
+ end
109
+ context.html(args) {
110
+ html_head(context) << context.body(@attributes) {
111
+ template_tags(context, &block)
112
+ }
113
+ }
114
+ end
115
+ def template_tags(context, &block)
116
+ block.call
117
+ end
118
+ def title(context)
119
+ context.title { @lookandfeel.lookup(:html_title) }
120
+ end
121
+ def to_html(context)
122
+ template_html(context) {
123
+ super(context)
124
+ }
125
+ end
126
+ end
127
+ class Template < Composite
128
+ include TemplateMethods
129
+ end
130
+ end
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
+ #
25
+ # Text -- htmlgrid -- 20.11.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/namedcomponent'
28
+
29
+ module HtmlGrid
30
+ class Text < NamedComponent
31
+ def init
32
+ super
33
+ @value = @lookandfeel.lookup(@name)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
+ #
25
+ # Textarea -- htmlgrid -- 12.12.2002 -- benfay@ywesee.com
26
+
27
+ require 'htmlgrid/input'
28
+
29
+ module HtmlGrid
30
+ class Textarea < Input
31
+ attr_writer :value
32
+ attr_accessor :unescaped
33
+ def to_html(context)
34
+ context.textarea(@attributes) {
35
+ _to_html(context, @value)
36
+ }
37
+ end
38
+ def escape_value(elm)
39
+ @unescaped ? elm.to_s : escape(elm.to_s)
40
+ end
41
+ def _to_html(context, value=@value)
42
+ if(value.is_a?(Array))
43
+ value.collect { |elm| escape_value elm }.join("\n")
44
+ else
45
+ escape_value value
46
+ end.strip
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
+ #
25
+ # Template -- htmlgrid -- 23.10.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/composite'
28
+
29
+ module HtmlGrid
30
+ class UlComposite < TagComposite
31
+ def to_html(context)
32
+ res = ''
33
+ res << context.ul(tag_attributes) {
34
+ inner_res = ''
35
+ @grid.each_with_index { |li, idx|
36
+ inner_res << context.li(tag_attributes(idx)) {
37
+ if(li.respond_to?(:to_html))
38
+ li.to_html(context)
39
+ else
40
+ li
41
+ end
42
+ }
43
+ }
44
+ inner_res
45
+ }
46
+ res
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # HtmlGrid::UlList -- davaz.com -- 25.04.2006 -- mhuggler@ywesee.com
4
+
5
+ require 'htmlgrid/ulcomposite'
6
+
7
+ module HtmlGrid
8
+ class UlList < HtmlGrid::UlComposite
9
+ def compose(model=@model)
10
+ @model.each { |item|
11
+ super(item)
12
+ }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
+ #
25
+ # UrlLink -- htmlgrid -- 10.06.2003 -- aschrafl@ywesee.com
26
+
27
+ require 'htmlgrid/link'
28
+
29
+ module HtmlGrid
30
+ class UrlLink < Link
31
+ def init
32
+ super
33
+ if(@model.respond_to?(@name))
34
+ @value = @model.send(@name).to_s
35
+ end
36
+ compose_link
37
+ end
38
+ end
39
+ class HttpLink < UrlLink
40
+ @@http_ptrn = /^http:/
41
+ LABEL = true
42
+ def compose_link
43
+ unless @value.nil?
44
+ if @@http_ptrn.match(@value)
45
+ self.href = @value
46
+ else
47
+ self.href = "http://" + @value
48
+ end
49
+ set_attribute('target', '_blank')
50
+ end
51
+ end
52
+ end
53
+ class MailLink < UrlLink
54
+ LABEL = true
55
+ @@mailto_ptrn = /^mailto:/
56
+ def compose_link
57
+ unless @value.empty?
58
+ self.href = @value
59
+ unless @@mailto_ptrn.match(@value)
60
+ self.href = "mailto:"+@value
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #
4
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
5
+ # Copyright (C) 2003 ywesee - intellectual capital connected
6
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
+ #
25
+ # Value -- htmlgrid -- 19.11.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/namedcomponent'
28
+
29
+ module HtmlGrid
30
+ class Value < NamedComponent
31
+ LABEL = true
32
+ def init
33
+ @value = @model.send(@name) if @model.respond_to?(@name)
34
+ end
35
+ end
36
+ end
data/test/rebuild.rb ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
4
+ # Copyright (C) 2003 ywesee - intellectual capital connected
5
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
6
+ #
7
+ # This library is free software; you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation; either
10
+ # version 2.1 of the License, or (at your option) any later version.
11
+ #
12
+ # This library is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public
18
+ # License along with this library; if not, write to the Free Software
19
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ #
21
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
22
+ # htmlgrid@ywesee.com, www.ywesee.com
23
+ #
24
+ # rebuild -- HtmlGrid -- 31.10.2003 -- hwyss@ywesee.com
25
+
26
+ $: << File.expand_path("../lib/", File.dirname(__FILE__))
27
+ $: << File.expand_path("../ext/htmlgrid", File.dirname(__FILE__))
28
+
29
+ install = File.expand_path("../install.rb", File.dirname(__FILE__))
30
+ bld_dir = File.expand_path("../ext/htmlgrid", File.dirname(__FILE__))
31
+ inst_dir = File.expand_path("..", File.dirname(__FILE__))
32
+ Dir.chdir(bld_dir){
33
+ system("make clean")
34
+ }
35
+ Dir.chdir(inst_dir) {
36
+ system("ruby #{install} config")
37
+ system("ruby #{install} setup")
38
+ }
39
+ #require 'htmlgrid'
data/test/stub/cgi.rb ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
4
+ # Copyright (C) 2003 ywesee - intellectual capital connected
5
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
6
+ #
7
+ # This library is free software; you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation; either
10
+ # version 2.1 of the License, or (at your option) any later version.
11
+ #
12
+ # This library is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public
18
+ # License along with this library; if not, write to the Free Software
19
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ #
21
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
22
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
23
+ #
24
+ # CGI -- htmlgrid -- hwyss@ywesee.com
25
+
26
+ require 'cgi'
27
+
28
+ class CGI
29
+ attr_accessor :params
30
+ alias :old_initialize :initialize
31
+ def initialize throwaway=nil
32
+ ARGV.push('')
33
+ old_initialize('html4')
34
+ end
35
+ def cookies
36
+ {}
37
+ end
38
+ def []key
39
+ @params[key]
40
+ end
41
+ def []=key, value
42
+ @params[key] = value
43
+ end
44
+ end
data/test/suite.rb ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # HtmlGrid -- HyperTextMarkupLanguage Framework
4
+ # Copyright (C) 2003 ywesee - intellectual capital connected
5
+ # Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
6
+ #
7
+ # This library is free software; you can redistribute it and/or
8
+ # modify it under the terms of the GNU Lesser General Public
9
+ # License as published by the Free Software Foundation; either
10
+ # version 2.1 of the License, or (at your option) any later version.
11
+ #
12
+ # This library is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # Lesser General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU Lesser General Public
18
+ # License along with this library; if not, write to the Free Software
19
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ #
21
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
22
+ # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
23
+ #
24
+ # suite.rb -- htmlgrid -- 20.11.2002 -- hwyss@ywesee.com
25
+
26
+ $: << File.expand_path(File.dirname(__FILE__))
27
+
28
+ require 'rebuild'
29
+
30
+ Dir.foreach(File.dirname(__FILE__)) { |file|
31
+ require file if /^test_.*\.rb$/o.match(file)
32
+ }