Differences between revisions 8 and 9
Revision 8 as of 2007-02-12 16:16:17
Size: 2805
Editor: drseuk
Comment: Added link to new Permissions page
Revision 9 as of 2009-09-20 23:28:03
Size: 2807
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 58: Line 58:
Usually, with large document sets, you are looking at writing an import script to automate things a bit. qMax has donated a [attachment:lenyaimport.pl perl script] for this purpose that may serve as inspiration. Usually, with large document sets, you are looking at writing an import script to automate things a bit. qMax has donated a [[attachment:lenyaimport.pl|perl script]] for this purpose that may serve as inspiration.

Importing content into Lenya

* HowToPermissions You may want to read this if things don't work as expected.

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 perl script 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.

HowToContentImport (last edited 2009-09-20 23:28:03 by localhost)