]> err.no Git - sope/commitdiff
added a flag to disable XML style generation of close tags
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Mon, 7 Mar 2005 19:22:15 +0000 (19:22 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Mon, 7 Mar 2005 19:22:15 +0000 (19:22 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@630 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

26 files changed:
GNUmakefile
sope-appserver/NGObjWeb/ChangeLog
sope-appserver/NGObjWeb/DynamicElements/WOActiveImage.m
sope-appserver/NGObjWeb/DynamicElements/WOCheckBox.m
sope-appserver/NGObjWeb/DynamicElements/WOCheckBoxList.m
sope-appserver/NGObjWeb/DynamicElements/WOEmbeddedObject.m
sope-appserver/NGObjWeb/DynamicElements/WOFileUpload.m
sope-appserver/NGObjWeb/DynamicElements/WOFrame.m
sope-appserver/NGObjWeb/DynamicElements/WOGenericElement.m
sope-appserver/NGObjWeb/DynamicElements/WOHiddenField.m
sope-appserver/NGObjWeb/DynamicElements/WOImage.m
sope-appserver/NGObjWeb/DynamicElements/WOImageButton.m
sope-appserver/NGObjWeb/DynamicElements/WOMetaRefresh.m
sope-appserver/NGObjWeb/DynamicElements/WOPasswordField.m
sope-appserver/NGObjWeb/DynamicElements/WORadioButton.m
sope-appserver/NGObjWeb/DynamicElements/WORadioButtonList.m
sope-appserver/NGObjWeb/DynamicElements/WOResetButton.m
sope-appserver/NGObjWeb/DynamicElements/WOString.m
sope-appserver/NGObjWeb/DynamicElements/WOSubmitButton.m
sope-appserver/NGObjWeb/DynamicElements/WOTextField.m
sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m
sope-appserver/NGObjWeb/DynamicElements/common.h
sope-appserver/NGObjWeb/NGObjWeb/WOContext.h
sope-appserver/NGObjWeb/Version
sope-appserver/NGObjWeb/WOContext.m
sope-appserver/NGObjWeb/WOElementID.h

index f85f2c0df74899619ca8af29b9258c6d150ed219..60b164aaf77fb540cd26d39c2400c04e844b1e4e 100644 (file)
@@ -1,4 +1,4 @@
-# Note: could be that it may not fully compile 'inline'
+# GNUstep makefile
 
 -include ./config.make
 include $(GNUSTEP_MAKEFILES)/common.make
index 68813711e0f733803ba505053738ca978c8d915e..a3480ffed5bca19135b4666605185926dbd3c1ce 100644 (file)
@@ -1,5 +1,16 @@
 2005-03-07  Helge Hess  <helge.hess@opengroupware.org>
 
+       * v4.5.131
+
+       * WOElementID.h: lowered max element nesting to 126 due to limited
+         scope of ivar (hopefully doesn't trigger #1281)
+       
+       * DynamicElements: added support for empty non-XML tags (generate
+         empty tags without the " />")
+
+       * WOContext.m: changed ivars (bumped class version to 8), added a flag
+         for generating XML empty elements (to be checked by dynamic elements)
+
        * DynamicElements/WOForm.m: consume 'multipleSubmit' association for
          WO compatibility as requested by Stephane (v4.5.130)
 
index c7b9df97aa5d90286dfd4a8e0f132cd8f67185d1..07574d188d322631455d03de3d81f12f18869145 100644 (file)
@@ -23,7 +23,7 @@
   Not implemented yet.
 
   Sample (Client side):
-<MAP NAME="FrontPageMap0">
+    <MAP NAME="FrontPageMap0">
      <AREA SHAPE="RECT" COORDS="0, 0, 779, 70" HREF="../index.html">
      <AREA SHAPE="RECT" COORDS="632, 76, 732, 87" HREF="../stellen/index.html">
      <AREA SHAPE="RECT" COORDS="544, 75, 595, 88" HREF="../kontakt/index.html">
index 4767b17cff2d7eed661e7fd030a7365419472eaf..70c7f17ba48835ec2ac2c0a2fee432a4d67edc66 100644 (file)
                            [self->otherTagString stringValueInComponent:
                                                    [_ctx component]]);
     }
-    WOResponse_AddCString(_response, " />\n");
+    
+    if (_ctx->wcFlags.xmlStyleEmptyElements) {
+      WOResponse_AddCString(_response, " />\n");
+    }
+    else {
+      WOResponse_AddCString(_response, ">\n");
+    }
   }
 }
 
index 0f457c13c39aa4bc6ee5952b6fba3839aa29e028..077f95fcc19c944066896d3ba0e84089f0bbed6c 100644 (file)
                                  [self->otherTagString stringValueInComponent:
                                                          [_ctx component]]);
           }
-          WOResponse_AddCString(_response, " />");
-  
+         WOResponse_AddEmptyCloseParens(_response, _ctx);
+         
           // the value in a checkbox list is the string besides the checkbox
           if (self->value) {
             WOResponse_AddHtmlString(_response,
index 0ddd11c69cee8905dc469c43c10673f0c523a092..4a24a336bb946989ba8a9b2c208f4ee701398dcc 100644 (file)
                            [self->otherTagString stringValueInComponent:
                                                    [_ctx component]]);
     }
-    WOResponse_AddCString(_response, " />");
+    WOResponse_AddEmptyCloseParens(_response, _ctx);
   }
 }
 
index c4ce1019aefaed1808e75c9fd51acca0532a87fb..a0fd3decb8199879c2dc1deb7b742e65f2a6ce65 100644 (file)
@@ -176,7 +176,7 @@ static NGMimeType *multipartFormData = nil;
                         [self->otherTagString stringValueInComponent:
                                 [_ctx component]]);
   }
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 /* description */
index 7ffaeebbe0692d753e90a2c6fd2aafae4092e3a7..30ad7654b06236bec6b8cc5258701ad62d654aeb 100644 (file)
                          [self->otherTagString stringValueInComponent:
                               [_ctx component]]);
   }
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 // description
index b2a32e1484ef017537313fb656234d6a9e46e8b7..429efb014d28fef04688a51316b47c61239ad7b0 100644 (file)
@@ -236,7 +236,7 @@ typedef struct {
                          [self->otherTagString stringValueInComponent:
                            sComponent]);
   }
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 @end /* WOGenericElement */
index 49542a655d82d3f1c490ce99c6a95164b05c5099..c4f8316e599f93ddbaa284c20f8fa2c8257a2e55 100644 (file)
@@ -66,7 +66,7 @@
                              [self->otherTagString stringValueInComponent:
                                   [_ctx component]]);
       }
-      WOResponse_AddCString(_response, " />");
+      WOResponse_AddEmptyCloseParens(_response, _ctx);
     }
   }
 }
index 4a8c69ad57b86f7e7f362ae5ea8f506af1eff1cd..b483d8d9acc3240da854523e6c5d49ad7513ebba 100644 (file)
                               [_ctx component]]);
   }
   
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 @end /* WOImage */
index 8e3bd41b2ec7e188f8a972d027d93ff6f4b018a9..77d25d3dc5ec63af3121aa9f9809f9c8770a5196 100644 (file)
                          [self->otherTagString stringValueInComponent:
                               [_ctx component]]);
   }
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 /* description */
index abf8ed7923ccaeda5c093d2ff652bf9715ecd35c..83fa4c4b65bc941001b99b0fc76f0453203bf918 100644 (file)
                          [self->otherTagString stringValueInComponent:
                               [_ctx component]]);
   }
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 /* description */
index 9d13b02d247460dacce2d983df903521cfe7abb8..f76d1976c12ef0af127c8e35d5afec925764fb21 100644 (file)
@@ -78,7 +78,7 @@
                          [self->otherTagString stringValueInComponent:
                               [_ctx component]]);
   }
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 /* description */
index afba1d247169e69f77839e3622ab54c8ce4e63e9..b5b479c04fdbe536ff10165567e98a34184a8922 100644 (file)
                          [self->otherTagString stringValueInComponent:
                               sComponent]);
   }
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 /* description */
index bc6420ac796303458a027e47f3543e0b1a918068..8c8980c2b44323ba3ca77387026f488551ad2918 100644 (file)
                             [self->otherTagString stringValueInComponent:
                                     [_ctx component]]);
       }
-      WOResponse_AddCString(_response, " />");
-
+      WOResponse_AddEmptyCloseParens(_response, _ctx);
+  
       // the value in a radio list is the string besides the button
       if (self->value) {
        NSString *s;
index 44a082a3e3b7177cb70360f8dbc1db63f290167f..e6cab87ff8dcf61bda5117dd6c825d386ab8d2c7 100644 (file)
@@ -56,7 +56,8 @@
                          [self->otherTagString stringValueInComponent:
                               [_ctx component]]);
   }
-  WOResponse_AddCString(_response, " />");
+  
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 @end /* WOResetButton */
index 4f04ce62c38182f26a2d4bc035b67086be01dd6d..4dbd5e89d66736c807dd5ccc01fa702552c4010b 100644 (file)
@@ -622,7 +622,9 @@ static WOAssociation *yesAssoc = nil;
     [_response performSelector:addSel withObject:obj];
   }
   else {
-    [self _appendStringLines:obj withSeparator:@"<br />"
+    [self _appendStringLines:obj 
+         withSeparator:
+           (_ctx->wcFlags.xmlStyleEmptyElements ? @"<br />" : @"<br>")
           contentSelector:addSel toResponse:_response inContext:_ctx];
   }
   
index db84b6c5b85c3b2bf44806dc07df4277e9c26362..6314dd6cc9b526ea9bfa03356ac5629d2ebea1f0 100644 (file)
                          [self->otherTagString stringValueInComponent:
                               [_ctx component]]);
   }
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 /* description */
index 14d54564f57c0d2eeaf1b2e33c22df196d4c3f69..72aad322704e4121f9dd8b9ea84c3678711e7cea 100644 (file)
@@ -212,7 +212,7 @@ static inline NSFormatter *_getFormatter(WOTextField *self, WOContext *_ctx) {
                          [self->otherTagString stringValueInComponent:
                               [_ctx component]]);
   }
-  WOResponse_AddCString(_response, " />");
+  WOResponse_AddEmptyCloseParens(_response, _ctx);
 }
 
 /* description */
index 61a0a25b54e1b18c13bf1b7f11eb3e14b9d8ed74..2509c16e37d072c3905b733c3afc969e0f904c8d 100644 (file)
@@ -249,7 +249,8 @@ static Class NSURLClass = Nil;
   WOResponse_AddChar(_resp, '"');
   
   [self appendExtraAttributesToResponse:_resp inContext:_ctx];
-  WOResponse_AddCString(_resp, " />");
+  
+  WOResponse_AddEmptyCloseParens(_resp, _ctx);
 }
 
 - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
index dcfdf19f529038a33223e2c33a0489eaf554f0ce..03ec34353f12d3b05d6cef1ba2fb1ff452b1990f 100644 (file)
 
 #include <NGExtensions/NGExtensions.h>
 
+static inline void WOResponse_AddEmptyCloseParens(WOResponse *r, 
+                                                 WOContext *ctx) 
+{
+  if (ctx->wcFlags.xmlStyleEmptyElements) {
+    WOResponse_AddCString(r, " />");
+  }
+  else {
+    WOResponse_AddChar(r, '>');
+  }
+}
+
 #endif /* __NGObjWeb_DynElem_common_H__ */
index 9e064f45e4be546ba61a317daf2ab6830e418274..e60bf4e96cae9056b417cd68efe37a755be629e9 100644 (file)
   id          contentStack[NGObjWeb_MAX_COMPONENT_NESTING_DEPTH];
   signed char componentStackCount;
   
-  /* FORM support */
-  BOOL inForm;
-  id   activeFormElement;
-  
+  /* misc */
+  id       activeFormElement;
   NSString *qpJoin;
   
-  /* tracking component actions */
-  BOOL savePageRequired;
+@public /* need fast access to generation flags */
+  /* flags */
+  struct {
+    int savePageRequired:1; /* tracking component actions */
+    int inForm:1;
+    int xmlStyleEmptyElements:1;
+    int reserved:29;
+  } wcFlags;
   
+@protected
   /* SOPE */
   id             clientObject;
   NSMutableArray *traversalStack;
 - (NSURL *)serverURL;
 - (NSURL *)urlForKey:(NSString *)_key;
 
+- (void)setGenerateXMLStyleEmptyElements:(BOOL)_flag;
+- (BOOL)generateXMLStyleEmptyElements;
+
 /* variables */
 
 - (void)setObject:(id)_obj forKey:(NSString *)_key;
index 8e4d785ce5b69ec18911ee562a29fe92f923eaa8..c8be53a65303393aabe2907160d9cf64901da3fe 100644 (file)
@@ -1,6 +1,6 @@
 # version file
 
-SUBMINOR_VERSION:=130
+SUBMINOR_VERSION:=131
 
 # v4.5.122 requires libNGExtensions v4.5.153
 # v4.5.91  requires libNGExtensions v4.5.134
index f6c5c0de9663f8d09d49dce7b1c7238664716d5c..3e6f3cd9906cbc4bb79488ff91607e85bfab2ee0 100644 (file)
@@ -49,7 +49,7 @@ static Class WOAppClass = Nil;
 @implementation WOContext
 
 + (int)version {
-  return 7;
+  return 8;
 }
 
 static Class    WOContextClass       = Nil;
@@ -104,6 +104,9 @@ static NSString *WOApplicationSuffix = nil;
     sprintf(buf, "%03x%08x%08x", ++contextCount, (int)time(NULL), (int)self);
     self->ctxId = [[NSString alloc] initWithCString:buf];
     
+    /* per default close tags in XML style */
+    self->wcFlags.xmlStyleEmptyElements = 1;
+    
     self->elementID = [[WOElementID alloc] init];
     self->awakeComponents = [[NSMutableSet alloc] initWithCapacity:64];
     
@@ -333,7 +336,7 @@ static NSString *WOApplicationSuffix = nil;
 }
 
 - (BOOL)savePageRequired {
-  return self->savePageRequired;
+  return self->wcFlags.savePageRequired ? YES : NO;
 }
 
 /* cursors */
@@ -561,10 +564,10 @@ void WOContext_leaveComponent(WOContext *self, WOComponent *_component) {
 /* forms */
 
 - (void)setInForm:(BOOL)_form {
-  self->inForm = _form;
+  self->wcFlags.inForm = _form ? 1 : 0;
 }
 - (BOOL)isInForm {
-  return self->inForm;
+  return self->wcFlags.inForm ? YES : NO;
 }
 
 - (void)addActiveFormElement:(WOElement *)_formElement {
@@ -706,6 +709,13 @@ void WOContext_leaveComponent(WOContext *self, WOComponent *_component) {
   return self->qpJoin;
 }
 
+- (void)setGenerateXMLStyleEmptyElements:(BOOL)_flag {
+  self->wcFlags.xmlStyleEmptyElements = _flag ? 1 : 0;
+}
+- (BOOL)generateXMLStyleEmptyElements {
+  return self->wcFlags.xmlStyleEmptyElements ? YES : NO;
+}
+
 - (NSString *)queryStringFromDictionary:(NSDictionary *)_queryDict {
   NSEnumerator    *keys;
   NSString        *key;
@@ -770,7 +780,7 @@ void WOContext_leaveComponent(WOContext *self, WOComponent *_component) {
     NSMutableString *qs;
     NSString *p;
   
-    self->savePageRequired = YES;
+    self->wcFlags.savePageRequired = 1;
     qs = [MutableStrClass stringWithCapacity:64];
   
     [qs appendString:WORequestValueSenderID];
@@ -801,8 +811,8 @@ void WOContext_leaveComponent(WOContext *self, WOComponent *_component) {
     static NSMutableString *url = nil; // THREAD
     static IMP addStr = NULL;
     NSString *s;
-  
-    self->savePageRequired = YES;
+    
+    self->wcFlags.savePageRequired = 1;
     if (url == nil) {
       url = [[MutableStrClass alloc] initWithCapacity:256];
       addStr = [url methodForSelector:@selector(appendString:)];
index e8a4ad8c0422b4b4e73865d9b7ff95d36be2118c..48eed23a20cb5ec2c588c0d1626ea40de50431d5 100644 (file)
@@ -31,7 +31,7 @@
   element-id. An element id is a "path" to an object kept in a tree.
 */
 
-#define NGObjWeb_MAX_ELEMENT_ID_COUNT 128
+#define NGObjWeb_MAX_ELEMENT_ID_COUNT 126
 
 @class NSString, NSMutableString;