rhodes 2.1.0 → 2.2.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.textile +4 -5
- data/Rakefile +8 -1
- data/lib/build/jake.rb +22 -16
- data/lib/extensions/rhoxml/rexml/cdata.rb +67 -0
- data/lib/extensions/rhoxml/rexml/document.rb +2 -116
- data/lib/extensions/rhoxml/rexml/element.rb +1 -1
- data/lib/extensions/rhoxml/rexml/text.rb +117 -0
- data/lib/framework/rho/render.rb +19 -11
- data/lib/framework/rho/rho.rb +17 -10
- data/lib/framework/rho/rhobluetooth.rb +103 -0
- data/lib/framework/rho/rhocontroller.rb +2 -0
- data/lib/framework/rho/rhoevent.rb +43 -0
- data/lib/framework/rho/rhoevent_bb.rb +80 -0
- data/lib/framework/rho/rhoevent_c.rb +47 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -1
- data/lib/framework/rhom/rhom_model.rb +9 -3
- data/lib/framework/rhom/rhom_object_factory.rb +46 -22
- data/lib/framework/rhom/rhom_source.rb +12 -10
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +23 -2
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +54 -38
- data/platform/android/Rhodes/jni/include/rhodes.h +3 -0
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +2 -2
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +4 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +16 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_bluetooth_RhoBluetoothManager.h +21 -0
- data/platform/android/Rhodes/jni/src/bluetooth.cpp +169 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +10 -0
- data/platform/android/Rhodes/jni/src/event.cpp +429 -0
- data/platform/android/Rhodes/jni/src/fileapi.cpp +51 -1
- data/platform/android/Rhodes/jni/src/rhodes.cpp +16 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -0
- data/platform/android/Rhodes/res/layout/bt_device_list.xml +42 -0
- data/platform/android/Rhodes/res/layout/bt_device_name.xml +7 -0
- data/platform/android/Rhodes/res/values/strings.xml +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +14 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Push.java +7 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +58 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +53 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +8 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +144 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +66 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothDeviceListActivity.java +201 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +139 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +401 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +136 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +457 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/UUIDHelper.java +71 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +12 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/Event.java +19 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +261 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +10 -2
- data/platform/android/build/RhodesSRC_build.files +33 -22
- data/platform/android/build/android.rake +198 -27
- data/platform/android/build/librhodes_build.files +3 -1
- data/platform/android/build/libruby_build.files +4 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +2 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +7 -4
- data/platform/bb/Hsqldb/src/org/hsqldb/Like.java +3 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +1 -1
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +108 -1
- data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +7 -4
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +7 -1
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +21 -23
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +19 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +8 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +3 -0
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +14 -17
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFile.java +7 -5
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +2 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyRuntime.java +10 -1
- data/platform/bb/RubyVM/src/j2me/io/File.java +7 -6
- data/platform/bb/build/RubyVM_build.files +412 -412
- data/platform/bb/build/bb.rake +42 -18
- data/platform/bb/build/hsqldb_build.files +151 -151
- data/platform/bb/build/rhodes_build.files +44 -40
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +2 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +237 -0
- data/platform/bb/rhodes/platform/common/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/rhodes.jdp +6 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +7 -1
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +14 -0
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +62 -76
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +660 -0
- data/platform/bb/rhodes/src/{rhomobile → com/rho/rubyext}/RhoPhonebook.java +95 -38
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +22 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +26 -6
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +21 -7
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothManager.java +528 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothPort.java +281 -0
- data/platform/bb/rhodes/src/rhomobile/bluetooth/BluetoothScreen.java +119 -0
- data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +2 -2
- data/platform/iphone/Classes/AppManager/AppManager.m +70 -7
- data/platform/iphone/Classes/Bluetooth/Bluetooth.h +72 -0
- data/platform/iphone/Classes/Bluetooth/Bluetooth.m +414 -0
- data/platform/iphone/Classes/Event/Event.h +12 -0
- data/platform/iphone/Classes/Event/Event.m +300 -0
- data/platform/iphone/Classes/LogOptionsController.h +2 -1
- data/platform/iphone/Classes/LogOptionsController.m +1 -1
- data/platform/iphone/Classes/LogViewController.h +2 -1
- data/platform/iphone/Classes/MapView/MapViewController.h +2 -1
- data/platform/iphone/Classes/RhoViewController.h +16 -0
- data/platform/iphone/Classes/RhoViewController.m +20 -0
- data/platform/iphone/Classes/Rhodes.h +12 -0
- data/platform/iphone/Classes/Rhodes.m +34 -6
- data/platform/iphone/Classes/Signature/SignatureViewController.h +2 -2
- data/platform/iphone/Classes/Signature/SignatureViewController.m +0 -10
- data/platform/iphone/Classes/SimpleMainView.h +2 -2
- data/platform/iphone/Classes/SimpleMainView.m +5 -14
- data/platform/iphone/Classes/SplashViewController.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.h +2 -2
- data/platform/iphone/Classes/TabbedMainView.m +5 -10
- data/platform/iphone/Info.plist +5 -5
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +39 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +47 -4
- data/platform/osx/Rhodes Debugger/NoodleLineNumberView.m +3 -2
- data/platform/shared/common/AutoPointer.h +3 -0
- data/platform/shared/common/RhoConf.cpp +2 -1
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhoTime.h +3 -3
- data/platform/shared/common/RhodesApp.cpp +75 -23
- data/platform/shared/common/RhodesApp.h +4 -0
- data/platform/shared/common/RhodesAppBase.h +2 -0
- data/platform/shared/common/ThreadQueue.cpp +23 -18
- data/platform/shared/common/ThreadQueue.h +2 -0
- data/platform/shared/db/res/db/syncdb.schema +39 -39
- data/platform/shared/logging/RhoLogConf.cpp +58 -3
- data/platform/shared/logging/RhoLogConf.h +3 -1
- data/platform/shared/net/CURLNetRequest.cpp +17 -6
- data/platform/shared/net/HttpServer.cpp +125 -25
- data/platform/shared/net/HttpServer.h +4 -3
- data/platform/shared/ruby/ext/bluetooth/bluetooth.i +56 -0
- data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +2563 -0
- data/platform/shared/ruby/ext/calendar/calendar.i +28 -0
- data/platform/shared/ruby/ext/calendar/calendar_wrap.c +2251 -0
- data/platform/shared/ruby/ext/calendar/event.h +41 -0
- data/platform/shared/ruby/ext/calendar/event.i +28 -0
- data/platform/shared/ruby/ext/calendar/event_wrap.c +2151 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +103 -3
- data/platform/shared/ruby/ext/rho/rhoruby.h +16 -2
- data/platform/shared/ruby/ext/rhoconf/rhoconf.i +12 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +101 -0
- data/platform/shared/ruby/ext/system/system.i +14 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +2568 -2208
- data/platform/shared/ruby/main.c +8 -0
- data/platform/shared/rubyext/GeoLocation.cpp +6 -3
- data/platform/shared/rubyext/System.cpp +14 -0
- data/platform/shared/sync/SyncEngine.cpp +9 -1
- data/platform/shared/sync/SyncNotify.cpp +16 -8
- data/platform/shared/sync/SyncNotify.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +7 -12
- data/platform/shared/sync/SyncThread.h +5 -3
- data/platform/wm/build/wm.rake +7 -1
- data/platform/wm/rhodes/Alert.cpp +1 -1
- data/platform/wm/rhodes/MainWindow.cpp +28 -0
- data/platform/wm/rhodes/MainWindow.h +9 -0
- data/platform/wm/rhodes/OutlookApp.cpp +72 -0
- data/platform/wm/rhodes/OutlookApp.h +22 -0
- data/platform/wm/rhodes/Rhodes.cpp +8 -0
- data/platform/wm/rhodes/Rhodes.rc +31 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1274 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +321 -0
- data/platform/wm/rhodes/phonebook/NativeAddressBook.cpp +37 -70
- data/platform/wm/rhodes/phonebook/NativeAddressBook.h +0 -4
- data/platform/wm/rhodes/resource.h +8 -1
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +4 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +6 -4
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +487 -0
- data/platform/wm/rhodes/rhodes.vcproj +28 -11
- data/platform/wm/rhodes/stdafx.h +1 -0
- data/platform/wm/rubylib/rubylib.vcproj +32 -0
- data/rakefile.rb +8 -1
- data/res/generators/templates/application/Rakefile +1 -1
- data/res/generators/templates/application/app/layout.erb +4 -1
- data/res/generators/templates/application/build.yml +0 -1
- data/res/generators/templates/application/public/css/iphone.css +2 -2
- data/res/generators/templates/application/public/jqtouch/jqtouch-iphone.css +9 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.css +1 -5
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +3 -2
- data/rhodes.gemspec +1 -1
- data/spec/perfomance_spec/app/Benchmark/benchmark.rb +4 -0
- data/spec/perfomance_spec/app/Benchmark/bulk_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/controller.rb +178 -0
- data/spec/perfomance_spec/app/Benchmark/create_results.erb +13 -0
- data/spec/perfomance_spec/app/Benchmark/customers.erb +35 -0
- data/spec/perfomance_spec/app/Benchmark/index.erb +9 -0
- data/spec/perfomance_spec/app/Benchmark/products.erb +25 -0
- data/spec/perfomance_spec/app/Benchmark/search_results.erb +13 -0
- data/spec/perfomance_spec/app/Customer/customer.rb +6 -0
- data/spec/perfomance_spec/app/Perftest/index.erb +5 -0
- data/spec/perfomance_spec/app/Product/index.erb +25 -0
- data/spec/perfomance_spec/app/Product/product.rb +6 -0
- data/spec/perfomance_spec/app/helpers/application_helper.rb +126 -0
- data/spec/perfomance_spec/app/helpers/browser_helper.rb +18 -0
- data/spec/perfomance_spec/rhoconfig.txt +1 -1
- data/spec/phone_spec/app/Account_s/account_s.rb +5 -2
- data/spec/phone_spec/app/Case/case.rb +1 -0
- data/spec/phone_spec/app/Case_s/case_s.rb +2 -0
- data/spec/phone_spec/app/Data/perftest.json +35 -0
- data/spec/phone_spec/app/Data/testCDATA.xml +11 -0
- data/spec/phone_spec/app/Product/product.rb +1 -1
- data/spec/phone_spec/app/{Spec → spec}/asynchttp_spec.rb +66 -17
- data/spec/phone_spec/app/{Spec → spec}/barcode_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/blobsync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bsearch_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/bulksync_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/contacts_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/crypt_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/date_spec.rb +0 -0
- data/spec/phone_spec/app/spec/events_spec.rb +199 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/client_info.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/json_spec.rb +11 -2
- data/spec/phone_spec/app/{Spec → spec}/mapview_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/nativebar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/navbar_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/pagination/fixtures/object_values.txt +0 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_controller_spec.rb +5 -0
- data/spec/phone_spec/app/{Spec → spec}/rho_spec.rb +48 -0
- data/spec/phone_spec/app/{Spec → spec}/rhofile_spec.rb +9 -6
- data/spec/phone_spec/app/{Spec → spec}/rhom_object_spec.rb +188 -9
- data/spec/phone_spec/app/{Spec → spec}/syncengine_spec.rb +0 -0
- data/spec/phone_spec/app/{Spec → spec}/xml_spec.rb +15 -0
- data/spec/phone_spec/app/{Spec → spec}/xruby_spec.rb +0 -0
- data/spec/phone_spec/app/spec_runner.rb +4 -1
- data/spec/phone_spec/build.yml +2 -1
- metadata +95 -31
- data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +0 -36
- data/platform/bb/rhodes/platform/6.0/com/rho/BrowserAdapter5.java +0 -155
- data/platform/bb/rhodes/platform/6.0/com/rho/RhoMainScreen.java +0 -36
@@ -0,0 +1,35 @@
|
|
1
|
+
<div class="pageTitle">
|
2
|
+
<h1>Customers</h1>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="toolbar">
|
6
|
+
<div class="leftItem regularButton">
|
7
|
+
<a href="<%= Rho::RhoConfig.start_path %>">Home</a>
|
8
|
+
</div>
|
9
|
+
<div class="rightItem regularButton">
|
10
|
+
<a href="<%= url_for :action => :new %>">New</a>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="content">
|
15
|
+
<form method="POST" action="<%= url_for(:action => :search) %>">
|
16
|
+
<ul>
|
17
|
+
<li>
|
18
|
+
<label for="query" class="fieldLabel">Query</label>
|
19
|
+
<input type="text" name="query" <%= placeholder( "Query" ) %>/>
|
20
|
+
</li>
|
21
|
+
</ul>
|
22
|
+
<input type="submit" class="standardButton" value="Search"/>
|
23
|
+
</form>
|
24
|
+
<ul>
|
25
|
+
<% @customers.each do |customer| %>
|
26
|
+
|
27
|
+
<li>
|
28
|
+
<a href="<%= url_for :action => :show, :id => customer.object %>">
|
29
|
+
<%= customer.first %>
|
30
|
+
</a>
|
31
|
+
</li>
|
32
|
+
|
33
|
+
<% end %>
|
34
|
+
</ul>
|
35
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div class="pageTitle">
|
2
|
+
<h1>Products</h1>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="toolbar">
|
6
|
+
<div class="leftItem regularButton">
|
7
|
+
<a href="<%= Rho::RhoConfig.start_path %>">Home</a>
|
8
|
+
</div>
|
9
|
+
<div class="rightItem regularButton">
|
10
|
+
<a href="<%= url_for :action => :new %>">New</a>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="content">
|
15
|
+
<ul>
|
16
|
+
<% @products.each do |product| %>
|
17
|
+
<li>
|
18
|
+
<a href="<%= url_for :action => :async_show, :id => product.object, :query => {:product_id => product.object} %>">
|
19
|
+
<span class="title"><%= product.name %></span><span class="disclosure_indicator"></span>
|
20
|
+
</a>
|
21
|
+
</li>
|
22
|
+
|
23
|
+
<% end %>
|
24
|
+
</ul>
|
25
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div class="toolbar">
|
2
|
+
<h1 id="pageTitle">
|
3
|
+
Benchmark
|
4
|
+
</h1>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<%@color = "#00ff00"%>
|
8
|
+
|
9
|
+
<ul id="perftest" title="PerfomanceTests" selected="true">
|
10
|
+
<li style="color:<%=@color%>">Controller Time (ms): <%=@time%></li>
|
11
|
+
</ul>
|
12
|
+
|
13
|
+
<li><a href="/app/Product">Show products...</a></li>
|
@@ -6,6 +6,11 @@
|
|
6
6
|
|
7
7
|
<ul id="home" selected="true" title="System Tests">
|
8
8
|
<li><a href="/app/Perftest/start">Start tests...</a></li>
|
9
|
+
<li><a href="/app/Benchmark/search_test">Bench search...</a></li>
|
10
|
+
<li><a href="/app/Benchmark/create_test">Bench create...</a></li>
|
11
|
+
<li><a href="/app/Benchmark/bulk_test">Bench bulk...</a></li>
|
12
|
+
<li><a href="/app/Benchmark/asynchttp_test">Bench asynchttp...</a></li>
|
13
|
+
|
9
14
|
</ul>
|
10
15
|
|
11
16
|
<% if @test_results %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div class="pageTitle">
|
2
|
+
<h1>Products</h1>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="toolbar">
|
6
|
+
<div class="leftItem regularButton">
|
7
|
+
<a href="<%= Rho::RhoConfig.start_path %>">Home</a>
|
8
|
+
</div>
|
9
|
+
<div class="rightItem regularButton">
|
10
|
+
<a href="<%= url_for :action => :new %>">New</a>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="content">
|
15
|
+
<ul>
|
16
|
+
<% $products.each do |product| %>
|
17
|
+
<li>
|
18
|
+
<a href="<%= url_for :action => :async_show, :id => product.object, :query => {:product_id => product.object} %>">
|
19
|
+
<span class="title"><%= product.name %></span><span class="disclosure_indicator"></span>
|
20
|
+
</a>
|
21
|
+
</li>
|
22
|
+
|
23
|
+
<% end %>
|
24
|
+
</ul>
|
25
|
+
</div>
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module ApplicationHelper
|
4
|
+
def strip_braces(str=nil)
|
5
|
+
str ? str.gsub(/\{/, "").gsub(/\}/, "") : nil
|
6
|
+
end
|
7
|
+
|
8
|
+
def strike_if(str, condition=true)
|
9
|
+
condition ? "<s>#{str}</s>" : str
|
10
|
+
end
|
11
|
+
|
12
|
+
def display_blanks(value)
|
13
|
+
if blank?(value)
|
14
|
+
"---"
|
15
|
+
else
|
16
|
+
value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def blank?(value)
|
21
|
+
value.nil? || value == "" || value.length==0
|
22
|
+
end
|
23
|
+
|
24
|
+
def display_blankstr(value)
|
25
|
+
if blank?(value)
|
26
|
+
" "
|
27
|
+
else
|
28
|
+
value
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def display_newline()
|
33
|
+
"<br>"
|
34
|
+
end
|
35
|
+
|
36
|
+
def display_space()
|
37
|
+
" "
|
38
|
+
end
|
39
|
+
|
40
|
+
def display_dollars(value)
|
41
|
+
if blank?(value)
|
42
|
+
" "
|
43
|
+
else
|
44
|
+
number = "$" + sprintf("%.2f", value)
|
45
|
+
|
46
|
+
# use a commify algorithm -- http://snippets.dzone.com/tag/commify
|
47
|
+
number.reverse!
|
48
|
+
number.gsub!(/(\d\d\d)(?=\d)(?!\d*\.)/, '\1,')
|
49
|
+
number.reverse!
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def display_number(value)
|
54
|
+
if blank?(value)
|
55
|
+
" "
|
56
|
+
else
|
57
|
+
sprintf("%.2f", value)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def both_items_present?(value1, value2)
|
62
|
+
!blank?(value1) && !blank?(value2)
|
63
|
+
end
|
64
|
+
|
65
|
+
def replace_newlines(value)
|
66
|
+
if blank?(value)
|
67
|
+
" "
|
68
|
+
else
|
69
|
+
value.gsub('\n', ' ')
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def format_address_for_mapping(street, city, state, zip, tagforurl)
|
74
|
+
# handle case where fields could be nil
|
75
|
+
mystreet = !street.nil? ? street : ""
|
76
|
+
mycity = !city.nil? ? city : ""
|
77
|
+
mystate = !state.nil? ? state : ""
|
78
|
+
myzip = !zip.nil? ? zip : ""
|
79
|
+
|
80
|
+
result = ""
|
81
|
+
if !tagforurl
|
82
|
+
# build up address string
|
83
|
+
result += (mystreet + ", ") if mystreet.length > 0
|
84
|
+
result += (mycity + ", ") if mycity.length > 0
|
85
|
+
result += (mystate + " ") if mystate.length > 0
|
86
|
+
result += myzip if myzip.length > 0
|
87
|
+
else
|
88
|
+
# need to URL encode data too
|
89
|
+
result += ("&street=" + Rho::RhoSupport.url_encode(mystreet)) if mystreet.length > 0
|
90
|
+
result += ("&city=" + Rho::RhoSupport.url_encode(mycity)) if mycity.length > 0
|
91
|
+
result += ("&state=" + Rho::RhoSupport.url_encode(mystate)) if mystate.length > 0
|
92
|
+
result += ("&zip=" + Rho::RhoSupport.url_encode(myzip)) if myzip.length > 0
|
93
|
+
end
|
94
|
+
# remove any extraneous characters that could interfere with proper address matching
|
95
|
+
result = replace_newlines(result)
|
96
|
+
end
|
97
|
+
|
98
|
+
def has_valid_mapping_address(street, city, state, zip)
|
99
|
+
# at a minimum, an address must have a state or a zip
|
100
|
+
(!state.nil? && state.length > 0) || (!zip.nil? && zip.length > 0)
|
101
|
+
end
|
102
|
+
|
103
|
+
def format_latlon_for_mapping(latitude, longitude)
|
104
|
+
result = ""
|
105
|
+
result += ("&latitude=" + Rho::RhoSupport.url_encode(latitude)) if latitude.length > 0
|
106
|
+
result += ("&longitude=" + Rho::RhoSupport.url_encode(longitude)) if longitude.length > 0
|
107
|
+
result
|
108
|
+
end
|
109
|
+
|
110
|
+
def render_transition(params)
|
111
|
+
@params["rho_callback"] = nil
|
112
|
+
params[:layout] = false
|
113
|
+
# TODO: escape carriage returns instead of removing them altoegether
|
114
|
+
content = render(params).split('\'').join('\\\'').split(/[\r\n]/).join('')
|
115
|
+
WebView.execute_js("Rho.insertAsyncPage('<div>#{content}</div>')")
|
116
|
+
end
|
117
|
+
|
118
|
+
def caller_request_hash_to_query
|
119
|
+
'caller_request=' + Rho::RhoSupport.url_encode(::JSON.generate(@request))
|
120
|
+
end
|
121
|
+
|
122
|
+
def caller_request_query_to_hash
|
123
|
+
@caller_request = Rho::JSON.parse(@params['caller_request']) if @params['caller_request']
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module BrowserHelper
|
2
|
+
|
3
|
+
def placeholder(label=nil)
|
4
|
+
"placeholder='#{label}'" if platform == 'apple'
|
5
|
+
end
|
6
|
+
|
7
|
+
def platform
|
8
|
+
System::get_property('platform').downcase
|
9
|
+
end
|
10
|
+
|
11
|
+
def selected(option_value,object_value)
|
12
|
+
"selected=\"yes\"" if option_value == object_value
|
13
|
+
end
|
14
|
+
|
15
|
+
def checked(option_value,object_value)
|
16
|
+
"checked=\"yes\"" if option_value == object_value
|
17
|
+
end
|
18
|
+
end
|
@@ -2,7 +2,7 @@ class Account_s
|
|
2
2
|
include Rhom::FixedSchema
|
3
3
|
|
4
4
|
set :schema_version, '1.0'
|
5
|
-
|
5
|
+
|
6
6
|
property :billing_address_country, :string
|
7
7
|
property :assigned_user_id, :string
|
8
8
|
property :website, :string
|
@@ -46,5 +46,8 @@ class Account_s
|
|
46
46
|
property :last_checked, :string
|
47
47
|
property :acct_object, :string
|
48
48
|
|
49
|
-
|
49
|
+
property :address, :string
|
50
|
+
|
51
|
+
property :propOne, :string
|
52
|
+
property :TwoProps, :string
|
50
53
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
[{"employee":
|
2
|
+
{"emp_number":"2","created_at":"2010-08-22T04:42:32Z","updated_at":"2010-08-22T08:24:39Z","id":
|
3
|
+
2,"last_name":"CA","first_name":"AC"}},{"employee":
|
4
|
+
{"emp_number":"1","created_at":"2010-08-22T04:42:17Z","updated_at":"2010-08-22T14:45:33Z","id":
|
5
|
+
1,"last_name":"K","first_name":"D"}},{"employee":
|
6
|
+
{"emp_number":"3","created_at":"2010-08-22T08:47:13Z","updated_at":"2010-08-22T15:03:15Z","id":
|
7
|
+
3,"last_name":"P","first_name":"M"}},{"employee":
|
8
|
+
{"emp_number":"35076","created_at":"2010-08-27T06:15:09Z","updated_at":"2010-08-27T06:15:09Z","id":
|
9
|
+
4,"last_name":"M P","first_name":"Balllaji"}},{"employee":
|
10
|
+
{"emp_number":"2355","created_at":"2010-08-29T07:05:52Z","updated_at":"2010-08-29T07:05:52Z","id":
|
11
|
+
5,"last_name":"Malhotdas","first_name":"Mansssish"}},{"employee":
|
12
|
+
{"emp_number":"2356","created_at":"2010-08-29T07:06:14Z","updated_at":"2010-08-29T07:06:14Z","id":
|
13
|
+
6,"last_name":"Thakssa","first_name":"Sassschin"}},{"employee":
|
14
|
+
{"emp_number":"2358","created_at":"2010-08-29T07:06:42Z","updated_at":"2010-08-29T07:06:42Z","id":
|
15
|
+
7,"last_name":"Kumar","first_name":"Mansdks"}},{"employee":
|
16
|
+
{"emp_number":"22359","created_at":"2010-08-29T07:06:55Z","updated_at":"2010-08-29T07:06:55Z","id":
|
17
|
+
8,"last_name":"Tandss","first_name":"Vissy"}},{"employee":
|
18
|
+
{"emp_number":"2361","created_at":"2010-08-29T07:07:47Z","updated_at":"2010-08-29T07:07:47Z","id":
|
19
|
+
9,"last_name":"Para","first_name":"Praja"}},{"employee":
|
20
|
+
{"emp_number":"2362","created_at":"2010-08-29T07:08:02Z","updated_at":"2010-08-29T07:08:02Z","id":
|
21
|
+
10,"last_name":"Jath","first_name":"Progra"}},{"employee":
|
22
|
+
{"emp_number":"2370","screated_at":"2010-08-29T07:08:18Z","updated_at":"2010-08-29T07:08:18Z","id":
|
23
|
+
11,"last_name":"Patans","first_name":"Maoshh"}},{"employee":
|
24
|
+
{"emp_number":"2363","created_at":"2010-08-29T07:08:46Z","updated_at":"2010-08-29T07:08:46Z","id":
|
25
|
+
12,"last_name":"Dekhane","first_name":"Sachin"}},{"employee":
|
26
|
+
{"emp_number":"2364","created_at":"2010-08-29T07:09:06Z","updated_at":"2010-08-29T07:09:06Z","id":
|
27
|
+
13,"last_name":"Joshaai","first_name":"Advsss"}},{"employee":
|
28
|
+
{"emp_number":"2365","created_at":"2010-08-29T07:09:25Z","updated_at":"2010-08-29T07:09:25Z","id":
|
29
|
+
14,"last_name":"Kel","first_name":"Sands"}},{"employee":
|
30
|
+
{"emp_number":"2366","created_at":"2010-08-29T07:09:44Z","updated_at":"2010-08-29T07:09:44Z","id":
|
31
|
+
15,"last_name":"ddd","first_name":"Nitsessn"}},{"employee":
|
32
|
+
{"emp_number":"2367","created_at":"2010-08-29T07:10:00Z","updated_at":"2010-08-29T07:10:00Z","id":
|
33
|
+
16,"last_name":"Khadasasaikar","first_name":"Rassj"}},{"employee":
|
34
|
+
{"emp_number":"2368","created_at":"2010-08-29T07:10:17Z","updated_at":"2010-08-29T07:10:17Z","id":
|
35
|
+
17,"last_name":"Tadesss","first_name":"Rssaaj"}}]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<persons>
|
3
|
+
<person>
|
4
|
+
<firstname>Sample</firstname>
|
5
|
+
<lastname>Sample</lastname>
|
6
|
+
</person>
|
7
|
+
<person>
|
8
|
+
<firstname><![CDATA[Sample bold <b</b>Tag]]></firstname>
|
9
|
+
<lastname>Sample</lastname>
|
10
|
+
</person>
|
11
|
+
</persons>
|
@@ -5,8 +5,11 @@ describe "AsyncHttp" do
|
|
5
5
|
after(:all) do
|
6
6
|
file_name = File.join(Rho::RhoApplication::get_base_app_path(), 'test.jpg')
|
7
7
|
File.delete(file_name) if File.exists?(file_name)
|
8
|
-
end
|
9
8
|
|
9
|
+
file_name = File.join(Rho::RhoApplication::get_app_path('DataTemp'), 'test_log.txt')
|
10
|
+
File.delete(file_name) if File.exists?(file_name)
|
11
|
+
end
|
12
|
+
|
10
13
|
it "should http get" do
|
11
14
|
return unless $is_network_available
|
12
15
|
|
@@ -34,7 +37,7 @@ describe "AsyncHttp" do
|
|
34
37
|
|
35
38
|
#TODO: post_test
|
36
39
|
end
|
37
|
-
|
40
|
+
|
38
41
|
it "should http download" do
|
39
42
|
return unless $is_network_available
|
40
43
|
|
@@ -52,7 +55,32 @@ describe "AsyncHttp" do
|
|
52
55
|
res['headers']['content-type'].should == 'image/jpeg'
|
53
56
|
|
54
57
|
File.exists?(file_name).should == true
|
55
|
-
File.size(file_name)
|
58
|
+
orig_len = File.size(file_name)
|
59
|
+
orig_len.should == res['headers']['content-length'].to_i
|
60
|
+
|
61
|
+
#check that in case of one more download, files keeps the same
|
62
|
+
res = Rho::AsyncHttp.download_file(
|
63
|
+
:url => 'http://rhomobile.com/wp-content/themes/rhomobile/img/imgs_21.jpg',
|
64
|
+
:filename => file_name )
|
65
|
+
#puts "res : #{res}"
|
66
|
+
|
67
|
+
res['status'].should == 'ok'
|
68
|
+
res['headers']['content-length'].to_i.should == 0
|
69
|
+
#res['headers']['content-type'].should == 'image/jpeg'
|
70
|
+
|
71
|
+
File.exists?(file_name).should == true
|
72
|
+
File.size(file_name).should == orig_len
|
73
|
+
|
74
|
+
#check that in case of network error, files keeps the same
|
75
|
+
res = Rho::AsyncHttp.download_file(
|
76
|
+
:url => 'http://rhomobile.com/wp-content/themes/rhomobile/img/imgs_21__BAD.jpg',
|
77
|
+
:filename => file_name )
|
78
|
+
#puts "res : #{res}"
|
79
|
+
res['status'].should == 'error'
|
80
|
+
res['http_error'].should == '404'
|
81
|
+
|
82
|
+
File.exists?(file_name).should == true
|
83
|
+
File.size(file_name).should == orig_len
|
56
84
|
end
|
57
85
|
|
58
86
|
it "should http upload" do
|
@@ -60,7 +88,7 @@ describe "AsyncHttp" do
|
|
60
88
|
|
61
89
|
server = 'http://rhologs.heroku.com'
|
62
90
|
|
63
|
-
file_name = File.join(Rho::RhoApplication::get_app_path('
|
91
|
+
file_name = File.join(Rho::RhoApplication::get_app_path('DataTemp'), 'test_log.txt')
|
64
92
|
File.exists?(file_name).should == true
|
65
93
|
|
66
94
|
res = Rho::AsyncHttp.upload_file(
|
@@ -76,9 +104,12 @@ describe "AsyncHttp" do
|
|
76
104
|
return unless $is_network_available
|
77
105
|
|
78
106
|
server = 'http://rhologs.heroku.com'
|
107
|
+
dir_name = Rho::RhoApplication::get_app_path('DataTemp')
|
108
|
+
Dir.mkdir(dir_name) unless Dir.exists?(dir_name)
|
79
109
|
|
80
|
-
file_name = File.join(
|
81
|
-
|
110
|
+
file_name = File.join(dir_name, 'test_log.txt')
|
111
|
+
puts " file_name : #{file_name}"
|
112
|
+
File.open(file_name, "w"){|f| puts "OK"; f.write("******************THIS IS TEST! REMOVE THIS FILE! *******************")}
|
82
113
|
|
83
114
|
res = Rho::AsyncHttp.upload_file(
|
84
115
|
:url => server + "/client_log?client_id=&device_pin=&log_name=uptest",
|
@@ -94,18 +125,36 @@ describe "AsyncHttp" do
|
|
94
125
|
it "should decode chunked body" do
|
95
126
|
return unless $is_network_available
|
96
127
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
res['body'].should == "1234567890"
|
105
|
-
end
|
128
|
+
host = SPEC_LOCAL_SERVER_HOST
|
129
|
+
port = SPEC_LOCAL_SERVER_PORT
|
130
|
+
puts "+++++++++++++++++++ chunked test: #{host}:#{port}"
|
131
|
+
res = Rho::AsyncHttp.get :url => "http://#{host}:#{port}/chunked"
|
132
|
+
res['status'].should == 'ok'
|
133
|
+
res['body'].should_not be_nil
|
134
|
+
res['body'].should == "1234567890"
|
106
135
|
end
|
107
136
|
|
108
|
-
|
137
|
+
it "should send custom command" do
|
138
|
+
return unless $is_network_available
|
139
|
+
|
140
|
+
res = Rho::AsyncHttp.get(
|
141
|
+
:url => 'http://www.apache.org/licenses/LICENSE-2.0',
|
142
|
+
:http_command => 'PUT' )
|
143
|
+
|
144
|
+
#puts "res : #{res}"
|
145
|
+
res['http_error'].should == '405'
|
146
|
+
res['body'].index('The requested method PUT is not allowed for the URL').should_not be_nil
|
147
|
+
|
148
|
+
res = Rho::AsyncHttp.post(
|
149
|
+
:url => 'http://www.apache.org/licenses/LICENSE-2.0',
|
150
|
+
:http_command => 'PUT' )
|
151
|
+
|
152
|
+
#puts "res : #{res}"
|
153
|
+
res['http_error'].should == '405'
|
154
|
+
res['body'].index('The requested method PUT is not allowed for the URL').should_not be_nil
|
155
|
+
|
156
|
+
end
|
157
|
+
|
109
158
|
def upload_withbody_test
|
110
159
|
return unless $is_network_available
|
111
160
|
|
@@ -159,7 +208,7 @@ describe "AsyncHttp" do
|
|
159
208
|
res['status'].should == 'ok'
|
160
209
|
File.exists?(file_name).should == true
|
161
210
|
end
|
162
|
-
|
211
|
+
|
163
212
|
# TODO: Fix this test!
|
164
213
|
=begin
|
165
214
|
def httpsget_test
|