]> err.no Git - scalable-opengroupware.org/commitdiff
Working AnaisUidSelector, working redirects, some refactoring.
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 11 Aug 2004 20:52:08 +0000 (20:52 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 11 Aug 2004 20:52:08 +0000 (20:52 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@185 d1b88da0-ebda-0310-925b-ed51d893ca5b

14 files changed:
SOGo/UI/Anais/AnaisUidSelector.m
SOGo/UI/Anais/AnaisUidSelector.wox
SOGo/UI/Anais/ChangeLog
SOGo/UI/Anais/Version
SOGo/UI/Common/ChangeLog
SOGo/UI/Common/UIxPageFrame.m
SOGo/UI/SOGoUI/ChangeLog
SOGo/UI/SOGoUI/UIxComponent.h
SOGo/UI/SOGoUI/UIxComponent.m
SOGo/UI/SOGoUI/Version
SOGo/UI/Scheduler/ChangeLog
SOGo/UI/Scheduler/UIxCalView.m
SOGo/UI/Scheduler/Version
SOGo/UI/Scheduler/product.plist

index 00cc3e8ce318624019b16ae02fa4c4737b6e608d..b8d88315ab57c8cf16a2f8b01d19d2c50d26f14a 100644 (file)
     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
 
@@ -50,6 +55,7 @@
 - (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
index ac691ebcf89a64f996b215bf66daafac9fe67071..6446bd91bdb638d235586a03a59929c35aedde9d 100644 (file)
@@ -20,7 +20,7 @@
                            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>
index 677db86ec7df3e50710cf0901e730c62831af265..4e9952d6661c5bd74b9bd39d94264c3354b107a6 100644 (file)
@@ -1,3 +1,8 @@
+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)
index a5a614689bac1243dc1ae44137e1d2230327f86d..f285cb83eddc699e6d4f35f139f23c1d0cbfd6e1 100644 (file)
@@ -1,3 +1,3 @@
 # $Id: Version 165 2004-08-05 17:55:50Z znek $
 
-SUBMINOR_VERSION:=1
+SUBMINOR_VERSION:=2
index 64c4a54cc4f9b0db78b90a71f772f1e977121032..6a10f38d30ac1117a9d4e5903ed73e93f35760a5 100644 (file)
@@ -1,3 +1,8 @@
+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)
index a4a4d47a00a4b98c4d4633253cdb2e0af55b5b47..6f538e0257f3eb821cd09b166c5a0d11e7265ac9 100644 (file)
@@ -1,18 +1,14 @@
 // $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;
@@ -20,6 +16,7 @@
 @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 {
index dd0e9c11f771f645894ad9c9fa2126b7a05495a1..f545d9d8bca2b49b08735702d0dc401a63c2d2f9 100644 (file)
@@ -1,3 +1,7 @@
+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
index 937a183791d5e194826dba6de8b77e7f6d3c6d3c..359c7c8539bb76e137e8a19d39c93653e77dcd6d 100644 (file)
@@ -26,7 +26,7 @@
 
 #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;
 
index 8786220b830579d9e4589f41b9d97df9c681b70a..bb92702021984838fbc28eb8d891ffd786b8027d 100644 (file)
@@ -252,6 +252,34 @@ static NSMutableArray *abbrMonthLabelKeys = nil;
 }
 
 
+/* 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 {
index 0eb47da345be1d4c8ac5a363234ca3f2c77473cb..cab297dce179f93daddb8c8e20c17af86c0b5d3b 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=6
+SUBMINOR_VERSION:=7
index 0ef40a91423fd784d9b87cfd1fec06bf01b42224..7868b60d5d69617d6c1fa0cfd39bfd8c86701034 100644 (file)
@@ -1,3 +1,13 @@
+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
index 3edb7567e5dc29541c8c4d307034601f788c0a59..f153fc3612dee720d1099ba8a0899b2e8ec9d750 100644 (file)
@@ -5,6 +5,11 @@
 #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 */
index 27f42dca521c102631a68b11d5a0fab575d2dd28..93c8cd1ddfe4862984d2fe8dffb82de3a02d010b 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=16
+SUBMINOR_VERSION:=19
index 6af398008f97b42045baaf406fec7e8646f80166..d282d996c6da761064a7de7140ac3fbe2d942ec3 100644 (file)
           pageName    = "UIxAppointmentEditor"; 
           actionName  = "new";
         };
+        "show" = { 
+          protectedBy = "View";
+          pageName    = "UIxCalView"; 
+          actionName  = "redirectForUIDs";
+        };
       };
     };