Silva
Silva Documentation

QuickStart Guides

Authors

Login

Adding Content

Kupu

Adding Properties to a Document

Importing Spreadsheet Data

Authoring Workspace

Editor Screen

Forms Editor

Document Publish Screen

Editors

Content Organization

Publishing

Access Keys & Shortcuts

Content Management Screens

Contents Screen

New Screen

Import Screen

Preview Screen

Properties Screen

Addables Screen

Publish Screen

Export Screen

Chief Editors

Author / Editor / Chief Roles

Groups

Viewer Roles

Roles and Permissions

Role Management Screens

Access Screen

Lookup Screen

Group Management

Access Roles Diagrams

Managers

Login Managers

Manager Roles

Adding Users

location Adding External Sources

Groups

Improving Accessibility

API

Template Design

Silva Overview

Silva in an Organization

Silva Features

Index

Adding External Sources

This guide explains:

Overview

Silva has an External Sources extension which gives the ability to add data from non-Silva sources in Silva Documents.  These non-Silva, or "external" sources, can for example be a relational database (e.g. addresses, price-listings, course info, etc.) or the outcome of executing a Python script (which could e.g. make an RSS feed available for Silva Documents).

Since an external source can potentially be resource intensive or expose a vulnerability, only users with ZMI access (Zope Management Interface, usually the site managers) can create external sources. The exception to this rule is the CSV Source object because its possibilities are limited.  A CSV source can be created from the Silva Management Area by an Author. It is the site administrator's responsibility to make sure no vulnerabilities are exposed to the Authors or the public website. This does imply the site administrator needs to be knowledgeable of both Silva and the external source being accessed.

An external source added to a Silva site also offers the author a set of parameters (via a Formulator form) to aid layout of the external source within the Silva Document.

Installing the External Sources product into Zope and Silva

  1. Install the Silva External Sources product in your Zope.  Unpack the SilvaExternalSources tarball into your Zope instance at the relevant Zope Products directory for the Zope installation.  If you do not have access to the Server ask your host to do this for you.
  2. Restart Zope.
  3. As Manager, login to the Zope Management Interface.
  4. Go to your Silva Root instance. Click on the Services Tab in the top navigation bar.
ServicesZMI.png


5. Scroll down and click onto “service_extensions (Silva Product and Extensions Configuration)”.

6. To make the Silva External Sources work in a particular Silva root, the install button needs to be clicked for this extension. This install button is to be found in the service_extensions, available in the Services-tab in the Zope Management Interface of this Silva root. Click install in the SilvaExternalSources box.

ExtSerInstZMI.gif

Using an SQL Source

The SQL Source allows an SQL query in a table. Because of the security issues mentioned above, only Zope managers are allowed to create them. Authors can place references to an SQL Source into their documents.

Prerequisites
  1. A Zope adapter for a SQL database must be installed
  2. At least one SQL connection object must be visible/reachable from the Silva root
  3. Manager creating the SQL Source has to know SQL.

Adding an SQL Source

1. Go to the ZMI (Zope Management Interface) and navigate to the Silva root.

addSQL2.png

2. Select Silva SQL Source from the drop-down menu.

addSQL.png

3.  Fill in id and title and press Add and Edit.
4.  If the displayed SQL connection isn't the one you want, choose a different one; check if the data encoding is the same as your database delivers; enter the sql statement you want to be executed.
5. Save the changes
6. Test the query via the Test tab.

If everything went well, the SQL Source can now be used in documents.
In a document, select External Source as the element to insert and choose the newly created SQL Source. Then press the update button next to the drop down list.

Customizing

In the form that appears the author can adjust the appearance of the table to be displayed and can add a caption if needed.

The Edit tab of the SQL Source in the ZMI contains a link called edit parameters. With this link a Formulator form can be changed, which displays when the SQL source is referenced from a document. Of course, one needs to know how to manage forms with Formulator – this is out of scope for this guide.

Using a CSV Source

CSV Source displays data that is uploaded in a format called ‘comma separated values’. CSV is a plain text format where each line contains a row of a table; the columns within a row are delimited by commas. We then have a tabular structure to present to the viewer.

Something important to note with the CSV Sources is the encoding of the data that will be uploaded. For this guide it is enough to say that the encoding of the data describes the way the characters are represented.

Another difference is that the parameter form shown when the CSV Source is referenced from a document is not changeable.

Example:
    When you save your Excel-Sheet as .csv, Excel uses one of the windows encodings. For most western European countries
    (EURO land:) this will be ‘cp1252’. Of course you have to know the name of the encoding before you upload the data.

In the edit view of the CSV Source you can change the encoding after the data was uploaded. If you experience strange visual effects, try another encoding.

In the edit view you also can upload another file, which replaces the actual data, or apply manual changes to the data.

The most important aspect of CSV Sources is you can insert references to them into documents.

Customizing

CSV Sources behave like normal assets, so you can specify some parameters which are attached to the document. For CSV Sources these parameters consist of the table style to use and the number of rows to show if the table is long and needs batching.

Adding a CSV Source to your Silva

  1. Before adding data from a source such as Microsoft Excel you must first save your spreadsheet data file as a CSV file.
CSVsave.png


  2.  Add a CSV Source via the drop down select list.

addCSVSource.png


3.  Fill in the form, browse to select 'filename.csv' on your drive, and click the Add button.

CSVform.png


4.  In the Silva Management Area an Author can now access this asset and place it inside a document in the forms editor, by adding an “external source” from the drop down add element list.

addexternalsource.png



5.  In the edit form, select the asset (in this case “Income Source”) from the drop down list and click update.

externalSourceUpdate2.png

6.  To view the data click on public preview.

7.  Publish the document.

CSV Source Updates

Changes to the data of the CSVSource are done by uploading a new set of data or editing the raw data via the edit screen.  A re-publication of the document is not necessary.

The table layout is the standard table layout Silva uses for its tables.  But there is, as always, the possibility to modify the page template which creates the html table.

Using Code Source

The Code Source element is a feature for including dynamically generated html into a document. It resembles a Python Script but is a bit more complex.

Code Sources can only be created on the Zope level and need Manager rights. Here is a list of the steps to take:

  1. Open the Zope (ZMI) management screen and navigate to the desired Silva root.
  2. Choose Silva Code Source from the drop-down menu.
  3. Fill in id,  title and script id, then click the Add and Edit button.
  4. Choose the Contents tab and add a Python Script;
    enter your script.
  5. Save the changes.
  6. Test the Code Source via the View tab.

Now the Code Source can be used from within a document.

The procedure is the same as with the other External Sources; the part about the parameter form also applies here.


© Copyright 2002-2004 Infrae.
All rights reserved. mail