* 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)


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@37922 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Manuel Guesdon 2014-05-29 18:41:21 +00:00
parent e15d404b2e
commit e4480ba188
5 changed files with 101 additions and 4 deletions

View file

@ -1,3 +1,14 @@
2014-05-29 Manuel Guesdon <mguesdon@orange-concept.com>
* 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 <mguesdon@orange-concept.com>
* GSWDatabase/WODisplayGroup.m
add NSArray -objectsAtIndexesArray:

View file

@ -280,6 +280,10 @@ static Class standardClass = Nil;
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 @@ static Class standardClass = Nil;
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);

View file

@ -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;

View file

@ -539,6 +539,15 @@ static inline BOOL _needQuote(NSString* str_needQuote)
return newQueryDictionary;
}
//--------------------------------------------------------------------
//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
@ -582,6 +591,15 @@ static inline BOOL _needQuote(NSString* str_needQuote)
}
}
//--------------------------------------------------------------------
//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
@ -593,6 +611,15 @@ static inline BOOL _needQuote(NSString* str_needQuote)
}
//--------------------------------------------------------------------
//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);
}
//--------------------------------------------------------------------
-(void) appendURLAttributesToResponse:(GSWResponse*) response
inContext:(GSWContext*) context

View file

@ -265,6 +265,10 @@ static Class standardClass = Nil;
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 @@ static Class standardClass = Nil;
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);