Importing content into Lenya

Documents

To import xml document into lenya publication you have to do following things:

  1. copy document file into context://lenya/pubs/$pub/content/$area/$nodepath/$nodename/index_$ln.xml
    (here $pub is your publication id, $area is live|authoring, $nodepath is sitetree path of parent node, $nodename
    is name of node itself. $ln is language code.)
    Note: This is how o.a.l.cms.authoring.DefaultDranchCreator creates nodes, for other creators, configured in doctypes.xconf the way may differ.

2. add node to sitetree at context://lenya/pubs/$pub/content/$area/sitetree.xml
The node should be placed inside node related to $nodepath:

  <node id="$nodename" visibleinnav="$bool">
    <label xml:lang="$ln">$navigation_label</label>
  </node>
 

If you import several languages, put in other labels.

3. create workflow file for this node (as "not live") in context://lenya/pubs/$pub/content/workflow/history/authoring/$nodepath/index_$ln.xml:

 <wf:history xmlns:wf="http://apache.org/cocoon/lenya/workflow/1.0" workflow="2stage.xml">
  <wf:variable name="is_live" value="$bool"/>
  <wf:version date="$date $time" state="$area">
  <wf:identity>
    <wf:user id="$user"/>
    <wf:machine ip-address="$ip"/>
  </wf:identity>
 </wf:history>
 

With values of is_live/@value and version/@state according to area yout import into.

If you want to import authoring document, you should import it into authoring area, and set workflow value of is_live to "false" and state="authoring". And then publish document using lenya menues.

If you want to import live document, you should import it to both authoring and live areas, and then set workflow value of is_live to "true" and state="live".

Assets

To import asset for some node $nodepath/$nodename:

  1. put it in context://lenya/pubs/$pub/resources/$area/$nodepath/$nodename/$filename

2. create context://lenya/pubs/$pub/resources/$area/$nodepath/$nodename/$filename.meta with DublinCore data.

Note: extention ".meta" is not replacing filename extension, but appended to full filename.

3. That's it.

Script

Usually, with large document sets, you are looking at writing an import script to automate things a bit. qMax has donated a lenyaimport.pl for this purpose that may serve as inspiration.

If you write your own script, make sure that the xml declaration in the .meta files begins on the first line and doesn't have whitespace before it otherwise Lenya will ignore it as invalid XML.

PS: This code runs on Linux and not on Windows.

  • No labels