Ray Zhang 12 éve
szülő
commit
582d711d20
53 módosított fájl, 3019 hozzáadás és 194 törlés
  1. 1 6
      Apex Mobile/AboutViewController.m
  2. 78 6
      Apex Mobile/Apex Mobile.xcodeproj/project.pbxproj
  3. 20 6
      Apex Mobile/Apex Mobile/ApexHistoryViewController.m
  4. 10 1
      Apex Mobile/Apex Mobile/ApexMobileAppDelegate.m
  5. 4 2
      Apex Mobile/Apex Mobile/ApexMobileDB.h
  6. 166 45
      Apex Mobile/Apex Mobile/ApexMobileDB.m
  7. 1 0
      Apex Mobile/Apex Mobile/ApexMobileFirstViewController.m
  8. 9 2
      Apex Mobile/Apex Mobile/ApexMobileNetwork.h
  9. 406 9
      Apex Mobile/Apex Mobile/ApexMobileNetwork.m
  10. 304 42
      Apex Mobile/Apex Mobile/Base.lproj/Main_iPhone.storyboard
  11. 5 7
      Apex Mobile/Apex Mobile/ChangePasswordViewController.m
  12. 4 2
      Apex Mobile/Apex Mobile/Constant.h
  13. 2 2
      Apex Mobile/Apex Mobile/Constant.m
  14. 11 1
      Apex Mobile/Apex Mobile/DetailPageViewController.m
  15. 15 0
      Apex Mobile/Apex Mobile/DocumentsViewController.h
  16. 137 0
      Apex Mobile/Apex Mobile/DocumentsViewController.m
  17. 3 0
      Apex Mobile/Apex Mobile/FunctionSelectViewController.h
  18. 56 8
      Apex Mobile/Apex Mobile/FunctionSelectViewController.m
  19. 14 0
      Apex Mobile/Apex Mobile/HistoryTabBarController.m
  20. 30 1
      Apex Mobile/Apex Mobile/HistoryViewController.m
  21. 17 0
      Apex Mobile/Apex Mobile/Images.xcassets/apex512.imageset/Contents.json
  22. BIN
      Apex Mobile/Apex Mobile/Images.xcassets/apex512.imageset/apex512.png
  23. 17 0
      Apex Mobile/Apex Mobile/Images.xcassets/ic_pdf128.imageset/Contents.json
  24. BIN
      Apex Mobile/Apex Mobile/Images.xcassets/ic_pdf128.imageset/ic_pdf128.png
  25. 18 0
      Apex Mobile/Apex Mobile/LocalDocumentsViewController.h
  26. 271 0
      Apex Mobile/Apex Mobile/LocalDocumentsViewController.m
  27. 4 3
      Apex Mobile/Apex Mobile/LocationDetailViewController.h
  28. 245 13
      Apex Mobile/Apex Mobile/LocationDetailViewController.m
  29. 7 1
      Apex Mobile/Apex Mobile/LocationViewController.h
  30. 28 3
      Apex Mobile/Apex Mobile/LocationViewController.m
  31. 15 0
      Apex Mobile/Apex Mobile/MessageDetailItem.h
  32. 34 0
      Apex Mobile/Apex Mobile/MessageDetailItem.m
  33. 21 0
      Apex Mobile/Apex Mobile/MessageDetailViewController.h
  34. 302 0
      Apex Mobile/Apex Mobile/MessageDetailViewController.m
  35. 15 0
      Apex Mobile/Apex Mobile/MessageItem.h
  36. 34 0
      Apex Mobile/Apex Mobile/MessageItem.m
  37. 20 0
      Apex Mobile/Apex Mobile/MessageViewController.h
  38. 348 0
      Apex Mobile/Apex Mobile/MessageViewController.m
  39. 3 1
      Apex Mobile/Apex Mobile/MyAutocompleteItemsSource.h
  40. 11 6
      Apex Mobile/Apex Mobile/MyAutocompleteItemsSource.m
  41. 3 2
      Apex Mobile/Apex Mobile/MyAutocompleteView.h
  42. 19 11
      Apex Mobile/Apex Mobile/MyAutocompleteView.m
  43. 15 0
      Apex Mobile/Apex Mobile/NewsDetailViewController.h
  44. 72 0
      Apex Mobile/Apex Mobile/NewsDetailViewController.m
  45. 19 1
      Apex Mobile/Apex Mobile/NewsViewController.m
  46. 14 0
      Apex Mobile/Apex Mobile/PdfViewController.h
  47. 55 0
      Apex Mobile/Apex Mobile/PdfViewController.m
  48. 21 3
      Apex Mobile/Apex Mobile/ResultViewController.m
  49. 1 1
      Apex Mobile/Apex Mobile/SearchViewController.h
  50. 64 4
      Apex Mobile/Apex Mobile/SearchViewController.m
  51. 20 5
      Apex Mobile/Apex Mobile/ToolsPanelViewController.m
  52. 1 0
      Apex Mobile/Apex Mobile/openurltest.txt
  53. 29 0
      Apex Mobile/FavoritesViewController.m

+ 1 - 6
Apex Mobile/AboutViewController.m

@@ -57,10 +57,5 @@
     [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
 }
-//- (void)webViewDidFinishLoad:(UIWebView *)webView
-//{
-//    // finished loading, hide the activity indicator in the status bar
-//    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
-//    [self.webview stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '350%'"];
-//}
+
 @end

+ 78 - 6
Apex Mobile/Apex Mobile.xcodeproj/project.pbxproj

@@ -7,6 +7,8 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		711BA6C1191E0525002EDE6F /* MessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 711BA6C0191E0525002EDE6F /* MessageViewController.m */; };
+		711BA6C4191E0553002EDE6F /* MessageItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 711BA6C3191E0553002EDE6F /* MessageItem.m */; };
 		711DC6B218C30A4800FB1749 /* TableCellEdit.m in Sources */ = {isa = PBXBuildFile; fileRef = 711DC6B118C30A4800FB1749 /* TableCellEdit.m */; };
 		7120DCE718BE255000E7546F /* GoogleMaps.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7120DCE618BE255000E7546F /* GoogleMaps.framework */; };
 		7120DCE918BE25B000E7546F /* GoogleMaps.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 7120DCE818BE25B000E7546F /* GoogleMaps.bundle */; };
@@ -31,11 +33,19 @@
 		71286AB918C70061001FDF43 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 71286AB318C70061001FDF43 /* README.md */; };
 		712A301318CFEF550022E6E6 /* CustomizeFieldViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 712A301218CFEF550022E6E6 /* CustomizeFieldViewController.m */; };
 		712CBA0318CF38DB00C61394 /* RTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 712CBA0218CF38DB00C61394 /* RTLabel.m */; };
+		71308AF7191E7B0E0024B2B0 /* MessageDetailItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 71308AF6191E7B0E0024B2B0 /* MessageDetailItem.m */; };
+		71308AFA191E7B2A0024B2B0 /* MessageDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71308AF9191E7B2A0024B2B0 /* MessageDetailViewController.m */; };
 		7130B3F41900FB61000610D8 /* NewsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7130B3F31900FB61000610D8 /* NewsViewController.m */; };
 		71330C2018BCC4DA0048956C /* FunctionSelectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71330C1F18BCC4DA0048956C /* FunctionSelectViewController.m */; };
 		71375C8F18D96EDE00EBA026 /* TabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71375C8E18D96EDE00EBA026 /* TabBarController.m */; };
+		713AA79D191724A200B44092 /* openurltest.txt in Resources */ = {isa = PBXBuildFile; fileRef = 713AA79C191724A200B44092 /* openurltest.txt */; };
+		713AA7A1191736E600B44092 /* DocumentsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 713AA7A0191736E600B44092 /* DocumentsViewController.m */; };
+		713AA7A41917373600B44092 /* LocalDocumentsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 713AA7A31917373600B44092 /* LocalDocumentsViewController.m */; };
+		713AA7A91917833600B44092 /* PdfViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 713AA7A81917833600B44092 /* PdfViewController.m */; };
 		71406DCE18C36A52000914C4 /* TableCellBool.m in Sources */ = {isa = PBXBuildFile; fileRef = 71406DCD18C36A52000914C4 /* TableCellBool.m */; };
 		71406DD118C36A6E000914C4 /* TableCellDate.m in Sources */ = {isa = PBXBuildFile; fileRef = 71406DD018C36A6E000914C4 /* TableCellDate.m */; };
+		714C39B81922FEE1004F045B /* NewsDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 714C39B71922FEE1004F045B /* NewsDetailViewController.m */; };
+		71514ED2191B7E2500009C00 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71514ED1191B7E2500009C00 /* AddressBookUI.framework */; };
 		716FF7921904ED2600ED6C3D /* NewsData.m in Sources */ = {isa = PBXBuildFile; fileRef = 716FF7911904ED2600ED6C3D /* NewsData.m */; };
 		716FF7951904FBC600ED6C3D /* NewsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 716FF7941904FBC600ED6C3D /* NewsTableViewCell.m */; };
 		7170AAE218D7C999003B711C /* LocationDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7170AAE118D7C999003B711C /* LocationDetailViewController.m */; };
@@ -107,6 +117,10 @@
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
+		711BA6BF191E0525002EDE6F /* MessageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageViewController.h; sourceTree = "<group>"; };
+		711BA6C0191E0525002EDE6F /* MessageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageViewController.m; sourceTree = "<group>"; };
+		711BA6C2191E0553002EDE6F /* MessageItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageItem.h; sourceTree = "<group>"; };
+		711BA6C3191E0553002EDE6F /* MessageItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageItem.m; sourceTree = "<group>"; };
 		711DC6B018C30A4800FB1749 /* TableCellEdit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableCellEdit.h; sourceTree = "<group>"; };
 		711DC6B118C30A4800FB1749 /* TableCellEdit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableCellEdit.m; sourceTree = "<group>"; };
 		7120DCE618BE255000E7546F /* GoogleMaps.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GoogleMaps.framework; sourceTree = "<group>"; };
@@ -139,16 +153,30 @@
 		712A301218CFEF550022E6E6 /* CustomizeFieldViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomizeFieldViewController.m; sourceTree = "<group>"; };
 		712CBA0118CF38DB00C61394 /* RTLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTLabel.h; sourceTree = "<group>"; };
 		712CBA0218CF38DB00C61394 /* RTLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RTLabel.m; sourceTree = "<group>"; };
+		71308AF5191E7B0E0024B2B0 /* MessageDetailItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageDetailItem.h; sourceTree = "<group>"; };
+		71308AF6191E7B0E0024B2B0 /* MessageDetailItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageDetailItem.m; sourceTree = "<group>"; };
+		71308AF8191E7B2A0024B2B0 /* MessageDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageDetailViewController.h; sourceTree = "<group>"; };
+		71308AF9191E7B2A0024B2B0 /* MessageDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageDetailViewController.m; sourceTree = "<group>"; };
 		7130B3F21900FB61000610D8 /* NewsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewsViewController.h; sourceTree = "<group>"; };
 		7130B3F31900FB61000610D8 /* NewsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewsViewController.m; sourceTree = "<group>"; };
 		71330C1E18BCC4DA0048956C /* FunctionSelectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionSelectViewController.h; sourceTree = "<group>"; };
 		71330C1F18BCC4DA0048956C /* FunctionSelectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunctionSelectViewController.m; sourceTree = "<group>"; };
 		71375C8D18D96EDE00EBA026 /* TabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TabBarController.h; sourceTree = "<group>"; };
 		71375C8E18D96EDE00EBA026 /* TabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TabBarController.m; sourceTree = "<group>"; };
+		713AA79C191724A200B44092 /* openurltest.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = openurltest.txt; sourceTree = "<group>"; };
+		713AA79F191736E600B44092 /* DocumentsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentsViewController.h; sourceTree = "<group>"; };
+		713AA7A0191736E600B44092 /* DocumentsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DocumentsViewController.m; sourceTree = "<group>"; };
+		713AA7A21917373600B44092 /* LocalDocumentsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalDocumentsViewController.h; sourceTree = "<group>"; };
+		713AA7A31917373600B44092 /* LocalDocumentsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocalDocumentsViewController.m; sourceTree = "<group>"; };
+		713AA7A71917833600B44092 /* PdfViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PdfViewController.h; sourceTree = "<group>"; };
+		713AA7A81917833600B44092 /* PdfViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PdfViewController.m; sourceTree = "<group>"; };
 		71406DCC18C36A52000914C4 /* TableCellBool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableCellBool.h; sourceTree = "<group>"; };
 		71406DCD18C36A52000914C4 /* TableCellBool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableCellBool.m; sourceTree = "<group>"; };
 		71406DCF18C36A6E000914C4 /* TableCellDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableCellDate.h; sourceTree = "<group>"; };
 		71406DD018C36A6E000914C4 /* TableCellDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableCellDate.m; sourceTree = "<group>"; };
+		714C39B61922FEE1004F045B /* NewsDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewsDetailViewController.h; sourceTree = "<group>"; };
+		714C39B71922FEE1004F045B /* NewsDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewsDetailViewController.m; sourceTree = "<group>"; };
+		71514ED1191B7E2500009C00 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; };
 		716FF7901904ED2600ED6C3D /* NewsData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewsData.h; sourceTree = "<group>"; };
 		716FF7911904ED2600ED6C3D /* NewsData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewsData.m; sourceTree = "<group>"; };
 		716FF7931904FBC600ED6C3D /* NewsTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewsTableViewCell.h; sourceTree = "<group>"; };
@@ -261,6 +289,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				71514ED2191B7E2500009C00 /* AddressBookUI.framework in Frameworks */,
 				719E7E3518C0395E003408FF /* libsqlite3.dylib in Frameworks */,
 				7120DD0118BE266000E7546F /* SystemConfiguration.framework in Frameworks */,
 				7120DCFF18BE265100E7546F /* QuartzCore.framework in Frameworks */,
@@ -311,6 +340,19 @@
 			name = AES;
 			sourceTree = "<group>";
 		};
+		713AA79E1917366A00B44092 /* documents */ = {
+			isa = PBXGroup;
+			children = (
+				713AA79F191736E600B44092 /* DocumentsViewController.h */,
+				713AA7A0191736E600B44092 /* DocumentsViewController.m */,
+				713AA7A21917373600B44092 /* LocalDocumentsViewController.h */,
+				713AA7A31917373600B44092 /* LocalDocumentsViewController.m */,
+				713AA7A71917833600B44092 /* PdfViewController.h */,
+				713AA7A81917833600B44092 /* PdfViewController.m */,
+			);
+			name = documents;
+			sourceTree = "<group>";
+		};
 		719A51A618C5A4E40080C075 /* CustomUI */ = {
 			isa = PBXGroup;
 			children = (
@@ -437,8 +479,6 @@
 		719BEC1418FFA60800DFE987 /* tools */ = {
 			isa = PBXGroup;
 			children = (
-				71DA6048190A02CE00683003 /* FavoritesViewController.h */,
-				71DA6049190A02CE00683003 /* FavoritesViewController.m */,
 				719BEC1518FFAB7B00DFE987 /* ToolsPanelViewController.h */,
 				719BEC1618FFAB7B00DFE987 /* ToolsPanelViewController.m */,
 				7130B3F21900FB61000610D8 /* NewsViewController.h */,
@@ -449,16 +489,20 @@
 				716FF7941904FBC600ED6C3D /* NewsTableViewCell.m */,
 				71F67CF419063612004E8462 /* ApexHistoryViewController.h */,
 				71F67CF519063612004E8462 /* ApexHistoryViewController.m */,
-				71BA502C1908ED5700D0BD31 /* CellItemHistory.h */,
-				71BA502D1908ED5700D0BD31 /* CellItemHistory.m */,
-				71BA502F1908ED9100D0BD31 /* HistoryViewController.h */,
-				71BA50301908ED9100D0BD31 /* HistoryViewController.m */,
 				71BA50321908EDCF00D0BD31 /* HistoryTabBarController.h */,
 				71BA50331908EDCF00D0BD31 /* HistoryTabBarController.m */,
+				71BA502F1908ED9100D0BD31 /* HistoryViewController.h */,
+				71BA50301908ED9100D0BD31 /* HistoryViewController.m */,
 				71BA50351908F21500D0BD31 /* HistoryData.h */,
 				71BA50361908F21500D0BD31 /* HistoryData.m */,
+				71DA6048190A02CE00683003 /* FavoritesViewController.h */,
+				71DA6049190A02CE00683003 /* FavoritesViewController.m */,
 				71DA6045190A00F600683003 /* FavoritesData.h */,
 				71DA6046190A00F600683003 /* FavoritesData.m */,
+				71BA502C1908ED5700D0BD31 /* CellItemHistory.h */,
+				71BA502D1908ED5700D0BD31 /* CellItemHistory.m */,
+				714C39B61922FEE1004F045B /* NewsDetailViewController.h */,
+				714C39B71922FEE1004F045B /* NewsDetailViewController.m */,
 			);
 			name = tools;
 			sourceTree = "<group>";
@@ -501,6 +545,7 @@
 		719EF8DF18BB839F00EFFF5F /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				71514ED1191B7E2500009C00 /* AddressBookUI.framework */,
 				719E7E3418C0395E003408FF /* libsqlite3.dylib */,
 				7120DD0018BE266000E7546F /* SystemConfiguration.framework */,
 				7120DCFE18BE265100E7546F /* QuartzCore.framework */,
@@ -527,6 +572,8 @@
 		719EF8E618BB839F00EFFF5F /* Apex Mobile */ = {
 			isa = PBXGroup;
 			children = (
+				71C72714191CFF11001127E0 /* message */,
+				713AA79E1917366A00B44092 /* documents */,
 				719BEC1418FFA60800DFE987 /* tools */,
 				71A003F918D680250057CDFD /* password */,
 				71A541D118D151770017E2BD /* webview */,
@@ -611,10 +658,26 @@
 			isa = PBXGroup;
 			children = (
 				71DA74A718BDDFB5003B46A6 /* about.htm */,
+				713AA79C191724A200B44092 /* openurltest.txt */,
 			);
 			name = resource;
 			sourceTree = "<group>";
 		};
+		71C72714191CFF11001127E0 /* message */ = {
+			isa = PBXGroup;
+			children = (
+				711BA6BF191E0525002EDE6F /* MessageViewController.h */,
+				711BA6C0191E0525002EDE6F /* MessageViewController.m */,
+				711BA6C2191E0553002EDE6F /* MessageItem.h */,
+				711BA6C3191E0553002EDE6F /* MessageItem.m */,
+				71308AF5191E7B0E0024B2B0 /* MessageDetailItem.h */,
+				71308AF6191E7B0E0024B2B0 /* MessageDetailItem.m */,
+				71308AF8191E7B2A0024B2B0 /* MessageDetailViewController.h */,
+				71308AF9191E7B2A0024B2B0 /* MessageDetailViewController.m */,
+			);
+			name = message;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -698,6 +761,7 @@
 			files = (
 				719EF8FF18BB839F00EFFF5F /* Images.xcassets in Resources */,
 				719EF8F418BB839F00EFFF5F /* Main_iPhone.storyboard in Resources */,
+				713AA79D191724A200B44092 /* openurltest.txt in Resources */,
 				71286AB518C70061001FDF43 /* LICENSE in Resources */,
 				7120DCE918BE25B000E7546F /* GoogleMaps.bundle in Resources */,
 				71DA74A818BDDFB5003B46A6 /* about.htm in Resources */,
@@ -736,11 +800,13 @@
 				712CBA0318CF38DB00C61394 /* RTLabel.m in Sources */,
 				71CEE3D718CC559B00052C63 /* ApexMobileNavigationController.m in Sources */,
 				71BA50371908F21500D0BD31 /* HistoryData.m in Sources */,
+				713AA7A91917833600B44092 /* PdfViewController.m in Sources */,
 				71A541D418D151C70017E2BD /* WebViewController.m in Sources */,
 				71330C2018BCC4DA0048956C /* FunctionSelectViewController.m in Sources */,
 				718BE8B4190F9D970046EA6A /* MySuggestion.m in Sources */,
 				719EF8FD18BB839F00EFFF5F /* ApexMobileSecondViewController.m in Sources */,
 				71AE427318C47AF900B8EC3D /* SearchViewController.m in Sources */,
+				71308AF7191E7B0E0024B2B0 /* MessageDetailItem.m in Sources */,
 				71A565D918C20F5900CDAC07 /* SearchTableAdapter.m in Sources */,
 				719EF8FA18BB839F00EFFF5F /* ApexMobileFirstViewController.m in Sources */,
 				719BEC1718FFAB7B00DFE987 /* ToolsPanelViewController.m in Sources */,
@@ -753,11 +819,14 @@
 				719E7E3318C0368A003408FF /* ApexMobileDB.m in Sources */,
 				719E7E3018C015D0003408FF /* ApexMobileNetwork.m in Sources */,
 				719EF8F118BB839F00EFFF5F /* ApexMobileAppDelegate.m in Sources */,
+				714C39B81922FEE1004F045B /* NewsDetailViewController.m in Sources */,
 				7170AAE218D7C999003B711C /* LocationDetailViewController.m in Sources */,
 				712A301318CFEF550022E6E6 /* CustomizeFieldViewController.m in Sources */,
 				716FF7921904ED2600ED6C3D /* NewsData.m in Sources */,
 				71F67CF619063612004E8462 /* ApexHistoryViewController.m in Sources */,
 				7130B3F41900FB61000610D8 /* NewsViewController.m in Sources */,
+				711BA6C1191E0525002EDE6F /* MessageViewController.m in Sources */,
+				711BA6C4191E0553002EDE6F /* MessageItem.m in Sources */,
 				71BA50311908ED9100D0BD31 /* HistoryViewController.m in Sources */,
 				71A2D76218DC3895001C380A /* LineView.m in Sources */,
 				719A51B418C5A8100080C075 /* ResultViewController.m in Sources */,
@@ -770,9 +839,12 @@
 				719EF8ED18BB839F00EFFF5F /* main.m in Sources */,
 				717D76EB18C7F8120070302D /* Reachability.m in Sources */,
 				7120DD0418BE273900E7546F /* LocationViewController.m in Sources */,
+				71308AFA191E7B2A0024B2B0 /* MessageDetailViewController.m in Sources */,
 				71286AB418C70061001FDF43 /* AESCrypt.m in Sources */,
+				713AA7A1191736E600B44092 /* DocumentsViewController.m in Sources */,
 				716FF7951904FBC600ED6C3D /* NewsTableViewCell.m in Sources */,
 				71A01D7918C9AE77003307A9 /* DetailCellKV.m in Sources */,
+				713AA7A41917373600B44092 /* LocalDocumentsViewController.m in Sources */,
 				71DA604A190A02CE00683003 /* FavoritesViewController.m in Sources */,
 				71BA50341908EDCF00D0BD31 /* HistoryTabBarController.m in Sources */,
 				719A51A918C5A5D30080C075 /* SimpleGridDataSource.m in Sources */,

+ 20 - 6
Apex Mobile/Apex Mobile/ApexHistoryViewController.m

@@ -13,7 +13,20 @@
 @end
 
 @implementation ApexHistoryViewController
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
 
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
 {
     self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
@@ -29,6 +42,7 @@
     NSString *filePath = [[NSBundle mainBundle]pathForResource:@"about" ofType:@"htm"];
     NSString *htmlString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
     [self.webview loadHTMLString:htmlString baseURL:[NSURL URLWithString:filePath]];
+
 }
 
 - (void)didReceiveMemoryWarning
@@ -37,12 +51,12 @@
     // Dispose of any resources that can be recreated.
 }
 
-//- (void)webViewDidFinishLoad:(UIWebView *)webView
-//{
-//    // finished loading, hide the activity indicator in the status bar
-//    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
-//    [self.webview stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '350%'"];
-//}
+- (void)webViewDidFinishLoad:(UIWebView *)webView
+{
+    // finished loading, hide the activity indicator in the status bar
+    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
+    [self.webview stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '120%'"];
+}
 
 /*
 #pragma mark - Navigation

+ 10 - 1
Apex Mobile/Apex Mobile/ApexMobileAppDelegate.m

@@ -10,7 +10,7 @@
 #import "ApexMobileAppDelegate.h"
 #import "ApexMobileDB.h"
 #import "ApexMobileNetwork.h"
-
+#import "AESCrypt.h"
 @implementation ApexMobileAppDelegate
 
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -22,6 +22,13 @@
         DebugLog(@"couldn't init db");
     [[UIApplication sharedApplication] registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
     
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    self.user = [AESCrypt decrypt:[defaults stringForKey:@"user"] password:@"usai"];
+    
+  
+    self.password= [AESCrypt decrypt:[defaults stringForKey:@"password"] password:@"usai"];
+
+    
     return YES;
 }
 -(void)Logout
@@ -33,7 +40,9 @@
     NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
     [defaults setBool:false forKey:@"autologin"];
     
+    
     [defaults synchronize];
+    [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
     //self.duid = nil;
 }
 - (void)applicationWillResignActive:(UIApplication *)application

+ 4 - 2
Apex Mobile/Apex Mobile/ApexMobileDB.h

@@ -9,14 +9,16 @@
 #import <Foundation/Foundation.h>
 #import <sqlite3.h>  
 #import "Constant.h"
-
+#import "ApexMobileAppDelegate.h"
 #define DBNAME    @"ApexMobile.db"  
 
 @interface ApexMobileDB : NSObject
 + (BOOL) initializeDb;
 + (sqlite3*) get_db;
 +(void)execSql:(NSString *)sql db:(sqlite3 *)db;
-
++(NSArray*) get_searchhistory:(NSString*) field;
++(NSArray*) get_Location;
++(void) savehistory:(NSString*) field value:(NSString*) value;
 + (int) get_recordid:(sqlite3*)db table:(NSString*) tablename where:(NSString*) whereclause order:(NSString*) orderby;
 + (int) get_recordid:(sqlite3*)db table:(NSString*) tablename where:(NSString*) whereclause;
 +(BOOL)checkForField:(NSString *)table field:(NSString *)field db:(sqlite3 *)db;

+ 166 - 45
Apex Mobile/Apex Mobile/ApexMobileDB.m

@@ -5,13 +5,13 @@
 //  Created by Ray on 14-2-28.
 //  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
 //
- 
+
 #import "ApexMobileDB.h"
 
 @implementation ApexMobileDB
 + (int) get_recordid:(sqlite3*)db table:(NSString*) tablename where:(NSString*) whereclause
 {
-//    [ApexMobileDB execSql: [NSString stringWithFormat: @"update fields_info set abandon = 1 where user ='%@'",user] db:db];
+    //    [ApexMobileDB execSql: [NSString stringWithFormat: @"update fields_info set abandon = 1 where user ='%@'",user] db:db];
     return [self get_recordid:db table:tablename where:whereclause order:@"_id"];
 }
 
@@ -25,15 +25,15 @@
     {
         if (sqlite3_step(statement) == SQLITE_ROW)
         {
-//            char *name = (char*)sqlite3_column_text(statement, 1);
-//            NSString *nsNameStr = [[NSString alloc]initWithUTF8String:name];
+            //            char *name = (char*)sqlite3_column_text(statement, 1);
+            //            NSString *nsNameStr = [[NSString alloc]initWithUTF8String:name];
             
             ret = sqlite3_column_int(statement, 0);
             
-//            char *address = (char*)sqlite3_column_text(statement, 3);
-//            NSString *nsAddressStr = [[NSString alloc]initWithUTF8String:address];
+            //            char *address = (char*)sqlite3_column_text(statement, 3);
+            //            NSString *nsAddressStr = [[NSString alloc]initWithUTF8String:address];
+            
             
-
         }
         sqlite3_finalize(statement);
     }
@@ -51,8 +51,9 @@
     NSString *database_path = [documents stringByAppendingPathComponent:DBNAME];
     
     if (sqlite3_open([database_path UTF8String], &db) != SQLITE_OK) {
+        
+        DebugLog(@"sqlite3_open failed. msg:%s",sqlite3_errmsg(db));
         sqlite3_close(db);
-         DebugLog(@"sqlite3_open failed. msg:%s",sqlite3_errmsg(db));
     }
     return db;
     
@@ -62,39 +63,142 @@
 {
     char *err;
     if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) != SQLITE_OK) {
-        sqlite3_close(db);
-         DebugLog(@"sqlite3_exec failed msg:%s",sqlite3_errmsg(db));
+        
+        DebugLog(@"sqlite3_exec failed msg:%s",sqlite3_errmsg(db));
         DebugLog(@"sqlite3_exec failed sql:%@",sql);
-
+        sqlite3_close(db);
+        
     }
 }
 +(BOOL)checkForField:(NSString *)table field:(NSString *)field db:(sqlite3 *)db
 {
-
+    
     sqlite3_stmt *stmt;
-        NSString *sql = [NSString stringWithFormat:@"PRAGMA table_info(%@)",table];
-    if (sqlite3_prepare_v2(db, [sql UTF8String], -1, &stmt, NULL) != SQLITE_OK)
+    NSString *sql = [NSString stringWithFormat:@"PRAGMA table_info(%@)",table];
+    if (sqlite3_prepare_v2(db, [sql UTF8String], -1, &stmt, NULL) == SQLITE_OK)
     {
-        return NO;
+        while(sqlite3_step(stmt) == SQLITE_ROW)
+        {
+            
+            NSString *fieldName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(stmt, 1)];
+            if([field isEqualToString:fieldName])
+            {
+                sqlite3_finalize(stmt);
+                return YES;
+            }
+        }
     }
     
-    while(sqlite3_step(stmt) == SQLITE_ROW)
+
+    
+    return NO;
+}
++(NSArray*) get_Location
+{
+    sqlite3* db = [self get_db ];
+    NSMutableArray* ret = [[NSMutableArray alloc] init];
+    NSString *sqlQuery = @"select area,company,city,longitude,latitude,address,telephone,fax,contact,email from locations";
+    sqlite3_stmt * statement;
+    NSMutableDictionary* map = [[NSMutableDictionary alloc] init];
+    
+    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK)
     {
-        
-        NSString *fieldName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(stmt, 1)];
-        if([field isEqualToString:fieldName])
-            return YES;
+        while (sqlite3_step(statement) == SQLITE_ROW)
+        {
+            NSString* area =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)];
+            NSString* company =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)];
+            NSString* city =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 2)];
+            NSString* longitude =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 3)];
+
+            NSString* latitude =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 4)];
+
+            NSString* address =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 5)];
+            NSString* telephone =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 6)];
+            NSString* fax =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 7)];
+            NSString* contact =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 8)];
+            NSString* email =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 9)];
+
+            
+            [map setValue:area forKey:@"area"];
+            [map setValue:company forKey:@"company"];
+            [map setValue:city forKey:@"city"];
+            [map setValue:longitude forKey:@"longitude"];
+            [map setValue:latitude forKey:@"latitude"];
+            [map setValue:address forKey:@"address"];
+            [map setValue:telephone forKey:@"telephone"];
+            [map setValue:fax forKey:@"fax"];
+            [map setValue:contact forKey:@"contact"];
+            [map setValue:email forKey:@"email"];
+
+
+            [ret addObject:map.copy];
+
+            
+            
+        }
+        sqlite3_finalize(statement);
     }
+    sqlite3_close(db);
     
-    return NO;
+    return ret;
+}
++(NSArray*) get_searchhistory:(NSString*) field
+{
+    sqlite3* db = [self get_db ];
+    NSMutableArray* ret = [[NSMutableArray alloc] init];
+    ApexMobileAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
+    NSString* user = appDelegate.user;
+    NSString *sqlQuery = [NSString stringWithFormat:@"select h_val from search_history where h_field='%@' and user='%@' order by h_time desc",field,user];
+    sqlite3_stmt * statement;
+    
+    if (sqlite3_prepare_v2(db, [sqlQuery UTF8String], -1, &statement, nil) == SQLITE_OK)
+    {
+        while (sqlite3_step(statement) == SQLITE_ROW)
+        {
+            //            char *name = (char*)sqlite3_column_text(statement, 1);
+            //            NSString *nsNameStr = [[NSString alloc]initWithUTF8String:name];
+            
+            NSString *val = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)];
+            [ret addObject:val];
+            //            char *address = (char*)sqlite3_column_text(statement, 3);
+            //            NSString *nsAddressStr = [[NSString alloc]initWithUTF8String:address];
+            
+            
+        }
+        sqlite3_finalize(statement);
+    }
+    
+    sqlite3_close(db);
+    
+    return ret;
+}
++(void) savehistory:(NSString*) field value:(NSString*) value
+{
+    sqlite3* db = [self get_db ];
+    ApexMobileAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
+    NSString* user = appDelegate.user;
+    int _id = [self get_recordid:db table:@"search_history" where:[NSString stringWithFormat:@"user='%@' and h_field='%@' and h_val ='%@'",user,field,value]];
+    if(_id>=0)
+    {
+        NSString* sql = [NSString stringWithFormat:@"update search_history set h_time = datetime('now', 'localtime') where _id =%d",_id];
+        [self execSql:sql db:db];
+    }
+    else
+    {
+        NSString* sql = [NSString stringWithFormat:@"insert into search_history(user,h_field,h_val) values('%@','%@','%@')",user,field,value];
+        [self execSql:sql db:db];
+    }
+    
+    
+    sqlite3_close(db);
 }
 + (BOOL) initializeDb {
-     DebugLog (@"initializeDB");
+    DebugLog (@"initializeDB");
     
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
     NSString *documents = [paths objectAtIndex:0];
     NSString *database_path = [documents stringByAppendingPathComponent:DBNAME];
-
+    
     
     // move db file from document to cache ;
     NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
@@ -103,53 +207,70 @@
     if ([[NSFileManager defaultManager] fileExistsAtPath: dbFilePath])
     {
         [[NSFileManager defaultManager] moveItemAtPath:dbFilePath toPath:database_path error:nil];
-       
+        
     }
     // end move;
     
-
     
     
-    sqlite3 *db;  
-  
+    
+
+    
     if (true)//! [[NSFileManager defaultManager] fileExistsAtPath: database_path])
     {
-        
-        if (sqlite3_open([database_path UTF8String], &db) != SQLITE_OK) {
-            sqlite3_close(db);
-             DebugLog(@"open db failed");
-            return NO;
-        }
+        sqlite3 *db = [self get_db];
+//        int ret = sqlite3_close(db);
+//db = [self get_db];
+//        
+//        ret = sqlite3_close(db);
         NSString *create_actions_info = @"CREATE TABLE IF NOT EXISTS actions_info (_id integer PRIMARY KEY,name varchar(20),function_name varchar(20),priority integer,abandon boolean,user varchar(20));";
-       
+        
         NSString *create_fields_info = @"CREATE TABLE IF NOT EXISTS fields_info (_id integer PRIMARY KEY,name varchar(20),aname varchar(20),field_type integer,function_name varchar(20),behavior integer,priority integer,show boolean,abandon boolean,user varchar(20));";
         
-        NSString *create_search_history = @"CREATE TABLE IF NOT EXISTS search_history (_id integer PRIMARY KEY,h_val varchar(20),h_field varchar(20),h_time timestamp default (datetime('now', 'localtime')),user varchar(20));";
-     
+        NSString *create_search_history = @"CREATE TABLE IF NOT EXISTS search_history (_id INTEGER PRIMARY KEY,h_val VARCHAR(20),h_field VARCHAR(20),level INTEGER,h_time TIMESTAMP default (datetime('now', 'localtime')),user VARCHAR(20));";
+        
         NSString* create_push_message =@"CREATE TABLE IF NOT EXISTS push_message (_id INTEGER PRIMARY KEY, s_id VARCHAR(20), e_id VARCHAR(20), msgcount INTEGER, message VARCHAR(20), h_time timestamp default (datetime('now', 'localtime')), create_time timestamp default (datetime('now', 'localtime')), user VARCHAR(20), read BOOLEAN);";
         
 		NSString* create_favorites =@"CREATE TABLE IF NOT EXISTS favorites (_id INTEGER PRIMARY KEY, name VARCHAR(20), params VARCHAR(20), action VARCHAR(20), module_name VARCHAR(20), create_time timestamp default (datetime('now', 'localtime')), user VARCHAR(20));";
 		NSString* create_history=@"CREATE TABLE IF NOT EXISTS history ( _id INTEGER PRIMARY KEY, name VARCHAR(20), params VARCHAR(20), action VARCHAR(20), module_name VARCHAR(20), create_time timestamp default (datetime('now', 'localtime')), user VARCHAR(20));";
         
-//        CREATE TABLE users (_id integer PRIMARY KEY,name varchar(20),pass varchar(20));
+        
+        NSString* create_location=@"CREATE TABLE IF NOT EXISTS locations ( _id INTEGER PRIMARY KEY, area VARCHAR(20), company VARCHAR(20), city VARCHAR(20), longitude VARCHAR(20), latitude VARCHAR(20) ,address VARCHAR(20),  telephone VARCHAR(20) , fax VARCHAR(20), contact VARCHAR(20), email VARCHAR(20));";
+        
+        
+        
+        
+        //        CREATE TABLE users (_id integer PRIMARY KEY,name varchar(20),pass varchar(20));
         [self execSql:create_actions_info db:db];
         [self execSql:create_fields_info db:db];
         [self execSql:create_search_history db:db];
         [self execSql:create_push_message db:db];
         [self execSql:create_favorites db:db];
         [self execSql:create_history db:db];
-       
-       if( ![self checkForField:@"search_history" field:@"level" db:db])
-       {
-        NSString* alter_search_history = @"ALTER TABLE search_history ADD level INTEGER";
+        [self execSql:create_location db:db];
+        
+        
+        if( ![self checkForField:@"search_history" field:@"level" db:db])
+        {
+            NSString* alter_search_history = @"ALTER TABLE search_history ADD level INTEGER";
             [self execSql:alter_search_history db:db];
-       }
-        sqlite3_close(db);
+        }
+        NSTimeInterval time=[[NSDate date] timeIntervalSince1970];
+        double t = time-2592000;      //NSTimeInterval返回的是double类型
+        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+        [formatter setDateFormat:@"yyyy-MM-dd"];
+
+        NSString*timestr=[formatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:t]];
+        
+    //    [self execSql:[NSString stringWithFormat:@"delete from search_history where h_time<%@",timestr ] db:db];
+        [self execSql:@"delete from search_history where julianday('now', 'localtime')-julianday(h_time, 'localtime')>30" db:db];
+        int ret=sqlite3_close(db);
+//        int aaa = 0;
     }
     return YES;
     
-
-     DebugLog (@"bottom of initializeDb");
+    
+    DebugLog (@"bottom of initializeDb");
 }
 
 

+ 1 - 0
Apex Mobile/Apex Mobile/ApexMobileFirstViewController.m

@@ -172,6 +172,7 @@
 //        return;
 //    }
 //    float moveY ;
+    
     if(self.resize)
     {
     NSTimeInterval animationDuration = 0.30f;

+ 9 - 2
Apex Mobile/Apex Mobile/ApexMobileNetwork.h

@@ -14,14 +14,16 @@
 #import "Reachability.h"
 #import "PageData.h"
 #import "DetailContent.h"
-
+#import <MessageUI/MessageUI.h>
+#import <MessageUI/MFMailComposeViewController.h>
 @interface ApexMobileNetwork : NSObject
 +(void)Logout ;
 +(int)Authorize : (NSString*) user password:(NSString*) password ;
 +(int)parse_authinfo : (NSData *) json user:(NSString*) user password:(NSString*) password;
 +(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params;// delegate:(id < NSURLConnectionDelegate >)delegate;
 //+(int) get_announcements: (NSString*)lastid limit:int limit ;//delegate:(id < NSURLConnectionDelegate >)delegate;
-
++(NSData*)pull_message : (int) offset;
++(NSData*)get_MessageDetail: (int) offset limit:(int) limit from:(NSString*) sid to:(NSString*) eid;
 +(NSData*)get_announcements : (NSString*) id limit: (int) limit ;
 +(NSData*)get_marketnews : (NSString*) id limit: (int) limit ;
 +(void)post_without_return : (NSString*) url parameters:(NSMutableDictionary *) params;
@@ -29,9 +31,14 @@
 +(PageData*) get_pagedata: (NSMutableDictionary *) params;
 +(DetailContent*) get_detailcontent: (NSMutableDictionary *) params;
 +(bool) IsNetworkAvailable;
++(int) delAllMessage:(NSString*) before;
 //+(bool) IsHostAvailable : (NSString*) url;
 +(int) RetrievePassword : (NSString*) user  email:(NSString*) email;
 +(int) ChangePassword : (NSString*) newpass user:(NSString*) user oldpass:(NSString*) oldpass;
++(bool) UpdateServiceLocation;
+
+//+(void) testmail;
+//+(void) testmail1 :(UIViewController*) caller;
 @end
 
 

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 406 - 9
Apex Mobile/Apex Mobile/ApexMobileNetwork.m


+ 304 - 42
Apex Mobile/Apex Mobile/Base.lproj/Main_iPhone.storyboard

@@ -28,7 +28,7 @@
         <!--Tab Bar Controller - Apex Mobile-->
         <scene sceneID="o0Y-pF-SrJ">
             <objects>
-                <tabBarController definesPresentationContext="YES" id="7w0-x0-gGx" customClass="TabBarController" sceneMemberID="viewController">
+                <tabBarController storyboardIdentifier="LoginTabBar" definesPresentationContext="YES" useStoryboardIdentifierAsRestorationIdentifier="YES" id="7w0-x0-gGx" customClass="TabBarController" sceneMemberID="viewController">
                     <navigationItem key="navigationItem" title="Apex Mobile" id="rJk-ME-87O"/>
                     <nil key="simulatedBottomBarMetrics"/>
                     <tabBar key="tabBar" contentMode="scaleToFill" translucent="NO" id="MHb-zp-cB2">
@@ -38,8 +38,8 @@
                     </tabBar>
                     <connections>
                         <segue destination="CZ4-MO-1fc" kind="relationship" relationship="viewControllers" id="OKe-H2-ohN"/>
-                        <segue destination="QUy-BD-bpt" kind="relationship" relationship="viewControllers" id="05a-NK-v2D"/>
                         <segue destination="hjf-df-tQU" kind="relationship" relationship="viewControllers" id="xkY-6r-wNm"/>
+                        <segue destination="QUy-BD-bpt" kind="relationship" relationship="viewControllers" id="itG-z0-OzE"/>
                     </connections>
                 </tabBarController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="Bif-3N-9wg" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -70,13 +70,13 @@
                         <rect key="frame" x="0.0" y="0.0" width="320" height="519"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
-                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="6iK-Zr-L65">
+                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="6iK-Zr-L65">
                                 <rect key="frame" x="0.0" y="0.0" width="320" height="499"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
                                 <prototypes>
                                     <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="tools" textLabel="4q9-0q-z26" style="IBUITableViewCellStyleDefault" id="KYN-Iw-fni">
-                                        <rect key="frame" x="0.0" y="86" width="320" height="44"/>
+                                        <rect key="frame" x="0.0" y="119" width="320" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KYN-Iw-fni" id="W5i-oO-Q1V">
                                             <rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
@@ -176,7 +176,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="ZX2-xn-9kp" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="1203" y="-1742"/>
+            <point key="canvasLocation" x="721" y="-1742"/>
         </scene>
         <!--Apex Mobile First View Controller - First-->
         <scene sceneID="W3I-pn-N6e">
@@ -211,7 +211,7 @@
                                     <action selector="LoginButtonClick:" destination="CZ4-MO-1fc" eventType="touchUpInside" id="WdK-CJ-7JY"/>
                                 </connections>
                             </button>
-                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="KOS-Kb-91y">
+                            <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="KOS-Kb-91y">
                                 <rect key="frame" x="20" y="317" width="130" height="32"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
                                 <inset key="insetFor6xAndEarlier" minX="0.0" minY="70" maxX="0.0" maxY="-70"/>
@@ -328,7 +328,7 @@
                                             <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                                         </state>
                                         <connections>
-                                            <action selector="onButtonClick:" destination="UNq-GU-jaf" eventType="touchUpInside" id="50J-Qd-62H"/>
+                                            <action selector="OnDocumentClick:" destination="UNq-GU-jaf" eventType="touchUpInside" id="q4o-Ol-7PB"/>
                                         </connections>
                                     </button>
                                     <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Document Manage" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="AQV-Uj-awl">
@@ -345,7 +345,7 @@
                                             <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
                                         </state>
                                         <connections>
-                                            <segue destination="w6b-yg-2yg" kind="push" id="eEH-cN-gfC"/>
+                                            <segue destination="qrn-VS-Yb7" kind="push" id="Ujz-iz-gWI"/>
                                         </connections>
                                     </button>
                                     <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Messages" textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="AGy-cb-MuS">
@@ -487,6 +487,7 @@
                     <navigationItem key="navigationItem" id="FlZ-he-0gE"/>
                     <connections>
                         <outlet property="edit" destination="Yak-ci-niG" id="teO-s1-Y7F"/>
+                        <outlet property="messageButton" destination="LJ8-xP-yYD" id="1f8-z3-XlI"/>
                         <outlet property="radioContainer" destination="47I-2c-G8g" id="qRd-86-3t5"/>
                         <outlet property="radioHbol" destination="5Zw-GS-WrJ" id="2IT-8Y-gIE"/>
                         <segue destination="7w0-x0-gGx" kind="modal" identifier="LOGIN" id="6c0-rZ-YVg"/>
@@ -496,6 +497,129 @@
             </objects>
             <point key="canvasLocation" x="-813" y="-408"/>
         </scene>
+        <!--Documents View Controller-->
+        <scene sceneID="Zav-eF-V5K">
+            <objects>
+                <viewController storyboardIdentifier="DocumentsViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="AtO-h1-rO7" customClass="DocumentsViewController" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="NwM-Rp-N40">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                        <subviews>
+                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="zDM-wX-KTe">
+                                <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
+                                <prototypes>
+                                    <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="documents" textLabel="YWH-Xf-c3w" style="IBUITableViewCellStyleDefault" id="xN7-OT-evG">
+                                        <rect key="frame" x="0.0" y="55" width="320" height="44"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="xN7-OT-evG" id="wGX-ZS-x8r">
+                                            <rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                            <subviews>
+                                                <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="YWH-Xf-c3w">
+                                                    <rect key="frame" x="15" y="0.0" width="270" height="43"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="18"/>
+                                                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                            </subviews>
+                                        </tableViewCellContentView>
+                                    </tableViewCell>
+                                </prototypes>
+                                <connections>
+                                    <outlet property="dataSource" destination="AtO-h1-rO7" id="h4A-Yx-cW7"/>
+                                    <outlet property="delegate" destination="AtO-h1-rO7" id="lDt-J0-aqm"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+                    </view>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="H1X-eu-8mg" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-813" y="335"/>
+        </scene>
+        <!--Local Documents View Controller-->
+        <scene sceneID="Brr-Uu-VnC">
+            <objects>
+                <viewController storyboardIdentifier="LocalDocumentsViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="mTm-QF-l86" customClass="LocalDocumentsViewController" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="Z0c-U1-gdm">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                        <subviews>
+                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="hhx-YW-kPS">
+                                <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <prototypes>
+                                    <tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="documentitem" textLabel="kvP-GJ-lpY" imageView="kx1-B6-Im0" style="IBUITableViewCellStyleDefault" id="vK6-zA-FAE">
+                                        <rect key="frame" x="0.0" y="22" width="320" height="44"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="vK6-zA-FAE" id="9QL-hu-dPy">
+                                            <rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                            <subviews>
+                                                <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="kvP-GJ-lpY">
+                                                    <rect key="frame" x="73" y="0.0" width="212" height="43"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="18"/>
+                                                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="ic_pdf128" id="kx1-B6-Im0">
+                                                    <rect key="frame" x="15" y="0.0" width="43" height="43"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </imageView>
+                                            </subviews>
+                                        </tableViewCellContentView>
+                                    </tableViewCell>
+                                </prototypes>
+                                <connections>
+                                    <outlet property="dataSource" destination="mTm-QF-l86" id="rni-Ze-F8P"/>
+                                    <outlet property="delegate" destination="mTm-QF-l86" id="obU-lh-cmL"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+                    </view>
+                    <connections>
+                        <outlet property="tableview" destination="hhx-YW-kPS" id="1M3-Iu-lHP"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="h7j-dA-a2k" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="-403" y="335"/>
+        </scene>
+        <!--Pdf View Controller-->
+        <scene sceneID="qDh-ef-h6s">
+            <objects>
+                <viewController storyboardIdentifier="PdfViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="mGH-EL-5Xm" customClass="PdfViewController" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="1rz-rZ-fZg">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                        <subviews>
+                            <webView contentMode="scaleToFill" scalesPageToFit="YES" allowsInlineMediaPlayback="NO" mediaPlaybackRequiresUserAction="NO" mediaPlaybackAllowsAirPlay="NO" id="Ih7-YS-cX1">
+                                <rect key="frame" x="0.0" y="20" width="320" height="548"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                <dataDetectorType key="dataDetectorTypes"/>
+                                <connections>
+                                    <outlet property="delegate" destination="mGH-EL-5Xm" id="22e-58-l0c"/>
+                                </connections>
+                            </webView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+                    </view>
+                    <connections>
+                        <outlet property="webview" destination="Ih7-YS-cX1" id="A2b-hn-HOg"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="No4-W6-BEF" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="4" y="335"/>
+        </scene>
         <!--Apex History View Controller-->
         <scene sceneID="fpU-rp-TyY">
             <objects>
@@ -505,8 +629,8 @@
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
                             <imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="apexlogo-2" id="Bwc-Vi-N7D">
-                                <rect key="frame" x="0.0" y="80" width="320" height="56"/>
-                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <rect key="frame" x="0.0" y="55" width="320" height="56"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             </imageView>
                             <webView contentMode="scaleToFill" id="0T5-Ll-Dff">
                                 <rect key="frame" x="0.0" y="100" width="320" height="420"/>
@@ -525,7 +649,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="aLR-0D-WuS" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="1700" y="-1742"/>
+            <point key="canvasLocation" x="1138" y="-1742"/>
         </scene>
         <!--Change Password View Controller - Change password-->
         <scene sceneID="fcq-JD-zfG">
@@ -607,7 +731,131 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="VbT-Dn-X4d" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="2704" y="-390"/>
+            <point key="canvasLocation" x="1972" y="-1742"/>
+        </scene>
+        <!--Message View Controller-->
+        <scene sceneID="6vl-5u-l6A">
+            <objects>
+                <viewController storyboardIdentifier="MessageViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="qrn-VS-Yb7" customClass="MessageViewController" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="c3o-cG-9Yp">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                        <subviews>
+                            <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" animating="YES" style="whiteLarge" id="f6w-95-ZtY">
+                                <rect key="frame" x="0.0" y="266" width="320" height="37"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <color key="color" red="0.40000000600000002" green="0.80000001190000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            </activityIndicatorView>
+                            <tableView hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="dNI-5t-B4L">
+                                <rect key="frame" x="0.0" y="65" width="320" height="503"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <prototypes>
+                                    <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="tableitemmsg" id="1nr-UE-sjD" customClass="MessageItem">
+                                        <rect key="frame" x="0.0" y="22" width="320" height="44"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1nr-UE-sjD" id="U3J-V7-tmK">
+                                            <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                            <subviews>
+                                                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="d7g-gu-2Bj">
+                                                    <rect key="frame" x="20" y="2" width="42" height="21"/>
+                                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                    <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="a" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="hpS-fx-8AH">
+                                                    <rect key="frame" x="133" y="20" width="167" height="21"/>
+                                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
+                                            </subviews>
+                                        </tableViewCellContentView>
+                                        <connections>
+                                            <outlet property="MessageLabel" destination="d7g-gu-2Bj" id="AHp-9R-VWf"/>
+                                            <outlet property="TimeLabel" destination="hpS-fx-8AH" id="IWp-AL-5gl"/>
+                                        </connections>
+                                    </tableViewCell>
+                                </prototypes>
+                                <connections>
+                                    <outlet property="dataSource" destination="qrn-VS-Yb7" id="FRI-qE-nqO"/>
+                                    <outlet property="delegate" destination="qrn-VS-Yb7" id="b2o-Yy-W1n"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+                    </view>
+                    <navigationItem key="navigationItem" id="pyf-tg-5tF">
+                        <barButtonItem key="rightBarButtonItem" systemItem="trash" id="7Pl-CC-Fek">
+                            <connections>
+                                <action selector="delAllMessage:" destination="qrn-VS-Yb7" id="Yk7-Vk-mM8"/>
+                            </connections>
+                        </barButtonItem>
+                    </navigationItem>
+                    <connections>
+                        <outlet property="mum" destination="f6w-95-ZtY" id="rBg-K6-xME"/>
+                        <outlet property="tableview" destination="dNI-5t-B4L" id="kJ4-gk-Q2O"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="Hqb-nc-neY" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="436" y="-408"/>
+        </scene>
+        <!--Message Detail View Controller-->
+        <scene sceneID="zJl-bE-06n">
+            <objects>
+                <viewController storyboardIdentifier="MessageDetailViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="QrY-u5-BMT" customClass="MessageDetailViewController" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="Qgi-7I-qcc">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                        <subviews>
+                            <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" animating="YES" style="whiteLarge" id="Khm-7i-JgE">
+                                <rect key="frame" x="142" y="265" width="37" height="37"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                <color key="color" red="0.40000000600000002" green="0.80000001190000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                            </activityIndicatorView>
+                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="175" sectionHeaderHeight="22" sectionFooterHeight="22" id="95E-D6-Wgp">
+                                <rect key="frame" x="0.0" y="65" width="320" height="503"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <prototypes>
+                                    <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="messagedetailitem" rowHeight="175" id="EfP-7H-xCp" customClass="MessageDetailItem">
+                                        <rect key="frame" x="0.0" y="22" width="320" height="175"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="EfP-7H-xCp" id="Jbk-8t-6hJ">
+                                            <rect key="frame" x="0.0" y="0.0" width="320" height="174"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                            <subviews>
+                                                <view contentMode="scaleToFill" id="knk-RT-xyF" customClass="RTLabel">
+                                                    <rect key="frame" x="20" y="9" width="280" height="165"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+                                                </view>
+                                            </subviews>
+                                        </tableViewCellContentView>
+                                        <connections>
+                                            <outlet property="contentLabel" destination="knk-RT-xyF" id="uVy-gl-Smq"/>
+                                        </connections>
+                                    </tableViewCell>
+                                </prototypes>
+                                <connections>
+                                    <outlet property="dataSource" destination="QrY-u5-BMT" id="0Mc-hx-2Up"/>
+                                    <outlet property="delegate" destination="QrY-u5-BMT" id="Ltr-JQ-hVW"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+                    </view>
+                    <connections>
+                        <outlet property="mum" destination="Khm-7i-JgE" id="xYK-Rz-ROo"/>
+                        <outlet property="tableview" destination="95E-D6-Wgp" id="EWl-KI-oxt"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="b3P-Fz-CEQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="825" y="-408"/>
         </scene>
         <!--Customize Field View Controller-->
         <scene sceneID="yzI-TK-ahX">
@@ -662,7 +910,35 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="nbG-c1-sls" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="3954" y="-1729"/>
+            <point key="canvasLocation" x="2402" y="-1742"/>
+        </scene>
+        <!--News Detail View Controller-->
+        <scene sceneID="33J-WJ-2tM">
+            <objects>
+                <viewController storyboardIdentifier="NewsDetailViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="ggi-Sd-Pt7" customClass="NewsDetailViewController" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="2nh-AD-EUs">
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                        <subviews>
+                            <webView contentMode="scaleToFill" allowsInlineMediaPlayback="NO" mediaPlaybackRequiresUserAction="NO" mediaPlaybackAllowsAirPlay="NO" id="5OF-cN-5qG">
+                                <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <dataDetectorType key="dataDetectorTypes"/>
+                                <connections>
+                                    <outlet property="delegate" destination="ggi-Sd-Pt7" id="Iif-kP-fVz"/>
+                                </connections>
+                            </webView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+                    </view>
+                    <connections>
+                        <outlet property="webview" destination="5OF-cN-5qG" id="34x-eq-C5E"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="NJI-Ax-rYf" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="2816" y="-1742"/>
         </scene>
         <!--Retrieve Password View Controller-->
         <scene sceneID="JeM-3c-O9i">
@@ -1019,7 +1295,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="ZLg-Ln-SOw" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="4074" y="-932"/>
+            <point key="canvasLocation" x="2290" y="-1094"/>
         </scene>
         <!--Result View Controller - Result-->
         <scene sceneID="HJD-6m-1oF">
@@ -1076,7 +1352,7 @@
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                     </view>
                     <navigationItem key="navigationItem" title="Result" id="JkP-Lu-glO">
-                        <barButtonItem key="rightBarButtonItem" title="Items" id="qrK-Vl-z8W">
+                        <barButtonItem key="rightBarButtonItem" title="Menu" id="qrK-Vl-z8W">
                             <connections>
                                 <action selector="onCustomize:" destination="U64-AM-iXd" id="tJB-O4-pdd"/>
                             </connections>
@@ -1092,7 +1368,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="BUa-P4-8Ex" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="4506" y="-932"/>
+            <point key="canvasLocation" x="2722" y="-1094"/>
         </scene>
         <!--Web View Controller - Loading...-->
         <scene sceneID="5AK-HM-skm">
@@ -1266,7 +1542,7 @@
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                                 <connections>
-                                    <segue destination="dbM-RP-CjU" kind="embed" id="arc-yR-QMh"/>
+                                    <segue destination="dbM-RP-CjU" kind="embed" id="5sj-fp-kV5"/>
                                 </connections>
                             </containerView>
                         </subviews>
@@ -1276,7 +1552,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="3qq-4t-Ow8" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="-52" y="-1074"/>
+            <point key="canvasLocation" x="-190" y="-1067"/>
         </scene>
         <!--About View Controller - About-->
         <scene sceneID="yPV-LT-kUD">
@@ -1306,26 +1582,28 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="1qU-xI-rc2" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="2791" y="320"/>
+            <point key="canvasLocation" x="1557" y="-1742"/>
         </scene>
-        <!--Location View Controller-->
+        <!--Location View Controller - Service location-->
         <scene sceneID="2vR-Up-DGY">
             <objects>
                 <viewController automaticallyAdjustsScrollViewInsets="NO" id="dbM-RP-CjU" customClass="LocationViewController" sceneMemberID="viewController">
-                    <view key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="feP-eT-obx">
+                    <view key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="feP-eT-obx">
                         <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                     </view>
+                    <tabBarItem key="tabBarItem" title="Service location" image="map (1)" id="4rm-9M-DPL"/>
                     <toolbarItems/>
                     <navigationItem key="navigationItem" id="eFt-a5-oFc"/>
+                    <simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
                     <connections>
                         <segue destination="mUL-1B-hqq" kind="modal" identifier="DETAIL" id="fJJ-YR-ose"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="pkZ-co-EKr" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="777" y="-1040"/>
+            <point key="canvasLocation" x="306" y="-1067"/>
         </scene>
         <!--Location Detail View Controller-->
         <scene sceneID="U7a-re-t7T">
@@ -1336,39 +1614,22 @@
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
                             <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" showsHorizontalScrollIndicator="NO" editable="NO" text="content" textAlignment="center" id="WJf-Cy-VOs">
-                                <rect key="frame" x="20" y="75" width="280" height="412"/>
+                                <rect key="frame" x="20" y="0.0" width="280" height="568"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="15"/>
                                 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
                                 <dataDetectorType key="dataDetectorTypes" phoneNumber="YES" link="YES"/>
                             </textView>
-                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="XP8-lF-VzJ">
-                                <rect key="frame" x="140" y="495" width="40" height="30"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                                <state key="normal" title="Close">
-                                    <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
-                                </state>
-                                <connections>
-                                    <action selector="onCloseClick:" destination="mUL-1B-hqq" eventType="touchUpInside" id="LsM-ks-kND"/>
-                                </connections>
-                            </button>
-                            <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="name" textAlignment="center" id="OQp-ZY-wcy">
-                                <rect key="frame" x="20" y="24" width="280" height="43"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                                <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
-                            </textView>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                     </view>
                     <connections>
                         <outlet property="contentText" destination="WJf-Cy-VOs" id="DJH-fT-gtM"/>
-                        <outlet property="nameText" destination="OQp-ZY-wcy" id="TYw-Vk-CS6"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="hZL-fK-eOy" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="1253" y="-1040"/>
+            <point key="canvasLocation" x="731" y="-1067"/>
         </scene>
     </scenes>
     <resources>
@@ -1379,6 +1640,7 @@
         <image name="ic_message" width="60" height="60"/>
         <image name="ic_ocean_blinfo" width="60" height="60"/>
         <image name="ic_oceanbooking" width="60" height="60"/>
+        <image name="ic_pdf128" width="64" height="64"/>
         <image name="ic_service_location" width="60" height="60"/>
         <image name="ic_tools" width="60" height="60"/>
         <image name="in" width="32" height="32"/>

+ 5 - 7
Apex Mobile/Apex Mobile/ChangePasswordViewController.m

@@ -85,14 +85,12 @@
             
             if (ret==RESULT_TRUE)
             {
+                 ApexMobileAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
+                appDelegate.password = newpass;
                 
-                
-                [self dismissViewControllerAnimated:true completion:^{
-                    
-                    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Change success." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
-                    [alert show];
-                    ;
-                }];
+                UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Change success." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
+                [alert show];
+                [self.navigationController popViewControllerAnimated:true ];
             }
             else
             {

+ 4 - 2
Apex Mobile/Apex Mobile/Constant.h

@@ -24,6 +24,8 @@
 #define URL_REQUEST_DETAIL @"https://ra.apexshipping.com/main.php"
 #define URL_ANNOUNCEMENTS @"https://ra.apexshipping.com/mobile_news.php"
 #define URL_NEWS	@"https://ra.apexshipping.com/mobile_news.php"
+#define URL_LOCATIONS @"https://ra.apexshipping.com/mobile_news.php"
+#define URL_PUSH @"https://ra.apexshipping.com/main.php"
 #define COLOR(R,G,B,A) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]
 extern const int MAX_ROW;
 extern const int MAX_COLUMN;
@@ -38,8 +40,8 @@ extern const int			AP_USER_NOT_AUTH;
 extern const int			AP_USER_NOT_EXIST;
 extern const int			AP_SESSION_EXPIRED;
 
-extern const int			AP_UPLOAD_SUCCESS;
-extern const int			AP_UPLOAD_FAIL;
+extern const int			AP_MESSAGE_NEW;
+extern const int			AP_MESSAGE_NONE;
 
 
 extern const int		RESULT_FALSE;

+ 2 - 2
Apex Mobile/Apex Mobile/Constant.m

@@ -19,8 +19,8 @@ const int			AP_USER_NOT_AUTH				= 2;
 const int			AP_USER_NOT_EXIST				= 3;
 const int			AP_SESSION_EXPIRED				= 4;
 
-const int			AP_UPLOAD_SUCCESS				= 4;
-const int			AP_UPLOAD_FAIL					= 5;
+const int			AP_MESSAGE_NEW				= 5;
+const int			AP_MESSAGE_NONE					= 6;
 
 
 const int		RESULT_FALSE					= 0;

+ 11 - 1
Apex Mobile/Apex Mobile/DetailPageViewController.m

@@ -12,7 +12,7 @@
 #define  LINE_WIDTH 0
 #define  CELL_MARGIN 0
 #define  LABEL_MARGIN 5
-
+#import "TabBarController.h"
 @interface DetailPageViewController ()
 
 @end
@@ -138,6 +138,16 @@
             }
             [UIView commitAnimations];
             
+            NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+            bool autologin =[defaults boolForKey:@"autologin"];
+            if(!autologin)
+            {
+                TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
+                [self presentViewController:viewController animated:YES completion:^{
+                    
+                }];
+            }
+            
             //            [self.table setNeedsDisplay];
             //            if(self.recordCount<2000)
             //                self.countView.title = [NSString stringWithFormat:@"%d records",self.recordCount];

+ 15 - 0
Apex Mobile/Apex Mobile/DocumentsViewController.h

@@ -0,0 +1,15 @@
+//
+//  DocumentsViewController.h
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-5.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "Constant.h"
+#import "SearchViewController.h"
+#import "LocalDocumentsViewController.h"
+@interface DocumentsViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>
+@property (strong,nonatomic) NSMutableArray * toolsinfo;
+@end

+ 137 - 0
Apex Mobile/Apex Mobile/DocumentsViewController.m

@@ -0,0 +1,137 @@
+//
+//  DocumentsViewController.m
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-5.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "DocumentsViewController.h"
+
+@interface DocumentsViewController ()
+
+@end
+
+@implementation DocumentsViewController
+
+
+-(void)initpanel
+{
+    self.toolsinfo = [[NSMutableArray alloc] init];
+    
+    NSMutableDictionary* map = [[NSMutableDictionary alloc] init];
+    
+    [map setValue:@"Search documents" forKey:@"title"];
+    [map setValue:@"rect_search_documents" forKey:@"img"];
+    [self.toolsinfo addObject:map.copy];
+    
+    [map setValue:@"View document" forKey:@"title"];
+    [map setValue:@"rect_view_download_documents" forKey:@"img"];
+    [self.toolsinfo addObject:map.copy];
+    
+    
+}
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+    if (self) {
+        // Custom initialization
+    }
+    return self;
+}
+
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    [self initpanel];
+}
+
+- (void)didReceiveMemoryWarning
+{
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+ #pragma mark - Navigation
+ 
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
+ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
+ {
+ // Get the new view controller using [segue destinationViewController].
+ // Pass the selected object to the new view controller.
+ }
+ */
+
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+    
+    return 1;
+}
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+    
+    return self.toolsinfo.count;
+    
+    
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    DebugLog(@"cellForRowAtIndexPath");
+    
+    NSString *CellIdentifier = @"documents";
+    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+    NSString* title = [self.toolsinfo[indexPath.row] valueForKey:@"title"];
+    
+    //    UIImageView* iv= [[UIImageView alloc] initWithImage:];
+    cell.textLabel.text = title;
+    cell.imageView.image = [UIImage imageNamed:[self.toolsinfo[indexPath.row] valueForKey:@"img"]];
+    
+    return cell;
+    
+    
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    
+    //    SearchViewController *searchViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"NewsView"];
+    //    searchViewController.function_name = @"Download Document";
+    //    [self.navigationController pushViewController:searchViewController animated:YES];
+    //    return;
+    
+    NSString* title = [self.toolsinfo[indexPath.row] valueForKey:@"title"];
+    if([title isEqualToString:@"Search documents"])
+    {
+        SearchViewController *searchViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
+        searchViewController.function_name = @"Download Document";
+        [self.navigationController pushViewController:searchViewController animated:YES];
+    }
+    else if([title isEqualToString:@"View document"])
+    {
+        LocalDocumentsViewController *viewcontroller=[self.storyboard instantiateViewControllerWithIdentifier:@"LocalDocumentsViewController"];
+//        viewcontroller.module_name = @"Announcements";
+        [self.navigationController pushViewController:viewcontroller animated:YES];
+    }
+
+}
+
+@end

+ 3 - 0
Apex Mobile/Apex Mobile/FunctionSelectViewController.h

@@ -13,10 +13,13 @@
 #import "MyAutocompleteView.h"
 #import "MyAutocompleteItemsSource.h"
 #import "MyAutocompletionCellFactory.h"
+#import "DocumentsViewController.h"
 @interface FunctionSelectViewController : UIViewController<UITextFieldDelegate>
 @property (strong,nonatomic) NSString * content;
 @property (strong, nonatomic) IBOutlet UIButton *radioHbol;
 @property (strong, nonatomic) IBOutlet UIButton *radioContainer;
 @property (strong, nonatomic) IBOutlet UITextField *edit;
 @property (strong,nonatomic) MyAutocompleteView * autocompleteView;
+@property (strong, nonatomic) IBOutlet UIButton *messageButton;
+
 @end

+ 56 - 8
Apex Mobile/Apex Mobile/FunctionSelectViewController.m

@@ -66,31 +66,60 @@
     [self.navigationController pushViewController:toolsViewController animated:YES];
     
 }
+- (IBAction)OnDocumentClick:(UIButton *)sender {
+    
+    DocumentsViewController *documentsViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentsViewController"];
+//    toolsViewController.showNavigation = true;
+    [self.navigationController pushViewController:documentsViewController animated:YES];
+}
 - (IBAction)onResetClick:(UIButton *)sender {
     self.edit.text=@"";
 }
 - (IBAction)onHbolClick:(UIButton *)sender {
     self.radioContainer.selected = false;
     sender.selected = true;
+    NSArray* array = [ApexMobileDB get_searchhistory:@"h_bol"];
+    [self.autocompleteView.itemsSource put_predictions:array ];
 }
 - (IBAction)onContainerClick:(UIButton *)sender {
     self.radioHbol.selected = false;
     sender.selected = true;
+    NSArray* array = [ApexMobileDB get_searchhistory:@"ctnr"];
+    [self.autocompleteView.itemsSource put_predictions:array ];
 }
 - (IBAction)onSearchClick:(UIButton *)sender {
     
+    
+//    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"openurltest.txt" ofType:nil inDirectory:nil];
+//    NSURL *url = [[NSURL alloc] initFileURLWithPath:filePath];
+//    UIDocumentInteractionController *documentController =[UIDocumentInteractionController interactionControllerWithURL: url];
+//    [documentController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES];
+//    
+//    return;
+    
+    
     NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
     
     [params setObject:@"dumb" forKey:@"id"];
+    NSString* h_field;
     if(self.radioContainer.selected==true)
+    {
         [params setObject:@"1" forKey:@"criterion_type"];
+        h_field = @"ctnr";
+    }
     else
+    {
         [params setObject:@"0" forKey:@"criterion_type"];
+    h_field = @"h_bol";
+    }
     NSString * cargo_criterion = self.edit.text;
     if(cargo_criterion==nil)
         cargo_criterion=@"";
     [params setObject:cargo_criterion forKey:@"cargo_criterion"];
     
+    
+    [ApexMobileDB savehistory:h_field value:cargo_criterion];
+    
     DetailTabBarController *detailViewController=[[DetailTabBarController alloc] init:@"Cargo Tracking" actions:[NSArray arrayWithObjects:@"Tracking",nil] params:params];
     [self.navigationController pushViewController:detailViewController animated:YES];
     
@@ -153,14 +182,26 @@
 }
 -(void)viewWillAppear:(BOOL)animated
 {
+    int i = [UIApplication sharedApplication].applicationIconBadgeNumber;
+    if(i>0)
+        self.messageButton.imageView.image = [UIImage imageNamed:@"ic_message_new"];
+    else
+        self.messageButton.imageView.image = [UIImage imageNamed:@"ic_message"];
+    NSString* field = nil;
+    if(self.radioHbol.selected ==true)
+        field=@"h_bol";
+    else
+        field=@"ctnr";
+    NSArray* array = [ApexMobileDB get_searchhistory:field] ;
     self.autocompleteView = [MyAutocompleteView autocompleteViewBindedTo:self.edit
                                                              usingSource:[[MyAutocompleteItemsSource alloc]
-                                                                          initWithMinimumCharactersToTrigger:1
+                                                                          initWithMinimumCharactersToTrigger:1 source:array
                                                                           ]
                                                              cellFactory:[[MyAutocompletionCellFactory alloc]
                                                                           initWithCellTextColor:[UIColor blackColor]
                                                                           fontSize:14]
-                                                            presentingIn:self];
+//                                                            presentingIn:self
+                                                              parentView:self.view];
     self.autocompleteView.topMargin = 0;
     //    self.autocompleteView.backgroundColor = [UIColor ui];
     
@@ -168,6 +209,13 @@
     {
         NSLog(@"Autocompleted with: %@",  item.completionText);
     };
+    
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    bool autologin =[defaults boolForKey:@"autologin"];
+    if(!autologin)
+    {
+        [self performSegueWithIdentifier:@"LOGIN" sender:self];
+    }
 }
 - (void)viewDidLoad
 {
@@ -187,12 +235,12 @@
     [self.radioHbol setImage:[UIImage imageNamed:@"checked_32.png"] forState:UIControlStateSelected];
 	// Do any additional setup after loading the view.
     
-    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-    bool autologin =[defaults boolForKey:@"autologin"];
-    if(!autologin)
-    {
-        [self performSegueWithIdentifier:@"LOGIN" sender:self];
-    }
+//    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+//    bool autologin =[defaults boolForKey:@"autologin"];
+//    if(!autologin)
+//    {
+//        [self performSegueWithIdentifier:@"LOGIN" sender:self];
+//    }
     
 }
 

+ 14 - 0
Apex Mobile/Apex Mobile/HistoryTabBarController.m

@@ -22,6 +22,20 @@
     }
     return self;
 }
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
 - (id)init
 {
     self = [super init];

+ 30 - 1
Apex Mobile/Apex Mobile/HistoryViewController.m

@@ -22,7 +22,20 @@
     }
     return self;
 }
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
 
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
 - (void)viewDidLoad
 {
     [super viewDidLoad];
@@ -108,5 +121,21 @@
     resultViewController.params =params;
     [self.navigationController pushViewController:resultViewController animated:YES];
 }
-
+- (UITableViewCellEditingStyle)tableView:(UITableView *)tv editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    return UITableViewCellEditingStyleDelete;
+    //不能是UITableViewCellEditingStyleNone
+}
+- (void)tableView:(UITableView *)tableView
+commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:(NSIndexPath *)indexPath {
+    sqlite3* db = [ApexMobileDB get_db];
+    NSString* sql = [NSString stringWithFormat:@"delete from history where _id=%@",[self.data.pagedata[indexPath.row] valueForKey:@"_id"]];
+    [ApexMobileDB execSql:sql db:db];
+    sqlite3_close(db);
+    
+    [self.data.pagedata removeObjectAtIndex:indexPath.row];
+    
+    [tableView reloadData];
+    
+}
 @end

+ 17 - 0
Apex Mobile/Apex Mobile/Images.xcassets/apex512.imageset/Contents.json

@@ -0,0 +1,17 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x",
+      "filename" : "apex512.png"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/Images.xcassets/apex512.imageset/apex512.png


+ 17 - 0
Apex Mobile/Apex Mobile/Images.xcassets/ic_pdf128.imageset/Contents.json

@@ -0,0 +1,17 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x",
+      "filename" : "ic_pdf128.png"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/Images.xcassets/ic_pdf128.imageset/ic_pdf128.png


+ 18 - 0
Apex Mobile/Apex Mobile/LocalDocumentsViewController.h

@@ -0,0 +1,18 @@
+//
+//  LocalDocumentsViewController.h
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-5.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "Constant.h"
+#import "PdfViewController.h"
+@interface LocalDocumentsViewController : UIViewController
+<UITableViewDataSource,UITableViewDelegate,UIDocumentInteractionControllerDelegate>
+@property (strong,nonatomic) NSMutableArray * toolsinfo;
+@property (strong, nonatomic) IBOutlet UITableView *tableview;
+@property (strong,nonatomic) UIDocumentInteractionController* fileInteractionController;
+-(void)openFile: (NSString *) file_url;
+@end

+ 271 - 0
Apex Mobile/Apex Mobile/LocalDocumentsViewController.m

@@ -0,0 +1,271 @@
+//
+//  LocalDocumentsViewController.m
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-5.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "LocalDocumentsViewController.h"
+
+@interface LocalDocumentsViewController ()
+
+@end
+
+@implementation LocalDocumentsViewController
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
+-(void)initpanel
+{
+    
+    self.toolsinfo = [[NSMutableArray alloc] init];
+        NSMutableDictionary* map = [[NSMutableDictionary alloc] init];
+    
+    
+    NSFileManager *manager;
+    manager = [NSFileManager defaultManager];
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString *path = [paths objectAtIndex:0];
+    NSDirectoryEnumerator *direnum;
+    direnum = [manager enumeratorAtPath: path];//枚举home下的目录
+    NSLog(@"home=%@,direnum=%@",path,direnum);
+    NSMutableArray *files;
+    files = [NSMutableArray arrayWithCapacity:5];
+    NSString *filename;
+    while (filename = [direnum nextObject])
+    {
+        if ([[filename pathExtension] isEqualToString:@"pdf"])
+        {
+            [map setValue:filename forKey:@"title"];
+//            [map setValue:@"rect_search_documents" forKey:@"img"];
+            [self.toolsinfo addObject:map.copy];
+            
+            [files addObject: filename];
+            NSLog (@"%@", filename);
+        }
+    }
+//    NSEnumerator *fileenum;
+//    fileenum = [files objectEnumerator];//枚举数组files
+//    while (filename = [fileenum nextObject]) {
+//        NSLog (@"%@", filename);
+//    }
+//    
+    
+    
+    
+    
+    
+    
+    
+
+    
+//
+//    
+//    [map setValue:@"View document" forKey:@"title"];
+//    [map setValue:@"rect_view_download_documents" forKey:@"img"];
+//    [self.toolsinfo addObject:map.copy];
+//    
+    
+}
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+    if (self) {
+        // Custom initialization
+    }
+    return self;
+}
+
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    [self initpanel];
+}
+
+- (void)didReceiveMemoryWarning
+{
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+ #pragma mark - Navigation
+ 
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
+ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
+ {
+ // Get the new view controller using [segue destinationViewController].
+ // Pass the selected object to the new view controller.
+ }
+ */
+
+
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+    
+    return 1;
+}
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+    
+    return self.toolsinfo.count;
+    
+    
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    DebugLog(@"cellForRowAtIndexPath");
+    
+    NSString *CellIdentifier = @"documentitem";
+    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+    NSString* title = [self.toolsinfo[indexPath.row] valueForKey:@"title"];
+    
+    
+//    cell.accessoryView
+    //    UIImageView* iv= [[UIImageView alloc] initWithImage:];
+    cell.textLabel.text = title;
+//    cell.imageView.image = [UIImage imageNamed:[self.toolsinfo[indexPath.row] valueForKey:@"img"]];
+    
+    return cell;
+    
+    
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString *path = [paths objectAtIndex:0];
+    NSString* filename =[self.toolsinfo[indexPath.row] valueForKey:@"title"];
+    
+    NSString *filePath = [path stringByAppendingPathComponent:filename];
+    [self openFile:filePath];
+    
+//    NSFileManager *manager;
+//    manager = [NSFileManager defaultManager];
+//
+//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+//    NSString *path = [paths objectAtIndex:0];
+//    NSString* filename =[self.toolsinfo[indexPath.row] valueForKey:@"title"];
+//    
+//        NSString *filePath = [path stringByAppendingPathComponent:filename];
+//    
+//    
+//    
+//    PdfViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PdfViewController"];
+//    ViewController.filepath = filePath;
+//    //    ViewController. = self.function_name;
+//    //    ViewController.behavior =BEHAVIOR_SEARCH;
+//    
+//    [self.navigationController pushViewController:ViewController animated:YES];
+    
+    //    SearchViewController *searchViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"NewsView"];
+    //    searchViewController.function_name = @"Download Document";
+    //    [self.navigationController pushViewController:searchViewController animated:YES];
+    //    return;
+    
+//    NSString* title = [self.toolsinfo[indexPath.row] valueForKey:@"title"];
+//    if([title isEqualToString:@"Search documents"])
+//    {
+//        SearchViewController *searchViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
+//        searchViewController.function_name = @"Download Document";
+//        [self.navigationController pushViewController:searchViewController animated:YES];
+//    }
+//    else if([title isEqualToString:@"View document"])
+//    {
+//        LocalDocumentsViewController *viewcontroller=[self.storyboard instantiateViewControllerWithIdentifier:@"LocalDocumentsViewController"];
+//        //        viewcontroller.module_name = @"Announcements";
+//        [self.navigationController pushViewController:viewcontroller animated:YES];
+//    }
+    
+}
+
+
+//-(void)tableView:(UITableView *)tableView1 accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
+//    
+//    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+//    NSString *path = [paths objectAtIndex:0];
+//    NSString* filename =[self.toolsinfo[indexPath.row] valueForKey:@"title"];
+//    
+//    NSString *filePath = [path stringByAppendingPathComponent:filename];
+//    [self openFile:filePath];
+//
+////        NSURL *url = [[NSURL alloc] initFileURLWithPath:filePath];
+////
+////    UIDocumentInteractionController *documentController =[UIDocumentInteractionController interactionControllerWithURL: url];
+////    documentController.delegate = self;
+////    [documentController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES];
+////    
+////    return;
+//    
+////        NSURL *url = [[NSURL alloc] initFileURLWithPath:filePath];
+////        UIDocumentInteractionController *documentController =[UIDocumentInteractionController interactionControllerWithURL: url];
+////    
+////        return;
+//}
+
+
+-(void)openFile: (NSString *) file_url  {
+    
+    NSURL *file_URL = [NSURL fileURLWithPath:file_url];
+    
+    if (file_URL != nil) {
+        if (self.fileInteractionController == nil) {
+            //_fileInteractionController = [[UIDocumentInteractionController alloc] init];
+            _fileInteractionController = [UIDocumentInteractionController interactionControllerWithURL:file_URL];
+            _fileInteractionController.delegate = self;
+            //  [_fileInteractionController retain];//不适用ARC,记得RETAIN 使用ARC注释这一行
+        }
+        else {
+            self.fileInteractionController.URL = file_URL;
+        }
+        
+// [self.fileInteractionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
+        [self.fileInteractionController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES];
+//        [self.fileInteractionController  presentPreviewAnimated:YES];
+        
+    }
+}
+#pragma mark methods for the UIDocumentInteractionControllerDelegate
+
+- (void)previewDocumentWithURL:(NSURL*)url
+{
+    UIDocumentInteractionController* preview = [UIDocumentInteractionController interactionControllerWithURL:url];
+    preview.delegate = self;
+    [preview presentPreviewAnimated:YES];
+
+}
+
+- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller
+{
+
+}
+
+- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller{
+    return self;
+}
+
+- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller{
+    return self.view.frame;
+}
+
+- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller{
+    return self.view;
+}
+@end

+ 4 - 3
Apex Mobile/Apex Mobile/LocationDetailViewController.h

@@ -7,9 +7,9 @@
 //
 
 #import <UIKit/UIKit.h>
-
-@interface LocationDetailViewController : UIViewController
-@property (strong, nonatomic) IBOutlet UITextView *nameText;
+#import <AddressBookUI/AddressBookUI.h>
+@interface LocationDetailViewController : UIViewController<ABNewPersonViewControllerDelegate>
+//@property (strong, nonatomic) IBOutlet UITextView *nameText;
 //@property (strong, nonatomic) IBOutlet UITextView *addrText;
 //@property (strong, nonatomic) IBOutlet UITextView *telText;
 //@property (strong, nonatomic) IBOutlet UITextView *faxText;
@@ -17,4 +17,5 @@
 //@property (strong, nonatomic) IBOutlet UITextView *emailText;
 @property (strong, nonatomic) IBOutlet UITextView *contentText;
 @property (strong,nonatomic) NSMutableDictionary* params;
+//@property (strong,nonatomic) UINavigationController * aBNewPersonNav;
 @end

+ 245 - 13
Apex Mobile/Apex Mobile/LocationDetailViewController.m

@@ -26,7 +26,11 @@
 {
     return YES;
 }
-
+//- (void)viewWillAppear:(BOOL)animated
+//{
+//    
+//    [self.navigationController setNavigationBarHidden:false];
+//}
 - (NSUInteger)supportedInterfaceOrientations
 {
     return UIInterfaceOrientationMaskPortrait;
@@ -35,16 +39,235 @@
 - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
 {
     return UIInterfaceOrientationPortrait;
+}
+- (IBAction)addUnknown:(UIButton *)sender {
+    
+    
+    
+    //    NSString* area = [self.params valueForKey:@"area"];
+    NSString* company = [self.params valueForKey:@"company"];
+    NSString* city = [self.params valueForKey:@"city"];
+    //    double longitude = [[self.params valueForKey:@"longitude"] doubleValue];
+    //    double latitude = [[self.params valueForKey:@"latitude"] doubleValue];
+    NSString* address = [self.params valueForKeyPath:@"address"];
+    NSString* telephone = [self.params valueForKeyPath:@"telephone"];
+    NSString* fax = [self.params valueForKeyPath:@"fax"];
+    //    NSString* contact = [self.params valueForKeyPath:@"contact"];
+    NSString* email = [self.params valueForKeyPath:@"email"];
+    
+    
+    
+    
+    
+    
+    
+    CFStringRef cfscompany = CFStringCreateWithCString( kCFAllocatorDefault, [company UTF8String], kCFStringEncodingUTF8);
+    //    CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+    //    CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+    //    CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+    //    CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+    
+    CFErrorRef error =NULL;
+    ABRecordRef personRef=ABPersonCreate();
+    
+    
+    NSData *dataRef = UIImagePNGRepresentation([UIImage imageNamed:@"apex512"]);
+    ABPersonSetImageData(personRef, CFBridgingRetain(dataRef), &error);
+    //    ABAddressBookAddRecord(iPhoneAddressBook, newPerson, &error);
+    
+    ABRecordSetValue(personRef, kABPersonOrganizationProperty, cfscompany, &error);
+    ABMutableMultiValueRef urlMultiValue = ABMultiValueCreateMutable(kABMultiStringPropertyType);
+    ABMultiValueAddValueAndLabel(urlMultiValue,@"http://www.apexshipping.com", kABPersonHomePageLabel, NULL);
+    ABRecordSetValue(personRef, kABPersonURLProperty, urlMultiValue, &error);
+    
+    
+    ABMutableMultiValueRef multiaddress=ABMultiValueCreateMutable(kABMultiStringPropertyType);
+    //电话号码属于具有多个值的项(除此还有email、地址类)
+    NSMutableDictionary *addressDictionary = [[NSMutableDictionary alloc] init];
+    [addressDictionary setObject:address forKey:(NSString *) kABPersonAddressStreetKey];
+    [addressDictionary setObject:city forKey:(NSString *)kABPersonAddressCityKey];
+    //    [addressDictionary setObject:@"IL" forKey:(NSString *)kABPersonAddressStateKey];
+    //    [addressDictionary setObject:@"60654" forKey:(NSString *)kABPersonAddressZIPKey];
+    ABMultiValueAddValueAndLabel(multiaddress, CFBridgingRetain(addressDictionary), kABWorkLabel, NULL);
+    
+    
+    // CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+    //        ABMultiValueAddValueAndLabel(multiaddress, cfsaddress, kABWorkLabel, NULL);
+    ABRecordSetValue(personRef, kABPersonAddressProperty, multiaddress, &error);
+    
+    
+    ABMutableMultiValueRef multiemail=ABMultiValueCreateMutable(kABMultiStringPropertyType);
+    //电话号码属于具有多个值的项(除此还有email、地址类)
+    NSArray* arremail = [email componentsSeparatedByString:NSLocalizedString(@"\r\n", nil)];
+    for(int i=0;i<arremail.count;i++)
+    {
+        ABMultiValueAddValueAndLabel(multiemail, CFStringCreateWithCString( kCFAllocatorDefault, [arremail[i] UTF8String], kCFStringEncodingUTF8), kABPersonPhoneMainLabel, NULL);
+    }
+    ABRecordSetValue(personRef, kABPersonEmailProperty, multiemail, &error);
+    
+    ABMutableMultiValueRef multiphone=ABMultiValueCreateMutable(kABMultiStringPropertyType);
+    //电话号码属于具有多个值的项(除此还有email、地址类)
+    NSArray* arrphone = [telephone componentsSeparatedByString:NSLocalizedString(@"\r\n", nil)];
+    for(int i=0;i<arrphone.count;i++)
+    {
+        ABMultiValueAddValueAndLabel(multiphone, CFStringCreateWithCString( kCFAllocatorDefault, [arrphone[i] UTF8String], kCFStringEncodingUTF8), kABPersonPhoneMainLabel, NULL);
+    }
+    
+    NSArray* arrfax = [fax componentsSeparatedByString:NSLocalizedString(@"\r\n", nil)];
+    for(int i=0;i<arrfax.count;i++)
+    {
+        ABMultiValueAddValueAndLabel(multiphone, CFStringCreateWithCString( kCFAllocatorDefault, [arrfax[i] UTF8String], kCFStringEncodingUTF8), kABPersonPhoneWorkFAXLabel, NULL);
+    }
+    ABRecordSetValue(personRef, kABPersonPhoneProperty, multiphone, &error);
+    
+    
+    
+    ABUnknownPersonViewController *unknown=[[ABUnknownPersonViewController alloc]init];
+    unknown.displayedPerson = personRef;
+    unknown.unknownPersonViewDelegate = self;
+    unknown.allowsActions = true;
+    
+    ABAddressBookRef addressBook = ABAddressBookCreate();
+//    CFStringRef cfName = CFSTR("小明");
+    NSArray *people = (__bridge NSArray *)(ABAddressBookCopyPeopleWithName(addressBook, cfscompany));
+    
+   if(people.count>0)
+       unknown.allowsAddingToAddressBook = false;
+//    unknown.displayedPerson=person;
+//    unknown.allowsAddingToAddressBook=YES;//允许添加
+    
+//    ABNewPersonViewController *npvc = [[ABNewPersonViewController alloc] init] ;
+//    //  npvc.navigationItem.leftBarButtonItem = BARBUTTON(@"取消", @selector(addNewBackAction:));
+//    //  self.aBNewPersonNav = [[UINavigationController alloc] initWithRootViewController:npvc] ;
+//    npvc.displayedPerson = personRef;
+//    npvc.newPersonViewDelegate = self;
+    // [self presentModalViewController:self.aBNewPersonNav animated:YES];
+    
+    [self.navigationController pushViewController:unknown animated:YES];
+    
+    
+    
+}
+- (IBAction)addContact:(UIButton *)sender {
+    
+    
+    
+    //    NSString* area = [self.params valueForKey:@"area"];
+    NSString* company = [self.params valueForKey:@"company"];
+        NSString* city = [self.params valueForKey:@"city"];
+    //    double longitude = [[self.params valueForKey:@"longitude"] doubleValue];
+    //    double latitude = [[self.params valueForKey:@"latitude"] doubleValue];
+    NSString* address = [self.params valueForKeyPath:@"address"];
+    NSString* telephone = [self.params valueForKeyPath:@"telephone"];
+    NSString* fax = [self.params valueForKeyPath:@"fax"];
+//    NSString* contact = [self.params valueForKeyPath:@"contact"];
+    NSString* email = [self.params valueForKeyPath:@"email"];
+    
+   
+    
+
+    
+    
+    
+    CFStringRef cfscompany = CFStringCreateWithCString( kCFAllocatorDefault, [company UTF8String], kCFStringEncodingUTF8);
+//    CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+//    CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+//    CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+//    CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+    
+    CFErrorRef error =NULL;
+    ABRecordRef personRef=ABPersonCreate();
+
+    
+    NSData *dataRef = UIImagePNGRepresentation([UIImage imageNamed:@"apex512"]);
+    ABPersonSetImageData(personRef, CFBridgingRetain(dataRef), &error);
+//    ABAddressBookAddRecord(iPhoneAddressBook, newPerson, &error);
+    
+    ABRecordSetValue(personRef, kABPersonOrganizationProperty, cfscompany, &error);
+    ABMutableMultiValueRef urlMultiValue = ABMultiValueCreateMutable(kABMultiStringPropertyType);
+    ABMultiValueAddValueAndLabel(urlMultiValue,@"http://www.apexshipping.com", kABPersonHomePageLabel, NULL);
+    ABRecordSetValue(personRef, kABPersonURLProperty, urlMultiValue, &error);
+    
+    
+    ABMutableMultiValueRef multiaddress=ABMultiValueCreateMutable(kABMultiStringPropertyType);
+    //电话号码属于具有多个值的项(除此还有email、地址类)
+    NSMutableDictionary *addressDictionary = [[NSMutableDictionary alloc] init];
+    [addressDictionary setObject:address forKey:(NSString *) kABPersonAddressStreetKey];
+    [addressDictionary setObject:city forKey:(NSString *)kABPersonAddressCityKey];
+//    [addressDictionary setObject:@"IL" forKey:(NSString *)kABPersonAddressStateKey];
+//    [addressDictionary setObject:@"60654" forKey:(NSString *)kABPersonAddressZIPKey];
+    ABMultiValueAddValueAndLabel(multiaddress, CFBridgingRetain(addressDictionary), kABWorkLabel, NULL);
+    
+    
+// CFStringRef cfsaddress = CFStringCreateWithCString( kCFAllocatorDefault, [address UTF8String], kCFStringEncodingUTF8);
+//        ABMultiValueAddValueAndLabel(multiaddress, cfsaddress, kABWorkLabel, NULL);
+    ABRecordSetValue(personRef, kABPersonAddressProperty, multiaddress, &error);
+    
+    
+    ABMutableMultiValueRef multiemail=ABMultiValueCreateMutable(kABMultiStringPropertyType);
+    //电话号码属于具有多个值的项(除此还有email、地址类)
+    NSArray* arremail = [email componentsSeparatedByString:NSLocalizedString(@"\r\n", nil)];
+    for(int i=0;i<arremail.count;i++)
+    {
+        ABMultiValueAddValueAndLabel(multiemail, CFStringCreateWithCString( kCFAllocatorDefault, [arremail[i] UTF8String], kCFStringEncodingUTF8), kABPersonPhoneMainLabel, NULL);
+    }
+    ABRecordSetValue(personRef, kABPersonEmailProperty, multiemail, &error);
+    
+    ABMutableMultiValueRef multiphone=ABMultiValueCreateMutable(kABMultiStringPropertyType);
+    //电话号码属于具有多个值的项(除此还有email、地址类)
+    NSArray* arrphone = [telephone componentsSeparatedByString:NSLocalizedString(@"\r\n", nil)];
+    for(int i=0;i<arrphone.count;i++)
+    {
+    ABMultiValueAddValueAndLabel(multiphone, CFStringCreateWithCString( kCFAllocatorDefault, [arrphone[i] UTF8String], kCFStringEncodingUTF8), kABPersonPhoneMainLabel, NULL);
+    }
+    
+    NSArray* arrfax = [fax componentsSeparatedByString:NSLocalizedString(@"\r\n", nil)];
+    for(int i=0;i<arrfax.count;i++)
+    {
+        ABMultiValueAddValueAndLabel(multiphone, CFStringCreateWithCString( kCFAllocatorDefault, [arrfax[i] UTF8String], kCFStringEncodingUTF8), kABPersonPhoneWorkFAXLabel, NULL);
+    }
+    ABRecordSetValue(personRef, kABPersonPhoneProperty, multiphone, &error);
+    
+    
+    
+    
+    
+    ABNewPersonViewController *npvc = [[ABNewPersonViewController alloc] init] ;
+  //  npvc.navigationItem.leftBarButtonItem = BARBUTTON(@"取消", @selector(addNewBackAction:));
+  //  self.aBNewPersonNav = [[UINavigationController alloc] initWithRootViewController:npvc] ;
+    npvc.displayedPerson = personRef;
+    npvc.newPersonViewDelegate = self;
+   // [self presentModalViewController:self.aBNewPersonNav animated:YES];
+    
+    [self.navigationController pushViewController:npvc animated:YES];
+    
+    
+   
 }
 - (void)viewDidLoad
 {
     [super viewDidLoad];
-//    NSString* sss=[self.params valueForKey:@"name"];
-    self.nameText.text = [self.params valueForKey:@"name"];
     
-    NSString* content = [NSString stringWithFormat:@"%@\n\n%@\n\n%@\n\n%@\n\n%@",[self.params valueForKey:@"addr"],[self.params valueForKey:@"tel"],[self.params valueForKey:@"fax"],[self.params valueForKey:@"contact"],[self.params valueForKey:@"email"]];
+    UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(addUnknown:)];
+//    addButton.title = @"Add Contact";
+    
+    self.navigationItem.rightBarButtonItem = addButton;
+    
+    
+    UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(onCloseClick:)];
+//    closeButton.title = @"Close";
+    
+    self.navigationItem.leftBarButtonItem = closeButton;
+    
+    self.navigationItem.title =[self.params valueForKey:@"company"];
+    
+    
+ //   NSString* sss=[self.params valueForKey:@"telephone"];
+  //  self.nameText.text = [self.params valueForKey:@"company"];
+    
+    NSString* content = [NSString stringWithFormat:@"%@\n\nAddress\n%@\n\nTel\n%@\n\nFax\n%@\n\nContact\n%@\n\nEmail\n%@",[self.params valueForKey:@"company"],[self.params valueForKey:@"address"],[self.params valueForKey:@"telephone"],[self.params valueForKey:@"fax"],[self.params valueForKey:@"contact"],[self.params valueForKey:@"email"]];
     self.contentText.text = content;
-
+    
 }
 
 - (void)didReceiveMemoryWarning
@@ -59,14 +282,23 @@
 }
 
 /*
-#pragma mark - Navigation
-
-// In a storyboard-based application, you will often want to do a little preparation before navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
+ #pragma mark - Navigation
+ 
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
+ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
+ {
+ // Get the new view controller using [segue destinationViewController].
+ // Pass the selected object to the new view controller.
+ }
+ */
+#pragma mark -ABNewPersonViewControllerDelegate
+- (void)newPersonViewController:(ABNewPersonViewController *)newPersonViewController didCompleteWithNewPerson:(ABRecordRef)person
 {
-    // Get the new view controller using [segue destinationViewController].
-    // Pass the selected object to the new view controller.
+    [self.navigationController popViewControllerAnimated:true];
+    
+//    [self.aBNewPersonNav dismissViewControllerAnimated:true completion:^{
+//        ;
+//    }];
+    //    newPersonViewController.navigationController navigationItem
 }
-*/
-
 @end

+ 7 - 1
Apex Mobile/Apex Mobile/LocationViewController.h

@@ -10,9 +10,15 @@
 #import <GoogleMaps/GoogleMaps.h>
 #import "LocationDetailViewController.h"
 #import "Constant.h"
-
+#import "ApexMobileNetwork.h"
 
 @interface LocationViewController : UIViewController<GMSMapViewDelegate>
 
 @property (strong,nonatomic) NSMutableDictionary * params;
+-(void)  updateLocation;
+-(void) addLocation;
+@property (strong,nonatomic) NSArray* Locations;
+@property (strong, nonatomic) IBOutlet UIView *mapContainer;
+@property BOOL showNavigation;
+@property (strong,nonatomic) UINavigationController * aBNewPersonNav;
 @end

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 28 - 3
Apex Mobile/Apex Mobile/LocationViewController.m


+ 15 - 0
Apex Mobile/Apex Mobile/MessageDetailItem.h

@@ -0,0 +1,15 @@
+//
+//  MessageDetailItem.h
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-10.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "RTLabel.h"
+@interface MessageDetailItem : UITableViewCell
+//@property (strong, nonatomic) IBOutlet UITextView *textview;
+@property (strong, nonatomic) IBOutlet RTLabel *contentLabel;
+
+@end

+ 34 - 0
Apex Mobile/Apex Mobile/MessageDetailItem.m

@@ -0,0 +1,34 @@
+//
+//  MessageDetailItem.m
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-10.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "MessageDetailItem.h"
+
+@implementation MessageDetailItem
+
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+{
+    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+    if (self) {
+        // Initialization code
+    }
+    return self;
+}
+
+- (void)awakeFromNib
+{
+    // Initialization code
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated
+{
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+@end

+ 21 - 0
Apex Mobile/Apex Mobile/MessageDetailViewController.h

@@ -0,0 +1,21 @@
+//
+//  MessageDetailViewController.h
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-10.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MessageDetailViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>
+
+@property (strong,nonatomic) NSMutableDictionary* params;
+@property (strong, nonatomic) IBOutlet UITableView *tableview;
+@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *mum;
+@property int limit;
+@property int offset;
+@property (strong,nonatomic) NSString* s_id;
+@property (strong,nonatomic) NSString* e_id;
+@property (strong,nonatomic) NSMutableArray * messageinfo;
+@end

+ 302 - 0
Apex Mobile/Apex Mobile/MessageDetailViewController.m

@@ -0,0 +1,302 @@
+//
+//  MessageDetailViewController.m
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-10.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "MessageDetailViewController.h"
+#import "MessageDetailItem.h"
+#import "ApexMobileNetwork.h"
+#import "RTLabel.h"
+#import "DetailTabBarController.h"
+#import "TabBarController.h"
+#define  DEF_CELL_HEIGHT 44
+#define  DEF_TABLE_HEIGHT 44
+#define  LINE_WIDTH 0
+#define  CELL_MARGIN 0
+#define  LABEL_MARGIN 5
+
+@interface MessageDetailViewController ()
+
+@end
+
+@implementation MessageDetailViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+    if (self) {
+        // Custom initialization
+    }
+    return self;
+}
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
+-(void) loadpage
+{
+    
+    //    [self.params setValue:[NSString stringWithFormat:@"%ld",self.offset] forKey:@"offset"];
+    self.mum.center = self.view.center;
+    //    self.btnrefresh.enabled = false;
+    //
+    //    NSTimeInterval animationDuration = 0.30f;
+    //    [UIView beginAnimations:@"ResizeView" context:nil];
+    //    [UIView setAnimationDuration:animationDuration];
+    //    self.prepageButton.enabled=false;
+    //    self.nextpageButton.enabled=false;
+    //    self.mum.hidden = false;
+    //    self.grid.hidden = true;
+    //    self.mum.hidden = false;
+    //    self.tableview.hidden = true;
+    
+    //    [UIView commitAnimations];
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        
+        
+        NSData* data=nil;
+        data=[ApexMobileNetwork get_MessageDetail:self.offset limit:self.limit from:self.s_id to:self.e_id];
+        
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            self.tableview.hidden =false;
+            self.mum.hidden = true;
+            if(data != nil)
+            {
+                NSError *error=nil;
+                NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
+                int total = [[jsobj valueForKey:@"total" ] intValue] ;
+                NSDictionary* objrecords = [jsobj objectForKey:@"records"];
+                
+                for(int i=0;i<total;i++)
+                {
+                    
+                    NSDictionary* objmsg = [objrecords objectForKey:[NSString stringWithFormat:@"record%d",i]];
+                    [self.messageinfo addObject:objmsg];
+                    
+                }
+                
+                
+                //                [self.data appenddata: data];
+                //                self.lastid = self.data._id;
+                //                self.btnrefresh.hidden = false;
+                //                if(self.data.finishload==true)
+                //                {
+                //
+                //                    int i =self.btnrefresh.state;
+                //                    self.btnrefresh.titleLabel.text =@"No more";
+                //                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
+                //                }
+                //                else
+                //                {
+                //                    self.btnrefresh.enabled = true;
+                //                    self.btnrefresh.titleLabel.text =@"Load more";
+                //                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+                //                }
+                [self.tableview reloadData ];
+                [UIApplication sharedApplication].applicationIconBadgeNumber --;
+            }
+            else
+            {
+                //                self.btnrefresh.enabled = true;
+                //                [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+                
+            }
+            NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+            bool autologin =[defaults boolForKey:@"autologin"];
+            if(!autologin)
+            {
+                TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
+                [self presentViewController:viewController animated:YES completion:^{
+                    
+                }];
+            }
+            
+            
+            
+            
+            
+        });
+    });
+}
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    self.offset = 0;
+    self.limit = 20;
+    self.s_id = [self.params valueForKey:@"s_id"];
+    self.e_id = [self.params valueForKey:@"e_id"];
+    self.messageinfo = [[NSMutableArray alloc]init];
+    [self loadpage];
+    // Do any additional setup after loading the view.
+}
+//-(void) viewWillAppear:(BOOL)animated
+//{
+//    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+//    bool autologin =[defaults boolForKey:@"autologin"];
+//    if(!autologin)
+//    {
+//        TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
+//        [self presentViewController:viewController animated:YES completion:^{
+//            
+//        }];
+//    }
+//}
+
+- (void)didReceiveMemoryWarning
+{
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+ #pragma mark - Navigation
+ 
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
+ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
+ {
+ // Get the new view controller using [segue destinationViewController].
+ // Pass the selected object to the new view controller.
+ }
+ */
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+    
+    return 1;
+}
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+    
+    return self.messageinfo.count;
+    
+    
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    DebugLog(@"cellForRowAtIndexPath");
+    
+    //    NSString *CellIdentifier = @"messagedetailitem";
+    //    MessageDetailItem *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+    NSString *CellIdentifier = @"messagedetailitem";
+    MessageDetailItem *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+    
+    NSString* title = [self.messageinfo[indexPath.row] valueForKey:@"title"];
+    cell.contentLabel.text = title;
+    
+    //    float width = tableView.frame.size.width;
+    //
+    //    width-=CELL_MARGIN*2;
+    //    CGSize constraint = CGSizeMake(width*-2*LABEL_MARGIN, 20000.0f);//key label width is 40% cell width;
+    //
+    //
+    //
+    //
+    //    CGRect frame;
+    //    frame.size = constraint;
+    //    frame.origin.x=0;
+    //    frame.origin.y=0;
+    //    RTLabel* rtlabel = [[RTLabel alloc] initWithFrame:frame];
+    //    [rtlabel setLineBreakMode: RTTextLineBreakModeWordWrapping];
+    //    //        rtlabel.lineSpacing = 20.0;
+    //    [rtlabel setText: title];
+    //    CGSize sizeval=rtlabel.optimumSize;
+    //      CGRect frameval = cell.valLabel.frame;
+    //    frameval.origin.x=constraintkey.width+CELL_MARGIN+3*LABEL_MARGIN; //2 margin for key 1 margin for value self
+    //    frameval.origin.y=LINE_WIDTH;
+    //    frameval.size = sizeval;
+    //    cell.valLabel.frame = frameval;
+    //    //        [cell.valLabel setTextAlignment:RTTextAlignmentCenter];
+    //    cell.valLabel.text= val;
+    //    CGPoint rcenter;
+    //    rcenter.x = width * 0.4+width * 0.6/2;
+    //    rcenter.y = height /2;
+    //    cell.valLabel.center=rcenter;
+    //    //        cell.valLabel.backgroundColor =[UIColor redColor];
+    //
+    //    //        cell.contentView.superview.backgroundColor = [UIColor clearColor];
+    //    //        cell.backgroundColor = [UIColor whiteColor];
+    //    UIView * lineview = [[LineView alloc] initWithFrame:cell.contentView.frame];
+    //    lineview.userInteractionEnabled = NO;// 不设为NO会屏蔽cell的点击事件
+    //    lineview.backgroundColor = [UIColor clearColor];// 设为透明从而使得cell.backgroundColor有效.
+    //    lineview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    //    [cell.contentView addSubview:lineview];// cell.contentView是个readonly属性,所以别想着替换contentView了.
+    
+    //       cell.textview.text = title;
+    //    cell.TimeLabel.text=time;
+    //    [cell.MessageLabel sizeToFit];
+    //    NSString* content = [self.data.pagedata[indexPath.row] valueForKey:@"content"];
+    //    NSString* base64img =[self.data.pagedata[indexPath.row] valueForKey:@"image"];
+    //
+    //    if(base64img.length>0)
+    //    {
+    //        NSData *_decodedImageData   = [[NSData alloc] initWithBase64EncodedString:base64img options:NSDataBase64DecodingIgnoreUnknownCharacters];
+    //        cell.image.image = [UIImage imageWithData:_decodedImageData];
+    //    }
+    //    else
+    //    {
+    //        UIImage * img =[UIImage imageNamed:@"rect_market_news"];
+    //        cell.image.image = img;
+    //
+    //    }
+    //    cell.title.text = title;
+    //    [cell.title sizeToFit];
+    //
+    //    cell.content.text =content;
+    
+    //    cell.imageView.image = [UIImage imageNamed:[self.toolsinfo[indexPath.row] valueForKey:@"img"]];
+    
+    return cell;
+    
+    
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    
+    
+    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
+    
+    [params setObject:@"dumb" forKey:@"id"];
+    
+    [params setObject:@"1" forKey:@"criterion_type"];
+    NSString * cargo_criterion = [self.messageinfo[indexPath.row] valueForKey:@"url"];
+    
+    [params setObject:cargo_criterion forKey:@"cargo_criterion"];
+    
+    
+    DetailTabBarController *detailViewController=[[DetailTabBarController alloc] init:@"Cargo Tracking" actions:[NSArray arrayWithObjects:@"Tracking",nil] params:params];
+    [self.navigationController pushViewController:detailViewController animated:YES];
+    
+    //    SearchViewController *searchViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
+    //    searchViewController.function_name = @"Download Document";
+    //    [self.navigationController pushViewController:searchViewController animated:YES];
+    //    return;
+    
+    //    NSString* title = [self.toolsinfo[indexPath.row] valueForKey:@"title"];
+    //    if([title isEqualToString:@"Market news"])
+    //    {
+    //        NewsViewController *newsview=[[NewsViewController alloc] init:title ];
+    //        [self.navigationController pushViewController:newsview animated:YES];
+    //    }
+    //    else if([title isEqualToString:@"Announcements"])
+    //    {
+    //        NewsViewController *newsview=[[NewsViewController alloc] init:title ];
+    //        [self.navigationController pushViewController:newsview animated:YES];
+    //    }
+}
+
+@end

+ 15 - 0
Apex Mobile/Apex Mobile/MessageItem.h

@@ -0,0 +1,15 @@
+//
+//  MessageItem.h
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-10.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface MessageItem : UITableViewCell
+@property (strong, nonatomic) IBOutlet UILabel *MessageLabel;
+@property (strong, nonatomic) IBOutlet UILabel *TimeLabel;
+
+@end

+ 34 - 0
Apex Mobile/Apex Mobile/MessageItem.m

@@ -0,0 +1,34 @@
+//
+//  MessageItem.m
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-10.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "MessageItem.h"
+
+@implementation MessageItem
+
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+{
+    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+    if (self) {
+        // Initialization code
+    }
+    return self;
+}
+
+- (void)awakeFromNib
+{
+    // Initialization code
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated
+{
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+@end

+ 20 - 0
Apex Mobile/Apex Mobile/MessageViewController.h

@@ -0,0 +1,20 @@
+//
+//  MessageViewController.h
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-10.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "ApexMobileDB.h"
+#import "ApexMobileNetwork.h"
+@interface MessageViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>
+
+@property (strong, nonatomic) IBOutlet UITableView *tableview;
+@property int offset;
+@property int limit;
+@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *mum;
+@property (strong,nonatomic) UIButton* btnrefresh;
+@property (strong,nonatomic) NSMutableArray * messageinfo;
+@end

+ 348 - 0
Apex Mobile/Apex Mobile/MessageViewController.m

@@ -0,0 +1,348 @@
+//
+//  MessageViewController.m
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-10.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "MessageViewController.h"
+#import "MessageItem.h"
+#import "MessageDetailViewController.h"
+#import "TabBarController.h"
+@interface MessageViewController ()
+
+@end
+
+@implementation MessageViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+    if (self) {
+        // Custom initialization
+    }
+    return self;
+}
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
+-(void) loadpage
+{
+    
+    //    [self.params setValue:[NSString stringWithFormat:@"%ld",self.offset] forKey:@"offset"];
+    self.mum.center = self.view.center;
+    self.btnrefresh.enabled = false;
+    //
+    //    NSTimeInterval animationDuration = 0.30f;
+    //    [UIView beginAnimations:@"ResizeView" context:nil];
+    //    [UIView setAnimationDuration:animationDuration];
+    //    self.prepageButton.enabled=false;
+    //    self.nextpageButton.enabled=false;
+    //    self.mum.hidden = false;
+    //    self.grid.hidden = true;
+    //    self.mum.hidden = false;
+    //    self.tableview.hidden = true;
+    
+    //    [UIView commitAnimations];
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        
+        
+        NSData* data=nil;
+        data=[ApexMobileNetwork pull_message :self.offset];
+        
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            self.tableview.hidden =false;
+            self.mum.hidden = true;
+            if(data != nil)
+            {
+                self.btnrefresh.hidden = false;
+                NSError *error=nil;
+                NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
+                int total = [[jsobj valueForKey:@"total" ] intValue] ;
+                NSDictionary* objrecords = [jsobj objectForKey:@"records"];
+                self.offset += total;
+                for(int i=0;i<total;i++)
+                {
+                    
+                    NSDictionary* objmsg = [objrecords objectForKey:[NSString stringWithFormat:@"record%d",i]];
+                    [self.messageinfo addObject:objmsg];
+                    
+                }
+                if(total<self.limit)
+                {
+                    
+                    int i =self.btnrefresh.state;
+                    self.btnrefresh.titleLabel.text =@"No more";
+                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
+                }
+                else
+                {
+                    self.btnrefresh.enabled = true;
+                    self.btnrefresh.titleLabel.text =@"Load more";
+                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+                }
+               
+                
+//                [self.data appenddata: data];
+//                self.lastid = self.data._id;
+//                self.btnrefresh.hidden = false;
+//                if(self.data.finishload==true)
+//                {
+//                    
+//                    int i =self.btnrefresh.state;
+//                    self.btnrefresh.titleLabel.text =@"No more";
+//                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
+//                }
+//                else
+//                {
+//                    self.btnrefresh.enabled = true;
+//                    self.btnrefresh.titleLabel.text =@"Load more";
+//                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+//                }
+                [self.tableview reloadData ];
+            }
+            else
+            {
+                self.btnrefresh.enabled = true;
+                [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+                
+            }
+            
+            
+            NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+            bool autologin =[defaults boolForKey:@"autologin"];
+            if(!autologin)
+            {
+                TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
+                [self presentViewController:viewController animated:YES completion:^{
+                    
+                }];
+            }
+            
+            
+        });
+    });
+}
+
+- (void)loadmore
+{
+    self.btnrefresh.enabled = NO;
+    self.btnrefresh.titleLabel.text =@"Loading...";
+    
+    //    [self.btnrefresh setTitle:@"Loading..." forState:UIControlStateNormal];
+    [self loadpage];
+
+}
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    self.offset = 0;
+    self.limit = 20;
+    self.messageinfo = [[NSMutableArray alloc]init];
+    
+    self.btnrefresh = [UIButton buttonWithType:UIButtonTypeCustom];
+    //    self.btnrefresh.titleLabel.text =@"Load more";
+    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+    self.btnrefresh.hidden = true;
+    [self.btnrefresh setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
+    self.btnrefresh.backgroundColor = [UIColor lightGrayColor];
+    [self.btnrefresh addTarget:self action:@selector(loadmore) forControlEvents:UIControlEventTouchUpInside];
+    self.btnrefresh.frame =CGRectMake(0.0f, 0.0f, self.tableview.bounds.size.width, 44.0f);
+    self.tableview.tableFooterView = self.btnrefresh;//tableFooterView;
+    [self loadpage];
+    // Do any additional setup after loading the view.
+}
+
+- (void)didReceiveMemoryWarning
+{
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
+{
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+    
+    return 1;
+}
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+    
+    return self.messageinfo.count;
+    
+    
+}
+- (IBAction)delAllMessage:(id)sender {
+    if(self.messageinfo.count<=0)
+        return;
+    NSString * _id =[self.messageinfo[0] valueForKey:@"id"];
+    if(_id.length>0)
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            
+            
+            int result = [ApexMobileNetwork delAllMessage:_id];;
+            
+            
+            dispatch_async(dispatch_get_main_queue(), ^{
+                if(result==1)
+                {
+                    [self.messageinfo removeAllObjects ];
+                [self.tableview reloadData];
+                    [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
+                }
+                
+                NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+                bool autologin =[defaults boolForKey:@"autologin"];
+                if(!autologin)
+                {
+                    TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
+                    [self presentViewController:viewController animated:YES completion:^{
+                        
+                    }];
+                }
+//                self.tableview.hidden =false;
+//                self.mum.hidden = true;
+//                if(data != nil)
+//                {
+//                    NSError *error=nil;
+//                    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
+//                    int total = [[jsobj valueForKey:@"total" ] intValue] ;
+//                    NSDictionary* objrecords = [jsobj objectForKey:@"records"];
+//                    
+//                    for(int i=0;i<total;i++)
+//                    {
+//                        
+//                        NSDictionary* objmsg = [objrecords objectForKey:[NSString stringWithFormat:@"record%d",i]];
+//                        [self.messageinfo addObject:objmsg];
+//                        
+//                    }
+//                    
+//                    
+//                    //                [self.data appenddata: data];
+//                    //                self.lastid = self.data._id;
+//                    //                self.btnrefresh.hidden = false;
+//                    //                if(self.data.finishload==true)
+//                    //                {
+//                    //
+//                    //                    int i =self.btnrefresh.state;
+//                    //                    self.btnrefresh.titleLabel.text =@"No more";
+//                    //                    //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
+//                    //                }
+//                    //                else
+//                    //                {
+//                    //                    self.btnrefresh.enabled = true;
+//                    //                    self.btnrefresh.titleLabel.text =@"Load more";
+//                    //                    //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+//                    //                }
+//                    [self.tableview reloadData ];
+//                }
+//                else
+//                {
+//                    self.btnrefresh.enabled = true;
+//                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+//                    
+//                }
+//                
+                
+                
+                
+                
+            });
+        });
+
+        
+    {
+        
+    }
+    
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    DebugLog(@"cellForRowAtIndexPath");
+    
+    NSString *CellIdentifier = @"tableitemmsg";
+    MessageItem *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+    NSString* title = @"New message from Apex";
+    NSString* time =[self.messageinfo[indexPath.row] valueForKey:@"insert_time"];
+    cell.MessageLabel.text = title;
+    cell.TimeLabel.text=time;
+    [cell.MessageLabel sizeToFit];
+//    NSString* content = [self.data.pagedata[indexPath.row] valueForKey:@"content"];
+//    NSString* base64img =[self.data.pagedata[indexPath.row] valueForKey:@"image"];
+//    
+//    if(base64img.length>0)
+//    {
+//        NSData *_decodedImageData   = [[NSData alloc] initWithBase64EncodedString:base64img options:NSDataBase64DecodingIgnoreUnknownCharacters];
+//        cell.image.image = [UIImage imageWithData:_decodedImageData];
+//    }
+//    else
+//    {
+//        UIImage * img =[UIImage imageNamed:@"rect_market_news"];
+//        cell.image.image = img;
+//        
+//    }
+//    cell.title.text = title;
+//    [cell.title sizeToFit];
+//    
+//    cell.content.text =content;
+    
+    //    cell.imageView.image = [UIImage imageNamed:[self.toolsinfo[indexPath.row] valueForKey:@"img"]];
+    
+    return cell;
+    
+    
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    MessageDetailViewController * viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MessageDetailViewController"];
+    NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
+    NSString* sid= [self.messageinfo[indexPath.row] valueForKey:@"s_id"];
+    NSString* eid= [self.messageinfo[indexPath.row] valueForKey:@"e_id"];
+    
+    [params setValue:sid forKey:@"s_id"];
+    [params setValue:eid forKey:@"e_id"];
+    viewController.params = params;
+    [self.navigationController pushViewController:viewController animated:YES];
+
+    //    SearchViewController *searchViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
+    //    searchViewController.function_name = @"Download Document";
+    //    [self.navigationController pushViewController:searchViewController animated:YES];
+    //    return;
+    
+    //    NSString* title = [self.toolsinfo[indexPath.row] valueForKey:@"title"];
+    //    if([title isEqualToString:@"Market news"])
+    //    {
+    //        NewsViewController *newsview=[[NewsViewController alloc] init:title ];
+    //        [self.navigationController pushViewController:newsview animated:YES];
+    //    }
+    //    else if([title isEqualToString:@"Announcements"])
+    //    {
+    //        NewsViewController *newsview=[[NewsViewController alloc] init:title ];
+    //        [self.navigationController pushViewController:newsview animated:YES];
+    //    }
+}
+@end

+ 3 - 1
Apex Mobile/Apex Mobile/MyAutocompleteItemsSource.h

@@ -9,8 +9,10 @@
 #import <Foundation/Foundation.h>
 //#import "TRAutocompleteItemsSource.h"
 @interface MyAutocompleteItemsSource : NSObject//<TRAutocompleteItemsSource>
-- (id)initWithMinimumCharactersToTrigger:(NSUInteger)minimumCharactersToTrigger;
+- (id)initWithMinimumCharactersToTrigger:(NSUInteger)minimumCharactersToTrigger source:(NSArray*) predictions;
 //- (id)initWithMinimumCharactersToTrigger:(NSUInteger)minimumCharactersToTrigger
 - (NSUInteger)minimumCharactersToTrigger;
 - (void)itemsFor:(NSString *)query whenReady:(void (^)(NSArray *))suggestionsReady;
+-(void) put_predictions:(NSArray*)predictions;
+@property (strong,nonatomic) NSArray* predictions;
 @end

+ 11 - 6
Apex Mobile/Apex Mobile/MyAutocompleteItemsSource.m

@@ -17,7 +17,7 @@
     BOOL _requestToReload;
     BOOL _loading;
 }
-- (id)initWithMinimumCharactersToTrigger:(NSUInteger)minimumCharactersToTrigger
+- (id)initWithMinimumCharactersToTrigger:(NSUInteger)minimumCharactersToTrigger source:(NSArray*) predictions
 //                                language:(NSString *)language
 //                                  apiKey:(NSString *)apiKey
 {
@@ -26,6 +26,7 @@
     {
         
         _minimumCharactersToTrigger = minimumCharactersToTrigger;
+        self.predictions = predictions;
         //        _apiKey = apiKey;
         //        _language = language;
         
@@ -59,18 +60,22 @@
         [self requestSuggestionsFor:query whenReady:suggestionsReady];
     }
 }
-
+-(void) put_predictions:(NSArray*)predictions
+{
+    self.predictions = predictions;
+    
+}
 - (void)requestSuggestionsFor:(NSString *)query whenReady:(void (^)(NSArray *))suggestionsReady
 {
     
     NSMutableArray *suggestions = [[NSMutableArray alloc] init];
-    NSArray *predictions =[[NSArray alloc] initWithObjects:@"aa",@"aab",@"bbc",@"bbbd",nil];
+//    NSArray *predictions =[[NSArray alloc] initWithObjects:@"aa",@"aab",@"bbc",@"bbbd",nil];
     
-    for (int i=0;i<predictions.count;i++)
+    for (int i=0;i<self.predictions.count;i++)
     {
-        if([predictions[i] rangeOfString:query].location==0)
+        if([self.predictions[i] rangeOfString:query].location==0)
         {
-            MySuggestion *suggestion = [[MySuggestion alloc] initWith:predictions[i]];
+            MySuggestion *suggestion = [[MySuggestion alloc] initWith:self.predictions[i]];
             [suggestions addObject:suggestion];
         }
     }

+ 3 - 2
Apex Mobile/Apex Mobile/MyAutocompleteView.h

@@ -21,6 +21,7 @@
 + (MyAutocompleteView *)autocompleteViewBindedTo:(UITextField *)textField
                                      usingSource:(MyAutocompleteItemsSource*) itemsSource
                                      cellFactory:(MyAutocompletionCellFactory*)factory
-                                    presentingIn:(UIViewController *)controller;
-
+//                                    presentingIn:(UIViewController *)controller
+                                      parentView:(UIView*) view;
+@property (strong,nonatomic) MyAutocompleteItemsSource* itemsSource;
 @end

+ 19 - 11
Apex Mobile/Apex Mobile/MyAutocompleteView.m

@@ -14,8 +14,10 @@
 {
     BOOL _visible;
 
-    __weak UITextField *_queryTextField;
-    __weak UIViewController *_contextController;
+//    __weak UITextField *_queryTextField;
+    UITextField *_queryTextField;
+//    __weak UIViewController *_contextController;
+    UIView* _parentView;
 
     UITableView *_table;
     MyAutocompleteItemsSource* _itemsSource;
@@ -25,20 +27,23 @@
 + (MyAutocompleteView *)autocompleteViewBindedTo:(UITextField *)textField
                                      usingSource:(MyAutocompleteItemsSource*) itemsSource
                                      cellFactory:(MyAutocompletionCellFactory*) factory
-                                    presentingIn:(UIViewController *)controller
+//                                    presentingIn:(UIViewController *)controller
+parentView:(UIView*) view
 {
     return [[MyAutocompleteView alloc] initWithFrame:CGRectZero
                                            textField:textField
                                          itemsSource:itemsSource
                                          cellFactory:factory
-                                          controller:controller];
+//                                          controller:controller
+                                          parentView:view];
 }
 
 - (id)initWithFrame:(CGRect)frame
           textField:(UITextField *)textField
         itemsSource:(MyAutocompleteItemsSource*) itemsSource
         cellFactory:(MyAutocompletionCellFactory*) factory
-         controller:(UIViewController *)controller
+//         controller:(UIViewController *)controller
+         parentView:(UIView*) view
 {
     self = [super initWithFrame:frame];
     if (self)
@@ -48,7 +53,8 @@
         _queryTextField = textField;
         _itemsSource = itemsSource;
         _cellFactory = factory;
-        _contextController = controller;
+//        _contextController = controller;
+        _parentView = view;
 
         _table = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
         _table.backgroundColor = [UIColor whiteColor];
@@ -97,21 +103,21 @@
     CGFloat kbHeight = 0;
     if (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation))
     {
-        contextViewHeight = _contextController.view.frame.size.height;
+        contextViewHeight = _parentView.frame.size.height;//_contextController.view.frame.size.height;
         kbHeight = kbSize.height;
     }
     else if (UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation))
     {
-        contextViewHeight = _contextController.view.frame.size.width;
+        contextViewHeight =_parentView.frame.size.width;// _contextController.view.frame.size.width;
         kbHeight = kbSize.width;
     }
 
-    CGPoint textPosition = [_queryTextField convertPoint:_queryTextField.bounds.origin toView:nil]; //Taking in account Y position of queryTextField relatively to it's Window
+    CGPoint textPosition = [_queryTextField convertPoint:_queryTextField.bounds.origin toView:_parentView]; //Taking in account Y position of queryTextField relatively to it's Window
     CGRect textfieldFrame = _queryTextField.frame;
     CGFloat calculatedY = textPosition.y + _queryTextField.frame.size.height + self.topMargin;
     CGFloat calculatedHeight = 130;//150;//contextViewHeight - calculatedY - kbHeight;
 
-    calculatedHeight += _contextController.tabBarController.tabBar.frame.size.height; //keyboard is shown over it, need to compensate
+//    calculatedHeight += _contextController.tabBarController.tabBar.frame.size.height; //keyboard is shown over it, need to compensate
 
     self.frame = CGRectMake(_queryTextField.frame.origin.x,
                             calculatedY,
@@ -146,7 +152,9 @@
 
                                                                     if (self.suggestions.count > 0 && !_visible)
                                                                     {
-                                                                        [_contextController.view addSubview:self];
+                                                                        [_parentView addSubview:self];
+//                                                                        [_contextController.view addSubview:self];
+                                                                        CGRect r= self.frame;
                                                                         _visible = YES;
                                                                     }
                                                                 }

+ 15 - 0
Apex Mobile/Apex Mobile/NewsDetailViewController.h

@@ -0,0 +1,15 @@
+//
+//  NewsDetailViewController.h
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-14.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface NewsDetailViewController : UIViewController
+@property (strong, nonatomic) IBOutlet UIWebView *webview;
+//@property (strong,nonatomic) NSString* _title;
+@property (strong,nonatomic) NSString* url;
+@end

+ 72 - 0
Apex Mobile/Apex Mobile/NewsDetailViewController.m

@@ -0,0 +1,72 @@
+//
+//  NewsDetailViewController.m
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-14.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "NewsDetailViewController.h"
+
+@interface NewsDetailViewController ()
+
+@end
+
+@implementation NewsDetailViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+    if (self) {
+        // Custom initialization
+    }
+    return self;
+}
+
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]];
+
+    [self.webview loadRequest:request];
+
+    // Do any additional setup after loading the view.
+}
+
+- (void)didReceiveMemoryWarning
+{
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
+{
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+- (void)webViewDidFinishLoad:(UIWebView *)webView
+{
+    // finished loading, hide the activity indicator in the status bar
+//    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
+    [self.webview stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '150%'"];
+}
+@end

+ 19 - 1
Apex Mobile/Apex Mobile/NewsViewController.m

@@ -7,13 +7,26 @@
 //
 
 #import "NewsViewController.h"
-
+#import "NewsDetailViewController.h"
 @interface NewsViewController ()
 
 @end
 
 @implementation NewsViewController
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
 
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
 -(void) loadpage
 {
     
@@ -230,6 +243,11 @@
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     
+    NewsDetailViewController *viewcontroller=[self.storyboard instantiateViewControllerWithIdentifier:@"NewsDetailViewController"];
+    viewcontroller.title = [self.data.pagedata[indexPath.row] valueForKey:@"title"];;
+    viewcontroller.url = [self.data.pagedata[indexPath.row] valueForKey:@"url"];;
+    [self.navigationController pushViewController:viewcontroller animated:YES];
+    
     //    SearchViewController *searchViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
     //    searchViewController.function_name = @"Download Document";
     //    [self.navigationController pushViewController:searchViewController animated:YES];

+ 14 - 0
Apex Mobile/Apex Mobile/PdfViewController.h

@@ -0,0 +1,14 @@
+//
+//  PdfViewController.h
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-5.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface PdfViewController : UIViewController
+@property (strong,nonatomic) NSString* filepath;
+@property (strong, nonatomic) IBOutlet UIWebView *webview;
+@end

+ 55 - 0
Apex Mobile/Apex Mobile/PdfViewController.m

@@ -0,0 +1,55 @@
+//
+//  PdfViewController.m
+//  Apex Mobile
+//
+//  Created by Ray on 14-5-5.
+//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "PdfViewController.h"
+
+@interface PdfViewController ()
+
+@end
+
+@implementation PdfViewController
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+    if (self) {
+        // Custom initialization
+    }
+    return self;
+}
+
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+    
+//    NSString *filePath = [[NSBundle mainBundle]pathForResource:@"1" ofType:@"html"];
+    NSURL *url = [NSURL fileURLWithPath:self.filepath];
+    NSURLRequest *request = [NSURLRequest requestWithURL:url];
+    [self.webview loadRequest:request];
+
+    // Do any additional setup after loading the view.
+}
+
+- (void)didReceiveMemoryWarning
+{
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
+{
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 21 - 3
Apex Mobile/Apex Mobile/ResultViewController.m

@@ -7,7 +7,7 @@
 //
 
 #import "ResultViewController.h"
-
+#import "TabBarController.h"
 @interface ResultViewController ()
 -(void) getHeader: (NSMutableArray*)header_name header_aname:(NSMutableArray*)header_aname;
 -(void) loadpage;
@@ -30,6 +30,8 @@
     self.grid.hidden = true;
     
     [UIView commitAnimations];
+    
+    
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         
         //        PageData* pageData=nil;
@@ -74,6 +76,16 @@
             self.grid.hidden = false;
             [UIView commitAnimations];
             
+            NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+            bool autologin =[defaults boolForKey:@"autologin"];
+            if(!autologin)
+            {
+                TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
+                [self presentViewController:viewController animated:YES completion:^{
+                    
+                }];
+            }
+            
         });
     });
 }
@@ -394,7 +406,7 @@
     
     self.navigationItem.backBarButtonItem = backButton;
     
-   // self.navigationController.view.frame.size.height;
+    // self.navigationController.view.frame.size.height;
     
     //    NSMutableArray * items = [[NSMutableArray alloc]init];
     //    UIBarButtonItem *item1 = [[UIBarButtonItem alloc] init];
@@ -406,7 +418,7 @@
     //    [items addObject:item1];
     //    [items addObject:item2];
     //    self.navigationItem.rightBarButtonItems=items;
-//    self.navigationItem.backBarButtonItem = backButton;
+    //    self.navigationItem.backBarButtonItem = backButton;
     
     
     self.dirty = @"true";
@@ -467,6 +479,10 @@
 - (void)viewWillAppear:(BOOL)animated
 {
     DebugLog(@"viewWillAppear");
+    
+    
+    
+    
     if(self.dirty ==true)
     {
         self.prepageCount=0;
@@ -496,6 +512,8 @@
         self.dirty = false;
         //            [pulldownMenu loadMenu:self.grid.frame.origin];
     }
+    
+    
 }
 //-(NSUInteger)supportedInterfaceOrientations
 //{

+ 1 - 1
Apex Mobile/Apex Mobile/SearchViewController.h

@@ -17,7 +17,7 @@
 @property (strong,nonatomic) UITextField* textFieldtmp;
 @property (strong,nonatomic) UIButton* boolBtntmp;
 @property (strong, nonatomic) IBOutlet UITableView *table;
-
+@property int ioffset;
 //- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
 
 @end

+ 64 - 4
Apex Mobile/Apex Mobile/SearchViewController.m

@@ -32,7 +32,7 @@
 - (void)viewDidLoad
 {
     [super viewDidLoad];
-    
+    self.ioffset = 0;
     NSString* title=@"";
     if([self.function_name isEqualToString:@"Ocean Booking"])
         title = @"Booking Search";
@@ -107,7 +107,12 @@
         [self.table reloadData];
         self.dirty=false;
     }
+    [self.table reloadData];
 }
+//-(void) viewWillDisappear:(BOOL)animated
+//{
+//    [[self view] endEditing:animated];
+//}
 - (IBAction)onCustomize:(UIBarButtonItem *)sender {
     CustomizeFieldViewController *ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"CustomizeFieldViewController"];
     ViewController.function_name = self.function_name;
@@ -140,6 +145,15 @@
     return [_adapter get_itemcount];
 }
 
+//- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
+//    
+//}
+//- (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath
+//{
+//   [[self view] endEditing:YES];
+//    return false;
+//}
+
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
@@ -210,20 +224,32 @@
     else
     {
         NSString *CellIdentifier = @"item_edit";
+        NSString * type = [field valueForKey:@"type"];
+        
+            
         TableCellEdit *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
         cell.anameLabel.text = [field valueForKey:@"aname"];
         [cell.anameLabel sizeToFit];
         NSString * val = [field valueForKey:@"value"];
+        if([type isEqualToString:@"int"])
+            cell.valueEdit.keyboardType = UIKeyboardTypeNumberPad;
+        else
+            cell.valueEdit.keyboardType = UIKeyboardTypeDefault;
         cell.valueEdit.text = val;
         
+        NSArray* array = [ApexMobileDB get_searchhistory:[field valueForKey:@"name"]];
+//        [self.autocompleteView.itemsSource put_predictions:array ];
+        
         MyAutocompleteView* autocompleteView = [MyAutocompleteView autocompleteViewBindedTo:cell.valueEdit
                                                                  usingSource:[[MyAutocompleteItemsSource alloc]
                                                                               initWithMinimumCharactersToTrigger:1
+                                                                              source:array
                                                                               ]
                                                                  cellFactory:[[MyAutocompletionCellFactory alloc]
                                                                               initWithCellTextColor:[UIColor blackColor]
                                                                               fontSize:14]
-                                                                presentingIn:self];
+//                                                                presentingIn:self
+                                                                                 parentView:self.table];
         autocompleteView.topMargin = 0;
         //    self.autocompleteView.backgroundColor = [UIColor ui];
         
@@ -313,7 +339,13 @@
         {
             NSString* value =[field valueForKey:@"value"];
             if(value.length>0)
+            {
                 [params setValue:[field valueForKey:@"value"] forKey:[field valueForKey:@"name"]];
+                if([[field valueForKey:@"type"] isEqualToString:@"string"] )
+                {
+                     [ApexMobileDB savehistory:[field valueForKey:@"name"] value:[field valueForKey:@"value"]];
+                }
+            }
         }
     }
     [params setValue:self.function_name forKey:@"module_name"];
@@ -373,9 +405,36 @@
 
 #pragma mark - Text field delegate
 
-
+- (void)textFieldDidBeginEditing:(UITextField *)textField {
+    int fieldpos = [textField convertPoint:textField.bounds.origin toView:self.view].y+textField.frame.size.height;
+    fieldpos+=150 ;//autocomplete height;
+    int screenheight =self.view.frame.size.height;
+    int ioffset = fieldpos - (screenheight - 216);//216 -(self.view.frame.size.height-fieldpos);
+    if(ioffset>0)
+    {
+        self.ioffset = ioffset;
+    CGPoint offset = self.table.contentOffset;
+    offset.y+=ioffset;
+        DebugLog(@"table content offset%d",ioffset);
+    [self.table setContentOffset:offset animated:YES];
+    }
+}
+//- (BOOL)textFieldShouldReturn:(UITextField *)sender {
+//    [self.table setContentOffset:CGPointMake(0, 0) animated:YES];
+//    return YES;
+//}
 -(BOOL)textFieldShouldReturn:(UITextField *)textField {
     
+//    if(self.ioffset>0)
+//    {
+//        
+//        CGPoint offset = self.table.contentOffset;
+//        offset.y-=self.ioffset;
+//        [self.table setContentOffset:offset animated:YES];
+//        self.ioffset = 0;
+//    }
+//    
+//    [self.table setContentOffset:CGPointMake(0, 0) animated:YES];
     [textField resignFirstResponder];
     return YES;
 }
@@ -392,12 +451,13 @@
         cell  = (UITableViewCell *) textField.superview.superview.superview;
         indexPath = [self.table indexPathForCell:cell];
     }
+//    [self.table setContentOffset:CGPointMake(0, 0) animated:YES];
     [[_adapter get_item:[indexPath row]] setValue:textField.text forKey:@"value"];
 }
 //
 - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
 {
-    
+//    [self.table setContentOffset:CGPointMake(0, 70) animated:YES];
       DebugLog(@"textFieldShouldBeginEditing  text=%@",textField.text);
     UITableViewCell *cell  = (UITableViewCell *)[[textField superview] superview];
     //      DebugLog(@"reuseid:%@",cell.reuseIdentifier);

+ 20 - 5
Apex Mobile/Apex Mobile/ToolsPanelViewController.m

@@ -23,6 +23,20 @@
     }
     return self;
 }
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
+
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
 -(void)initpanel
 {
     self.toolsinfo = [[NSMutableArray alloc] init];
@@ -36,9 +50,10 @@
     [map setValue:@"Announcements" forKey:@"title"];
     [map setValue:@"rect_announcements" forKey:@"img"];
     [self.toolsinfo addObject:map.copy];
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    bool autologin =[defaults boolForKey:@"autologin"];
     
-    
-    if(true)
+    if(autologin)
     {
         
         [map setValue:@"Saved Detail/Search" forKey:@"title"];
@@ -50,9 +65,9 @@
         [map setValue:@"rect_change_password" forKey:@"img"];
         [self.toolsinfo addObject:map.copy];
         
-        [map setValue:@"Setting" forKey:@"title"];
-        [map setValue:@"rect_setting" forKey:@"img"];
-        [self.toolsinfo addObject:map.copy];
+//        [map setValue:@"Setting" forKey:@"title"];
+//        [map setValue:@"rect_setting" forKey:@"img"];
+//        [self.toolsinfo addObject:map.copy];
     }
 
     

+ 1 - 0
Apex Mobile/Apex Mobile/openurltest.txt

@@ -0,0 +1 @@
+open url test file

+ 29 - 0
Apex Mobile/FavoritesViewController.m

@@ -22,7 +22,20 @@
     }
     return self;
 }
+- (BOOL)shouldAutorotate
+{
+    return YES;
+}
+
+- (NSUInteger)supportedInterfaceOrientations
+{
+    return UIInterfaceOrientationMaskPortrait;
+}
 
+- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
+{
+    return UIInterfaceOrientationPortrait;
+}
 - (void)viewDidLoad
 {
     [super viewDidLoad];
@@ -123,5 +136,21 @@
     [self.navigationController pushViewController:detailViewController animated:YES];
 
 }
+- (UITableViewCellEditingStyle)tableView:(UITableView *)tv editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    return UITableViewCellEditingStyleDelete;
+    //不能是UITableViewCellEditingStyleNone
+}
+- (void)tableView:(UITableView *)tableView
+commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:(NSIndexPath *)indexPath {
+    sqlite3* db = [ApexMobileDB get_db];
+    NSString* sql = [NSString stringWithFormat:@"delete from favorites where _id=%@",[self.data.pagedata[indexPath.row] valueForKey:@"_id"]];
+    [ApexMobileDB execSql:sql db:db];
+    sqlite3_close(db);
+    
+    [self.data.pagedata removeObjectAtIndex:indexPath.row];
 
+    [tableView reloadData];
+    
+}
 @end

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott