Changeset 4827


Ignore:
Timestamp:
2003-06-27T17:31:46+12:00 (21 years ago)
Author:
kjdon
Message:

fixed a bug to do with paged documents and .fc/ns etc in the oids

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/action/DocumentAction.java

    r4718 r4827  
    137137    }
    138138
     139    boolean dummy_node = false;
    139140    if (get_structure || get_structure_info) {
    140141
     
    172173            the_document.appendChild(doc_.importNode(structs.item(i), true));
    173174        }
     175        } else {
     176        // no structure nodes, so put in a dummy doc node
     177        Element doc_node = doc_.createElement(GSXML.DOC_NODE_ELEM);
     178        doc_node.setAttribute(GSXML.NODE_ID_ATT, document_name);
     179        the_document.appendChild(doc_node);
     180        dummy_node = true;
    174181        }
    175182    } else {
     
    178185        doc_node.setAttribute(GSXML.NODE_ID_ATT, document_name);
    179186        the_document.appendChild(doc_node);
     187        dummy_node = true;
    180188    }
    181189   
     
    299307    String modified_doc_id = dc_response_doc.getAttribute(GSXML.NODE_ID_ATT);
    300308    the_document.setAttribute("selectedNode", modified_doc_id);
    301     // Merge the document content with the metadata and structure information
    302     for (int i = 0; i < doc_nodes.getLength(); i++) {
    303         Node dn = doc_nodes.item(i);
    304         String dn_id = ((Element)dn).getAttribute(GSXML.NODE_ID_ATT);
    305         if (dn_id.equals(modified_doc_id)) {
    306         dn.appendChild(doc_.importNode(dc_response_doc_content, true));
    307         break;
     309    if (dummy_node) {
     310        // change the id if necessary and add the content
     311        ((Element)doc_nodes.item(0)).setAttribute(GSXML.NODE_ID_ATT, modified_doc_id);
     312        doc_nodes.item(0).appendChild(doc_.importNode(dc_response_doc_content, true));
     313    } else {
     314        // Merge the document content with the metadata and structure information
     315        for (int i = 0; i < doc_nodes.getLength(); i++) {
     316        Node dn = doc_nodes.item(i);
     317        String dn_id = ((Element)dn).getAttribute(GSXML.NODE_ID_ATT);
     318        if (dn_id.equals(modified_doc_id)) {
     319            dn.appendChild(doc_.importNode(dc_response_doc_content, true));
     320            break;
     321        }
    308322        }
    309323    }
Note: See TracChangeset for help on using the changeset viewer.