Author: mguesdon
Date: Thu May 29 20:41:21 2014
New Revision: 37922

URL: http://svn.gna.org/viewcvs/gnustep?rev=37922&view=rev
Log:
* GSWDatabase/GSWHTMLDynamicElement.[hm]
  add -hasNonURLAttributes
  add -hasURLAttributes
  add -hasConstantAttributes
* GSWeb/GSWRadioButtonList.m
  handle disabled association
  handle other associations (like id, onChange, etc)
* GSWeb/GSWCheckBoxList.m
  handle disabled association
  handle other associations (like id, onChange, etc)

Modified:
    libs/gsweb/trunk/ChangeLog
    libs/gsweb/trunk/GSWeb/GSWCheckBoxList.m
    libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.h
    libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.m
    libs/gsweb/trunk/GSWeb/GSWRadioButtonList.m

Modified: libs/gsweb/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gsweb/trunk/ChangeLog?rev=37922&r1=37921&r2=37922&view=diff
==============================================================================
--- libs/gsweb/trunk/ChangeLog  (original)
+++ libs/gsweb/trunk/ChangeLog  Thu May 29 20:41:21 2014
@@ -1,3 +1,14 @@
+2014-05-29  Manuel Guesdon <[email protected]>
+       * GSWDatabase/GSWHTMLDynamicElement.[hm]
+         add -hasNonURLAttributes
+         add -hasURLAttributes
+         add -hasConstantAttributes
+       * GSWeb/GSWRadioButtonList.m
+         handle disabled association
+         handle other associations (like id, onChange, etc)
+       * GSWeb/GSWCheckBoxList.m
+         handle disabled association
+         handle other associations (like id, onChange, etc)
 2014-05-29  Manuel Guesdon <[email protected]>
        * GSWDatabase/WODisplayGroup.m
          add NSArray -objectsAtIndexesArray:

Modified: libs/gsweb/trunk/GSWeb/GSWCheckBoxList.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gsweb/trunk/GSWeb/GSWCheckBoxList.m?rev=37922&r1=37921&r2=37922&view=diff
==============================================================================
--- libs/gsweb/trunk/GSWeb/GSWCheckBoxList.m    (original)
+++ libs/gsweb/trunk/GSWeb/GSWCheckBoxList.m    Thu May 29 20:41:21 2014
@@ -280,6 +280,10 @@
          BOOL doEscape = NO;
          id selections = nil;
          IMP oaiIMP=NULL;
+         BOOL isDisabled=[self 
disabledInComponent:GSWContext_component(context)];
+         BOOL hasConstantAttributes=[self hasConstantAttributes];
+         BOOL hasNonURLAttributes=[self hasNonURLAttributes];
+         BOOL hasURLAttributes=[self hasURLAttributes];
          
          if (_escapeHTML==nil)
            doEscape=_defaultEscapeHTML;
@@ -355,9 +359,33 @@
                
GSWResponse_appendContentAsciiString(response,GSWIntToNSString(i));
              
              if ([selections containsObject:item]) 
-               GSWResponse_appendContentAsciiString(response,@"\" checked>");
+               GSWResponse_appendContentAsciiString(response,@"\" checked");
              else 
-               GSWResponse_appendContentAsciiString(response,@"\">");
+               GSWResponse_appendContentAsciiString(response,@"\"");
+
+             if (isDisabled)
+               GSWResponse_appendContentAsciiString(response,@" disabled");
+
+             //append other associations (like id, onChange, ...)
+             if (hasConstantAttributes)
+               {
+                 [self appendConstantAttributesToResponse: response 
+                       inContext: context];
+               }
+             
+             if (hasNonURLAttributes)
+               {
+                 [self appendNonURLAttributesToResponse: response
+                       inContext: context];
+               }
+             
+             if (hasURLAttributes)
+               {
+                 [self appendURLAttributesToResponse: response
+                       inContext: context];
+               }
+
+             GSWResponse_appendContentCharacter(response,'>');
              
              if (prefixStr != nil) 
                GSWResponse_appendContentString(response,prefixStr);

Modified: libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.h?rev=37922&r1=37921&r2=37922&view=diff
==============================================================================
--- libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.h      (original)
+++ libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.h      Thu May 29 20:41:21 2014
@@ -66,12 +66,15 @@
                              
directActionNameAssociation:(GSWAssociation*)directActionName
                                                inContext:(GSWContext*)context;
 
+-(BOOL) hasNonURLAttributes;
 -(void) appendNonURLAttributesToResponse:(GSWResponse*) response
                                inContext:(GSWContext*) context;
 
+-(BOOL) hasURLAttributes;
 -(void) appendURLAttributesToResponse:(GSWResponse*) response
                             inContext:(GSWContext*) context;
                                                          
+-(BOOL) hasConstantAttributes;
 -(void) appendConstantAttributesToResponse:(GSWResponse*) response
                                  inContext:(GSWContext*)aContext;
 

Modified: libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.m?rev=37922&r1=37921&r2=37922&view=diff
==============================================================================
--- libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.m      (original)
+++ libs/gsweb/trunk/GSWeb/GSWHTMLDynamicElement.m      Thu May 29 20:41:21 2014
@@ -540,6 +540,15 @@
 }
 
 //--------------------------------------------------------------------
+//Used by childs like GSW(CheckBox|RadioButton)List to avoid calling 
+//multiple time appendConstantAttributesToResponse: if there's nothing
+//to do
+-(BOOL)hasConstantAttributes
+{
+  return ([[self constantAttributesRepresentation] length]>0 ? YES : NO);
+}
+
+//--------------------------------------------------------------------
 -(void) appendConstantAttributesToResponse:(GSWResponse*) response
                                  inContext:(GSWContext*)aContext
 {
@@ -583,6 +592,15 @@
 }
 
 //--------------------------------------------------------------------
+//Used by childs like GSW(CheckBox|RadioButton)List to avoid calling 
+//multiple time appendNonURLAttributesToResponse: if there's nothing
+//to do
+-(BOOL)hasNonURLAttributes
+{
+  return ([[self nonUrlAttributeAssociations] count]>0 ? YES : NO);
+}
+
+//--------------------------------------------------------------------
 -(void) appendNonURLAttributesToResponse:(GSWResponse*) response
                                inContext:(GSWContext*) context
   
@@ -591,6 +609,15 @@
                                           inContext: context
                                        associations: [self 
nonUrlAttributeAssociations]];
 
+}
+
+//--------------------------------------------------------------------
+//Used by childs like GSW(CheckBox|RadioButton)List to avoid calling 
+//multiple time appendURLAttributesToResponse: if there's nothing
+//to do
+-(BOOL)hasURLAttributes
+{
+  return ([[self urlAttributeAssociations] count]>0 ? YES : NO);
 }
 
 //--------------------------------------------------------------------

Modified: libs/gsweb/trunk/GSWeb/GSWRadioButtonList.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gsweb/trunk/GSWeb/GSWRadioButtonList.m?rev=37922&r1=37921&r2=37922&view=diff
==============================================================================
--- libs/gsweb/trunk/GSWeb/GSWRadioButtonList.m (original)
+++ libs/gsweb/trunk/GSWeb/GSWRadioButtonList.m Thu May 29 20:41:21 2014
@@ -265,6 +265,10 @@
              NSString* ctxName  = [self nameInContext:context];
              id selection = [_selection valueInComponent:component];
              IMP list_oaiIMP=NULL;
+             BOOL isDisabled=[self 
disabledInComponent:GSWContext_component(context)];
+             BOOL hasConstantAttributes=[self hasConstantAttributes];
+             BOOL hasNonURLAttributes=[self hasNonURLAttributes];
+             BOOL hasURLAttributes=[self hasURLAttributes];
   
              for (i = 0; i < count; i++)
                {
@@ -329,10 +333,34 @@
                  
                  if (selection != nil 
                      && [selection isEqual:item])
-                   GSWResponse_appendContentAsciiString(response,@"\" 
checked>");
+                   GSWResponse_appendContentAsciiString(response,@"\" 
checked");
                  else
-                   GSWResponse_appendContentAsciiString(response,@"\">");
-                 
+                   GSWResponse_appendContentAsciiString(response,@"\"");
+                 
+                 if (isDisabled)
+                   GSWResponse_appendContentAsciiString(response,@" disabled");
+                 
+                 //append other associations (like id, onChange, ...)
+                 if (hasConstantAttributes)
+                   {
+                     [self appendConstantAttributesToResponse: response 
+                           inContext: context];
+                   }
+                 
+                 if (hasNonURLAttributes)
+                   {
+                     [self appendNonURLAttributesToResponse: response
+                           inContext: context];
+                   }
+                 
+                 if (hasURLAttributes)
+                   {
+                     [self appendURLAttributesToResponse: response
+                           inContext: context];
+                   }
+                 
+                 GSWResponse_appendContentCharacter(response,'>');
+             
                  if (prefixStr != nil)
                    GSWResponse_appendContentString(response,prefixStr);
                  


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to