Skip to content

Commit

Permalink
Merge branch 'master' of github.com:xyc0562/iPlan
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangying committed Jul 17, 2011
2 parents e4e4121 + 1cb5495 commit 0534745
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
11 changes: 9 additions & 2 deletions Classes/CalendarViewController.m
Expand Up @@ -50,11 +50,17 @@ - (void) configureView
{
//read in data from Model Logic



SharedAppDataObject* theDataObject = [self theAppDataObject];
NSMutableArray* defaultAnswer = [[ModelLogic modelLogic] getSelectedGroupsInfo];
// add in imageview
[scrollView addSubview:imageView];
theDataObject.image = self.imageView;
printf("active moudle %d\n",[[theDataObject activeModules]count]);
if([theDataObject activeModules]&&[[theDataObject activeModules]count]!=0)
{
NSMutableArray* defaultAnswer = [[ModelLogic modelLogic] getSelectedGroupsInfo];
// add in imageview

for (NSDictionary* dict in defaultAnswer)
{
NSString* moduleCode = [dict objectForKey:@"moduleCode"];
Expand Down Expand Up @@ -154,6 +160,7 @@ - (void) configureView
}

}
}

- (void) configureToolBar
{
Expand Down
11 changes: 10 additions & 1 deletion Classes/IVLEWebViewController.m
Expand Up @@ -16,6 +16,9 @@
#define EXPORT_TO_IVLE_FAIL @"Sorry, can not connect server!"
#define API_KEY @"K6vDt3tA51QC3gotLvPYf"

#define USERNAME @"u0602684"
#define PASSWORD @"tomrlq#04"


@implementation IVLEWebViewController

Expand Down Expand Up @@ -108,7 +111,13 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView{
[acadYear release];
[semester release];
}else if ([requestURL.absoluteString isEqualToString:@"https://ivle.nus.edu.sg/api/login/?apikey=K6vDt3tA51QC3gotLvPYf"]) {
//do nothing
NSString *loadUsernameJS = [NSString stringWithFormat:@"document.forms['frm'].userid.value ='%@'", USERNAME];
NSString *loadPasswordJS = [NSString stringWithFormat:@"document.forms['frm'].password.value ='%@'", PASSWORD];


//autofill the form
[self.ivlePage stringByEvaluatingJavaScriptFromString: loadUsernameJS];
[self.ivlePage stringByEvaluatingJavaScriptFromString: loadPasswordJS];
}
/*else{
NSString *xml_file = [self.ivlePage stringByEvaluatingJavaScriptFromString:@"document.getElementById"];
Expand Down
35 changes: 19 additions & 16 deletions Classes/ModuleListViewController.m
Expand Up @@ -277,23 +277,26 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
if(alertView.message == SURE_TO_CHANGE_TO_CALENDAR)
{
ModelLogic* modelLogic = [ModelLogic modelLogic];
[modelLogic syncModulesWithBasket:[theDataObject activeModules]];
if ([[ModelLogic modelLogic] generateDefaultTimetableWithRequirements:[theDataObject requirements]])
if([[theDataObject activeModules]count]!=0)
{
//[[ModelLogic modelLogic]exportTimetableToiCalendar];
UINavigationController *controller = [self.tabBarController.viewControllers objectAtIndex:0];
[controller viewWillAppear:YES];
self.tabBarController.selectedViewController = controller;
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:NO_SOLUTION
delegate:self
cancelButtonTitle:@"Sure" otherButtonTitles:nil];

[alert show];
[alert release];

[modelLogic syncModulesWithBasket:[theDataObject activeModules]];
if ([[ModelLogic modelLogic] generateDefaultTimetableWithRequirements:[theDataObject requirements]])
{
//[[ModelLogic modelLogic]exportTimetableToiCalendar];
UINavigationController *controller = [self.tabBarController.viewControllers objectAtIndex:0];
[controller viewWillAppear:YES];
self.tabBarController.selectedViewController = controller;
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:NO_SOLUTION
delegate:self
cancelButtonTitle:@"Sure" otherButtonTitles:nil];

[alert show];
[alert release];

}
}
theDataObject.continueToCalendar = NO;
}else if (alertView.message == NO_SOLUTION) {
Expand Down

0 comments on commit 0534745

Please sign in to comment.