Remove include functionality by <object appliction/xid way.
This commit is contained in:
parent
6511b04085
commit
5456caece2
2 changed files with 78 additions and 210 deletions
Binary file not shown.
|
@ -301,121 +301,6 @@ public class Presenter
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Includes another file into the current page.
|
||||
*
|
||||
* @param node
|
||||
* @param attrMap
|
||||
* @param idAttr
|
||||
*/
|
||||
static protected StringBuffer processObjectTag (Node node,
|
||||
NamedNodeMap attrMap,
|
||||
Node idAttr,
|
||||
IdsDataById datas,
|
||||
String webappPath,
|
||||
StringBuffer errorOutput)
|
||||
{
|
||||
StringBuffer result;
|
||||
|
||||
result = new StringBuffer ();
|
||||
|
||||
// Find codetype.
|
||||
String codetype;
|
||||
if (attrMap == null)
|
||||
{
|
||||
codetype = null;
|
||||
}
|
||||
else if (attrMap.getNamedItem ("codetype") == null)
|
||||
{
|
||||
codetype = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
codetype = attrMap.getNamedItem ("codetype").getNodeValue ();
|
||||
}
|
||||
|
||||
// Check tag requirements.
|
||||
if ((attrMap == null) ||
|
||||
(codetype == null) ||
|
||||
(!codetype.equals ("application/xid")) ||
|
||||
(attrMap.getNamedItem ("data") == null))
|
||||
{
|
||||
// STU: do default action.
|
||||
Presenter.processElementBasically (node, datas, webappPath, errorOutput);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.debug ("object action");
|
||||
result.append ("<!-- STARTING INCLUDE XID FILE " + attrMap.getNamedItem ("data") + " -->");
|
||||
|
||||
// Build the file name.
|
||||
String htmlFileName = webappPath + attrMap.getNamedItem ("data").getNodeValue ();
|
||||
|
||||
|
||||
// Load file in tree.
|
||||
Document childDoc = null;
|
||||
try
|
||||
{
|
||||
childDoc = fileToTree (htmlFileName, errorOutput);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorOutput.append ("unable to build the file tree");
|
||||
logger.debug ("unable to build the file tree");
|
||||
}
|
||||
|
||||
// Extract the 'body' section.
|
||||
Node body = null;
|
||||
try
|
||||
{
|
||||
NodeList nodes = childDoc.getElementsByTagName ("body");
|
||||
|
||||
if (nodes.getLength () == 0)
|
||||
{
|
||||
errorOutput.append ("no body tag in include html");
|
||||
logger.debug ("no body tag in include html");
|
||||
}
|
||||
else
|
||||
{
|
||||
body = nodes.item(0);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
errorOutput.append ("error getting child");
|
||||
logger.debug ("error getting child");
|
||||
}
|
||||
|
||||
// Process the body child as part of the primary tree.
|
||||
if (body == null)
|
||||
{
|
||||
errorOutput.append ("xid object body empty.");
|
||||
}
|
||||
else
|
||||
{
|
||||
NodeList bodyChildren = body.getChildNodes ();
|
||||
|
||||
if (bodyChildren != null)
|
||||
{
|
||||
int childCount = bodyChildren.getLength ();
|
||||
for (int childCounter = 0; childCounter < childCount; childCounter++)
|
||||
{
|
||||
result.append (process (bodyChildren.item (childCounter), datas, webappPath, errorOutput));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result.append ("<!-- ENDING INCLUDE XID FILE " + attrMap.getNamedItem ("data") + " -->");
|
||||
}
|
||||
logger.debug ("end of object action");
|
||||
//
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Processes a node that has dynamic content. Calls the appropriate code
|
||||
* generator method, depending on the tag.
|
||||
|
@ -468,12 +353,6 @@ public class Presenter
|
|||
|
||||
String tag = node.getNodeName();
|
||||
|
||||
if (tag.equals ("object"))
|
||||
{
|
||||
result.append (processObjectTag (node, attrs, idAttr, datas, webappPath, errorOutput));
|
||||
}
|
||||
else
|
||||
{
|
||||
String idValue = idAttr.getNodeValue();
|
||||
|
||||
logger.debug ("tag=" + tag);
|
||||
|
@ -599,7 +478,6 @@ public class Presenter
|
|||
{
|
||||
logger.warn ("Unknow type of IdDataId");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
logger.debug ("Exit");
|
||||
|
@ -693,19 +571,9 @@ public class Presenter
|
|||
errorOutput));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
String tag = node.getNodeName();
|
||||
|
||||
if (tag.equals ("object"))
|
||||
{
|
||||
result.append (processObjectTag (node, attrs, idAttr, datas, webappPath, errorOutput));
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append (Presenter.processElementBasically (node, datas, webappPath, suffix, errorOutput));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue