mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-27 06:15:26 +00:00
merge of 'bc3bfc52f8785d114d335b22f794ece898dbd164'
and 'de4013a540009902497a1085be5975e4ff6c3a83' Monotone-Parent: bc3bfc52f8785d114d335b22f794ece898dbd164 Monotone-Parent: de4013a540009902497a1085be5975e4ff6c3a83 Monotone-Revision: cd1bb1e892161fcc358630fd5cf9f3c3511c886f Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-08-19T07:17:12 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -24,8 +24,14 @@
|
||||
#define UIXLISTVIEW_H
|
||||
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
#import <SoObjects/Contacts/SOGoContactGCSList.h>
|
||||
|
||||
@interface UIxListView : UIxComponent
|
||||
{
|
||||
NGVList *list;
|
||||
SOGoContactGCSList *co;
|
||||
id item;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -20,8 +20,103 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
#import <NGCards/NGVList.h>
|
||||
#import <NGCards/NGVCard.h>
|
||||
#import <NGCards/NGVCardReference.h>
|
||||
|
||||
#import "UIxListView.h"
|
||||
|
||||
@implementation UIxListView
|
||||
|
||||
|
||||
- (NSString *) listName
|
||||
{
|
||||
return [list fn];
|
||||
}
|
||||
|
||||
- (BOOL) hasNickname
|
||||
{
|
||||
return [list nickname] != nil;
|
||||
}
|
||||
- (NSString *) listNickname
|
||||
{
|
||||
return [list nickname];
|
||||
}
|
||||
|
||||
- (BOOL) hasDescription
|
||||
{
|
||||
return [list description] != nil;
|
||||
}
|
||||
- (NSString *) listDescription
|
||||
{
|
||||
return [list description];
|
||||
}
|
||||
|
||||
- (NSArray *) components
|
||||
{
|
||||
return [list cardReferences];
|
||||
}
|
||||
- (NSString *) itemText
|
||||
{
|
||||
NSString *rc;
|
||||
|
||||
rc = [NSString stringWithFormat: @"%@ <%@>",
|
||||
[item fn], [item email]];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) checkListReferences
|
||||
{
|
||||
NSMutableArray *invalid;
|
||||
NGVCardReference *card;
|
||||
int i, count;
|
||||
id test;
|
||||
|
||||
invalid = [NSMutableArray array];
|
||||
|
||||
count = [[list cardReferences] count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
card = [[list cardReferences] objectAtIndex: i];
|
||||
test = [[co container] lookupName: [card reference]
|
||||
inContext: context
|
||||
acquire: NO];
|
||||
if ([test isKindOfClass: [NSException class]])
|
||||
{
|
||||
NSLog (@"%@ not found", [card reference]);
|
||||
[invalid addObject: [card copy]];
|
||||
}
|
||||
}
|
||||
|
||||
count = [invalid count];
|
||||
if (count > 0)
|
||||
{
|
||||
for (i = 0; i < count; i++)
|
||||
[list deleteCardReference: [invalid objectAtIndex: i]];
|
||||
[co save];
|
||||
}
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) defaultAction
|
||||
{
|
||||
id rc;
|
||||
|
||||
co = [self clientObject];
|
||||
list = [co vList];
|
||||
|
||||
if (list)
|
||||
{
|
||||
[self checkListReferences];
|
||||
rc = self;
|
||||
}
|
||||
else
|
||||
rc = [NSException exceptionWithHTTPStatus: 404 /* Not Found */
|
||||
reason: @"could not locate contact"];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -9,4 +9,17 @@
|
||||
className="UIxPageFrame"
|
||||
title="name"
|
||||
const:popup="YES"
|
||||
>Unimplemented</var:component>
|
||||
>
|
||||
<h3 class="contactCardTitle"><var:string value="listName" /></h3>
|
||||
<var:if condition="hasNickname">
|
||||
<h4><var:string value="listNickname" /></h4>
|
||||
</var:if>
|
||||
<var:if condition="hasDescription">
|
||||
<div class="listDescription"><var:string value="listDescription" /></div>
|
||||
</var:if>
|
||||
<ul class="listComponents">
|
||||
<var:foreach list="components" item="item">
|
||||
<li><var:string value="itemText"/></li>
|
||||
</var:foreach>
|
||||
</ul>
|
||||
</var:component>
|
||||
|
||||
Reference in New Issue
Block a user