]> err.no Git - sope/commitdiff
added escapeJS/framework bindings to some elements
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Mon, 28 Mar 2005 15:31:09 +0000 (15:31 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Mon, 28 Mar 2005 15:31:09 +0000 (15:31 +0000)
added support for non-xml tag endings

git-svn-id: http://svn.opengroupware.org/SOPE/trunk@704 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

17 files changed:
sope-appserver/WOExtensions/ChangeLog
sope-appserver/WOExtensions/JSAlertPanel.api
sope-appserver/WOExtensions/JSAlertPanel.m
sope-appserver/WOExtensions/JSConfirmPanel.api
sope-appserver/WOExtensions/JSConfirmPanel.m
sope-appserver/WOExtensions/JSImageFlyover.api
sope-appserver/WOExtensions/JSImageFlyover.m
sope-appserver/WOExtensions/JSKeyHandler.m
sope-appserver/WOExtensions/JSModalWindow.api
sope-appserver/WOExtensions/JSModalWindow.m
sope-appserver/WOExtensions/JSValidatedField.api
sope-appserver/WOExtensions/JSValidatedField.m
sope-appserver/WOExtensions/Version
sope-appserver/WOExtensions/WOCheckBoxMatrix.m
sope-appserver/WOExtensions/WOCollapsibleComponentContent.api
sope-appserver/WOExtensions/WORadioButtonMatrix.m
sope-appserver/WOExtensions/WOTabPanel.m

index ed7e88ff33fd94d8cca3231be09c4d0671080ee1..db1dd918a48da37b091a07765ce422a4224890d5 100644 (file)
@@ -1,3 +1,31 @@
+2005-03-28  Stephane Corthesy  <stephane@sente.ch>
+       
+       * v4.5.23
+
+       * JSAlertPanel: added new bindings, escapeJS and framework;
+         fixed html 'onclick' attribute
+
+       * JSConfirmPanel: added new bindings, escapeJS and framework; replaced
+         deprecated 'language' html attribute by 'type'
+       
+       * JSImageFlyover.m: replaced deprecated 'language' html attribute by
+         'type'
+       
+       * JSModalWindow: added 'framework' binding
+       
+       * JSValidatedField: added new binding, escapeJS; replaced deprecated
+         'language' html attribute by 'type'
+       
+       * JSImageFlyover.api, WOCollapsibleComponentContent.api: added
+         defaults to framework binding
+
+2005-03-28  Helge Hess  <helge.hess@opengroupware.org>
+
+       * JSValidatedField.m, JSModalWindow.m, JSAlertPanel.m,
+         JSConfirmPanel.m, JSImageFlyover.m, WOCheckBoxMatrix.m,
+         WORadioButtonMatrix.m, WOTabPanel.m: minor code cleanups, added some
+         support for non-xml style elements
+
 2005-01-04  Marcus Mueller  <znek@mulle-kybernetik.com>
 
        * common.h, JSConfirmPanel.m, JSAlertPanel.m, JSImageFlyover.m,
index f8e4ba0e5d78bae64f132b3bb72b0fb9f7e410e8..28b04ea1b950c8d58f862d44b0dc8bfa1cf9d735 100644 (file)
   <binding name="targetWindow"/>
   <binding name="string"/>
 
+  <!-- SOPE -->
+  <binding name="escapeJS" defaults="YES/NO" />
+  <binding name="framework" defaults="Frameworks"/>
+
   <validation message="either one of &apos;action&apos;, &apos;pageName&apos;, or &apos;javaScriptFunction&apos; may be bound">
     <count test="!=1">
       <bound name="action"/>
index 3ed65cb4dc7396c6cc7f20116ab365c03c6bf096..3fd45d1db5ac6495f935dcfd2e9ee740f472dfa3 100644 (file)
   WOAssociation *targetWindow;
   WOAssociation *string;
   
+  /* non WO */
   WOElement     *template;
+  WOAssociation *escapeJS;
+  WOAssociation *framework;
 }
 
 @end
@@ -66,6 +69,8 @@
     self->filename           = WOExtGetProperty(_config,@"filename");
     self->targetWindow       = WOExtGetProperty(_config,@"targetWindow");
     self->string             = WOExtGetProperty(_config,@"string");
+    self->escapeJS           = WOExtGetProperty(_config,@"escapeJS");
+    self->framework          = WOExtGetProperty(_config,@"framework");
     
     funcCount = 0;
     if (self->action) funcCount++;
   RELEASE(self->targetWindow);
   RELEASE(self->string);
   RELEASE(self->template);
+  RELEASE(self->escapeJS);
+  RELEASE(self->framework);
   [super dealloc];
 }
 
   comp = [_ctx component];
   
   // link
-  [_response appendContentString:@"<a onClick=\"javascript:alert('"];
+  [_response appendContentString:@"<a onclick=\"javascript:alert('"];
   tmp = (self->alertMessage)
     ? [self->alertMessage stringValueInComponent: comp]
     : @"Press OK.";
+  if (self->escapeJS != nil && [self->escapeJS boolValueInComponent: comp]) {
+    tmp = [tmp stringByApplyingJavaScriptEscaping];
+  }
   [_response appendContentHTMLString:tmp];
   [_response appendContentString:@"');\""];
   [_response appendContentString:@" href=\""];
   [_response appendContentString:@" >"];
 
   // link content  
-  if (self->filename) {
+  if (self->filename != nil) {
     WOResourceManager *rm;
+    NSString          *frameworkName;
 
+    frameworkName = (self->framework != nil)
+      ? [self->framework stringValueInComponent:comp] 
+      : [comp frameworkName];
+    
     rm        = [[_ctx application] resourceManager];
     languages = [_ctx resourceLookupLanguages];
     
     tmp = [rm urlForResourceNamed:[self->filename stringValueInComponent:comp]
-              inFramework:[comp frameworkName]
+              inFramework:frameworkName
               languages:languages
               request:[_ctx request]];
     
     [_response appendContentString:tmp];
     [_response appendContentString:@"\""];
     
-    if (self->altTag) {
+    if (self->altTag != nil) {
       [_response appendContentString:@" alt=\""];
       [_response appendContentString:
         [self->altTag stringValueInComponent:comp]];
       [_response appendContentString:@"\" "];
     }
-    [_response appendContentString:@" />"];
+    
+    [_response appendContentString:
+                (_ctx->wcFlags.xmlStyleEmptyElements ? @" />" : @">")];
   }
+
   [self->template appendToResponse:_response inContext:_ctx];
-  if (self->string) 
+  
+  if (self->string != nil) 
     [_response appendContentString:[self->string stringValueInComponent:comp]];
 
   /* close link */
index bbb048ee88f7b4c03ffd4d64dcc35a77e49a1162..7bd83a69219e8916af6a9a4f97a67f031db8d134 100644 (file)
@@ -13,6 +13,8 @@
 
   <!-- SOPE -->
   <binding name="showPanel" defaults="YES/NO" />
+  <binding name="escapeJS" defaults="YES/NO" />
+  <binding name="framework" defaults="Frameworks"/>
 
   <validation message="either one of &apos;action&apos;, &apos;pageName&apos;, or &apos;javaScriptFunction&apos; may be bound">
     <count test="!=1">
index 4854f602277a4cc642d73307fb30cdb7c81b2a6b..1d0f13efcd22260ff376f0b2af59bd6494f4f976 100644 (file)
@@ -35,6 +35,8 @@
   /* non WO */
   WOAssociation *showPanel;
   WOElement     *template;
+  WOAssociation *escapeJS;
+  WOAssociation *framework;
 }
 
 @end
@@ -69,6 +71,8 @@
     self->targetWindow       = WOExtGetProperty(_config,@"targetWindow");
     self->string             = WOExtGetProperty(_config,@"string");
     self->showPanel          = WOExtGetProperty(_config,@"showPanel");
+    self->escapeJS           = WOExtGetProperty(_config,@"escapeJS");
+    self->framework          = WOExtGetProperty(_config,@"framework");
 
     funcCount = 0;
     if (self->action) funcCount++;
   [self->string             release];
   [self->template           release];
   [self->showPanel          release];
+  [self->escapeJS           release];
+  [self->framework          release];
   [super dealloc];
 }
 
     return nil;
   }
   
-  if (self->pageName) {
-    name = [self->pageName stringValueInComponent: [_ctx component]];
+  if (self->pageName != nil) {
+    name   = [self->pageName stringValueInComponent: [_ctx component]];
     result = [[_ctx application] pageWithName:name inContext:_ctx];
   }
-  else if (self->action) {
+  else if (self->action != nil) {
     result = [self->action valueInComponent:[_ctx component]];
   }
   else {
     return;
   
   [_response appendContentString:
-               @"<script language=\"javascript\">\nvar res = confirm(\""];
+               @"<script type=\"text/javascript\">\nvar res = confirm(\""];
   [_response appendContentHTMLString:_msg];
   [_response appendContentString:@"\");\n if (res) {\n"];
 
   [_response appendContentString:@" >"];
 
   /* link content */
-  if (self->filename) { /* image */
-      WOResourceManager *rm;
+  if (self->filename != nil) { /* image */
+    WOResourceManager *rm;
+    NSString          *frameworkName;
 
-      rm        = [[_ctx application] resourceManager];
-      languages = [_ctx resourceLookupLanguages];
+    frameworkName = (self->framework != nil)
+      ? [self->framework stringValueInComponent:comp] 
+      : [comp frameworkName];
 
-      tmp = [rm urlForResourceNamed:[self->filename stringValueInComponent:comp]
-                inFramework:[comp frameworkName]
-                languages:languages
-                request:[_ctx request]];
+    rm        = [[_ctx application] resourceManager];
+    languages = [_ctx resourceLookupLanguages];
+      
+    tmp = [rm urlForResourceNamed:[self->filename stringValueInComponent:comp]
+             inFramework:frameworkName
+             languages:languages
+             request:[_ctx request]];
     
-      [_response appendContentString:@"<img border=\"0\" src=\""];
-      [_response appendContentString:tmp];
-      [_response appendContentString:@"\" "];
+    [_response appendContentString:@"<img border=\"0\" src=\""];
+    [_response appendContentString:tmp];
+    [_response appendContentString:@"\" "];
     
-      if (self->altTag) {
-        [_response appendContentString:@"alt=\""];
-        [_response appendContentString:
+    if (self->altTag != nil) {
+      [_response appendContentString:@"alt=\""];
+      [_response appendContentString:
                    [self->altTag stringValueInComponent:comp]];
-        [_response appendContentString:@"\" "];
-      }
-      [_response appendContentString:@" />"];
+      [_response appendContentString:@"\" "];
+    }
+
+    [_response appendContentString:
+                (_ctx->wcFlags.xmlStyleEmptyElements ? @" />" : @">")];
   }
   
   [self->template appendToResponse:_response inContext:_ctx];
   
-  if (self->string) {
+  if (self->string != nil) {
     [_response appendContentString:
                  [self->string stringValueInComponent:comp]];
   }
 }
 
 - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx {
-  NSString *msg;
+  NSString    *msg;
+  WOComponent *comp;
   
+  comp = [_ctx component];
   msg  = (self->confirmMessage)
-    ? [self->confirmMessage stringValueInComponent:[_ctx component]]
+    ? [self->confirmMessage stringValueInComponent:comp]
     : @"Really?";
-  
+  if (self->escapeJS != nil && [self->escapeJS boolValueInComponent:comp]) {
+    msg = [msg stringByApplyingJavaScriptEscaping];
+  }
+
   if (self->showPanel)
     [self _appendPanelToResponse:_response message:msg inContext:_ctx];
   else 
index 5a47a200d96c61aabc924c9ce90f5548df1ff307..7cfb8bd75325bdf2c3db072a5defae3722e5e6f7 100644 (file)
@@ -7,7 +7,7 @@
 
   <binding name="selectedImage"   required="YES"/>
   <binding name="unselectedImage" required="YES" />
-  <binding name="framework"/>
+  <binding name="framework" defaults="Frameworks"/>
   <binding name="targetWindow"/>
 
   <!-- SOPE -->
index e7a024be745742d47285accf2e882cb76e9b1cb4..77f551f14db037cd31bb367c8851756412c27f3b 100644 (file)
   associations:(NSDictionary *)_config
   template:(WOElement *)_subs
 {
-  if ((self = [super initWithName:_name associations:_config template:_subs]))
-  {
+  if ((self = [super initWithName:_name associations:_config template:_subs])){
     int           funcCount;
     WOAssociation *sidInUrlAssoc;
-
     
     self->action             = WOExtGetProperty(_config, @"action");
     self->javaScriptFunction = WOExtGetProperty(_config, @"javaScriptFunction");
       : YES;
     
 
-    self->template = RETAIN(_subs);
+    self->template = [_subs retain];
   }
   return self;
 }
 
 - (void)dealloc {
-  RELEASE(self->action);
-  RELEASE(self->javaScriptFunction);
-  RELEASE(self->pageName);
-  RELEASE(self->selectedImage);
-  RELEASE(self->unselectedImage);
-  RELEASE(self->framework);
-  RELEASE(self->targetWindow);
-  RELEASE(self->template);
-
-  RELEASE(self->directActionName);
-  RELEASE(self->actionClass);
-  RELEASE(self->queryDictionary);
-  RELEASE(self->queryParameters);
+  [self->action             release];
+  [self->javaScriptFunction release];
+  [self->pageName           release];
+  [self->selectedImage      release];
+  [self->unselectedImage    release];
+  [self->framework          release];
+  [self->targetWindow       release];
+  [self->template           release];
+
+  [self->directActionName release];
+  [self->actionClass      release];
+  [self->queryDictionary  release];
+  [self->queryParameters  release];
   
   [super dealloc];
 }
 
-- (void)takeValuesFromRequest:(WORequest *)_request
-  inContext:(WOContext *)_ctx
-{
-  [self->template takeValuesFromRequest:_request inContext:_ctx];
+/* handle requests */
+
+- (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
+  [self->template takeValuesFromRequest:_rq inContext:_ctx];
 }
 
-- (id)invokeActionForRequest:(WORequest *)_request
-  inContext:(WOContext *)_ctx
-{
+- (id)invokeActionForRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
   id          result;
   NSString    *name;
 
     result = [self->action valueInComponent:[_ctx component]];
   }
   else {
-    result = [self->template invokeActionForRequest:_request inContext:_ctx];
+    result = [self->template invokeActionForRequest:_rq inContext:_ctx];
   }
   return result;
 }
 
+/* generate response */
 
 - (NSString *)imageByFilename:(NSString *)_name
   inContext:(WOContext *)_ctx
   [self->template appendToResponse:_response inContext:_ctx];
 
   /* script */
-  [_response appendContentString:@"<script language=\"JavaScript\">\n<!--\n"];
+  [_response appendContentString:@"<script type=\"text/javascript\">\n<!--\n"];
 
   if (![_ctx valueForKey:@"JSImageFlyoverScriptDone"]) {
     tmp = @"var JSImageFlyoverImages = new Array();\n"
   }
   [_response appendContentString:@" >"];
 
-  /* image itself */
+  /* the image itself */
+  
   [_response appendContentString:@"<img border='0' src=\""];
   [_response appendContentString:tunselected];
   [_response appendContentString:@"\" name=\""];
   [_response appendContentString:elID];
   [_response appendContentString:@"\" "];
   [self appendExtraAttributesToResponse:_response inContext:_ctx];
-  [_response appendContentString:@" />"];
+  
+  [_response appendContentString:
+              (_ctx->wcFlags.xmlStyleEmptyElements ? @" />" : @">")];
 
   /* close link */
   [_response appendContentString:@"</a>"];
index 4e0c552049a54b89eabb6b75d72aebeb10683440..58f8c9b114a55243a2385abc5456b61f488b5abf 100644 (file)
@@ -20,7 +20,7 @@
 */
 
 /*
-  to be done ...
+  TO BE DONE ...
 
   Usage:
 
index 6f70543c7f01c814ba3cf37aca3b48a68ef78773..c690053137635920028ae760d01d7ef74a4de833 100644 (file)
@@ -21,6 +21,7 @@
   <binding name="isCenter" />
   <binding name="filename" />
   <binding name="string" />
+  <binding name="framework" defaults="Frameworks"/>
 
   <validation message="exactly one of &apos;action&apos;, &apos;pagename&apos;, or &apos;href&apos; may be bound">
     <count test="!=1">
index a23d47aea95b68a8a8195b046d3d6a1a1c5b6011..0e70eb1ac3360051f84936b38ce99d72590a8105 100644 (file)
@@ -43,6 +43,7 @@
   WOAssociation *isCenter;
   WOAssociation *filename;
   WOAssociation *string;
+  WOAssociation *framework;
   
   WOElement     *template;
 }
@@ -88,6 +89,7 @@
     self->isCenter           = WOExtGetProperty(_config, @"isCenter");
     self->filename           = WOExtGetProperty(_config, @"filename");
     self->string             = WOExtGetProperty(_config, @"string");
+    self->framework          = WOExtGetProperty(_config, @"framework");
 
     funcCount = 0;
     if (self->action)   funcCount++;
 
 #undef SetAssociationValue
 
-    self->template = RETAIN(_subs);
+    self->template = [_subs retain];
   }
   return self;
 }
 
 - (void)dealloc {
-  RELEASE(self->action);
-  RELEASE(self->pageName);
-  RELEASE(self->href);
+  [self->action   release];
+  [self->pageName release];
+  [self->href     release];
   
-  RELEASE(self->height);
-  RELEASE(self->width);
-  RELEASE(self->windowName);
-  RELEASE(self->isResizable);
-  RELEASE(self->showLocation);
-  RELEASE(self->showMenuBar);
-  RELEASE(self->showScrollbars);
-  RELEASE(self->showStatus);
-  RELEASE(self->showToolbar);
-
-  RELEASE(self->top);
-  RELEASE(self->left);
-  RELEASE(self->isCenter);
-  RELEASE(self->filename);
-  RELEASE(self->string);
+  [self->height         release];
+  [self->width          release];
+  [self->windowName     release];
+  [self->isResizable    release];
+  [self->showLocation   release];
+  [self->showMenuBar    release];
+  [self->showScrollbars release];
+  [self->showStatus     release];
+  [self->showToolbar    release];
+
+  [self->top       release];
+  [self->left      release];
+  [self->isCenter  release];
+  [self->filename  release];
+  [self->string    release];
+  [self->framework release];
   
-  RELEASE(self->template);
+  [self->template release];
   [super dealloc];
 }
 
   [self->template takeValuesFromRequest:_rq inContext:_ctx];
 }
 
-- (id)invokeActionForRequest:(WORequest *)_request
-  inContext:(WOContext *)_ctx
-{
-  if (self->pageName) {
+- (id)invokeActionForRequest:(WORequest *)_rq inContext:(WOContext *)_ctx {
+  if (self->pageName != nil) {
     NSString *name;
     
     name = [self->pageName stringValueInComponent: [_ctx component]];
     return [[_ctx application] pageWithName:name inContext:_ctx];
   }
   
-  if (self->action)
+  if (self->action != nil)
     return [self->action valueInComponent:[_ctx component]];
 
-  return [self->template invokeActionForRequest:_request inContext:_ctx];
+  return [self->template invokeActionForRequest:_rq inContext:_ctx];
 }
 
 /* generating response */
 
-- (void)appendToResponse:(WOResponse *)_resp
-  inContext:(WOContext *)_ctx
-{
+- (void)appendToResponse:(WOResponse *)_resp inContext:(WOContext *)_ctx {
   WOComponent *comp;
   NSString    *tmp;
   NSArray     *languages;
   // link
   [_resp appendContentString:
              @"<a onclick=\"window.showModalDialog('"];
-  if (self->href)
+  if (self->href != nil)
     [_resp appendContentString:[self->href stringValueInComponent:comp]];
   else
-    [_resp appendContentString:@"http://www.ccc.de"];
+    [_resp appendContentString:@"http://sope.opengroupware.org/"];
   
   [_resp appendContentString:@"', 'a short text', '"];
 
   /* configure modal panel */
-  if (self->height) {
+  if (self->height != nil) {
     [_resp appendContentString:@" dialogHeight: "];
     [_resp appendContentString:[self->height stringValueInComponent:comp]];
     [_resp appendContentString:@"px;"];
   }
-  if (self->width) {
+  if (self->width != nil) {
     [_resp appendContentString:@" dialogWidth: "];
     [_resp appendContentString:[self->width stringValueInComponent:comp]];
     [_resp appendContentString:@"px;"];
   }
-  if (self->top) {
+  if (self->top != nil) {
     [_resp appendContentString:@" dialogTop: "];
     [_resp appendContentString:[self->top stringValueInComponent:comp]];
     [_resp appendContentString:@"px;"];
   }
-  if (self->left) {
+  if (self->left != nil) {
     [_resp appendContentString:@" dialogLeft: "];
     [_resp appendContentString:[self->left stringValueInComponent:comp]];
     [_resp appendContentString:@"px;"];
   }
-  if (self->isResizable) {
+  if (self->isResizable != nil) {
     [_resp appendContentString:@" resizable: "];
-    [_resp appendContentString:[self->isResizable stringValueInComponent:comp]];
+    [_resp appendContentString:
+            [self->isResizable stringValueInComponent:comp]];
     [_resp appendContentCharacter:';'];
   }
-  if (self->showStatus) {
+  if (self->showStatus != nil) {
     [_resp appendContentString:@" status: "];
     [_resp appendContentString:[self->showStatus stringValueInComponent:comp]];
     [_resp appendContentCharacter:';'];
   }
-  if (self->isCenter) {
+  if (self->isCenter != nil) {
     [_resp appendContentString:@" center: "];
     [_resp appendContentString:[self->isCenter stringValueInComponent:comp]];
     [_resp appendContentCharacter:';'];
   [self appendExtraAttributesToResponse:_resp inContext:_ctx];
   [_resp appendContentString:@" >"];
 
-  // link content
-  if (self->filename) {
+  /* link content */
+  if (self->filename != nil) {
     WOResourceManager *rm;
-
+    NSString          *frameworkName;
+      
     rm        = [[_ctx application] resourceManager];
     languages = [_ctx resourceLookupLanguages];
-
+    frameworkName = (self->framework != nil)
+      ? [self->framework stringValueInComponent:comp] 
+      : [comp frameworkName];
+    
     tmp = [rm urlForResourceNamed:[self->filename stringValueInComponent:comp]
-              inFramework:[comp frameworkName]
+              inFramework:frameworkName
               languages:languages
               request:[_ctx request]];
     
     [_resp appendContentString:tmp];
     [_resp appendContentString:@"\" "];
     
-    [_resp appendContentString:@" />"];
+    [_resp appendContentString:
+            (_ctx->wcFlags.xmlStyleEmptyElements ? @" />" : @">")];
   }
+  
   [self->template appendToResponse:_resp inContext:_ctx];
-  if (self->string) 
+  
+  if (self->string != nil)
     [_resp appendContentString:[self->string stringValueInComponent:comp]];
-
+  
   /* close link */
   [_resp appendContentString:@"</a>"];
 }
index 50a52e11bbfce174af8ba6d7e25c0948954461a6..1f5112368d7bc1c73803784480cb8deecdc636ac 100644 (file)
@@ -7,4 +7,7 @@
   <binding name="fieldSize" />
   <binding name="inputIsRequired" />
   <binding name="requiredText" />
+
+  <!-- SOPE -->
+  <binding name="escapeJS" defaults="YES/NO" />
 </wo>
\ No newline at end of file
index df6aa2bbf102897343a96f71dbc578c7c296e90b..0ba2d561155361d7b4aacde2e716418294da6f04 100644 (file)
   WOAssociation *inputIsRequired;
   WOAssociation *requiredText;
 
+  /* non WO */
   WOElement     *template;
+  WOAssociation *escapeJS;
 }
 @end
 
+#include <NGObjWeb/NSString+JavaScriptEscaping.h>
+#include <NGExtensions/NSString+Ext.h>
 #include "common.h"
 
 @implementation JSValidatedField
 
 - (id)initWithName:(NSString *)_name
   associations:(NSDictionary *)_config
-  template:(WOElement *)_subs
+  template:(WOElement *)_t
 {
-  if ((self = [super initWithName:_name associations:_config template:_subs]))
-  {
+  if ((self = [super initWithName:_name associations:_config template:_t])) {
     self->inputText       = WOExtGetProperty(_config,@"inputText");
     self->errorMessage    = WOExtGetProperty(_config,@"errorMessage");
     self->formName        = WOExtGetProperty(_config,@"formName");
     self->fieldSize       = WOExtGetProperty(_config,@"fieldSize");
     self->inputIsRequired = WOExtGetProperty(_config,@"inputIsRequired");
     self->requiredText    = WOExtGetProperty(_config,@"requiredText");
+    self->escapeJS        = WOExtGetProperty(_config,@"escapeJS");
 
     if (!self->inputText)
       NSLog(@"WARNING: JSValidatedField: 'inputText' not bound.");
     if (!self->formName)
       NSLog(@"ERROR: JSValidatedField: 'formName' not bound.");
 
-    self->template = RETAIN(_subs);
+    self->template = [_t retain];
   }
   return self;
 }
 
 - (void)dealloc {
-  RELEASE(self->inputText);
-  RELEASE(self->errorMessage);
-  RELEASE(self->fieldSize);
-  RELEASE(self->inputIsRequired);
-  RELEASE(self->requiredText);
-  RELEASE(self->template);
+  [self->inputText       release];
+  [self->errorMessage    release];
+  [self->fieldSize       release];
+  [self->inputIsRequired release];
+  [self->requiredText    release];
+  [self->template        release];
+  [self->escapeJS        release];
   [super dealloc];
 }
 
 /* operations */
 
 - (NSString *)buildJSSaveID:(NSString *)_id {
-  NSArray *ta;
-
-  ta = [[NSArray alloc] initWithArray: [_id componentsSeparatedByString:@"."]];
-  _id = [ta componentsJoinedByString:@"x"];
-  [ta release];
-  return _id;
+  return [_id stringByReplacingString:@"." withString:@"x"];
 }
 
 /* processing requests */
   terrMesg = (self->errorMessage)
     ? [self->errorMessage stringValueInComponent:comp]
     : @"Invalid values.";
+  if (self->escapeJS != nil && [self->escapeJS boolValueInComponent:comp])
+      terrMesg = [terrMesg stringByApplyingJavaScriptEscaping];
   tformName = [self->formName stringValueInComponent:comp];
   tinput = ([self->inputIsRequired boolValueInComponent:comp])
     ? @"true"
     : @"false";
-  ttext = (self->requiredText)
-    ? [NSString stringWithFormat:@"\"%@\"",
-                  [self->requiredText stringValueInComponent:comp]]
-    : @"false";
-
+  if (self->requiredText) {
+    ttext = [self->requiredText stringValueInComponent:comp];
+    if (self->escapeJS != nil && [self->escapeJS boolValueInComponent:comp])
+      ttext = [ttext stringByApplyingJavaScriptEscaping];
+    ttext = [NSString stringWithFormat:@"\"%@\"", ttext];
+  }
+  else
+      ttext = @"false";
   
   /* script */
-  [_response appendContentString:@"<script language=\"JavaScript\">\n<!--\n"];
+  [_response appendContentString:@"<script type=\"text/javascript\">\n<!--\n"];
 
   if (!((objectsCount =
          [[_ctx valueForKey:@"JSValidatedFieldCounter"] intValue]))) {
                  [self->fieldSize stringValueInComponent:comp]];
     [_response appendContentString:@"\""];
   }
-  [_response appendContentString:@" />"];
+
+  [_response appendContentString:
+              (_ctx->wcFlags.xmlStyleEmptyElements ? @" />" : @">")];
 }
 
 @end /* JSValidatedField */
index 7c684d83aefd03b54cc3caab0df6d3e5c3bf0a9e..b437a7c4da6fd9a482bf187d9f03c3f087ff1fa3 100644 (file)
@@ -1,5 +1,6 @@
-# $Id$
+# Version file
 
-SUBMINOR_VERSION:=22
+SUBMINOR_VERSION:=23
 
+# v4.5.23 requires libNGObjWeb v4.5.145
 # v4.5.22 requires libNGObjWeb v4.5.106
index 23a0a04ae9b71ccea6135c110f6d658f68d51436..b3a7dbb67e7511bad04d61bea87db48181c244cc 100644 (file)
@@ -308,18 +308,20 @@ void _applyIndex(WOCheckBoxMatrix *self, WOComponent *cmp, unsigned _idx)
         [_response appendContentString:s];
         [s release];
         [_response appendContentCharacter:'"'];
-  
+       
+       // TODO: need a ctx flag for empty attributes
         if ([selArray containsObject:obj])
          [_response appendContentString:@" checked=\"checked\""];
         
-        [_response appendContentString:@" />"];
-
+       [_response appendContentString:
+                    (_ctx->wcFlags.xmlStyleEmptyElements ? @" />" : @">")];
+       
         /* append template */
         [self->template appendToResponse:_response inContext:_ctx];
         [_ctx deleteLastElementIDComponent];
       }
       else
-        [_response appendContentString:@"&nbsp;"];
+        [_response appendContentString:@"&nbsp;"]; // TODO: XML/XHTML?
       [_response appendContentString:@"</td>"];
     }
     [_response appendContentString:@"</tr>"];
index 4fd60a32183b93f602db503104b2f6517562b6c9..be32ad227231ff7a25784728071469df0d41d8b5 100644 (file)
@@ -5,7 +5,7 @@
   <binding name="visibility" required="YES" defaults="YES/NO"/>
   <binding name="openedImageFileName" />
   <binding name="closedImageFileName" />
-  <binding name="framework" />
+  <binding name="framework" defaults="Frameworks"/>
   <binding name="openedLabel" />
   <binding name="closedLabel" />
   <binding name="submitActionName" />
index 34b75aab5b750c192a15fc3e9e61fe60ff97b6d2..13444642be126e5340b3144ec6eb2bd9e1918be7 100644 (file)
@@ -287,8 +287,9 @@ void _applyIndex(WORadioButtonMatrix *self, WOComponent *cmp, unsigned _idx)
         if ([sel isEqual:obj])
          [_response appendContentString:@" checked=\"checked\""];
         
-        [_response appendContentString:@" />"];
-
+       [_response appendContentString:
+                    (_ctx->wcFlags.xmlStyleEmptyElements ? @" />" : @">")];
+       
         // append template
         [self->template appendToResponse:_response inContext:_ctx];
         [_ctx deleteLastElementIDComponent];
index aed87ce8e7d02bc131eeddc99dd33561db229704..96af736cc077b68163277022020816c3fe1dc7a9 100644 (file)
       [_response appendContentHTMLAttributeValue:[_ctx elementID]];
       [_response appendContentString:@"\" value=\""];
       [_response appendContentString:title];
-      [_response appendContentString:@"\" />"];
+      [_response appendContentString:
+                  (_ctx->wcFlags.xmlStyleEmptyElements ? @" />" : @">")];
     }
     else {
       /* gen link */
       [_response appendContentHTMLAttributeValue:title];
       [_response appendContentString:@"\">"];
       
-      if (self->textColor) {
+      if (self->textColor != nil) {
         [_response appendContentString:@"<font color=\""];
         [_response appendContentHTMLAttributeValue:
                      [self->textColor stringValueInComponent:sComponent]];
       
       [_response appendContentHTMLString:title];
 
-      if (self->textColor)
+      if (self->textColor != nil)
         [_response appendContentString:@"</font>"];
       [_response appendContentString:@"</a>"];
     }