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,286 @@
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
+ # Grid -- htmlgrid -- hwyss@ywesee.com
26
+ begin
27
+ VERSION = '1.0.0'
28
+ require 'htmlgrid.so'
29
+ rescue LoadError
30
+ puts "could not find htmlgrid.so, falling back to pure-ruby class"
31
+ module HtmlGrid
32
+ class Grid
33
+ attr_accessor :width, :height
34
+ private
35
+ class Row
36
+ class Field
37
+ attr_reader :components
38
+ attr_accessor :tag
39
+ ALLOWED_ATTRIBUTES = [
40
+ 'align',
41
+ 'class',
42
+ 'colspan',
43
+ 'style',
44
+ 'tag',
45
+ 'title',
46
+ ]
47
+ def initialize
48
+ @components = []
49
+ @attributes = {}
50
+ end
51
+ def add(item)
52
+ if(item.is_a? Array)
53
+ @components += item
54
+ else
55
+ @components.push item
56
+ end
57
+ end
58
+ def add_background
59
+ compose
60
+ @components.each { |component|
61
+ component.add_background
62
+ }
63
+ if(@attributes["class"])
64
+ @attributes["class"] += "-bg" unless @attributes["class"] =~ /-bg/
65
+ else
66
+ @attributes["class"] = "bg"
67
+ end
68
+ end
69
+ def add_attribute(key, value)
70
+ @attributes.store(key.to_s, value.to_s)
71
+ end
72
+ def add_component_style(style)
73
+ @components.each { |cmp|
74
+ cmp.set_attribute("class", style) if cmp.respond_to?(:set_attribute)
75
+ }
76
+ end
77
+ def add_style(style)
78
+ @attributes["class"] = style
79
+ end
80
+ def attribute(key)
81
+ @attributes[key]
82
+ end
83
+ def colspan
84
+ @attributes.fetch("colspan", 1).to_i
85
+ end
86
+ def colspan=(span)
87
+ @attributes["colspan"] = span.to_s if span.to_i > 1
88
+ end
89
+ def component_html(cgi)
90
+ html = ''
91
+ @components.each { |component|
92
+ if component.respond_to? :to_html
93
+ html << component.to_html(cgi).to_s
94
+ else
95
+ html << component.to_s
96
+ end
97
+ }
98
+ html = "&nbsp;" if html.empty?
99
+ html
100
+ end
101
+ def tag=(tag)
102
+ @tag = tag.to_s.downcase
103
+ end
104
+ def to_html(context)
105
+ if(@tag && context.respond_to?(@tag))
106
+ context.send(@tag, @attributes) {
107
+ component_html(context) }
108
+ else
109
+ context.td(@attributes) {
110
+ component_html(context) }
111
+ end
112
+ end
113
+ end
114
+ def initialize
115
+ @width = 1
116
+ @fields = [Field.new]
117
+ @attributes = {}
118
+ end
119
+ def initialize_row w
120
+ if(w > @width)
121
+ @width.upto(w-1) { |ii| @fields[ii] ||= Field.new }
122
+ @width = w
123
+ end
124
+ end
125
+ def add(item, x)
126
+ (@fields[x] ||= Field.new).add item
127
+ end
128
+ def each_field(x, w=1)
129
+ x.upto([x+w, @width].min - 1) { |xx|
130
+ yield(@fields[xx])
131
+ }
132
+ end
133
+ def to_html cgi
134
+ cgi.tr(@attributes) {
135
+ field_html(cgi)
136
+ }
137
+ end
138
+ def field_attribute(key, x=0)
139
+ @fields[x].attribute(key)
140
+ end
141
+ def field_html(cgi)
142
+ html = ""
143
+ span = 1
144
+ @fields.each { |field|
145
+ if(span < 2)
146
+ html << field.to_html(cgi)
147
+ span = field.colspan
148
+ else
149
+ span.step(-1)
150
+ end
151
+ }
152
+ html
153
+ end
154
+ def set_attributes(attr)
155
+ @attributes = attr
156
+ end
157
+ def [](x)
158
+ begin
159
+ @fields[x]
160
+ rescue StandardError
161
+ nil
162
+ end
163
+ end
164
+ end
165
+ public
166
+ def initialize(attributes={})
167
+ @height = 1
168
+ @width = 1
169
+ @rows = [Row.new]
170
+ @attributes = {
171
+ "cellspacing" => "0",
172
+ }.update(attributes)
173
+ end
174
+ def initialize_grid(w, h)
175
+ if(w > @width || h > @height)
176
+ floor = (w > @width) ? 0 : @height
177
+ @width = [w, @width].max
178
+ @height = [h, @height].max
179
+ floor.upto(@height - 1) { |ii|
180
+ (@rows[ii] ||= Row.new).initialize_row(@width)
181
+ }
182
+ end
183
+ end
184
+ def add(arg, x, y, col=false)
185
+ if arg.kind_of? Enumerable
186
+ if(col)
187
+ add_column(arg, x, y)
188
+ else
189
+ add_row(arg, x, y)
190
+ end
191
+ else
192
+ add_field(arg, x, y)
193
+ end
194
+ end
195
+ def add_attribute(key, value, x, y, w=1, h=1)
196
+ each_field(x, y, w, h) { |field|
197
+ field.add_attribute(key, value)
198
+ }
199
+ end
200
+ def add_background(x, y, w=1, h=1)
201
+ each_field(x, y, w, h) { |field|
202
+ field.add_background(x, w)
203
+ }
204
+ end
205
+ def add_column(arg, x, y)
206
+ offset = 0
207
+ arg.each do |item|
208
+ add_field(item, x, y + offset)
209
+ offset = offset.next
210
+ end
211
+ end
212
+ def add_component_style(style, x, y, w=1, h=1)
213
+ each_field(x, y, w, h) { |field|
214
+ field.add_component_style(style)
215
+ }
216
+ end
217
+ def add_field(arg, x, y)
218
+ initialize_grid(x+1, y+1)
219
+ (@rows[y] ||= Row.new).add(arg, x)
220
+ end
221
+ def add_row(arg, x, y)
222
+ offset = 0
223
+ arg.each do |item|
224
+ add_field(item, x + offset, y)
225
+ offset = offset.next
226
+ end
227
+ end
228
+ def add_style(style, x, y, w=1, h=1)
229
+ each_field(x, y, w, h) { |field|
230
+ field.add_style(style)
231
+ }
232
+ end
233
+ def add_tag(tag, x, y, w=1, h=1)
234
+ initialize_grid(x+w, y+h)
235
+ each_field(x, y, w, h) { |field|
236
+ field.tag = tag
237
+ }
238
+ end
239
+ def each_field(x, y, w=1, h=1)
240
+ y.upto([y+h, @height].min - 1) { |yy|
241
+ @rows[yy].each_field(x,w) { |field|
242
+ yield(field)
243
+ }
244
+ }
245
+ end
246
+ def field_attribute(key, x=0, y=0)
247
+ @rows[y].field_attribute(key, x)
248
+ end
249
+ def insert_row(y=0, arg=nil)
250
+ @rows[y, 0] = Row.new
251
+ @height += 1
252
+ add(arg, 0, y)
253
+ end
254
+ def push(arg, x=0, y=height)
255
+ add(arg, x, y)
256
+ set_colspan(x,y)
257
+ end
258
+ def set_attribute(key, value)
259
+ @attributes[key] = value
260
+ end
261
+ def set_attributes(hash)
262
+ @attributes.update(hash)
263
+ end
264
+ def set_colspan(x=0, y=0, span=(@width - x))
265
+ initialize_grid(x+span, y+1)
266
+ self[x,y].colspan = span
267
+ end
268
+ def set_row_attributes(attr={}, y=0)
269
+ initialize_grid(0, y+1)
270
+ @rows[y].set_attributes(attr)
271
+ end
272
+ def to_html(cgi)
273
+ cgi.table(@attributes) {
274
+ @rows.collect { |row| row.to_html(cgi) }.join
275
+ }
276
+ end
277
+ def [](x, y)
278
+ begin
279
+ @rows[y][x]
280
+ rescue StandardError
281
+ nil
282
+ end
283
+ end
284
+ end
285
+ end
286
+ end
@@ -0,0 +1,43 @@
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
+ # Image -- htmlgrid -- 27.11.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/namedcomponent'
28
+
29
+ module HtmlGrid
30
+ class Image < NamedComponent
31
+ def init
32
+ super
33
+ if(@lookandfeel)
34
+ @attributes['src'] = @lookandfeel.resource(@name)
35
+ @attributes['alt'] = @lookandfeel.lookup(@name)
36
+ end
37
+ #@attributes['border'] = "0"
38
+ end
39
+ def to_html(context)
40
+ context.img(@attributes)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,41 @@
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
+ # InfoMessage -- htmlgrid -- 25.08.2003 -- mhuggler@ywesee.com
26
+
27
+ module HtmlGrid
28
+ module InfoMessage
29
+ private
30
+ def info_message
31
+ if @session.info?
32
+ @session.infos.each { |info|
33
+ txt = HtmlGrid::Text.new(info, @model, @session, self)
34
+ @grid.insert_row(0, txt)
35
+ @grid.set_colspan(0,0)
36
+ @grid.add_style('info', 0, 0)
37
+ }
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,59 @@
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
+ # Input -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/namedcomponent'
28
+
29
+ module HtmlGrid
30
+ class Input < NamedComponent
31
+ def init
32
+ super
33
+ @attributes['name'] = @name.to_s
34
+ value = nil
35
+ if(@model.respond_to?(@name))
36
+ value = @model.send(@name)
37
+ end
38
+ if(value.nil? \
39
+ && @session.respond_to?(:user_input))
40
+ value = @session.user_input(@name)
41
+ end
42
+ if(value.nil? && autofill? \
43
+ && @session.respond_to?(:get_cookie_input))
44
+ value = @session.get_cookie_input(@name)
45
+ end
46
+ if(value.is_a? RuntimeError)
47
+ value = value.value
48
+ end
49
+ self.value = value
50
+ end
51
+ def value=(value)
52
+ @attributes.store("value", value.to_s)
53
+ @value = value
54
+ end
55
+ def to_html(context)
56
+ context.input(@attributes)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,41 @@
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
+ # InputCheckbox -- htmlgrid -- 29.04.2003 -- mhuggler@ywesee.com
26
+
27
+ require 'htmlgrid/input'
28
+
29
+ module HtmlGrid
30
+ class InputCheckbox < Input
31
+ LABEL = true
32
+ def init
33
+ super
34
+ if(@value)
35
+ @attributes.store('checked', true)
36
+ end
37
+ @attributes.store('value', '1')
38
+ @attributes['type'] = 'checkbox'
39
+ end
40
+ end
41
+ 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
+ # InputCurrency -- htmlgrid -- 14.03.2003 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/inputtext'
28
+
29
+ module HtmlGrid
30
+ class InputCurrency < InputText
31
+ def init
32
+ super
33
+ @attributes['value'] = @lookandfeel.format_price(@value)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,38 @@
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
+ #InputDate -- htmlgrid -- 22.04.2003 -- benfay@ywesee.com
26
+
27
+ require 'htmlgrid/inputtext'
28
+
29
+ module HtmlGrid
30
+ class InputDate < InputText
31
+ def init
32
+ super
33
+ if(@value.respond_to?(:strftime))
34
+ @attributes['value'] = @value.strftime(@lookandfeel.lookup(:date_format))
35
+ end
36
+ end
37
+ end
38
+ 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
24
+ #
25
+ # InputFile -- oddb -- 29.07.2003 -- mhuggler@ywesee.com
26
+
27
+ require 'htmlgrid/namedcomponent'
28
+
29
+ module HtmlGrid
30
+ class InputFile < NamedComponent
31
+ LABEL = true
32
+ def init
33
+ super
34
+ @attributes["type"] = 'file'
35
+ end
36
+ def to_html(context)
37
+ context.input(@attributes)
38
+ end
39
+ end
40
+ end
@@ -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/htmlgrid
24
+ #
25
+ # InputRadio -- htmlgrid -- 29.04.2003 -- mhuggler@ywesee.com
26
+
27
+ require 'htmlgrid/input'
28
+
29
+ module HtmlGrid
30
+ class InputRadio < Input
31
+ LABEL = true
32
+ def init
33
+ super
34
+ @attributes['type'] = 'radio'
35
+ end
36
+ end
37
+ end
@@ -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/htmlgrid
24
+ #
25
+ # InputText -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
26
+
27
+ require 'htmlgrid/input'
28
+
29
+ module HtmlGrid
30
+ class InputText < Input
31
+ LABEL = true
32
+ def init
33
+ super
34
+ @attributes['type'] = 'text'
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ # JavaScript -- htmlgrid -- 25.10.2005 -- hwyss@ywesee.com
4
+
5
+ require 'htmlgrid/component'
6
+
7
+ module HtmlGrid
8
+ class JavaScript < Component
9
+ def init
10
+ super
11
+ @attributes = {
12
+ 'type' => 'text/javascript',
13
+ 'language'=> 'JavaScript',
14
+ }
15
+ end
16
+ def to_html(context)
17
+ context.script(@attributes) {
18
+ @value.to_s
19
+ }
20
+ end
21
+ end
22
+ end