rhodes 3.3.2.beta.1 → 3.3.2.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/Manifest.txt +5 -5
  2. data/Rakefile +1 -1
  3. data/doc/build.txt +27 -1
  4. data/doc/device-caps.txt +65 -18
  5. data/doc/install.txt +5 -3
  6. data/lib/extensions/barcode/ext/barcode/platform/wm/Barcode.sln +30 -0
  7. data/lib/extensions/barcode/ext/barcode/platform/wm/Barcode.vcproj +159 -5
  8. data/lib/extensions/barcode/ext/barcode/platform/wm/Rakefile +1 -1
  9. data/lib/extensions/digest-md5/ext/Rakefile +2 -2
  10. data/lib/extensions/digest-md5/ext/digest-md5.sln +44 -0
  11. data/lib/extensions/digest-sha1/ext/Rakefile +2 -2
  12. data/lib/extensions/digest-sha1/ext/digest-sha1.sln +44 -0
  13. data/lib/framework/rho/rhofsconnector.rb +9 -6
  14. data/lib/framework/rhom/rhom_db_adapter.rb +10 -0
  15. data/platform/android/Rhodes/jni/src/logconf.cpp +5 -0
  16. data/platform/android/Rhodes/jni/src/rhodesapp.cpp +7 -3
  17. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +82 -37
  18. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoLogConf.java +2 -0
  19. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +8 -9
  20. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +87 -2
  21. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +77 -159
  22. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +4 -5
  23. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +6 -31
  24. data/platform/iphone/Classes/AppManager/AppManager.m +106 -29
  25. data/platform/iphone/Classes/Rhodes.m +27 -0
  26. data/platform/iphone/rbuild/iphone.rake +1 -1
  27. data/platform/shared/common/RhodesApp.cpp +10 -2
  28. data/platform/shared/common/RhodesAppBase.cpp +20 -4
  29. data/platform/shared/common/RhodesAppBase.h +4 -0
  30. data/platform/shared/db/DBAdapter.cpp +4 -6
  31. data/platform/shared/logging/RhoLogConf.cpp +2 -7
  32. data/platform/shared/logging/RhoLogConf.h +4 -0
  33. data/platform/shared/net/HttpServer.cpp +2 -2
  34. data/platform/shared/net/RawSocket.cpp +3 -0
  35. data/platform/shared/ruby/ext/rho/rhoruby.c +7 -3
  36. data/platform/shared/ruby/ext/rho/rhoruby.h +2 -1
  37. data/platform/shared/ruby/ext/rho/rhosupport.c +9 -3
  38. data/platform/shared/ruby/ext/system/system.i +4 -0
  39. data/platform/shared/ruby/ext/system/system_wrap.c +40 -1
  40. data/platform/wm/build/wm.rake +15 -5
  41. data/platform/wm/rhodes/LogView.cpp +25 -1
  42. data/platform/wm/rhodes/LogView.h +13 -0
  43. data/platform/wm/rhodes/MainWindow.cpp +4 -0
  44. data/platform/wm/rhodes/Rhodes.cpp +1 -1
  45. data/platform/wm/rhodes/rho/rubyext/RhoSignature.cpp +240 -145
  46. data/platform/wm/rhodes/rho/rubyext/RhoSignature.h +24 -5
  47. data/platform/wm/rhodes/rho/rubyext/calendar.cpp +8 -1
  48. data/platform/wm/tools/detool/detool.cpp +88 -7
  49. data/platform/wm/tools/detool/detool.vcproj +2 -2
  50. data/platform/wm/tools/detool/stdafx.h +1 -0
  51. data/platform/wp7/RhoRubyExtGen/RhoSyncEngine.cs +2 -2
  52. data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +4 -4
  53. data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +8 -3
  54. data/platform/wp7/RhoRubyLib/net/HttpServer.cs +25 -6
  55. data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
  56. data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +23 -13
  57. data/platform/wp7/RhoRubyLib/sync/SyncProtocol_3.cs +6 -1
  58. data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +33 -2
  59. data/platform/wp7/build/wp.rake +52 -0
  60. data/rakefile.rb +1 -1
  61. data/res/build-tools/detool.exe +0 -0
  62. data/res/generators/rhogen.rb +5 -0
  63. data/res/generators/templates/application/app/Settings/controller.rb +1 -1
  64. data/res/generators/templates/application/app/Settings/err_sync.erb +11 -0
  65. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Montana.sln +22 -0
  66. data/res/generators/templates/extension/extensions/montana/ext/montana/platform/wm/Rakefile +2 -2
  67. data/spec/phone_spec/app/SpecRunner/index.erb +0 -1
  68. data/spec/phone_spec/app/spec/asynchttp_spec.rb +1 -11
  69. data/spec/phone_spec/app/spec/blobsync_spec.rb +7 -2
  70. data/spec/phone_spec/app/spec/date_spec.rb +1 -1
  71. data/spec/phone_spec/app/spec/json_spec.rb +0 -3
  72. data/spec/phone_spec/app/spec/syncengine_spec.rb +6 -2
  73. data/spec/phone_spec/app/spec_runner.rb +10 -7
  74. data/version +1 -1
  75. metadata +9 -9
  76. data/platform/wm/tools/wmdc_connect/stdafx.cpp +0 -27
  77. data/platform/wm/tools/wmdc_connect/stdafx.h +0 -35
  78. data/platform/wm/tools/wmdc_connect/wmdc_connect.cpp +0 -119
  79. data/platform/wm/tools/wmdc_connect/wmdc_connect.vcproj +0 -205
  80. data/platform/wm/tools/wmdc_connect.sln +0 -20
@@ -74,16 +74,35 @@ public:
74
74
 
75
75
  class CRhoSignatureWindow : public CDialogImpl <CRhoSignatureWindow>
76
76
  {
77
- void* m_pInkImpl;
77
+ struct CSigPoint
78
+ {
79
+ short m_xPos;
80
+ short m_yPos;
81
+ bool m_bNewLine;
82
+
83
+ CSigPoint() : m_xPos(-1), m_yPos(-1), m_bNewLine(false){}
84
+ CSigPoint( int x, int y, bool bNewLine ) : m_xPos(x), m_yPos(y), m_bNewLine(bNewLine){}
85
+ };
86
+
87
+ //bool m_bSigning;
88
+ //int m_nCurPoint;
89
+ CPoint m_ptLast;
90
+ bool m_bOutOfSignature, m_bCapture;
91
+ Vector<CSigPoint> m_vecPoints;
92
+ bool m_bDoVectors;
93
+
94
+ void addNewPoint(int x, int y, bool bNewLine);
95
+ void sendVectors();
96
+ void drawLastStroke();
97
+
78
98
  CRhoSignature::CParams* m_pParams;
79
99
  HRESULT m_hResult;
80
100
  HWND m_hWndCommandBar;
81
101
 
82
- HBITMAP getScreenBitmap();
83
- HRESULT saveBitmapToFile( HBITMAP hBitmap, LPCTSTR filename, LPCTSTR format);
84
-
102
+ HRESULT saveBitmapToFileByImageFactory( HBITMAP hBitmap, LPCTSTR filename, LPCTSTR format);
103
+ void drawSignature( CDC& oDC, CRect& rcDraw );
85
104
  public:
86
- CRhoSignatureWindow(CRhoSignature::CParams* pParams) : m_pInkImpl(0), m_pParams(pParams), m_hWndCommandBar(0){}
105
+ CRhoSignatureWindow(CRhoSignature::CParams* pParams) : m_pParams(pParams), m_hWndCommandBar(0), m_bDoVectors(false), m_bOutOfSignature(false), m_bCapture(false){}
87
106
  ~CRhoSignatureWindow(){ delete m_pParams; }
88
107
 
89
108
  enum { IDD = IDD_TAKE_SIGNATURE };
@@ -83,7 +83,14 @@ static void addVariantTimeToHash(VALUE hash, const char* key, DATE time)
83
83
  static DATE dateFromRuby(VALUE rDate)
84
84
  {
85
85
  SYSTEMTIME sysTime = {0};
86
- UnixTimeToSystemTime(rho_ruby_get_time(rDate), &sysTime );
86
+ // UnixTimeToSystemTime(rho_ruby_get_time(rDate), &sysTime );
87
+ rDate = rho_ruby_get_time(rDate);
88
+ sysTime.wYear = (WORD)rho_ruby_get_time_part(rDate, "year");
89
+ sysTime.wMonth = (WORD)rho_ruby_get_time_part(rDate, "month");
90
+ sysTime.wDay = (WORD)rho_ruby_get_time_part(rDate, "day");
91
+ sysTime.wHour = (WORD)rho_ruby_get_time_part(rDate, "hour");
92
+ sysTime.wMinute = (WORD)rho_ruby_get_time_part(rDate, "min");
93
+ sysTime.wSecond = (WORD)rho_ruby_get_time_part(rDate, "sec");
87
94
 
88
95
  DATE time = 0;
89
96
  SystemTimeToVariantTime(&sysTime, &time);
@@ -398,8 +398,9 @@ FatalError:
398
398
 
399
399
  bool wceRunProcess(const char *process, const char *args)
400
400
  {
401
- HRESULT hRapiResult;
401
+ #ifndef UNICODE
402
402
  HRESULT hr;
403
+ #endif
403
404
  PROCESS_INFORMATION pi;
404
405
  WCHAR wszProgram[MAX_PATH];
405
406
  WCHAR wszArgs[MAX_PATH];
@@ -694,6 +695,75 @@ void startLogServer( TCHAR * log_file, TCHAR* log_port )
694
695
  WSACleanup();
695
696
  }
696
697
 
698
+ void simulateKeyInput (int vk, BOOL bExtended, BOOL doDown, BOOL doUp)
699
+ {
700
+ KEYBDINPUT kb = {0};
701
+ INPUT Input = {0};
702
+ if (doDown) {
703
+ // generate down
704
+ if (bExtended)
705
+ kb.dwFlags = KEYEVENTF_EXTENDEDKEY;
706
+ kb.wVk = vk;
707
+ Input.type = INPUT_KEYBOARD;
708
+ Input.ki = kb;
709
+ ::SendInput(1,&Input,sizeof(Input));
710
+ }
711
+ if (doUp) {
712
+ // generate up
713
+ ::ZeroMemory(&kb,sizeof(KEYBDINPUT));
714
+ ::ZeroMemory(&Input,sizeof(INPUT));
715
+ kb.dwFlags = KEYEVENTF_KEYUP;
716
+ if (bExtended)
717
+ kb.dwFlags |= KEYEVENTF_EXTENDEDKEY;
718
+ kb.wVk = vk;
719
+ Input.type = INPUT_KEYBOARD;
720
+ Input.ki = kb;
721
+ ::SendInput(1,&Input,sizeof(Input));
722
+ }
723
+ }
724
+
725
+ bool doUseWMDC() {
726
+ OSVERSIONINFOW os_version;
727
+ ZeroMemory(&os_version, sizeof(OSVERSIONINFO));
728
+ os_version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
729
+ ::GetVersionEx(&os_version);
730
+ return (os_version.dwMajorVersion >= 6);
731
+ }
732
+
733
+ HWND findWMDCWindow() {
734
+ return FindWindow(NULL, L"Windows Mobile Device Center");
735
+ }
736
+
737
+ void startWMDC() {
738
+ if (doUseWMDC()) {
739
+ if (findWMDCWindow() == 0) {
740
+ _tprintf( TEXT("WMDC is not running. Starting WMDC...\n") );
741
+ ::system("start %WINDIR%\\WindowsMobile\\wmdc.exe /show");
742
+ ::Sleep(5000);
743
+ }
744
+ }
745
+ }
746
+
747
+ void connectWMDC() {
748
+ if (doUseWMDC()) {
749
+ HWND hwnd = findWMDCWindow();
750
+ if (hwnd == 0) {
751
+ _tprintf( TEXT("Cannot find WMDC window to establish network connection to device emulator.\n") );
752
+ } else {
753
+ ::SetForegroundWindow(hwnd);
754
+ ::SetFocus(hwnd);
755
+ ::LockSetForegroundWindow(LSFW_LOCK);
756
+ ::Sleep(100);
757
+ simulateKeyInput(VK_MENU, TRUE, TRUE, FALSE);
758
+ ::Sleep(20);
759
+ simulateKeyInput('C', FALSE, TRUE, TRUE);
760
+ ::Sleep(20);
761
+ simulateKeyInput(VK_MENU, TRUE, FALSE, TRUE);
762
+ ::LockSetForegroundWindow(LSFW_UNLOCK);
763
+ }
764
+ }
765
+ }
766
+
697
767
  int _tmain(int argc, _TCHAR* argv[])
698
768
  {
699
769
  TCHAR *emu_name = NULL;
@@ -796,6 +866,8 @@ int _tmain(int argc, _TCHAR* argv[])
796
866
  printf ("Failed to connect to remote device.\n");
797
867
  goto stop_emu_deploy;
798
868
  } else {
869
+ // start Windows Mobile Device Center for network connectivity of the device emulator (if applicable)
870
+ startWMDC();
799
871
 
800
872
  hFind = CeFindFirstFile(app_dir, &findData);
801
873
  if (INVALID_HANDLE_VALUE == hFind) {
@@ -846,6 +918,9 @@ int _tmain(int argc, _TCHAR* argv[])
846
918
  goto stop_emu_deploy;
847
919
  }
848
920
 
921
+ // establish network connectivity of the device emulator from Windows Mobile Device Center (if applicable)
922
+ connectWMDC();
923
+
849
924
  emuBringToFront(emu_name);
850
925
 
851
926
  _tprintf( TEXT("Starting application..."));
@@ -893,6 +968,9 @@ int _tmain(int argc, _TCHAR* argv[])
893
968
  }
894
969
  _tprintf( TEXT("DONE\n"));
895
970
 
971
+ // start Windows Mobile Device Center for network connectivity of the device emulator (if applicable)
972
+ startWMDC();
973
+
896
974
  _tprintf( TEXT("Loading cab file..."));
897
975
  if (!wcePutFile (T2A(cab_file), "")) {
898
976
  _tprintf( TEXT("FAILED\n"));
@@ -906,7 +984,7 @@ int _tmain(int argc, _TCHAR* argv[])
906
984
  goto stop_emu_deploy;
907
985
  }
908
986
  _tprintf( TEXT("DONE\n"));
909
-
987
+
910
988
  _tprintf( TEXT("Setup application..."));
911
989
 
912
990
  //FIXME: rake gives pathname with unix-like '/' file separators,
@@ -923,6 +1001,9 @@ int _tmain(int argc, _TCHAR* argv[])
923
1001
  }
924
1002
  _tprintf( TEXT("DONE\n"));
925
1003
 
1004
+ // establish network connectivity of the device emulator from Windows Mobile Device Center (if applicable)
1005
+ connectWMDC();
1006
+
926
1007
  emuBringToFront(emu_name);
927
1008
 
928
1009
  _tprintf( TEXT("Starting application..."));
@@ -934,7 +1015,7 @@ int _tmain(int argc, _TCHAR* argv[])
934
1015
 
935
1016
  TCHAR params[128];
936
1017
  _tcscpy(params, _T("-log="));
937
- _tcscpy(params, log_port);
1018
+ _tcscat(params, log_port);
938
1019
 
939
1020
  if(!wceRunProcess(T2A(params_buf), T2A(params))) {
940
1021
  _tprintf( TEXT("FAILED\n"));
@@ -1027,7 +1108,7 @@ int _tmain(int argc, _TCHAR* argv[])
1027
1108
 
1028
1109
  TCHAR params[128];
1029
1110
  _tcscpy(params, _T("-log="));
1030
- _tcscpy(params, log_port);
1111
+ _tcscat(params, log_port);
1031
1112
 
1032
1113
  if(!wceRunProcess(T2A(params_buf), T2A(params))) {
1033
1114
  _tprintf( TEXT("FAILED\n"));
@@ -1100,7 +1181,7 @@ int _tmain(int argc, _TCHAR* argv[])
1100
1181
 
1101
1182
  TCHAR params[128];
1102
1183
  _tcscpy(params, _T("-log="));
1103
- _tcscpy(params, log_port);
1184
+ _tcscat(params, log_port);
1104
1185
 
1105
1186
  if(!wceRunProcess (T2A(params_buf), T2A(params))) {
1106
1187
  _tprintf( TEXT("FAILED\n"));
@@ -1161,8 +1242,8 @@ int _tmain(int argc, _TCHAR* argv[])
1161
1242
 
1162
1243
  if (deploy_type == DEPLOY_EMU_WEBKIT)
1163
1244
  {
1164
- HANDLE hFind;
1165
- CE_FIND_DATA findData;
1245
+ //HANDLE hFind;
1246
+ //CE_FIND_DATA findData;
1166
1247
 
1167
1248
  _tprintf( TEXT("Searching for Windows CE device..."));
1168
1249
 
@@ -119,7 +119,7 @@
119
119
  Name="VCCLCompilerTool"
120
120
  Optimization="2"
121
121
  EnableIntrinsicFunctions="true"
122
- AdditionalIncludeDirectories="&quot;C:\Program Files\Windows Mobile 6 SDK\Activesync\inc&quot;"
122
+ AdditionalIncludeDirectories="&quot;C:\Program Files (x86)\Windows Mobile 6 SDK\Activesync\inc&quot;"
123
123
  PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
124
124
  RuntimeLibrary="2"
125
125
  EnableFunctionLevelLinking="true"
@@ -140,7 +140,7 @@
140
140
  Name="VCLinkerTool"
141
141
  AdditionalDependencies="rapi.lib Ws2_32.lib"
142
142
  LinkIncremental="1"
143
- AdditionalLibraryDirectories="C:\Program Files\Windows Mobile 6 SDK\Activesync\Lib"
143
+ AdditionalLibraryDirectories="C:\Program Files (x86)\Windows Mobile 6 SDK\Activesync\Lib"
144
144
  GenerateDebugInformation="true"
145
145
  SubSystem="1"
146
146
  OptimizeReferences="2"
@@ -37,6 +37,7 @@
37
37
 
38
38
  #include <atlbase.h>
39
39
  #include <atlstr.h>
40
+ #include <windows.h>
40
41
 
41
42
  //Device Emulator interface
42
43
  #import "DEMComInterface.tlb" no_namespace raw_interfaces_only
@@ -37,7 +37,7 @@ namespace rho.rubyext
37
37
  public static class RhoSyncEngine
38
38
  {
39
39
  [RubyMethod("dosync", RubyMethodAttributes.PublicSingleton)]
40
- public static object dosync(RubyModule/*!*/ self, RubyArray args)
40
+ public static object dosync(RubyModule/*!*/ self, params object[] args)
41
41
  {
42
42
  return null;
43
43
  }
@@ -49,7 +49,7 @@ namespace rho.rubyext
49
49
  }*/
50
50
 
51
51
  [RubyMethod("dosync_source", RubyMethodAttributes.PublicSingleton)]
52
- public static object dosync_source(RubyModule/*!*/ self, RubyArray args)
52
+ public static object dosync_source(RubyModule/*!*/ self, params object[] args)
53
53
  {
54
54
  return null;
55
55
  }
@@ -285,13 +285,13 @@ namespace rho.rubyext {
285
285
  );
286
286
 
287
287
  DefineLibraryMethod(module, "dosync", 0x21,
288
- 0x00000000U,
289
- new Func<IronRuby.Builtins.RubyModule, IronRuby.Builtins.RubyArray, System.Object>(rho.rubyext.RhoSyncEngine.dosync)
288
+ 0x80000000U,
289
+ new Func<IronRuby.Builtins.RubyModule, System.Object[], System.Object>(rho.rubyext.RhoSyncEngine.dosync)
290
290
  );
291
291
 
292
292
  DefineLibraryMethod(module, "dosync_source", 0x21,
293
- 0x00000000U,
294
- new Func<IronRuby.Builtins.RubyModule, IronRuby.Builtins.RubyArray, System.Object>(rho.rubyext.RhoSyncEngine.dosync_source)
293
+ 0x80000000U,
294
+ new Func<IronRuby.Builtins.RubyModule, System.Object[], System.Object>(rho.rubyext.RhoSyncEngine.dosync_source)
295
295
  );
296
296
 
297
297
  DefineLibraryMethod(module, "enable_status_popup", 0x21,
@@ -289,6 +289,11 @@ namespace rho.common
289
289
  }
290
290
  }
291
291
 
292
+ processInvokeScriptArgs(arr[0], arrParams, index);
293
+ }
294
+
295
+ public void processInvokeScriptArgs(String strFuncName, String[] arrParams, int index)
296
+ {
292
297
  m_webBrowser.Dispatcher.BeginInvoke(() =>
293
298
  {
294
299
  try
@@ -297,17 +302,17 @@ namespace rho.common
297
302
  {
298
303
  if (m_tabControl != null && m_tabControl.Items.Count > 0)
299
304
  {
300
- ((RhoView)((TabItem)m_tabControl.Items[index]).Content).webBrowser1.InvokeScript(arr[0], arrParams);
305
+ ((RhoView)((TabItem)m_tabControl.Items[index]).Content).webBrowser1.InvokeScript(strFuncName, arrParams);
301
306
  }
302
307
  }
303
308
  else
304
309
  {
305
- m_webBrowser.InvokeScript(arr[0], arrParams);
310
+ m_webBrowser.InvokeScript(strFuncName, arrParams);
306
311
  }
307
312
  }
308
313
  catch (Exception exc)
309
314
  {
310
- LOG.ERROR("WebView.execute_js failed: " + arr[0] + "(" + String.Join(",", arrParams), exc);
315
+ LOG.ERROR("WebView.execute_js failed: " + strFuncName + "(" + String.Join(",", arrParams), exc);
311
316
  }
312
317
  });
313
318
  }
@@ -67,11 +67,12 @@ namespace rho.net
67
67
  CRoute m_route;
68
68
  CHttpServer m_Parent;
69
69
  int m_nCommand;
70
+ String m_strAjaxContext;
70
71
 
71
72
  public const int scDispatch = 1, scIndex = 2;
72
73
 
73
- public CServerCommand(CHttpServer Parent, CRoute route,
74
- String method, String uri, String query, String body, int nCommand)
74
+ public CServerCommand(CHttpServer Parent, CRoute route,
75
+ String method, String uri, String query, String body, int nCommand, String strAjaxContext)
75
76
  {
76
77
  m_Parent = Parent;
77
78
  m_method = method;
@@ -80,6 +81,7 @@ namespace rho.net
80
81
  m_body = body;
81
82
  m_route = route;
82
83
  m_nCommand = nCommand;
84
+ m_strAjaxContext = strAjaxContext;
83
85
  }
84
86
 
85
87
  public void execute()
@@ -90,7 +92,22 @@ namespace rho.net
90
92
  else if ( m_nCommand == scIndex )
91
93
  strUrl = m_Parent.processIndex(m_route, m_method, m_uri, m_query, m_body);
92
94
 
93
- RHODESAPP().processWebNavigate(strUrl, -1);
95
+ if (m_strAjaxContext == null || m_strAjaxContext.length() == 0)
96
+ {
97
+ RHODESAPP().processWebNavigate(strUrl, -1);
98
+ }
99
+ else
100
+ {
101
+ String res = CRhoFile.isResourceFileExist(strUrl) ? CRhoFile.readStringFromResourceFile(strUrl) : CRhoFile.readStringFromFile(strUrl);
102
+
103
+ String[] args = new String[4];
104
+ args[0] = m_strAjaxContext;
105
+ args[1] = res;
106
+ args[2] = "ok";
107
+ args[3] = "200";
108
+
109
+ RHODESAPP().processInvokeScriptArgs("RhodesAjaxResult", args, RHODESAPP().getCurrentTab());
110
+ }
94
111
  }
95
112
 
96
113
  public boolean equals(IQueueCommand cmd) { return false; }
@@ -122,8 +139,10 @@ namespace rho.net
122
139
  (pCmd as CServerCommand).execute();
123
140
  }
124
141
 
125
- public boolean processBrowserRequest(Uri uri)
142
+ public boolean processBrowserRequest(Uri uri, String strAjaxContext)
126
143
  {
144
+ boolean bAjaxCall = !(strAjaxContext == null || strAjaxContext.length() == 0);
145
+
127
146
  if (!uri.OriginalString.StartsWith(RHODESAPP().getHomeUrl())
128
147
  && (uri.IsAbsoluteUri || uri.OriginalString.StartsWith("res:")))
129
148
  return false;
@@ -149,7 +168,7 @@ namespace rho.net
149
168
  CRoute route = new CRoute();
150
169
  if (dispatch(url, route))
151
170
  {
152
- addQueueCommand(new CServerCommand(this, route, "GET", url, query, "", CServerCommand.scDispatch));
171
+ addQueueCommand(new CServerCommand(this, route, bAjaxCall ? "POST" : "GET", url, query, "", CServerCommand.scDispatch, strAjaxContext));
153
172
 
154
173
  return true;
155
174
  }
@@ -159,7 +178,7 @@ namespace rho.net
159
178
  String strIndexFile = getIndex(fullPath);
160
179
  if (strIndexFile.Length > 0)
161
180
  {
162
- addQueueCommand(new CServerCommand(this, route, "GET", url, query, "", CServerCommand.scIndex));
181
+ addQueueCommand(new CServerCommand(this, route, bAjaxCall ? "POST" : "GET", url, query, "", CServerCommand.scIndex, strAjaxContext));
163
182
 
164
183
  return true;
165
184
  }
@@ -467,7 +467,7 @@ namespace rho.net
467
467
 
468
468
  if ((strBody != null && strBody.length() > 0) || m_isPullFile || m_isMultiPart)
469
469
  {
470
- if (oSession != null)
470
+ if (oSession != null && !m_isPullFile)
471
471
  m_webRequest.ContentType = oSession.getContentType();
472
472
  else if (m_isMultiPart)
473
473
  m_webRequest.ContentType = "multipart/form-data; boundary=----------A6174410D6AD474183FDE48F5662FCC5";
@@ -43,21 +43,26 @@ namespace rho.rubyext
43
43
  static CRhoRuby RhoRuby { get { return CRhoRuby.Instance; } }
44
44
 
45
45
  [RubyMethod("dosync", RubyMethodAttributes.PublicSingleton)]
46
- public static object dosync(RubyModule/*!*/ self, RubyArray args)
46
+ public static object dosync(RubyModule/*!*/ self, params object[] args)
47
47
  {
48
48
  object res = null;
49
49
  try
50
50
  {
51
51
  boolean bShowStatus = true;
52
52
  String query_params = "";
53
- if ( args != null && args.Count > 0 )
53
+ if ( args != null && args.Length > 0 )
54
54
  {
55
- String str = ((MutableString)args[0]).ToString();
56
- //bShowStatus = args[0].Equals(RubyConstant.QTRUE)||"true".equalsIgnoreCase(str);
57
- bShowStatus = "true".equalsIgnoreCase(str);
55
+ if (args[0] is int)
56
+ bShowStatus = ((int)args[0]).Equals(1);
57
+ else
58
+ {
59
+ String str = ((MutableString)args[0]).ToString();
60
+ //bShowStatus = args[0].Equals(RubyConstant.QTRUE)||"true".equalsIgnoreCase(str);
61
+ bShowStatus = "true".equalsIgnoreCase(str);
62
+ }
58
63
  }
59
64
 
60
- if (args != null && args.Count > 1)
65
+ if (args != null && args.Length > 1)
61
66
  query_params = ((MutableString)args[1]).ToString();
62
67
 
63
68
  SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, bShowStatus, query_params));
@@ -103,7 +108,7 @@ namespace rho.rubyext
103
108
  }*/
104
109
 
105
110
  [RubyMethod("dosync_source", RubyMethodAttributes.PublicSingleton)]
106
- public static object dosync_source(RubyModule/*!*/ self, RubyArray args)
111
+ public static object dosync_source(RubyModule/*!*/ self, params object[] args)
107
112
  {
108
113
  object res = null;
109
114
  try
@@ -127,14 +132,19 @@ namespace rho.rubyext
127
132
 
128
133
  boolean bShowStatus = true;
129
134
  String query_params = "";
130
- if ( args != null && args.Count > 1 )
135
+ if ( args != null && args.Length > 1 )
131
136
  {
132
- String str = ((MutableString)args[1]).ToString();
133
- //bShowStatus = args[0].Equals(RubyConstant.QTRUE)||"true".equalsIgnoreCase(str);
134
- bShowStatus = "true".equalsIgnoreCase(str);
137
+ if (args[1] is int)
138
+ bShowStatus = ((int)args[1]).Equals(1);
139
+ else
140
+ {
141
+ String str = ((MutableString)args[1]).ToString();
142
+ //bShowStatus = args[0].Equals(RubyConstant.QTRUE)||"true".equalsIgnoreCase(str);
143
+ bShowStatus = "true".equalsIgnoreCase(str);
144
+ }
135
145
  }
136
-
137
- if (args != null && args.Count > 2)
146
+
147
+ if (args != null && args.Length > 2)
138
148
  query_params = ((MutableString)args[2]).ToString();
139
149
 
140
150
  SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncOne, strName, nSrcID, bShowStatus, query_params));
@@ -17,7 +17,12 @@ namespace rho.sync
17
17
 
18
18
  public String getLoginUrl()
19
19
  {
20
- return RhoConf.getInstance().getPath("syncserver") + "clientlogin";
20
+ if (RhoConf.getInstance().getPath("syncserver").Equals("http://rhoconnect-spec-wp.heroku.com/application/"))
21
+ return "http://rhoconnect-spec-wp.heroku.com/api/application/clientlogin";
22
+ else if (RhoConf.getInstance().getPath("syncserver").Equals("http://rhodes-samples-server.heroku.com/application/"))
23
+ return "http://rhodes-samples-server.heroku.com/api/application/clientlogin";
24
+ else
25
+ return RhoConf.getInstance().getPath("syncserver") + "clientlogin";
21
26
  }
22
27
 
23
28
  public String getLoginBody(String name, String password)
@@ -39,11 +39,15 @@ using Microsoft.Phone.Controls;
39
39
  using System.Windows.Navigation;
40
40
  using IronRuby.Builtins;
41
41
  using rho.common;
42
+ using System.IO;
42
43
 
43
44
  namespace rho.views
44
45
  {
45
46
  public partial class RhoView : UserControl
46
47
  {
48
+ private static RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
49
+ new RhoLogger("RhoView");
50
+
47
51
  private Stack<Uri> m_backHistory = new Stack<Uri>();
48
52
  private Stack<Uri> m_forwardHistory = new Stack<Uri>();
49
53
  /// <summary>
@@ -59,6 +63,7 @@ namespace rho.views
59
63
  private bool m_reload = false;
60
64
  private bool m_loadFirstTime = true;
61
65
  private bool m_masterView = false;
66
+ private const string AJAX_CONTEXT_PARAM = "_rho_callbackId";
62
67
  //TO DO history. each time we have to save our current state of rhodesapp in rhoview entity
63
68
  public Stack<Uri> BackHistory { set { m_backHistory = value; } }
64
69
  public Stack<Uri> ForwardHistory { set { m_forwardHistory = value; } }
@@ -74,6 +79,7 @@ namespace rho.views
74
79
  //webBrowser1.LoadCompleted += WebBrowser_OnLoadCompleted;
75
80
  webBrowser1.Navigating += WebBrowser_OnNavigating;
76
81
  webBrowser1.Navigated += WebBrowser_OnNavigated;
82
+ webBrowser1.ScriptNotify += WebBrowser_OnScriptNotify;
77
83
  }
78
84
 
79
85
  public RhoView(PhoneApplicationPage mainPage, Grid layoutRoot, String strAction,
@@ -86,7 +92,7 @@ namespace rho.views
86
92
  //webBrowser1.LoadCompleted += WebBrowser_OnLoadCompleted;
87
93
  webBrowser1.Navigating += WebBrowser_OnNavigating;
88
94
  webBrowser1.Navigated += WebBrowser_OnNavigated;
89
- //webBrowser1.ScriptNotify += WebBrowser_OnScriptNotify;
95
+ webBrowser1.ScriptNotify += WebBrowser_OnScriptNotify;
90
96
  m_mainPage = mainPage;
91
97
  m_strAction = strAction;
92
98
  m_layoutRoot = layoutRoot;
@@ -134,7 +140,7 @@ namespace rho.views
134
140
 
135
141
  private void WebBrowser_OnNavigating(object sender, NavigatingEventArgs e)
136
142
  {
137
- if (!RHODESAPP().HttpServer.processBrowserRequest(e.Uri))
143
+ if (!RHODESAPP().HttpServer.processBrowserRequest(e.Uri, null))
138
144
  return;
139
145
 
140
146
  e.Cancel = true;
@@ -145,6 +151,31 @@ namespace rho.views
145
151
  RHODESAPP().addToHistory(e.Uri);
146
152
  }
147
153
 
154
+ private string extractAjaxContext(string uri)
155
+ {
156
+ int idx = uri.indexOf(AJAX_CONTEXT_PARAM) + AJAX_CONTEXT_PARAM.length();
157
+ if (-1 == idx)
158
+ return null;
159
+
160
+ string context = uri.substring(idx + 1); // +1 due to the '=' sign after param name
161
+
162
+ idx = context.indexOf('&');
163
+ if (-1 < idx)
164
+ context = context.substring(0, idx);
165
+
166
+ return context;
167
+ }
168
+
169
+ private void WebBrowser_OnScriptNotify(object sender, NotifyEventArgs e)
170
+ {
171
+ string ajaxContext = extractAjaxContext(e.Value);
172
+ if (!RHODESAPP().HttpServer.processBrowserRequest(new Uri(e.Value, UriKind.Relative), ajaxContext))
173
+ {
174
+ LOG.ERROR("External requests should be filtered in javascript");
175
+ }
176
+
177
+ }
178
+
148
179
  public void refresh()
149
180
  {
150
181
  WebBrowser_OnLoaded(this, null);
@@ -417,6 +417,58 @@ namespace "run" do
417
417
  $rhosim_config = "platform='wp'\r\n"
418
418
  Rake::Task["run:rhosimulator_debug"].invoke
419
419
  end
420
+
421
+ task :spec do
422
+ Rake::Task["run:wp"].invoke
423
+ Jake.before_run_spec
424
+ log_file = getLogPath
425
+
426
+ puts "waiting for log: " + log_file
427
+
428
+ for i in 0..120
429
+ if !File.exist?(log_file)
430
+ sleep(1)
431
+ else
432
+ break
433
+ end
434
+ end
435
+
436
+ if !File.exist?(log_file)
437
+ puts "Can not read log file: " + log_file
438
+ exit(1)
439
+ end
440
+
441
+ puts "start read log"
442
+
443
+ io = File.new(log_file, "r")
444
+ waiting_count = 0
445
+ end_spec = false
446
+ while !end_spec do
447
+ line_count = 0
448
+ io.each do |line|
449
+ #puts line
450
+ end_spec = !Jake.process_spec_output(line)
451
+ break if end_spec
452
+ line_count += 1
453
+ end
454
+ if line_count==0
455
+ waiting_count += 1
456
+ else
457
+ waiting_count = 0
458
+ end
459
+ if waiting_count > 240
460
+ puts "spec application hung (240 seconds timeout)"
461
+ end_spec = true
462
+ end
463
+ sleep(1) unless end_spec
464
+ end
465
+ io.close
466
+
467
+ Jake.process_spec_results(start)
468
+
469
+ $stdout.flush
470
+ chdir $startdir
471
+ end
420
472
 
421
473
  task :phone_spec do
422
474
  Jake.run_spec_app('wp','phone_spec')
data/rakefile.rb CHANGED
@@ -80,7 +80,7 @@ namespace "framework" do
80
80
  end
81
81
 
82
82
 
83
- $application_build_configs_keys = ['security_token', 'encrypt_database', 'android_title', 'iphone_use_doc_folder', 'iphone_all_in_doc_folder']
83
+ $application_build_configs_keys = ['security_token', 'encrypt_database', 'android_title', 'iphone_db_in_approot', 'iphone_set_approot', 'iphone_userpath_in_approot']
84
84
 
85
85
  def make_application_build_config_header_file
86
86
  f = StringIO.new("", "w+")
Binary file
@@ -388,6 +388,11 @@ module Rhogen
388
388
  template.destination = "extensions/#{name.downcase}/ext/#{name.downcase}/platform/wm/Rakefile"
389
389
  end
390
390
 
391
+ template :extension_wm_vcsol do |template|
392
+ template.source = 'extensions/montana/ext/montana/platform/wm/Montana.sln'
393
+ template.destination = "extensions/#{name.downcase}/ext/#{name.downcase}/platform/wm/#{name.camel_case}.sln"
394
+ end
395
+
391
396
  template :extension_wm_vcproject do |template|
392
397
  template.source = 'extensions/montana/ext/montana/platform/wm/Montana.vcproj'
393
398
  template.destination = "extensions/#{name.downcase}/ext/#{name.downcase}/platform/wm/#{name.camel_case}.vcproj"
@@ -112,6 +112,6 @@ class SettingsController < Rho::RhoController
112
112
  else
113
113
  WebView.navigate( url_for :action => :err_sync, :query => { :msg => @msg } )
114
114
  end
115
- end
115
+ end
116
116
  end
117
117
  end