/*
Copyright (c) 2008, 2009 Lee Barney
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
The end-user documentation included with the redistribution, if any, must
include the following acknowledgment:
"This product was created using the QuickConnect framework. http://quickconnect.sourceforge.net/",
in the same place and form as other third-party acknowledgments. Alternately, this acknowledgment
may appear in the software itself, in the same form and location as other
such third-party acknowledgments.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#import "PickResultsVCO.h"
#import "QuickConnectViewController.h"
#import "SBJSON.h"
@implementation PickResultsVCO
+ (id) doCommand:(NSArray*) parameters{
QuickConnectViewController *aController = (QuickConnectViewController*)[parametersobjectAtIndex:0];
UIPickerView *aPicker = [[aController webView] picker];
[aController webView].picker = nil;
if([aPicker isKindOfClass:[UIDatePicker class]]){
NSDate *aDate = ((UIDatePicker*)aPicker).date;
NSString *aDateString = [aDate description];
MESSAGE(aDateString);
NSMutableArray *passingArray = [[NSMutableArray alloc] initWithCapacity:1];
[passingArray addObject:aDateString];
SBJSON *generator = [SBJSON alloc];
NSError *error;
NSString *paramsToPass = [generator stringWithObject:passingArray error:&error];
NSString *jsString = [[NSString alloc] initWithFormat:@"handleJSONRequest('showPickResults', '%@')", paramsToPass];
MESSAGE(jsString);
[[aController webView] stringByEvaluatingJavaScriptFromString:jsString];
}
[aPicker removeFromSuperview];
return nil;
//build the JavaScript string to make the call to deliver the data
/*
[NSString stringWithFormat:@"%@ - %d",
[pickerViewArray objectAtIndex:[pickerView selectedRowInComponent:0]], [pickerView selectedRowInComponent:1]];
*/
}
@end