version 1.17, 2007/01/26 13:15:48
|
version 1.18, 2007/01/29 11:17:16
|
Line 205 static void InstantiateAttribute (XTiger
|
Line 205 static void InstantiateAttribute (XTiger
|
// there is a "use" attribute. Check its value |
// there is a "use" attribute. Check its value |
{ |
{ |
text = GetAttributeStringValue (el, useAttr, NULL); |
text = GetAttributeStringValue (el, useAttr, NULL); |
if (text && strcmp (text, "optional") == 0) |
if(!text) |
return; |
return; |
|
if(strcmp (text, "optional") == 0) |
|
{ |
|
TtaFreeMemory(text); |
|
return; |
|
} |
|
TtaFreeMemory(text); |
} |
} |
|
|
// get the "name" and "default" attributes |
// get the "name" and "default" attributes |
nameType.AttrSSchema = defaultType.AttrSSchema = TtaGetSSchema (TEMPLATE_SCHEMA_NAME, doc); |
nameType.AttrSSchema = defaultType.AttrSSchema = TtaGetSSchema (TEMPLATE_SCHEMA_NAME, doc); |
nameType.AttrTypeNum = Template_ATTR_ref_name; |
nameType.AttrTypeNum = Template_ATTR_ref_name; |
Line 231 static void InstantiateAttribute (XTiger
|
Line 238 static void InstantiateAttribute (XTiger
|
if (defAttr) |
if (defAttr) |
{ |
{ |
text = GetAttributeStringValue (el, defAttr, NULL); |
text = GetAttributeStringValue (el, defAttr, NULL); |
TtaSetAttributeText(attr, text, parent, doc); |
if(text) |
|
TtaSetAttributeText(attr, text, parent, doc); |
TtaFreeMemory(text); |
TtaFreeMemory(text); |
// if it's a src arttribute for an image, load the image |
// if it's a src arttribute for an image, load the image |
if (!strcmp (TtaGetSSchemaName (elType.ElSSchema), "HTML") && |
if (!strcmp (TtaGetSSchemaName (elType.ElSSchema), "HTML") && |
Line 391 Element Template_InsertUseChildren(Docum
|
Line 399 Element Template_InsertUseChildren(Docum
|
} |
} |
|
|
/* Copy currentType attribute. */ |
/* Copy currentType attribute. */ |
attrCurrentTypeValue = GetAttributeStringValue(newEl, Template_ATTR_currentType, NULL); |
attrCurrentTypeValue = GetAttributeStringValueFromNum(newEl, Template_ATTR_currentType, NULL); |
SetAttributeStringValue(el, Template_ATTR_currentType, attrCurrentTypeValue); |
if(attrCurrentTypeValue) |
|
{ |
|
SetAttributeStringValue(el, Template_ATTR_currentType, attrCurrentTypeValue); |
|
TtaFreeMemory(attrCurrentTypeValue); |
|
} |
TtaDeleteTree(newEl, doc); |
TtaDeleteTree(newEl, doc); |
newEl = el; |
newEl = el; |
break; |
break; |
Line 440 Element InstantiateUse (XTigerTemplate t
|
Line 451 Element InstantiateUse (XTigerTemplate t
|
/* get the value of the "types" attribute */ |
/* get the value of the "types" attribute */ |
cont = NULL; |
cont = NULL; |
elType = TtaGetElementType (el); |
elType = TtaGetElementType (el); |
types = GetAttributeStringValue(el, Template_ATTR_types, &size); |
types = GetAttributeStringValueFromNum(el, Template_ATTR_types, &size); |
|
if(!types) |
|
return NULL; |
giveItems (types, size, &items, &nbitems); |
giveItems (types, size, &items, &nbitems); |
// No structure checking |
// No structure checking |
oldStructureChecking = TtaGetStructureChecking (doc); |
oldStructureChecking = TtaGetStructureChecking (doc); |
Line 454 Element InstantiateUse (XTigerTemplate t
|
Line 467 Element InstantiateUse (XTigerTemplate t
|
cont = Template_InsertUseChildren(doc, el, dec); |
cont = Template_InsertUseChildren(doc, el, dec); |
} |
} |
TtaFreeMemory(types); |
TtaFreeMemory(types); |
|
TtaFreeMemory(items); |
TtaSetStructureChecking (oldStructureChecking, doc); |
TtaSetStructureChecking (oldStructureChecking, doc); |
return cont; |
return cont; |
#endif /* TEMPLATES */ |
#endif /* TEMPLATES */ |
Line 624 static void ParseTemplate (XTigerTemplat
|
Line 638 static void ParseTemplate (XTigerTemplat
|
attType.AttrSSchema = elType.ElSSchema; |
attType.AttrSSchema = elType.ElSSchema; |
attType.AttrTypeNum = Template_ATTR_name; |
attType.AttrTypeNum = Template_ATTR_name; |
|
|
name = GetAttributeStringValue (el, Template_ATTR_name, NULL); |
name = GetAttributeStringValueFromNum (el, Template_ATTR_name, NULL); |
TtaRemoveAttribute (el, TtaGetAttribute (el, attType), doc); |
TtaRemoveAttribute (el, TtaGetAttribute (el, attType), doc); |
if (NeedAMenu (el, doc)) |
if (NeedAMenu (el, doc)) |
TtaChangeElementType (el, Template_EL_useEl); |
TtaChangeElementType (el, Template_EL_useEl); |
Line 634 static void ParseTemplate (XTigerTemplat
|
Line 648 static void ParseTemplate (XTigerTemplat
|
attType.AttrTypeNum = Template_ATTR_types; |
attType.AttrTypeNum = Template_ATTR_types; |
att = TtaNewAttribute (attType); |
att = TtaNewAttribute (attType); |
TtaAttachAttribute (el, att, doc); |
TtaAttachAttribute (el, att, doc); |
TtaSetAttributeText (att, name, el, doc); |
if(name) |
|
TtaSetAttributeText (att, name, el, doc); |
|
|
attType.AttrTypeNum = Template_ATTR_currentType; |
attType.AttrTypeNum = Template_ATTR_currentType; |
att = TtaNewAttribute (attType); |
att = TtaNewAttribute (attType); |
TtaAttachAttribute (el, att, doc); |
TtaAttachAttribute (el, att, doc); |
TtaSetAttributeText (att, name, el, doc); |
if(name) |
|
TtaSetAttributeText (att, name, el, doc); |
|
|
break; |
break; |
case Template_EL_option : |
case Template_EL_option : |