diff --git a/GCDWebUploader/GCDWebUploader.bundle/css/index.css b/GCDWebUploader/GCDWebUploader.bundle/css/index.css index 1d83317..4ec6f15 100644 --- a/GCDWebUploader/GCDWebUploader.bundle/css/index.css +++ b/GCDWebUploader/GCDWebUploader.bundle/css/index.css @@ -25,10 +25,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -.header { - color: #222; -} - .row-file { height: 40px; } diff --git a/GCDWebUploader/GCDWebUploader.bundle/en.lproj/Localizable.strings b/GCDWebUploader/GCDWebUploader.bundle/en.lproj/Localizable.strings index fe936ba..2f4b4a2 100644 --- a/GCDWebUploader/GCDWebUploader.bundle/en.lproj/Localizable.strings +++ b/GCDWebUploader/GCDWebUploader.bundle/en.lproj/Localizable.strings @@ -1,3 +1,3 @@ -"TITLE" = "%@"; -"HEADER" = "Drag & drop files on this window or use the \"Upload Files…\" button to upload new files."; -"FOOTER" = "%@ %@"; +"PROLOGUE" = "

Drag & drop files on this window or use the \"Upload Files…\" button to upload new files.

"; +"EPILOGUE" = ""; +"FOOTER_FORMAT" = "%@ %@"; diff --git a/GCDWebUploader/GCDWebUploader.bundle/index.html b/GCDWebUploader/GCDWebUploader.bundle/index.html index 07a78c8..ec40a7c 100644 --- a/GCDWebUploader/GCDWebUploader.bundle/index.html +++ b/GCDWebUploader/GCDWebUploader.bundle/index.html @@ -57,10 +57,10 @@
-

%header%

+ %prologue%
@@ -89,6 +89,8 @@
+ %epilogue% + diff --git a/GCDWebUploader/GCDWebUploader.h b/GCDWebUploader/GCDWebUploader.h index 815ffe0..a8de854 100644 --- a/GCDWebUploader/GCDWebUploader.h +++ b/GCDWebUploader/GCDWebUploader.h @@ -43,9 +43,11 @@ @property(nonatomic, assign) id delegate; @property(nonatomic, copy) NSArray* allowedFileExtensions; // Default is nil i.e. all file extensions are allowed @property(nonatomic) BOOL showHiddenFiles; // Default is NO -@property(nonatomic, copy) NSString* title; // Default is application name (text must be HTML escaped) -@property(nonatomic, copy) NSString* header; // Default is help blurb (text must be HTML escaped) -@property(nonatomic, copy) NSString* footer; // Default is application name and version (text must be HTML escaped) +@property(nonatomic, copy) NSString* title; // Default is application name (must be HTML escaped) +@property(nonatomic, copy) NSString* header; // Default is same as title (must be HTML escaped) +@property(nonatomic, copy) NSString* prologue; // Default is mini help (must be raw HTML) +@property(nonatomic, copy) NSString* epilogue; // Default is mini help (must be raw HTML) +@property(nonatomic, copy) NSString* footer; // Default is application name and version (must be HTML escaped) - (id)initWithUploadDirectory:(NSString*)path; @end diff --git a/GCDWebUploader/GCDWebUploader.m b/GCDWebUploader/GCDWebUploader.m index ec3680b..c97fc82 100644 --- a/GCDWebUploader/GCDWebUploader.m +++ b/GCDWebUploader/GCDWebUploader.m @@ -42,13 +42,16 @@ BOOL _showHidden; NSString* _title; NSString* _header; + NSString* _prologue; + NSString* _epilogue; NSString* _footer; } @end @implementation GCDWebUploader -@synthesize uploadDirectory=_uploadDirectory, delegate=_delegate, allowedFileExtensions=_allowedExtensions, showHiddenFiles=_showHidden, title=_title, header=_header, footer=_footer; +@synthesize uploadDirectory=_uploadDirectory, delegate=_delegate, allowedFileExtensions=_allowedExtensions, showHiddenFiles=_showHidden, + title=_title, header=_header, prologue=_prologue, epilogue=_epilogue, footer=_footer; - (BOOL)_checkFileExtension:(NSString*)fileName { if (_allowedExtensions && ![_allowedExtensions containsObject:[[fileName pathExtension] lowercaseString]]) { @@ -93,15 +96,6 @@ // Web page [self addHandlerForMethod:@"GET" path:@"/" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) { - NSString* title = uploader.title; - if (title == nil) { - title = [NSString stringWithFormat:[siteBundle localizedStringForKey:@"TITLE" value:@"" table:nil], - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]]; - } - NSString* header = uploader.header; - if (header == nil) { - header = [siteBundle localizedStringForKey:@"HEADER" value:@"" table:nil]; - } #if TARGET_OS_IPHONE NSString* device = [[UIDevice currentDevice] name]; #else @@ -111,17 +105,35 @@ NSString* device = [(id)SCDynamicStoreCopyComputerName(NULL, NULL) autorelease]; #endif #endif + NSString* title = uploader.title; + if (title == nil) { + title = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; + } + NSString* header = uploader.header; + if (header == nil) { + header = title; + } + NSString* prologue = uploader.prologue; + if (prologue == nil) { + prologue = [siteBundle localizedStringForKey:@"PROLOGUE" value:@"" table:nil]; + } + NSString* epilogue = uploader.epilogue; + if (epilogue == nil) { + epilogue = [siteBundle localizedStringForKey:@"EPILOGUE" value:@"" table:nil]; + } NSString* footer = uploader.footer; if (footer == nil) { - footer = [NSString stringWithFormat:[siteBundle localizedStringForKey:@"FOOTER" value:@"" table:nil], + footer = [NSString stringWithFormat:[siteBundle localizedStringForKey:@"FOOTER_FORMAT" value:@"" table:nil], [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"], [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]]; } return [GCDWebServerDataResponse responseWithHTMLTemplate:[siteBundle pathForResource:@"index" ofType:@"html"] variables:@{ + @"device": device, @"title": title, @"header": header, - @"device": device, + @"prologue": prologue, + @"epilogue": epilogue, @"footer": footer }]; @@ -322,6 +334,8 @@ [_allowedExtensions release]; [_title release]; [_header release]; + [_prologue release]; + [_epilogue release]; [_footer release]; [super dealloc];