Permalink
Browse files

Added session time info to session detail pane; added 'More Info' act…

…ion; Made table cells non-selectable; added mo-bettah flavah
  • Loading branch information...
1 parent 78ade10 commit a3de489927331b5d6876b27edbc3ce1405c65f0c Michael Nachbaur committed Feb 13, 2011
@@ -205,6 +205,7 @@ - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPa
switch (indexPath.row) {
case 0:
cell.textLabel.text = NSLocalizedString(@"iYAPC is a conference assistance tool to help the Perl Community and its attendees manage their schedules, discover conferences, and interact with other developers at Perl-related conferences and workshops. It was written by Decaf Ninja Software and released to the community as Open Source Software.", nil);
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
break;
case 1: {
@@ -8,6 +8,7 @@
#import "SessionDetailViewController.h"
#import <QuartzCore/QuartzCore.h>
+#import "WebViewController.h"
typedef enum {
SessionDetailViewControllerSectionDescription,
@@ -89,8 +90,9 @@ - (void)updateSessionObject {
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
+
NSString *startTimeStr = [dateFormatter stringFromDate:self.sessionObject.startTime];
- NSString *durationStr = [NSString stringWithFormat:@"%@ minutes", self.sessionObject.duration];
+ NSString *durationStr = [NSString stringWithFormat:NSLocalizedString(@"%@ minutes", nil), self.sessionObject.duration];
self.navigationItem.title = self.sessionObject.title;
_summaryHeader.titleLabel.text = self.sessionObject.title;
@@ -105,30 +107,68 @@ - (void)updateSessionObject {
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.section) {
case SessionDetailViewControllerSectionDescription: {
- cell.textLabel.text = self.sessionObject.summary;
+ switch (indexPath.row) {
+ case 0:
+ cell.textLabel.text = self.sessionObject.summary;
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
+ break;
+
+ case 1:
+ cell.textLabel.text = NSLocalizedString(@"More information", nil);
+ cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
+
+ default:
+ break;
+ }
break;
}
case SessionDetailViewControllerSectionPresenter: {
break;
}
- /*
+
case SessionDetailViewControllerSectionInfo: {
+ NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
+ [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
+ [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
+
switch (indexPath.row) {
case 0:
+ cell.textLabel.text = NSLocalizedString(@"Begins", nil);
+ cell.detailTextLabel.text = [dateFormatter stringFromDate:self.sessionObject.startTime];
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
+ break;
+
+ case 1:
+ cell.textLabel.text = NSLocalizedString(@"Ends", nil);
+ cell.detailTextLabel.text = [dateFormatter stringFromDate:self.sessionObject.endTime];
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
+ break;
+ case 2:
+ cell.textLabel.text = NSLocalizedString(@"Room", nil);
+ cell.detailTextLabel.text = self.sessionObject.room;
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
break;
default:
break;
}
break;
- }*/
-
+ }
+
case SessionDetailViewControllerSectionActions: {
+ switch (indexPath.row) {
+ case 0:
+
+ break;
+
+ default:
+ break;
+ }
break;
}
-
+
default:
break;
}
@@ -157,8 +197,16 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege
switch (section) {
case SessionDetailViewControllerSectionDescription:
return _summaryHeader.bounds.size.height;
+
+ case SessionDetailViewControllerSectionPresenter:
+ return [self.sessionObject.presenters count] > 0 ? 14.0 : 0.0;
+
+ default:
+ return 0.0;
}
-
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 0.0;
}
@@ -169,9 +217,9 @@ - (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteg
case 0:
return nil;
case 1:
- return @"Presenter";
+ return NSLocalizedString(@"Presenter", nil);
default:
- return @"Presenters";
+ return NSLocalizedString(@"Presenters", nil);
}
}
}
@@ -185,27 +233,41 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
return [self.sessionObject.summary sizeWithFont:[UIFont systemFontOfSize:14.0]
constrainedToSize:CGSizeMake(self.view.frame.size.width - 20, MAXFLOAT)
lineBreakMode:UILineBreakModeWordWrap].height + 20;
-
+
default:
return 44.0;
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ int rowCount = 0;
+
switch (section) {
// Show the session description, if it has summary text
- case SessionDetailViewControllerSectionDescription:
- return [self.sessionObject.summary length] > 0 ? 1 : 0;
+ case SessionDetailViewControllerSectionDescription: {
+ if ([self.sessionObject.summary length] > 0)
+ rowCount++;
+ if ([self.sessionObject.url length] > 0)
+ rowCount++;
+
+ return rowCount;
+ }
// Show the list of presenters if there are any
case SessionDetailViewControllerSectionPresenter:
return [self.sessionObject.presenters count];
- case SessionDetailViewControllerSectionActions:
- return 0;
+ case SessionDetailViewControllerSectionInfo: {
+ rowCount = 2;
+ if ([self.sessionObject.room length] > 0)
+ rowCount++;
+ return rowCount;
+ }
+
+ case SessionDetailViewControllerSectionActions:
default:
- return 0;
+ return rowCount;
}
}
@@ -218,6 +280,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
case SessionDetailViewControllerSectionPresenter:
break;
+ case SessionDetailViewControllerSectionInfo: {
+ cellIdentifier = @"DetailSectionInfo";
+ cellStyle = UITableViewCellStyleValue1;
+ break;
+ }
+
case SessionDetailViewControllerSectionActions: {
cellIdentifier = @"DetailSectionAction";
cellStyle = UITableViewCellStyleSubtitle;
@@ -249,7 +317,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
- (NSIndexPath*)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- if (indexPath.section == SessionDetailViewControllerSectionDescription)
+ if (indexPath.section == SessionDetailViewControllerSectionDescription && indexPath.row == 0)
return nil;
return indexPath;
@@ -259,14 +327,18 @@ - (NSIndexPath*)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSI
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- // Navigation logic may go here. Create and push another view controller.
- /*
- <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
- // ...
- // Pass the selected object to the new view controller.
- [self.navigationController pushViewController:detailViewController animated:YES];
- [detailViewController release];
- */
+ switch (indexPath.section) {
+ case SessionDetailViewControllerSectionDescription:
+ if (indexPath.row == 1) {
+ WebViewController *controller = [[[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil] autorelease];
+ controller.url = [NSURL URLWithString:self.sessionObject.url];
+ [self.navigationController pushViewController:controller animated:YES];
+ }
+ break;
+
+ default:
+ break;
+ }
}
@@ -15,9 +15,11 @@
IBOutlet UIBarButtonItem *_backItem;
IBOutlet UIBarButtonItem *_forwardItem;
IBOutlet UIBarButtonItem *_reloadItem;
+ NSURL *_url;
}
@property (nonatomic, retain) IBOutlet UIWebView *webView;
+@property (nonatomic, copy) NSURL *url;
- (IBAction)close:(id)sender;
- (IBAction)goBack:(id)sender;
@@ -17,11 +17,17 @@ - (void)updateBarButtonItems;
@implementation WebViewController
@synthesize webView = _webView;
+@synthesize url = _url;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ [self.webView loadRequest:[NSURLRequest requestWithURL:self.url]];
+}
+
- (void)viewDidUnload {
self.webView = nil;
@@ -27,6 +27,7 @@
@property (nonatomic, retain) NSString * startTimeSection;
@property (nonatomic, retain) NSNumber * duration;
@property (nonatomic, retain) NSDate * startTime;
+@property (nonatomic, retain) NSDate * endTime;
@property (nonatomic, retain) NSSet* attendees;
@property (nonatomic, retain) NSSet* presenters;
@property (nonatomic, retain) TrackModel * track;
@@ -25,6 +25,7 @@ @implementation SessionModel
@dynamic startTimeSection;
@dynamic duration;
@dynamic startTime;
+@dynamic endTime;
@dynamic attendees;
@dynamic presenters;
@dynamic track;
@@ -39,4 +40,8 @@ - (NSString*)startTimeSection {
return [dateFormatter stringFromDate:self.startTime];
}
+- (NSDate*)endTime {
+ return [self.startTime dateByAddingTimeInterval:[self.duration floatValue] * 60.0];
+}
+
@end
Binary file not shown.
Binary file not shown.

0 comments on commit a3de489

Please sign in to comment.