Load XMLHttpRequest conditionally (< IE9)

This commit is contained in:
Francis Lachapelle
2013-12-18 22:18:08 -05:00
parent a1bec0e995
commit 59ce12a51b
5 changed files with 422 additions and 239 deletions
+16 -4
View File
@@ -1,8 +1,8 @@
/* SOGoIEConditional.m - this file is part of SOGo
*
* Copyright (C) 2007 Inverse inc.
* Copyright (C) 2007-2013 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Author: Inverse <info@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WOResponse.h>
#import <NGObjWeb/WOAssociation.h>
#import "SOGoIEConditional.h"
@@ -34,7 +35,10 @@
if ((self = [super initWithName: name
associations: associations
template: newTemplate]))
ASSIGN (template, newTemplate);
{
ASSIGN (template, newTemplate);
lte = OWGetProperty(associations, @"lte");
}
return self;
}
@@ -42,13 +46,21 @@
- (void) dealloc
{
[template release];
[lte release];
[super dealloc];
}
- (void) appendToResponse: (WOResponse *) response
inContext: (WOContext *) context
{
[response appendContentString: @"<!--[if IE]>"];
NSString *condition;
if (lte)
condition = [NSString stringWithFormat: @"<!--[if lte IE %d ]>", [lte intValueInComponent: [context component]]];
else
condition = @"<!--[if IE]>";
[response appendContentString: condition];
[template appendToResponse: response inContext: context];
[response appendContentString: @"<![endif]-->"];
}