rhodes 3.3.3.beta.3 → 3.3.3.beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/Manifest.txt +16 -1
  2. data/Rakefile +77 -28
  3. data/doc/build.txt +5 -3
  4. data/doc/configuration.txt +13 -0
  5. data/doc/device-caps.txt +46 -27
  6. data/doc/rhom.txt +2 -2
  7. data/doc/test-log-debug.txt +6 -0
  8. data/doc/ui.txt +13 -0
  9. data/lib/build/jake.rb +11 -11
  10. data/lib/extensions/crypt/crypt/cbc.rb +5 -2
  11. data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +14 -4
  12. data/lib/framework/rho/render.rb +17 -4
  13. data/lib/framework/rho/rho.rb +1 -1
  14. data/lib/framework/rho/rhocontroller.rb +11 -1
  15. data/lib/framework/rhomotoapi.rb +110 -0
  16. data/platform/android/Rhodes/jni/Android.mk +2 -5
  17. data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
  18. data/platform/android/Rhodes/jni/include/rhodes/fileapi.h +38 -0
  19. data/platform/android/Rhodes/jni/src/callbacks.cpp +7 -26
  20. data/platform/android/Rhodes/jni/src/extmanager.cpp +4 -1
  21. data/platform/android/Rhodes/jni/src/fileapi.cpp +38 -14
  22. data/platform/android/Rhodes/jni/src/mapview.cpp +1 -2
  23. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +10 -0
  24. data/platform/android/Rhodes/jni/src/rhodessystem.cpp +1 -1
  25. data/platform/android/Rhodes/jni/src/signature.cpp +1 -4
  26. data/platform/android/Rhodes/rhobundle.xml +1 -1
  27. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +11 -1
  28. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +4 -3
  29. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -6
  30. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +3 -1
  31. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +70 -0
  32. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +3 -1
  33. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +21 -7
  34. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +19 -10
  35. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +8 -5
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManager.java +18 -0
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +168 -31
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +46 -9
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +3 -2
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +27 -53
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +27 -3
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/Utils.java +13 -14
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +12 -5
  44. data/platform/android/build/RhodesSRC_build.files +2 -1
  45. data/platform/android/build/android.rake +48 -17
  46. data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +1 -1
  47. data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +24 -3
  48. data/platform/iphone/Classes/AppManager/AppManager.m +1 -1
  49. data/platform/iphone/Classes/Camera/PickImageDelegate.m +27 -2
  50. data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
  51. data/platform/iphone/Classes/DateTimePickerDelegate.m +85 -9
  52. data/platform/iphone/Classes/DateTimePickerViewController.h +21 -0
  53. data/platform/iphone/Classes/DateTimePickerViewController.m +75 -0
  54. data/platform/iphone/Classes/GeoLocation/LocationController.h +6 -2
  55. data/platform/iphone/Classes/GeoLocation/LocationController.m +54 -14
  56. data/platform/iphone/Classes/RhoMainView.h +2 -0
  57. data/platform/iphone/Classes/Rhodes.m +11 -5
  58. data/platform/iphone/Classes/Signature/SignatureDelegate.m +13 -12
  59. data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -1
  60. data/platform/iphone/Classes/SimpleMainView.m +3 -0
  61. data/platform/iphone/Classes/SplitView/SplittedMainView.m +3 -0
  62. data/platform/iphone/Classes/TabbedMainView.m +30 -11
  63. data/platform/iphone/rbuild/iphone.rake +7 -1
  64. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +6 -0
  65. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
  66. data/platform/shared/common/BundleManager.cpp +42 -2
  67. data/platform/shared/common/ExtManager.h +7 -0
  68. data/platform/shared/common/RhoFile.cpp +170 -2
  69. data/platform/shared/common/RhoFile.h +4 -0
  70. data/platform/shared/common/RhodesApp.cpp +30 -0
  71. data/platform/shared/common/RhodesApp.h +1 -0
  72. data/platform/shared/common/map/OSMMapEngine.cpp +11 -3
  73. data/platform/shared/common/map/OSMMapEngine.h +3 -0
  74. data/platform/shared/logging/RhoLogConf.cpp +8 -9
  75. data/platform/shared/logging/RhoLogConf.h +5 -7
  76. data/platform/shared/logging/RhoLogSink.cpp +3 -3
  77. data/platform/shared/logging/RhoLogSink.h +1 -1
  78. data/platform/shared/net/HttpServer.cpp +17 -9
  79. data/platform/shared/qt/rhodes/main.cpp +1 -1
  80. data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
  81. data/platform/shared/ruby/ext/webview/webview.i +9 -4
  82. data/platform/shared/ruby/ext/webview/webview_wrap.c +2 -2
  83. data/platform/shared/test/Tests.cpp +2 -2
  84. data/platform/wm/build/build_inf.js +75 -47
  85. data/platform/wm/build/wm.rake +50 -53
  86. data/platform/wm/rhodes/Rhodes.cpp +40 -97
  87. data/platform/wm/rhodes/rho/common/ExtManager.cpp +23 -1
  88. data/platform/wm/rhodes/rho/rubyext/WebView.cpp +9 -0
  89. data/platform/wm/tools/detool/detool.cpp +103 -52
  90. data/platform/wp7/RhoRubyExtGen/RhoDateTimePicker.cs +60 -0
  91. data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +1 -0
  92. data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +4 -4
  93. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +15 -1
  94. data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +12 -2
  95. data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +2 -0
  96. data/platform/wp7/RhoRubyLib/common/RhoFile.cs +3 -3
  97. data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +2 -2
  98. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +39 -24
  99. data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +8 -1
  100. data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +3 -3
  101. data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +1 -1
  102. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +22 -15
  103. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
  104. data/platform/wp7/RhoRubyLib/rubyext/RhoDateTimePicker.cs +237 -0
  105. data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +5 -5
  106. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml +37 -0
  107. data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml.cs +59 -0
  108. data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +34 -41
  109. data/platform/wp7/rhodes/App.xaml.cs +1 -0
  110. data/platform/wp7/rhodes/Properties/WMAppManifest.xml +18 -18
  111. data/platform/wp7/rhodes/Rhodes.csproj +5 -1
  112. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Cancel.png +0 -0
  113. data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Check.png +0 -0
  114. data/rakefile.rb +77 -28
  115. data/res/build-tools/Microsoft.Phone.Controls.Toolkit.dll +0 -0
  116. data/res/build-tools/YUICompressorLicense.txt +54 -0
  117. data/res/build-tools/detool.exe +0 -0
  118. data/res/build-tools/yuicompressor-2.4.7.jar +0 -0
  119. data/res/generators/templates/application/app/layout.erb +1 -0
  120. data/res/generators/templates/application/public/js/jquery-wp7-patch.js +8 -2
  121. data/res/generators/templates/application/public/js/syncengine.js +147 -0
  122. data/spec/phone_spec/app/Data/septest.json +1 -1
  123. data/spec/phone_spec/app/spec/asynchttp_spec.rb +11 -10
  124. data/spec/phone_spec/app/spec/blobsync_spec.rb +9 -34
  125. data/spec/phone_spec/app/spec/date_spec.rb +6 -6
  126. data/spec/phone_spec/app/spec/rho_spec.rb +1 -6
  127. data/spec/phone_spec/app/spec/rhofile_spec.rb +13 -7
  128. data/spec/phone_spec/app/spec/rhom_object_spec.rb +4 -3
  129. data/spec/phone_spec/app/spec/syncengine_spec.rb +12 -14
  130. data/spec/phone_spec/app/spec_runner.rb +9 -10
  131. data/version +1 -1
  132. metadata +20 -5
  133. data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +0 -15
@@ -0,0 +1,60 @@
1
+ /*------------------------------------------------------------------------
2
+ * (The MIT License)
3
+ *
4
+ * Copyright (c) 2008-2011 Rhomobile, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in
14
+ * all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ * THE SOFTWARE.
23
+ *
24
+ * http://rhomobile.com
25
+ *------------------------------------------------------------------------*/
26
+
27
+ using Microsoft.Scripting.Utils;
28
+ using Microsoft.Scripting.Runtime;
29
+ using IronRuby.Runtime;
30
+ using IronRuby.Builtins;
31
+ using System;
32
+ using System.Runtime.InteropServices;
33
+
34
+ namespace rho.rubyext
35
+ {
36
+ [RubyModule("DateTimePicker")]
37
+ public static class RhoDateTimePicker
38
+ {
39
+
40
+ #region Private Implementation Details
41
+
42
+ #endregion
43
+
44
+ #region Private Instance & Singleton Methods
45
+
46
+
47
+ [RubyMethodAttribute("choose", RubyMethodAttributes.PublicSingleton)]
48
+ public static void choose(RubyModule/*!*/ self, params object[] args)
49
+ {
50
+ }
51
+
52
+ [RubyMethodAttribute("choose_with_range", RubyMethodAttributes.PublicSingleton)]
53
+ public static void choose_with_range(RubyModule/*!*/ self, params object[] args)
54
+ {
55
+ }
56
+
57
+ #endregion
58
+
59
+ }
60
+ }
@@ -57,6 +57,7 @@
57
57
  <Compile Include="RhoAsyncHttp.cs" />
58
58
  <Compile Include="RhoCamera.cs" />
59
59
  <Compile Include="RhoConfig.cs" />
60
+ <Compile Include="RhoDateTimePicker.cs" />
60
61
  <Compile Include="RhoJSON.cs" />
61
62
  <Compile Include="RhoNativeBar.cs" />
62
63
  <Compile Include="RhoSyncEngine.cs" />
@@ -43,22 +43,22 @@ namespace rho.rubyext
43
43
  #region Private Instance & Singleton Methods
44
44
 
45
45
  [RubyMethodAttribute("navigate", RubyMethodAttributes.PublicSingleton)]
46
- public static void Navigate(RubyModule/*!*/ self, [NotNull]String/*!*/ url, int index = 0)
46
+ public static void Navigate(RubyModule/*!*/ self, [NotNull]String/*!*/ url, int index = -1)
47
47
  {
48
48
  }
49
49
 
50
50
  [RubyMethodAttribute("refresh", RubyMethodAttributes.PublicSingleton)]
51
- public static void Refresh(RubyModule/*!*/ self, int index = 0)
51
+ public static void Refresh(RubyModule/*!*/ self, int index = -1)
52
52
  {
53
53
  }
54
54
 
55
55
  [RubyMethodAttribute("execute_js", RubyMethodAttributes.PublicSingleton)]
56
- public static void execute_js(RubyModule/*!*/ self, [NotNull]String/*!*/ strScript, int index = 0, RubyArray vals = null)
56
+ public static void execute_js(RubyModule/*!*/ self, [NotNull]String/*!*/ strScript, int index = -1, RubyArray vals = null)
57
57
  {
58
58
  }
59
59
 
60
60
  [RubyMethodAttribute("current_location", RubyMethodAttributes.PublicSingleton)]
61
- public static String currentLocation(RubyModule/*!*/ self)
61
+ public static String currentLocation(RubyModule/*!*/ self, int index = -1)
62
62
  {
63
63
  return null;
64
64
  }
@@ -28,6 +28,7 @@ namespace rho.rubyext {
28
28
 
29
29
  DefineGlobalModule("Alert", typeof(rho.rubyext.RhoAlert), 0x00000008, null, LoadAlert_Class, null, IronRuby.Builtins.RubyModule.EmptyArray);
30
30
  DefineGlobalModule("Camera", typeof(rho.rubyext.RhoCamera), 0x00000008, null, LoadCamera_Class, null, IronRuby.Builtins.RubyModule.EmptyArray);
31
+ DefineGlobalModule("DateTimePicker", typeof(rho.rubyext.RhoDateTimePicker), 0x00000008, null, LoadDateTimePicker_Class, null, IronRuby.Builtins.RubyModule.EmptyArray);
31
32
  DefineGlobalModule("NativeBar", typeof(rho.rubyext.RhoNativeBar), 0x00000008, null, LoadNativeBar_Class, null, IronRuby.Builtins.RubyModule.EmptyArray);
32
33
  IronRuby.Builtins.RubyModule def3 = DefineGlobalModule("Rho", typeof(rho.rubyext.RhoRoot), 0x00000008, null, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
33
34
  IronRuby.Builtins.RubyModule def1 = DefineGlobalModule("Rho", typeof(rho.rubyext.Rho), 0x00000008, null, null, null, IronRuby.Builtins.RubyModule.EmptyArray);
@@ -87,6 +88,19 @@ namespace rho.rubyext {
87
88
 
88
89
  }
89
90
 
91
+ private static void LoadDateTimePicker_Class(IronRuby.Builtins.RubyModule/*!*/ module) {
92
+ DefineLibraryMethod(module, "choose", 0x21,
93
+ 0x80000000U,
94
+ new Action<IronRuby.Builtins.RubyModule, System.Object[]>(rho.rubyext.RhoDateTimePicker.choose)
95
+ );
96
+
97
+ DefineLibraryMethod(module, "choose_with_range", 0x21,
98
+ 0x80000000U,
99
+ new Action<IronRuby.Builtins.RubyModule, System.Object[]>(rho.rubyext.RhoDateTimePicker.choose_with_range)
100
+ );
101
+
102
+ }
103
+
90
104
  private static void LoadNativeBar_Class(IronRuby.Builtins.RubyModule/*!*/ module) {
91
105
  DefineLibraryMethod(module, "create", 0x21,
92
106
  0x00000000U,
@@ -462,7 +476,7 @@ namespace rho.rubyext {
462
476
  private static void LoadWebView_Class(IronRuby.Builtins.RubyModule/*!*/ module) {
463
477
  DefineLibraryMethod(module, "current_location", 0x21,
464
478
  0x00000000U,
465
- new Func<IronRuby.Builtins.RubyModule, System.String>(rho.rubyext.RhoWebView.currentLocation)
479
+ new Func<IronRuby.Builtins.RubyModule, System.Int32, System.String>(rho.rubyext.RhoWebView.currentLocation)
466
480
  );
467
481
 
468
482
  DefineLibraryMethod(module, "execute_js", 0x21,
@@ -46,7 +46,7 @@
46
46
  </PropertyGroup>
47
47
  <ItemGroup>
48
48
  <Reference Include="Coding4Fun.Phone.Controls">
49
- <HintPath>..\..\..\res\build-tools\Coding4Fun.Phone.Controls.dll</HintPath>
49
+ <HintPath>..\..\..\res\build-tools\Coding4Fun.Phone.Controls.dll</HintPath>
50
50
  </Reference>
51
51
  <Reference Include="IronRuby">
52
52
  <HintPath>..\ironruby\bin\Silverlight3$(Configuration)\IronRuby.dll</HintPath>
@@ -56,6 +56,9 @@
56
56
  </Reference>
57
57
  <Reference Include="Microsoft.Phone" />
58
58
  <Reference Include="Microsoft.Phone.Controls, Version=7.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e, processorArchitecture=MSIL" />
59
+ <Reference Include="Microsoft.Phone.Controls.Toolkit">
60
+ <HintPath>..\..\..\res\build-tools\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
61
+ </Reference>
59
62
  <Reference Include="Microsoft.Phone.Interop" />
60
63
  <Reference Include="Microsoft.Scripting">
61
64
  <HintPath>..\ironruby\bin\Silverlight3$(Configuration)\Microsoft.Scripting.dll</HintPath>
@@ -127,6 +130,7 @@
127
130
  <Compile Include="rubyext\RhoConfig.cs" />
128
131
  <Compile Include="rubyext\RhoDatabase.cs" />
129
132
  <Compile Include="RhoRuby.cs" />
133
+ <Compile Include="rubyext\RhoDateTimePicker.cs" />
130
134
  <Compile Include="rubyext\RhoJSON.cs" />
131
135
  <Compile Include="rubyext\RhoKernelOps.cs" />
132
136
  <Compile Include="rubyext\RhoNativeBar.cs" />
@@ -148,6 +152,9 @@
148
152
  <Compile Include="sync\SyncThread.cs">
149
153
  <SubType>Code</SubType>
150
154
  </Compile>
155
+ <Compile Include="views\RhoDateTimeDlg.xaml.cs">
156
+ <DependentUpon>RhoDateTimeDlg.xaml</DependentUpon>
157
+ </Compile>
151
158
  <Compile Include="views\RhoTabHeader.xaml.cs">
152
159
  <DependentUpon>RhoTabHeader.xaml</DependentUpon>
153
160
  </Compile>
@@ -163,6 +170,10 @@
163
170
  </ProjectReference>
164
171
  </ItemGroup>
165
172
  <ItemGroup>
173
+ <Page Include="views\RhoDateTimeDlg.xaml">
174
+ <SubType>Designer</SubType>
175
+ <Generator>MSBuild:Compile</Generator>
176
+ </Page>
166
177
  <Page Include="views\RhoTabHeader.xaml">
167
178
  <SubType>Designer</SubType>
168
179
  <Generator>MSBuild:Compile</Generator>
@@ -172,7 +183,6 @@
172
183
  <SubType>Designer</SubType>
173
184
  </Page>
174
185
  </ItemGroup>
175
- <ItemGroup />
176
186
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
177
187
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
178
188
  <ProjectExtensions />
@@ -38,6 +38,7 @@ namespace rho
38
38
  {
39
39
  public override bool FileExists(string path)
40
40
  {
41
+ if (path == "") return false;
41
42
  return CRhoFile.isResourceFileExist(path) || CRhoFile.isFileExist(path);
42
43
  }
43
44
 
@@ -58,6 +59,7 @@ namespace rho
58
59
 
59
60
  public override bool DirectoryExists(string path)
60
61
  {
62
+ if (path == "") return false;
61
63
  return CRhoFile.isDirectoryExist(path);
62
64
  }
63
65
 
@@ -68,10 +68,10 @@ namespace rho.common
68
68
  szFilePath = CFilePath.removeFirstSlash(szFilePath);
69
69
  if (eMode == EOpenModes.OpenForAppend || eMode == EOpenModes.OpenForReadWrite)
70
70
  {
71
- if (!isFileExist(szFilePath))
72
- {
71
+ //if (!isFileExist(szFilePath))
72
+ //{
73
73
  m_st = isoStore.OpenFile(szFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
74
- }
74
+ //}
75
75
 
76
76
  if (eMode == EOpenModes.OpenForAppend)
77
77
  movePosToEnd();
@@ -83,8 +83,8 @@ namespace rho.common
83
83
 
84
84
  public static String removeLastSlash(String path)
85
85
  {
86
- if (path.EndsWith("/") || path.EndsWith("\\") )
87
- return path.Substring(1);
86
+ if (path.EndsWith("/") || path.EndsWith("\\"))
87
+ return path.Substring(1, path.length() - 2);
88
88
 
89
89
  return path;
90
90
  }
@@ -72,6 +72,7 @@ namespace rho.common
72
72
  private String m_strAppBackUrl;
73
73
  private RhoView m_rhoView;
74
74
  private RhoView m_masterView = null;
75
+ public bool m_transition = false;
75
76
  ManualResetEvent m_UIWaitEvent = new ManualResetEvent(false);
76
77
  Vector<Object> m_arCallbackObjects = new Vector<Object>();
77
78
 
@@ -89,6 +90,7 @@ namespace rho.common
89
90
 
90
91
  private void Pivot_OnChanged(object sender, RoutedEventArgs e)
91
92
  {
93
+ m_currentTabIndex = m_tabControl.SelectedIndex;
92
94
  ((RhoView)(((PivotItem)m_tabControl.SelectedItem).Content)).refresh();
93
95
  }
94
96
 
@@ -97,7 +99,6 @@ namespace rho.common
97
99
  initAppUrls();
98
100
  RhoLogger.InitRhoLog();
99
101
  LOG.INFO("Init");
100
-
101
102
  CRhoFile.recursiveCreateDir(CFilePath.join(getBlobsDirPath()," "));
102
103
 
103
104
  m_webBrowser = browser;
@@ -228,16 +229,16 @@ namespace rho.common
228
229
  m_webBrowser.Dispatcher.BeginInvoke( () =>
229
230
  {
230
231
  try{
231
- if (index > 0)
232
+ if (m_tabControl != null && m_tabControl.Items.Count > 0)
232
233
  {
233
- if (m_tabControl != null && m_tabControl.Items.Count > 0)
234
- {
235
- ((RhoView)((PivotItem)m_tabControl.Items[index]).Content).webBrowser1.IsScriptEnabled = true;
236
- if (isExternalUrl(strUrl))
237
- ((RhoView)((PivotItem)m_tabControl.Items[index]).Content).webBrowser1.Navigate(new Uri(strUrl, UriKind.Absolute));
238
- else
239
- ((RhoView)((PivotItem)m_tabControl.Items[index]).Content).webBrowser1.Navigate(new Uri(strUrl, UriKind.Relative));
240
- }
234
+ if (index == -1)
235
+ index = getCurrentTab();
236
+
237
+ ((RhoView)((PivotItem)m_tabControl.Items[index]).Content).webBrowser1.IsScriptEnabled = true;
238
+ if (isExternalUrl(strUrl))
239
+ ((RhoView)((PivotItem)m_tabControl.Items[index]).Content).webBrowser1.Navigate(new Uri(strUrl, UriKind.Absolute));
240
+ else
241
+ ((RhoView)((PivotItem)m_tabControl.Items[index]).Content).webBrowser1.Navigate(new Uri(strUrl, UriKind.Relative));
241
242
  }
242
243
  else
243
244
  {
@@ -261,12 +262,12 @@ namespace rho.common
261
262
  {
262
263
  try
263
264
  {
264
- if (index > 0)
265
+ if (m_tabControl != null && m_tabControl.Items.Count > 0)
265
266
  {
266
- if (m_tabControl != null && m_tabControl.Items.Count > 0)
267
- {
268
- ((RhoView)((PivotItem)m_tabControl.Items[index]).Content).webBrowser1.Navigate(m_webBrowser.Source);
269
- }
267
+ if (index == -1)
268
+ index = this.getCurrentTab();
269
+
270
+ ((RhoView)((PivotItem)m_tabControl.Items[index]).Content).webBrowser1.Navigate(m_webBrowser.Source);
270
271
  }
271
272
  else
272
273
  {
@@ -280,6 +281,17 @@ namespace rho.common
280
281
  });
281
282
  }
282
283
 
284
+ public int getTabIndexFor(object obj)
285
+ {
286
+ if (!(obj is WebBrowser) || m_tabControl == null || m_tabControl.Items.Count == 0) return -1;
287
+
288
+ for (int i = 0; i < m_tabControl.Items.Count; i++)
289
+ {
290
+ if (obj == ((RhoView)((PivotItem)m_tabControl.Items[i]).Content).webBrowser1) return i;
291
+ }
292
+
293
+ return -1;
294
+ }
283
295
 
284
296
  public void processInvokeScriptArgs(String strFuncName, String[] arrParams, int index)
285
297
  {
@@ -292,8 +304,11 @@ namespace rho.common
292
304
  {
293
305
  try
294
306
  {
295
- if (index >= 0 && m_tabControl != null && m_tabControl.Items.Count > 0)
307
+ if (m_tabControl != null && m_tabControl.Items.Count > 0)
296
308
  {
309
+ if (index == -1)
310
+ index = getCurrentTab();
311
+
297
312
  ((RhoView)((PivotItem)m_tabControl.Items[index]).Content).webBrowser1.InvokeScript(strFuncName, arrParams);
298
313
  }
299
314
  else
@@ -323,7 +338,10 @@ namespace rho.common
323
338
 
324
339
  public String getCurrentUrl(int index)
325
340
  {
326
- return m_currentUrls[m_currentTabIndex];
341
+ if ( index == -1 )
342
+ index = m_currentTabIndex;
343
+
344
+ return m_currentUrls[index];
327
345
  }
328
346
 
329
347
  public void keepLastVisitedUrl(String strUrl)
@@ -709,7 +727,7 @@ namespace rho.common
709
727
  m_tabControl.TabStripPlacement = Dock.Top;
710
728
  else if (tabBarType == 3)
711
729
  m_tabControl.TabStripPlacement = Dock.Left;*/
712
-
730
+
713
731
  m_tabControl = new Pivot();
714
732
  m_tabControl.SelectionChanged += Pivot_OnChanged;
715
733
 
@@ -731,6 +749,7 @@ namespace rho.common
731
749
  createTabBarButtons(tabBarType, hashArray);
732
750
  m_tabControl.Margin = new Thickness(0, 70, 0, 0);
733
751
  m_layoutRoot.Children.Add(m_tabControl);
752
+ m_layoutRoot.Children.Remove(m_masterView);
734
753
  });
735
754
  }
736
755
 
@@ -742,6 +761,7 @@ namespace rho.common
742
761
  {
743
762
  m_tabControl.Items.Clear();
744
763
  m_layoutRoot.Children.Remove(m_tabControl);
764
+ m_layoutRoot.Children.Add(m_masterView);
745
765
  m_masterView.refresh();
746
766
  }
747
767
  });
@@ -772,12 +792,7 @@ namespace rho.common
772
792
 
773
793
  public int getCurrentTab()
774
794
  {
775
- if (m_tabControl != null)
776
- {
777
- return m_tabControl.SelectedIndex;
778
- }
779
-
780
- return -1;
795
+ return m_currentTabIndex;
781
796
  }
782
797
  }
783
798
  }
@@ -285,7 +285,14 @@ namespace fastJSON
285
285
  success = true;
286
286
 
287
287
  index = lastIndex + 1;
288
- return RhoRuby.createString(number);
288
+ long intResult;
289
+ double floatResult;
290
+ if (long.TryParse(number, out intResult))
291
+ return intResult;
292
+ else if (double.TryParse(number, out floatResult))
293
+ return floatResult;
294
+
295
+ return 0;
289
296
  }
290
297
 
291
298
  protected static int GetLastIndexOfNumber(char[] json, int index)
@@ -40,12 +40,12 @@ namespace rho.logging
40
40
  private static RhoLogConf m_oLogConf;
41
41
  RhoConf RHOCONF() { return RhoConf.getInstance(); }
42
42
  CAsyncHttp m_aHttp = new CAsyncHttp(true);
43
- String m_addrHost = "";
43
+ String m_URL = "";
44
44
 
45
45
  public RhoLogServerSink(RhoLogConf conf)
46
46
  {
47
47
  m_oLogConf = conf;
48
- m_addrHost = "http://"+RHOCONF().getString("rhologhost") + ":" + RHOCONF().getString("rhologport");
48
+ m_URL = RHOCONF().getString("rhologurl");
49
49
  }
50
50
 
51
51
  public void close()
@@ -68,7 +68,7 @@ namespace rho.logging
68
68
  {
69
69
  IDictionary<object, object> map = new Dictionary<object, object>();
70
70
  Hash values = new Hash(map);
71
- values.Add(CRhoRuby.CreateSymbol("url"), MutableString.Create(m_addrHost));
71
+ values.Add(CRhoRuby.CreateSymbol("url"), MutableString.Create(m_URL));
72
72
  values.Add(CRhoRuby.CreateSymbol("body"), MutableString.Create(strMsg));
73
73
  RhoParams p = new RhoParams(values);
74
74
  m_aHttp.addHttpCommand(new CAsyncHttp.HttpCommand("POST", p));
@@ -363,7 +363,7 @@ namespace rho.common
363
363
  RhoConf.getInstance().loadConf();
364
364
  m_oLogConf.loadFromConf(RhoConf.getInstance());
365
365
 
366
- if (RhoConf.getInstance().getString("rhologhost").length() > 0)
366
+ if (RhoConf.getInstance().getString("rhologurl").length() > 0)
367
367
  m_oLogConf.setServerSynk(new rho.logging.RhoLogServerSink(m_oLogConf));
368
368
  }
369
369
  }
@@ -51,8 +51,8 @@ namespace rho.net
51
51
  static public String AJAX_CALLBACK_FUNCNAME = "_rho_ajaxProxyCallback";
52
52
  static public String AJAX_PARAM_CALLBACK_ID = "_rho_callbackId";
53
53
  static public String AJAX_PARAM_RESPONSE = "response";
54
- static public String AJAX_PARAM_STATUS = "status";
55
- static public String AJAX_PARAM_MESSAGE = "message";
54
+ static public String RESPONSE_STATUS = "status";
55
+ static public String RESPONSE_STATUS_MESSAGE = "message";
56
56
 
57
57
  class CRoute
58
58
  {
@@ -81,12 +81,13 @@ namespace rho.net
81
81
  CRoute m_route;
82
82
  CHttpServer m_Parent;
83
83
  int m_nCommand;
84
+ int m_iTabIndex;
84
85
  String m_strAjaxContext;
85
86
 
86
87
  public const int scDispatch = 1, scIndex = 2;
87
88
 
88
89
  public CServerCommand(CHttpServer Parent, CRoute route,
89
- String method, String uri, IDictionary headers, IDictionary data, int nCommand, String strAjaxContext)
90
+ String method, String uri, IDictionary headers, IDictionary data, int nCommand, String strAjaxContext, int tabIndex)
90
91
  {
91
92
  m_Parent = Parent;
92
93
  m_method = (null != method) ? method.toUpperCase() : "GET";
@@ -94,6 +95,7 @@ namespace rho.net
94
95
  m_route = route;
95
96
  m_nCommand = nCommand;
96
97
  m_strAjaxContext = strAjaxContext;
98
+ m_iTabIndex = tabIndex;
97
99
 
98
100
  m_body = "";
99
101
 
@@ -134,7 +136,7 @@ namespace rho.net
134
136
  result = m_Parent.processDispatch(m_route, m_method, m_uri, m_headers, m_query, m_body);
135
137
  strUrl = result[RESPONSE_BODY_FILEPATH].ToString();
136
138
 
137
- if (isAjaxRequest() && result[AJAX_PARAM_STATUS].ToString().equals(HTTP_REDIRECT_CODE))
139
+ if (isAjaxRequest() && result[RESPONSE_STATUS].ToString().equals(HTTP_REDIRECT_CODE))
138
140
  {
139
141
  IDictionary headers = new Dictionary<String, String>();
140
142
  headers["X-Requested-With"] = "XMLHttpRequest";
@@ -143,7 +145,8 @@ namespace rho.net
143
145
  new Uri(strUrl, UriKind.Relative),
144
146
  headers,
145
147
  new Dictionary<String, String>(),
146
- m_strAjaxContext
148
+ m_strAjaxContext,
149
+ m_iTabIndex
147
150
  ))
148
151
  {
149
152
  LOG.ERROR("Ajax request redirection failed.");
@@ -173,8 +176,8 @@ namespace rho.net
173
176
  if (
174
177
  key.ToString().startsWith(PARAM_PREFIX_REQ)
175
178
  || key.ToString().startsWith(PARAM_PREFIX_RESP)
176
- || key.ToString().equals(AJAX_PARAM_MESSAGE)
177
- || key.ToString().equals(AJAX_PARAM_STATUS)
179
+ || key.ToString().equals(RESPONSE_STATUS_MESSAGE)
180
+ || key.ToString().equals(RESPONSE_STATUS)
178
181
  ) continue;
179
182
  headers[key.ToString()] = result[key].ToString();
180
183
  jsonHeaders.AppendFormat("{0}\"{1}\": \"{2}\"",
@@ -186,10 +189,10 @@ namespace rho.net
186
189
  args[0] = m_strAjaxContext;
187
190
  args[1] = res;
188
191
  args[2] = "{" + jsonHeaders + "}";
189
- args[3] = result[AJAX_PARAM_MESSAGE].ToString();
190
- args[4] = result[AJAX_PARAM_STATUS].ToString();
192
+ args[3] = result[RESPONSE_STATUS_MESSAGE] != null ? result[RESPONSE_STATUS_MESSAGE].ToString() : "";
193
+ args[4] = result[RESPONSE_STATUS] != null ? result[RESPONSE_STATUS].ToString() : "";
191
194
 
192
- RHODESAPP().processInvokeScriptArgs(AJAX_CALLBACK_FUNCNAME, args, RHODESAPP().getCurrentTab());
195
+ RHODESAPP().processInvokeScriptArgs(AJAX_CALLBACK_FUNCNAME, args, m_iTabIndex);
193
196
  }
194
197
  }
195
198
 
@@ -222,12 +225,12 @@ namespace rho.net
222
225
  (pCmd as CServerCommand).execute();
223
226
  }
224
227
 
225
- public boolean processBrowserRequest(Uri uri, String strAjaxContext)
228
+ public boolean processBrowserRequest(Uri uri, String strAjaxContext, int tabIndex = -1)
226
229
  {
227
- return processBrowserRequest("get", uri, null, null, strAjaxContext);
230
+ return processBrowserRequest("get", uri, null, null, strAjaxContext, tabIndex);
228
231
  }
229
232
 
230
- public boolean processBrowserRequest(String reqType, Uri uri, IDictionary headers, IDictionary data, String strAjaxContext)
233
+ public boolean processBrowserRequest(String reqType, Uri uri, IDictionary headers, IDictionary data, String strAjaxContext, int tabIndex = -1)
231
234
  {
232
235
  boolean bAjaxCall = !(strAjaxContext == null || strAjaxContext.length() == 0);
233
236
 
@@ -258,7 +261,7 @@ namespace rho.net
258
261
  {
259
262
  addQueueCommand(new CServerCommand(this, route, reqType,
260
263
  url + (0 < query.Length ? ("?"+query) : ""),
261
- headers, data, CServerCommand.scDispatch, strAjaxContext));
264
+ headers, data, CServerCommand.scDispatch, strAjaxContext, tabIndex));
262
265
  //addQueueCommand(new CServerCommand(this, route, bAjaxCall ? "GET" : "GET", url, query, "", CServerCommand.scDispatch, strAjaxContext));
263
266
 
264
267
  return true;
@@ -269,7 +272,7 @@ namespace rho.net
269
272
  String strIndexFile = getIndex(fullPath);
270
273
  if (strIndexFile.Length > 0)
271
274
  {
272
- addQueueCommand(new CServerCommand(this, route, reqType, url, headers, data, CServerCommand.scIndex, strAjaxContext));
275
+ addQueueCommand(new CServerCommand(this, route, reqType, url, headers, data, CServerCommand.scIndex, strAjaxContext, tabIndex));
273
276
  //addQueueCommand(new CServerCommand(this, route, bAjaxCall ? "GET" : "GET", url, query, "", CServerCommand.scIndex, strAjaxContext));
274
277
 
275
278
  return true;
@@ -317,12 +320,16 @@ namespace rho.net
317
320
  CRhoFile.recursiveCreateDir(strFilePath);
318
321
  CRhoFile.writeStringToFile(strFilePath, error);
319
322
  ((IDictionary)rhoResp)[RESPONSE_BODY_FILEPATH] = strFilePath;
323
+ ((IDictionary)rhoResp)[RESPONSE_STATUS] = "404";
324
+ ((IDictionary)rhoResp)[RESPONSE_STATUS_MESSAGE] = "Not Found";
320
325
  return (IDictionary)rhoResp;
321
326
  }
322
327
 
323
328
  if (CFilePath.getExtension(fullPath).Length > 0)
324
329
  {
325
330
  ((IDictionary)rhoResp)[RESPONSE_BODY_FILEPATH] = strIndexFile;
331
+ ((IDictionary)rhoResp)[RESPONSE_STATUS] = "200";
332
+ ((IDictionary)rhoResp)[RESPONSE_STATUS_MESSAGE] = "Ok";
326
333
  return (IDictionary)rhoResp;
327
334
  }
328
335