Adding dummy namespace for Firefox

Adding dummy namespace for Firefox

xquery version "1.0";
declare namespace exist = "http://exist.sourceforge.net/NS/exist";
declare namespace request="http://exist-db.org/xquery/request";

(:
Punch list:

(might want)
  * Add trigger to see preview on save (may involve xq)

:)

declare option exist:serialize "method=xhtml media-type=text/xml";
declare option exist:serialize "indent=no";
declare option exist:serialize "process-xsl-pi=no";

let $attribute := request:set-attribute("betterform.filter.ignoreResponseBody", "true")

let $base_url := '/metadata/'
let $load_path := 'posted_data/'
let $param := request:get-parameter("fid", 0)

let $form_url := concat($base_url, $load_path, $param)

let $form :=

    <title>Shelley-Godwin Archive Metadata Editor</title>
    <link rel="stylesheet" type="text/css" href="../lib/bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="../lib/FontAwesome/css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.8.2/css/jquery.dataTables.css" />
    <link rel="stylesheet" type="text/css" href="../lib/fancyBox/source/jquery.fancybox.css" />

    <xf:model id="teiHeader">
      <xf:instance id="itemMD" xmlns="http://www.tei-c.org/ns/1.0"
        src= "{$form_url}">
      </xf:instance>

      <xf:instance id="control-codes" xmlns="">
        <data>
          <output-filename>temp.xml</output-filename>
          <institution-id></institution-id>
        </data>
      </xf:instance>

      <xf:bind id="title"
        nodeset="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[@type='main']"
        required="true()"></xf:bind>
      <xf:bind id="date"
        nodeset="/tei:TEI/tei:teiHeader/tei:profileDesc/tei:creation/tei:date/@when"></xf:bind>
      <xf:bind id="desc-label" nodeset="//tei:msDesc/tei:msContents/tei:summary" required="true()"></xf:bind>

      <xf:bind id="call-number" nodeset="//tei:msDesc/tei:msIdentifier/tei:idno" required="true()"></xf:bind>

      <xf:bind id="foliation-modern"
        nodeset="//tei:msDesc/tei:physDesc/tei:objectDesc/tei:supportDesc/tei:foliation[@xml:id='modern']"></xf:bind>

      <xf:bind id="meditor"
        nodeset="/tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[@xml:id='md_editor']/tei:name"
        required="true()"></xf:bind>
      <xf:bind id="metadata-source"
        nodeset="//tei:msDesc/tei:additional/tei:adminInfo/tei:recordHist/tei:p/tei:bibl"
        required="true()"></xf:bind>

      <xf:bind id="change-author" nodeset="//tei:revisionDesc/tei:change/@who" readonly="true()"></xf:bind>
      <xf:bind id="change" nodeset="//tei:revisionDesc/tei:change" readonly="true()"></xf:bind>

      <xf:submission id="save" method="put" replace="none">
        <xf:resource value="concat('/metadata/posted_data/', instance('control-codes')/output-filename)"></xf:resource>
      </xf:submission>

      <xf:action ev:observer="save" ev:event="xforms-submit-done">
        <xf:load resource="javascript:customSaveMessage()"></xf:load>
      </xf:action>

    </xf:model>

Metadata Editor

for the Shelley-Godwin Archive

          <xf:trigger>
            <xf:label> Basics</xf:label>
            <xf:toggle case="basics" ev:event="DOMActivate"></xf:toggle>
          </xf:trigger>
          <xf:trigger id="holdings">
            <xf:label> Holdings Info</xf:label>
            <xf:toggle case="holdings_info" ev:event="DOMActivate"></xf:toggle>
          </xf:trigger>
          <xf:trigger>
            <xf:label> Physical Description</xf:label>
            <xf:toggle case="physical_description" ev:event="DOMActivate"></xf:toggle>
          </xf:trigger>
          <xf:trigger>
            <xf:label> Hands</xf:label>
            <xf:toggle case="hand_info" ev:event="DOMActivate"></xf:toggle>
          </xf:trigger>
          <xf:trigger>
            <xf:label> Data Provenance</xf:label>
            <xf:toggle case="prov" ev:event="DOMActivate"></xf:toggle>
          </xf:trigger>
          <xf:trigger id="related-items">
            <xf:label> Related Items</xf:label>
            <xf:toggle case="surrogates" ev:event="DOMActivate"></xf:toggle>
          </xf:trigger>
          <xf:trigger>
            <xf:label> Changelog</xf:label>
            <xf:toggle case="admin_info" ev:event="DOMActivate"></xf:toggle>
          </xf:trigger>

        <xf:switch>
          <xf:case id="basics">

1 of 7

Basic Item Description

          <xf:group>

              <xf:input id="main-title" bind="title" incremental="true">
                <xf:label>Main title: </xf:label>
              </xf:input>

              <xf:input id="creation-date" appearance="minimal" bind="date">
                <xf:label>Date created: </xf:label>

              </xf:input>

              <xf:textarea id="item-label" bind="desc-label">
                <xf:label>Short description: </xf:label>
              </xf:textarea>

          </xf:group>

                <xf:trigger id="next-to-holdings">
                  <xf:label>Next →</xf:label>
                  <xf:toggle case="holdings_info" ev:event="DOMActivate"></xf:toggle>
                </xf:trigger>

        </xf:case>
          <xf:case id="holdings_info">

2 of 7

Holdings Information

          <xf:group ref="//tei:msDesc/tei:msIdentifier">

              <xf:select1 id="select-repo" ref="tei:repository" appearance="minimal">
                <xf:label>Host institution</xf:label>
                <xf:item>
                  <xf:label>British Library</xf:label>
                  <xf:value>bl</xf:value>
                </xf:item>
                <xf:item>
                  <xf:label>Harvard University, Houghton Library</xf:label>
                  <xf:value>mh</xf:value>
                </xf:item>
                <xf:item>
                  <xf:label>Huntington Library</xf:label>
                  <xf:value>hu</xf:value>
                </xf:item>
                <xf:item>
                  <xf:label>New York Public Library</xf:label>
                  <xf:value>pf</xf:value>
                </xf:item>
                <xf:item>
                  <xf:label>Oxford University, Bodleian Library</xf:label>
                  <xf:value>ox</xf:value>
                </xf:item>
                <xf:action ev:event="xforms-value-changed">
                  <xf:setvalue ref="instance('control-codes')/institution-id" value="instance('itemMD')//tei:repository"></xf:setvalue>
                </xf:action>
              </xf:select1>

              <xf:input id="lib-collection" ref="tei:collection" appearance="minimal">
                <xf:label>Name of collection: </xf:label>
              </xf:input>

              <xf:input id="lib-idno" bind="call-number" appearance="minimal">
                <xf:label>Call number/shelf mark for item: </xf:label>
                <xf:action ev:event="xforms-value-changed">
                  <xf:setvalue ref="instance('control-codes')/output-filename" value="concat(lower-case(translate(instance('itemMD')//tei:msDesc/tei:msIdentifier/tei:idno, ' .,', '_')), '.xml')"></xf:setvalue>
                </xf:action>
              </xf:input>

          </xf:group>

                  <xf:trigger id="prev-to-basics">
                    <xf:label>← Previous</xf:label>
                    <xf:toggle case="basics" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

                  <xf:trigger id="next-to-physDesc">
                    <xf:label>Next →</xf:label>
                    <xf:toggle case="physical_description" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

        </xf:case>
          <xf:case id="physical_description">

3 of 7

Physical Description Aspects of the form, support, and extent of a manuscript, as well as the styles of writing present

          <xf:group ref="//tei:msDesc/tei:physDesc/tei:objectDesc/tei:supportDesc">

              <xf:input id="physical-extent" ref="tei:extent" appearance="minimal">
              <xf:label>Extent: </xf:label>
            </xf:input>

              <xf:textarea id="physical-support" ref="tei:support/tei:p" appearance="minimal">
                <xf:label>Describe the material support of the item: </xf:label>
              </xf:textarea>

              <xf:textarea id="foliation-orig" ref="tei:foliation[@xml:id='original']/tei:p">
                <xf:label>Describe any (original) foliation scheme present: </xf:label>
              </xf:textarea>

              <xf:textarea id="foliation-mod" bind="foliation-modern">
              <xf:label>Describe any additional foliation schemes present: </xf:label>
            </xf:textarea>

              <xf:textarea id="physical-condition" ref="tei:condition/tei:p">
                <xf:label>Describe the condition of the item: </xf:label>
              </xf:textarea>

          </xf:group>

                  <xf:trigger id="prev-to-holdings">
                    <xf:label>← Previous</xf:label>
                    <xf:toggle case="holdings_info" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

                  <xf:trigger id="next-to-hands">
                    <xf:label>Next →</xf:label>
                    <xf:toggle case="hand_info" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

        </xf:case>
          <xf:case id="hand_info">

4 of 7

Manuscript Hands

          <xf:group>

              <xf:textarea id="manu-hands" ref="//tei:msDesc/tei:physDesc/tei:handDesc/tei:p">
                <xf:label>Describe hands found in the item: </xf:label>
              </xf:textarea>

          </xf:group>

                  <xf:trigger id="prev-to-physDesc">
                    <xf:label>← Previous</xf:label>
                    <xf:toggle case="physical_description" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

                  <xf:trigger id="next-to-prov">
                    <xf:label>Next →</xf:label>
                    <xf:toggle case="prov" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

        </xf:case>
          <xf:case id="prov">

5 of 7

Data Provenance

              <xf:input id="metadata-creator" bind="meditor">
                <xf:label>Metadata created/edited for SGA by: </xf:label>
              </xf:input>

              <xf:textarea id="source" bind="metadata-source">
                <xf:label>Source used: </xf:label>
              </xf:textarea>

                  <xf:trigger id="prev-to-hands">
                    <xf:label>← Previous</xf:label>
                    <xf:toggle case="hand_info" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

                  <xf:trigger id="next-to-surrogates">
                    <xf:label>Next →</xf:label>
                    <xf:toggle case="surrogates" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

        </xf:case>
          <xf:case id="surrogates">

6 of 7

Related Items Most of the items in the Shelley-Godwin Archive have been published in facsimile editions.
              This section records information about those surrogate items.

          <xf:group ref="//tei:msDesc/tei:additional/tei:listBibl">

              <xf:textarea id="surrogate1" ref="tei:bibl">
                <xf:label>Citation for related/additional surrogate for this item: </xf:label>
              </xf:textarea>

          </xf:group>

                <xf:trigger id="next-to-manifest">
                  <xf:label> Link page images to this Item</xf:label>
                <xf:toggle case="file_manifest" ev:event="DOMActivate"></xf:toggle>
              </xf:trigger>

                  <xf:trigger id="prev-to-prov">
                    <xf:label>← Previous</xf:label>
                    <xf:toggle case="prov" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

                  <xf:trigger id="surrogate-to-finish">
                    <xf:label>Finish</xf:label>
                    <xf:toggle case="admin_info" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

        </xf:case>
          <xf:case id="file_manifest">

Link Page Images Label image files with descriptive information indicating their relationship to the original item

<xf:output id="institution-code" ref="instance('control-codes')/institution-id"></xf:output>

Select an item:

Loading

Retrieving page images for this item. Please wait.

                                filename
                                link
                                label

                        <button id="jsSave" class="btn btn-primary">Save</button>

                  <xf:trigger id="prev-to-manifest">
                    <xf:label>← Back</xf:label>
                    <xf:toggle case="file_manifest" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

                  <xf:trigger id="img-to-finish">
                    <xf:label>Finish</xf:label>
                    <xf:toggle case="admin_info" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

          </xf:case>
          <xf:case id="admin_info">

7 of 7

Edit Changelog Help the Shelley-Godwin Archive keep track of everyone's contributions

                Timestamp
                Author
                Change(s)

          <xf:repeat id="change-repeat" nodeset="instance('itemMD')//tei:revisionDesc/tei:change">

                    <xf:output ref="./@when"></xf:output>

                    <xf:input ref="./@who">
                        <xf:action ev:event="DOMFocusIn">
                            <xf:load resource="javascript:makeEditable()"></xf:load>
                        </xf:action>
                    </xf:input>

                        <xf:input ref=".">
                            <xf:action ev:event="xforms-value-changed">
                                <xf:setvalue ref="./@when" value="now()"></xf:setvalue>
                            </xf:action>
                        </xf:input>

            </xf:repeat>

          <xf:trigger>
                <xf:label>Add an entry</xf:label>
                    <xf:action ev:event="DOMActivate">
                    <xf:insert nodeset="//tei:revisionDesc/tei:change" at="last()" position="after"/>
                    <xf:setvalue ref="instance('control-codes')/output-filename" value="concat(lower-case(translate(instance('itemMD')//tei:msDesc/tei:msIdentifier/tei:idno, ' .,', '_')), '.xml')"></xf:setvalue>
                    <xf:setvalue ref="//tei:revisionDesc/tei:change[last()]/@when" value="now()"></xf:setvalue>
                    <xf:setvalue ref="//tei:revisionDesc/tei:change[last()]/@who" value="'Click to edit'"></xf:setvalue>
                    <xf:setvalue ref="//tei:revisionDesc/tei:change[last()]" value="'Click to edit'"></xf:setvalue>
                    </xf:action>
          </xf:trigger>

                  <xf:trigger id="prev-from-submit">
                    <xf:label>← Go back</xf:label>
                    <xf:toggle case="surrogates" ev:event="DOMActivate"></xf:toggle>
                  </xf:trigger>

                  <xf:submit id="finish" submission="save">
                    <xf:label>Save</xf:label>
                  </xf:submit>

Success!

Metadata for this item has been saved. Thank you.

        </xf:case>
        </xf:switch>

            Powered by XSLTForms, Bootstrap, Font Awesome, fancyBox, and poetry.

let $xslt-pi := processing-instruction xml-stylesheet {'type="text/xsl" href="http://50.19.209.106/fs/xforms/xsltforms/xsltforms.xsl" '}
let $css-pi := processing-instruction css-conversion {'no'}

return ($xslt-pi,$css-pi,$form)