Website Downloads Documentation Knowledgebase Wiki Issue tracker Commercial support

Daisy Detachment

Class diagrams

class diagram
Click to enlarge

GUI diagram
Click to enlarge

Getting a detachment from the repository

get_detachment
Click to enlarge

This shows the process of downloading a detachment from the repository. The actual task of conecting occurs in the constructor of DetachmentRepositoryTalker. Once the DetachmentManager has a Document from the repository, it creates a DetachmentDocument, which is an implementation of the Document interface suited to working offline. It then creates the detachment zip file: Meta info and fields will be written to xml documents, and parts will be written to appropriate files such as html or jpeg. All this will be put into one directory which will then be zipped with a .ddz extension. This does not need to happen immediately as the program interacts with the DetachmentDocument rather than the actual files.

Opening a detachment

open_detachment
Click to enlarge

This shows the process when a user opens an existing detachment file from within the program. The process of opening a file directly from outside the program would be similar - it just would not have the initial interaction with the DetachmentView and file chooser. The main work involves reading the 'content.xml' file and creating a DetachmentDocument from the information stored there. Calling 'inform()' on the DetachmentView causes it to refresh itself, acquiring the latest open documents from the DetachmentManager.

Editing a detachment

edit detachment sequence diagram
Click to enlarge

Opening a detachment involves first unzipping the files to a temporary location then creating a representation of the document as an instance of the DetachmentDocument class. This will be very similar to the Document interface, but may not have all the same methods, and will have an additional method 'inform()' for notifying observers that a change has occurred. I have not decided whether or not it should in fact implement the Document interface. This is loosely based on the model-view-controller pattern. The detachment files contain the data, but during execution the DetachmentDocument provides a model of the Document. DetachmentDisplay is an interface which allows viewing of the Document. This may be implemented as a GUI or CLI. It should display document metadata, fields and parts. A DetachmentDisplay will have a DetachmentActionHandler attached to it for responding to user events. The main types of user events will be opening part files for editing and modifying fields and document meta info.  Opening part files involves launching an editor. At this stage I am planning to let the user choose which editor they wish to use.  Changes will be made to the physical file and will not, as far as I can see, require any changes to the DetachmentDocument. Changing document meta info and fields will not require an external editor, they may be done through the DetachmentDisplay and DetachmentActionHandler. Editing this data will require the DetachmentDocument to be updated, which will trigger it to save() the changes to file and inform() any DetachmentDisplay. 'Save' be be a bad word to use since Document also has a 'save()' method which saves the Document to the repository.

GUI screenshot

gui-screenshot
Click to enlarge

This is the basic GUI so far.

Detachment zip file (.ddz) structure

META-INF/
  + manifest.xml
meta.xml
daisy-467/
  + content.xml
  + Parts/
    + 2.jpg
daisy-392/
  + content.xml
  + Parts/
    + 1.html
daisy-new-0/
  + content.xml
  + Parts/
settings.xml
resources/
  + default.css

manifest.xml will contain the names and paths of all files in the detachment. This is copied from odf. An example:

<?xml version="1.0" encoding="UTF-8"?> 

<manifest:manifest xmlns:manifest="http://outerx.org/daisy/detachment/manifest/1.0">

 <manifest:file-entry manifest:media-type="text/xml"    manifest:full-path="meta.xml"/> 
 <manifest:file-entry manifest:media-type="text/xml"    manifest:full-path="daisy-467/content.xml"/>
 <manifest:file-entry manifest:media-type="image/pjpeg" manifest:full-path="daisy-467/partdata/2.jpg"/> 
 <manifest:file-entry manifest:media-type="text/xml"    manifest:full-path="daisy-392/content.xml"/>
 <manifest:file-entry manifest:media-type="image/jpeg"  manifest:full-path="daisy-392/partdata/1.html"/> 
 <manifest:file-entry manifest:media-type="text/xml"    manifest:full-path="daisy-new-0/content.xml"/>
 <manifest:file-entry manifest:media-type="text/xml"    manifest:full-path="settings.xml"/> 
 <manifest:file-entry manifest:media-type="text/css"    manifest:full-path="resources/default.css"/> 

</manifest:manifest>

We may wish to use 'mime-type' rather than 'media-type'.  meta.xml will contain general information about the detachment file:

<xml version="1.0" encoding="UTF-8"?> 

<ddz:meta xmlns:ddz="http://outerx.org/daisy/detachment/1.0"  xmlns:dc="http://purl.org/dc/elements/1.1/">

  <dc:date>2006-05-15T17:52:45</dc:date>
  <ddz:repository-url>http://localhost:9263</ddz:repository-url>
  <dc:creator>Tim Cranfield</dc:creator>
  <ddz:document-statistic document-count="1"/>

</ddz:meta>

The dc standard was the most appropriate I could find for our needs, but it has a small element set so we have to use some of our own elements. An alternative is to include Daisy specific information in a separate file.

content.xml will be an xml representation of a document, similar to that obtained from the document.getXML() method. The document element has some additional attributes which can not be got without a connection to the repository: branchName, ownerName and languageName. The part element also has some additional attributes.

<document   xmlns="http://outerx.org/daisy/1.0"
    name="roses"               id="4"
    validateOnSave="true"      dataVersionId="-1"          createdFromVersionId="-1"    createdFromLanguageId="-1"   private="false"
    createdFromBranchId="-1"   variantUpdateCount="1"      newVersionState="publish"    retired="false"              lastVersionId="1"
    typeId="3"                 languageId="1"              branchId="1"                 liveVersionId="1"            updateCount="1"
    owner="3"                  created="2006-05-27T09:33:25.000+12:00" 
    lastModifier="3"           lastModified="2006-05-27T09:33:25.000+12:00" 
    variantLastModifier="3"    variantLastModified="2006-05-27T09:33:25.000+12:00"     branchName="main"             languageName="default"  
    ownerName="tim"   > 
  <summary>Welcome to the Daisy home page.</summary>
  <customFields>
    <customField>  value="happy"  name="mood" />
  <customFields>
  <lockInfo hasLock="false"/>

  <collections>
    <collection  name="scratchpad  id="347"/>
  </collections>

  <fields/>

  <parts>
    <part fileName="roses.jpg" mimeType="image/pjpeg" size="104718"  typeId="3"/>
   typeName="ImageData" isDaisyHtml="false" />
  </parts>

  <links/>

</document>

Settings.xml may be useful for recording editor choices.

Comments (0)
Advertisement

Daisy hosting, installation, support. Workshops and turnkey Daisy CMS projects. Get Daisy from its creators.

outerthought.org

Downloads provided by

SourceForge.net Logo

Open source stats