rmobio 1.1.26 → 1.1.27
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/xforms_transformer.rb +39 -41
- metadata +1 -1
@@ -79,7 +79,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
79
79
|
# basic_styles
|
80
80
|
yield xml
|
81
81
|
|
82
|
-
@model_buffer << "</xf:model></head>\n"
|
82
|
+
@model_buffer << "\n</xf:model></head>\n"
|
83
83
|
xml << @model_buffer << @view_buffer
|
84
84
|
xml << "</html>"
|
85
85
|
@view_buffer = ""
|
@@ -638,11 +638,11 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
638
638
|
# </xf:instance>
|
639
639
|
def instance_tag(doc, id, src=nil, &block)
|
640
640
|
if src.nil?
|
641
|
-
@model_buffer << "\n<xf:instance id=\"#{id}\"
|
641
|
+
@model_buffer << "\n<xf:instance id=\"#{id}\">\n<data xmlns=\"\">\n"
|
642
642
|
if block
|
643
643
|
yield doc
|
644
644
|
end
|
645
|
-
@model_buffer <<
|
645
|
+
@model_buffer << "\n</data></xf:instance>"
|
646
646
|
else
|
647
647
|
@model_buffer << "\n<xf:instance src=\"#{src}\"/>"
|
648
648
|
end
|
@@ -700,7 +700,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
700
700
|
def table(doc, options={})
|
701
701
|
@view_buffer << "\n<m:grid #{options[:xstyle]}>"
|
702
702
|
yield doc
|
703
|
-
@view_buffer <<
|
703
|
+
@view_buffer << "\n</m:grid>"
|
704
704
|
end
|
705
705
|
#Create grid rowset control, similar to <tr> in html.
|
706
706
|
#1. id - the widget id
|
@@ -733,9 +733,9 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
733
733
|
#* <tt>:style</tt> -- specifies html, xhtml style attributes as a string
|
734
734
|
#* <tt>:xstyle</tt> -- specifies xforms style attributes as a string
|
735
735
|
def itemset(doc, id, nodeset, options={})
|
736
|
-
@view_buffer << "<m:itemset id=\"#{id}\" nodeset=\"#{nodeset}\" #{options[:xstyle]}>"
|
736
|
+
@view_buffer << "\n<m:itemset id=\"#{id}\" nodeset=\"#{nodeset}\" #{options[:xstyle]}>"
|
737
737
|
yield doc
|
738
|
-
@view_buffer <<
|
738
|
+
@view_buffer << "\n</m:itemset>"
|
739
739
|
end
|
740
740
|
#Create <m:itemlist> control with static data.
|
741
741
|
#1. id - the widget id
|
@@ -743,27 +743,27 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
743
743
|
#* <tt>:style</tt> -- specifies html, xhtml style attributes as a string
|
744
744
|
#* <tt>:xstyle</tt> -- specifies xforms style attributes as a string
|
745
745
|
def itemlist(doc, id, options={})
|
746
|
-
@view_buffer << "<m:itemlist id=\"#{id}\" #{options[:xstyle]}>"
|
746
|
+
@view_buffer << "\n<m:itemlist id=\"#{id}\" #{options[:xstyle]}>"
|
747
747
|
yield doc
|
748
|
-
@view_buffer <<
|
748
|
+
@view_buffer << "\n</m:itemlist>"
|
749
749
|
end
|
750
750
|
#Create <m:item> control.
|
751
751
|
#==== Options
|
752
752
|
#* <tt>:style</tt> -- specifies html, xhtml style attributes as a string
|
753
753
|
#* <tt>:xstyle</tt> -- specifies xforms style attributes as a string
|
754
754
|
def cell(doc, options={})
|
755
|
-
@view_buffer << "<m:item #{options[:xstyle]}>"
|
755
|
+
@view_buffer << "\n<m:item #{options[:xstyle]}>"
|
756
756
|
yield doc
|
757
|
-
@view_buffer <<
|
757
|
+
@view_buffer << "\n</m:item>"
|
758
758
|
end
|
759
759
|
#Create <m:slist> control.
|
760
760
|
#==== Options
|
761
761
|
#* <tt>:style</tt> -- specifies html, xhtml style attributes as a string
|
762
762
|
#* <tt>:xstyle</tt> -- specifies xforms style attributes as a string
|
763
763
|
def list(doc, options={})
|
764
|
-
@view_buffer << "<m:slist #{options[:xstyle]}>"
|
764
|
+
@view_buffer << "\n<m:slist #{options[:xstyle]}>"
|
765
765
|
yield doc
|
766
|
-
@view_buffer <<
|
766
|
+
@view_buffer << "\n</m:slist>"
|
767
767
|
end
|
768
768
|
#Create a Tab control
|
769
769
|
#1. xstyle: the xforms style string. If xstyle is not specified, the default\
|
@@ -794,9 +794,9 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
794
794
|
# </m:tab>
|
795
795
|
#
|
796
796
|
def tab(doc, xstyle='width="100%" height="100%" style="tabbody"')
|
797
|
-
@view_buffer << "<m:tab #{xstyle}>"
|
797
|
+
@view_buffer << "\n<m:tab #{xstyle}>"
|
798
798
|
yield doc
|
799
|
-
@view_buffer <<
|
799
|
+
@view_buffer << "\n</m:tab>"
|
800
800
|
end
|
801
801
|
|
802
802
|
#Create swtich case control, similar to Tab control but without the tab UI.
|
@@ -824,9 +824,9 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
824
824
|
# </m:case>
|
825
825
|
# </m:switch>
|
826
826
|
def switch(doc)
|
827
|
-
@view_buffer << "<m:switch>"
|
827
|
+
@view_buffer << "\n<m:switch>"
|
828
828
|
yield doc
|
829
|
-
@view_buffer <<
|
829
|
+
@view_buffer << "\n</m:switch>"
|
830
830
|
end
|
831
831
|
|
832
832
|
#Create a case control. This tag cannot act along. It has to be wrapped in
|
@@ -837,7 +837,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
837
837
|
#3. xstyle: the xforms style string for the case (only needed in tab case).\
|
838
838
|
#if not defined, default style="tab" will be applied.
|
839
839
|
def xcase(doc, id, label=nil, xstyle=nil)
|
840
|
-
@view_buffer << "<m:case id=\"#{id}\" label=\"#{label}\""
|
840
|
+
@view_buffer << "\n<m:case id=\"#{id}\" label=\"#{label}\""
|
841
841
|
if xstyle
|
842
842
|
@view_buffer << " #{xstyle}"
|
843
843
|
else
|
@@ -845,7 +845,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
845
845
|
end
|
846
846
|
@view_buffer << '>'
|
847
847
|
yield doc
|
848
|
-
@view_buffer <<
|
848
|
+
@view_buffer << "\n</m:case>"
|
849
849
|
end
|
850
850
|
|
851
851
|
#Create a softkey menu.
|
@@ -918,7 +918,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
918
918
|
# </m:softkey>
|
919
919
|
# </m:menu>
|
920
920
|
def softkey(doc, position="1", label="", refid=nil, &block)
|
921
|
-
@view_buffer << "<m:softkey position=\"#{position}\"><m:label>#{label}</m:label>"
|
921
|
+
@view_buffer << "\n<m:softkey position=\"#{position}\"><m:label>#{label}</m:label>"
|
922
922
|
|
923
923
|
# If we have a refid, setup a popup for the child menus; otherwise, execute
|
924
924
|
# the proc to take action.
|
@@ -927,7 +927,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
927
927
|
else
|
928
928
|
@view_buffer << "<m:show-popup refid=\"#{refid}\" ev:event=\"DOMActivate\" />"
|
929
929
|
end
|
930
|
-
@view_buffer <<
|
930
|
+
@view_buffer << "\n</m:softkey>"
|
931
931
|
end
|
932
932
|
#A holders for a popup menu.
|
933
933
|
#1. id: the widget's reference id. The id is used by softkey to trigger the popup\
|
@@ -939,23 +939,21 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
939
939
|
#==== Examples
|
940
940
|
#Refer to softkey examples
|
941
941
|
def menus(doc, id, label="Options", xstyle=nil)
|
942
|
-
@view_buffer << "<m:menu id=\"#{id}\" height=\"0\""
|
942
|
+
@view_buffer << "\n<m:menu id=\"#{id}\" height=\"0\""
|
943
943
|
if xstyle
|
944
944
|
@view_buffer << " #{xstyle}>" if xstyle
|
945
945
|
else
|
946
946
|
@view_buffer << " width=\"40%\">"
|
947
947
|
end
|
948
948
|
|
949
|
-
@view_buffer << "<m:hstack height=\"1ex\" style=\"title\"><m:icon>jar://img/option.png</m:icon>"
|
950
|
-
@view_buffer << "<m:output style=\"option\">#{label}</m:output></m:hstack>"
|
949
|
+
@view_buffer << "\n<m:hstack height=\"1ex\" style=\"title\"><m:icon>jar://img/option.png</m:icon>"
|
950
|
+
@view_buffer << "\n<m:output style=\"option\">#{label}</m:output></m:hstack>"
|
951
951
|
@accesskey=0
|
952
952
|
|
953
|
-
@view_buffer << "<m:itemlist height=\"0\" style=\"menu\"> "
|
953
|
+
@view_buffer << "\n<m:itemlist height=\"0\" style=\"menu\"> "
|
954
954
|
yield doc
|
955
|
-
@view_buffer << "</m:itemlist>"
|
956
|
-
@view_buffer << "<m:softkey position=\"3\"
|
957
|
-
<m:softkey position=\"1\"><m:hide-popup ev:event=\"DOMActivate\" refid=\"#{id}\" />
|
958
|
-
<m:label>Close</m:label></m:softkey></m:menu>"
|
955
|
+
@view_buffer << "\n</m:itemlist>"
|
956
|
+
@view_buffer << "\n<m:softkey position=\"3\"/>\n<m:softkey position=\"1\">\n\t<m:hide-popup ev:event=\"DOMActivate\" refid=\"#{id}\" />\n\t<m:label>Close</m:label>\n</m:softkey>\n</m:menu>"
|
959
957
|
|
960
958
|
end
|
961
959
|
|
@@ -968,7 +966,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
968
966
|
#==== Examples
|
969
967
|
#Refer to softkey examples
|
970
968
|
def menu(doc, label, accesskey=nil, xstyle=nil, &block)
|
971
|
-
@view_buffer << "<m:item height=\"1ex\" accesskey=\""
|
969
|
+
@view_buffer << "\n<m:item height=\"1ex\" accesskey=\""
|
972
970
|
if accesskey
|
973
971
|
@view_buffer << accesskey
|
974
972
|
else
|
@@ -976,11 +974,11 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
976
974
|
end
|
977
975
|
@view_buffer << " style=\"#{xstyle}\"" if xstyle
|
978
976
|
@view_buffer << "\">"
|
979
|
-
@view_buffer << "<m:output style=\"label\">" << label << "</m:output>"
|
977
|
+
@view_buffer << "\n<m:output style=\"label\">" << label << "</m:output>"
|
980
978
|
if block
|
981
979
|
yield doc
|
982
980
|
end
|
983
|
-
@view_buffer << "</m:item>"
|
981
|
+
@view_buffer << "\n</m:item>"
|
984
982
|
end
|
985
983
|
|
986
984
|
#Create <xf:load> control to do a HTTP get for a new form. Default event
|
@@ -998,7 +996,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
998
996
|
# </m:softkey>
|
999
997
|
#
|
1000
998
|
def load_tag(doc, resource)
|
1001
|
-
@view_buffer << "<xf:load resource=\"#{resource}\" ev:event=\"DOMActivate\"/>"
|
999
|
+
@view_buffer << "\n<xf:load resource=\"#{resource}\" ev:event=\"DOMActivate\"/>"
|
1002
1000
|
end
|
1003
1001
|
|
1004
1002
|
#Create syscall control. Refer to mobio client user manual for details usage
|
@@ -1072,13 +1070,13 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
1072
1070
|
# </m:syscall>
|
1073
1071
|
# </m:button>
|
1074
1072
|
def syscall(doc, name, params={})
|
1075
|
-
@view_buffer << "<m:syscall name=\"#{name}\" ev:event=\"DOMActivate\">"
|
1073
|
+
@view_buffer << "\n<m:syscall name=\"#{name}\" ev:event=\"DOMActivate\">"
|
1076
1074
|
if not params.nil?
|
1077
1075
|
params.keys.each do |x|
|
1078
|
-
@view_buffer << "<m:param name=\"#{x}\" ref=\"#{params[x.to_sym]}\"/>"
|
1076
|
+
@view_buffer << "\n\t<m:param name=\"#{x}\" ref=\"#{params[x.to_sym]}\"/>"
|
1079
1077
|
end
|
1080
1078
|
end
|
1081
|
-
@view_buffer <<
|
1079
|
+
@view_buffer << "\n</m:syscall>"
|
1082
1080
|
end
|
1083
1081
|
|
1084
1082
|
#Generate a click2call syscall control to a phone number
|
@@ -1096,7 +1094,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
1096
1094
|
# <m:param name="address">tel:4085551212</m:param>
|
1097
1095
|
# </m:syscall>
|
1098
1096
|
def click2call(doc, phone)
|
1099
|
-
@view_buffer << "<m:syscall name=\"click2call\" ev:event=\"DOMActivate\"
|
1097
|
+
@view_buffer << "\n<m:syscall name=\"click2call\" ev:event=\"DOMActivate\">\n\t<m:param name=\"address\">tel:#{phone}</m:param>\n</m:syscall>"
|
1100
1098
|
end
|
1101
1099
|
|
1102
1100
|
#Create Action control. Default event is "DOMActivate" if event argument is
|
@@ -1117,9 +1115,9 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
1117
1115
|
# </xf:action>
|
1118
1116
|
#
|
1119
1117
|
def action_tag(doc, event="DOMActivate")
|
1120
|
-
@view_buffer << "<xf:action ev:event=\"#{event}\">"
|
1118
|
+
@view_buffer << "\n<xf:action ev:event=\"#{event}\">"
|
1121
1119
|
yield doc
|
1122
|
-
@view_buffer <<
|
1120
|
+
@view_buffer << "\n</xf:action>"
|
1123
1121
|
end
|
1124
1122
|
#Create exit control to exit the client.
|
1125
1123
|
#==== Examples
|
@@ -1132,7 +1130,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
1132
1130
|
# <m:exit ev:event="DOMActivate"/>
|
1133
1131
|
# </m:softkey>
|
1134
1132
|
def exit_tag(doc)
|
1135
|
-
@view_buffer << "<m:exit ev:event=\"DOMActivate\"/>"
|
1133
|
+
@view_buffer << "\n<m:exit ev:event=\"DOMActivate\"/>"
|
1136
1134
|
end
|
1137
1135
|
|
1138
1136
|
#Create back control to go back to previous page.
|
@@ -1146,7 +1144,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
1146
1144
|
# <m:back ev:event="DOMActivate"/>
|
1147
1145
|
# </m:softkey>
|
1148
1146
|
def back_tag(doc)
|
1149
|
-
@view_buffer << "<m:back ev:event=\"DOMActivate\"/>"
|
1147
|
+
@view_buffer << "\n<m:back ev:event=\"DOMActivate\"/>"
|
1150
1148
|
end
|
1151
1149
|
#Create toggle control
|
1152
1150
|
#1. name: the toggle case name, default is "main" if not defined.
|
@@ -1164,7 +1162,7 @@ A rails icon and some text will be displayed on Mobio runner when you load the r
|
|
1164
1162
|
# <xf:toggle case="view" ev:event="DOMActivate"/>
|
1165
1163
|
#
|
1166
1164
|
def toggle_tag(doc, name="main")
|
1167
|
-
@view_buffer << "<xf:toggle case=\"#{name}\" ev:event=\"DOMActivate\"/>"
|
1165
|
+
@view_buffer << "\n<xf:toggle case=\"#{name}\" ev:event=\"DOMActivate\"/>"
|
1168
1166
|
end
|
1169
1167
|
|
1170
1168
|
#Override builder method_missing method to send output to model buffer so we
|