Open SiteSearch 4.1.1
Final

ORG.oclc.mantis
Class MantisXML

java.lang.Object
  |
  +--ORG.oclc.mantis.MantisXML

public class MantisXML
extends Object


Field Summary
 boolean applet
           
 Hashtable appletEntities
           
 String appletParamList
           
 Hashtable appletPost
           
 String appName
           
 String appVersion
           
 Document clone
           
static int CLONE
           
 boolean displayWrapper
           
 netscape.javascript.JSObject js
           
 String lastTemplateName
           
 MantisUtil mu
           
 DataDir native_dir
           
 boolean raggedDisplay
           
 boolean showButtons
           
 Document template
           
static int TEMPLATE
           
 Hashtable user
           
 Document xmldoc
           
static int XMLDOC
           
 
Constructor Summary
MantisXML(Document xml, Document temp, Hashtable userObject)
          Create an instance of this class.
MantisXML(Document xml, Hashtable userObject)
          Create an instance of this class.
MantisXML(Document xml, Hashtable userObject, MantisUtil mu)
          Create an instance of this class.
MantisXML(Document xml, RequestManager req, MantisUtil mu)
          Create an instance of this class.
 
Method Summary
 Document addMantisTreeID(Document doc)
           
 Element addMantisTreeID(Document doc, Element el, boolean parentProtected)
           
 void addNode(Element el, String id)
          Add an exact replicate of the specified element (minus the data) to the parent's child list.
 void appendToAppletPost(String name, Object value)
          Add an object to the hashtable of the applet that simulates a form post.
static int autosize(ElementInfoObject eio)
          Get the correct height from looking at the specified hieght, total content, as well as the autosize flag.
 void buildAppletPost()
          Build a hashtable that contains all the form element data for the applet to use to update a record.
 void changeElementDisplay(Element el, String type)
          Change the display type of an element.
static void clean(Element el)
          Removes element specific data from the Element and all its subelements.
 void cleanLocalData(Element el)
           
static void cleanNonMantisElements(Element el)
           
static Document clone(Document doc)
          Footprint into clone
static Document clone(Document doc, boolean preserveLocalData)
           
static Element clone(Element el, Document doc)
          Make a copy of the specified element.
static Element clone(Element el, Document doc, boolean preserveLocalData)
           
 void cloneRecord()
          Clone a record in a database and give the clone an original ID.
protected  Element cloneStructure(Element el)
          Copy an Element and all of its subelements, then clean out some of the data that is element specific.
 String createAppletParams()
          Create the applet parameters that will be inserted into the MantisApplet.html page.
 void decreaseHeight(Element el)
          Decrease the value of an Element's MANTIS:height tag.
 void decreaseHeight(int id)
          Footprint into decreaseHeight.
 String display(Element el)
          Footprint into display.
 String display(ElementInfoObject eio)
           
protected  void display(ElementInfoObject eio, int level, StringBuffer out, boolean editable, boolean expanded, boolean templateEditor)
          Footprint into display
protected  void display(ElementInfoObject eio, int level, StringBuffer out, boolean editable, boolean expanded, boolean templateEditor, String action)
          This method creates HTML displays for the record viewer as well as the record editor.
protected  void displayAnchor(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display an anchor display.
 void displayContent(ElementInfoObject eio, boolean editable, String action, boolean templateEditor, StringBuffer out, StringBuffer buf, String id)
          Generate the HTML to display the content portion of an element's display in record view mode.
 void displayContentLabel(ElementInfoObject eio, StringBuffer buf, StringBuffer out, String id)
          Generate the HTML to display the label portion of an element's display in record view mode.
 void displayDataCheck(ElementInfoObject eio, StringBuffer out, boolean templateEditor)
          Generate the HTML to display the dataCheck portion of an element's display in record view mode.
 void displayEnlarger(ElementInfoObject eio, StringBuffer out, String id, boolean templateEditor)
          Generate the HTML to display enlarger buttons.
 void displayError(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display an error.
 void displayHeader(ElementInfoObject eio, StringBuffer msg, String action)
           
 void displayHeading(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display the heading portion of an element's display in record edit mode.
 void displayHook(ElementInfoObject eio, StringBuffer out, String id, boolean templateEditor)
          Generate the HTML to display the hook portion of an element's display.
 void displayLabel(ElementInfoObject eio, StringBuffer buf, StringBuffer out, String id, boolean templateEditor)
          Generate the HTML to display the label portion of an element's display.
 void displayListbox(ElementInfoObject eio, StringBuffer out, String id)
          Generate the HTML to display a listbox display.
protected  void displayListboxAlternate(ElementInfoObject eio, StringBuffer out, String id)
          Generate the HTML to display a listbox alternate display.
 void displayMailto(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display a mailto display.
 void displayRadio(ElementInfoObject eio, StringBuffer out, String id)
          Generate the HTML to display a radio button display.
 void displayReplicable(ElementInfoObject eio, StringBuffer out, String id, boolean templateEditor)
          Generate the HTML to display replication buttons.
 void displaySmartListbox(String value, String id, Vector list, StringBuffer out)
           
 void displaySmartListbox(String value, String id, Vector list, StringBuffer out, String javascript)
           
 void displaySmartListbox(String value, String id, Vector list, Vector values, StringBuffer out, String javascript)
           
 void displaySpacingElements(ElementInfoObject eio, StringBuffer out, boolean templateEditor)
          Generate the HTML to display the spacing element's portion of an element's display.
 void displayTableCell(ElementInfoObject eio, StringBuffer out, String id)
          This method creates the data segment of the element display.
 void displayWarning(ElementInfoObject eio, StringBuffer out)
          Generate the HTML to display a warning
 HookData doHooks(int which, String action)
          Setup method for runHooks.
 HookData doHooks(String action)
          Footprint to doHooks which defaults to the XMLDOC document.
 String escape(String str)
          Perform HTML escaping for >, <, &, " in the specified String.
static String escapeQuotes(String str)
          Escape any quotes found in a String with HTML entities.
 HookData export(MantisXML xmltree, Document xmldoc, String action)
           
static DataDir exportMARC(DataDir dir, Element el, TagFile tf, Hashtable user, MantisUtil mu)
           
static Element findChild(Element parent, String tag)
          Returns the child element of parent with the matching tagName or null.
static DataDir[] fromNative(DataDir dir, Element el, TagFile tf, Hashtable user, MantisUtil mu)
          Scans the immediate children of el for any that are hooks and runs the fromNative method of any hook it finds.
static Class getClass(String hook)
          Dynamically creates and instance of a class specified by it's fully qualified string name.
 Document getDoc()
           
 Element getElement(Element parent, String tag)
          Returns the child element of parent with the matching tagName.
 Element getElement(int elementID)
          Returns the element associatted with the integer provided.
 String getElementID(Element el)
          Get an element's ID as it would appear in HTML display.
 ElementInfoObject getElementInfo(Element el)
          Get an ElementInfoObject containg data from the specified element and all of its children.
 ElementInfoObject getElementInfo(Element el, boolean templateEditor)
           
 Object getEntity(String name)
          Get an object out of the user object.
 MantisInfo getInfo()
           
 String getLabelName(ElementInfoObject eio)
          Get the display label for an element.
 String getLabelName(ElementInfoObject eio, boolean doReplace)
           
 void getMantisLists(Element el)
          Collect all the lists that are specified in the element tree.
 String getNextID(int id)
          Get the id of the next element in the element tree.
 Element getNextOfType(Element el)
          Gets the next Element of the same type from the sibling list.
 String getPost(String name)
          Search the posted form data, whether from the applet or from the server.
 String getPreviousID(int id)
          Get the id of the previous element in the element tree.
 Element getPreviousOfType(Element el)
          Get the previous Element of the same type in the sibling list.
static String getRDFValue(Element el)
          Get the RDF:Value data from a specified Element.
 String getReplicate(int id)
          Replicate an element and create the HTML display for that new element.
 RequestManager getRequestManager()
           
 Element getRightMostSubnode(Element el)
          Get the right most subnode of the specified element.
 String getRightMostSubnode(int id)
          Footprint to getRightMostSubnode
static Element getStaticElement(Element parent, String tag)
          Returns the child element of parent with the matching tagName.
 Document getTemplate()
           
 Hashtable getUser()
          Get the user object.
static String getValue(Element el)
           
static String getValue(Element el, String tag)
           
 boolean hookWasClicked(Element el)
          Check to see if a hook was clicked by the user.
 void increaseHeight(Element el)
          Increase the value of an Element's MANTIS:height tag.
 void increaseHeight(int id)
          Footprint into increaseHeight.
 boolean isDisplayType(Element el, String type)
          Returns the results of a display check.
protected  boolean isFirstOfType(Element el)
          Check to see if there are other elements of the same type before the specified element in the parent's child list.
protected  boolean isLastOfType(Element el)
          Check to see if there are other elements of the same type after the specified element in the parent's child list.
protected static boolean isProtectedNamespace(Element el)
          Check to see if an element is in a protected namespace.
 void killElement(int actionNode)
          Remove an Element from the Element Tree with no checks.
 int lastNode()
           
 int levelsIn(Element el)
          Determine the depth of an element in the document.
 void mergeTemplate(int actionNode)
          Foot print into mergeTemplate.
protected  void moveNodeDown(Element el)
          Moves an Element down one level in the XML tree if it is not the last Element of type ELEMENT in the sibling list.
 void moveNodeDown(int actionNode)
          Footprint to moveNodeDown.
protected  void moveNodeIn(Element el)
          Moves an Element in one level in the XML tree if it not the first Element of type ELEMENT in its sibling list.
 void moveNodeIn(int actionNode)
          Footprint to moveNodeIn.
protected  void moveNodeOut(Element el)
          Moves an Element out one level in the XML tree if it is not a direct child of the root node.
 void moveNodeOut(int actionNode)
          Footprint to moveNodeOut.
protected  void moveNodeUp(Element el)
          Moves an Element up one level in the XML tree if it is not the first Element of type ELEMENT in the sibling list.
 void moveNodeUp(int actionNode)
          Footprint into moveNodeUp
 void narrowerWidth(Element el)
          Decrease the value of an Element's MANTIS:width tag.
 void narrowerWidth(int id)
          Footprint to narrowerWidth.
 boolean noautosize(int id)
          Check to see if textarea should be autosized.
 void preExport(MantisXML xmltree, Document xmldoc)
           
 void putEntity(String name, Object value)
          Put an object into the user object.
 void remakeHash(Element el)
          Get the data corresponding to the given element.
static DataDir remap(DataDir dir, Element el, TagFile tf, Hashtable user)
           
 void remove(int id)
          Remove an element from the document given its HTML identifier.
 void removeElement(Element el)
          Remove an element from the from the hashtable
 void removeElement(int id)
          Remove an element from the document.
protected  void removeNode(Element el)
          Removes an Element from its parent.
 void removeTokens(Element el)
           
 Element renameAndReturnElement(Element el, String tag)
           
 void renameElement(Element el, String tag)
           
 String replace(String str, String delim, String replace)
          Replace a string portion with an alternate string.
 void rmPost(String name)
          Remove an element from the posted form data.
 void setDoc(Document xml)
           
 void setElement(Element el, int id)
          Set an element mapping between an element and how it is displayed on an HTML page.
 void setJSObject(netscape.javascript.JSObject local_js)
          Set the js instance variable.
static void setStaticValue(Element el, String value, boolean templateEditor, boolean marc)
          Try to get rid of this method.
 void setTemplate(Document tmp)
           
 void setValue(Element el, String value)
          Footprint into setValue
 void setValue(Element el, String value, boolean templateEditor)
          Set the value of an Element with a specified value.
 void setWidgets(DataPairs widgets)
          Set the widgets object in this class.
 void toggleSection(Element el, int node)
          Toggles the section element value for the element associatted with the integer node.
 void toggleSection(int node)
          Footprint into toggleSection.
static DataDir toNative(DataDir dir, DataDir native_dir, Element el, TagFile tf, Hashtable user, MantisUtil mu)
           
 String toSGML()
           
static String toSGML(Element el)
           
 String toString()
          A footprint to the toString method.
 String toString(boolean editable)
          A footprint to the toString method.
 String toString(boolean editable, boolean templateEditor)
          A footprint to the toString method.
 String toString(boolean editable, DataPairs mywidgets)
          A footprint to the toString method.
 String toString(boolean editable, DataPairs mywidgets, String action)
          A footprint to the toString method.
 String toString(boolean editable, int document, boolean templateEditor)
          A footprint to the toString method.
 String toString(boolean editable, int document, boolean templateEditor, String action)
          Complete call of this method.
 String toString(String action)
          A footprint to the toString method.
static DataDir update(DataDir dir, Element el, TagFile tf, Hashtable user, MantisUtil mu)
           
 void updateElement(int id, String value)
          Update an element given its ID and new value.
 void updateNode(DataPairs widgets, int actionNode)
          Footprint into updateNode.
 void updateStructure(int id, String action)
          Updates an the structure or the content as well as the structure of an element according to the specified action.
 void updateTemplate(DataPairs widgets, Element el)
          Walk the element tree and get the corresponding values from the widgets.
 void updateTree(DataPairs widgets, int actionNode, String action)
          Footprint into updateTree.
 void updateTree(Element el, DataPairs widgets, int actionNode, String action, boolean templateEditor)
          Footprint into updateTree.
 void updateTree(Element el, int actionNode, String action, boolean templateEditor)
          Updates an element tree with updates provided from the widgets, as well as from the action generated from the user.
 void updateTree(int actionNode, String action)
          Footprint into updateTree.
 HookData view(MantisXML xmltree, Document xmldoc, String action)
           
 void widerWidth(Element el)
          Increase the value of an Element's MANTIS:width tag.
 void widerWidth(int id)
          Footprint to widerWidth.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xmldoc

public Document xmldoc

clone

public Document clone

lastTemplateName

public String lastTemplateName

user

public Hashtable user

template

public Document template

XMLDOC

public static final int XMLDOC

TEMPLATE

public static final int TEMPLATE

CLONE

public static final int CLONE

mu

public MantisUtil mu

applet

public boolean applet

showButtons

public boolean showButtons

appletParamList

public String appletParamList

appletPost

public Hashtable appletPost

appletEntities

public Hashtable appletEntities

js

public netscape.javascript.JSObject js

appName

public String appName

appVersion

public String appVersion

displayWrapper

public boolean displayWrapper

native_dir

public DataDir native_dir

raggedDisplay

public boolean raggedDisplay
Constructor Detail

MantisXML

public MantisXML(Document xml,
                 Hashtable userObject)
Create an instance of this class.
Parameters:
xml - - The XML Document used throughout many public instance methods. This object drives the class as it contains the record itself, the database structure, as well as display information.
userObject - - A Hashtable containing session information.

MantisXML

public MantisXML(Document xml,
                 RequestManager req,
                 MantisUtil mu)
Create an instance of this class.
Parameters:
xml - - the XML Document used throughout many public instance methods. This object drives the class as it contains the record itself, the database structure, as well as display information.
req - - The JaSSI object that contains all the information about a given session.
mu - - A MantisUtil instance. Contains database information.

MantisXML

public MantisXML(Document xml,
                 Hashtable userObject,
                 MantisUtil mu)
Create an instance of this class.
Parameters:
xml - - The XML Document used throughout many public instance methods. This object drives the class as it contains the record itself, the database structure, as well as display information.
userObject - - A Hashtable containing session information.
mu - - A MantisUtil instance. Contains database information.

MantisXML

public MantisXML(Document xml,
                 Document temp,
                 Hashtable userObject)
Create an instance of this class.
Parameters:
xml - - The XML Document used throughout many public instance methods. This object drives the class as it contains the record itself, the database structure, as well as display information.
temp - - The XML Document that contains the record structure without any of the record data. Used to strip out the record content for updates to the database.
userObject - - A Hashtable containing session information.
Method Detail

isDisplayType

public boolean isDisplayType(Element el,
                             String type)
Returns the results of a display check.
Parameters:
el - - The Element being checked
type - - The display type being checked.
Returns:
- The result of the check.

isProtectedNamespace

protected static boolean isProtectedNamespace(Element el)
Check to see if an element is in a protected namespace.
Parameters:
el - - The element to check.
Returns:
- The result of the check.

isFirstOfType

protected boolean isFirstOfType(Element el)
Check to see if there are other elements of the same type before the specified element in the parent's child list.
Parameters:
el - - The element to check.
Returns:
- The result of the check.

isLastOfType

protected boolean isLastOfType(Element el)
Check to see if there are other elements of the same type after the specified element in the parent's child list.
Parameters:
el - - The element to check.
Returns:
- The result of the check.

hookWasClicked

public boolean hookWasClicked(Element el)
Check to see if a hook was clicked by the user.
Parameters:
el - - The parent of the hook in question.
Returns:
- If hook was clicked.

toSGML

public String toSGML()

toSGML

public static String toSGML(Element el)

toString

public String toString()
A footprint to the toString method. Creates an HTML display of the record in editable format.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.
Overrides:
toString in class Object

toString

public String toString(boolean editable)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(String action)
A footprint to the toString method. Creates an HTML display of the record in editable format.
Parameters:
action - - A String containing the action of the user.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(boolean editable,
                       boolean templateEditor)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
templateEditor - - A flag specifying if in template editor or record editor.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(boolean editable,
                       DataPairs mywidgets)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
mywidgets - - A DataPairs object containing the widgets from the previous HTML page.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(boolean editable,
                       DataPairs mywidgets,
                       String action)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
mywidgets - - A DataPairs object containing the widgets from the previous HTML page.
action - - A String containing the action of the user.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

toString

public String toString(boolean editable,
                       int document,
                       boolean templateEditor)
A footprint to the toString method. Creates an HTML display of the record.
Parameters:
editable - - A flag for displaying in edit or display mode.
document - - An integer specifying which document to display.
templateEditor - - Flag specifying which environment we are displaying into.

toString

public String toString(boolean editable,
                       int document,
                       boolean templateEditor,
                       String action)
Complete call of this method. Create the HTML code to display the edit or display screens for the given xml document.
Parameters:
editable - - A flag for displaying in edit or display mode.
document - - An integer specifying which document to display.
templateEditor - - Flag specifying which environment we are displaying into.
action - - A String containing the action of the user.
Returns:
- A String containing the ready to be used HTML display of the record editor interface.

displayLabel

public void displayLabel(ElementInfoObject eio,
                         StringBuffer buf,
                         StringBuffer out,
                         String id,
                         boolean templateEditor)
Generate the HTML to display the label portion of an element's display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
buf - - Horizontal offset string.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.
templateEditor - - Flag specifying if in the Template Editor.

displayHook

public void displayHook(ElementInfoObject eio,
                        StringBuffer out,
                        String id,
                        boolean templateEditor)
Generate the HTML to display the hook portion of an element's display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.
templateEditor - - Flag specifying if in the Template Editor.

displaySpacingElements

public void displaySpacingElements(ElementInfoObject eio,
                                   StringBuffer out,
                                   boolean templateEditor)
Generate the HTML to display the spacing element's portion of an element's display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
templateEditor - - Flag specifying if in the Template Editor.

displayContentLabel

public void displayContentLabel(ElementInfoObject eio,
                                StringBuffer buf,
                                StringBuffer out,
                                String id)
Generate the HTML to display the label portion of an element's display in record view mode.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
buf - - Horizontal offset string.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

displayContent

public void displayContent(ElementInfoObject eio,
                           boolean editable,
                           String action,
                           boolean templateEditor,
                           StringBuffer out,
                           StringBuffer buf,
                           String id)
Generate the HTML to display the content portion of an element's display in record view mode.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
buf - - Horizontal offset string.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

displayHeading

public void displayHeading(ElementInfoObject eio,
                           StringBuffer out)
Generate the HTML to display the heading portion of an element's display in record edit mode.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.

displayDataCheck

public void displayDataCheck(ElementInfoObject eio,
                             StringBuffer out,
                             boolean templateEditor)
Generate the HTML to display the dataCheck portion of an element's display in record view mode.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
templateEditor - - Flag specifying whether in the Template Editor or not.

displayRadio

public void displayRadio(ElementInfoObject eio,
                         StringBuffer out,
                         String id)
Generate the HTML to display a radio button display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

displayListbox

public void displayListbox(ElementInfoObject eio,
                           StringBuffer out,
                           String id)
Generate the HTML to display a listbox display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

displaySmartListbox

public void displaySmartListbox(String value,
                                String id,
                                Vector list,
                                StringBuffer out)

displaySmartListbox

public void displaySmartListbox(String value,
                                String id,
                                Vector list,
                                StringBuffer out,
                                String javascript)

displaySmartListbox

public void displaySmartListbox(String value,
                                String id,
                                Vector list,
                                Vector values,
                                StringBuffer out,
                                String javascript)

displayError

public void displayError(ElementInfoObject eio,
                         StringBuffer out)
Generate the HTML to display an error.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.

displayWarning

public void displayWarning(ElementInfoObject eio,
                           StringBuffer out)
Generate the HTML to display a warning
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.

displayAnchor

protected void displayAnchor(ElementInfoObject eio,
                             StringBuffer out)
Generate the HTML to display an anchor display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.

displayMailto

public void displayMailto(ElementInfoObject eio,
                          StringBuffer out)
Generate the HTML to display a mailto display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.

displayListboxAlternate

protected void displayListboxAlternate(ElementInfoObject eio,
                                       StringBuffer out,
                                       String id)
Generate the HTML to display a listbox alternate display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

displayEnlarger

public void displayEnlarger(ElementInfoObject eio,
                            StringBuffer out,
                            String id,
                            boolean templateEditor)
Generate the HTML to display enlarger buttons.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.
templateEditor - - Flag specifying if in the TemplateEditor.

displayReplicable

public void displayReplicable(ElementInfoObject eio,
                              StringBuffer out,
                              String id,
                              boolean templateEditor)
Generate the HTML to display replication buttons.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.
templateEditor - - Flag specifying if in the TemplateEditor.

display

public String display(ElementInfoObject eio)

display

public String display(Element el)
Footprint into display.
Parameters:
el - - The element to display (as well as child elements).

display

protected void display(ElementInfoObject eio,
                       int level,
                       StringBuffer out,
                       boolean editable,
                       boolean expanded,
                       boolean templateEditor)
Footprint into display
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
level - - The level in the element tree (number of parents).
out - - StringBuffer to receive the generated HTML.
editable - - Flag to display in edit or display mode.
expanded - - Current section state of element.
templateEditor - - Flag specifying if in the TemplateEditor.

display

protected void display(ElementInfoObject eio,
                       int level,
                       StringBuffer out,
                       boolean editable,
                       boolean expanded,
                       boolean templateEditor,
                       String action)
This method creates HTML displays for the record viewer as well as the record editor.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
level - - The level in the element tree (number of parents).
out - - StringBuffer to receive the generated HTML.
editable - - Flag to display in edit or display mode.
expanded - - Current section state of element.
templateEditor - - Flag specifying if in the TemplateEditor.

displayHeader

public void displayHeader(ElementInfoObject eio,
                          StringBuffer msg,
                          String action)

displayTableCell

public void displayTableCell(ElementInfoObject eio,
                             StringBuffer out,
                             String id)
This method creates the data segment of the element display.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
out - - StringBuffer to receive the generated HTML.
id - - ID of an element from an HTML page.

getClass

public static Class getClass(String hook)
Dynamically creates and instance of a class specified by it's fully qualified string name.
Parameters:
hook - - The fully qualified string name of a class.
Returns:
- A Class object.

doHooks

public HookData doHooks(String action)
Footprint to doHooks which defaults to the XMLDOC document.
Parameters:
action - - The action taken by the user of the system.
Returns:
- The error state after running the hooks contained within the document. True if erros detected, false otherwise.

doHooks

public HookData doHooks(int which,
                        String action)
Setup method for runHooks.
Parameters:
which - - Which document to run hooks on. XMLDOC (0) - The document with record content. TEMPLATE (1) - The document with record structure alone. CLONE (2) - A clone of TEMPLATE used to store element editing in the Template Editor.
action - - The action taken by the user of the system.
Returns:
- The error state after running the hooks contained within the document. True if erros detected, false otherwise.

fromNative

public static DataDir[] fromNative(DataDir dir,
                                   Element el,
                                   TagFile tf,
                                   Hashtable user,
                                   MantisUtil mu)
Scans the immediate children of el for any that are hooks and runs the fromNative method of any hook it finds. Numerous hooks are applied sequentially with subsequent hooks acting on the results of previous hooks.
Parameters:
dir - A record in native (MARC) format.
el - The root element of a Mantis template.
tf - The tag file (pseudo DTD) corresponding to the template el represents.
Returns:
The original dir if no hooks were found or a new DataDir representing a different "view" of the record such as the Dublin Core view of a MARC record.

toNative

public static DataDir toNative(DataDir dir,
                               DataDir native_dir,
                               Element el,
                               TagFile tf,
                               Hashtable user,
                               MantisUtil mu)

remap

public static DataDir remap(DataDir dir,
                            Element el,
                            TagFile tf,
                            Hashtable user)

update

public static DataDir update(DataDir dir,
                             Element el,
                             TagFile tf,
                             Hashtable user,
                             MantisUtil mu)

exportMARC

public static DataDir exportMARC(DataDir dir,
                                 Element el,
                                 TagFile tf,
                                 Hashtable user,
                                 MantisUtil mu)

preExport

public void preExport(MantisXML xmltree,
                      Document xmldoc)

export

public HookData export(MantisXML xmltree,
                       Document xmldoc,
                       String action)

view

public HookData view(MantisXML xmltree,
                     Document xmldoc,
                     String action)

getInfo

public MantisInfo getInfo()

setJSObject

public void setJSObject(netscape.javascript.JSObject local_js)
Set the js instance variable. This is used in the applet in order to gain access to form data without posting to the server.
Parameters:
local_js - - The JSObject allowing access to all form data on the applet html page.

appendToAppletPost

public void appendToAppletPost(String name,
                               Object value)
Add an object to the hashtable of the applet that simulates a form post.
Parameters:
name - - The String name of the object.
value - - The Object being stored in the hashtable. This object should be a String as all form data is in String format.

buildAppletPost

public void buildAppletPost()
Build a hashtable that contains all the form element data for the applet to use to update a record. The instance variable js must be set at this point for proper execution.

createAppletParams

public String createAppletParams()
Create the applet parameters that will be inserted into the MantisApplet.html page.
Returns:
- A String containing the applet parameters, ready to be inserted in to an HTML page.

mergeTemplate

public void mergeTemplate(int actionNode)
Foot print into mergeTemplate.
Parameters:
actionNode - - The int associatted with a specific element from an HTML form.

updateElement

public void updateElement(int id,
                          String value)
Update an element given its ID and new value.
Parameters:
id - - ID of an element from an HTML page.
value - - New value of the given element.

updateTemplate

public void updateTemplate(DataPairs widgets,
                           Element el)
Walk the element tree and get the corresponding values from the widgets. Used exclusively in the Template Editor, as there are no actions to take.
Parameters:
widgets - - A DataPairs object containing the post from a web page.
el - - The Element tree to update.

updateStructure

public void updateStructure(int id,
                            String action)
Updates an the structure or the content as well as the structure of an element according to the specified action.
Parameters:
id - - ID of an element from an HTML page.
action - - The action taken by a user.

updateTree

public void updateTree(DataPairs widgets,
                       int actionNode,
                       String action)
Footprint into updateTree.
Parameters:
widgets - - The DataPairs from a form post to the server.
actionNode - - ID of an element from an HTML page.
action - - The action taken by a user.

updateTree

public void updateTree(int actionNode,
                       String action)
Footprint into updateTree.
Parameters:
actionNode - - ID of an element from an HTML page.
action - - The action taken by a user.

updateTree

public void updateTree(Element el,
                       DataPairs widgets,
                       int actionNode,
                       String action,
                       boolean templateEditor)
Footprint into updateTree.
Parameters:
el - - The element tree to be updated.
widgets - - The DataPairs from a form post to the server.
actionNode - - ID of an element from an HTML page.
action - - The action taken by a user.
templateEditor - - Flag specifying whether display is in the Template Editor.

updateTree

public void updateTree(Element el,
                       int actionNode,
                       String action,
                       boolean templateEditor)
Updates an element tree with updates provided from the widgets, as well as from the action generated from the user.
Parameters:
el - - The element tree to be updated.
actionNode - - ID of an element from an HTML page.
action - - The action taken by a user.
templateEditor - - Flag specifying whether display is in the Template Editor.

removeTokens

public void removeTokens(Element el)

lastNode

public int lastNode()

updateNode

public void updateNode(DataPairs widgets,
                       int actionNode)
Footprint into updateNode.
Parameters:
widgets - - The DataPairs containing the form inputs from an HTML page.
actionNode - - ID of an element from an HTML page.

getElement

public Element getElement(Element parent,
                          String tag)
Returns the child element of parent with the matching tagName. Creates the element if it does not exist.
Parameters:
parent - - The parent element.
tag - - The String name of the child to be found or created.
Returns:
- The child element specified in tag.

renameElement

public void renameElement(Element el,
                          String tag)

renameAndReturnElement

public Element renameAndReturnElement(Element el,
                                      String tag)

getStaticElement

public static Element getStaticElement(Element parent,
                                       String tag)
Returns the child element of parent with the matching tagName. Creates the element if it does not exist.
Parameters:
parent - - The parent element.
tag - - The String name of the child to be found or created. return - The child element specified in tag.

findChild

public static Element findChild(Element parent,
                                String tag)
Returns the child element of parent with the matching tagName or null.
Parameters:
parent - - The parent element.
tag - - The String name of the child to be found or created. return - The child element specified in tag.

getElementID

public String getElementID(Element el)
Get an element's ID as it would appear in HTML display.
Parameters:
el - - The Element to search for

getElement

public Element getElement(int elementID)
Returns the element associatted with the integer provided. Null is returned when no match is found.
Parameters:
elementID - - The int number associatted with an element in an HTML page.
Returns:
- The corresponding element or null.

toggleSection

public void toggleSection(int node)
Footprint into toggleSection.
Parameters:
node - - ID of element from an HTML page.

toggleSection

public void toggleSection(Element el,
                          int node)
Toggles the section element value for the element associatted with the integer node. This method should be called every time a section arrow is clicked to expand or collapse a section.
Parameters:
el - - The Element to be expanded.
node - - The Element el's corresponding id in an HTML page.

setElement

public void setElement(Element el,
                       int id)
Set an element mapping between an element and how it is displayed on an HTML page.
Parameters:
el - - The Element to map an id with.
id - - The id to give to the element.

removeElement

public void removeElement(Element el)
Remove an element from the from the hashtable
Parameters:
el - - The Element to remove from the hashtable.

remakeHash

public void remakeHash(Element el)
Get the data corresponding to the given element.
Parameters:
el - - The Element to get the value of, specifically the data under it's RDF:Value chils.
Returns:
- The value of the Element or "".

getValue

public static String getValue(Element el)

getValue

public static final String getValue(Element el,
                                    String tag)
Parameters:
el - - The Element to search immediatly under.
tag - - The String tag name of the child to search for.
Returns:
- The String value contained in the specified child element, or "".

getPreviousID

public String getPreviousID(int id)
Get the id of the previous element in the element tree.
Parameters:
id - - ID of an element from an HTML page where the search should start.
Returns:
- ID of previous or null if does not exist.

getNextID

public String getNextID(int id)
Get the id of the next element in the element tree.
Parameters:
id - - ID of an element from an HTML page where the search should start.
Returns:
- ID of next or the given id if next is null.

removeElement

public void removeElement(int id)
Remove an element from the document.
Parameters:
id - - ID of an element from an HTML page that should be removed.

getReplicate

public String getReplicate(int id)
Replicate an element and create the HTML display for that new element.
Parameters:
id - - ID of an element from an HTML page that should be removed.
Returns:
- The HTML display for the new element.

levelsIn

public int levelsIn(Element el)
Determine the depth of an element in the document.
Parameters:
el - - The element in question.
Returns:
- The number of parents the element has.

remove

public void remove(int id)
Remove an element from the document given its HTML identifier.
Parameters:
id - - ID of an element from an HTML page that should be removed.

getRightMostSubnode

public String getRightMostSubnode(int id)
Footprint to getRightMostSubnode
Parameters:
id - - ID of an element from an HTML page.
Returns:
- ID of the right most subnode.

getRightMostSubnode

public Element getRightMostSubnode(Element el)
Get the right most subnode of the specified element.
Parameters:
el - - The parent element to search under.
Returns:
- The right most subnode if exists, else the original element.

getMantisLists

public void getMantisLists(Element el)
Collect all the lists that are specified in the element tree.
Parameters:
el - - The element to begin the search under.

getLabelName

public String getLabelName(ElementInfoObject eio)
Get the display label for an element.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
Returns:
- The label if specified, else the tagname.

getLabelName

public String getLabelName(ElementInfoObject eio,
                           boolean doReplace)

autosize

public static int autosize(ElementInfoObject eio)
Get the correct height from looking at the specified hieght, total content, as well as the autosize flag.
Parameters:
eio - - An ElementInfoObject containing Mantis element data.
Returns:
- The height of a textarea.

noautosize

public boolean noautosize(int id)
Check to see if textarea should be autosized.
Parameters:
id - - ID of an element from an HTML page.
Returns:
- Autosize or not.

increaseHeight

public void increaseHeight(int id)
Footprint into increaseHeight.
Parameters:
id - - ID of an element from an HTML page.

increaseHeight

public void increaseHeight(Element el)
Increase the value of an Element's MANTIS:height tag.
Parameters:
el - - The element to be affected.

decreaseHeight

public void decreaseHeight(int id)
Footprint into decreaseHeight.
Parameters:
id - - ID of an element from an HTML page.

decreaseHeight

public void decreaseHeight(Element el)
Decrease the value of an Element's MANTIS:height tag.
Parameters:
el - - The element to be affected.

widerWidth

public void widerWidth(int id)
Footprint to widerWidth.
Parameters:
el - - The element to be affected.

widerWidth

public void widerWidth(Element el)
Increase the value of an Element's MANTIS:width tag.
Parameters:
el - - The element to be affected.

narrowerWidth

public void narrowerWidth(int id)
Footprint to narrowerWidth.
Parameters:
el - - Th element to be affected.

narrowerWidth

public void narrowerWidth(Element el)
Decrease the value of an Element's MANTIS:width tag.
Parameters:
el - - The element to be affected.

changeElementDisplay

public void changeElementDisplay(Element el,
                                 String type)
Change the display type of an element.
Parameters:
el - - The element being affected.
type - - The type of display to change to.

addNode

public void addNode(Element el,
                    String id)
Add an exact replicate of the specified element (minus the data) to the parent's child list.
Parameters:
el - - The Element to replicate.
id - - ID of an element from an HTML page.

killElement

public void killElement(int actionNode)
Remove an Element from the Element Tree with no checks.
Parameters:
actionNode - - ID of an element from an HTML page.

cloneStructure

protected Element cloneStructure(Element el)
Copy an Element and all of its subelements, then clean out some of the data that is element specific.
Parameters:
el - - The Element to be copied.
Returns:
- An Element copy of el.

clone

public static Document clone(Document doc)
Footprint into clone
Parameters:
doc - - The Document to copy.

clone

public static Document clone(Document doc,
                             boolean preserveLocalData)

clone

public static Element clone(Element el,
                            Document doc)
Make a copy of the specified element.
Parameters:
el - - The element to copy.
doc - - The Document to spawn new Elements.
Returns:
- The copy of the element.

clone

public static Element clone(Element el,
                            Document doc,
                            boolean preserveLocalData)

cloneRecord

public void cloneRecord()
Clone a record in a database and give the clone an original ID.

clean

public static void clean(Element el)
Removes element specific data from the Element and all its subelements. The elements that are cleaned are RDF:Value Elements or Attributes that exist as direct children of an unprotected Element
Parameters:
el - - The Element to be cleaned.

cleanLocalData

public void cleanLocalData(Element el)

cleanNonMantisElements

public static void cleanNonMantisElements(Element el)

setValue

public void setValue(Element el,
                     String value)
Footprint into setValue
Parameters:
el - - The Element to be set.
value - - The value the Element will receive.

setValue

public void setValue(Element el,
                     String value,
                     boolean templateEditor)
Set the value of an Element with a specified value.
Parameters:
el - - The Element to be set.
value - - The value the Element will receive.
templateEditor - - Flag specifying whether or not in the Template Editor.

setStaticValue

public static void setStaticValue(Element el,
                                  String value,
                                  boolean templateEditor,
                                  boolean marc)
Try to get rid of this method.

removeNode

protected void removeNode(Element el)
Removes an Element from its parent. If the element is replicable and it is the only sibling of its tagName, then the element is cleaned and remains in the tree. If there are more instances of this element in the sibling list, then this element is removed. If the element is mutable, remove it.
Parameters:
el - - The Element to remove.

getPreviousOfType

public Element getPreviousOfType(Element el)
Get the previous Element of the same type in the sibling list.
Parameters:
el - - The Element which we are looking before.
Returns:
- The previous Element if it exists, else null.

getNextOfType

public Element getNextOfType(Element el)
Gets the next Element of the same type from the sibling list.
Parameters:
el - - The Element which we are looking after.
Returns:
- The next Element if it exists, else null.

moveNodeOut

public void moveNodeOut(int actionNode)
Footprint to moveNodeOut.
Parameters:
actionNode - - ID of an element from an HTML page.

moveNodeOut

protected void moveNodeOut(Element el)
Moves an Element out one level in the XML tree if it is not a direct child of the root node.
Parameters:
el - - The Element to move.

moveNodeUp

public void moveNodeUp(int actionNode)
Footprint into moveNodeUp
Parameters:
actionNode - - ID of an element from an HTML page.

moveNodeUp

protected void moveNodeUp(Element el)
Moves an Element up one level in the XML tree if it is not the first Element of type ELEMENT in the sibling list.
Parameters:
el - - The Element to move.

moveNodeDown

public void moveNodeDown(int actionNode)
Footprint to moveNodeDown.
Parameters:
actionNode - - ID of an element from an HTML page.

moveNodeDown

protected void moveNodeDown(Element el)
Moves an Element down one level in the XML tree if it is not the last Element of type ELEMENT in the sibling list.
Parameters:
el - - The Element to move.

moveNodeIn

public void moveNodeIn(int actionNode)
Footprint to moveNodeIn.
Parameters:
actionNode - - ID of an element from an HTML page.

moveNodeIn

protected void moveNodeIn(Element el)
Moves an Element in one level in the XML tree if it not the first Element of type ELEMENT in its sibling list. The sibling directly above the Element becomes the parent.
Parameters:
el - - The Element to move.

getRDFValue

public static final String getRDFValue(Element el)
Get the RDF:Value data from a specified Element.
Parameters:
el - - The Element to search under.
Returns:
- The RDF:Value data or null.

getElementInfo

public ElementInfoObject getElementInfo(Element el)
Get an ElementInfoObject containg data from the specified element and all of its children.
Parameters:
el - - The Element to collect data from.
Returns:
- The object containg all Mantis data for the specified element and its children.

getElementInfo

public ElementInfoObject getElementInfo(Element el,
                                        boolean templateEditor)

escapeQuotes

public static String escapeQuotes(String str)
Escape any quotes found in a String with HTML entities.
Parameters:
str - - The String to escape.
Returns:
- The resulting String after replacement.

escape

public String escape(String str)
Perform HTML escaping for >, <, &, " in the specified String.
Parameters:
str - - The String to escape.
Returns:
- The resulting String after replacement.

replace

public String replace(String str,
                      String delim,
                      String replace)
Replace a string portion with an alternate string.
Parameters:
str - - The string to be altered.
delim - - The string to be replaced.
replace - - The replacement string.
Returns:
- The new string after replacement.

addMantisTreeID

public Document addMantisTreeID(Document doc)

addMantisTreeID

public Element addMantisTreeID(Document doc,
                               Element el,
                               boolean parentProtected)

getRequestManager

public RequestManager getRequestManager()

setDoc

public void setDoc(Document xml)

getDoc

public Document getDoc()

setTemplate

public void setTemplate(Document tmp)

getTemplate

public Document getTemplate()

setWidgets

public void setWidgets(DataPairs widgets)
Set the widgets object in this class.
Parameters:
widgets - - A DataPairs object containg the name-value pairs from a HTML form.

getPost

public String getPost(String name)
Search the posted form data, whether from the applet or from the server.
Parameters:
name - - The name of the value to be searched for.
Returns:
- The result of the specified search.

rmPost

public void rmPost(String name)
Remove an element from the posted form data.
Parameters:
name - - The name of the value to be removed.

getEntity

public Object getEntity(String name)
Get an object out of the user object.
Parameters:
name - - The name of the object to get.
Returns:
- The object specified, or null.

getUser

public Hashtable getUser()
Get the user object.
Returns:
- The user object.

putEntity

public void putEntity(String name,
                      Object value)
Put an object into the user object.
Parameters:
name - - The String name (key) of the object being placed into the user object.
value - - The object being placed into the user object.

Open SiteSearch 4.1.1
Final