33 -(void) viewDidLoad { |
33 -(void) viewDidLoad { |
34 [super viewDidLoad]; |
34 [super viewDidLoad]; |
35 |
35 |
36 NSMutableArray *array_na = [[NSMutableArray alloc] init]; |
36 NSMutableArray *array_na = [[NSMutableArray alloc] init]; |
37 NSMutableArray *array_cm = [[NSMutableArray alloc] init]; |
37 NSMutableArray *array_cm = [[NSMutableArray alloc] init]; |
38 |
38 |
39 for (NSString *name in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FLAGS_DIRECTORY() error:NULL]) { |
39 for (NSString *name in [[NSFileManager defaultManager] contentsOfDirectoryAtPath:FLAGS_DIRECTORY() error:NULL]) { |
40 if ([name hasPrefix:@"cm_"]) { |
40 if ([name hasPrefix:@"cm_"]) { |
41 NSString *processed = [name substringFromIndex:3]; |
41 NSString *processed = [name substringFromIndex:3]; |
42 [array_cm addObject:processed]; |
42 [array_cm addObject:processed]; |
43 } else |
43 } else |
44 [array_na addObject:name]; |
44 [array_na addObject:name]; |
45 } |
45 } |
46 |
46 |
47 self.flagArray = array_na; |
47 self.flagArray = array_na; |
48 [array_na release]; |
48 [array_na release]; |
49 self.communityArray = array_cm; |
49 self.communityArray = array_cm; |
50 [array_cm release]; |
50 [array_cm release]; |
51 |
51 |
133 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
133 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { |
134 int newRow = [indexPath row]; |
134 int newRow = [indexPath row]; |
135 int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; |
135 int oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1; |
136 int newSection = [indexPath section]; |
136 int newSection = [indexPath section]; |
137 int oldSection = (lastIndexPath != nil) ? [lastIndexPath section] : -1; |
137 int oldSection = (lastIndexPath != nil) ? [lastIndexPath section] : -1; |
138 |
138 |
139 if (newRow != oldRow || newSection != oldSection) { |
139 if (newRow != oldRow || newSection != oldSection) { |
140 NSString *flag = nil; |
140 NSString *flag = nil; |
141 if ([indexPath section] == 0) |
141 if ([indexPath section] == 0) |
142 flag = [self.flagArray objectAtIndex:newRow]; |
142 flag = [self.flagArray objectAtIndex:newRow]; |
143 else |
143 else |
144 flag = [NSString stringWithFormat:@"cm_%@",[self.communityArray objectAtIndex:newRow]]; |
144 flag = [NSString stringWithFormat:@"cm_%@",[self.communityArray objectAtIndex:newRow]]; |
145 |
145 |
146 // if the two selected rows differ update data on the hog dictionary and reload table content |
146 // if the two selected rows differ update data on the hog dictionary and reload table content |
147 [self.teamDictionary setValue:[flag stringByDeletingPathExtension] forKey:@"flag"]; |
147 [self.teamDictionary setValue:[flag stringByDeletingPathExtension] forKey:@"flag"]; |
148 |
148 |
149 // tell our boss to write this new stuff on disk |
149 // tell our boss to write this new stuff on disk |
150 [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; |
150 [[NSNotificationCenter defaultCenter] postNotificationName:@"setWriteNeedTeams" object:nil]; |