rmobio 1.1.15 → 1.1.16
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.
- data/lib/rmobio/rxml/base_transformer.rb +37 -16
- data/lib/rmobio/rxml/xforms_transformer.rb +68 -30
- metadata +2 -2
@@ -169,9 +169,12 @@ The above code generates the following xhtml in Firefox:
|
|
169
169
|
# my italic example
|
170
170
|
# </i>
|
171
171
|
def text(doc, txt="", options={})
|
172
|
-
doc << txt
|
172
|
+
doc << txt
|
173
173
|
end
|
174
|
-
|
174
|
+
#Itentical to text except a line break at the end of the text
|
175
|
+
def text_line(doc, txt="", options={})
|
176
|
+
doc << txt << "<br/>"
|
177
|
+
end
|
175
178
|
#Create a text box. To apply style for text, wrap the tag with xml tag.
|
176
179
|
#Extra html style (cols, rows, etc.) can be specified in the hash variable options.
|
177
180
|
#===== Options
|
@@ -265,27 +268,34 @@ The above code generates the following xhtml in Firefox:
|
|
265
268
|
def softBr(doc)
|
266
269
|
doc.br
|
267
270
|
end
|
268
|
-
#Create html img tag.
|
269
|
-
#1.
|
270
|
-
#2. src: the url of the image
|
271
|
+
#Create html img tag.
|
272
|
+
#1. src: the url of the image
|
271
273
|
#==== Options
|
272
274
|
#* <tt>:style</tt> -- specifies html, xhtml style attributes as a string
|
273
275
|
#* <tt>:alt</tt> -- html alt attribute
|
274
276
|
#==== Examples
|
275
277
|
# img = {:alt=>"Rails", :xstyle=>'height="5ex" width="100%"'}
|
276
|
-
# @xml.image(body,
|
278
|
+
# @xml.image(body, 'http://homer.qa.mobiolabs.com/cms/images/default/glp/bn/til/top-wcric.png', img)
|
277
279
|
#generates the following xhtml:
|
278
|
-
# <img
|
280
|
+
# <img
|
279
281
|
# src="http://homer.qa.mobiolabs.com/cms/images/default/glp/bn/til/top-wcric.png"
|
280
282
|
# alt="Rails"/>
|
281
|
-
def image(doc,
|
282
|
-
doc << "\n<img
|
283
|
+
def image(doc, src, options={})
|
284
|
+
doc << "\n<img src=\"#{src}\" #{options[:style]}"
|
283
285
|
doc << " alt=\"" << options[:alt] << "\"" if options[:alt]
|
284
286
|
doc << '/>'
|
285
287
|
end
|
286
|
-
#Not implemented for html client
|
287
|
-
def instance_tag(doc, id, src=nil, &block)
|
288
|
-
|
288
|
+
#Not implemented for html client, only impemented for xforms client
|
289
|
+
def instance_tag(doc, id, src=nil, &block)
|
290
|
+
if block
|
291
|
+
yield doc
|
292
|
+
end
|
293
|
+
end
|
294
|
+
def vstack(doc, xstyle='height="0"')
|
295
|
+
yield doc
|
296
|
+
end
|
297
|
+
def hstack(doc, xstyle='height="0"')
|
298
|
+
yield doc
|
289
299
|
end
|
290
300
|
#Create table tag
|
291
301
|
#1. style: html styles
|
@@ -323,10 +333,10 @@ The above code generates the following xhtml in Firefox:
|
|
323
333
|
def tab(doc, xstyle="")
|
324
334
|
yield doc
|
325
335
|
end
|
326
|
-
def switch(doc)
|
336
|
+
def switch(doc)
|
327
337
|
yield doc
|
328
338
|
end
|
329
|
-
def xcase(doc, id, label=nil, xstyle=nil)
|
339
|
+
def xcase(doc, id, label=nil, xstyle=nil)
|
330
340
|
yield doc
|
331
341
|
end
|
332
342
|
def softkey(doc, position="1", label="", refid=nil, &block)
|
@@ -334,20 +344,31 @@ The above code generates the following xhtml in Firefox:
|
|
334
344
|
yield doc
|
335
345
|
end
|
336
346
|
end
|
347
|
+
#Implement menus with links
|
337
348
|
def menus(doc, id, label="Options", &block)
|
349
|
+
doc << "<br/>"
|
338
350
|
if block
|
339
351
|
yield doc
|
340
352
|
end
|
353
|
+
doc << "<br/>"
|
341
354
|
end
|
355
|
+
#
|
342
356
|
def menu(doc, label, accesskey=nil, &block)
|
357
|
+
doc << "<a href=\""
|
343
358
|
if block
|
344
|
-
yield doc
|
345
|
-
end
|
359
|
+
yield doc
|
360
|
+
end
|
361
|
+
doc << "\">" << label << '</a> '
|
346
362
|
end
|
347
363
|
def load_tag(doc, resource)
|
364
|
+
doc << resource
|
348
365
|
end
|
349
366
|
def syscall(doc, name, address=nil, address_ref=nil, message=nil, message_ref=nil)
|
350
367
|
end
|
368
|
+
def action_tag(doc, event="DOMActivate")
|
369
|
+
end
|
370
|
+
def toggle_tag(doc, name="main")
|
371
|
+
end
|
351
372
|
def exit_tag(doc)
|
352
373
|
end
|
353
374
|
def back_tag(doc)
|
@@ -192,7 +192,9 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
192
192
|
end
|
193
193
|
end
|
194
194
|
end
|
195
|
-
|
195
|
+
def text_line(doc, txt="", options={})
|
196
|
+
text(doc, txt, options)
|
197
|
+
end
|
196
198
|
#Produce a textoutput widget (multi line text box).
|
197
199
|
#The text area is read only for xforms client.
|
198
200
|
#
|
@@ -477,13 +479,13 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
477
479
|
#
|
478
480
|
#==== Examples
|
479
481
|
#* Simple link:
|
480
|
-
# @xml.
|
482
|
+
# @xml.button(body, "http://m.twitter.com", "Twitter")
|
481
483
|
#generate the following xforms:
|
482
484
|
# <m:button height="1ex"><m:label>Twitter</m:label>
|
483
485
|
# <xf:load ev:event="DOMActivate" resource="http://m.twitter.com"/>
|
484
486
|
# </m:button>
|
485
487
|
#* Customize action:
|
486
|
-
# @xml.
|
488
|
+
# @xml.button(body, "http://m.twitter.com", "Twitter") do |link|
|
487
489
|
# @xml.view_tag(link, '<xf:toggle case="page2" ev:event="DOMActivate"/>')
|
488
490
|
# end
|
489
491
|
#generates the following xforms:
|
@@ -524,24 +526,23 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
524
526
|
end
|
525
527
|
|
526
528
|
#Create image widget. There are two types of image control: icon and image.
|
527
|
-
#See Mobio client user manual for details.
|
528
|
-
#1.
|
529
|
-
#2.
|
530
|
-
#3. options: all other attributes
|
529
|
+
#See Mobio client user manual for details.
|
530
|
+
#1. src: the url of the image
|
531
|
+
#2. options: all other attributes
|
531
532
|
#==== Options
|
532
533
|
#* <tt>:xstyle</tt> -- specifies xforms style attributes like height, width, style, \
|
533
534
|
#etc. as string.
|
534
535
|
#* <tt>:widget</tt> -- specifies the widget to use, "icon" or "image". Default\
|
535
536
|
#is <image>.
|
536
|
-
#* <tt>:xpath</tt> -- specifies the xpath
|
537
|
-
#the image url.
|
537
|
+
#* <tt>:xpath</tt> -- specifies the xpath of the data instancen that contains \
|
538
|
+
#the image url.
|
538
539
|
#
|
539
540
|
#==== Examples (
|
540
541
|
#* Create a simple image control\
|
541
542
|
#Note, define the style options outside the doctype block):
|
542
543
|
# img = {:alt=>"Rails", :xstyle=>'height="5ex" width="100%"'}
|
543
544
|
# @xml.doctype(xml) do |x|
|
544
|
-
# @xml.body(x, '
|
545
|
+
# @xml.body(x, 'default_style.xml') do|body|
|
545
546
|
# @xml.image(body, "img1", 'http://localhost:3000/images/rails.png',img)
|
546
547
|
# end
|
547
548
|
# end
|
@@ -550,29 +551,24 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
550
551
|
#The image will be scaled to 5 character high on the screen when the page is loaded.
|
551
552
|
#* This example creates an icon widget which takes the image url from an \
|
552
553
|
#instance variable:
|
553
|
-
# @xml.image(body,
|
554
|
+
# @xml.image(body, 'http://localhost:3000/images/rails.png',
|
554
555
|
# {:xstyle=>'height="3ex" width="20em"',
|
555
|
-
# :xpath=>"images/url",
|
556
|
+
# :xpath=>"instance('img1')/images/url",
|
556
557
|
# :widget=>"icon"})
|
557
558
|
#generates the following xforms:
|
558
559
|
# <m:icon height="3ex" width="20em" ref="instance('img1')/images/url"></m:icon>
|
559
560
|
#The icon takes the url from an instance named "img1" with xpath /images/url.
|
560
561
|
#The instance data has to be defined for the image to be displayed.
|
561
|
-
def image(doc,
|
562
|
+
def image(doc, src=nil, options={})
|
562
563
|
widget = "image"
|
563
564
|
widget = options[:widget] if options[:widget]
|
564
|
-
@view_buffer << "\n<m:#{widget} #{options[:xstyle]}"
|
565
|
+
@view_buffer << "\n<m:#{widget} #{options[:xstyle]}"
|
565
566
|
|
566
567
|
# if id, get the image from predefined instance data, otherwise, just
|
567
568
|
# use the src path
|
568
|
-
if
|
569
|
-
@view_buffer << " ref=\"
|
570
|
-
|
571
|
-
@view_buffer << options[:xpath] << "\">"
|
572
|
-
else
|
573
|
-
@view_buffer << src << "\">"
|
574
|
-
end
|
575
|
-
else
|
569
|
+
if options[:xpath]
|
570
|
+
@view_buffer << " ref=\"#{options[:xpath]}\">"
|
571
|
+
else
|
576
572
|
@view_buffer << '>' << src
|
577
573
|
end
|
578
574
|
|
@@ -634,7 +630,16 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
634
630
|
@model_buffer << "\n<xf:instance src=\"#{src}\"/>"
|
635
631
|
end
|
636
632
|
end
|
637
|
-
|
633
|
+
def vstack(doc, xstyle='height="0"')
|
634
|
+
@view_buffer << "<m:vstack #{xstyle}>"
|
635
|
+
yield doc
|
636
|
+
@view_buffer << "</m:vstack>"
|
637
|
+
end
|
638
|
+
def hstack(doc, xstyle='height="0"')
|
639
|
+
@view_buffer << "<m:hstack #{xstyle}>"
|
640
|
+
yield doc
|
641
|
+
@view_buffer << "</m:hstack>"
|
642
|
+
end
|
638
643
|
#Create grid control, similar to table in html
|
639
644
|
#1. style: html styles
|
640
645
|
#2. xstyle: xforms styles
|
@@ -643,7 +648,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
643
648
|
yield doc
|
644
649
|
@view_buffer << '</m:grid>'
|
645
650
|
end
|
646
|
-
def row(doc, id, nodeset, style=
|
651
|
+
def row(doc, id, nodeset, style=nil, xstyle='col="auto"')
|
647
652
|
@view_buffer << "<m:rowset id=\"#{id}\" nodeset=\"#{nodeset}\" #{xstyle}>"
|
648
653
|
yield doc
|
649
654
|
@view_buffer << '</m:rowset>'
|
@@ -664,15 +669,13 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
664
669
|
yield doc
|
665
670
|
@view_buffer << '</m:itemlist>'
|
666
671
|
end
|
667
|
-
def cell(doc, style=nil, xstyle=
|
668
|
-
xstyle = 'style="item"' if xstyle.nil?
|
672
|
+
def cell(doc, style=nil, xstyle='style="item"')
|
669
673
|
@view_buffer << "<m:item #{xstyle}>"
|
670
674
|
yield doc
|
671
675
|
@view_buffer << '</m:item>'
|
672
676
|
end
|
673
677
|
#Create slist control.
|
674
|
-
def list(doc, style=nil, xstyle=
|
675
|
-
xstyle = 'style="slist"' if xstyle.nil?
|
678
|
+
def list(doc, style=nil, xstyle='style="slist"')
|
676
679
|
@view_buffer << "\n<m:slist #{xstyle}>"
|
677
680
|
yield doc
|
678
681
|
@view_buffer << '</m:slist>'
|
@@ -984,8 +987,25 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
984
987
|
@view_buffer << "<m:param name=\"message\" ref=\"#{message_ref}\"/>" if message_ref
|
985
988
|
@view_buffer << '</m:syscall>'
|
986
989
|
end
|
987
|
-
|
988
|
-
|
990
|
+
#Create Action control. Default event is "DOMActivate" if event argument is
|
991
|
+
#not defined.
|
992
|
+
#1. event: the name of DOM event to trigger the action. Refer to Mobio client\
|
993
|
+
#user manual for all event types.
|
994
|
+
#==== Examples
|
995
|
+
# @xf.action_tag(body) do |a|
|
996
|
+
# end
|
997
|
+
#generates an action control with default DOM event:
|
998
|
+
# <xf:action ev:event="DOMActivate">
|
999
|
+
# </xf:action>
|
1000
|
+
#
|
1001
|
+
# @xf.action_tag(body, "xforms-ready") do |a|
|
1002
|
+
# end
|
1003
|
+
#generates an action control with "xforms-ready" event:
|
1004
|
+
# <xf:action ev:event="xforms-ready">
|
1005
|
+
# </xf:action>
|
1006
|
+
#
|
1007
|
+
def action_tag(doc, event="DOMActivate")
|
1008
|
+
@view_buffer << "<xf:action ev:event=\"#{event}\">"
|
989
1009
|
yield doc
|
990
1010
|
@view_buffer << '</xf:action>'
|
991
1011
|
end
|
@@ -1016,6 +1036,24 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
1016
1036
|
def back_tag(doc)
|
1017
1037
|
@view_buffer << "<m:back ev:event=\"DOMActivate\"/>"
|
1018
1038
|
end
|
1039
|
+
#Create toggle control
|
1040
|
+
#1. name: the toggle case name, default is "main" if not defined.
|
1041
|
+
#==== Examples
|
1042
|
+
# @xml.softkey(body, "3", "back") do |soft1|
|
1043
|
+
# @xml.toggle_tag(soft1)
|
1044
|
+
# end
|
1045
|
+
#generates a toggle control to go back to "main" switch case:
|
1046
|
+
# <xf:toggle case="main" ev:event="DOMActivate"/>
|
1047
|
+
#
|
1048
|
+
# @xml.softkey(body, "3", "back") do |soft1|
|
1049
|
+
# @xml.toggle_tag(soft1, "view")
|
1050
|
+
# end
|
1051
|
+
#generates a toggle control to go back to a switch case named "view":
|
1052
|
+
# <xf:toggle case="view" ev:event="DOMActivate"/>
|
1053
|
+
#
|
1054
|
+
def toggle_tag(doc, name="main")
|
1055
|
+
@view_buffer << "<xf:toggle case=\"#{name}\" ev:event=\"DOMActivate\"/>"
|
1056
|
+
end
|
1019
1057
|
|
1020
1058
|
#Override builder method_missing method to send output to model buffer so we
|
1021
1059
|
#can create arbitrary xml tags in the model. Typically combine with instance_tag
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmobio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mobio Networks
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|