//
//  NewsDetailController.m
//  Axis
//
//  Created by Olivier Savard on 10-02-19.
//  Copyright 2010 OSInfo Informatique. All rights reserved.
//

#import "NewsDetailController.h"
#import "AsyncImageView.h"

@implementation NewsDetailController
@synthesize image;
@synthesize no;
@synthesize detail;
@synthesize texte;


/*
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        // Custom initialization
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	
	//ASYNC LOADING
	CGRect frame;
	frame.size.width=320; frame.size.height=280;
	frame.origin.x=0; frame.origin.y=0;
	AsyncImageView* asyncImage = [[[AsyncImageView alloc]
								   initWithFrame:frame] autorelease];
	asyncImage.tag = 999;
	NSString *stringUrl = [[NSString alloc] initWithFormat:@"http://www.web-k.org/os/imgs/%i.jpg",self.no];
	NSURL *url = [NSURL URLWithString:stringUrl];
	[asyncImage loadImageFromURL:url];
	[self.view addSubview:asyncImage];
	
	
	/*
	//LOADING LARGE IMAGE
	NSString* imageURL = [[NSString alloc] initWithFormat:@"http://www.web-k.org/os/imgs/%i.png",self.no];
	NSData* imageData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:imageURL]];
	UIImage* imageTemp = [[UIImage alloc] initWithData:imageData];
	image.image=imageTemp;*/
	self.detail.text=self.texte;
	
	
	/*
	NSString *urlAddress = [[NSString alloc] initWithFormat: @"http://www.web-k.org/os/index1.php",self.title];
	NSURL *url=[NSURL URLWithString:urlAddress];
	NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
	[webView loadRequest:requestObj]; */
    //[imageTemp release];
	//[imageData release];
	//[imageURL release];
	[stringUrl release];
	[super viewDidLoad];
}


/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
	self.image = nil;
	self.detail = nil;
}


- (void)dealloc {
	[image release];
	[detail release];
	[texte release];
    [super dealloc];
}


@end
