NSArray *calendarUIDs;
NSString *uid;
BOOL meTooChecked;
+ NSString *userUid;
}
- (NSString *)prettyUid;
+- (NSString *)userUid;
+
+- (NSString *)showHref;
- (NSString *)jsCode;
@end
#include "common.h"
+#include <NGObjWeb/SoUser.h>
@implementation AnaisUidSelector
- (void)dealloc {
[self->calendarUIDs release];
[self->uid release];
+ [self->userUid release];
[super dealloc];
}
}
+/* Href */
+
+- (NSString *)showHref {
+ return [self completeHrefForMethod:@"show"];
+}
+
+
+/* Helper */
+
+- (NSString *)userUid {
+ if(self->userUid)
+ return self->userUid;
+
+ ASSIGN(self->userUid, [[self user] login]);
+ return self->userUid;
+}
+
+- (NSString *)calendarUIDString {
+ return [[self calendarUIDs] componentsJoinedByString:@","];
+}
+
+
/* JavaScript */
- (NSString *)jsCode {
static NSString *script = \
- @"function submitUidList() {\n"
- @"}\n"
- @"function clearUidList() {\n"
- @" var o = document.getElementById('anaisUidList');\n"
+ @"function clearElementWithId(elemId) {\n"
+ @" var o = document.getElementById(elemId);\n"
@" var dst = o.parentNode;\n"
@" var n = document.createElement('td');\n"
- @" n.setAttribute('id', 'anaisUidList');\n"
+ @" n.setAttribute('id', elemId);\n"
@" dst.replaceChild(n, o);\n"
@"}\n"
+ @"function clearUidList() {\n"
+ @" clearElementWithId('anaisUIDList');\n"
+ @" var e = document.getElementById('anaisUIDString');\n"
+ @" e.setAttribute('value', '%@');\n"
+ @"}\n"
@"function addUid(division, cn, dn, email, uid, sn) {\n"
@" if(!uid)\n"
- @" uid='helge';\n"
- @" var td = document.getElementById('anaisUidList');\n"
+ @" uid='unknown';\n"
+ @" var td = document.getElementById('anaisUIDList');\n"
@" if(td.hasChildNodes())\n"
@" uid=', '+uid;\n"
@" var text = document.createTextNode(uid);\n"
@" td.appendChild(text);\n"
+ @" var e = document.getElementById('anaisUIDString');\n"
+ @" e.setAttribute('value', uid);\n"
@"}\n"
@"";
- return script;
+
+ return [NSString stringWithFormat:script,
+ [self userUid]];
}
@end
label:title="Search in Anais"
const:windowId="UidSelector"
const:callback="addUid"
- const:division="CC"
+ const:division="TEST"
/>
</td>
<td>
<var:string label:value="me too" />
</td>
<td class="button_auto_env">
- <a href="javascript:submitUidList()"
- class="button_auto"
- ><var:string label:value="show" /></a>
+ <form var:href="showHref">
+ <input type="hidden"
+ name="anaisUIDString"
+ id="anaisUIDString"
+ var:value="calendarUIDString"
+ />
+ <input type="hidden"
+ name="previousMethod"
+ var:value="ownMethodName"
+ />
+ <input type="submit" label:value="show" />
+ </form>
</td>
<td class="button_auto_env">
<a href="javascript:clearUidList()"
</td>
</tr>
<tr valign="middle">
- <td id="anaisUidList" align="left">
- <var:foreach list="calendarUIDs" item="uid">
- <var:string value="prettyUid" />
- </var:foreach>
- </td>
+ <td id="anaisUIDList"
+ align="left"
+ ><var:foreach list="calendarUIDs"
+ item="uid"
+ ><var:string value="prettyUid"
+ /></var:foreach></td>
</tr>
</table>
+2004-08-11 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * AnaisUidSelector.[m|wox]: much enhanced, but still not perfect
+ (v0.9.2)
+
2004-08-11 Marcus Mueller <znek@mulle-kybernetik.com>
* AnaisUidSelector.[m|wox]: added (v0.9.1)
# $Id: Version 165 2004-08-05 17:55:50Z znek $
-SUBMINOR_VERSION:=1
+SUBMINOR_VERSION:=2
+2004-08-11 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * UIxPageFrame subclasses from UIxComponent now, removed -SoUser
+ because it's now in UIxComponent. (v0.9.10)
+
2004-08-11 Marcus Mueller <znek@mulle-kybernetik.com>
* UIxPageFrame.wox, UIxAppNavView.m: added labels (v0.9.9)
// $Id$
-#include <NGObjWeb/SoComponent.h>
-#include <NGObjWeb/SoHTTPAuthenticator.h>
-#include <NGObjWeb/SoUser.h>
-
+#include <SOGoUI/UIxComponent.h>
-@interface UIxPageFrame : SoComponent
+@interface UIxPageFrame : UIxComponent
{
NSString *title;
NSString *rootURL;
NSString *userRootURL;
}
-- (SoUser *)user;
- (NSString *)rootURL;
- (NSString *)userRootURL;
- (NSString *)calendarRootURL;
@end
#include "common.h"
+#include <NGObjWeb/SoComponent.h>
@implementation UIxPageFrame
return self->title;
}
-- (SoUser *)user {
- WOContext *ctx;
-
- ctx = [self context];
- return [[[self clientObject] authenticatorInContext:ctx]
- userInContext:ctx];
-}
-
-- (NSString *)shortUserNameForDisplay {
- // TODO: better use a SoUser formatter?
- NSString *s;
- NSRange r;
-
- s = [[self user] login];
- if ([s length] < 10)
- return s;
-
- // TODO: algorithm might be inappropriate, depends on the actual UID
-
- r = [s rangeOfString:@"."];
- if (r.length == 0)
- return s;
-
- return [s substringToIndex:r.location];
-}
-
/* URL generation */
- (NSString *)rootURL {
+2004-08-11 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * UIxComponent.[hm]: added -SoUser (v0.9.7)
+
2004-08-10 Marcus Mueller <znek@mulle-kybernetik.com>
* v0.9.6
#include <NGObjWeb/SoComponent.h>
-@class NSCalendarDate, NSTimeZone, NSMutableDictionary;
+@class NSCalendarDate, NSTimeZone, NSMutableDictionary, SoUser;
@interface UIxComponent : SoComponent
- (NSString *)dateStringForDate:(NSCalendarDate *)_date;
- (NSCalendarDate *)dateForDateString:(NSString *)_dateString;
+/* SoUser */
+- (SoUser *)user;
+- (NSString *)shortUserNameForDisplay;
+
/* labels */
- (NSString *)labelForKey:(NSString *)_key;
}
+/* SoUser */
+
+- (SoUser *)user {
+ WOContext *ctx;
+
+ ctx = [self context];
+ return [[[self clientObject] authenticatorInContext:ctx]
+ userInContext:ctx];
+}
+
+- (NSString *)shortUserNameForDisplay {
+ // TODO: better use a SoUser formatter?
+ NSString *s;
+ NSRange r;
+
+ s = [[self user] login];
+ if ([s length] < 10)
+ return s;
+
+ // TODO: algorithm might be inappropriate, depends on the actual UID
+
+ r = [s rangeOfString:@"."];
+ if (r.length == 0)
+ return s;
+
+ return [s substringToIndex:r.location];
+}
+
/* labels */
- (NSString *)labelForKey:(NSString *)_str {
# $Id$
-SUBMINOR_VERSION:=6
+SUBMINOR_VERSION:=7
+2004-08-11 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * v0.9.19
+
+ * UIxCalView.m: implements -redirectForUIDsAction to construct a
+ redirect to a special appointment folder.
+
+ * product.plist: "show" method is mapped to UIxCalView's
+ -redirectForUIDsAction.
+
2004-08-11 Marcus Mueller <znek@mulle-kybernetik.com>
* v0.9.18
#include "UIxAppointmentFormatter.h"
#include <OGoContentStore/OCSFolder.h>
#include "SoObjects/Appointments/SOGoAppointmentFolder.h"
+#include <NGObjWeb/SoUser.h>
+
+@interface UIxCalView (PrivateAPI)
+- (NSString *)_userFolderURI;
+@end
@implementation UIxCalView
[_qp removeObjectForKey:@"day"];
}
+
+/* Actions */
+
+- (NSString *)_userFolderURI {
+ WOContext *ctx;
+ id obj;
+ NSURL *url;
+
+ ctx = [self context];
+ obj = [[ctx objectTraversalStack] objectAtIndex:1];
+ url = [NSURL URLWithString:[obj baseURLInContext:ctx]];
+ return [url path];
+}
+
+- (id)redirectForUIDsAction {
+ NSMutableString *uri;
+ NSString *uidsString, *loc, *prevMethod;
+ WOResponse *r;
+ WORequest *req;
+
+ req = [[self context] request];
+
+ uidsString = [req formValueForKey:@"anaisUIDString"];
+ uidsString = [uidsString stringByTrimmingWhiteSpaces];
+ if([uidsString length] == 0) {
+ // TODO: improve user experience ... (eg error panel like Zope)
+ return [NSException exceptionWithHTTPStatus:400 /* bad request */
+ reason:@"missing uids from request"];
+ }
+ prevMethod = [req formValueForKey:@"previousMethod"];
+ if(prevMethod == nil)
+ prevMethod = @"";
+
+ uri = [[NSMutableString alloc] initWithString:[self _userFolderURI]];
+ [uri appendString:@"/Groups/_custom_"];
+ [uri appendString:uidsString];
+ [uri appendString:@"/Calendar/"];
+ [uri appendString:prevMethod];
+
+ loc = [self completeHrefForMethod:uri]; /* this might return uri! */
+ r = [WOResponse responseWithRequest:req];
+ [r setStatus:302 /* moved */];
+ [r setHeader:loc forKey:@"location"];
+ [uri release];
+ return r;
+}
+
@end /* UIxCalView */
# $Id$
-SUBMINOR_VERSION:=16
+SUBMINOR_VERSION:=19
pageName = "UIxAppointmentEditor";
actionName = "new";
};
+ "show" = {
+ protectedBy = "View";
+ pageName = "UIxCalView";
+ actionName = "redirectForUIDs";
+ };
};
};