Difference between revisions of "Open-Xchange Publishing"

(Complete Contacts and Infostore example)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Publishing Data with Open-Xchange =
+
The publish mechanism was replaced with version 7.8.0 by the '''''Sharing and Guest Mode'''''. See [https://documentation.open-xchange.com/7.10.2/middleware/miscellaneous/sharing_and_guest_mode.html documentation.open-xchange.com] for details.
 
 
Open-Xchange offers to publish an increasing amount of internal data like contacts, documents, appointments. This data can be published in a way that it is machine-readable using [http://oxmf.org OXMF] and it can be customized in it's look and feel using common web techniques like CSS.
 
 
 
Open-Xchange is using the [http://freemarker.org/ FreeMarker Template Engine] to export the internal date to the published templates. Check the [http://freemarker.org/docs/index.html FreeMarker Manual] on how to use it.
 
 
 
== Open-Xchange Internal data structures to access with FreeMarker ==
 
 
 
=== Contacts ===
 
Within freemarker, you are given a list called <tt>contacts</tt>, which contains all contacts of the given publication. This is the central element of the publication. Freemarker enables you to access every attribute of the class Contact that has both a setter and a getter. See the JavaDoc for the class to find out about attributes or use the example template of your OX.
 
 
 
==== Example for Contacts ====
 
This is the basic loop over the list of contacts that you get:
 
  &lt;#list contacts as contact&gt;
 
      &lt;div class="ox_contact"&gt;
 
        &lt;span class="ox_company"&gt;$contact.company&lt;/span&gt;
 
        &lt;span class="ox_company"&gt;$contact.uRL&lt;/span&gt;
 
        &lt;span class="ox_note"&gt;$contact.note&lt;/span>
 
      &lt;/div&gt;
 
  &lt;/#list&gt;
 
 
 
=== Infostore ===
 
You are given a list called <tt>infostore</tt>, which contains all infostore items of the given publication. This is the central element of the publication. Freemarker enables you to access every attribute of the class Infostore that has both a setter and a getter. See the JavaDoc for the class to find out about attributes or use the example template of your OX.
 
 
 
==== Example for Infostore ====
 
  &lt;#list infostore as infoitem&gt;
 
      &lt;div class="an_infoitem"&gt;
 
        &lt;span key="ox_title"&gt;$infoitem.title&lt;/span&gt;
 
        &lt;span key="ox_url"&gt;$infoitem.URL&lt;/span&gt;
 
        &lt;span key="ox_title"&gt;$infoitem.version&lt;/span&gt;
 
        &lt;span key="ox_creationDate"&gt;$infoitem.creationDate&lt;/span&gt;
 
        &lt;span key="ox_lastModified"&gt;$infoitem.lastModified&lt;/span&gt;
 
        &lt;span key="ox_comment"&gt;$infoitem.description&lt;/span&gt;
 
      &lt;/div&gt;
 
  &lt;/#list&gt;
 
 
 
=== Calendar ===
 
The calendar is a bit trickier than the others, because appointments can be recurring series with exceptions. So their data structure is a bit more complicated. That is why there is currently no Publish/Subscribe system in place, the freemaker templating is just used to render print views. There are two approaches to render the calendar.
 
 
 
==== Printing the text-processor way ====
 
The first approach uses a text-processor style: Your are given a list of appointments (all non-recurring, they have been broken up for you already) sorted by start date and a list of formatting information (like "between appointment 1 and 2 starts a new day"). You are free to ignore most of the formatting information (if you want to make a plain list of appointments, for example).
 
 
 
==== Printing the programmer way ====
 
 
 
==== Variables for calendar printing ====
 
 
 
{|
 
! Variable !! Description
 
| appointments
 
| A list of appointments, all single day appointments with no recurrence information, sorted by starting date.
 
|-
 
| formattingInfo
 
| A list of formatting information, each entry containing a position (position zero is before the first appointment) and a flag that explains what it marks.
 
|}
 
 
 
 
 
Formatting information:
 
{|
 
! Constant !! Description
 
| "0"
 
| Day break: Following appointment starts on a new day
 
|-
 
| "1"
 
| Week break: Following appointment starts on a new week
 
|-
 
| "2"
 
| Month break: Following appointment starts on a new month
 
|-
 
| "3"
 
| Year break: Following appointment starts on a new year
 
|-
 
| "10"
 
| Day name: This element contains the name of the new day
 
|-
 
| "11"
 
| Fill day: Place holder if the list covers a day that as no appointment in there (so you do not have to guess when to place fillers in more complex designs)
 
|}
 
 
 
== Additional fields for all publications ==
 
These fields are contained within all publication templates, independent of the type.
 
 
 
{|
 
! Variable !! Description
 
|-
 
| publication
 
| The complete publication object.
 
|-
 
| request
 
| The http request that was sent to show this publication.
 
|-
 
| dateFormat
 
| The format of the date, usually in the java.text.SimpleDateFormat.
 
|-
 
| timeFormat
 
| Like date format, just for displaying times during the day (without the year, month or day).
 
|-
 
| privacy
 
| The privacy text meant to be published on the displayed page (*).
 
|-
 
| userContact
 
| The contact that is responsible for the publication of this page (*).
 
|}
 
 
 
(*) Note: ''Several countries legally require you to publish this information. Leave it out at your own peril.''
 
 
 
== Changing the default templates ==
 
 
 
The default templates of all existing items to publish can be found in the folder <tt>/opt/open-xchange/templates/</tt> of every Open-Xchange installation, if the packages '''open-xchange-publish-microformats''' and/or '''open-xchange-calendar-printing''' are installed:
 
 
 
$ dpkg -L open-xchange-publish-microformats | grep templates
 
/opt/open-xchange/templates
 
/opt/open-xchange/templates/contacts_oxmf_uncensored.tmpl
 
/opt/open-xchange/templates/infostore.tmpl
 
/opt/open-xchange/templates/contacts_hcard_censored.tmpl
 
/opt/open-xchange/templates/contacts_oxmf_censored.tmpl
 
/opt/open-xchange/templates/contacts.tmpl
 
/opt/open-xchange/templates/contacts_hcard_uncensored.tmpl
 
 
 
$ dpkg -L open-xchange-calendar-printing | grep templates
 
/opt/open-xchange/templates
 
/opt/open-xchange/templates/cp_monthview_table.tmpl
 
/opt/open-xchange/templates/cp_monthview_list.tmpl
 
/opt/open-xchange/templates/cp_workweekview_table.tmpl
 
/opt/open-xchange/templates/cp_weekview_table.tmpl
 
/opt/open-xchange/templates/cp_dayview_table.tmpl
 
 
 
== Complete Contacts and Infostore example ==
 
 
 
The archive http://software.open-xchange.com/OX6/doc/publishing-templates.zip contains a complete example for Contacts and Infostore publishing. In order to use it, just copy the complete <tt>_data</tt> directory on a web server.
 
 
 
Adapt the path to files '''contacts.tmpl''' and '''infostore.tmpl''' and replace it with the files in <tt>/opt/open-xchange/templates</tt>.
 
 
 
If you want to change the colors or images, just edit <tt>_data/css/pubsub.css</tt> and replace the images in the <tt>_data/img/</tt> directory.
 
 
 
When these files are changed, new published items in Open-Xchange will get this look and feel. Check out the online help or the [http://software.open-xchange.com/OX6/doc/ user guides] on how to publish using Open-Xchange.
 

Latest revision as of 08:54, 15 May 2019

The publish mechanism was replaced with version 7.8.0 by the Sharing and Guest Mode. See documentation.open-xchange.com for details.