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.
- data/Manifest.txt +16 -1
- data/Rakefile +77 -28
- data/doc/build.txt +5 -3
- data/doc/configuration.txt +13 -0
- data/doc/device-caps.txt +46 -27
- data/doc/rhom.txt +2 -2
- data/doc/test-log-debug.txt +6 -0
- data/doc/ui.txt +13 -0
- data/lib/build/jake.rb +11 -11
- data/lib/extensions/crypt/crypt/cbc.rb +5 -2
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +14 -4
- data/lib/framework/rho/render.rb +17 -4
- data/lib/framework/rho/rho.rb +1 -1
- data/lib/framework/rho/rhocontroller.rb +11 -1
- data/lib/framework/rhomotoapi.rb +110 -0
- data/platform/android/Rhodes/jni/Android.mk +2 -5
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +1 -0
- data/platform/android/Rhodes/jni/include/rhodes/fileapi.h +38 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +7 -26
- data/platform/android/Rhodes/jni/src/extmanager.cpp +4 -1
- data/platform/android/Rhodes/jni/src/fileapi.cpp +38 -14
- data/platform/android/Rhodes/jni/src/mapview.cpp +1 -2
- data/platform/android/Rhodes/jni/src/rhodesapp.cpp +10 -0
- data/platform/android/Rhodes/jni/src/rhodessystem.cpp +1 -1
- data/platform/android/Rhodes/jni/src/signature.cpp +1 -4
- data/platform/android/Rhodes/rhobundle.xml +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +11 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +4 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +26 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +3 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +70 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtData.java +3 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +21 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +19 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtDataImpl.java +8 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManager.java +18 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +168 -31
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +46 -9
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +3 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +27 -53
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +27 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/Utils.java +13 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +12 -5
- data/platform/android/build/RhodesSRC_build.files +2 -1
- data/platform/android/build/android.rake +48 -17
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +24 -3
- data/platform/iphone/Classes/AppManager/AppManager.m +1 -1
- data/platform/iphone/Classes/Camera/PickImageDelegate.m +27 -2
- data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
- data/platform/iphone/Classes/DateTimePickerDelegate.m +85 -9
- data/platform/iphone/Classes/DateTimePickerViewController.h +21 -0
- data/platform/iphone/Classes/DateTimePickerViewController.m +75 -0
- data/platform/iphone/Classes/GeoLocation/LocationController.h +6 -2
- data/platform/iphone/Classes/GeoLocation/LocationController.m +54 -14
- data/platform/iphone/Classes/RhoMainView.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +11 -5
- data/platform/iphone/Classes/Signature/SignatureDelegate.m +13 -12
- data/platform/iphone/Classes/Signature/SignatureViewController.m +2 -1
- data/platform/iphone/Classes/SimpleMainView.m +3 -0
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +3 -0
- data/platform/iphone/Classes/TabbedMainView.m +30 -11
- data/platform/iphone/rbuild/iphone.rake +7 -1
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +6 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1 -1
- data/platform/shared/common/BundleManager.cpp +42 -2
- data/platform/shared/common/ExtManager.h +7 -0
- data/platform/shared/common/RhoFile.cpp +170 -2
- data/platform/shared/common/RhoFile.h +4 -0
- data/platform/shared/common/RhodesApp.cpp +30 -0
- data/platform/shared/common/RhodesApp.h +1 -0
- data/platform/shared/common/map/OSMMapEngine.cpp +11 -3
- data/platform/shared/common/map/OSMMapEngine.h +3 -0
- data/platform/shared/logging/RhoLogConf.cpp +8 -9
- data/platform/shared/logging/RhoLogConf.h +5 -7
- data/platform/shared/logging/RhoLogSink.cpp +3 -3
- data/platform/shared/logging/RhoLogSink.h +1 -1
- data/platform/shared/net/HttpServer.cpp +17 -9
- data/platform/shared/qt/rhodes/main.cpp +1 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
- data/platform/shared/ruby/ext/webview/webview.i +9 -4
- data/platform/shared/ruby/ext/webview/webview_wrap.c +2 -2
- data/platform/shared/test/Tests.cpp +2 -2
- data/platform/wm/build/build_inf.js +75 -47
- data/platform/wm/build/wm.rake +50 -53
- data/platform/wm/rhodes/Rhodes.cpp +40 -97
- data/platform/wm/rhodes/rho/common/ExtManager.cpp +23 -1
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +9 -0
- data/platform/wm/tools/detool/detool.cpp +103 -52
- data/platform/wp7/RhoRubyExtGen/RhoDateTimePicker.cs +60 -0
- data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +1 -0
- data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +4 -4
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +15 -1
- data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +12 -2
- data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +2 -0
- data/platform/wp7/RhoRubyLib/common/RhoFile.cs +3 -3
- data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +2 -2
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +39 -24
- data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +8 -1
- data/platform/wp7/RhoRubyLib/logging/RhoLogServerSink.cs +3 -3
- data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +1 -1
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +22 -15
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
- data/platform/wp7/RhoRubyLib/rubyext/RhoDateTimePicker.cs +237 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +5 -5
- data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml +37 -0
- data/platform/wp7/RhoRubyLib/views/RhoDateTimeDlg.xaml.cs +59 -0
- data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +34 -41
- data/platform/wp7/rhodes/App.xaml.cs +1 -0
- data/platform/wp7/rhodes/Properties/WMAppManifest.xml +18 -18
- data/platform/wp7/rhodes/Rhodes.csproj +5 -1
- data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Cancel.png +0 -0
- data/platform/wp7/rhodes/Toolkit.Content/ApplicationBar.Check.png +0 -0
- data/rakefile.rb +77 -28
- data/res/build-tools/Microsoft.Phone.Controls.Toolkit.dll +0 -0
- data/res/build-tools/YUICompressorLicense.txt +54 -0
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/yuicompressor-2.4.7.jar +0 -0
- data/res/generators/templates/application/app/layout.erb +1 -0
- data/res/generators/templates/application/public/js/jquery-wp7-patch.js +8 -2
- data/res/generators/templates/application/public/js/syncengine.js +147 -0
- data/spec/phone_spec/app/Data/septest.json +1 -1
- data/spec/phone_spec/app/spec/asynchttp_spec.rb +11 -10
- data/spec/phone_spec/app/spec/blobsync_spec.rb +9 -34
- data/spec/phone_spec/app/spec/date_spec.rb +6 -6
- data/spec/phone_spec/app/spec/rho_spec.rb +1 -6
- data/spec/phone_spec/app/spec/rhofile_spec.rb +13 -7
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +4 -3
- data/spec/phone_spec/app/spec/syncengine_spec.rb +12 -14
- data/spec/phone_spec/app/spec_runner.rb +9 -10
- data/version +1 -1
- metadata +20 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerSingleton.java +0 -15
@@ -473,7 +473,7 @@ namespace rho.net
|
|
473
473
|
|
474
474
|
if ((strBody != null && strBody.length() > 0) || m_isPullFile || m_isMultiPart)
|
475
475
|
{
|
476
|
-
if (oSession != null && !m_isPullFile)
|
476
|
+
if (oSession != null && !m_isPullFile && !m_isMultiPart)
|
477
477
|
m_webRequest.ContentType = oSession.getContentType();
|
478
478
|
else if (m_isMultiPart)
|
479
479
|
m_webRequest.ContentType = "multipart/form-data; boundary=----------A6174410D6AD474183FDE48F5662FCC5";
|
@@ -0,0 +1,237 @@
|
|
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
|
+
using Microsoft.Phone.Tasks;
|
34
|
+
using rho.common;
|
35
|
+
using System.Globalization;
|
36
|
+
using System.Windows;
|
37
|
+
using Microsoft.Phone.Controls;
|
38
|
+
using rho.views;
|
39
|
+
using System.Globalization;
|
40
|
+
using System.Windows;
|
41
|
+
using System.Windows.Controls;
|
42
|
+
using System.Windows.Controls.Primitives;
|
43
|
+
using System.Windows.Navigation;
|
44
|
+
using Microsoft.Phone.Controls.Primitives;
|
45
|
+
|
46
|
+
|
47
|
+
namespace rho.rubyext
|
48
|
+
{
|
49
|
+
[RubyModule("DateTimePicker")]
|
50
|
+
public static class RhoDateTimePicker
|
51
|
+
{
|
52
|
+
private static RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
53
|
+
new RhoLogger("RhoDateTimePicker");
|
54
|
+
private static CRhoRuby RhoRuby { get { return CRhoRuby.Instance; } }
|
55
|
+
private static CRhodesApp RHODESAPP() { return CRhodesApp.Instance; }
|
56
|
+
private static PhoneApplicationFrame m_frame = null;
|
57
|
+
private static object m_frameContentWhenOpened;
|
58
|
+
private static RhoDateTimeDlg m_dateTimePickerPage = null;
|
59
|
+
private static DateTime m_dateValue;
|
60
|
+
private static DateTime m_timeValue;
|
61
|
+
private static String m_callback = "";
|
62
|
+
private static String m_title = "";
|
63
|
+
private static String m_opaque = null;
|
64
|
+
private static int m_fmt = 0;
|
65
|
+
|
66
|
+
|
67
|
+
#region Private Implementation Details
|
68
|
+
|
69
|
+
#endregion
|
70
|
+
|
71
|
+
#region Private Instance & Singleton Methods
|
72
|
+
|
73
|
+
|
74
|
+
[RubyMethodAttribute("choose", RubyMethodAttributes.PublicSingleton)]
|
75
|
+
public static void choose(RubyModule/*!*/ self, params object[] args)
|
76
|
+
{
|
77
|
+
try
|
78
|
+
{
|
79
|
+
if (args != null && args.Length != 4 && args.Length != 5)
|
80
|
+
throw RubyExceptionData.InitializeException(new RuntimeError("wrong number of arguments"), "wrong number of arguments");
|
81
|
+
|
82
|
+
if (args.Length == 5)
|
83
|
+
m_opaque = args[4].ToString();
|
84
|
+
|
85
|
+
m_fmt = int.Parse(args[3].ToString());
|
86
|
+
|
87
|
+
m_callback = args[0].ToString();
|
88
|
+
m_title = args[1].ToString();
|
89
|
+
//long init = args[2].toRubyTime().getTime();
|
90
|
+
|
91
|
+
RHODESAPP().MainPage.Dispatcher.BeginInvoke(() =>
|
92
|
+
{
|
93
|
+
OpenPickerPage();
|
94
|
+
});
|
95
|
+
}
|
96
|
+
catch (Exception ex)
|
97
|
+
{
|
98
|
+
Exception rubyEx = self.Context.CurrentException;
|
99
|
+
if (rubyEx == null)
|
100
|
+
{
|
101
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
102
|
+
}
|
103
|
+
LOG.ERROR("choose", ex);
|
104
|
+
throw rubyEx;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
[RubyMethodAttribute("choose_with_range", RubyMethodAttributes.PublicSingleton)]
|
109
|
+
public static void choose_with_range(RubyModule/*!*/ self, params object[] args)
|
110
|
+
{
|
111
|
+
try
|
112
|
+
{
|
113
|
+
if (args != null && args.Length != 4 && args.Length != 5)
|
114
|
+
throw RubyExceptionData.InitializeException(new RuntimeError("wrong number of arguments"), "wrong number of arguments");
|
115
|
+
|
116
|
+
if (args.Length == 5)
|
117
|
+
m_opaque = args[4].ToString();
|
118
|
+
|
119
|
+
m_fmt = int.Parse(args[3].ToString());
|
120
|
+
|
121
|
+
m_callback = args[0].ToString();
|
122
|
+
m_title = args[1].ToString();
|
123
|
+
//long init = args[2].toRubyTime().getTime();
|
124
|
+
//long min_t = args[5].toRubyTime().getTime();
|
125
|
+
//long max_t = args[6].toRubyTime().getTime();
|
126
|
+
|
127
|
+
RHODESAPP().MainPage.Dispatcher.BeginInvoke(() =>
|
128
|
+
{
|
129
|
+
OpenPickerPage();
|
130
|
+
});
|
131
|
+
}
|
132
|
+
catch (Exception ex)
|
133
|
+
{
|
134
|
+
Exception rubyEx = self.Context.CurrentException;
|
135
|
+
if (rubyEx == null)
|
136
|
+
{
|
137
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
138
|
+
}
|
139
|
+
LOG.ERROR("choose_with_range", ex);
|
140
|
+
throw rubyEx;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
#endregion
|
145
|
+
|
146
|
+
#region Helpers
|
147
|
+
|
148
|
+
private static void OpenPickerPage()
|
149
|
+
{
|
150
|
+
if (null == m_frame)
|
151
|
+
{
|
152
|
+
m_frame = Application.Current.RootVisual as PhoneApplicationFrame;
|
153
|
+
if (null != m_frame)
|
154
|
+
{
|
155
|
+
m_frameContentWhenOpened = m_frame.Content;
|
156
|
+
|
157
|
+
m_frame.Navigated += OnFrameNavigated;
|
158
|
+
m_frame.NavigationStopped += OnFrameNavigationStoppedOrFailed;
|
159
|
+
m_frame.NavigationFailed += OnFrameNavigationStoppedOrFailed;
|
160
|
+
|
161
|
+
m_frame.Navigate(new Uri("/RhoRubyLib;component/views/RhoDateTimeDlg.xaml", UriKind.Relative));
|
162
|
+
RHODESAPP().m_transition = true;
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
}
|
167
|
+
|
168
|
+
private static void ClosePickerPage()
|
169
|
+
{
|
170
|
+
if (null != m_frame)
|
171
|
+
{
|
172
|
+
m_frame.Navigated -= OnFrameNavigated;
|
173
|
+
m_frame.NavigationStopped -= OnFrameNavigationStoppedOrFailed;
|
174
|
+
m_frame.NavigationFailed -= OnFrameNavigationStoppedOrFailed;
|
175
|
+
|
176
|
+
m_frame = null;
|
177
|
+
m_frameContentWhenOpened = null;
|
178
|
+
}
|
179
|
+
|
180
|
+
if (null != m_dateTimePickerPage)
|
181
|
+
{
|
182
|
+
m_dateValue = m_dateTimePickerPage.m_dateValue;
|
183
|
+
m_timeValue = m_dateTimePickerPage.m_timeValue;
|
184
|
+
DateTime result = new DateTime();
|
185
|
+
|
186
|
+
switch(m_fmt)
|
187
|
+
{
|
188
|
+
case 0:
|
189
|
+
result = m_dateValue;//TODO// + m_timeValue;
|
190
|
+
break;
|
191
|
+
case 1:
|
192
|
+
result = m_dateValue;
|
193
|
+
break;
|
194
|
+
case 2:
|
195
|
+
result = m_timeValue;
|
196
|
+
break;
|
197
|
+
default:
|
198
|
+
break;
|
199
|
+
}
|
200
|
+
|
201
|
+
long sec = (result - new DateTime(1970, 1, 1)).Ticks / 10000000;
|
202
|
+
|
203
|
+
if (m_callback != "")
|
204
|
+
{
|
205
|
+
m_callback = RHODESAPP().canonicalizeRhoUrl(m_callback);
|
206
|
+
String body ="";
|
207
|
+
if(m_dateTimePickerPage.m_cancel == false)
|
208
|
+
body += "status=ok&result=" + sec.ToString();
|
209
|
+
else
|
210
|
+
body += "status=cancel";
|
211
|
+
if (m_opaque != null)
|
212
|
+
body += "&opaque=" + m_opaque;
|
213
|
+
body += "&rho_callback=1";
|
214
|
+
RhoClassFactory.createNetRequest().pushData(m_callback, body, null);
|
215
|
+
//m_frame.InvalidateArrange();
|
216
|
+
}
|
217
|
+
m_dateTimePickerPage = null;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
private static void OnFrameNavigated(object sender, NavigationEventArgs e)
|
222
|
+
{
|
223
|
+
if (e.Content == m_frameContentWhenOpened)
|
224
|
+
ClosePickerPage();
|
225
|
+
else if (null == m_dateTimePickerPage)
|
226
|
+
m_dateTimePickerPage = e.Content as RhoDateTimeDlg;
|
227
|
+
}
|
228
|
+
|
229
|
+
private static void OnFrameNavigationStoppedOrFailed(object sender, EventArgs e)
|
230
|
+
{
|
231
|
+
ClosePickerPage();
|
232
|
+
}
|
233
|
+
|
234
|
+
#endregion
|
235
|
+
|
236
|
+
}
|
237
|
+
}
|
@@ -49,7 +49,7 @@ namespace rho.rubyext
|
|
49
49
|
#region Private Instance & Singleton Methods
|
50
50
|
|
51
51
|
[RubyMethodAttribute("navigate", RubyMethodAttributes.PublicSingleton)]
|
52
|
-
public static void Navigate(RubyModule/*!*/ self, [NotNull]String/*!*/ url, int index =
|
52
|
+
public static void Navigate(RubyModule/*!*/ self, [NotNull]String/*!*/ url, int index = -1)
|
53
53
|
{
|
54
54
|
try
|
55
55
|
{
|
@@ -68,7 +68,7 @@ namespace rho.rubyext
|
|
68
68
|
}
|
69
69
|
|
70
70
|
[RubyMethodAttribute("refresh", RubyMethodAttributes.PublicSingleton)]
|
71
|
-
public static void Refresh(RubyModule/*!*/ self, int index =
|
71
|
+
public static void Refresh(RubyModule/*!*/ self, int index = -1)
|
72
72
|
{
|
73
73
|
try
|
74
74
|
{
|
@@ -87,7 +87,7 @@ namespace rho.rubyext
|
|
87
87
|
}
|
88
88
|
|
89
89
|
[RubyMethodAttribute("execute_js", RubyMethodAttributes.PublicSingleton)]
|
90
|
-
public static void execute_js(RubyModule/*!*/ self, [NotNull]String/*!*/ strScript, int index =
|
90
|
+
public static void execute_js(RubyModule/*!*/ self, [NotNull]String/*!*/ strScript, int index = -1, RubyArray vals = null)
|
91
91
|
{
|
92
92
|
try
|
93
93
|
{
|
@@ -116,12 +116,12 @@ namespace rho.rubyext
|
|
116
116
|
}
|
117
117
|
|
118
118
|
[RubyMethodAttribute("current_location", RubyMethodAttributes.PublicSingleton)]
|
119
|
-
public static String currentLocation(RubyModule/*!*/ self)
|
119
|
+
public static String currentLocation(RubyModule/*!*/ self, int index = -1)
|
120
120
|
{
|
121
121
|
String res = "";
|
122
122
|
try
|
123
123
|
{
|
124
|
-
res = RHODESAPP().getCurrentUrl(
|
124
|
+
res = RHODESAPP().getCurrentUrl(index);
|
125
125
|
}
|
126
126
|
catch (Exception ex)
|
127
127
|
{
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<phone:PhoneApplicationPage x:Class="rho.views.RhoDateTimeDlg"
|
2
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
3
|
+
xmlns:tk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
|
4
|
+
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
5
|
+
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
6
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
7
|
+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
8
|
+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
9
|
+
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
10
|
+
mc:Ignorable="d"
|
11
|
+
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
12
|
+
FontSize="{StaticResource PhoneFontSizeNormal}"
|
13
|
+
Foreground="{StaticResource PhoneForegroundBrush}"
|
14
|
+
|
15
|
+
d:DesignHeight="800" d:DesignWidth="480">
|
16
|
+
|
17
|
+
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}" IsHitTestVisible="True">
|
18
|
+
<StackPanel Orientation="Vertical" x:Name="ContentPanel" >
|
19
|
+
<TextBlock Text="select date" Style="{StaticResource PhoneTextNormalStyle}"/>
|
20
|
+
<toolkit:DatePicker Name="dateField" ValueChanged="DatePicker_ValueChanged" />
|
21
|
+
<TextBlock Text="select time" Style="{StaticResource PhoneTextNormalStyle}"/>
|
22
|
+
<toolkit:TimePicker Name="timeField" ValueChanged="TimePicker_ValueChanged"/>
|
23
|
+
<Grid x:Name="btngrid" Background="{StaticResource PhoneChromeBrush}" IsHitTestVisible="True">
|
24
|
+
<Button Content="OK"
|
25
|
+
x:Name="doneButton" VerticalAlignment="Bottom"
|
26
|
+
d:LayoutOverrides="Width"
|
27
|
+
HorizontalAlignment="Center" Margin="129,0,267,6"
|
28
|
+
Click="OnDoneButtonClick"/>
|
29
|
+
<Button Content="Cancel"
|
30
|
+
x:Name="cancelButton" VerticalAlignment="Bottom"
|
31
|
+
d:LayoutOverrides="Width"
|
32
|
+
HorizontalAlignment="Center" Margin="218,0,136,6"
|
33
|
+
Click="OnCancelButtonClick"/>
|
34
|
+
</Grid>
|
35
|
+
</StackPanel>
|
36
|
+
</Grid>
|
37
|
+
</phone:PhoneApplicationPage>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Collections.Generic;
|
3
|
+
using System.Linq;
|
4
|
+
using System.Net;
|
5
|
+
using System.Windows;
|
6
|
+
using System.Windows.Controls;
|
7
|
+
using System.Windows.Documents;
|
8
|
+
using System.Windows.Input;
|
9
|
+
using System.Windows.Media;
|
10
|
+
using System.Windows.Media.Animation;
|
11
|
+
using System.Windows.Shapes;
|
12
|
+
using Microsoft.Phone.Controls;
|
13
|
+
using rho.rubyext;
|
14
|
+
|
15
|
+
namespace rho.views
|
16
|
+
{
|
17
|
+
public partial class RhoDateTimeDlg : PhoneApplicationPage
|
18
|
+
{
|
19
|
+
|
20
|
+
public DateTime m_dateValue;
|
21
|
+
public DateTime m_timeValue;
|
22
|
+
public bool m_cancel = false;
|
23
|
+
|
24
|
+
public RhoDateTimeDlg()
|
25
|
+
{
|
26
|
+
InitializeComponent();
|
27
|
+
}
|
28
|
+
|
29
|
+
private void ClosePickerPage()
|
30
|
+
{
|
31
|
+
NavigationService.GoBack();
|
32
|
+
}
|
33
|
+
|
34
|
+
|
35
|
+
private void DatePicker_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
|
36
|
+
{
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
private void TimePicker_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
|
41
|
+
{
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
private void OnDoneButtonClick(object sender, EventArgs e)
|
46
|
+
{
|
47
|
+
m_dateValue = dateField.Value.Value;//.Date.ToShortDateString();
|
48
|
+
m_timeValue = timeField.Value.Value;//.ToShortTimeString();
|
49
|
+
m_cancel = false;
|
50
|
+
ClosePickerPage();
|
51
|
+
}
|
52
|
+
|
53
|
+
private void OnCancelButtonClick(object sender, EventArgs e)
|
54
|
+
{
|
55
|
+
m_cancel = true;
|
56
|
+
ClosePickerPage();
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
@@ -1,30 +1,4 @@
|
|
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 System;
|
1
|
+
using System;
|
28
2
|
using System.Collections.Generic;
|
29
3
|
using System.Linq;
|
30
4
|
using System.Net;
|
@@ -55,28 +29,28 @@ namespace rho.views
|
|
55
29
|
private Stack<Uri> m_backHistory = new Stack<Uri>();
|
56
30
|
private Stack<Uri> m_forwardHistory = new Stack<Uri>();
|
57
31
|
/// <summary>
|
58
|
-
///
|
32
|
+
///
|
59
33
|
/// </summary>
|
60
34
|
//private Hash m_menuItems = null;
|
61
35
|
private Uri m_currentUri = null;
|
62
36
|
private PhoneApplicationPage m_mainPage = null;
|
63
37
|
private Grid m_layoutRoot = null;
|
64
|
-
public
|
65
|
-
public
|
38
|
+
public PhoneApplicationPage MainPage { set { m_mainPage = value; } }
|
39
|
+
public Grid MainPageLayoutRoot { set { m_layoutRoot = value; } }
|
66
40
|
private String m_strAction = null;
|
67
41
|
private bool m_reload = false;
|
68
42
|
private bool m_loadFirstTime = true;
|
69
43
|
private bool m_masterView = false;
|
70
44
|
private int m_index = -1;
|
71
45
|
private bool m_callback = false;
|
72
|
-
|
46
|
+
|
73
47
|
private const string AJAX_CONTEXT_PARAM = "_rho_callbackId";
|
74
48
|
private const string JS_NOTIFY_CONSOLE_LOG = "console.log:";
|
75
49
|
private const string JS_NOTIFY_CONSOLE_INFO = "console.info:";
|
76
50
|
private const string JS_NOTIFY_CONSOLE_WARNING = "console.warn:";
|
77
51
|
private const string JS_NOTIFY_CONSOLE_ERROR = "console.error:";
|
78
52
|
private const string JS_NOTIFY_REQUEST = "request:";
|
79
|
-
private const string
|
53
|
+
private const string REQUEST_URL_SCHEME_PREFIX = "x-wmapp";
|
80
54
|
|
81
55
|
//TO DO history. each time we have to save our current state of rhodesapp in rhoview entity
|
82
56
|
public Stack<Uri> BackHistory { set { m_backHistory = value; } }
|
@@ -95,7 +69,7 @@ namespace rho.views
|
|
95
69
|
webBrowser1.Navigated += WebBrowser_OnNavigated;
|
96
70
|
webBrowser1.ScriptNotify += WebBrowser_OnScriptNotify;
|
97
71
|
}
|
98
|
-
|
72
|
+
|
99
73
|
public RhoView(PhoneApplicationPage mainPage, Grid layoutRoot, String strAction,
|
100
74
|
bool reload, Brush webBkgColor, int index)
|
101
75
|
{
|
@@ -121,6 +95,12 @@ namespace rho.views
|
|
121
95
|
private void WebBrowser_OnLoaded(object sender, RoutedEventArgs e)
|
122
96
|
{
|
123
97
|
if (RHODESAPP().Tab != null && RHODESAPP().Tab.SelectedIndex != m_index) return;
|
98
|
+
if (RHODESAPP().m_transition)
|
99
|
+
{
|
100
|
+
RHODESAPP().m_transition = false;
|
101
|
+
|
102
|
+
return;
|
103
|
+
}
|
124
104
|
OperatingSystem os = Environment.OSVersion;
|
125
105
|
Version vs = os.Version;
|
126
106
|
if (vs.Minor < 10) m_reload = true;
|
@@ -156,7 +136,8 @@ namespace rho.views
|
|
156
136
|
|
157
137
|
private void WebBrowser_OnNavigating(object sender, NavigatingEventArgs e)
|
158
138
|
{
|
159
|
-
|
139
|
+
var tabIndex = RHODESAPP().getTabIndexFor(sender);
|
140
|
+
if (!RHODESAPP().HttpServer.processBrowserRequest(e.Uri, null, tabIndex))
|
160
141
|
return;
|
161
142
|
|
162
143
|
e.Cancel = true;
|
@@ -173,7 +154,7 @@ namespace rho.views
|
|
173
154
|
if (-1 == idx)
|
174
155
|
return null;
|
175
156
|
|
176
|
-
string context = uri.substring(idx + 1);
|
157
|
+
string context = uri.substring(idx + 1); // +1 due to the '=' sign after param name
|
177
158
|
|
178
159
|
idx = context.indexOf('&');
|
179
160
|
if (-1 < idx)
|
@@ -182,6 +163,15 @@ namespace rho.views
|
|
182
163
|
return context;
|
183
164
|
}
|
184
165
|
|
166
|
+
private String pathFromUrl(String url)
|
167
|
+
{
|
168
|
+
if (0 == url.IndexOf(REQUEST_URL_SCHEME_PREFIX))
|
169
|
+
{
|
170
|
+
return url.substring(url.indexOf(":") + 1);
|
171
|
+
}
|
172
|
+
return url;
|
173
|
+
}
|
174
|
+
|
185
175
|
private void WebBrowser_OnScriptNotify(object sender, NotifyEventArgs e)
|
186
176
|
{
|
187
177
|
string request = e.Value;
|
@@ -209,7 +199,7 @@ namespace rho.views
|
|
209
199
|
IDictionary res = null;
|
210
200
|
try
|
211
201
|
{
|
212
|
-
res = (IDictionary)
|
202
|
+
res = (IDictionary)fastJSON.RJSONTokener.JsonDecode(req);
|
213
203
|
}
|
214
204
|
catch (Exception ex)
|
215
205
|
{
|
@@ -223,19 +213,22 @@ namespace rho.views
|
|
223
213
|
string type = res["type"].ToString().toUpperCase();
|
224
214
|
string contentType = res["contentType"].ToString();
|
225
215
|
IDictionary headers = (IDictionary)res["headers"];
|
216
|
+
headers["X-Requested-With"] = "XMLHttpRequest";
|
226
217
|
IDictionary data = (IDictionary)res["data"];
|
218
|
+
|
227
219
|
string httpUsername = (null == res["usename"]) ? null : res["usename"].ToString();
|
228
220
|
string httpPassword = (null == res["password"]) ? null : res["password"].ToString();
|
221
|
+
string ajaxContext = data[AJAX_CONTEXT_PARAM].ToString();
|
229
222
|
|
230
|
-
|
223
|
+
int tabIdx = RHODESAPP().getTabIndexFor(sender);
|
231
224
|
|
232
|
-
string ajaxContext = data[AJAX_CONTEXT_PARAM].ToString();
|
233
225
|
if (!RHODESAPP().HttpServer.processBrowserRequest(
|
234
226
|
type,
|
235
|
-
new Uri(url
|
227
|
+
new Uri(pathFromUrl(url), UriKind.Relative),
|
236
228
|
headers,
|
237
229
|
data,
|
238
|
-
ajaxContext
|
230
|
+
ajaxContext,
|
231
|
+
tabIdx
|
239
232
|
))
|
240
233
|
{
|
241
234
|
LOG.ERROR("External requests should be filtered in javascript");
|
@@ -254,4 +247,4 @@ namespace rho.views
|
|
254
247
|
WebBrowser_OnLoaded(this, null);
|
255
248
|
}
|
256
249
|
}
|
257
|
-
}
|
250
|
+
}
|