diff --git a/RedmineMobile/RedmineMobile.xcodeproj/project.pbxproj b/RedmineMobile/RedmineMobile.xcodeproj/project.pbxproj index 687b58b..85c6b20 100644 --- a/RedmineMobile/RedmineMobile.xcodeproj/project.pbxproj +++ b/RedmineMobile/RedmineMobile.xcodeproj/project.pbxproj @@ -7,9 +7,9 @@ objects = { /* Begin PBXBuildFile section */ - 2B62D0DF1796498800AC3C19 /* OZLIssueCreateViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B62D0DE1796498800AC3C19 /* OZLIssueCreateViewController.storyboard */; }; + 2B62D0DF1796498800AC3C19 /* OZLIssueCreateOrUpdateViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B62D0DE1796498800AC3C19 /* OZLIssueCreateOrUpdateViewController.storyboard */; }; 2B62D0E1179649A800AC3C19 /* OZLIssueDetailViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B62D0E0179649A800AC3C19 /* OZLIssueDetailViewController.storyboard */; }; - 2B62D0E31796A15C00AC3C19 /* OZLProjectCreateViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B62D0E21796A15C00AC3C19 /* OZLProjectCreateViewController.storyboard */; }; + 2B62D0E31796A15C00AC3C19 /* OZLProjectInfoViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B62D0E21796A15C00AC3C19 /* OZLProjectInfoViewController.storyboard */; }; 2B62D0E81796A8D800AC3C19 /* OZLIssueFilterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B62D0E71796A8D800AC3C19 /* OZLIssueFilterViewController.m */; }; 2B6F382F1797A00A00D06F51 /* MLTableAlertBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 2B6F38251797A00A00D06F51 /* MLTableAlertBackground.png */; }; 2B6F38301797A00A00D06F51 /* MLTableAlertBackground@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2B6F38261797A00A00D06F51 /* MLTableAlertBackground@2x.png */; }; @@ -23,20 +23,25 @@ 2B6F38391797BEBA00D06F51 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B6F38381797BEBA00D06F51 /* QuartzCore.framework */; }; 2B8A11E217963CE500906D34 /* OZLIssueDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B8A11E117963CE500906D34 /* OZLIssueDetailViewController.m */; }; 2B9968AB1794F71B0086F115 /* OZLModelIssueCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B9968AA1794F71B0086F115 /* OZLModelIssueCategory.m */; }; - 2B9968AF1794FC0A0086F115 /* OZLProjectCreateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B9968AD1794FC0A0086F115 /* OZLProjectCreateViewController.m */; }; - 2B9968B417951A5C0086F115 /* OZLIssueCreateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B9968B217951A5C0086F115 /* OZLIssueCreateViewController.m */; }; + 2B9968AF1794FC0A0086F115 /* OZLProjectInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B9968AD1794FC0A0086F115 /* OZLProjectInfoViewController.m */; }; + 2B9968B417951A5C0086F115 /* OZLIssueCreateOrUpdateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B9968B217951A5C0086F115 /* OZLIssueCreateOrUpdateViewController.m */; }; + 2BBE440F179E500E00FD9E20 /* OZLIssueLogtimeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBE440E179E500E00FD9E20 /* OZLIssueLogtimeViewController.m */; }; + 2BBE4411179E503100FD9E20 /* OZLIssueLogtimeViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2BBE4410179E503100FD9E20 /* OZLIssueLogtimeViewController.storyboard */; }; + 2BBE4414179E586B00FD9E20 /* OZLModelTimeEntryActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBE4413179E586B00FD9E20 /* OZLModelTimeEntryActivity.m */; }; 2BC4DD8C179928C80090F52C /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BC4DD8B179928C80090F52C /* SenTestingKit.framework */; }; 2BC4DD8D179928C80090F52C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5DB80591792F2BF0081662A /* UIKit.framework */; }; 2BC4DD8E179928C80090F52C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5DB805B1792F2BF0081662A /* Foundation.framework */; }; 2BC4DD94179928C80090F52C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2BC4DD92179928C80090F52C /* InfoPlist.strings */; }; 2BC4DD97179928C80090F52C /* RedmineMobileUnitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BC4DD96179928C80090F52C /* RedmineMobileUnitTest.m */; }; + 2BCBA81D179E292800E5FD46 /* OZLModelIssueJournal.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCBA81C179E292800E5FD46 /* OZLModelIssueJournal.m */; }; + 2BCBA820179E2AA500E5FD46 /* OZLModelIssueJournalDetail.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCBA81F179E2AA400E5FD46 /* OZLModelIssueJournalDetail.m */; }; + 2BCC0FCF179D5458003DFB44 /* OZLIssueHistoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCC0FCE179D5458003DFB44 /* OZLIssueHistoryViewController.m */; }; + 2BCC0FD2179D56BA003DFB44 /* OZLModelTimeEntries.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCC0FD1179D56BA003DFB44 /* OZLModelTimeEntries.m */; }; 2BCCA0541795312E00FA8B1A /* OZLConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCCA0531795312E00FA8B1A /* OZLConstants.m */; }; 2BCF880C1793A26A006FC859 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF880B1793A26A006FC859 /* MBProgressHUD.m */; }; 2BCF88101793ABA0006FC859 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF880F1793ABA0006FC859 /* Reachability.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 2BCF88121793CB4F006FC859 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BCF88111793CB4F006FC859 /* CFNetwork.framework */; }; 2BCF88141793CB94006FC859 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BCF88131793CB94006FC859 /* SystemConfiguration.framework */; }; - 2BCF88181793E353006FC859 /* OZLProjectDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF88161793E353006FC859 /* OZLProjectDetailViewController.m */; }; - 2BCF88191793E353006FC859 /* OZLProjectDetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2BCF88171793E353006FC859 /* OZLProjectDetailViewController.xib */; }; 2BCF881E1793F3C8006FC859 /* OZLModelIssue.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF881D1793F3C8006FC859 /* OZLModelIssue.m */; }; 2BCF88211793F478006FC859 /* OZLModelTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF88201793F478006FC859 /* OZLModelTracker.m */; }; 2BCF88271793F4AA006FC859 /* OZLModelIssueStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF88261793F4AA006FC859 /* OZLModelIssueStatus.m */; }; @@ -87,9 +92,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 2B62D0DE1796498800AC3C19 /* OZLIssueCreateViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLIssueCreateViewController.storyboard; path = ViewControllers/OZLIssueCreateViewController.storyboard; sourceTree = ""; }; + 2B62D0DE1796498800AC3C19 /* OZLIssueCreateOrUpdateViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLIssueCreateOrUpdateViewController.storyboard; path = ViewControllers/OZLIssueCreateOrUpdateViewController.storyboard; sourceTree = ""; }; 2B62D0E0179649A800AC3C19 /* OZLIssueDetailViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLIssueDetailViewController.storyboard; path = ViewControllers/OZLIssueDetailViewController.storyboard; sourceTree = ""; }; - 2B62D0E21796A15C00AC3C19 /* OZLProjectCreateViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLProjectCreateViewController.storyboard; path = ViewControllers/OZLProjectCreateViewController.storyboard; sourceTree = ""; }; + 2B62D0E21796A15C00AC3C19 /* OZLProjectInfoViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLProjectInfoViewController.storyboard; path = ViewControllers/OZLProjectInfoViewController.storyboard; sourceTree = ""; }; 2B62D0E61796A8D800AC3C19 /* OZLIssueFilterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLIssueFilterViewController.h; path = ViewControllers/OZLIssueFilterViewController.h; sourceTree = ""; }; 2B62D0E71796A8D800AC3C19 /* OZLIssueFilterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLIssueFilterViewController.m; path = ViewControllers/OZLIssueFilterViewController.m; sourceTree = ""; }; 2B6F38251797A00A00D06F51 /* MLTableAlertBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MLTableAlertBackground.png; sourceTree = ""; }; @@ -107,10 +112,15 @@ 2B8A11E117963CE500906D34 /* OZLIssueDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLIssueDetailViewController.m; path = ViewControllers/OZLIssueDetailViewController.m; sourceTree = ""; }; 2B9968A91794F71B0086F115 /* OZLModelIssueCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLModelIssueCategory.h; path = Models/OZLModelIssueCategory.h; sourceTree = ""; }; 2B9968AA1794F71B0086F115 /* OZLModelIssueCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLModelIssueCategory.m; path = Models/OZLModelIssueCategory.m; sourceTree = ""; }; - 2B9968AC1794FC0A0086F115 /* OZLProjectCreateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLProjectCreateViewController.h; path = ViewControllers/OZLProjectCreateViewController.h; sourceTree = ""; }; - 2B9968AD1794FC0A0086F115 /* OZLProjectCreateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLProjectCreateViewController.m; path = ViewControllers/OZLProjectCreateViewController.m; sourceTree = ""; }; - 2B9968B117951A5C0086F115 /* OZLIssueCreateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLIssueCreateViewController.h; path = ViewControllers/OZLIssueCreateViewController.h; sourceTree = ""; }; - 2B9968B217951A5C0086F115 /* OZLIssueCreateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLIssueCreateViewController.m; path = ViewControllers/OZLIssueCreateViewController.m; sourceTree = ""; }; + 2B9968AC1794FC0A0086F115 /* OZLProjectInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLProjectInfoViewController.h; path = ViewControllers/OZLProjectInfoViewController.h; sourceTree = ""; }; + 2B9968AD1794FC0A0086F115 /* OZLProjectInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLProjectInfoViewController.m; path = ViewControllers/OZLProjectInfoViewController.m; sourceTree = ""; }; + 2B9968B117951A5C0086F115 /* OZLIssueCreateOrUpdateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLIssueCreateOrUpdateViewController.h; path = ViewControllers/OZLIssueCreateOrUpdateViewController.h; sourceTree = ""; }; + 2B9968B217951A5C0086F115 /* OZLIssueCreateOrUpdateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLIssueCreateOrUpdateViewController.m; path = ViewControllers/OZLIssueCreateOrUpdateViewController.m; sourceTree = ""; }; + 2BBE440D179E500E00FD9E20 /* OZLIssueLogtimeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLIssueLogtimeViewController.h; path = ViewControllers/OZLIssueLogtimeViewController.h; sourceTree = ""; }; + 2BBE440E179E500E00FD9E20 /* OZLIssueLogtimeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLIssueLogtimeViewController.m; path = ViewControllers/OZLIssueLogtimeViewController.m; sourceTree = ""; }; + 2BBE4410179E503100FD9E20 /* OZLIssueLogtimeViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLIssueLogtimeViewController.storyboard; path = ViewControllers/OZLIssueLogtimeViewController.storyboard; sourceTree = ""; }; + 2BBE4412179E586B00FD9E20 /* OZLModelTimeEntryActivity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLModelTimeEntryActivity.h; path = Models/OZLModelTimeEntryActivity.h; sourceTree = ""; }; + 2BBE4413179E586B00FD9E20 /* OZLModelTimeEntryActivity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLModelTimeEntryActivity.m; path = Models/OZLModelTimeEntryActivity.m; sourceTree = ""; }; 2BC4DD8A179928C80090F52C /* RedmineMobileUnitTest.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RedmineMobileUnitTest.octest; sourceTree = BUILT_PRODUCTS_DIR; }; 2BC4DD8B179928C80090F52C /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; 2BC4DD91179928C80090F52C /* RedmineMobileUnitTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "RedmineMobileUnitTest-Info.plist"; sourceTree = ""; }; @@ -118,6 +128,14 @@ 2BC4DD95179928C80090F52C /* RedmineMobileUnitTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RedmineMobileUnitTest.h; sourceTree = ""; }; 2BC4DD96179928C80090F52C /* RedmineMobileUnitTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RedmineMobileUnitTest.m; sourceTree = ""; }; 2BC4DD98179928C80090F52C /* RedmineMobileUnitTest-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RedmineMobileUnitTest-Prefix.pch"; sourceTree = ""; }; + 2BCBA81B179E292800E5FD46 /* OZLModelIssueJournal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLModelIssueJournal.h; path = Models/OZLModelIssueJournal.h; sourceTree = ""; }; + 2BCBA81C179E292800E5FD46 /* OZLModelIssueJournal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLModelIssueJournal.m; path = Models/OZLModelIssueJournal.m; sourceTree = ""; }; + 2BCBA81E179E2AA400E5FD46 /* OZLModelIssueJournalDetail.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLModelIssueJournalDetail.h; path = Models/OZLModelIssueJournalDetail.h; sourceTree = ""; }; + 2BCBA81F179E2AA400E5FD46 /* OZLModelIssueJournalDetail.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLModelIssueJournalDetail.m; path = Models/OZLModelIssueJournalDetail.m; sourceTree = ""; }; + 2BCC0FCD179D5458003DFB44 /* OZLIssueHistoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLIssueHistoryViewController.h; path = ViewControllers/OZLIssueHistoryViewController.h; sourceTree = ""; }; + 2BCC0FCE179D5458003DFB44 /* OZLIssueHistoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLIssueHistoryViewController.m; path = ViewControllers/OZLIssueHistoryViewController.m; sourceTree = ""; }; + 2BCC0FD0179D56BA003DFB44 /* OZLModelTimeEntries.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLModelTimeEntries.h; path = Models/OZLModelTimeEntries.h; sourceTree = ""; }; + 2BCC0FD1179D56BA003DFB44 /* OZLModelTimeEntries.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLModelTimeEntries.m; path = Models/OZLModelTimeEntries.m; sourceTree = ""; }; 2BCCA0521795312E00FA8B1A /* OZLConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLConstants.h; path = Models/OZLConstants.h; sourceTree = ""; }; 2BCCA0531795312E00FA8B1A /* OZLConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLConstants.m; path = Models/OZLConstants.m; sourceTree = ""; }; 2BCF880A1793A26A006FC859 /* MBProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBProgressHUD.h; sourceTree = ""; }; @@ -126,9 +144,6 @@ 2BCF880F1793ABA0006FC859 /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; 2BCF88111793CB4F006FC859 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; 2BCF88131793CB94006FC859 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - 2BCF88151793E352006FC859 /* OZLProjectDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLProjectDetailViewController.h; path = ViewControllers/OZLProjectDetailViewController.h; sourceTree = ""; }; - 2BCF88161793E353006FC859 /* OZLProjectDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLProjectDetailViewController.m; path = ViewControllers/OZLProjectDetailViewController.m; sourceTree = ""; }; - 2BCF88171793E353006FC859 /* OZLProjectDetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = OZLProjectDetailViewController.xib; path = ViewControllers/OZLProjectDetailViewController.xib; sourceTree = ""; }; 2BCF881C1793F3C8006FC859 /* OZLModelIssue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLModelIssue.h; path = Models/OZLModelIssue.h; sourceTree = ""; }; 2BCF881D1793F3C8006FC859 /* OZLModelIssue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLModelIssue.m; path = Models/OZLModelIssue.m; sourceTree = ""; }; 2BCF881F1793F478006FC859 /* OZLModelTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLModelTracker.h; path = Models/OZLModelTracker.h; sourceTree = ""; }; @@ -301,12 +316,9 @@ D5DB80A31792F4DE0081662A /* OZLProjectListViewController.h */, D5DB80A41792F4DE0081662A /* OZLProjectListViewController.m */, D5DB80A51792F4DE0081662A /* OZLProjectListViewController.xib */, - 2BCF88151793E352006FC859 /* OZLProjectDetailViewController.h */, - 2BCF88161793E353006FC859 /* OZLProjectDetailViewController.m */, - 2BCF88171793E353006FC859 /* OZLProjectDetailViewController.xib */, - 2B9968AC1794FC0A0086F115 /* OZLProjectCreateViewController.h */, - 2B9968AD1794FC0A0086F115 /* OZLProjectCreateViewController.m */, - 2B62D0E21796A15C00AC3C19 /* OZLProjectCreateViewController.storyboard */, + 2B9968AC1794FC0A0086F115 /* OZLProjectInfoViewController.h */, + 2B9968AD1794FC0A0086F115 /* OZLProjectInfoViewController.m */, + 2B62D0E21796A15C00AC3C19 /* OZLProjectInfoViewController.storyboard */, ); name = Project; sourceTree = ""; @@ -317,14 +329,19 @@ D5DB80A91792F6980081662A /* OZLProjectViewController.h */, D5DB80AA1792F6980081662A /* OZLProjectViewController.m */, D5DB80AB1792F6980081662A /* OZLProjectViewController.xib */, - 2B9968B117951A5C0086F115 /* OZLIssueCreateViewController.h */, - 2B9968B217951A5C0086F115 /* OZLIssueCreateViewController.m */, - 2B62D0DE1796498800AC3C19 /* OZLIssueCreateViewController.storyboard */, + 2B9968B117951A5C0086F115 /* OZLIssueCreateOrUpdateViewController.h */, + 2B9968B217951A5C0086F115 /* OZLIssueCreateOrUpdateViewController.m */, + 2B62D0DE1796498800AC3C19 /* OZLIssueCreateOrUpdateViewController.storyboard */, 2B8A11E017963CE500906D34 /* OZLIssueDetailViewController.h */, 2B8A11E117963CE500906D34 /* OZLIssueDetailViewController.m */, 2B62D0E0179649A800AC3C19 /* OZLIssueDetailViewController.storyboard */, 2B62D0E61796A8D800AC3C19 /* OZLIssueFilterViewController.h */, 2B62D0E71796A8D800AC3C19 /* OZLIssueFilterViewController.m */, + 2BCC0FCD179D5458003DFB44 /* OZLIssueHistoryViewController.h */, + 2BCC0FCE179D5458003DFB44 /* OZLIssueHistoryViewController.m */, + 2BBE440D179E500E00FD9E20 /* OZLIssueLogtimeViewController.h */, + 2BBE440E179E500E00FD9E20 /* OZLIssueLogtimeViewController.m */, + 2BBE4410179E503100FD9E20 /* OZLIssueLogtimeViewController.storyboard */, ); name = Issue; sourceTree = ""; @@ -504,6 +521,14 @@ 2BCF882F1793F5CE006FC859 /* OZLModelUser.m */, 2B9968A91794F71B0086F115 /* OZLModelIssueCategory.h */, 2B9968AA1794F71B0086F115 /* OZLModelIssueCategory.m */, + 2BCC0FD0179D56BA003DFB44 /* OZLModelTimeEntries.h */, + 2BCC0FD1179D56BA003DFB44 /* OZLModelTimeEntries.m */, + 2BCBA81B179E292800E5FD46 /* OZLModelIssueJournal.h */, + 2BCBA81C179E292800E5FD46 /* OZLModelIssueJournal.m */, + 2BCBA81E179E2AA400E5FD46 /* OZLModelIssueJournalDetail.h */, + 2BCBA81F179E2AA400E5FD46 /* OZLModelIssueJournalDetail.m */, + 2BBE4412179E586B00FD9E20 /* OZLModelTimeEntryActivity.h */, + 2BBE4413179E586B00FD9E20 /* OZLModelTimeEntryActivity.m */, ); name = Models; sourceTree = ""; @@ -595,10 +620,9 @@ D5DB80A71792F4DE0081662A /* OZLProjectListViewController.xib in Resources */, D5DB80AD1792F6980081662A /* OZLProjectViewController.xib in Resources */, D5DB80B61793016B0081662A /* OZLAccountViewController.xib in Resources */, - 2BCF88191793E353006FC859 /* OZLProjectDetailViewController.xib in Resources */, - 2B62D0DF1796498800AC3C19 /* OZLIssueCreateViewController.storyboard in Resources */, + 2B62D0DF1796498800AC3C19 /* OZLIssueCreateOrUpdateViewController.storyboard in Resources */, 2B62D0E1179649A800AC3C19 /* OZLIssueDetailViewController.storyboard in Resources */, - 2B62D0E31796A15C00AC3C19 /* OZLProjectCreateViewController.storyboard in Resources */, + 2B62D0E31796A15C00AC3C19 /* OZLProjectInfoViewController.storyboard in Resources */, 2B6F382F1797A00A00D06F51 /* MLTableAlertBackground.png in Resources */, 2B6F38301797A00A00D06F51 /* MLTableAlertBackground@2x.png in Resources */, 2B6F38311797A00A00D06F51 /* MLTableAlertButton.png in Resources */, @@ -607,6 +631,7 @@ 2B6F38341797A00A00D06F51 /* MLTableAlertButtonPressed@2x.png in Resources */, 2B6F38351797A00A00D06F51 /* MLTableAlertShadowMask.png in Resources */, 2B6F38361797A00A00D06F51 /* MLTableAlertShadowMask@2x.png in Resources */, + 2BBE4411179E503100FD9E20 /* OZLIssueLogtimeViewController.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -665,19 +690,24 @@ D5DB80C217931C8B0081662A /* OZLModelProject.m in Sources */, 2BCF880C1793A26A006FC859 /* MBProgressHUD.m in Sources */, 2BCF88101793ABA0006FC859 /* Reachability.m in Sources */, - 2BCF88181793E353006FC859 /* OZLProjectDetailViewController.m in Sources */, 2BCF881E1793F3C8006FC859 /* OZLModelIssue.m in Sources */, 2BCF88211793F478006FC859 /* OZLModelTracker.m in Sources */, 2BCF88271793F4AA006FC859 /* OZLModelIssueStatus.m in Sources */, 2BCF882A1793F4C9006FC859 /* OZLModelIssuePriority.m in Sources */, 2BCF88301793F5CE006FC859 /* OZLModelUser.m in Sources */, 2B9968AB1794F71B0086F115 /* OZLModelIssueCategory.m in Sources */, - 2B9968AF1794FC0A0086F115 /* OZLProjectCreateViewController.m in Sources */, - 2B9968B417951A5C0086F115 /* OZLIssueCreateViewController.m in Sources */, + 2B9968AF1794FC0A0086F115 /* OZLProjectInfoViewController.m in Sources */, + 2B9968B417951A5C0086F115 /* OZLIssueCreateOrUpdateViewController.m in Sources */, 2BCCA0541795312E00FA8B1A /* OZLConstants.m in Sources */, 2B8A11E217963CE500906D34 /* OZLIssueDetailViewController.m in Sources */, 2B62D0E81796A8D800AC3C19 /* OZLIssueFilterViewController.m in Sources */, 2B6F38371797A00A00D06F51 /* MLTableAlert.m in Sources */, + 2BCC0FCF179D5458003DFB44 /* OZLIssueHistoryViewController.m in Sources */, + 2BCC0FD2179D56BA003DFB44 /* OZLModelTimeEntries.m in Sources */, + 2BCBA81D179E292800E5FD46 /* OZLModelIssueJournal.m in Sources */, + 2BCBA820179E2AA500E5FD46 /* OZLModelIssueJournalDetail.m in Sources */, + 2BBE440F179E500E00FD9E20 /* OZLIssueLogtimeViewController.m in Sources */, + 2BBE4414179E586B00FD9E20 /* OZLModelTimeEntryActivity.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -837,6 +867,7 @@ 2BC4DD9B179928C80090F52C /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; D5DB80511792F2BF0081662A /* Build configuration list for PBXProject "RedmineMobile" */ = { isa = XCConfigurationList; diff --git a/RedmineMobile/RedmineMobile/Models/OZLConstants.h b/RedmineMobile/RedmineMobile/Models/OZLConstants.h index 4417e24..555b29c 100644 --- a/RedmineMobile/RedmineMobile/Models/OZLConstants.h +++ b/RedmineMobile/RedmineMobile/Models/OZLConstants.h @@ -27,7 +27,7 @@ // THE SOFTWARE. #import -extern const NSString* NOTIFICATION_REDMINE_ACCOUNT_CHANGED; +extern NSString* NOTIFICATION_REDMINE_ACCOUNT_CHANGED; @interface OZLConstants : NSObject diff --git a/RedmineMobile/RedmineMobile/Models/OZLConstants.m b/RedmineMobile/RedmineMobile/Models/OZLConstants.m index 99e80b1..0f402ab 100644 --- a/RedmineMobile/RedmineMobile/Models/OZLConstants.m +++ b/RedmineMobile/RedmineMobile/Models/OZLConstants.m @@ -27,7 +27,7 @@ // THE SOFTWARE. #import "OZLConstants.h" -const NSString* NOTIFICATION_REDMINE_ACCOUNT_CHANGED = @"NOTIFICATION_REDMINE_ACCOUNT_CHANGED"; +NSString* NOTIFICATION_REDMINE_ACCOUNT_CHANGED = @"NOTIFICATION_REDMINE_ACCOUNT_CHANGED"; @implementation OZLConstants diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelIssueCategory.m b/RedmineMobile/RedmineMobile/Models/OZLModelIssueCategory.m index cda8288..f6c37d9 100644 --- a/RedmineMobile/RedmineMobile/Models/OZLModelIssueCategory.m +++ b/RedmineMobile/RedmineMobile/Models/OZLModelIssueCategory.m @@ -41,9 +41,9 @@ _name = [dic objectForKey:@"name"]; return self; } -//-(NSMutableDictionary*) toParametersDic -//{ -// -//} +-(NSMutableDictionary*) toParametersDic +{ + return nil; +} @end diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournal.h b/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournal.h new file mode 100644 index 0000000..44fd59b --- /dev/null +++ b/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournal.h @@ -0,0 +1,66 @@ +// +// OZLModelIssueJournal.h +// RedmineMobile +// +// Created by lizhijie on 7/23/13. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#import +#import "OZLModelUser.h" +#import "OZLModelIssueJournalDetail.h" + +/* + { + "id": 12353, + "user": { + "id": 20043, + "name": "wang lei" + }, + "notes": "fdfcasvawefqwf\r\n\r\nasdfasd\r\nasdfasdf", + "created_on": "2013-07-22T08:47:47Z", + "details": [ + { + "property": "attr", + "name": "done_ratio", + "old_value": "0", + "new_value": "20" + } + ] + } + + */ +@interface OZLModelIssueJournal : NSObject + +@property(nonatomic) int index; +@property(nonatomic, strong) NSString* notes; +@property(nonatomic, strong) NSString* createdOn; +@property(nonatomic, strong) OZLModelUser* user; +@property(nonatomic, strong) NSArray* detailArray; + +-(id)initWithDictionary:(NSDictionary*)dic; +-(NSMutableDictionary*) toParametersDic; + + +@end diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournal.m b/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournal.m new file mode 100644 index 0000000..d046f8e --- /dev/null +++ b/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournal.m @@ -0,0 +1,60 @@ +// +// OZLModelIssueJournal.m +// RedmineMobile +// +// Created by lizhijie on 7/23/13. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "OZLModelIssueJournal.h" + +@implementation OZLModelIssueJournal + + +-(id)initWithDictionary:(NSDictionary*)dic +{ + self = [super init]; + if (!self) { + return nil; + } + _index = [[dic objectForKey:@"index"] intValue]; + _notes = [dic objectForKey:@"notes"]; + _createdOn = [dic objectForKey:@"created_on"]; + _user = [[ OZLModelUser alloc] initWithDictionary:[dic objectForKey:@"user"]]; + NSMutableArray* detailItems = [[NSMutableArray alloc] init]; + NSArray* dataArray = [dic objectForKey:@"details"]; + for (NSDictionary* detailDic in dataArray) { + OZLModelIssueJournalDetail* detail = [[OZLModelIssueJournalDetail alloc] initWithDictionary:detailDic]; + [detailItems addObject:detail]; + } + _detailArray = detailItems; + return self; + +} + +-(NSMutableDictionary*) toParametersDic +{ + return nil; +} + +@end diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournalDetail.h b/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournalDetail.h new file mode 100644 index 0000000..3796584 --- /dev/null +++ b/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournalDetail.h @@ -0,0 +1,51 @@ +// +// OZLModelIssueJournalDetail.h +// RedmineMobile +// +// Created by lizhijie on 7/23/13. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +/* + "details": [ + { + "property": "attr", + "name": "done_ratio", + "old_value": "0", + "new_value": "20" + } + ] + */ +@interface OZLModelIssueJournalDetail : NSObject + +@property(nonatomic, strong) NSString* property; +@property(nonatomic, strong) NSString* name; +@property(nonatomic, strong) NSString* oldValue; +@property(nonatomic, strong) NSString* freshValue; + +-(id)initWithDictionary:(NSDictionary*)dic; +-(NSMutableDictionary*) toParametersDic; + + +@end diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournalDetail.m b/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournalDetail.m new file mode 100644 index 0000000..89b554c --- /dev/null +++ b/RedmineMobile/RedmineMobile/Models/OZLModelIssueJournalDetail.m @@ -0,0 +1,50 @@ +// +// OZLModelIssueJournalDetail.m +// RedmineMobile +// +// Created by lizhijie on 7/23/13. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "OZLModelIssueJournalDetail.h" + +@implementation OZLModelIssueJournalDetail + +-(id)initWithDictionary:(NSDictionary*)dic +{ + self = [super init]; + if (!self) { + return nil; + } + _name = [dic objectForKey:@"name"]; + _property = [dic objectForKey:@"property"]; + _oldValue = [dic objectForKey:@"old_value"]; + _freshValue = [dic objectForKey:@"new_value"]; + return self; +} + +-(NSMutableDictionary*) toParametersDic +{ + return nil; +} +@end diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntries.h b/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntries.h new file mode 100644 index 0000000..486c2f0 --- /dev/null +++ b/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntries.h @@ -0,0 +1,56 @@ +// +// OZLModelTimeEntries.h +// RedmineMobile +// +// Created by lizhijie on 7/22/13. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#import +#import "OZLModelProject.h" +#import "OZLModelIssue.h" +#import "OZLModelUser.h" +#import "OZLModelTimeEntryActivity.h" + + +@interface OZLModelTimeEntries : NSObject +//"id":3880,"project":{"id":14848,"name":"TVS-SCS DEMO PROJ 1"},"issue":{"id":16697},"user":{"id":20600,"name":"Derek Halford"},"activity":{"id":9,"name":"Development"},"hours":1.0,"comments":"Issue has been confirmed","spent_on":"2013-07-22","created_on":"2013-07-22T10:36:57Z","updated_on":"2013-07-22T10:36:57Z" +@property(nonatomic) int index; +@property(nonatomic, strong) OZLModelProject* project; +@property(nonatomic, strong) OZLModelUser* user; +@property(nonatomic, strong) OZLModelIssue* issue; +@property(nonatomic, strong) OZLModelTimeEntryActivity* activity; +@property(nonatomic) float hours; +@property(nonatomic, strong) NSString* comments; +@property(nonatomic, strong) NSString* spentOn; +@property(nonatomic, strong) NSString* createdOn; +@property(nonatomic, strong) NSString* updatedOn; + + + +-(id)initWithDictionary:(NSDictionary*)dic; +-(NSMutableDictionary*) toParametersDic; + + +@end diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntries.m b/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntries.m new file mode 100644 index 0000000..05edc7b --- /dev/null +++ b/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntries.m @@ -0,0 +1,88 @@ +// +// OZLModelTimeEntries.m +// RedmineMobile +// +// Created by lizhijie on 7/22/13. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#import "OZLModelTimeEntries.h" + +@implementation OZLModelTimeEntries + +-(id)initWithDictionary:(NSDictionary*)dic +{ + self = [super init]; + if (!self) { + return nil; + } + _index = [[dic objectForKey:@"id"] intValue]; + id project = [dic objectForKey:@"project"]; + if (project != nil) { + _project = [[OZLModelProject alloc] initWithDictionary:project]; + } + id user = [dic objectForKey:@"user"]; + if (user != nil) { + _user = [[OZLModelUser alloc] initWithDictionary: user]; + } + id issue = [dic objectForKey:@"issue"]; + if (issue != nil ) { + _issue = [[OZLModelIssue alloc] initWithDictionary:issue]; + } + id activity = [dic objectForKey:@"activity"]; + if (activity != nil) { + _activity = [[OZLModelTimeEntryActivity alloc] initWithDictionary:activity]; + } + _hours = [[dic objectForKey:@"hours"] floatValue]; + _comments = [dic objectForKey:@"comments"]; + _spentOn = [dic objectForKey:@"spent_on"]; + _createdOn = [dic objectForKey:@"created_on"]; + _updatedOn = [dic objectForKey:@"updated_on"]; + return self; +} + +-(NSMutableDictionary*) toParametersDic +{ + NSMutableDictionary* entryDic = [[NSMutableDictionary alloc] init]; + [entryDic setObject:[NSNumber numberWithFloat:_hours] forKey:@"hours"];//required + if (_issue) { + [entryDic setObject:[NSNumber numberWithInt:_issue.index] forKey:@"issue_id"]; + }else if(_project){ + [entryDic setObject:[NSNumber numberWithInt:_project.index] forKey:@"project_id"]; + } + if (_spentOn) { + [entryDic setObject:_spentOn forKey:@"spent_on"]; + } + if (_activity) { + [entryDic setObject:[NSNumber numberWithInt:_activity.index] forKey:@"activity_id"]; + } + if (_comments) { + [entryDic setObject:_comments forKey:@"comments"]; + } + + return [[NSMutableDictionary alloc] initWithObjectsAndKeys:entryDic,@"time_entry",nil]; +} + + +@end diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntryActivity.h b/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntryActivity.h new file mode 100644 index 0000000..0412aab --- /dev/null +++ b/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntryActivity.h @@ -0,0 +1,39 @@ +// +// OZLModelTimeEntryActivity.h +// RedmineMobile +// +// Created by lizhijie on 7/23/13. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +@interface OZLModelTimeEntryActivity : NSObject + +@property(nonatomic) int index; +@property(nonatomic,strong) NSString* name; + +-(id)initWithDictionary:(NSDictionary*)dic; +-(NSMutableDictionary*) toParametersDic; + +@end diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntryActivity.m b/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntryActivity.m new file mode 100644 index 0000000..d6401c2 --- /dev/null +++ b/RedmineMobile/RedmineMobile/Models/OZLModelTimeEntryActivity.m @@ -0,0 +1,48 @@ +// +// OZLModelTimeEntryActivity.m +// RedmineMobile +// +// Created by lizhijie on 7/23/13. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "OZLModelTimeEntryActivity.h" + +@implementation OZLModelTimeEntryActivity +-(id)initWithDictionary:(NSDictionary*)dic +{ + self = [super init]; + if (!self) { + return nil; + } + _index = [[dic objectForKey:@"id"] intValue]; + _name = [dic objectForKey:@"name"]; + return self; +} + +-(NSMutableDictionary*) toParametersDic +{ + return nil; +} + +@end diff --git a/RedmineMobile/RedmineMobile/Models/OZLModelUser.m b/RedmineMobile/RedmineMobile/Models/OZLModelUser.m index c910ed6..306885d 100644 --- a/RedmineMobile/RedmineMobile/Models/OZLModelUser.m +++ b/RedmineMobile/RedmineMobile/Models/OZLModelUser.m @@ -45,7 +45,11 @@ _createdOn = [dic objectForKey:@"created_on"]; _lastLoginIn = [dic objectForKey:@"last_login_on"]; - _name = _login; + _name = [dic objectForKey:@"name"]; + if (_name == nil) { + _name = _login; + } + return self; } diff --git a/RedmineMobile/RedmineMobile/Utils/OZLNetwork.h b/RedmineMobile/RedmineMobile/Utils/OZLNetwork.h index 35ab89c..a1e3cbf 100644 --- a/RedmineMobile/RedmineMobile/Utils/OZLNetwork.h +++ b/RedmineMobile/RedmineMobile/Utils/OZLNetwork.h @@ -33,6 +33,10 @@ #import "OZLModelIssueStatus.h" #import "OZLModelTracker.h" #import "OZLModelUser.h" +#import "OZLModelTimeEntries.h" +#import "OZLModelIssueJournal.h" +#import "OZLModelIssueJournalDetail.h" +#import "OZLModelTimeEntryActivity.h" @interface OZLNetwork : NSObject @@ -50,6 +54,7 @@ +(void)createIssue:(OZLModelIssue*)issueData withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block; +(void)updateIssue:(OZLModelIssue*)issueData withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block; +(void)deleteIssue:(int)issueid withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block; ++(void)getJournalListForIssue:(int)issueid withParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block; // priority +(void)getPriorityListWithParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block; @@ -60,5 +65,12 @@ // tracker +(void)getTrackerListWithParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block; +// time entries ++(void)getTimeEntriesWithParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block; ++(void)getTimeEntriesForIssueId:(int)issueid withParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block; ++(void)getTimeEntriesForProjectId:(int)projectid withParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block; ++(void)getTimeEntryListWithParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block; ++(void)createTimeEntry:(OZLModelTimeEntries*)timeEntry withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block; + @end diff --git a/RedmineMobile/RedmineMobile/Utils/OZLNetwork.m b/RedmineMobile/RedmineMobile/Utils/OZLNetwork.m index 7bec7e8..42ce7ea 100644 --- a/RedmineMobile/RedmineMobile/Utils/OZLNetwork.m +++ b/RedmineMobile/RedmineMobile/Utils/OZLNetwork.m @@ -335,6 +335,37 @@ }]; } ++(void)getJournalListForIssue:(int)issueid withParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block +{ + NSString* path = [NSString stringWithFormat:@"/issues/%d.json?include=journals",issueid]; + NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params]; + NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey]; + if (accessKey.length > 0) { + [paramsDic setObject:accessKey forKey:@"key"]; + } + + [[OZLNetworkBase sharedClient] getPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) { + + if (block) { + NSLog(@"the repsonse:%@",responseObject); + + NSMutableArray* journals = [[NSMutableArray alloc] init]; + + NSArray* journalsDic = [[responseObject objectForKey:@"issue"] objectForKey:@"journals"]; + for (NSDictionary* p in journalsDic) { + [journals addObject:[[OZLModelIssueJournal alloc] initWithDictionary:p]]; + } + block(journals,nil); + } + + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + + if (block) { + block([NSArray array], error); + } + + }]; +} #pragma mark - #pragma mark priority api @@ -472,4 +503,114 @@ } }]; } + + +#pragma mark - +#pragma mark time entries +// time entries ++(void)getTimeEntriesWithParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block +{ + NSString* path = @"/time_entries.json"; + NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params]; + NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey]; + if (accessKey.length > 0) { + [paramsDic setObject:accessKey forKey:@"key"]; + } + + [[OZLNetworkBase sharedClient] setAuthorizationHeader]; + [[OZLNetworkBase sharedClient] getPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) { + + if (block) { + NSLog(@"the repsonse:%@",responseObject); + NSMutableArray* priorities = [[NSMutableArray alloc] init]; + + NSArray* dic = [responseObject objectForKey:@"time_entries"]; + for (NSDictionary* p in dic) { + [priorities addObject:[[OZLModelTimeEntries alloc] initWithDictionary:p]]; + } + block(priorities,nil); + } + + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + + if (block) { + block([NSArray array], error); + } + }]; + +} + ++(void)getTimeEntriesForIssueId:(int)issueid withParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block +{ + NSDictionary* param = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithInt:issueid],@"issue_id", nil]; + [OZLNetwork getTimeEntriesWithParams:param andBlock:block]; +} + ++(void)getTimeEntriesForProjectId:(int)projectid withParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block +{ + + NSDictionary* param = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithInt:projectid],@"project_id", nil]; + [OZLNetwork getTimeEntriesWithParams:param andBlock:block]; +} + ++(void)getTimeEntryListWithParams:(NSDictionary*)params andBlock:(void (^)(NSArray *result, NSError *error))block +{ + NSString* path = @"/enumerations/time_entry_activities.json"; + NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params]; + NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey]; + if (accessKey.length > 0) { + [paramsDic setObject:accessKey forKey:@"key"]; + } + + [[OZLNetworkBase sharedClient] setAuthorizationHeader]; + [[OZLNetworkBase sharedClient] getPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) { + + if (block) { + NSLog(@"the repsonse:%@",responseObject); + NSMutableArray* activities = [[NSMutableArray alloc] init]; + + NSArray* dic = [responseObject objectForKey:@"time_entry_activities"]; + for (NSDictionary* p in dic) { + [activities addObject:[[OZLModelTimeEntryActivity alloc] initWithDictionary:p]]; + } + block(activities,nil); + } + + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + + if (block) { + block([NSArray array], error); + } + }]; +} ++(void)createTimeEntry:(OZLModelTimeEntries*)timeEntry withParams:(NSDictionary*)params andBlock:(void (^)(BOOL success, NSError *error))block +{ + NSString* path = [NSString stringWithFormat:@"/time_entries.json"]; + + //project info + NSMutableDictionary* paramsDic = [[NSMutableDictionary alloc] initWithDictionary:params]; + [paramsDic addEntriesFromDictionary:[timeEntry toParametersDic]]; + + NSString* accessKey = [[OZLSingleton sharedInstance] redmineUserKey]; + if (accessKey.length > 0) { + [paramsDic setObject:accessKey forKey:@"key"]; + } + + [[OZLNetworkBase sharedClient] postPath:path parameters:paramsDic success:^(AFHTTPRequestOperation *operation, id responseObject) { + + if (block) { + NSLog(@"the repsonse:%@",responseObject); + block(YES,nil); + } + + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + + if (block) { + block(NO, error); + } + + }]; +} + + @end diff --git a/RedmineMobile/RedmineMobile/Utils/OZLSingleton.h b/RedmineMobile/RedmineMobile/Utils/OZLSingleton.h index b895d91..9307f86 100644 --- a/RedmineMobile/RedmineMobile/Utils/OZLSingleton.h +++ b/RedmineMobile/RedmineMobile/Utils/OZLSingleton.h @@ -46,6 +46,12 @@ //app status @property(nonatomic) int lastProjectID;// last viewed project id +// app data +@property (strong, nonatomic) NSArray* trackerList; +@property (strong, nonatomic) NSArray* priorityList; +@property (strong, nonatomic) NSArray* statusList; +@property (strong, nonatomic) NSArray* userList; +@property (strong, nonatomic) NSArray* timeEntryActivityList; @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.h b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateOrUpdateViewController.h similarity index 82% rename from RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.h rename to RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateOrUpdateViewController.h index fb24b2f..27ca01c 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.h +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateOrUpdateViewController.h @@ -1,5 +1,5 @@ // -// OZLIssueCreateViewController.h +// OZLIssueCreateOrUpdateViewController.h // RedmineMobile // // Created by lizhijie on 7/16/13. @@ -30,7 +30,13 @@ #import "OZLModelIssue.h" #import "OZLModelProject.h" -@interface OZLIssueCreateViewController : UITableViewController +typedef enum { + OZLIssueInfoViewModeCreate, +// OZLIssueInfoViewModeDisplay, + OZLIssueInfoViewModeEdit +} OZLIssueInfoViewMode; + +@interface OZLIssueCreateOrUpdateViewController : UITableViewController - (IBAction)onCancel:(id)sender; - (IBAction)onSave:(id)sender; @@ -55,5 +61,9 @@ @property(nonatomic,strong) OZLModelProject* parentProject; @property(nonatomic,strong) OZLModelIssue* parentIssue; -@property(nonatomic,strong) NSArray* issueList; +@property(nonatomic, strong) OZLModelIssue* issueData;// used for update issue +@property(nonatomic) OZLIssueInfoViewMode viewMode; + +//@property(nonatomic,strong) NSArray* issueList; + @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateOrUpdateViewController.m similarity index 68% rename from RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.m rename to RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateOrUpdateViewController.m index 2f75d9d..50bf131 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateOrUpdateViewController.m @@ -1,5 +1,5 @@ // -// OZLIssueCreateViewController.m +// OZLIssueCreateOrUpdateViewController.m // RedmineMobile // // Created by lizhijie on 7/16/13. @@ -26,7 +26,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#import "OZLIssueCreateViewController.h" +#import "OZLIssueCreateOrUpdateViewController.h" #import "OZLNetwork.h" #import "MBProgressHUD.h" #import "OZLModelIssuePriority.h" @@ -34,13 +34,9 @@ #import "OZLModelUser.h" #import "OZLModelIssueStatus.h" #import "MLTableAlert.h" +#import "OZLSingleton.h" -@interface OZLIssueCreateViewController () { - - OZLModelTracker* _currentTracker; - OZLModelIssuePriority* _currentPriority; - OZLModelIssueStatus* _currentStatus; - OZLModelUser* _currentUser; +@interface OZLIssueCreateOrUpdateViewController () { NSDate* _currentStartDate; NSDate* _currentDueDate; @@ -51,7 +47,7 @@ @end -@implementation OZLIssueCreateViewController +@implementation OZLIssueCreateOrUpdateViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { @@ -66,12 +62,19 @@ { [super viewDidLoad]; + OZLSingleton* singleton = [OZLSingleton sharedInstance]; + _trackerList = singleton.trackerList; + _statusList = singleton.statusList; + _userList = singleton.userList; + _priorityList = singleton.priorityList; + UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(onCancel:)]; [self.navigationItem setLeftBarButtonItem:cancelBtn]; UIBarButtonItem* saveBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(onSave:)]; [self.navigationItem setRightBarButtonItem:saveBtn]; [self setupInputviews]; + [self initializeViewValues]; // hud _HUD = [[MBProgressHUD alloc] initWithView:self.view]; @@ -90,7 +93,7 @@ UIToolbar* inputAccessoryView = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 40)]; UIBarButtonItem* accessoryDoneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(accessoryDoneClicked:)]; UIBarButtonItem* flexleft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; - inputAccessoryView.items = [NSArray arrayWithObjects:flexleft, accessoryDoneButton, nil];; + inputAccessoryView.items = [NSArray arrayWithObjects:flexleft, accessoryDoneButton, nil]; _startDateLabel.inputView = datePicker; _startDateLabel.inputAccessoryView = inputAccessoryView; @@ -118,6 +121,37 @@ _doneProgressLabel.delegate = self; } +-(void)initializeViewValues +{ + if (_viewMode == OZLIssueInfoViewModeEdit) { // initial values for ui elements + _subjectTextField.text = _issueData.subject; + if (_issueData.tracker) { + _trackerLabel.text = _issueData.tracker.name; + } + if (_issueData.status) { + _statusLabel.text = _issueData.status.name; + } + if (_issueData.priority) { + _priorityLabel.text = _issueData.priority.name; + } + if (_issueData.assignedTo) { + _assigneeLabel.text = _issueData.assignedTo.name; + } + if (_issueData.startDate) { + _startDateLabel.text = _issueData.startDate; + } + if (_issueData.dueDate) { + _dueDateLabel.text = _issueData.dueDate; + } + _estimatedHoursLabel.text = [NSString stringWithFormat:@"%f",_issueData.estimatedHours]; + _doneProgressLabel.text = [NSString stringWithFormat:@"%d %%",(int)_issueData.doneRatio]; + + }else if(_viewMode == OZLIssueInfoViewModeCreate){ + _issueData = [[OZLModelIssue alloc] init]; + } + +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; @@ -137,21 +171,21 @@ [_HUD hide:YES afterDelay:1]; return; } - if (_currentUser == nil) { + if (_issueData.tracker == nil) { _HUD.mode = MBProgressHUDModeText; _HUD.labelText = @"tracker can not be empty."; [_HUD show:YES]; [_HUD hide:YES afterDelay:1]; return; } - if (_currentStatus == nil) { + if (_issueData.status == nil) { _HUD.mode = MBProgressHUDModeText; _HUD.labelText = @"status can not be empty."; [_HUD show:YES]; [_HUD hide:YES afterDelay:1]; return; } - if (_currentPriority == nil) { + if (_issueData.priority == nil) { _HUD.mode = MBProgressHUDModeText; _HUD.labelText = @"priority can not be empty."; [_HUD show:YES]; @@ -159,37 +193,63 @@ return; } - OZLModelIssue* issueData = [[OZLModelIssue alloc] init]; - issueData.subject = _subjectTextField.text; - issueData.tracker = _currentTracker; - issueData.status = _currentStatus; - issueData.priority = _currentPriority; - issueData.assignedTo = _currentUser; - issueData.projectId = _parentProject.index; - + _issueData.subject = _subjectTextField.text; if (_parentIssue) { - issueData.parentIssueId = _parentIssue.index; + _issueData.parentIssueId = _parentIssue.index; + _issueData.projectId = _parentIssue.projectId; + }else if(_parentProject){ + _issueData.projectId = _parentProject.index; } - issueData.description = _descriptionTextview.text; - issueData.startDate = _startDateLabel.text; - issueData.dueDate = _dueDateLabel.text; - issueData.doneRatio = [_doneProgressLabel.text integerValue]; - issueData.estimatedHours = _currentEstimatedTime/60.0f; + if (_viewMode == OZLIssueInfoViewModeEdit) { + _issueData.notes = _descriptionTextview.text; + }else if(_viewMode == OZLIssueInfoViewModeCreate) { + _issueData.description = _descriptionTextview.text; + } + _issueData.startDate = _startDateLabel.text; + _issueData.dueDate = _dueDateLabel.text; + _issueData.doneRatio = [_doneProgressLabel.text integerValue]; + _issueData.estimatedHours = _currentEstimatedTime/60.0f; //TODO: is_public is not processed yet _HUD.mode = MBProgressHUDModeIndeterminate; - _HUD.labelText = @"Creating Project..."; - [_HUD show:YES]; - [OZLNetwork createIssue:issueData withParams:nil andBlock:^(BOOL success, NSError *error){ - if (error) { - NSLog(@"create project error: %@",error.description); - }else { + if (_viewMode == OZLIssueInfoViewModeEdit) { + _HUD.labelText = @"Updating Issue ..."; + [_HUD show:YES]; + [OZLNetwork updateIssue:_issueData withParams:nil andBlock:^(BOOL success, NSError *error){ + [_HUD hide:YES]; + + if (error) { + NSLog(@"update issue error: %@",error.description); - } - [_HUD hide:YES]; - }]; + _HUD.mode = MBProgressHUDModeText; + _HUD.labelText = @"Sorry, something wrong while updating issue."; + [_HUD show:YES]; + [_HUD hide:YES afterDelay:1]; + }else { + [self.navigationController popViewControllerAnimated:YES]; + } + }]; + }else if(_viewMode == OZLIssueInfoViewModeCreate){ + _HUD.labelText = @"Creating New Issue ..."; + [_HUD show:YES]; + [OZLNetwork createIssue:_issueData withParams:nil andBlock:^(BOOL success, NSError *error){ + [_HUD hide:YES]; + + if (error) { + NSLog(@"create issue error: %@",error.description); + + _HUD.mode = MBProgressHUDModeText; + _HUD.labelText = @"Sorry, something wrong while creating issue."; + [_HUD show:YES]; + [_HUD hide:YES afterDelay:1]; + + }else { + [self.navigationController popViewControllerAnimated:YES]; + } + }]; + } } - (void)viewDidUnload { @@ -240,16 +300,16 @@ if (selectedIndex.row == 0) { switch (indexPath.row) { case 0:{//tracker - _currentTracker = nil; + _issueData.tracker = nil; }break; case 1:{//status - _currentStatus = nil; + _issueData.status = nil; }break; case 2:{//priority - _currentPriority = nil; + _issueData.priority = nil; }break; case 3:{//assignee - _currentUser = nil; + _issueData.assignedTo = nil; }break; default: break; @@ -260,16 +320,16 @@ id data = [[dataArray objectAtIndex:indexPath.row ] objectAtIndex:selectedIndex.row - 1]; switch (indexPath.row) { case 0:{//tracker - _currentUser = data; + _issueData.tracker = data; }break; case 1:{//status - _currentStatus = data; + _issueData.status = data; }break; case 2:{//priority - _currentPriority = data; + _issueData.priority = data; }break; case 3:{//assignee - _currentUser = data; + _issueData.assignedTo = data; }break; default: @@ -288,16 +348,16 @@ }else if( indexPath.section == 2){ switch (indexPath.row) { case 0:{//start date - + [_startDateLabel becomeFirstResponder]; }break; case 1:{//due date - + [_dueDateLabel becomeFirstResponder]; }break; case 2:{//estimated hours - + [_estimatedHoursLabel becomeFirstResponder]; }break; case 3:{//done - + [_doneProgressLabel becomeFirstResponder]; }break; default: @@ -308,6 +368,31 @@ [self.tableView reloadData]; } +-(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +{ + if (section == 0) { + NSString* tip ; + if (_viewMode == OZLIssueInfoViewModeEdit) { + tip = [NSString stringWithFormat:@"Update issue #%d",_issueData.index]; + }else if(_viewMode == OZLIssueInfoViewModeCreate){ + if (_parentIssue) { + tip = [NSString stringWithFormat:@"Add sub issue to #%d",_parentIssue.index]; + }else { + tip = [NSString stringWithFormat:@"Add issue to project:%@",_parentProject.name]; + } + } + return tip; + }else if(section == 3) { + if (_viewMode == OZLIssueInfoViewModeEdit) { + return @"Notes"; + }else if(_viewMode == OZLIssueInfoViewModeCreate){ + return @"Description"; + } + } + + return @""; +} + #pragma mark - #pragma mark delegate of textfield inputview diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.storyboard b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateOrUpdateViewController.storyboard similarity index 95% rename from RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.storyboard rename to RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateOrUpdateViewController.storyboard index 2216f3e..1369d60 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.storyboard +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateOrUpdateViewController.storyboard @@ -4,10 +4,10 @@ - + - + @@ -289,6 +289,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.h b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.h index a19d017..46430cb 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.h +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.h @@ -28,9 +28,13 @@ #import #import "OZLModelIssue.h" +#import "OZLModelTimeEntryActivity.h" @interface OZLIssueDetailViewController : UITableViewController -@property(nonatomic,strong) OZLModelIssue* issueData; + +@property(nonatomic, strong) OZLModelIssue* issueData; +@property(nonatomic, strong) NSArray* timeEntryActivityList; + @property (weak, nonatomic) IBOutlet UILabel *subject; @property (weak, nonatomic) IBOutlet UILabel *description; @property (weak, nonatomic) IBOutlet UIProgressView *progressbar; diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.m index 6bc8892..a9c3a96 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.m @@ -27,6 +27,10 @@ // THE SOFTWARE. #import "OZLIssueDetailViewController.h" +#import "OZLIssueHistoryViewController.h" +#import "OZLIssueLogtimeViewController.h" +#import "OZLSingleton.h" +#import "OZLIssueCreateOrUpdateViewController.h" @interface OZLIssueDetailViewController () @@ -56,6 +60,8 @@ { [super viewDidLoad]; + _timeEntryActivityList = [[OZLSingleton sharedInstance] timeEntryActivityList]; + _subject.text = _issueData.subject; _description.text = _issueData.description; _progressbar.progress = _issueData.doneRatio/100; @@ -65,6 +71,8 @@ _assignedTo.text = _issueData.assignedTo.login; _startTime.text = _issueData.startDate; _dueTime.text = _issueData.dueDate; + + [self.navigationItem setTitle:@"Issue Details"]; } - (void)didReceiveMemoryWarning @@ -73,87 +81,36 @@ // Dispose of any resources that can be recreated. } -#pragma mark - Table view data source - -//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -//{ -//#warning Potentially incomplete method implementation. -// // Return the number of sections. -// return 1; -//} -// -//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -//{ -//#warning Incomplete method implementation. -// // Return the number of rows in the section. -// return 2; -//} -// -//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -//{ -// static NSString *CellIdentifier = @"Cell"; -// UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; -// -// // Configure the cell... -// -// return cell; -//} -// -///* -//// Override to support conditional editing of the table view. -//- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath -//{ -// // Return NO if you do not want the specified item to be editable. -// return YES; -//} -//*/ -// -///* -//// Override to support editing the table view. -//- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath -//{ -// if (editingStyle == UITableViewCellEditingStyleDelete) { -// // Delete the row from the data source -// [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; -// } -// else if (editingStyle == UITableViewCellEditingStyleInsert) { -// // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view -// } -//} -//*/ -// -///* -//// Override to support rearranging the table view. -//- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath -//{ -//} -//*/ -// -///* -//// Override to support conditional rearranging of the table view. -//- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath -//{ -// // Return NO if you do not want the item to be re-orderable. -// return YES; -//} -//*/ - #pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == 1) { switch (indexPath.row) { - case 0:{ - + case 0:{//history + OZLIssueHistoryViewController* history = [[OZLIssueHistoryViewController alloc] init]; + [history setIssueData:_issueData]; + [self.navigationController pushViewController:history animated:YES]; }break; - case 1:{ - + case 1:{// add sub task + UIStoryboard *tableViewStoryboard = [UIStoryboard storyboardWithName:@"OZLIssueCreateOrUpdateViewController" bundle:nil]; + OZLIssueCreateOrUpdateViewController* creator = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"OZLIssueCreateOrUpdateViewController"]; + [creator setParentIssue:_issueData]; + [self.navigationController pushViewController:creator animated:YES]; }break; - case 2:{ - + case 2:{//logtime + UIStoryboard *tableViewStoryboard = [UIStoryboard storyboardWithName:@"OZLIssueLogtimeViewController" bundle:nil]; + OZLIssueLogtimeViewController* creator = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"OZLIssueLogtimeViewController"]; + [creator setIssueData:_issueData]; + [self.navigationController pushViewController:creator animated:YES]; + }break; + case 3:{ // update + UIStoryboard *tableViewStoryboard = [UIStoryboard storyboardWithName:@"OZLIssueCreateOrUpdateViewController" bundle:nil]; + OZLIssueCreateOrUpdateViewController* creator = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"OZLIssueCreateOrUpdateViewController"]; + [creator setIssueData:_issueData]; + [creator setViewMode:OZLIssueInfoViewModeEdit]; + [self.navigationController pushViewController:creator animated:YES]; }break; - default: break; } diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.storyboard b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.storyboard index 990f929..e1c5ff2 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.storyboard +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueDetailViewController.storyboard @@ -181,7 +181,7 @@ - + @@ -198,6 +198,24 @@ + + + + + + + + + + + + @@ -224,22 +242,6 @@ - - - - - - - - - - - - - - - - diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.m index 4a6124c..7f94766 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.m @@ -78,7 +78,6 @@ { OZLSingleton* singleton =[OZLSingleton sharedInstance]; - [singleton setIssueListFilterType:_checkedCell[0]]; [singleton setIssueListSortType:_checkedCell[1]]; [singleton setIssueListSortAscending:_checkedCell[2]]; diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectDetailViewController.h b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueHistoryViewController.h similarity index 68% rename from RedmineMobile/RedmineMobile/ViewControllers/OZLProjectDetailViewController.h rename to RedmineMobile/RedmineMobile/ViewControllers/OZLIssueHistoryViewController.h index 83bbf2c..322b8f5 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectDetailViewController.h +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueHistoryViewController.h @@ -1,8 +1,8 @@ // -// OZLProjectDetailViewController.h +// OZLIssueHistoryViewController.h // RedmineMobile // -// Created by lizhijie on 7/15/13. +// Created by lizhijie on 7/22/13. // This code is distributed under the terms and conditions of the MIT license. @@ -26,18 +26,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + #import -#import "OZLModelProject.h" +#import "OZLModelIssue.h" -@interface OZLProjectDetailViewController : UIViewController +@interface OZLIssueHistoryViewController : UITableViewController -@property(nonatomic, strong) OZLModelProject* projectData; - -@property (weak, nonatomic) IBOutlet UILabel *IDLabel; -@property (weak, nonatomic) IBOutlet UILabel *nameLabel; -@property (weak, nonatomic) IBOutlet UILabel *parentIDlabel; -@property (weak, nonatomic) IBOutlet UILabel *createTimeLabel; -@property (weak, nonatomic) IBOutlet UILabel *updateTimeLabel; -@property (weak, nonatomic) IBOutlet UITextView *descriptionTextview; +@property(nonatomic,strong) OZLModelIssue* issueData; @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueHistoryViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueHistoryViewController.m new file mode 100644 index 0000000..98ef1cd --- /dev/null +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueHistoryViewController.m @@ -0,0 +1,117 @@ +// +// OZLIssueHistoryViewController.m +// RedmineMobile +// +// Created by lizhijie on 7/22/13. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#import "OZLIssueHistoryViewController.h" +#import "MBProgressHUD.h" +#import "OZLNetwork.h" +#import "OZLModelIssueJournal.h" +#import "OZLModelIssueJournalDetail.h" + +@interface OZLIssueHistoryViewController () { + MBProgressHUD* _HUD; + NSMutableArray* _journalList; +} + +@end + +@implementation OZLIssueHistoryViewController + +- (id)initWithStyle:(UITableViewStyle)style +{ + self = [super initWithStyle:style]; + if (self) { + // Custom initialization + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + // self.clearsSelectionOnViewWillAppear = NO; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; + + _HUD = [[MBProgressHUD alloc] initWithView:self.view]; + [self.view addSubview:_HUD]; + _HUD.labelText = @"Refreshing..."; + + [self.navigationItem setTitle:_issueData.subject]; +} + + +-(void) viewWillAppear:(BOOL)animated +{ + [_HUD show:YES]; + // refresh journal list + [OZLNetwork getJournalListForIssue:_issueData.index withParams:nil andBlock:^(NSArray *result, NSError *error) { + NSLog(@"respond:%@",result.description); + _journalList = [[NSMutableArray alloc] initWithArray: result]; + [self.tableView reloadData]; + [_HUD hide:YES]; + }]; + +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return _journalList.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *CellIdentifier = @"timeEntryCell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier ]; + if (!cell) { + cell = [[UITableViewCell alloc] + initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier]; + } + OZLModelIssueJournal* journal = [_journalList objectAtIndex:indexPath.row]; + [cell.textLabel setText: journal.user.name]; + [cell.detailTextLabel setText:[NSString stringWithFormat:@"number of change: %d",journal.detailArray.count]]; + return cell; +} + +@end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.h b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.h new file mode 100644 index 0000000..c5fdb97 --- /dev/null +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.h @@ -0,0 +1,23 @@ +// +// OZLIssueLogtimeViewController.h +// RedmineMobile +// +// Created by lizhijie on 7/23/13. +// Copyright (c) 2013 Lee Zhijie. All rights reserved. +// + +#import +#import "OZLModelIssue.h" +#import "OZLModelTimeEntryActivity.h" + +@interface OZLIssueLogtimeViewController : UITableViewController + +@property (nonatomic, strong) OZLModelIssue* issueData; +@property (nonatomic, strong) NSArray* timeEntryActivityList; + +@property (weak, nonatomic) IBOutlet UITextField *hours; +@property (weak, nonatomic) IBOutlet UITextField *activity; +@property (weak, nonatomic) IBOutlet UITextField *dateLabel; +@property (weak, nonatomic) IBOutlet UITextView *comment; + +@end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.m new file mode 100644 index 0000000..1e6f82d --- /dev/null +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.m @@ -0,0 +1,196 @@ +// +// OZLIssueLogtimeViewController.m +// RedmineMobile +// +// Created by lizhijie on 7/23/13. +// Copyright (c) 2013 Lee Zhijie. All rights reserved. +// + +#import "OZLIssueLogtimeViewController.h" +#import "MBProgressHUD.h" +#import "MLTableAlert.h" +#import "OZLNetwork.h" +#import "OZLSingleton.h" + +@interface OZLIssueLogtimeViewController () { + MBProgressHUD* _HUD; + float _hourValue; + OZLModelTimeEntries* _entry; +} +@end + +@implementation OZLIssueLogtimeViewController + +- (id)initWithStyle:(UITableViewStyle)style +{ + self = [super initWithStyle:style]; + if (self) { + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + // initialize data + _hourValue = 0; + _entry = [[OZLModelTimeEntries alloc] init]; + _timeEntryActivityList = [[OZLSingleton sharedInstance] timeEntryActivityList]; + + UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(onCancel:)]; + [self.navigationItem setLeftBarButtonItem:cancelBtn]; + UIBarButtonItem* saveBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(onSave:)]; + [self.navigationItem setRightBarButtonItem:saveBtn]; + + [self.navigationItem setTitle:@"Log Time"]; + + [self setupInputViews]; + + // hud + _HUD = [[MBProgressHUD alloc] initWithView:self.view]; + [self.view addSubview:_HUD]; + _HUD.labelText = @"Loading..."; +} + +-(void)setupInputViews +{ + [_activity setUserInteractionEnabled:NO]; + + // setup time picker inputview + UIDatePicker* timerPicker = [[UIDatePicker alloc]init]; + [timerPicker setDatePickerMode:UIDatePickerModeCountDownTimer]; + [timerPicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged]; + timerPicker.minuteInterval = 5; + // setup datapicker inputview + UIDatePicker* datePicker = [[UIDatePicker alloc]init]; + [datePicker setDatePickerMode:UIDatePickerModeDate]; + [datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged]; + // accessoryview + UIToolbar* inputAccessoryView = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 40)]; + UIBarButtonItem* accessoryDoneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(accessoryDoneClicked:)]; + UIBarButtonItem* flexleft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; + inputAccessoryView.items = [NSArray arrayWithObjects:flexleft, accessoryDoneButton, nil]; + + _hours.inputView = timerPicker; + _hours.inputAccessoryView = inputAccessoryView; + _dateLabel.inputView = datePicker; + _dateLabel.inputAccessoryView = inputAccessoryView; +} +-(void) onCancel:(id)sender +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +-(void) onSave:(id)sender +{ + _HUD.mode = MBProgressHUDModeIndeterminate; + _HUD.labelText = @"Logging time ..."; + [_HUD show:YES]; + + // build entry + _entry.issue = _issueData; + _entry.hours = _hourValue; + if (_comment.text.length > 0) { + _entry.comments = _comment.text; + } + if (_dateLabel.text.length > 0) { + _entry.createdOn = _dateLabel.text; + } + + [OZLNetwork createTimeEntry:_entry withParams:nil andBlock:^(BOOL success, NSError *error){ + if (error) { + NSLog(@"log time error: %@",error.description); + }else { + + [self.navigationController popViewControllerAnimated:YES]; + + } + [_HUD hide:YES]; + }]; +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (indexPath.section == 0 && indexPath.row == 1) {//activity + MLTableAlert* tableAlert = [MLTableAlert tableAlertWithTitle:@"Activty" cancelButtonTitle:@"Cancel" numberOfRows:^NSInteger (NSInteger section) + { + return [_timeEntryActivityList count] + 1; + } + andCells:^UITableViewCell* (MLTableAlert *anAlert, NSIndexPath *alertIndexPath) + { + static NSString *CellIdentifier = @"CellIdentifier"; + UITableViewCell *cell = [anAlert.table dequeueReusableCellWithIdentifier:CellIdentifier]; + if (cell == nil) + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; + + if (alertIndexPath.row == 0) { + cell.textLabel.text = @"None"; + }else { + cell.textLabel.text = [[_timeEntryActivityList objectAtIndex:alertIndexPath.row - 1] name]; + } + return cell; + }]; + + // Setting custom alert height + tableAlert.height = 350; + + // configure actions to perform + [tableAlert configureSelectionBlock:^(NSIndexPath *selectedIndex){ + if (selectedIndex.row == 0) { + _activity.text = @"None"; + _entry.activity = nil; + }else { + _activity.text = [[ _timeEntryActivityList objectAtIndex:selectedIndex.row - 1] name]; + _entry.activity = [_timeEntryActivityList objectAtIndex:selectedIndex.row -1]; + } + [_activity sizeToFit]; + } andCompletionBlock:^{ + + }]; + + [tableAlert show]; + } +} + +- (void)viewDidUnload { + [self setHours:nil]; + [self setActivity:nil]; + [self setDateLabel:nil]; + [self setComment:nil]; + [super viewDidUnload]; +} + +#pragma mark data picker value changed +-(void)datePickerValueChanged:(id)sender +{ + UIDatePicker* datepicker = (UIDatePicker*)sender; + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + + if (_hours.isFirstResponder) { + + NSString* timeStr = [NSString stringWithFormat:@"%d Mins",(int)datepicker.countDownDuration/60]; + _hours.text = timeStr; + _hourValue = (int)(datepicker.countDownDuration/3600.f); + }else { + [dateFormatter setDateFormat:@"yyyy-MM-dd"]; + + NSString* dateStr = [dateFormatter stringFromDate:datepicker.date]; + _dateLabel.text = dateStr; + } +} + +-(void)accessoryDoneClicked:(id)sender +{ + [self.view endEditing:YES]; +} + +@end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.storyboard b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.storyboard new file mode 100644 index 0000000..14cef0d --- /dev/null +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.storyboard @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectDetailViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectDetailViewController.m deleted file mode 100644 index cbfdd7a..0000000 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectDetailViewController.m +++ /dev/null @@ -1,80 +0,0 @@ -// -// OZLProjectDetailViewController.m -// RedmineMobile -// -// Created by lizhijie on 7/15/13. - -// This code is distributed under the terms and conditions of the MIT license. - -// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "OZLProjectDetailViewController.h" - -@interface OZLProjectDetailViewController () { - -} - -@end - -@implementation OZLProjectDetailViewController - -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Custom initialization - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - [_IDLabel setText:[NSString stringWithFormat:@"%d",_projectData.index]]; - [_nameLabel setText:_projectData.name]; - if (_projectData.parentId < 0) { - [_parentIDlabel setText:@"--"]; - }else { - [_parentIDlabel setText:[NSString stringWithFormat:@"%d",_projectData.parentId]]; - } - [_createTimeLabel setText:_projectData.createdOn]; - [_updateTimeLabel setText:_projectData.updatedOn]; - - [_descriptionTextview setEditable:NO]; - [_descriptionTextview setText:_projectData.description]; -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -- (void)viewDidUnload { - [self setIDLabel:nil]; - [self setNameLabel:nil]; - [self setParentIDlabel:nil]; - [self setCreateTimeLabel:nil]; - [self setUpdateTimeLabel:nil]; - [self setDescriptionTextview:nil]; - [super viewDidUnload]; -} -@end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectDetailViewController.xib b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectDetailViewController.xib deleted file mode 100644 index e6aa4d7..0000000 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectDetailViewController.xib +++ /dev/null @@ -1,583 +0,0 @@ - - - - 1552 - 11G63 - 3084 - 1138.51 - 569.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - IBProxyObject - IBUILabel - IBUITextView - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - - - 292 - {{20, 20}, {106, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - ID: - - 1 - MCAwIDAAA - darkTextColor - - - 0 - - 1 - 17 - - - Helvetica - 17 - 16 - - NO - - - - 292 - {{20, 49}, {106, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Name: - - - 0 - - - NO - - - - 292 - {{20, 107}, {106, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Created On: - - - 0 - - - NO - - - - 292 - {{20, 136}, {106, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Updated On: - - - 0 - - - NO - - - - 292 - {{20, 165}, {106, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Description: - - - 0 - - - NO - - - - 292 - {{20, 78}, {106, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Parent ID: - - - 0 - - - NO - - - - 306 - {{20, 194}, {280, 290}} - - - - _NS:9 - - 1 - MSAxIDEAA - - YES - YES - IBCocoaTouchFramework - Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. - - 2 - IBCocoaTouchFramework - - - 1 - 14 - - - Helvetica - 14 - 16 - - - - - 292 - {{134, 20}, {166, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - ID: - - - 0 - - - NO - - - - 292 - {{134, 49}, {166, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - ID: - - - 0 - - - NO - - - - 292 - {{134, 78}, {166, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - ID: - - - 0 - - - NO - - - - 292 - {{134, 107}, {166, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - ID: - - - 0 - - - NO - - - - 292 - {{134, 136}, {166, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - ID: - - - 0 - - - NO - - - {{0, 64}, {320, 504}} - - - - - 3 - MQA - - 2 - - - - - NO - - - IBUIScreenMetrics - - YES - - - - - - {320, 568} - {568, 320} - - - IBCocoaTouchFramework - Retina 4 Full Screen - 2 - - IBCocoaTouchFramework - - - - - - - view - - - - 3 - - - - IDLabel - - - - 18 - - - - nameLabel - - - - 19 - - - - parentIDlabel - - - - 20 - - - - createTimeLabel - - - - 21 - - - - updateTimeLabel - - - - 22 - - - - descriptionTextview - - - - 23 - - - - - - 0 - - - - - - 1 - - - - - - - - - - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 6 - - - - - 7 - - - - - 8 - - - - - 9 - - - - - 10 - - - - - 11 - - - - - 12 - - - - - 13 - - - - - 14 - - - - - 15 - - - - - 16 - - - - - 17 - - - - - - - OZLProjectDetailViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 23 - - - - - OZLProjectDetailViewController - UIViewController - - UILabel - UILabel - UITextView - UILabel - UILabel - UILabel - - - - IDLabel - UILabel - - - createTimeLabel - UILabel - - - descriptionTextview - UITextView - - - nameLabel - UILabel - - - parentIDlabel - UILabel - - - updateTimeLabel - UILabel - - - - IBProjectSource - ./Classes/OZLProjectDetailViewController.h - - - - - 0 - IBCocoaTouchFramework - YES - 3 - 2083 - - diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectCreateViewController.h b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.h similarity index 83% rename from RedmineMobile/RedmineMobile/ViewControllers/OZLProjectCreateViewController.h rename to RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.h index 39e8b14..78bd745 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectCreateViewController.h +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.h @@ -1,5 +1,5 @@ // -// OZLProjectCreateViewController.h +// OZLProjectInfoViewController.h // RedmineMobile // // Created by lizhijie on 7/16/13. @@ -29,7 +29,14 @@ #import #import "OZLModelProject.h" -@interface OZLProjectCreateViewController : UITableViewController +typedef enum { + OZLProjectInfoViewModeCreate, + OZLProjectInfoViewModeDisplay, + OZLProjectInfoViewModeEdit +} OZLProjectInfoViewMode; + + +@interface OZLProjectInfoViewController : UITableViewController - (IBAction)onCancel:(id)sender; - (IBAction)onSave:(id)sender; @property (weak, nonatomic) IBOutlet UITextField *name; @@ -40,4 +47,7 @@ @property (nonatomic,strong) OZLModelProject* parentProject; @property (nonatomic,strong) NSArray* projectList; +@property (nonatomic, strong) OZLModelProject* projectData; +@property (nonatomic) OZLProjectInfoViewMode viewMode; + @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectCreateViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.m similarity index 85% rename from RedmineMobile/RedmineMobile/ViewControllers/OZLProjectCreateViewController.m rename to RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.m index cda5122..c4b2a72 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectCreateViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.m @@ -1,5 +1,5 @@ // -// OZLProjectCreateViewController.m +// OZLProjectInfoViewController.m // RedmineMobile // // Created by lizhijie on 7/16/13. @@ -26,19 +26,19 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#import "OZLProjectCreateViewController.h" +#import "OZLProjectInfoViewController.h" #import "MBProgressHUD.h" #import "OZLNetwork.h" #import "MLTableAlert.h" -@interface OZLProjectCreateViewController () { +@interface OZLProjectInfoViewController () { MBProgressHUD * _HUD; } @end -@implementation OZLProjectCreateViewController +@implementation OZLProjectInfoViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { @@ -53,15 +53,45 @@ { [super viewDidLoad]; + + _HUD = [[MBProgressHUD alloc] initWithView:self.view]; + [self.view addSubview:_HUD]; + _HUD.labelText = @"Loading..."; + + if (_viewMode == OZLProjectInfoViewModeCreate) { + [self prepareViewForCreate]; + }else if(_viewMode == OZLProjectInfoViewModeDisplay) { + [self prepareViewForDisplay]; + }else if(_viewMode == OZLProjectInfoViewModeEdit) { + + } +} + +-(void)prepareViewForDisplay +{ + self.navigationItem.title = @"Project Details"; + + _name.userInteractionEnabled = NO; + _identifier.userInteractionEnabled = NO; + _homepageUrl.userInteractionEnabled = NO; + _description.userInteractionEnabled = NO; + + _name.text = _projectData.name; + _identifier.text = _projectData.identifier; + _homepageUrl.text = _projectData.homepage; + _description.text = _projectData.description; +} + +-(void)prepareViewForCreate +{ + UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(onCancel:)]; [self.navigationItem setLeftBarButtonItem:cancelBtn]; UIBarButtonItem* saveBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(onSave:)]; [self.navigationItem setRightBarButtonItem:saveBtn]; + self.navigationItem.title = @"New Project"; - _HUD = [[MBProgressHUD alloc] initWithView:self.view]; - [self.view addSubview:_HUD]; - _HUD.labelText = @"Loading..."; } - (void)didReceiveMemoryWarning @@ -126,6 +156,9 @@ [super viewDidUnload]; } +#pragma mark tableview datasource + +#pragma mark tableview delegate -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section ==0 && indexPath.row == 4) {//parent project diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectCreateViewController.storyboard b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.storyboard similarity index 92% rename from RedmineMobile/RedmineMobile/ViewControllers/OZLProjectCreateViewController.storyboard rename to RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.storyboard index cdfb4ff..3749179 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectCreateViewController.storyboard +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.storyboard @@ -4,11 +4,11 @@ - + - - + + @@ -170,22 +170,6 @@ - - - - - - - - - - - - - - - - diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectListViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectListViewController.m index 7976ab0..faf0a37 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectListViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectListViewController.m @@ -30,7 +30,7 @@ #import "PPRevealSideViewController.h" #import "OZLProjectViewController.h" #import "OZLAccountViewController.h" -#import "OZLProjectCreateViewController.h" +#import "OZLProjectInfoViewController.h" #import "OZLNetwork.h" #import "OZLModelProject.h" #import "MBProgressHUD.h" @@ -39,6 +39,9 @@ @interface OZLProjectListViewController (){ NSMutableArray* _projectList; MBProgressHUD * _HUD; + + UIBarButtonItem* _editBtn; + UIBarButtonItem* _doneBtn; } @end @@ -66,6 +69,9 @@ UIBarButtonItem* accountBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize target:self action:@selector(showAccountView:)]; [self.navigationItem setLeftBarButtonItem:accountBtn]; + _editBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editProjectList:)]; + _doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(editProjectListDone:)]; + [self.navigationItem setRightBarButtonItem:_editBtn]; [self.navigationItem setTitle:@"Projects"]; @@ -117,12 +123,24 @@ // animated:YES]; } +-(void)editProjectList:(id)sender +{ + [_projectsTableview setEditing:YES animated:YES]; + self.navigationItem.rightBarButtonItem = _doneBtn; + +} + +-(void)editProjectListDone:(id)sender +{ + [_projectsTableview setEditing:NO animated:YES]; + self.navigationItem.rightBarButtonItem = _editBtn; +} + - (IBAction)createProject:(id)sender { - //OZLProjectCreateViewController* creator = [[OZLProjectCreateViewController alloc] initWithNibName:@"OZLProjectCreateViewController" bundle:nil]; - //[self.navigationController presentModalViewController:creator animated:YES]; - UIStoryboard *tableViewStoryboard = [UIStoryboard storyboardWithName:@"OZLProjectCreateViewController" bundle:nil]; - OZLProjectCreateViewController* creator = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"OZLProjectCreateViewController"]; + UIStoryboard *tableViewStoryboard = [UIStoryboard storyboardWithName:@"OZLProjectInfoViewController" bundle:nil]; + OZLProjectInfoViewController* creator = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"OZLProjectInfoViewController"]; [creator setProjectList:_projectList]; + [creator setViewMode:OZLProjectInfoViewModeCreate]; [self.navigationController pushViewController:creator animated:YES]; } @@ -165,44 +183,39 @@ return cell; } -/* - // Override to support conditional editing of the table view. - - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath - { - // Return NO if you do not want the specified item to be editable. - return YES; - } - */ -/* - // Override to support editing the table view. - - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath - { - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Delete the row from the data source - [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; - } - else if (editingStyle == UITableViewCellEditingStyleInsert) { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } - } - */ +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the specified item to be editable. + return YES; +} -/* - // Override to support rearranging the table view. - - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath - { - } - */ +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (editingStyle == UITableViewCellEditingStyleDelete) { -/* - // Override to support conditional rearranging of the table view. - - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath - { - // Return NO if you do not want the item to be re-orderable. - return YES; - } - */ + _HUD.labelText = @"Deleting Project..."; + [_HUD show:YES]; + [OZLNetwork deleteProject:[[_projectList objectAtIndex:indexPath.row] index] withParams:nil andBlock:^(BOOL success, NSError *error) { + [_HUD hide:YES]; + if (error) { + NSLog(@"failed to delete project"); + _HUD.mode = MBProgressHUDModeText; + + _HUD.labelText = @"Sorry, something wrong while deleting project."; + [_HUD show:YES]; + [_HUD hide:YES afterDelay:1]; + }else { + [_projectList removeObjectAtIndex:indexPath.row]; + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } + }]; + } else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} #pragma mark - Table view delegate diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.h b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.h index 2fad8c6..582f48f 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.h +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.h @@ -34,11 +34,13 @@ @property (nonatomic,strong) OZLModelProject* projectData; - (IBAction)onNewIssue:(id)sender; - (IBAction)onSortSetting:(id)sender; +- (IBAction)onShowInfo:(id)sender; -@property (weak, nonatomic) NSArray* trackerList; -@property (weak, nonatomic) NSArray* priorityList; -@property (weak, nonatomic) NSArray* statusList; -@property (weak, nonatomic) NSArray* userList; +@property (strong, nonatomic) NSArray* trackerList; +@property (strong, nonatomic) NSArray* priorityList; +@property (strong, nonatomic) NSArray* statusList; +@property (strong, nonatomic) NSArray* userList; +@property (strong, nonatomic) NSArray* timeEntryActivityList; @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.m index 3f576a1..5ec0c45 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.m @@ -31,18 +31,20 @@ #import "OZLProjectListViewController.h" #import "OZLNetwork.h" #import "MBProgressHUD.h" -#import "OZLProjectDetailViewController.h" +#import "OZLProjectInfoViewController.h" #import "OZLIssueDetailViewController.h" -#import "OZLIssueCreateViewController.h" +#import "OZLIssueCreateOrUpdateViewController.h" #import "OZLIssueFilterViewController.h" #import "OZLSingleton.h" @interface OZLProjectViewController () { - NSArray* _issuesList; + NSMutableArray* _issuesList; float _sideviewOffset; MBProgressHUD * _HUD; + UIBarButtonItem* _editBtn; + UIBarButtonItem* _doneBtn; NSMutableDictionary* _issueListOption; } @@ -64,11 +66,9 @@ [super viewDidLoad]; // [self changeSideViewOffset:40]; -// UIBarButtonItem* projectListBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize target:self action:@selector(showProjectList)]; -// [self.navigationItem setLeftBarButtonItem:projectListBtn]; - - UIBarButtonItem* inforBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(showProjectDetail)]; - [self.navigationItem setRightBarButtonItem:inforBtn]; + _editBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemEdit target:self action:@selector(editIssueList:)]; + _doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(editIssueListDone:)]; + [self.navigationItem setRightBarButtonItem:_editBtn]; _HUD = [[MBProgressHUD alloc] initWithView:self.view]; [self.view addSubview:_HUD]; @@ -134,8 +134,7 @@ if (error) { NSLog(@"error getIssueListForProject: %@",error.description); }else { - _issuesList = result; - + _issuesList = [[NSMutableArray alloc] initWithArray: result]; [_issuesTableview reloadData]; } [_HUD hide:YES]; @@ -148,56 +147,85 @@ { _issueListOption = [[NSMutableDictionary alloc] init]; - static int doneCount = 0; - [OZLNetwork getTrackerListWithParams:nil andBlock:^(NSArray *result, NSError *error) { - if (!error) { - _trackerList = result; - }else { - NSLog(@"get tracker list error : %@",error.description); - } - doneCount ++; - if (doneCount == 4) { - [self loadProjectDetail]; - doneCount = 0; - } - }]; + OZLSingleton* singleton = [OZLSingleton sharedInstance]; + if (singleton.userList != nil) { + _trackerList = singleton.trackerList; + _statusList = singleton.statusList; + _userList = singleton.userList; + _priorityList = singleton.priorityList; + _timeEntryActivityList = singleton.timeEntryActivityList; + [self loadProjectDetail]; + }else { + static int doneCount = 0; + const int totalCount = 5; + [OZLNetwork getTrackerListWithParams:nil andBlock:^(NSArray *result, NSError *error) { + if (!error) { + _trackerList = result; + singleton.trackerList = _trackerList; + }else { + NSLog(@"get tracker list error : %@",error.description); + } + doneCount ++; + if (doneCount == totalCount) { + [self loadProjectDetail]; + doneCount = 0; + } + }]; - [OZLNetwork getIssueStatusListWithParams:nil andBlock:^(NSArray *result, NSError *error) { - if (!error) { - _statusList = result; - }else { - NSLog(@"get issue status list error : %@",error.description); - } - doneCount ++; - if (doneCount == 4) { - [self loadProjectDetail]; - doneCount = 0; - } - }]; - [OZLNetwork getPriorityListWithParams:nil andBlock:^(NSArray *result, NSError *error) { - if (!error) { - _priorityList = result; - }else { - NSLog(@"get priority list error : %@",error.description); - } - doneCount ++; - if (doneCount == 4) { - [self loadProjectDetail]; - doneCount = 0; - } - }]; - [OZLNetwork getUserListWithParams:nil andBlock:^(NSArray *result, NSError *error) { - if (!error) { - _userList = result; - }else { - NSLog(@"get user list error : %@",error.description); - } - doneCount ++; - if (doneCount == 4) { - [self loadProjectDetail]; - doneCount = 0; - } - }]; + [OZLNetwork getIssueStatusListWithParams:nil andBlock:^(NSArray *result, NSError *error) { + if (!error) { + _statusList = result; + singleton.statusList = _statusList; + }else { + NSLog(@"get issue status list error : %@",error.description); + } + doneCount ++; + if (doneCount == totalCount) { + [self loadProjectDetail]; + doneCount = 0; + } + }]; + [OZLNetwork getPriorityListWithParams:nil andBlock:^(NSArray *result, NSError *error) { + if (!error) { + _priorityList = result; + singleton.priorityList = _priorityList; + }else { + NSLog(@"get priority list error : %@",error.description); + } + doneCount ++; + if (doneCount == totalCount) { + [self loadProjectDetail]; + doneCount = 0; + } + }]; + [OZLNetwork getUserListWithParams:nil andBlock:^(NSArray *result, NSError *error) { + if (!error) { + _userList = result; + singleton.userList = _userList; + }else { + NSLog(@"get user list error : %@",error.description); + } + doneCount ++; + if (doneCount == totalCount) { + [self loadProjectDetail]; + doneCount = 0; + } + }]; + + [OZLNetwork getTimeEntryListWithParams:nil andBlock:^(NSArray *result, NSError *error) { + if (!error) { + _timeEntryActivityList = result; + singleton.timeEntryActivityList = _timeEntryActivityList; + }else { + NSLog(@"get user list error : %@",error.description); + } + doneCount ++; + if (doneCount == totalCount) { + [self loadProjectDetail]; + doneCount = 0; + } + }]; + } } @@ -208,15 +236,6 @@ } -- (void) showProjectDetail -{ - //OZLProjectDetailViewController* detail = [[OZLProjectDetailViewController alloc] initWithNibName:@"OZLProjectDetailViewController" bundle:nil]; - UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"OZLProjectDetailViewController" bundle:nil]; - OZLProjectDetailViewController* detail = [storyboard instantiateViewControllerWithIdentifier:@"OZLProjectDetailViewController"]; - [detail setProjectData:_projectData]; - [self.navigationController pushViewController:detail animated:YES]; -} - - (void) preloadLeft { // OZLProjectListViewController *c = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil]; // [self.revealSideViewController preloadViewController:c @@ -293,44 +312,38 @@ return cell; } -/* - // Override to support conditional editing of the table view. - - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath - { - // Return NO if you do not want the specified item to be editable. - return YES; - } - */ -/* - // Override to support editing the table view. - - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath - { - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Delete the row from the data source - [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; - } - else if (editingStyle == UITableViewCellEditingStyleInsert) { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } - } - */ +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +{ + // Return NO if you do not want the specified item to be editable. + return YES; +} -/* - // Override to support rearranging the table view. - - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath - { - } - */ +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath +{ + if (editingStyle == UITableViewCellEditingStyleDelete) { -/* - // Override to support conditional rearranging of the table view. - - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath - { - // Return NO if you do not want the item to be re-orderable. - return YES; - } - */ + _HUD.labelText = @"Deleting Issue..."; + [_HUD show:YES]; + [OZLNetwork deleteIssue:[[_issuesList objectAtIndex:indexPath.row] index] withParams:nil andBlock:^(BOOL success, NSError *error) { + [_HUD hide:YES]; + if (error) { + NSLog(@"failed to delete issue"); + _HUD.mode = MBProgressHUDModeText; + _HUD.labelText = @"Sorry, something wrong while deleting issue."; + [_HUD show:YES]; + [_HUD hide:YES afterDelay:1]; + }else { + [_issuesList removeObjectAtIndex:indexPath.row]; + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } + }]; + } else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} #pragma mark - Table view delegate @@ -344,14 +357,11 @@ } - (IBAction)onNewIssue:(id)sender { - //OZLIssueCreateViewController* creator = [[OZLIssueCreateViewController alloc] initWithNibName:@"OZLIssueCreateViewController" bundle:nil]; - UIStoryboard *tableViewStoryboard = [UIStoryboard storyboardWithName:@"OZLIssueCreateViewController" bundle:nil]; - OZLIssueCreateViewController* creator = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"OZLIssueCreateViewController"]; + //OZLIssueCreateOrUpdateViewController* creator = [[OZLIssueCreateOrUpdateViewController alloc] initWithNibName:@"OZLIssueCreateOrUpdateViewController" bundle:nil]; + UIStoryboard *tableViewStoryboard = [UIStoryboard storyboardWithName:@"OZLIssueCreateOrUpdateViewController" bundle:nil]; + OZLIssueCreateOrUpdateViewController* creator = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"OZLIssueCreateOrUpdateViewController"]; [creator setParentProject:_projectData]; - creator.userList = _userList; - creator.trackerList = _trackerList; - creator.priorityList = _priorityList; - creator.statusList = _statusList; + [creator setViewMode:OZLIssueInfoViewModeCreate]; //[self.navigationController presentModalViewController:creator animated:YES]; [self.navigationController pushViewController:creator animated:YES]; } @@ -360,4 +370,25 @@ OZLIssueFilterViewController* filter = [[OZLIssueFilterViewController alloc] initWithStyle:UITableViewStyleGrouped]; [self.navigationController pushViewController:filter animated:YES]; } + +- (IBAction)onShowInfo:(id)sender { + UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"OZLProjectInfoViewController" bundle:nil]; + OZLProjectInfoViewController* detail = [storyboard instantiateViewControllerWithIdentifier:@"OZLProjectInfoViewController"]; + [detail setProjectData:_projectData]; + [detail setViewMode:OZLProjectInfoViewModeDisplay]; + [self.navigationController pushViewController:detail animated:YES]; +} + +-(void)editIssueList:(id)sender +{ + [_issuesTableview setEditing:YES animated:YES]; + self.navigationItem.rightBarButtonItem = _doneBtn; + +} + +-(void)editIssueListDone:(id)sender +{ + [_issuesTableview setEditing:NO animated:YES]; + self.navigationItem.rightBarButtonItem = _editBtn; +} @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.xib b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.xib index d31008a..e4a4abf 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.xib +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.xib @@ -80,6 +80,12 @@ 10 + + IBCocoaTouchFramework + 1 + + 11 + @@ -167,6 +173,14 @@ 14 + + + onShowInfo: + + + + 16 + @@ -202,6 +216,7 @@ + @@ -220,6 +235,11 @@ + + 15 + + + @@ -229,6 +249,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -237,7 +258,7 @@ - 14 + 16 0