From: Michael J. Rubinsky Date: Tue, 22 Sep 2009 18:49:41 +0000 (-0400) Subject: Better organization for source code tree X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9f879b37be65d9f41bfe5e64259a56ceedc96006;p=horde.git Better organization for source code tree --- diff --git a/ApertureToAnselExportPlugin/AnselGalleryViewItem.h b/ApertureToAnselExportPlugin/AnselGalleryViewItem.h deleted file mode 100644 index 41ba61d68..000000000 --- a/ApertureToAnselExportPlugin/AnselGalleryViewItem.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * AnselGalleryViewItem - * - * Copyright 2009 The Horde Project (http://www.horde.org) - * - * @implements IKImageBrowserItem - * @license http://opensource.org/licenses/bsd-license.php - * @author Michael J. Rubinsky - */ -#import -#import - -@interface AnselGalleryViewItem: NSObject -{ - NSURL *image; - NSString *imageID; - NSString *imageTitle; - NSCalendarDate *imageDate; -} - -@property(readwrite,copy) NSURL * image; -@property(readwrite,copy) NSString * imageID; - -- (id)initWithURL: (NSURL *)theUrl withTitle: (NSString *)theTitle withDate: (NSDate *)theDate; - -#pragma mark - -#pragma mark Required Methods IKImageBrowserItem Informal Protocol -- (NSString *)imageUID; -- (NSString *)imageRepresentationType; -- (id)imageRepresentation; - -- (NSString *)imageTitle; -- (NSString *)imageSubtitle; - -@end diff --git a/ApertureToAnselExportPlugin/AnselGalleryViewItem.m b/ApertureToAnselExportPlugin/AnselGalleryViewItem.m deleted file mode 100644 index a27b41b5c..000000000 --- a/ApertureToAnselExportPlugin/AnselGalleryViewItem.m +++ /dev/null @@ -1,69 +0,0 @@ -/** - * AnselGalleryViewItem.m - * - * Implements the IKImageBrowserItem protocol for displaying images from a - * remote Ansel gallery in an IKImageBrowser. - * - * Copyright 2009 The Horde Project (http://www.horde.org) - * - * @implements IKImageBrowserItem - * @license http://opensource.org/licenses/bsd-license.php - * @author Michael J. Rubinsky - */ -#import "AnselGalleryViewItem.h" - -@implementation AnselGalleryViewItem -@synthesize image; -@synthesize imageID; - -- (id)initWithURL: (NSURL *)theURL - withTitle: (NSString *)theTitle - withDate: (NSDate *)theDate -{ - [super init]; - image = [theURL retain]; - imageID = [[theURL absoluteString] retain]; - imageTitle = [theTitle retain]; - imageDate = [theDate retain]; - return self; -} -- (void)dealloc -{ - [image release]; - [imageID release]; - [imageTitle release]; - [imageDate release]; - [super dealloc]; -} - -#pragma mark -#pragma mark Required methods -- (NSString *)imageUID -{ - return imageID; -} - -- (NSString *)imageRepresentationType -{ - return IKImageBrowserNSURLRepresentationType; -} - -- (id)imageRepresentation -{ - return image; -} - -#pragma mark -#pragma mark Optional methods. -- (NSString *)imageTitle -{ - NSLog(@"imageTitle: %@", imageTitle); - return imageTitle; -} -- (NSString *)imageSubtitle -{ - NSLog(@"imageSubtitle: %@", [imageDate description]); - return [imageDate description]; -} - -@end diff --git a/ApertureToAnselExportPlugin/ApertureToAnselExportPlugin.xcodeproj/project.pbxproj b/ApertureToAnselExportPlugin/ApertureToAnselExportPlugin.xcodeproj/project.pbxproj index 2c7190e31..394ac7d40 100644 --- a/ApertureToAnselExportPlugin/ApertureToAnselExportPlugin.xcodeproj/project.pbxproj +++ b/ApertureToAnselExportPlugin/ApertureToAnselExportPlugin.xcodeproj/project.pbxproj @@ -9,14 +9,14 @@ /* Begin PBXBuildFile section */ 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; - B070DA551069387B00C0E3FC /* TURAnselConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = B070DA541069387B00C0E3FC /* TURAnselConstants.m */; }; - B0AE23391049F7770096565B /* TURAnselGalleryPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = B0AE23361049F7770096565B /* TURAnselGalleryPanelController.m */; }; - B0AE23411049F7A20096565B /* AnselGalleryPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = B0AE233D1049F7A20096565B /* AnselGalleryPanel.nib */; }; - B0D311D01049A7DE006B06C6 /* TURAnsel.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D311CB1049A7DE006B06C6 /* TURAnsel.m */; }; - B0D311D11049A7DE006B06C6 /* TURAnselGallery.m in Sources */ = {isa = PBXBuildFile; fileRef = B0D311CD1049A7DE006B06C6 /* TURAnselGallery.m */; }; + B070DB8A1069532500C0E3FC /* AnselGalleryViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = B070DB7E1069532500C0E3FC /* AnselGalleryViewItem.m */; }; + B070DB8B1069532500C0E3FC /* AnselGalleryPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = B070DB801069532500C0E3FC /* AnselGalleryPanel.nib */; }; + B070DB8C1069532500C0E3FC /* TURAnsel.m in Sources */ = {isa = PBXBuildFile; fileRef = B070DB821069532500C0E3FC /* TURAnsel.m */; }; + B070DB8D1069532500C0E3FC /* TURAnselConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = B070DB841069532500C0E3FC /* TURAnselConstants.m */; }; + B070DB8E1069532500C0E3FC /* TURAnselGallery.m in Sources */ = {isa = PBXBuildFile; fileRef = B070DB861069532500C0E3FC /* TURAnselGallery.m */; }; + B070DB8F1069532500C0E3FC /* TURAnselGalleryPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = B070DB881069532500C0E3FC /* TURAnselGalleryPanelController.m */; }; B0DD64D2106738DB00085661 /* NSStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B0DD64D1106738DB00085661 /* NSStringAdditions.m */; }; B0DD64E31067391E00085661 /* NSDataAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = B0DD64E21067391E00085661 /* NSDataAdditions.m */; }; - B0DEA058104D7012001D1509 /* AnselGalleryViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = B0DEA057104D7012001D1509 /* AnselGalleryViewItem.m */; }; B0DEA1CE104D7DE2001D1509 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0DEA1CD104D7DE2001D1509 /* Quartz.framework */; }; D118EA660AC08CCB006DD2FE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = D118EA640AC08CCB006DD2FE /* Localizable.strings */; }; D15DEA4A0ABF639500CBE3A5 /* PluginManager.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D15DEA490ABF639500CBE3A5 /* PluginManager.framework */; }; @@ -46,22 +46,22 @@ 287924B90DAEB2A20074992A /* ApertureSDKCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApertureSDKCommon.h; sourceTree = ""; }; 32DBCF630370AF2F00C91783 /* ApertureToAnselExportPlugin_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApertureToAnselExportPlugin_Prefix.pch; sourceTree = ""; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B070DA531069387B00C0E3FC /* TURAnselConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselConstants.h; sourceTree = ""; }; - B070DA541069387B00C0E3FC /* TURAnselConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnselConstants.m; sourceTree = ""; }; - B070DA5A1069391F00C0E3FC /* TURAnselKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselKit.h; sourceTree = ""; }; - B0AE23351049F7770096565B /* TURAnselGalleryPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselGalleryPanelController.h; sourceTree = ""; }; - B0AE23361049F7770096565B /* TURAnselGalleryPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnselGalleryPanelController.m; sourceTree = ""; }; - B0AE233E1049F7A20096565B /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/AnselGalleryPanel.nib; sourceTree = ""; }; - B0D311CA1049A7DE006B06C6 /* TURAnsel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnsel.h; sourceTree = ""; }; - B0D311CB1049A7DE006B06C6 /* TURAnsel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnsel.m; sourceTree = ""; }; - B0D311CC1049A7DE006B06C6 /* TURAnselGallery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselGallery.h; sourceTree = ""; }; - B0D311CD1049A7DE006B06C6 /* TURAnselGallery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnselGallery.m; sourceTree = ""; }; + B070DB7D1069532500C0E3FC /* AnselGalleryViewItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnselGalleryViewItem.h; sourceTree = ""; }; + B070DB7E1069532500C0E3FC /* AnselGalleryViewItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnselGalleryViewItem.m; sourceTree = ""; }; + B070DB801069532500C0E3FC /* AnselGalleryPanel.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = AnselGalleryPanel.nib; sourceTree = ""; }; + B070DB811069532500C0E3FC /* TURAnsel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnsel.h; sourceTree = ""; }; + B070DB821069532500C0E3FC /* TURAnsel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnsel.m; sourceTree = ""; }; + B070DB831069532500C0E3FC /* TURAnselConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselConstants.h; sourceTree = ""; }; + B070DB841069532500C0E3FC /* TURAnselConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnselConstants.m; sourceTree = ""; }; + B070DB851069532500C0E3FC /* TURAnselGallery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselGallery.h; sourceTree = ""; }; + B070DB861069532500C0E3FC /* TURAnselGallery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnselGallery.m; sourceTree = ""; }; + B070DB871069532500C0E3FC /* TURAnselGalleryPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselGalleryPanelController.h; sourceTree = ""; }; + B070DB881069532500C0E3FC /* TURAnselGalleryPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TURAnselGalleryPanelController.m; sourceTree = ""; }; + B070DB891069532500C0E3FC /* TURAnselKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TURAnselKit.h; sourceTree = ""; }; B0DD64D0106738DB00085661 /* NSStringAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSStringAdditions.h; sourceTree = ""; }; B0DD64D1106738DB00085661 /* NSStringAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSStringAdditions.m; sourceTree = ""; }; B0DD64E11067391E00085661 /* NSDataAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSDataAdditions.h; sourceTree = ""; }; B0DD64E21067391E00085661 /* NSDataAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSDataAdditions.m; sourceTree = ""; }; - B0DEA056104D7012001D1509 /* AnselGalleryViewItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnselGalleryViewItem.h; sourceTree = ""; }; - B0DEA057104D7012001D1509 /* AnselGalleryViewItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnselGalleryViewItem.m; sourceTree = ""; }; B0DEA1CD104D7DE2001D1509 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = /System/Library/Frameworks/Quartz.framework; sourceTree = ""; }; D118EA650AC08CCB006DD2FE /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; D118EB0F0AC08EAE006DD2FE /* ApertureToAnselExportPlugin.ApertureExport */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ApertureToAnselExportPlugin.ApertureExport; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -89,8 +89,8 @@ 089C166AFE841209C02AAC07 /* MyApertureExportPlugIn */ = { isa = PBXGroup; children = ( + B070DB7C1069532500C0E3FC /* TURAnselKit */, B00872201066B73A00BE0CCF /* Additions */, - B0D312931049B17F006B06C6 /* AnselToolkit */, 287924B60DAEB2A20074992A /* ApertureHeaders */, 08FB77AFFE84173DC02AAC07 /* Classes */, 32C88E010371C26100C91783 /* Other Sources */, @@ -113,7 +113,6 @@ 089C167CFE841241C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( - B0AE233D1049F7A20096565B /* AnselGalleryPanel.nib */, D15DEA500ABF641300CBE3A5 /* ApertureToAnselExportPlugin.nib */, 8D5B49B7048680CD000E48DA /* Info.plist */, D118EA640AC08CCB006DD2FE /* Localizable.strings */, @@ -180,22 +179,31 @@ name = Additions; sourceTree = ""; }; - B0D312931049B17F006B06C6 /* AnselToolkit */ = { + B070DB7C1069532500C0E3FC /* TURAnselKit */ = { isa = PBXGroup; children = ( - B0DEA056104D7012001D1509 /* AnselGalleryViewItem.h */, - B0DEA057104D7012001D1509 /* AnselGalleryViewItem.m */, - B0AE23351049F7770096565B /* TURAnselGalleryPanelController.h */, - B0AE23361049F7770096565B /* TURAnselGalleryPanelController.m */, - B0D311CB1049A7DE006B06C6 /* TURAnsel.m */, - B0D311CA1049A7DE006B06C6 /* TURAnsel.h */, - B0D311CC1049A7DE006B06C6 /* TURAnselGallery.h */, - B0D311CD1049A7DE006B06C6 /* TURAnselGallery.m */, - B070DA531069387B00C0E3FC /* TURAnselConstants.h */, - B070DA541069387B00C0E3FC /* TURAnselConstants.m */, - B070DA5A1069391F00C0E3FC /* TURAnselKit.h */, + B070DB7D1069532500C0E3FC /* AnselGalleryViewItem.h */, + B070DB7E1069532500C0E3FC /* AnselGalleryViewItem.m */, + B070DB7F1069532500C0E3FC /* English.lProj */, + B070DB811069532500C0E3FC /* TURAnsel.h */, + B070DB821069532500C0E3FC /* TURAnsel.m */, + B070DB831069532500C0E3FC /* TURAnselConstants.h */, + B070DB841069532500C0E3FC /* TURAnselConstants.m */, + B070DB851069532500C0E3FC /* TURAnselGallery.h */, + B070DB861069532500C0E3FC /* TURAnselGallery.m */, + B070DB871069532500C0E3FC /* TURAnselGalleryPanelController.h */, + B070DB881069532500C0E3FC /* TURAnselGalleryPanelController.m */, + B070DB891069532500C0E3FC /* TURAnselKit.h */, ); - name = AnselToolkit; + path = TURAnselKit; + sourceTree = ""; + }; + B070DB7F1069532500C0E3FC /* English.lProj */ = { + isa = PBXGroup; + children = ( + B070DB801069532500C0E3FC /* AnselGalleryPanel.nib */, + ); + path = English.lProj; sourceTree = ""; }; D118EB1C0AC08EE7006DD2FE /* Products */ = { @@ -254,7 +262,7 @@ 8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */, D15DEA520ABF641300CBE3A5 /* ApertureToAnselExportPlugin.nib in Resources */, D118EA660AC08CCB006DD2FE /* Localizable.strings in Resources */, - B0AE23411049F7A20096565B /* AnselGalleryPanel.nib in Resources */, + B070DB8B1069532500C0E3FC /* AnselGalleryPanel.nib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -266,13 +274,13 @@ buildActionMask = 2147483647; files = ( D15DEA4F0ABF63C600CBE3A5 /* ApertureToAnselExportPlugin.m in Sources */, - B0D311D01049A7DE006B06C6 /* TURAnsel.m in Sources */, - B0D311D11049A7DE006B06C6 /* TURAnselGallery.m in Sources */, - B0AE23391049F7770096565B /* TURAnselGalleryPanelController.m in Sources */, - B0DEA058104D7012001D1509 /* AnselGalleryViewItem.m in Sources */, B0DD64D2106738DB00085661 /* NSStringAdditions.m in Sources */, B0DD64E31067391E00085661 /* NSDataAdditions.m in Sources */, - B070DA551069387B00C0E3FC /* TURAnselConstants.m in Sources */, + B070DB8A1069532500C0E3FC /* AnselGalleryViewItem.m in Sources */, + B070DB8C1069532500C0E3FC /* TURAnsel.m in Sources */, + B070DB8D1069532500C0E3FC /* TURAnselConstants.m in Sources */, + B070DB8E1069532500C0E3FC /* TURAnselGallery.m in Sources */, + B070DB8F1069532500C0E3FC /* TURAnselGalleryPanelController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -287,14 +295,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - B0AE233D1049F7A20096565B /* AnselGalleryPanel.nib */ = { - isa = PBXVariantGroup; - children = ( - B0AE233E1049F7A20096565B /* English */, - ); - name = AnselGalleryPanel.nib; - sourceTree = ""; - }; D118EA640AC08CCB006DD2FE /* Localizable.strings */ = { isa = PBXVariantGroup; children = ( diff --git a/ApertureToAnselExportPlugin/English.lproj/AnselGalleryPanel.nib/designable.nib b/ApertureToAnselExportPlugin/English.lproj/AnselGalleryPanel.nib/designable.nib deleted file mode 100644 index aab13b850..000000000 --- a/ApertureToAnselExportPlugin/English.lproj/AnselGalleryPanel.nib/designable.nib +++ /dev/null @@ -1,744 +0,0 @@ - - - - 1050 - 9F33 - 672 - 949.34 - 352.00 - - YES - - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - YES - - TURAnselGalleryPanelController - - - FirstResponder - - - NSApplication - - - 19 - 2 - {{797, 724}, {267, 276}} - -536866816 - New Gallery - NSPanel - - {3.40282e+38, 3.40282e+38} - - - 256 - - YES - - - 268 - {{20, 219}, {227, 22}} - - YES - - -1804468671 - 272630784 - - - LucidaGrande - 1.300000e+01 - 1044 - - - YES - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 6 - System - textColor - - 3 - MAA - - - - - - - 268 - {{17, 240}, {88, 16}} - - YES - - 68288064 - 272630784 - Gallery Name - - LucidaGrande - 1.200000e+01 - 16 - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2OQA - - - - 6 - System - controlTextColor - - - - - - - 268 - {{17, 195}, {73, 16}} - - YES - - 68288064 - 272630784 - Gallery Slug - - - - - - - - - 268 - {{20, 174}, {227, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 268 - {{20, 103}, {227, 47}} - - YES - - -1805517311 - 272629760 - - - - YES - - - - - - - 268 - {{17, 150}, {124, 16}} - - YES - - 68288064 - 272630784 - Gallery Description - - - - - - - - - 268 - {{116, 12}, {68, 32}} - - YES - - 67239424 - 134217728 - Cancel - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{184, 12}, {69, 32}} - - YES - - 67239424 - 134217728 - Save - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{20, 56}, {230, 26}} - - YES - - 879885888 - 272630784 - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - YES - - - 1.200000e+01 - 1.000000e+01 - 1.000000e+03 - - 75628032 - 0 - - - - 3 - MC4zMzMzMzI5OQA - - - - - 338820672 - 1024 - - - YES - - 6 - System - controlBackgroundColor - - - - - 3 - YES - - - - 3.000000e+00 - 2.000000e+00 - - - 6 - System - gridColor - - 3 - MC41AA - - - 1.900000e+01 - tableViewAction: - -767524864 - - - - 1 - 15 - 0 - YES - - - - - - 268 - {{17, 79}, {88, 16}} - - YES - - 68288064 - 272630784 - Gallery Parent - - - - - - - - {267, 276} - - - {{0, 0}, {1920, 1178}} - {3.40282e+38, 3.40282e+38} - - - - - YES - - - newGallerySheet - - - - 43 - - - - doNewGallery: - - - - 48 - - - - galleryDescTextField - - - - 49 - - - - galleryNameTextField - - - - 50 - - - - gallerySlugTextField - - - - 51 - - - - cancelNewGallery: - - - - 53 - - - - - YES - - 0 - - YES - - - - - - -2 - - - RmlsZSdzIE93bmVyA - - - -1 - - - First Responder - - - -3 - - - Application - - - 1 - - - YES - - - - - - 2 - - - YES - - - - - - - - - - - - - - - 3 - - - YES - - - - - - 4 - - - - - 5 - - - YES - - - - - - 6 - - - - - 7 - - - YES - - - - - - 8 - - - - - 9 - - - YES - - - - - - 10 - - - - - 11 - - - YES - - - - - - 12 - - - - - 13 - - - YES - - - - - - 14 - - - - - 15 - - - YES - - - - - - 16 - - - - - 17 - - - YES - - - - - - 18 - - - - - 19 - - - YES - - - - - - 20 - - - - - 21 - - - YES - - - - - - 22 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 1.IBWindowTemplateEditedContentRect - 1.NSWindowTemplate.visibleAtLaunch - 1.WindowOrigin - 1.editorWindowContentRectSynchronizationRect - 10.IBPluginDependency - 11.IBPluginDependency - 12.IBPluginDependency - 13.IBPluginDependency - 14.IBPluginDependency - 15.IBPluginDependency - 16.IBPluginDependency - 17.IBPluginDependency - 18.IBPluginDependency - 19.IBPluginDependency - 2.IBPluginDependency - 20.IBPluginDependency - 21.IBPluginDependency - 22.IBPluginDependency - 3.IBPluginDependency - 4.IBPluginDependency - 5.IBPluginDependency - 6.IBPluginDependency - 7.IBPluginDependency - 8.IBPluginDependency - 9.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{177, 722}, {267, 276}} - com.apple.InterfaceBuilder.CocoaPlugin - {{177, 722}, {267, 276}} - - {196, 240} - {{357, 418}, {480, 270}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - YES - - - YES - - - - - YES - - YES - - - YES - - - - 53 - - - - YES - - NSObject - - IBProjectSource - TURAnsel.h - - - - NSObject - - IBProjectSource - TURAnselGallery.h - - - - NSObject - - IBProjectSource - TURAnselGalleryPanelController.h - - - - NSObject - - IBProjectSource - xmlrpc-1.5.1/XMLRPCConnection.h - - - - TURAnselGalleryPanelController - NSObject - - YES - - YES - cancelNewGallery: - doNewGallery: - - - YES - id - id - - - - YES - - YES - delegate - galleryDescTextField - galleryNameTextField - gallerySlugTextField - newGallerySheet - - - YES - id - NSTextField - NSTextField - NSTextField - NSPanel - - - - - - - 0 - ../iPhoto2Ansel.xcodeproj - 3 - - diff --git a/ApertureToAnselExportPlugin/English.lproj/AnselGalleryPanel.nib/keyedobjects.nib b/ApertureToAnselExportPlugin/English.lproj/AnselGalleryPanel.nib/keyedobjects.nib deleted file mode 100644 index b318b79b4..000000000 Binary files a/ApertureToAnselExportPlugin/English.lproj/AnselGalleryPanel.nib/keyedobjects.nib and /dev/null differ diff --git a/ApertureToAnselExportPlugin/TURAnsel.h b/ApertureToAnselExportPlugin/TURAnsel.h deleted file mode 100644 index b1997fa43..000000000 --- a/ApertureToAnselExportPlugin/TURAnsel.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * TURAnsel - * - * Copyright 2009 The Horde Project (http://www.horde.org) - * - * @license http://opensource.org/licenses/bsd-license.php - * @author Michael J. Rubinsky - */ -#import -@class TURAnselGallery; - -typedef enum { - PERMS_SHOW = 2, - PERMS_READ = 4, - PERMS_EDIT = 8, - PERMS_DELETE = 16 -} HORDE_PERMS; - -typedef enum { - TURAnselStateDisconnected = 0, - TURAnselStateConnected, - TURAnselStateError, - TURAnselStateCancelled, - TURAnselStateWaiting -} TURAnselState; - -@interface NSObject (TURAnselDelegate) -- (void)TURAnselDidInitialize; -- (void)TURAnselHadError: (NSError *)error; -@end - -@interface TURAnsel : NSObject { - NSString *userAgent; - NSString *rpcEndPoint; - NSString *username; - NSString *password; - NSMutableArray *galleryList; - TURAnselState state; - id delegate; - NSLock *lock; -} - -@property (readwrite, retain) NSString *rpcEndPoint; -@property (readwrite, retain) NSString *username; -@property (readwrite, retain) NSString *password; - -- (id)initWithConnectionParameters: (NSDictionary *)params; -- (void)connect; -- (TURAnselGallery *)getGalleryById: (NSString *)galleryId; -- (TURAnselGallery *)getGalleryByIndex: (NSInteger)index; -- (NSDictionary *)callRPCMethod: (NSString *)methodName withParams: (NSArray *)params withOrder: (NSArray *)order; -- (NSDictionary *)createNewGallery: (NSDictionary *)params; -- (void)cancel; - -// Getters/setters -- (void) setState: (TURAnselState)state; -- (TURAnselState)state; -- (id)delegate; -- (void)setDelegate: (id)newDelegate; -@end diff --git a/ApertureToAnselExportPlugin/TURAnsel.m b/ApertureToAnselExportPlugin/TURAnsel.m deleted file mode 100644 index 56ad2f77d..000000000 --- a/ApertureToAnselExportPlugin/TURAnsel.m +++ /dev/null @@ -1,315 +0,0 @@ -/** - * TURAnsel.m - * - * Main class for interacting with a remote Ansel server. - * - * Copyright 2009 The Horde Project (http://www.horde.org) - * - * @license http://opensource.org/licenses/bsd-license.php - * @author Michael J. Rubinsky - */ -#import -#import "TURAnselKit.h" - -@interface TURAnsel (PrivateAPI) -- (void)doLogin; -@end - -@implementation TURAnsel - -@synthesize rpcEndPoint; -@synthesize username; -@synthesize password; - -#pragma mark - -#pragma mark init/dealloc -- (id)initWithConnectionParameters: (NSDictionary *)params -{ - [super init]; - galleryList = [[NSMutableArray alloc] init]; - - // Initialize the connection properties, KVC style - [self setValue:[params objectForKey:@"endpoint"] - forKey: @"rpcEndPoint"]; - [self setValue: [params objectForKey:@"username"] - forKey: @"username"]; - [self setValue: [params objectForKey:@"password"] - forKey: @"password"]; - [self setValue: @"The Ansel Cocoa XML-RPC Client" - forKey: @"userAgent"]; - - return self; -} --(void) dealloc -{ - NSLog(@"TURAnsel dealloc"); - [galleryList removeAllObjects]; - [galleryList release]; - [rpcEndPoint release]; - [username release]; - [password release]; - [userAgent release]; - [super dealloc]; -} - -#pragma mark - -#pragma mark Actions -- (void)connect -{ - [self doLogin]; -} -- (void) cancel -{ - state = TURAnselStateCancelled; -} - -/** - * Create a new gallery on the Ansel server. - * - * @param NSDictionary params A dictionary of parameters for the new gallery. - * - * @return NSDictionary A dictionary describing the new gallery - */ -- (NSDictionary *)createNewGallery: (NSDictionary *)params -{ - NSArray *apiparams = [NSArray arrayWithObjects: @"ansel", params, nil]; - NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamGaleryParams, nil]; - - NSDictionary *response = [self callRPCMethod: @"images.createGallery" - withParams: apiparams - withOrder: order]; - - if (response) { - NSNumber *gallery_id = [response objectForKey: (NSString *)kWSMethodInvocationResult]; - NSDictionary *results = [NSDictionary dictionaryWithObjectsAndKeys: - gallery_id, kTURAnselGalleryKeyId, - [params valueForKey: @"name"], kTURAnselGalleryKeyName, - @"", kTURAnselGalleryKeyDescription, - [NSNumber numberWithInt: 0], kTURAnselGalleryKeyImages, - [NSNumber numberWithInt: 0], kTURAnselGalleryKeyDefaultImage, nil]; - - TURAnselGallery *newGallery = [[TURAnselGallery alloc] initWithObject: results - controller: self]; - [galleryList addObject: newGallery]; - [newGallery release]; - - return results; - } - - return nil; -} - - -/** - * Entry point for calling RPC methods on the Horde server. - * - * @param NSString methodName The method to call (e.g. images.listGalleries) - * @param NSArray params All the method's parameters - * @param NSArray order Keys for the params array, needed because of how - * WSMethodInvocationSetParameters is used. (The keys are - * disregarded by Horde, but needed to ensure they get - * sent in the correct order by WS. - * - * The invocationCallback function is called on completion, which in turn will - * call the methodCompletionCallback with the results - */ -- (NSDictionary *)callRPCMethod: (NSString *)methodName - withParams: (NSArray *) params - withOrder: (NSArray *) order -{ - NSLog(@"Initiating connection for %@", methodName); - - // Get a URL object - NSURL *url = [NSURL URLWithString: [self valueForKey: @"rpcEndPoint"]]; - NSDictionary *values = [NSDictionary dictionaryWithObjects: params forKeys:order]; - - // Credentials - NSString *user = [self valueForKey:@"username"]; - NSString *pass = [self valueForKey:@"password"]; - - if (user != nil && [user length] && pass != nil && [pass length]) { - // Create a custom http request with authorization - CFHTTPMessageRef request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, - (CFStringRef)@"POST", - (CFURLRef)url, - kCFHTTPVersion1_1); - // Add auth creds to request. - Boolean success = CFHTTPMessageAddAuthentication(request, - NULL, - (CFStringRef)user, - (CFStringRef)pass, - kCFHTTPAuthenticationSchemeBasic, - false); - - NSLog(@"Results adding credentials to request: %d", success); - if (!success) { - NSLog(@"Unable to authenticate"); - - if ([[self delegate] respondsToSelector: @selector(TURAnselHadError:)]) { - NSError *error = [NSError errorWithDomain:@"TURAnsel" - code: 1 - userInfo:[NSDictionary dictionaryWithObjectsAndKeys: @"Authentication failure.", @"message", nil]]; - - [[self delegate] TURAnselHadError: error]; - } - - return nil; - - } else { - // Build a new invocation - [self setState:TURAnselStateWaiting]; - WSMethodInvocationRef rpcCall; - rpcCall = WSMethodInvocationCreate((CFURLRef)url, (CFStringRef)methodName, kWSXMLRPCProtocol); - WSMethodInvocationSetParameters(rpcCall, (CFDictionaryRef)values, (CFArrayRef)order); - WSMethodInvocationSetProperty(rpcCall, kWSHTTPMessage, request); - NSDictionary *result = (NSDictionary *)WSMethodInvocationInvoke(rpcCall); - CFRelease(request); - // Check out the results - if (WSMethodResultIsFault((CFDictionaryRef) result)) { - - NSError *error; - - CFHTTPMessageRef response = (CFHTTPMessageRef)[result objectForKey:(id)kWSHTTPResponseMessage]; - int resStatusCode = CFHTTPMessageGetResponseStatusCode(response); - NSString *resStatusLine = (NSString *)CFHTTPMessageCopyResponseStatusLine(response); - if (resStatusCode == 401) { - error = [NSError errorWithDomain: @"TURAnsel" - code: resStatusCode - userInfo: [NSDictionary dictionaryWithObjectsAndKeys: resStatusLine, @"NSLocalizedDescriptionKey", nil]]; - } else { - NSNumber *faultCode = [result objectForKey: (NSString *)kWSFaultCode]; - NSString *faultString = [result objectForKey: (NSString *)kWSFaultString]; - NSLog(@"faultCode: %@ faultString: %@", faultCode, faultString); - error = [NSError errorWithDomain: @"TURAnsel" - code: [faultCode intValue] - userInfo: [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat: @"%@, %@", resStatusLine, faultString], @"NSLocalizedDescriptionKey", nil]]; - - - } - if ([[self delegate] respondsToSelector: @selector(TURAnselHadError:)]) { - [[self delegate] TURAnselHadError: error]; - } - [resStatusLine release]; - [result autorelease]; - return nil; - } - - CFHTTPMessageRef response = (CFHTTPMessageRef)[result objectForKey:(id)kWSHTTPResponseMessage]; - int resStatusCode = CFHTTPMessageGetResponseStatusCode(response); - NSLog(@"ResponseCode: %d", resStatusCode); - [self setState:TURAnselStateConnected]; - return [result autorelease]; - } - } - - NSLog(@"No authentication information present."); - return nil; - -} - -#pragma mark - -#pragma mark Setters/Getters -// Fetch a gallery by id -- (TURAnselGallery *)getGalleryById: (NSString *)galleryId -{ - for (TURAnselGallery *g in galleryList) { - if ([galleryId isEqualTo: [NSNumber numberWithInt: [g galleryId]]]) { - return g; - } - } - - return nil; -} - -/** - * Return the gallery at the specified position in the internal storage array. - * Needed for when we are using this class as a datasource for a UI element. - */ -- (TURAnselGallery *)getGalleryByIndex: (NSInteger)index -{ - TURAnselGallery *g = [galleryList objectAtIndex:index]; - return g; -} - -#pragma mark -- -#pragma mark ComboBox Datasource -- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox -{ - return [galleryList count]; -} - -- (id)comboBox:(NSComboBox *)aComboBox - objectValueForItemAtIndex:(NSInteger)index -{ - TURAnselGallery *g = [galleryList objectAtIndex:index]; - NSString *stringValue = [g valueForKey:@"galleryName"]; - return stringValue; -} - -#pragma mark Getter/Setters -- (TURAnselState) state -{ - return state; -} --(void) setState: (TURAnselState)newstate -{ - state = newstate; -} - -- (id)delegate { - return delegate; -} - -- (void)setDelegate:(id)newDelegate { - delegate = newDelegate; -} - -#pragma mark PrivateAPI -/** - * Perform initial contact with Ansel server. Retrieves the list of galleries - * available for the selected server. - * - * @return void - */ -- (void)doLogin -{ - NSArray *params = [[NSArray alloc] initWithObjects: - @"ansel", // Scope - [NSNumber numberWithInt: PERMS_EDIT], // Perms - @"", // No parent - [NSNumber numberWithBool:YES], // allLevels - [NSNumber numberWithInt: 0], // Offset - [NSNumber numberWithInt: 0], // Count - [self valueForKey:@"username"], nil]; // Restrict to user (This should be an option eventually). - - NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamPerms, - kTURAnselAPIParamParent, kTURAnselAPIParamAllLevels, - kTURAnselAPIParamOffset, kTURAnselAPIParamCount, - kTURAnselAPIParamUserOnly, nil]; - - NSDictionary *results = [self callRPCMethod: @"images.listGalleries" - withParams: params - withOrder: order]; - - if (results) { - NSDictionary *galleries = [results objectForKey: (id)kWSMethodInvocationResult]; - for (NSString *gal in galleries) { - TURAnselGallery *theGallery = [[TURAnselGallery alloc] initWithObject: gal - controller: self]; - [theGallery setAnselController: self]; - [galleryList addObject: theGallery]; - [theGallery release]; - theGallery = nil; - } - - if ([delegate respondsToSelector:@selector(TURAnselDidInitialize)]) { - [delegate performSelectorOnMainThread:@selector(TURAnselDidInitialize) - withObject:self - waitUntilDone: NO]; - } - - } - - [params release]; -} -@end \ No newline at end of file diff --git a/ApertureToAnselExportPlugin/TURAnselConstants.h b/ApertureToAnselExportPlugin/TURAnselConstants.h deleted file mode 100644 index ef64dc77a..000000000 --- a/ApertureToAnselExportPlugin/TURAnselConstants.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * TURAnselConstants - * - * Copyright 2009 The Horde Project (http://www.horde.org) - * - * @license http://opensource.org/licenses/bsd-license.php - * @author Michael J. Rubinsky - */ - -// Constants for the API parameter names. -extern NSString * const kTURAnselAPIParamScope; -extern NSString * const kTURAnselAPIParamGaleryParams; -extern NSString * const kTURAnselAPIParamPerms; -extern NSString * const kTURAnselAPIParamParent; -extern NSString * const kTURAnselAPIParamAllLevels; -extern NSString * const kTURAnselAPIParamOffset; -extern NSString * const kTURAnselAPIParamCount; -extern NSString * const kTURAnselAPIParamUserOnly; -extern NSString * const kTURAnselAPIParamImageId; -extern NSString * const kTURAnselAPIParamGalleryId; -extern NSString * const kTURAnselAPIParamThumbnailStyle; -extern NSString * const kTURAnselAPIParamFullPath; -extern NSString * const kTURAnselAPIParamImageData; -extern NSString * const kTURAnselAPIParamSetAsDefault; -extern NSString * const kTURAnselAPIParamAdditionalData; -extern NSString * const kTURAnselAPIParamEncoding; - -// Constants for the dictionary keys used to describe/create TURAnselGallery -extern NSString * const kTURAnselGalleryKeyId; -extern NSString * const kTURAnselGalleryKeyName; -extern NSString * const kTURAnselGalleryKeyDescription; -extern NSString * const kTURAnselGalleryKeyImages; -extern NSString * const kTURAnselGalleryKeyDefaultImage; diff --git a/ApertureToAnselExportPlugin/TURAnselConstants.m b/ApertureToAnselExportPlugin/TURAnselConstants.m deleted file mode 100644 index 74472bb5f..000000000 --- a/ApertureToAnselExportPlugin/TURAnselConstants.m +++ /dev/null @@ -1,34 +0,0 @@ -// -// TURAnselConstants.m -// ApertureToAnselExportPlugin -// -// Created by Michael Rubinsky on 9/22/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import "TURAnselConstants.h" - -// Constants for the API parameter names. -NSString * const kTURAnselAPIParamScope = @"scope"; -NSString * const kTURAnselAPIParamGaleryParams = @"galleryParams"; -NSString * const kTURAnselAPIParamPerms = @"perms"; -NSString * const kTURAnselAPIParamParent = @"parent"; -NSString * const kTURAnselAPIParamAllLevels = @"allLevels"; -NSString * const kTURAnselAPIParamOffset = @"offset"; -NSString * const kTURAnselAPIParamCount = @"count"; -NSString * const kTURAnselAPIParamUserOnly = @"userOnly"; -NSString * const kTURAnselAPIParamImageId = @"imageId"; -NSString * const kTURAnselAPIParamGalleryId = @"galleryId"; -NSString * const kTURAnselAPIParamThumbnailStyle = @"thumbnailStyle"; -NSString * const kTURAnselAPIParamFullPath = @"fullPath"; -NSString * const kTURAnselAPIParamImageData = @"imageData"; -NSString * const kTURAnselAPIParamSetAsDefault = @"default"; -NSString * const kTURAnselAPIParamAdditionalData = @"additionalData"; -NSString * const kTURAnselAPIParamEncoding = @"encoding"; - -// Ansel gallery attribtues. -NSString * const kTURAnselGalleryKeyId = @"share_id"; -NSString * const kTURAnselGalleryKeyName = @"attribute_name"; -NSString * const kTURAnselGalleryKeyDescription = @"attribute_desc"; -NSString * const kTURAnselGalleryKeyImages = @"attribute_images"; -NSString * const kTURAnselGalleryKeyDefaultImage = @"attribute_default"; \ No newline at end of file diff --git a/ApertureToAnselExportPlugin/TURAnselGallery.h b/ApertureToAnselExportPlugin/TURAnselGallery.h deleted file mode 100644 index 5eff4e79b..000000000 --- a/ApertureToAnselExportPlugin/TURAnselGallery.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * TURAnselGallery - * - * Copyright 2009 The Horde Project (http://www.horde.org) - * - * @license http://opensource.org/licenses/bsd-license.php - * @author Michael J. Rubinsky - */ -#import -@class TURAnsel, NSURL; - -@interface NSObject (TURAnselGalleryDelegate) -- (void)TURAnselGalleryDidUploadImage: (id *)gallery; -@end - -@interface TURAnselGallery : NSObject { - int _galleryId; - int galleryImageCount; - int galleryKeyImage; - NSURL *galleryKeyImageURL; - NSMutableArray *imageList; - NSString *galleryName; - NSString *galleryDescription; - TURAnsel *anselController; - id delegate; -} -@property (readonly) NSString *galleryName; -@property (readonly) NSString *galleryDescription; -@property (readonly) int galleryImageCount; -@property (readwrite) int galleryKeyImage; - -- (id)initWithObject:(id)galleryData controller:(TURAnsel * )controller; -- (void)uploadImageObject: (NSDictionary *)imageParameters; - -// Getter / Setter -- (void)setDelegate: (id)newDelegate; -- (id)delegate; -- (NSURL *)galleryKeyImageURL; -- (id)listImages; -- (int)galleryId; -- (void)setAnselController:(TURAnsel *)newController; -@end \ No newline at end of file diff --git a/ApertureToAnselExportPlugin/TURAnselGallery.m b/ApertureToAnselExportPlugin/TURAnselGallery.m deleted file mode 100644 index 9397b107d..000000000 --- a/ApertureToAnselExportPlugin/TURAnselGallery.m +++ /dev/null @@ -1,216 +0,0 @@ -/** - * TURAnselGallery.m - * - * Copyright 2009 The Horde Project (http://www.horde.org) - * - * @license http://opensource.org/licenses/bsd-license.php - * @author Michael J. Rubinsky - */ -#import -#import "TURAnselKit.h" - -@interface TURAnselGallery (PrivateAPI) -- (void)doUpload: (NSDictionary *)imageParams; -@end - -@implementation TURAnselGallery - -@synthesize galleryDescription; -@synthesize galleryName; -@synthesize galleryImageCount; -@synthesize galleryKeyImage; - -#pragma mark - -#pragma mark init/dealloc -/** - * Init a gallery object - */ -- (id)initWithObject:(id)galleryData controller:(TURAnsel *)controller -{ - [super init]; - [self setValue: [galleryData valueForKey: kTURAnselGalleryKeyId] - forKey: @"galleryId"]; - [self setValue:[galleryData valueForKey: kTURAnselGalleryKeyDescription] - forKey:@"galleryDescription"]; - [self setValue:[galleryData valueForKey: kTURAnselGalleryKeyName] - forKey:@"galleryName"]; - [self setValue: [galleryData valueForKey: kTURAnselGalleryKeyImages] - forKey:@"galleryImageCount"]; - [self setValue: [galleryData valueForKey: kTURAnselGalleryKeyDefaultImage] - forKey:@"galleryKeyImage"]; - [self setAnselController: controller]; - return self; -} -- (void)dealloc -{ - NSLog(@"TURAnselGallery dealloc called on Gallery %@", self); - [anselController release]; - anselController = nil; - - [galleryKeyImageURL release]; - galleryKeyImageURL = nil; - - [imageList release]; - imageList = nil; - - [super dealloc]; -} -- (id)description -{ - NSString *text = [NSString stringWithFormat:@"Description: %@ Id: %d has: %d images", galleryName, _galleryId, galleryImageCount]; - return text; -} - -#pragma mark - -#pragma mark Actions -/** - * Requests the gallery's key image url to be fetched from the server - * (This information is not present in the gallery definition array returned - * from the images.listGalleries call). - */ -- (NSURL *)galleryKeyImageURL -{ - if (galleryKeyImageURL) { - return galleryKeyImageURL; - } else { - NSArray *params = [[NSArray alloc] initWithObjects: - @"ansel", // Scope - [NSNumber numberWithInt: galleryKeyImage], // Image Id - @"thumb", // Thumbnail type - [NSNumber numberWithBool:YES], // Full path - nil]; - - NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, - kTURAnselAPIParamImageId, - kTURAnselAPIParamThumbnailStyle, - kTURAnselAPIParamFullPath, nil]; - - NSDictionary *response = [anselController callRPCMethod: @"images.getImageUrl" - withParams: params - withOrder: order]; - - if (response) { - NSDictionary *url = [response objectForKey:(id)kWSMethodInvocationResult]; - [galleryKeyImageURL autorelease]; - galleryKeyImageURL = [[NSURL URLWithString: [NSString stringWithFormat: @"%@", url]] retain]; - NSLog(@"galleryKeyImageURL: %@", galleryKeyImageURL); - return galleryKeyImageURL; - } - - return nil; - } -} - -/** - * Get the complete list of image ids and URLs - */ -- (id)listImages -{ - if (!imageList) { - - NSArray *params = [[NSArray alloc] initWithObjects: - @"ansel", //Scope - [NSNumber numberWithInt: _galleryId], //Gallery Id - [NSNumber numberWithInt: 2], //PERMS_SHOW - @"thumb", // Thumbnail - [NSNumber numberWithBool:YES], // Full path - nil]; - NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, - kTURAnselAPIParamGalleryId, - kTURAnselAPIParamPerms, - kTURAnselAPIParamThumbnailStyle, - kTURAnselAPIParamFullPath, nil]; - - NSDictionary *response = [anselController callRPCMethod: @"images.listImages" - withParams: params - withOrder: order]; - if (response) { - [imageList autorelease]; - imageList = [[response objectForKey: (id)kWSMethodInvocationResult] retain]; - - NSLog(@"listImages: %@", imageList); - - return imageList; - } - } - - return nil; -} - -/** - * Upload the provided image to this gallery. - */ -- (void)uploadImageObject: (NSDictionary *)imageParameters -{ - [self doUpload: imageParameters]; -} - -#pragma mark - -#pragma mark Getter/Setter -- (int)galleryId -{ - return _galleryId; -} - -- (void)setGalleryId:(int)id -{ - _galleryId = id; -} - -- (id)delegate -{ - return delegate; -} - -- (void)setDelegate: (id)newDelegate -{ - delegate = newDelegate; -} - -- (void)setAnselController: (TURAnsel *)newController -{ - [anselController autorelease]; - anselController = [newController retain]; -} - -- (TURAnsel *)anselController -{ - return anselController; -} - -#pragma mark - -#pragma mark PrivateAPI -- (void)doUpload:(NSDictionary *)imageParameters -{ - // Need to build the params array now. - NSArray *params = [[NSArray alloc] initWithObjects: - @"ansel", // app - [NSNumber numberWithInt: _galleryId], // gallery_id - [imageParameters valueForKey: @"data"], // image data array - [imageParameters valueForKey: @"default"], // set as default? - @"", // Additional gallery data to set? - @"base64", // Image data encoding - nil]; - NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, - kTURAnselAPIParamGalleryId, - kTURAnselAPIParamImageData, - kTURAnselAPIParamSetAsDefault, - kTURAnselAPIParamAdditionalData, - kTURAnselAPIParamEncoding, nil]; - - // Send the request up to the controller - NSDictionary *result = [anselController callRPCMethod: @"images.saveImage" - withParams: params - withOrder: order]; - - if (result) { - if ([delegate respondsToSelector:@selector(TURAnselGalleryDidUploadImage:)]) { - [delegate performSelectorOnMainThread: @selector(TURAnselGalleryDidUploadImage:) - withObject: self - waitUntilDone: NO]; - } - } - - [params release]; -} -@end diff --git a/ApertureToAnselExportPlugin/TURAnselGalleryPanelController.h b/ApertureToAnselExportPlugin/TURAnselGalleryPanelController.h deleted file mode 100644 index b0a8f2e66..000000000 --- a/ApertureToAnselExportPlugin/TURAnselGalleryPanelController.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * TURAnselGalleryPanelController - * - * Copyright 2009 The Horde Project (http://www.horde.org) - * - * @license http://opensource.org/licenses/bsd-license.php - * @author Michael J. Rubinsky - */ -#import -#import "TURAnselKit.h" - -@interface NSObject (TURAnselGalleryPaneControllerDelegate) --(void)TURAnselGalleryPanelDidAddGallery; -@end - -@interface TURAnselGalleryPanelController : NSObject { - // Outlets - IBOutlet NSTextField *galleryNameTextField; - IBOutlet NSTextField *gallerySlugTextField; - IBOutlet NSTextField *galleryDescTextField; - IBOutlet NSPanel *newGallerySheet; - - // Instance members - TURAnsel *_anselController; - NSWindow *_controllerWindow; - id _delegate; -} - -// Actions -- (IBAction)doNewGallery: (id)sender; -- (IBAction)cancelNewGallery: (id)sender; -- (id)initWithController: (TURAnsel *)theController; -- (id)initWithController: (TURAnsel *)theController withGalleryName: (NSString *)galleryName; -- (void)showSheetForWindow: (NSWindow *)theWindow; -- (void)setDelegate: (id)theDelegate; -@end diff --git a/ApertureToAnselExportPlugin/TURAnselGalleryPanelController.m b/ApertureToAnselExportPlugin/TURAnselGalleryPanelController.m deleted file mode 100644 index 09aa6c5ae..000000000 --- a/ApertureToAnselExportPlugin/TURAnselGalleryPanelController.m +++ /dev/null @@ -1,120 +0,0 @@ -/** - * TURAnselGalleryPanelController.m - * - * Controller for handling the form that creates new remote Ansel galleries. - * - * Copyright 2009 The Horde Project (http://www.horde.org) - * - * @license http://opensource.org/licenses/bsd-license.php - * @author Michael J. Rubinsky - */ -#import "TURAnselGalleryPanelController.h" - -@implementation TURAnselGalleryPanelController - -#pragma mark - -#pragma mark init/dealloc --(id)initWithController: (TURAnsel *)theController -{ - [super init]; - _anselController = [theController retain]; - [NSBundle loadNibNamed: @"AnselGalleryPanel" - owner: self]; - - return self; -} -- (id)initWithController: (TURAnsel *)theController - withGalleryName: (NSString *)galleryName -{ - - [super init]; - _anselController = [theController retain]; - [NSBundle loadNibNamed: @"AnselGalleryPanel" - owner: self]; - - [galleryNameTextField setStringValue: galleryName]; - - return self; -} -- (void)dealloc -{ - [_anselController release]; - [_controllerWindow release]; - [super dealloc]; -} - -#pragma mark - -#pragma mark IBActions -- (IBAction)cancelNewGallery: (id)sender -{ - [NSApp endSheet: newGallerySheet]; - [newGallerySheet orderOut: nil]; -} - -- (IBAction)doNewGallery: (id)sender -{ - // Get Gallery Properties from the panel. - NSString *galleryName = [galleryNameTextField stringValue]; - NSString *gallerySlug = [gallerySlugTextField stringValue]; - NSString *galleryDescription = [galleryDescTextField stringValue]; - - if (!galleryName) { - - [NSApp endSheet: newGallerySheet]; - [newGallerySheet orderOut: nil]; - - NSAlert *alert = [[NSAlert alloc] init]; - [alert setMessageText:@"Gallery names cannot be empty"]; - [alert setAlertStyle: NSCriticalAlertStyle]; - [alert beginSheetModalForWindow: _controllerWindow - modalDelegate: nil - didEndSelector: nil - contextInfo: nil]; - [alert release]; - return; - } - NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: - galleryName, @"name", - gallerySlug, @"slug", - galleryDescription, @"desc", nil]; - - NSDictionary *results = [[_anselController createNewGallery: params] retain]; - - [NSApp endSheet: newGallerySheet]; - [newGallerySheet orderOut: nil]; - - if ([_anselController state] != TURAnselStateError) { - NSAlert *alert = [[NSAlert alloc] init]; - [alert setMessageText: @"Gallery successfully created."]; - [alert beginSheetModalForWindow: _controllerWindow - modalDelegate: nil - didEndSelector: nil - contextInfo: nil]; - [alert release]; - if ([_delegate respondsToSelector:@selector(TURAnselGalleryPanelDidAddGallery)]) { - [_delegate TURAnselGalleryPanelDidAddGallery]; - } - } - - [results release]; -} - - -- (void)setDelegate: (id)theDelegate -{ - _delegate = theDelegate; // weak -} - - -- (void)showSheetForWindow: (NSWindow *)theWindow -{ - [_controllerWindow release]; - _controllerWindow = [theWindow retain]; - [NSApp beginSheet: newGallerySheet - modalForWindow: theWindow - modalDelegate: nil - didEndSelector: nil - contextInfo: nil]; -} - -@end diff --git a/ApertureToAnselExportPlugin/TURAnselKit.h b/ApertureToAnselExportPlugin/TURAnselKit.h deleted file mode 100644 index 7a4277a8a..000000000 --- a/ApertureToAnselExportPlugin/TURAnselKit.h +++ /dev/null @@ -1,4 +0,0 @@ -#import "TURAnselConstants.h" -#import "TURAnsel.h" -#import "TURAnselGallery.h" - diff --git a/ApertureToAnselExportPlugin/TURAnselKit/AnselGalleryViewItem.h b/ApertureToAnselExportPlugin/TURAnselKit/AnselGalleryViewItem.h new file mode 100644 index 000000000..41ba61d68 --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/AnselGalleryViewItem.h @@ -0,0 +1,35 @@ +/** + * AnselGalleryViewItem + * + * Copyright 2009 The Horde Project (http://www.horde.org) + * + * @implements IKImageBrowserItem + * @license http://opensource.org/licenses/bsd-license.php + * @author Michael J. Rubinsky + */ +#import +#import + +@interface AnselGalleryViewItem: NSObject +{ + NSURL *image; + NSString *imageID; + NSString *imageTitle; + NSCalendarDate *imageDate; +} + +@property(readwrite,copy) NSURL * image; +@property(readwrite,copy) NSString * imageID; + +- (id)initWithURL: (NSURL *)theUrl withTitle: (NSString *)theTitle withDate: (NSDate *)theDate; + +#pragma mark - +#pragma mark Required Methods IKImageBrowserItem Informal Protocol +- (NSString *)imageUID; +- (NSString *)imageRepresentationType; +- (id)imageRepresentation; + +- (NSString *)imageTitle; +- (NSString *)imageSubtitle; + +@end diff --git a/ApertureToAnselExportPlugin/TURAnselKit/AnselGalleryViewItem.m b/ApertureToAnselExportPlugin/TURAnselKit/AnselGalleryViewItem.m new file mode 100644 index 000000000..a27b41b5c --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/AnselGalleryViewItem.m @@ -0,0 +1,69 @@ +/** + * AnselGalleryViewItem.m + * + * Implements the IKImageBrowserItem protocol for displaying images from a + * remote Ansel gallery in an IKImageBrowser. + * + * Copyright 2009 The Horde Project (http://www.horde.org) + * + * @implements IKImageBrowserItem + * @license http://opensource.org/licenses/bsd-license.php + * @author Michael J. Rubinsky + */ +#import "AnselGalleryViewItem.h" + +@implementation AnselGalleryViewItem +@synthesize image; +@synthesize imageID; + +- (id)initWithURL: (NSURL *)theURL + withTitle: (NSString *)theTitle + withDate: (NSDate *)theDate +{ + [super init]; + image = [theURL retain]; + imageID = [[theURL absoluteString] retain]; + imageTitle = [theTitle retain]; + imageDate = [theDate retain]; + return self; +} +- (void)dealloc +{ + [image release]; + [imageID release]; + [imageTitle release]; + [imageDate release]; + [super dealloc]; +} + +#pragma mark +#pragma mark Required methods +- (NSString *)imageUID +{ + return imageID; +} + +- (NSString *)imageRepresentationType +{ + return IKImageBrowserNSURLRepresentationType; +} + +- (id)imageRepresentation +{ + return image; +} + +#pragma mark +#pragma mark Optional methods. +- (NSString *)imageTitle +{ + NSLog(@"imageTitle: %@", imageTitle); + return imageTitle; +} +- (NSString *)imageSubtitle +{ + NSLog(@"imageSubtitle: %@", [imageDate description]); + return [imageDate description]; +} + +@end diff --git a/ApertureToAnselExportPlugin/TURAnselKit/English.lProj/AnselGalleryPanel.nib/designable.nib b/ApertureToAnselExportPlugin/TURAnselKit/English.lProj/AnselGalleryPanel.nib/designable.nib new file mode 100644 index 000000000..aab13b850 --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/English.lProj/AnselGalleryPanel.nib/designable.nib @@ -0,0 +1,744 @@ + + + + 1050 + 9F33 + 672 + 949.34 + 352.00 + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + TURAnselGalleryPanelController + + + FirstResponder + + + NSApplication + + + 19 + 2 + {{797, 724}, {267, 276}} + -536866816 + New Gallery + NSPanel + + {3.40282e+38, 3.40282e+38} + + + 256 + + YES + + + 268 + {{20, 219}, {227, 22}} + + YES + + -1804468671 + 272630784 + + + LucidaGrande + 1.300000e+01 + 1044 + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + + + + 268 + {{17, 240}, {88, 16}} + + YES + + 68288064 + 272630784 + Gallery Name + + LucidaGrande + 1.200000e+01 + 16 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + + + + + + 268 + {{17, 195}, {73, 16}} + + YES + + 68288064 + 272630784 + Gallery Slug + + + + + + + + + 268 + {{20, 174}, {227, 22}} + + YES + + -1804468671 + 272630784 + + + + YES + + + + + + + 268 + {{20, 103}, {227, 47}} + + YES + + -1805517311 + 272629760 + + + + YES + + + + + + + 268 + {{17, 150}, {124, 16}} + + YES + + 68288064 + 272630784 + Gallery Description + + + + + + + + + 268 + {{116, 12}, {68, 32}} + + YES + + 67239424 + 134217728 + Cancel + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{184, 12}, {69, 32}} + + YES + + 67239424 + 134217728 + Save + + + -2038284033 + 129 + + + 200 + 25 + + + + + 268 + {{20, 56}, {230, 26}} + + YES + + 879885888 + 272630784 + + + + YES + + + 5 + YES + + + + 274 + {15, 0} + + + YES + + YES + + + 1.200000e+01 + 1.000000e+01 + 1.000000e+03 + + 75628032 + 0 + + + + 3 + MC4zMzMzMzI5OQA + + + + + 338820672 + 1024 + + + YES + + 6 + System + controlBackgroundColor + + + + + 3 + YES + + + + 3.000000e+00 + 2.000000e+00 + + + 6 + System + gridColor + + 3 + MC41AA + + + 1.900000e+01 + tableViewAction: + -767524864 + + + + 1 + 15 + 0 + YES + + + + + + 268 + {{17, 79}, {88, 16}} + + YES + + 68288064 + 272630784 + Gallery Parent + + + + + + + + {267, 276} + + + {{0, 0}, {1920, 1178}} + {3.40282e+38, 3.40282e+38} + + + + + YES + + + newGallerySheet + + + + 43 + + + + doNewGallery: + + + + 48 + + + + galleryDescTextField + + + + 49 + + + + galleryNameTextField + + + + 50 + + + + gallerySlugTextField + + + + 51 + + + + cancelNewGallery: + + + + 53 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + + + + + + + + + + 3 + + + YES + + + + + + 4 + + + + + 5 + + + YES + + + + + + 6 + + + + + 7 + + + YES + + + + + + 8 + + + + + 9 + + + YES + + + + + + 10 + + + + + 11 + + + YES + + + + + + 12 + + + + + 13 + + + YES + + + + + + 14 + + + + + 15 + + + YES + + + + + + 16 + + + + + 17 + + + YES + + + + + + 18 + + + + + 19 + + + YES + + + + + + 20 + + + + + 21 + + + YES + + + + + + 22 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 17.IBPluginDependency + 18.IBPluginDependency + 19.IBPluginDependency + 2.IBPluginDependency + 20.IBPluginDependency + 21.IBPluginDependency + 22.IBPluginDependency + 3.IBPluginDependency + 4.IBPluginDependency + 5.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{177, 722}, {267, 276}} + com.apple.InterfaceBuilder.CocoaPlugin + {{177, 722}, {267, 276}} + + {196, 240} + {{357, 418}, {480, 270}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 53 + + + + YES + + NSObject + + IBProjectSource + TURAnsel.h + + + + NSObject + + IBProjectSource + TURAnselGallery.h + + + + NSObject + + IBProjectSource + TURAnselGalleryPanelController.h + + + + NSObject + + IBProjectSource + xmlrpc-1.5.1/XMLRPCConnection.h + + + + TURAnselGalleryPanelController + NSObject + + YES + + YES + cancelNewGallery: + doNewGallery: + + + YES + id + id + + + + YES + + YES + delegate + galleryDescTextField + galleryNameTextField + gallerySlugTextField + newGallerySheet + + + YES + id + NSTextField + NSTextField + NSTextField + NSPanel + + + + + + + 0 + ../iPhoto2Ansel.xcodeproj + 3 + + diff --git a/ApertureToAnselExportPlugin/TURAnselKit/English.lProj/AnselGalleryPanel.nib/keyedobjects.nib b/ApertureToAnselExportPlugin/TURAnselKit/English.lProj/AnselGalleryPanel.nib/keyedobjects.nib new file mode 100644 index 000000000..b318b79b4 Binary files /dev/null and b/ApertureToAnselExportPlugin/TURAnselKit/English.lProj/AnselGalleryPanel.nib/keyedobjects.nib differ diff --git a/ApertureToAnselExportPlugin/TURAnselKit/TURAnsel.h b/ApertureToAnselExportPlugin/TURAnselKit/TURAnsel.h new file mode 100644 index 000000000..b1997fa43 --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/TURAnsel.h @@ -0,0 +1,60 @@ +/** + * TURAnsel + * + * Copyright 2009 The Horde Project (http://www.horde.org) + * + * @license http://opensource.org/licenses/bsd-license.php + * @author Michael J. Rubinsky + */ +#import +@class TURAnselGallery; + +typedef enum { + PERMS_SHOW = 2, + PERMS_READ = 4, + PERMS_EDIT = 8, + PERMS_DELETE = 16 +} HORDE_PERMS; + +typedef enum { + TURAnselStateDisconnected = 0, + TURAnselStateConnected, + TURAnselStateError, + TURAnselStateCancelled, + TURAnselStateWaiting +} TURAnselState; + +@interface NSObject (TURAnselDelegate) +- (void)TURAnselDidInitialize; +- (void)TURAnselHadError: (NSError *)error; +@end + +@interface TURAnsel : NSObject { + NSString *userAgent; + NSString *rpcEndPoint; + NSString *username; + NSString *password; + NSMutableArray *galleryList; + TURAnselState state; + id delegate; + NSLock *lock; +} + +@property (readwrite, retain) NSString *rpcEndPoint; +@property (readwrite, retain) NSString *username; +@property (readwrite, retain) NSString *password; + +- (id)initWithConnectionParameters: (NSDictionary *)params; +- (void)connect; +- (TURAnselGallery *)getGalleryById: (NSString *)galleryId; +- (TURAnselGallery *)getGalleryByIndex: (NSInteger)index; +- (NSDictionary *)callRPCMethod: (NSString *)methodName withParams: (NSArray *)params withOrder: (NSArray *)order; +- (NSDictionary *)createNewGallery: (NSDictionary *)params; +- (void)cancel; + +// Getters/setters +- (void) setState: (TURAnselState)state; +- (TURAnselState)state; +- (id)delegate; +- (void)setDelegate: (id)newDelegate; +@end diff --git a/ApertureToAnselExportPlugin/TURAnselKit/TURAnsel.m b/ApertureToAnselExportPlugin/TURAnselKit/TURAnsel.m new file mode 100644 index 000000000..56ad2f77d --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/TURAnsel.m @@ -0,0 +1,315 @@ +/** + * TURAnsel.m + * + * Main class for interacting with a remote Ansel server. + * + * Copyright 2009 The Horde Project (http://www.horde.org) + * + * @license http://opensource.org/licenses/bsd-license.php + * @author Michael J. Rubinsky + */ +#import +#import "TURAnselKit.h" + +@interface TURAnsel (PrivateAPI) +- (void)doLogin; +@end + +@implementation TURAnsel + +@synthesize rpcEndPoint; +@synthesize username; +@synthesize password; + +#pragma mark - +#pragma mark init/dealloc +- (id)initWithConnectionParameters: (NSDictionary *)params +{ + [super init]; + galleryList = [[NSMutableArray alloc] init]; + + // Initialize the connection properties, KVC style + [self setValue:[params objectForKey:@"endpoint"] + forKey: @"rpcEndPoint"]; + [self setValue: [params objectForKey:@"username"] + forKey: @"username"]; + [self setValue: [params objectForKey:@"password"] + forKey: @"password"]; + [self setValue: @"The Ansel Cocoa XML-RPC Client" + forKey: @"userAgent"]; + + return self; +} +-(void) dealloc +{ + NSLog(@"TURAnsel dealloc"); + [galleryList removeAllObjects]; + [galleryList release]; + [rpcEndPoint release]; + [username release]; + [password release]; + [userAgent release]; + [super dealloc]; +} + +#pragma mark - +#pragma mark Actions +- (void)connect +{ + [self doLogin]; +} +- (void) cancel +{ + state = TURAnselStateCancelled; +} + +/** + * Create a new gallery on the Ansel server. + * + * @param NSDictionary params A dictionary of parameters for the new gallery. + * + * @return NSDictionary A dictionary describing the new gallery + */ +- (NSDictionary *)createNewGallery: (NSDictionary *)params +{ + NSArray *apiparams = [NSArray arrayWithObjects: @"ansel", params, nil]; + NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamGaleryParams, nil]; + + NSDictionary *response = [self callRPCMethod: @"images.createGallery" + withParams: apiparams + withOrder: order]; + + if (response) { + NSNumber *gallery_id = [response objectForKey: (NSString *)kWSMethodInvocationResult]; + NSDictionary *results = [NSDictionary dictionaryWithObjectsAndKeys: + gallery_id, kTURAnselGalleryKeyId, + [params valueForKey: @"name"], kTURAnselGalleryKeyName, + @"", kTURAnselGalleryKeyDescription, + [NSNumber numberWithInt: 0], kTURAnselGalleryKeyImages, + [NSNumber numberWithInt: 0], kTURAnselGalleryKeyDefaultImage, nil]; + + TURAnselGallery *newGallery = [[TURAnselGallery alloc] initWithObject: results + controller: self]; + [galleryList addObject: newGallery]; + [newGallery release]; + + return results; + } + + return nil; +} + + +/** + * Entry point for calling RPC methods on the Horde server. + * + * @param NSString methodName The method to call (e.g. images.listGalleries) + * @param NSArray params All the method's parameters + * @param NSArray order Keys for the params array, needed because of how + * WSMethodInvocationSetParameters is used. (The keys are + * disregarded by Horde, but needed to ensure they get + * sent in the correct order by WS. + * + * The invocationCallback function is called on completion, which in turn will + * call the methodCompletionCallback with the results + */ +- (NSDictionary *)callRPCMethod: (NSString *)methodName + withParams: (NSArray *) params + withOrder: (NSArray *) order +{ + NSLog(@"Initiating connection for %@", methodName); + + // Get a URL object + NSURL *url = [NSURL URLWithString: [self valueForKey: @"rpcEndPoint"]]; + NSDictionary *values = [NSDictionary dictionaryWithObjects: params forKeys:order]; + + // Credentials + NSString *user = [self valueForKey:@"username"]; + NSString *pass = [self valueForKey:@"password"]; + + if (user != nil && [user length] && pass != nil && [pass length]) { + // Create a custom http request with authorization + CFHTTPMessageRef request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, + (CFStringRef)@"POST", + (CFURLRef)url, + kCFHTTPVersion1_1); + // Add auth creds to request. + Boolean success = CFHTTPMessageAddAuthentication(request, + NULL, + (CFStringRef)user, + (CFStringRef)pass, + kCFHTTPAuthenticationSchemeBasic, + false); + + NSLog(@"Results adding credentials to request: %d", success); + if (!success) { + NSLog(@"Unable to authenticate"); + + if ([[self delegate] respondsToSelector: @selector(TURAnselHadError:)]) { + NSError *error = [NSError errorWithDomain:@"TURAnsel" + code: 1 + userInfo:[NSDictionary dictionaryWithObjectsAndKeys: @"Authentication failure.", @"message", nil]]; + + [[self delegate] TURAnselHadError: error]; + } + + return nil; + + } else { + // Build a new invocation + [self setState:TURAnselStateWaiting]; + WSMethodInvocationRef rpcCall; + rpcCall = WSMethodInvocationCreate((CFURLRef)url, (CFStringRef)methodName, kWSXMLRPCProtocol); + WSMethodInvocationSetParameters(rpcCall, (CFDictionaryRef)values, (CFArrayRef)order); + WSMethodInvocationSetProperty(rpcCall, kWSHTTPMessage, request); + NSDictionary *result = (NSDictionary *)WSMethodInvocationInvoke(rpcCall); + CFRelease(request); + // Check out the results + if (WSMethodResultIsFault((CFDictionaryRef) result)) { + + NSError *error; + + CFHTTPMessageRef response = (CFHTTPMessageRef)[result objectForKey:(id)kWSHTTPResponseMessage]; + int resStatusCode = CFHTTPMessageGetResponseStatusCode(response); + NSString *resStatusLine = (NSString *)CFHTTPMessageCopyResponseStatusLine(response); + if (resStatusCode == 401) { + error = [NSError errorWithDomain: @"TURAnsel" + code: resStatusCode + userInfo: [NSDictionary dictionaryWithObjectsAndKeys: resStatusLine, @"NSLocalizedDescriptionKey", nil]]; + } else { + NSNumber *faultCode = [result objectForKey: (NSString *)kWSFaultCode]; + NSString *faultString = [result objectForKey: (NSString *)kWSFaultString]; + NSLog(@"faultCode: %@ faultString: %@", faultCode, faultString); + error = [NSError errorWithDomain: @"TURAnsel" + code: [faultCode intValue] + userInfo: [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat: @"%@, %@", resStatusLine, faultString], @"NSLocalizedDescriptionKey", nil]]; + + + } + if ([[self delegate] respondsToSelector: @selector(TURAnselHadError:)]) { + [[self delegate] TURAnselHadError: error]; + } + [resStatusLine release]; + [result autorelease]; + return nil; + } + + CFHTTPMessageRef response = (CFHTTPMessageRef)[result objectForKey:(id)kWSHTTPResponseMessage]; + int resStatusCode = CFHTTPMessageGetResponseStatusCode(response); + NSLog(@"ResponseCode: %d", resStatusCode); + [self setState:TURAnselStateConnected]; + return [result autorelease]; + } + } + + NSLog(@"No authentication information present."); + return nil; + +} + +#pragma mark - +#pragma mark Setters/Getters +// Fetch a gallery by id +- (TURAnselGallery *)getGalleryById: (NSString *)galleryId +{ + for (TURAnselGallery *g in galleryList) { + if ([galleryId isEqualTo: [NSNumber numberWithInt: [g galleryId]]]) { + return g; + } + } + + return nil; +} + +/** + * Return the gallery at the specified position in the internal storage array. + * Needed for when we are using this class as a datasource for a UI element. + */ +- (TURAnselGallery *)getGalleryByIndex: (NSInteger)index +{ + TURAnselGallery *g = [galleryList objectAtIndex:index]; + return g; +} + +#pragma mark -- +#pragma mark ComboBox Datasource +- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox +{ + return [galleryList count]; +} + +- (id)comboBox:(NSComboBox *)aComboBox + objectValueForItemAtIndex:(NSInteger)index +{ + TURAnselGallery *g = [galleryList objectAtIndex:index]; + NSString *stringValue = [g valueForKey:@"galleryName"]; + return stringValue; +} + +#pragma mark Getter/Setters +- (TURAnselState) state +{ + return state; +} +-(void) setState: (TURAnselState)newstate +{ + state = newstate; +} + +- (id)delegate { + return delegate; +} + +- (void)setDelegate:(id)newDelegate { + delegate = newDelegate; +} + +#pragma mark PrivateAPI +/** + * Perform initial contact with Ansel server. Retrieves the list of galleries + * available for the selected server. + * + * @return void + */ +- (void)doLogin +{ + NSArray *params = [[NSArray alloc] initWithObjects: + @"ansel", // Scope + [NSNumber numberWithInt: PERMS_EDIT], // Perms + @"", // No parent + [NSNumber numberWithBool:YES], // allLevels + [NSNumber numberWithInt: 0], // Offset + [NSNumber numberWithInt: 0], // Count + [self valueForKey:@"username"], nil]; // Restrict to user (This should be an option eventually). + + NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, kTURAnselAPIParamPerms, + kTURAnselAPIParamParent, kTURAnselAPIParamAllLevels, + kTURAnselAPIParamOffset, kTURAnselAPIParamCount, + kTURAnselAPIParamUserOnly, nil]; + + NSDictionary *results = [self callRPCMethod: @"images.listGalleries" + withParams: params + withOrder: order]; + + if (results) { + NSDictionary *galleries = [results objectForKey: (id)kWSMethodInvocationResult]; + for (NSString *gal in galleries) { + TURAnselGallery *theGallery = [[TURAnselGallery alloc] initWithObject: gal + controller: self]; + [theGallery setAnselController: self]; + [galleryList addObject: theGallery]; + [theGallery release]; + theGallery = nil; + } + + if ([delegate respondsToSelector:@selector(TURAnselDidInitialize)]) { + [delegate performSelectorOnMainThread:@selector(TURAnselDidInitialize) + withObject:self + waitUntilDone: NO]; + } + + } + + [params release]; +} +@end \ No newline at end of file diff --git a/ApertureToAnselExportPlugin/TURAnselKit/TURAnselConstants.h b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselConstants.h new file mode 100644 index 000000000..ef64dc77a --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselConstants.h @@ -0,0 +1,33 @@ +/** + * TURAnselConstants + * + * Copyright 2009 The Horde Project (http://www.horde.org) + * + * @license http://opensource.org/licenses/bsd-license.php + * @author Michael J. Rubinsky + */ + +// Constants for the API parameter names. +extern NSString * const kTURAnselAPIParamScope; +extern NSString * const kTURAnselAPIParamGaleryParams; +extern NSString * const kTURAnselAPIParamPerms; +extern NSString * const kTURAnselAPIParamParent; +extern NSString * const kTURAnselAPIParamAllLevels; +extern NSString * const kTURAnselAPIParamOffset; +extern NSString * const kTURAnselAPIParamCount; +extern NSString * const kTURAnselAPIParamUserOnly; +extern NSString * const kTURAnselAPIParamImageId; +extern NSString * const kTURAnselAPIParamGalleryId; +extern NSString * const kTURAnselAPIParamThumbnailStyle; +extern NSString * const kTURAnselAPIParamFullPath; +extern NSString * const kTURAnselAPIParamImageData; +extern NSString * const kTURAnselAPIParamSetAsDefault; +extern NSString * const kTURAnselAPIParamAdditionalData; +extern NSString * const kTURAnselAPIParamEncoding; + +// Constants for the dictionary keys used to describe/create TURAnselGallery +extern NSString * const kTURAnselGalleryKeyId; +extern NSString * const kTURAnselGalleryKeyName; +extern NSString * const kTURAnselGalleryKeyDescription; +extern NSString * const kTURAnselGalleryKeyImages; +extern NSString * const kTURAnselGalleryKeyDefaultImage; diff --git a/ApertureToAnselExportPlugin/TURAnselKit/TURAnselConstants.m b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselConstants.m new file mode 100644 index 000000000..74472bb5f --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselConstants.m @@ -0,0 +1,34 @@ +// +// TURAnselConstants.m +// ApertureToAnselExportPlugin +// +// Created by Michael Rubinsky on 9/22/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "TURAnselConstants.h" + +// Constants for the API parameter names. +NSString * const kTURAnselAPIParamScope = @"scope"; +NSString * const kTURAnselAPIParamGaleryParams = @"galleryParams"; +NSString * const kTURAnselAPIParamPerms = @"perms"; +NSString * const kTURAnselAPIParamParent = @"parent"; +NSString * const kTURAnselAPIParamAllLevels = @"allLevels"; +NSString * const kTURAnselAPIParamOffset = @"offset"; +NSString * const kTURAnselAPIParamCount = @"count"; +NSString * const kTURAnselAPIParamUserOnly = @"userOnly"; +NSString * const kTURAnselAPIParamImageId = @"imageId"; +NSString * const kTURAnselAPIParamGalleryId = @"galleryId"; +NSString * const kTURAnselAPIParamThumbnailStyle = @"thumbnailStyle"; +NSString * const kTURAnselAPIParamFullPath = @"fullPath"; +NSString * const kTURAnselAPIParamImageData = @"imageData"; +NSString * const kTURAnselAPIParamSetAsDefault = @"default"; +NSString * const kTURAnselAPIParamAdditionalData = @"additionalData"; +NSString * const kTURAnselAPIParamEncoding = @"encoding"; + +// Ansel gallery attribtues. +NSString * const kTURAnselGalleryKeyId = @"share_id"; +NSString * const kTURAnselGalleryKeyName = @"attribute_name"; +NSString * const kTURAnselGalleryKeyDescription = @"attribute_desc"; +NSString * const kTURAnselGalleryKeyImages = @"attribute_images"; +NSString * const kTURAnselGalleryKeyDefaultImage = @"attribute_default"; \ No newline at end of file diff --git a/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGallery.h b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGallery.h new file mode 100644 index 000000000..5eff4e79b --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGallery.h @@ -0,0 +1,42 @@ +/** + * TURAnselGallery + * + * Copyright 2009 The Horde Project (http://www.horde.org) + * + * @license http://opensource.org/licenses/bsd-license.php + * @author Michael J. Rubinsky + */ +#import +@class TURAnsel, NSURL; + +@interface NSObject (TURAnselGalleryDelegate) +- (void)TURAnselGalleryDidUploadImage: (id *)gallery; +@end + +@interface TURAnselGallery : NSObject { + int _galleryId; + int galleryImageCount; + int galleryKeyImage; + NSURL *galleryKeyImageURL; + NSMutableArray *imageList; + NSString *galleryName; + NSString *galleryDescription; + TURAnsel *anselController; + id delegate; +} +@property (readonly) NSString *galleryName; +@property (readonly) NSString *galleryDescription; +@property (readonly) int galleryImageCount; +@property (readwrite) int galleryKeyImage; + +- (id)initWithObject:(id)galleryData controller:(TURAnsel * )controller; +- (void)uploadImageObject: (NSDictionary *)imageParameters; + +// Getter / Setter +- (void)setDelegate: (id)newDelegate; +- (id)delegate; +- (NSURL *)galleryKeyImageURL; +- (id)listImages; +- (int)galleryId; +- (void)setAnselController:(TURAnsel *)newController; +@end \ No newline at end of file diff --git a/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGallery.m b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGallery.m new file mode 100644 index 000000000..9397b107d --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGallery.m @@ -0,0 +1,216 @@ +/** + * TURAnselGallery.m + * + * Copyright 2009 The Horde Project (http://www.horde.org) + * + * @license http://opensource.org/licenses/bsd-license.php + * @author Michael J. Rubinsky + */ +#import +#import "TURAnselKit.h" + +@interface TURAnselGallery (PrivateAPI) +- (void)doUpload: (NSDictionary *)imageParams; +@end + +@implementation TURAnselGallery + +@synthesize galleryDescription; +@synthesize galleryName; +@synthesize galleryImageCount; +@synthesize galleryKeyImage; + +#pragma mark - +#pragma mark init/dealloc +/** + * Init a gallery object + */ +- (id)initWithObject:(id)galleryData controller:(TURAnsel *)controller +{ + [super init]; + [self setValue: [galleryData valueForKey: kTURAnselGalleryKeyId] + forKey: @"galleryId"]; + [self setValue:[galleryData valueForKey: kTURAnselGalleryKeyDescription] + forKey:@"galleryDescription"]; + [self setValue:[galleryData valueForKey: kTURAnselGalleryKeyName] + forKey:@"galleryName"]; + [self setValue: [galleryData valueForKey: kTURAnselGalleryKeyImages] + forKey:@"galleryImageCount"]; + [self setValue: [galleryData valueForKey: kTURAnselGalleryKeyDefaultImage] + forKey:@"galleryKeyImage"]; + [self setAnselController: controller]; + return self; +} +- (void)dealloc +{ + NSLog(@"TURAnselGallery dealloc called on Gallery %@", self); + [anselController release]; + anselController = nil; + + [galleryKeyImageURL release]; + galleryKeyImageURL = nil; + + [imageList release]; + imageList = nil; + + [super dealloc]; +} +- (id)description +{ + NSString *text = [NSString stringWithFormat:@"Description: %@ Id: %d has: %d images", galleryName, _galleryId, galleryImageCount]; + return text; +} + +#pragma mark - +#pragma mark Actions +/** + * Requests the gallery's key image url to be fetched from the server + * (This information is not present in the gallery definition array returned + * from the images.listGalleries call). + */ +- (NSURL *)galleryKeyImageURL +{ + if (galleryKeyImageURL) { + return galleryKeyImageURL; + } else { + NSArray *params = [[NSArray alloc] initWithObjects: + @"ansel", // Scope + [NSNumber numberWithInt: galleryKeyImage], // Image Id + @"thumb", // Thumbnail type + [NSNumber numberWithBool:YES], // Full path + nil]; + + NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, + kTURAnselAPIParamImageId, + kTURAnselAPIParamThumbnailStyle, + kTURAnselAPIParamFullPath, nil]; + + NSDictionary *response = [anselController callRPCMethod: @"images.getImageUrl" + withParams: params + withOrder: order]; + + if (response) { + NSDictionary *url = [response objectForKey:(id)kWSMethodInvocationResult]; + [galleryKeyImageURL autorelease]; + galleryKeyImageURL = [[NSURL URLWithString: [NSString stringWithFormat: @"%@", url]] retain]; + NSLog(@"galleryKeyImageURL: %@", galleryKeyImageURL); + return galleryKeyImageURL; + } + + return nil; + } +} + +/** + * Get the complete list of image ids and URLs + */ +- (id)listImages +{ + if (!imageList) { + + NSArray *params = [[NSArray alloc] initWithObjects: + @"ansel", //Scope + [NSNumber numberWithInt: _galleryId], //Gallery Id + [NSNumber numberWithInt: 2], //PERMS_SHOW + @"thumb", // Thumbnail + [NSNumber numberWithBool:YES], // Full path + nil]; + NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, + kTURAnselAPIParamGalleryId, + kTURAnselAPIParamPerms, + kTURAnselAPIParamThumbnailStyle, + kTURAnselAPIParamFullPath, nil]; + + NSDictionary *response = [anselController callRPCMethod: @"images.listImages" + withParams: params + withOrder: order]; + if (response) { + [imageList autorelease]; + imageList = [[response objectForKey: (id)kWSMethodInvocationResult] retain]; + + NSLog(@"listImages: %@", imageList); + + return imageList; + } + } + + return nil; +} + +/** + * Upload the provided image to this gallery. + */ +- (void)uploadImageObject: (NSDictionary *)imageParameters +{ + [self doUpload: imageParameters]; +} + +#pragma mark - +#pragma mark Getter/Setter +- (int)galleryId +{ + return _galleryId; +} + +- (void)setGalleryId:(int)id +{ + _galleryId = id; +} + +- (id)delegate +{ + return delegate; +} + +- (void)setDelegate: (id)newDelegate +{ + delegate = newDelegate; +} + +- (void)setAnselController: (TURAnsel *)newController +{ + [anselController autorelease]; + anselController = [newController retain]; +} + +- (TURAnsel *)anselController +{ + return anselController; +} + +#pragma mark - +#pragma mark PrivateAPI +- (void)doUpload:(NSDictionary *)imageParameters +{ + // Need to build the params array now. + NSArray *params = [[NSArray alloc] initWithObjects: + @"ansel", // app + [NSNumber numberWithInt: _galleryId], // gallery_id + [imageParameters valueForKey: @"data"], // image data array + [imageParameters valueForKey: @"default"], // set as default? + @"", // Additional gallery data to set? + @"base64", // Image data encoding + nil]; + NSArray *order = [NSArray arrayWithObjects: kTURAnselAPIParamScope, + kTURAnselAPIParamGalleryId, + kTURAnselAPIParamImageData, + kTURAnselAPIParamSetAsDefault, + kTURAnselAPIParamAdditionalData, + kTURAnselAPIParamEncoding, nil]; + + // Send the request up to the controller + NSDictionary *result = [anselController callRPCMethod: @"images.saveImage" + withParams: params + withOrder: order]; + + if (result) { + if ([delegate respondsToSelector:@selector(TURAnselGalleryDidUploadImage:)]) { + [delegate performSelectorOnMainThread: @selector(TURAnselGalleryDidUploadImage:) + withObject: self + waitUntilDone: NO]; + } + } + + [params release]; +} +@end diff --git a/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGalleryPanelController.h b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGalleryPanelController.h new file mode 100644 index 000000000..b0a8f2e66 --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGalleryPanelController.h @@ -0,0 +1,36 @@ +/** + * TURAnselGalleryPanelController + * + * Copyright 2009 The Horde Project (http://www.horde.org) + * + * @license http://opensource.org/licenses/bsd-license.php + * @author Michael J. Rubinsky + */ +#import +#import "TURAnselKit.h" + +@interface NSObject (TURAnselGalleryPaneControllerDelegate) +-(void)TURAnselGalleryPanelDidAddGallery; +@end + +@interface TURAnselGalleryPanelController : NSObject { + // Outlets + IBOutlet NSTextField *galleryNameTextField; + IBOutlet NSTextField *gallerySlugTextField; + IBOutlet NSTextField *galleryDescTextField; + IBOutlet NSPanel *newGallerySheet; + + // Instance members + TURAnsel *_anselController; + NSWindow *_controllerWindow; + id _delegate; +} + +// Actions +- (IBAction)doNewGallery: (id)sender; +- (IBAction)cancelNewGallery: (id)sender; +- (id)initWithController: (TURAnsel *)theController; +- (id)initWithController: (TURAnsel *)theController withGalleryName: (NSString *)galleryName; +- (void)showSheetForWindow: (NSWindow *)theWindow; +- (void)setDelegate: (id)theDelegate; +@end diff --git a/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGalleryPanelController.m b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGalleryPanelController.m new file mode 100644 index 000000000..09aa6c5ae --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselGalleryPanelController.m @@ -0,0 +1,120 @@ +/** + * TURAnselGalleryPanelController.m + * + * Controller for handling the form that creates new remote Ansel galleries. + * + * Copyright 2009 The Horde Project (http://www.horde.org) + * + * @license http://opensource.org/licenses/bsd-license.php + * @author Michael J. Rubinsky + */ +#import "TURAnselGalleryPanelController.h" + +@implementation TURAnselGalleryPanelController + +#pragma mark - +#pragma mark init/dealloc +-(id)initWithController: (TURAnsel *)theController +{ + [super init]; + _anselController = [theController retain]; + [NSBundle loadNibNamed: @"AnselGalleryPanel" + owner: self]; + + return self; +} +- (id)initWithController: (TURAnsel *)theController + withGalleryName: (NSString *)galleryName +{ + + [super init]; + _anselController = [theController retain]; + [NSBundle loadNibNamed: @"AnselGalleryPanel" + owner: self]; + + [galleryNameTextField setStringValue: galleryName]; + + return self; +} +- (void)dealloc +{ + [_anselController release]; + [_controllerWindow release]; + [super dealloc]; +} + +#pragma mark - +#pragma mark IBActions +- (IBAction)cancelNewGallery: (id)sender +{ + [NSApp endSheet: newGallerySheet]; + [newGallerySheet orderOut: nil]; +} + +- (IBAction)doNewGallery: (id)sender +{ + // Get Gallery Properties from the panel. + NSString *galleryName = [galleryNameTextField stringValue]; + NSString *gallerySlug = [gallerySlugTextField stringValue]; + NSString *galleryDescription = [galleryDescTextField stringValue]; + + if (!galleryName) { + + [NSApp endSheet: newGallerySheet]; + [newGallerySheet orderOut: nil]; + + NSAlert *alert = [[NSAlert alloc] init]; + [alert setMessageText:@"Gallery names cannot be empty"]; + [alert setAlertStyle: NSCriticalAlertStyle]; + [alert beginSheetModalForWindow: _controllerWindow + modalDelegate: nil + didEndSelector: nil + contextInfo: nil]; + [alert release]; + return; + } + NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: + galleryName, @"name", + gallerySlug, @"slug", + galleryDescription, @"desc", nil]; + + NSDictionary *results = [[_anselController createNewGallery: params] retain]; + + [NSApp endSheet: newGallerySheet]; + [newGallerySheet orderOut: nil]; + + if ([_anselController state] != TURAnselStateError) { + NSAlert *alert = [[NSAlert alloc] init]; + [alert setMessageText: @"Gallery successfully created."]; + [alert beginSheetModalForWindow: _controllerWindow + modalDelegate: nil + didEndSelector: nil + contextInfo: nil]; + [alert release]; + if ([_delegate respondsToSelector:@selector(TURAnselGalleryPanelDidAddGallery)]) { + [_delegate TURAnselGalleryPanelDidAddGallery]; + } + } + + [results release]; +} + + +- (void)setDelegate: (id)theDelegate +{ + _delegate = theDelegate; // weak +} + + +- (void)showSheetForWindow: (NSWindow *)theWindow +{ + [_controllerWindow release]; + _controllerWindow = [theWindow retain]; + [NSApp beginSheet: newGallerySheet + modalForWindow: theWindow + modalDelegate: nil + didEndSelector: nil + contextInfo: nil]; +} + +@end diff --git a/ApertureToAnselExportPlugin/TURAnselKit/TURAnselKit.h b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselKit.h new file mode 100644 index 000000000..7a4277a8a --- /dev/null +++ b/ApertureToAnselExportPlugin/TURAnselKit/TURAnselKit.h @@ -0,0 +1,4 @@ +#import "TURAnselConstants.h" +#import "TURAnsel.h" +#import "TURAnselGallery.h" +