htmlgrid 1.2.0 → 1.2.1
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.
- checksums.yaml +4 -4
- data/lib/htmlgrid/booleanvalue.rb +14 -14
- data/lib/htmlgrid/button.rb +9 -9
- data/lib/htmlgrid/centeredcomposite.rb +21 -20
- data/lib/htmlgrid/component.rb +214 -199
- data/lib/htmlgrid/composite.rb +332 -301
- data/lib/htmlgrid/datevalue.rb +12 -12
- data/lib/htmlgrid/div.rb +9 -9
- data/lib/htmlgrid/divcomposite.rb +44 -43
- data/lib/htmlgrid/divform.rb +8 -8
- data/lib/htmlgrid/divlist.rb +17 -19
- data/lib/htmlgrid/divtemplate.rb +6 -6
- data/lib/htmlgrid/dojotoolkit.rb +54 -48
- data/lib/htmlgrid/errormessage.rb +47 -43
- data/lib/htmlgrid/form.rb +70 -62
- data/lib/htmlgrid/formlist.rb +14 -14
- data/lib/htmlgrid/grid.rb +111 -67
- data/lib/htmlgrid/image.rb +17 -16
- data/lib/htmlgrid/infomessage.rb +15 -14
- data/lib/htmlgrid/input.rb +34 -32
- data/lib/htmlgrid/inputcheckbox.rb +13 -13
- data/lib/htmlgrid/inputcurrency.rb +9 -9
- data/lib/htmlgrid/inputdate.rb +11 -11
- data/lib/htmlgrid/inputfile.rb +13 -12
- data/lib/htmlgrid/inputradio.rb +9 -9
- data/lib/htmlgrid/inputtext.rb +10 -10
- data/lib/htmlgrid/javascript.rb +17 -16
- data/lib/htmlgrid/label.rb +53 -49
- data/lib/htmlgrid/labeltext.rb +8 -8
- data/lib/htmlgrid/link.rb +31 -27
- data/lib/htmlgrid/list.rb +121 -110
- data/lib/htmlgrid/namedcomponent.rb +28 -25
- data/lib/htmlgrid/pass.rb +11 -11
- data/lib/htmlgrid/passthru.rb +20 -17
- data/lib/htmlgrid/popuplink.rb +41 -39
- data/lib/htmlgrid/reset.rb +8 -8
- data/lib/htmlgrid/richtext.rb +22 -20
- data/lib/htmlgrid/select.rb +28 -26
- data/lib/htmlgrid/span.rb +9 -9
- data/lib/htmlgrid/spancomposite.rb +18 -18
- data/lib/htmlgrid/spanlist.rb +9 -9
- data/lib/htmlgrid/staticinput.rb +14 -13
- data/lib/htmlgrid/submit.rb +9 -9
- data/lib/htmlgrid/template.rb +120 -105
- data/lib/htmlgrid/text.rb +9 -9
- data/lib/htmlgrid/textarea.rb +19 -17
- data/lib/htmlgrid/ulcomposite.rb +22 -22
- data/lib/htmlgrid/ullist.rb +9 -9
- data/lib/htmlgrid/urllink.rb +38 -36
- data/lib/htmlgrid/value.rb +9 -9
- data/lib/htmlgrid/version.rb +2 -2
- data/test/stub/cgi.rb +10 -7
- data/test/suite.rb +3 -3
- data/test/test_add_row.rb +12 -13
- data/test/test_component.rb +121 -100
- data/test/test_composite.rb +85 -46
- data/test/test_datevalue.rb +28 -24
- data/test/test_divlist.rb +126 -0
- data/test/test_dojotoolkit.rb +41 -27
- data/test/test_form.rb +89 -73
- data/test/test_formlist.rb +77 -65
- data/test/test_grid.rb +256 -208
- data/test/test_input.rb +37 -31
- data/test/test_interaction_list.rb +106 -70
- data/test/test_label.rb +91 -77
- data/test/test_list.rb +110 -95
- data/test/test_select.rb +35 -30
- data/test/test_template.rb +63 -55
- data/test/test_text.rb +36 -31
- metadata +17 -2
data/lib/htmlgrid/image.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -22,22 +22,23 @@
|
|
22
22
|
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
23
23
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
24
24
|
#
|
25
|
-
# Image -- htmlgrid -- 27.11.2002 -- hwyss@ywesee.com
|
25
|
+
# Image -- htmlgrid -- 27.11.2002 -- hwyss@ywesee.com
|
26
26
|
|
27
|
-
require
|
27
|
+
require "htmlgrid/namedcomponent"
|
28
28
|
|
29
29
|
module HtmlGrid
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
+
|
40
|
+
def to_html(context)
|
41
|
+
context.img(@attributes)
|
42
|
+
end
|
43
|
+
end
|
43
44
|
end
|
data/lib/htmlgrid/infomessage.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -25,17 +25,18 @@
|
|
25
25
|
# InfoMessage -- htmlgrid -- 25.08.2003 -- mhuggler@ywesee.com
|
26
26
|
|
27
27
|
module HtmlGrid
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
28
|
+
module InfoMessage
|
29
|
+
private
|
30
|
+
|
31
|
+
def info_message
|
32
|
+
if @session.info?
|
33
|
+
@session.infos.each { |info|
|
34
|
+
txt = HtmlGrid::Text.new(info, @model, @session, self)
|
35
|
+
@grid.insert_row(0, txt)
|
36
|
+
@grid.set_colspan(0, 0)
|
37
|
+
@grid.add_style("info", 0, 0)
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
41
42
|
end
|
data/lib/htmlgrid/input.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -22,38 +22,40 @@
|
|
22
22
|
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
23
23
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
24
24
|
#
|
25
|
-
# Input -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
|
25
|
+
# Input -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
|
26
26
|
|
27
|
-
require
|
27
|
+
require "htmlgrid/namedcomponent"
|
28
28
|
|
29
29
|
module HtmlGrid
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
+
|
52
|
+
def value=(value)
|
53
|
+
@attributes.store("value", value.to_s)
|
54
|
+
@value = value
|
55
|
+
end
|
56
|
+
|
57
|
+
def to_html(context)
|
58
|
+
context.input(@attributes)
|
59
|
+
end
|
60
|
+
end
|
59
61
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -24,18 +24,18 @@
|
|
24
24
|
#
|
25
25
|
# InputCheckbox -- htmlgrid -- 29.04.2003 -- mhuggler@ywesee.com
|
26
26
|
|
27
|
-
require
|
27
|
+
require "htmlgrid/input"
|
28
28
|
|
29
29
|
module HtmlGrid
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
41
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -22,15 +22,15 @@
|
|
22
22
|
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
23
23
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
24
24
|
#
|
25
|
-
# InputCurrency -- htmlgrid -- 14.03.2003 -- hwyss@ywesee.com
|
25
|
+
# InputCurrency -- htmlgrid -- 14.03.2003 -- hwyss@ywesee.com
|
26
26
|
|
27
|
-
require
|
27
|
+
require "htmlgrid/inputtext"
|
28
28
|
|
29
29
|
module HtmlGrid
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
class InputCurrency < InputText
|
31
|
+
def init
|
32
|
+
super
|
33
|
+
@attributes["value"] = @lookandfeel.format_price(@value)
|
34
|
+
end
|
35
|
+
end
|
36
36
|
end
|
data/lib/htmlgrid/inputdate.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -22,17 +22,17 @@
|
|
22
22
|
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
23
23
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
24
24
|
#
|
25
|
-
#InputDate -- htmlgrid -- 22.04.2003 -- benfay@ywesee.com
|
25
|
+
# InputDate -- htmlgrid -- 22.04.2003 -- benfay@ywesee.com
|
26
26
|
|
27
|
-
require
|
27
|
+
require "htmlgrid/inputtext"
|
28
28
|
|
29
29
|
module HtmlGrid
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
38
|
end
|
data/lib/htmlgrid/inputfile.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -24,17 +24,18 @@
|
|
24
24
|
#
|
25
25
|
# InputFile -- oddb -- 29.07.2003 -- mhuggler@ywesee.com
|
26
26
|
|
27
|
-
require
|
27
|
+
require "htmlgrid/namedcomponent"
|
28
28
|
|
29
29
|
module HtmlGrid
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
30
|
+
class InputFile < NamedComponent
|
31
|
+
LABEL = true
|
32
|
+
def init
|
33
|
+
super
|
34
|
+
@attributes["type"] = "file"
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_html(context)
|
38
|
+
context.input(@attributes)
|
39
|
+
end
|
40
|
+
end
|
40
41
|
end
|
data/lib/htmlgrid/inputradio.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -24,14 +24,14 @@
|
|
24
24
|
#
|
25
25
|
# InputRadio -- htmlgrid -- 29.04.2003 -- mhuggler@ywesee.com
|
26
26
|
|
27
|
-
require
|
27
|
+
require "htmlgrid/input"
|
28
28
|
|
29
29
|
module HtmlGrid
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
class InputRadio < Input
|
31
|
+
LABEL = true
|
32
|
+
def init
|
33
|
+
super
|
34
|
+
@attributes["type"] = "radio"
|
35
|
+
end
|
36
|
+
end
|
37
37
|
end
|
data/lib/htmlgrid/inputtext.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -22,16 +22,16 @@
|
|
22
22
|
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
23
23
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
24
24
|
#
|
25
|
-
# InputText -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
|
25
|
+
# InputText -- htmlgrid -- 24.10.2002 -- hwyss@ywesee.com
|
26
26
|
|
27
|
-
require
|
27
|
+
require "htmlgrid/input"
|
28
28
|
|
29
29
|
module HtmlGrid
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
class InputText < Input
|
31
|
+
LABEL = true
|
32
|
+
def init
|
33
|
+
super
|
34
|
+
@attributes["type"] = "text"
|
35
|
+
end
|
36
|
+
end
|
37
37
|
end
|
data/lib/htmlgrid/javascript.rb
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
# JavaScript -- htmlgrid -- 25.10.2005 -- hwyss@ywesee.com
|
4
4
|
|
5
|
-
require
|
5
|
+
require "htmlgrid/component"
|
6
6
|
|
7
7
|
module HtmlGrid
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
8
|
+
class JavaScript < Component
|
9
|
+
def init
|
10
|
+
super
|
11
|
+
@attributes = {
|
12
|
+
"type" => "text/javascript",
|
13
|
+
"language" => "JavaScript"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_html(context)
|
18
|
+
context.script(@attributes) {
|
19
|
+
@value.to_s
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
22
23
|
end
|
data/lib/htmlgrid/label.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
|
3
3
|
#
|
4
4
|
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
5
5
|
# Copyright (C) 2003 ywesee - intellectual capital connected
|
@@ -22,69 +22,73 @@
|
|
22
22
|
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
23
23
|
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
24
24
|
#
|
25
|
-
# Label -- htmlgrid -- 26.11.2002 -- hwyss@ywesee.com
|
25
|
+
# Label -- htmlgrid -- 26.11.2002 -- hwyss@ywesee.com
|
26
26
|
|
27
|
-
require
|
28
|
-
require
|
27
|
+
require "delegate"
|
28
|
+
require "htmlgrid/namedcomponent"
|
29
29
|
|
30
30
|
module HtmlGrid
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
class SimpleLabel < NamedComponent
|
32
|
+
def init
|
33
|
+
super
|
34
|
+
@value = @lookandfeel.lookup(@name)
|
35
35
|
state = @session.state
|
36
|
-
if
|
36
|
+
if state.respond_to?(:mandatory?) && state.mandatory?(@name)
|
37
37
|
@value += "*"
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_html(context)
|
42
|
+
context.label(@attributes) { @value }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Label < SimpleDelegator
|
47
|
+
include Enumerable
|
48
|
+
def initialize(component, session, label_key = nil)
|
49
|
+
@component = component
|
50
|
+
@attributes = {}
|
51
|
+
@session = session
|
52
|
+
@lookandfeel = session.lookandfeel
|
53
|
+
@label_key = label_key
|
54
|
+
if @component.respond_to? :name
|
55
|
+
@attributes["for"] = @component.name.to_s
|
56
|
+
@label_key ||= @component.name
|
57
|
+
end
|
58
|
+
if @component.respond_to?(:data_origin) \
|
59
|
+
&& (origin = @component.data_origin)
|
60
|
+
@attributes.store("title", origin.to_s)
|
61
|
+
end
|
62
|
+
if @session.error(@label_key) \
|
63
|
+
|| (@component.respond_to?(:name) && @session.error(@component.name))
|
64
|
+
@attributes["class"] = "error"
|
65
|
+
end
|
66
|
+
if @component.respond_to?(:attributes) \
|
67
|
+
&& (id = @component.attributes["id"])
|
68
|
+
@attributes.store("id", "label_#{id}")
|
69
|
+
end
|
70
|
+
super(component)
|
71
|
+
end
|
72
|
+
|
73
|
+
def each
|
74
|
+
yield self if @component.respond_to?(:label?) && @component.label?
|
75
|
+
yield @component
|
76
|
+
end
|
77
|
+
|
74
78
|
def to_html(context)
|
75
|
-
key
|
79
|
+
key = @label_key
|
76
80
|
label = @lookandfeel.lookup(key)
|
77
81
|
if !label && @component.respond_to?(:name)
|
78
|
-
key
|
82
|
+
key = @component.name
|
79
83
|
label = @lookandfeel.lookup(key)
|
80
84
|
end
|
81
85
|
state = @session.state
|
82
86
|
if label && state.respond_to?(:mandatory?) && state.mandatory?(key)
|
83
|
-
label +=
|
87
|
+
label += "*"
|
84
88
|
end
|
85
89
|
if label
|
86
90
|
context.label(@attributes) { label }
|
87
91
|
end
|
88
92
|
end
|
89
|
-
|
93
|
+
end
|
90
94
|
end
|