version 1.44, 2009/09/07 14:01:56
|
version 1.45, 2009/09/16 11:17:21
|
Line 195 char *GetAttributeStringValueFromNum (El
|
Line 195 char *GetAttributeStringValueFromNum (El
|
attribute = TtaGetAttribute(el, attType); |
attribute = TtaGetAttribute(el, attType); |
if (attribute == NULL) |
if (attribute == NULL) |
return NULL; |
return NULL; |
|
|
size = TtaGetTextAttributeLength (attribute); |
size = TtaGetTextAttributeLength (attribute); |
aux = (char*) TtaGetMemory (size+1); |
aux = (char*) TtaGetMemory (size+1); |
TtaGiveTextAttributeValue (attribute, aux, &size); |
TtaGiveTextAttributeValue (attribute, aux, &size); |
Line 217 int GetAttributeIntValueFromNum (Element
|
Line 216 int GetAttributeIntValueFromNum (Element
|
AttributeType attType; |
AttributeType attType; |
Attribute attribute; |
Attribute attribute; |
|
|
attType.AttrSSchema = TtaGetElementType(el).ElSSchema; |
attType.AttrSSchema = TtaGetElementType (el).ElSSchema; |
attType.AttrTypeNum = att; |
attType.AttrTypeNum = att; |
attribute = TtaGetAttribute(el, attType); |
attribute = TtaGetAttribute (el, attType); |
|
if (attribute) |
return TtaGetAttributeValue(attribute); |
return TtaGetAttributeValue (attribute); |
|
else |
|
return 0; |
#else |
#else |
return NULL; |
return 0; |
#endif /* TEMPLATES */ |
#endif /* TEMPLATES */ |
} |
} |
|
|
Line 299 char *GetAncestorComponentName (Element
|
Line 300 char *GetAncestorComponentName (Element
|
return NULL; |
return NULL; |
} |
} |
|
|
|
/*---------------------------------------------------------------------- |
|
AllowAttributeEdit returns TRUE if the template allows the user to edit |
|
the attribute |
|
----------------------------------------------------------------------*/ |
|
ThotBool AllowAttributeEdit (Element el, Document doc, char *name) |
|
{ |
|
#ifdef TEMPLATES |
|
Element child; |
|
ElementType childType; |
|
char *value; |
|
int val; |
|
ThotBool ok; |
|
|
|
if (name == NULL || *name == EOS) |
|
return FALSE; |
|
child = TtaGetFirstChild (el); |
|
while (child) |
|
{ |
|
childType = TtaGetElementType (child); |
|
if (childType.ElTypeNum == Template_EL_attribute && |
|
!strcmp (TtaGetSSchemaName(childType.ElSSchema) , "Template")) |
|
{ |
|
value = GetAttributeStringValueFromNum (child, Template_ATTR_ref_name, NULL); |
|
ok = (value && !strcmp (value, name)); |
|
TtaFreeMemory (value); |
|
if (ok) |
|
{ |
|
val = GetAttributeIntValueFromNum (el, Template_ATTR_useAt); |
|
if (val == Template_ATTR_useAt_VAL_prohibited) |
|
return FALSE; |
|
value = GetAttributeStringValueFromNum (child, Template_ATTR_fixed, NULL); |
|
if (value) |
|
{ |
|
TtaFreeMemory (value); |
|
return FALSE; |
|
} |
|
return ok; |
|
} |
|
else |
|
TtaNextSibling(&child); |
|
} |
|
else |
|
return FALSE; |
|
} |
|
#endif /* TEMPLATES */ |
|
return FALSE; |
|
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
GetFirstEditableElement |
GetFirstEditableElement |