]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@54 d1b88da0-ebda-0310-925b-ed51d8...
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 21 Jun 2004 12:40:06 +0000 (12:40 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 21 Jun 2004 12:40:06 +0000 (12:40 +0000)
dbd/DSoDatabase.h
dbd/DSoDatabase.m
dbd/DSoDatabaseManager.m
dbd/DSoTable.h
dbd/DSoTable.m
dbd/DTable.m [new file with mode: 0644]
dbd/DTable.wox [new file with mode: 0644]
dbd/GNUmakefile
dbd/product.plist

index 48fc63bd1fa66054a8336efa50d66bd4519d907f..60324b5e5b33d04d2a6f8c0ec65c993c1d7f83e1 100644 (file)
 - (id)initWithHostName:(NSString *)_hostname port:(int)_port 
   databaseName:(NSString *)_dbname;
 
+/* accessors */
+
+- (NSString *)hostName;
+- (int)port;
+- (NSString *)databaseName;
+
 /* support */
 
 - (EOAdaptor *)adaptorInContext:(WOContext *)_ctx;
index 0663657dc9e9ccbbd994fe1bfe09a8091218abe2..b848a1ca5bad7bf62f704dfaaee03781c11e7834 100644 (file)
@@ -60,6 +60,8 @@
   return self->databaseName;
 }
 
+// TODO: add baseURL generation
+
 /* support */
 
 - (EOAdaptor *)adaptorInContext:(WOContext *)_ctx {
index 1529ba00dc283c639ae29f5932a9684797a71bab..c99b933d35501d13578f5c5007288396889782e5 100644 (file)
   return self->host;
 }
 
+- (id)container {
+  return [self host];
+}
+- (NSString *)nameInContainer {
+  return @"Databases";
+}
+
 /* name lookup */
 
 - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag {
index 7bfac9226e706d7311bf408d37df3a784891af06..cdad265ba92b8bdb627186f0285233b53d01544f 100644 (file)
 
 - (id)initWithName:(NSString *)_name inContainer:(id)_container;
 
+/* accessors */
+
+- (DSoDatabase *)database;
+- (NSString *)tableName;
+
+- (NSString *)hostName;
+- (int)port;
+- (NSString *)databaseName;
+
+/* support */
+
+- (EOAdaptor *)adaptorInContext:(WOContext *)_ctx;
+
 @end
 
 #endif /* __dbd_DSoTable_H__ */
index 88a1821c7d9dd6b472451e349227f168558be2d7..36df6c9e3dd1f2cecf127fef5aa15e93e3f9c9c0 100644 (file)
   [super dealloc];
 }
 
+/* accessors */
+
+- (DSoDatabase *)database {
+  return self->database;
+}
+- (NSString *)tableName {
+  return self->tableName;
+}
+
+- (NSString *)hostName {
+  return [[self database] hostName];
+}
+- (int)port {
+  return [[self database] port];
+}
+- (NSString *)databaseName {
+  return [[self database] databaseName];
+}
+
+- (id)container {
+  return [self database];
+}
+- (NSString *)nameInContainer {
+  return [self tableName];
+}
+
 /* support */
 
 - (EOAdaptor *)adaptorInContext:(WOContext *)_ctx {
diff --git a/dbd/DTable.m b/dbd/DTable.m
new file mode 100644 (file)
index 0000000..89d303c
--- /dev/null
@@ -0,0 +1,87 @@
+// $Id$
+
+#include <NGObjWeb/SoComponent.h>
+
+@class EOAdaptorChannel;
+
+@interface DTable : SoComponent
+{
+  EOAdaptorChannel *channel;
+  NSArray *columnNames;
+  id item;
+}
+
+@end
+
+#include "DSoTable.h"
+#include "common.h"
+
+@implementation DTable
+
+- (void)dealloc {
+  if ([self->channel isOpen])
+    [self->channel closeChannel];
+  [self->channel release];
+  
+  [self->columnNames release];
+  [self->item        release];
+  [super dealloc];
+}
+
+/* notifications */
+
+- (void)sleep {
+  if ([self->channel isOpen])
+    [self->channel closeChannel];
+  
+  [super sleep];
+}
+
+/* DB things */
+
+- (EOAdaptor *)adaptor {
+  return [(DSoTable *)[self clientObject] adaptorInContext:[self context]];
+}
+
+- (EOAdaptorChannel *)channel {
+  EOAdaptorContext *ctx;
+  
+  if (self->channel)
+    return self->channel;
+
+  ctx = [[self adaptor] createAdaptorContext];
+  self->channel = [[ctx createAdaptorChannel] retain];
+  if (![self->channel openChannel]) {
+    [self->channel release];
+    self->channel = nil;
+  }
+
+  return self->channel;
+}
+
+- (EOModel *)_describeModel {
+  NSArray *tableNames;
+  
+  tableNames = [NSArray arrayWithObject:[[self clientObject] tableName]];
+  return [[self channel] describeModelWithTableNames:tableNames];
+}
+
+/* accessors */
+
+- (void)setItem:(id)_item {
+  ASSIGN(self->item, _item);
+}
+- (id)item {
+  return self->item;
+}
+
+- (NSArray *)columnNames {
+  return self->columnNames;
+}
+
+- (NSString *)itemSlashLink {
+  // this suxx, a) we need to write code, b) we need to attach the / manually
+  return [[self item] stringByAppendingString:@"/"];
+}
+
+@end /* DTable */
diff --git a/dbd/DTable.wox b/dbd/DTable.wox
new file mode 100644 (file)
index 0000000..eb3ce5f
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version='1.0' standalone='yes'?>
+<var:component className="Frame" 
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:var="http://www.skyrix.com/od/binding"
+  xmlns:const="http://www.skyrix.com/od/constant"
+>
+
+Host:  <a href="../.."><var:string value="clientObject.hostName"/></a><br />
+Port:  <var:string value="clientObject.port"/><br />
+DB:    <a href=".."><var:string value="clientObject.databaseName"/></a><br />
+Table: <var:string value="clientObject.tableName"/><br />
+
+<h4>Columns</h4>
+<var:foreach list="columnNames" item="item">
+  <li><a var:href="itemSlashLink"><var:string value="item" /></a></li>
+</var:foreach>
+
+</var:component>
index 8520dc6733ca681844189fd79ae31cd801b83e5e..07f17ab735e97620a46a188287e59cda7f33db40 100644 (file)
@@ -23,6 +23,7 @@ dbd_OBJC_FILES += \
        DHostView.m             \
        DDatabaseManager.m      \
        DDatabase.m             \
+       DTable.m                \
 
 dbd_RESOURCE_FILES += \
        Version                 \
@@ -34,6 +35,7 @@ dbd_RESOURCE_FILES += \
        DHostView.wox           \
        DDatabaseManager.wox    \
        DDatabase.wox           \
+       DTable.wox              \
 
 dbd_WEBSERVER_RESOURCE_FILES +=
 
index fa25922985f814e935e5f201e85e2be2c927dc46..6d55643eee271c693e8e755dcafba2fb438cf0aa 100644 (file)
         "WebDAV Access" = "Authenticated";
       };
       methods = {
-        "index" = { 
+        index = { 
           protectedBy = "View";
           pageName    = "MainPage"; 
         };
-        "GET" = { // more or less a hack, see README
+        GET = { // more or less a hack, see README
           protectedBy = "View";
           pageName    = "MainPage"; 
         };
-        "connect" = { 
+        connect = { 
           protectedBy = "View";
           pageName    = "MainPage"; 
           actionName  = "connect";
@@ -43,7 +43,7 @@
     DSoHost = {
       superclass    = "DSoObject";
       methods = {
-        "index" = { 
+        index = { 
           protectedBy = "View";
           pageName    = "DHostView";
         };
     DSoTable = {
       superclass    = "DSoObject";
       methods = {
+        index = { 
+          protectedBy = "View";
+          pageName    = "DTable";
+        };
       };
     };
     DSoDatabase = {
       superclass    = "DSoObject";
       methods = {
-        "index" = { 
+        index = { 
           protectedBy = "View";
           pageName    = "DDatabase"; 
         };
@@ -66,7 +70,7 @@
     DSoDatabaseManager = {
       superclass    = "DSoObject";
       methods = {
-        "index" = { 
+        index = { 
           protectedBy = "View";
           pageName    = "DDatabaseManager"; 
         };