Example - OneStart

Download Report

Transcript Example - OneStart

I
N
D
Starting XML Content
I
A
N
A
U
N
During this class, you'll be writing your
XML in Eclipse and copying the code into
OneStart using the publishing options
covered in the previous class.
I
V
E
R
S
I
T
Y
If you're new to Eclipse, there will be time
during the first exercise to get familiar with
it.
I
N
D
Portal Element
I
A
N
A
U
N
The <portal> element is the outer tag
that contains the XML content.
All of your XML goes within this root
element.
I
V
E
R
S
I
T
Y
<portal xmlns="https://onestart.iu.edu"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://onestart.iu.edu
xmlportlet.xsd"> .........
</portal>
I
N
D
Content Pages
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
 Put content into separate "pages" within a single XML
file
 Can use content navigation and content links to
provide navigation within XML content
<content-page content-page-number="1">
…
</content-page>
<content-page content-page-number="2">
…
</content-page>
I
N
D
Links
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Can link to other content pages, external links, portal
pages.
<link content-page-number="2"
title="Display Title" focus="fullscreen" />
<link url="https://onestart.iu.edu"
title="Display Title" window-width="1000"
window-height="800" status="yes" scrollbars="no"
resizable="no" toolbar="no" location="no"
menubar="no" directories="no" />
I
N
D
More Link attributes
I
A
N
A
Using the image-button-name attribute, <link> element
can also be used to create a button that will dynamically
change color determined by the tab the user is on.
U
N
<link url="http://mywebapplication.edu" image-button-name="view"/>
I
V
E
R
S
I
T
Y
You can also put your own image in by using the
<image> attribute. Other attributes include specifying
size in pixels using image-width and image-height, and
image-alt to provide HTML alt functionality.
I
N
D
<link-param>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Using <link-param> with content page links you can
pass values from one content-page to another:
<link content-page-number="2" title="Pass param">
<link-param name="test" value="1" />
</link>
…
<content-page content-page-number="2">
${test}
</content-page>
I
N
Additional Attributes
D
I
A
N
A
U
N
I
V
E
R
S
I
T
Y










content-page-number
portal-page-number
target
window-width
window-height
focus
status
scrollbars
resizable
toolbar
 directories
 location
 menubar
I
N
D
Image
I
A
N
A
You can also just put your own image in that is not a link by using
the <image> tag. Image contains attributes specifying size in pixels
using width and height, alt to provide HTML alt functionality,
and button-name.
U
N
I
V
E
R
S
I
T
Y
<image location=
"https://www.example.com/myimage.gif"
width="100" height="200"/>
I
N
<list>
D
I
A
N
A
U
The list tag allows both ordered and unordered lists.
<list ordered="false">
<list-item >myitem</list-item>
</list>
N
I
V
E
R
S
I
T
Y
Becomes in HTML:
<ul>
<li>myitem</li>
</ul>
I
N
D
<table>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
You can create tables much like you can in HTML.
<table borders="true" width="90%">
<row>
<header width="10%">Name:</header>
<cell width="90%">
My cell text
</cell>
</row>
</table>
I
N
D
<more-info>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Creates an area for displaying contact
information.
<more-info email="[email protected]"
url="http://www.example.com/helppage"
display-name="My Help URL"/>
I
N
XML/HTML Conversion
D
I
A
XML
HTML
<align value="center">
move to center
</align>
<div align="center">
move to center
</div>
U
<bold> Bold Text </bold>
<strong> Bold Text </strong>
N
<h3> This is a heading </h3>
I
<heading text="This is a
heading" />
V
<newline />
<br />
E
<paragraph>
Write a paragraph
</paragraph>
<p>
Write a paragraph
</p>
<separator />
<hr />
N
A
R
S
I
T
Y
I
N
D
Special Entities
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
As in HTML, replacements in XML
content are necessary for special entities
 &: &amp;
 <: &lt;
 >: &gt;
I
N
D
I
XML Content Exercise #1
(Introduction)
A
N
A
U
N
I
V
E
R
S
I
T
Y
In Eclipse, open the file "XML Content
Exercise 1.xml" contained in the folder
"publisherTraining/Exercises" and follow
the included instructions.
I
N
D
Permissions/Conditions
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Using information available to OneStart
through ADS, you can specify what
information will be made available to
different types of users.
I
N
D
<variable>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
The <variable> element is used to create
variables in your xml content that can be used
in conditions, permissions, and general
displays.
Local variables are declared within one of your
content page tags and can only be referenced
in that content page, whereas global variables
are set outside of a specific content page and
can be accessed throughout your XML content.
I
N
D
Variable type
I
A
N
A
Type is an optional attribute of variable
that supports two values:
U
N
I
V
E
R
S
I
T
Y
 date-format
 person-attribute
I
N
D
Variable type="date-format"
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<variable name="today"
type="date-format"
type-value="MM/dd/yyyy" />
Can also use offset attributes to reference times
in the future or past:
<variable name="tomorrow" type="date-format"
type-value="MM-dd-yyyy" day-offset="1" />
<variable name="HourFromNow" type="dateformat" type-value="h:mm a" minuteoffset="60" />
<variable name="OneWeekAgo" type="dateformat" type-value="MM-dd-yyyy" day-offset="7" />
I
<variable>, using
person-attribute
N
D
I
A
N
A
<variable name="email"
type="person-attribute"
type-value="user.iu.email" />
U
N
I
In this example you could display the user's email by
using the following variable reference:
V
E
R
${email}
S
I
T
Y
For more person-attribute values see:
https://uisapp2.iu.edu/confluence//x/NICd
I
N
D
I
<variable>
(With Test Attribute, Xpath)
A
N
A
U
N
Comparing with Test:
<variable name="MyVariable" value="variableValue1"/>
<variable name="MyVariable2" value="variableValue2"
test="$[MyVariable] = 'test'"/>
<variable name="MyVariable2" value="variableValue3"
test="$[MyVariable] = 'variableValue1'"/>
I
V
Referencing with Xpath:
E
<variable name="myNewTestVariable"
dataset="myDataset"
xpath="data/rows/row/more_xpath_to_my_data" />
R
S
I
T
Y
I
N
D
<xpath>
I
A
N
A
U
 Language for navigating XML documents
 Supported in XML contents using <xpath>
element
N
I
V
E
R
S
I
T
Y
Examples taken from:
http://www.w3schools.com/Xpath/default.asp
I
N
D
/bookstore
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
I
N
D
/bookstore/book
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
I
N
D
/bookstore/book/title
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
I
N
D
/bookstore/book[price>35.00]/title
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.95</price>
</book>
</bookstore>
I
N
D
<permission>
I
A
N
Three different ways to create permissions:
A
U
N
I
V
 Person – personAttribute; user information from ADS
 Group – ADS group
 Role – cachedPermissions; these are complex
expressions created by the OneStart team
E
R
S
I
T
Y
Additionally, <or>, <not>, and <and> elements can be
used to form complex permission expressions.
I
N
D
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<permission>
Example
<permission name="myPermission">
<![CDATA[
<or>
<personAttribute key="user.iu.ou" value="BL"/>
<group key="BL-UITS-ONESTART-TEAM"/>
<cachedPermission key="iu-permission-in-student"/>
</or>
]]>
</permission>
I
N
D
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<permission> Example,
A Little More Complex
<or>
<cachedPermission key="IU-PERMISSION-CO-FORMERSTUDENT"/>
<and>
<cachedPermission key="IU-PERMISSION-STUDENT"/>
<group key="MY_ADS_GROUP"/>
<not>
<personAttribute key="user.iu.ou" value="BL"/>
</not>
</and>
</or>
I
N
D
<if>
I
A
N
A
U
The if tag is used to create conditionals.
<if test="$[myVariable] != 'variableValue'">
My variable
</if>
N
I
V
E
R
S
I
T
Y
<if permission="IU-PERMISSION-STAFF">
I am a staff.
</if>
I
N
D
<safeword-protect>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<safeword-protect>
My safeword card projected data.
</safeword-protect>
I
N
D
I
XML Content Exercise #2
(Permissions)
A
N
A
U
N
I
V
E
R
S
I
T
Y
In Eclipse, open the file "XML Content
Exercise 2.xml" contained in the folder
"publisherTraining/Exercises" and follow
the included instructions.
I
N
D
External Data Sources
I
A
N
A
U
Access your existing XML files (including
RSS feeds) as well as your personal
databases using the <dataset> element
N
I
V
E
R
S
I
T
Y
Supported Databases:
Oracle
MySQL
Microsoft SQL
I
N
D
<dataset>
I
A
N
A
U
N
In this example, we retrieve data from an external xml
file:
<dataset name="datasetFromURL"
datasource=
"https://www.example.com/sample.xml" />
I
V
E
R
S
I
T
Y
In this example, we retrieve data from an external
database we registered with OneStart:
<dataset name="datasetFromDB"
datasource="ourDatasource"
query="SELECT 1 FROM DUAL" />
I
N
D
<dataset-bind-param>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
 Allows you to dynamically assign
parameters while querying a database
 "index" attribute defines the order you
want your parameters inserted into the
query
 "type" attribute specifies whether the
bind-param is an "int", "long", or "string"
I
N
D
Dynamic Dataset Query
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<dataset name="myDataset"
datasource="myDatabase"
query="select name from userTable where
year = ? and user_id != ?"
cache-minutes="30" cache-type="user">
<dataset-bind-param index="1" type="int">
2009
</dataset-bind-param>
<dataset-bind-param index="2" type="string">
${userId}
</dataset-bind-param>
</dataset>
I
N
D
cache-minutes & cache-type
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
 cache-minutes: how often you want OneStart
to fetch the data from your database
 cache-type: valid values are "user" and
"global"
 If your query is specific to the user logged in
use the "user" type, so OneStart will create a
new cache for each user who views this page
 Use global if your query is not unique to each
user, therefore all users share the same cache.
I
N
D
Iterate Over Retrieved Data
I
A
N
A
U
Often times your datasets will contain
multiple results. OneStart offers three
ways to display/interact with your data:
N
I
V
E
R
S
I
T
Y
<rss>
<data-table>
<for-each>
I
N
D
Working With RSS Feeds
I
A
N
A
U
N
I
V
If your datasource is an RSS feed, you
can display its contents as they appear in
other feed readers.
<dataset name="exampleRss"
datasource="https://www.example.com/rss.aspx"
cache-minutes="5" cache-type="global"></dataset>
E
R
S
I
T
Y
<content-page content-page-number="3">
<rss dataset="exampleRss"
showRssImage="true" showRssTitles="true"
showRssDescriptions="true" />
</content-page>
I
N
D
<data-table>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Presents your data in a table that takes
advantage of paging and sorting.
<data-table name="User"
dataset="usersDB" page-size="5" >
<data-column header="User Name" name="userName" />
<data-column header="Person ID" name="personID" />
<data-column header="Action" id="action1">
<data-column-text test="${User.personID == 'admin'}">
This text will appear only when personID is equal to 'admin'.
</data-column-text>
</data-column>
</data-table>
I
N
D
Why visible="false"?
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
By making visible="false", it will not display in your table, but you will have access to
it in your URL.
<data-table name="userTable" dataset="userDB">
<data-column header="User Name" name="userName" />
<data-column header="userID" name="userID" visible="false"/>
<data-column header="Action" id="action1">
<data-column-text >
<link title="Change"
url="https://www.example.com/edit=${userTable.userID}"/>
</data-column-text >
</data-column>
</data-table>
I
N
D
for-each example
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<list>
<for-each var="myVariable" dataset="myDB">
<list-item>${myVariable.title}</list-item>
</for-each>
</list>
I
N
D
I
XML Content Exercise #3
(Datasets)
A
N
A
U
N
I
V
E
R
S
I
T
Y
In Eclipse, open the file "XML Content
Exercise 3.xml" contained in the folder
"publisherTraining/Exercises" and follow
the included instructions.
I
N
D
Forms
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Options for form submission:
Save to a database
Delete form database
Send form contents as email
Save user preference
Send request to any listening server
I
N
D
Form Examples
I
A
N
Save to database
I
<form action="save" data-write="myDatabase"
content-page-number-success="2"
content-page-number-failure="5" id="myform1">
other tags...
</form>
V
Delete to database
E
<form action="delete" data-write="myDatabase"
content-page-number-success="2"
content-page-number-failure="5" id="myform1">
other tags...
</form>
A
U
N
R
S
I
T
Y
I
N
D
More Form examples
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Post to server
<form action="https://www.example.com/"
id="myform1">
other tags...
</form>
Send email
<form action=”[email protected]” id="myform1">
other tags...
</form>
Save preference to OneStart
<form action="preference” id="myform1">
other tags...
</form>
I
N
D
Preferences
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
 Setting action="preference" saves
form entries to OneStart database
 Can be accessed on different pages of
your XML content using variable syntax
• ${myPreference}
I
N
D
<textbox>
I
A
N
A
U
N
I
<textbox name="myTextboxName" size="30"
default="MyDefaultArea" />
The size attribute specifies the length of the text box.
You can also use the rows attribute to add more lines to
the text area:
V
E
R
S
I
T
Y
<textbox name="myTextAreaName"
size="30" rows="4"
default="MyDefaultArea" />
I
N
D
I
<textbox>
(with calendar)
A
N
A
U
N
I
V
E
R
S
I
T
Y
If you need a date textbox and want a calendar popup
window use the following:
<textbox name="myTextboxName" size="30"
date-format="MM/dd/yyyy" calendar="true"
form-id="myform1"/>
I
N
D
hidden
I
A
N
A
U
N
The <hidden> element is used to include
additional information in a form submission
beyond that which was entered by the
user.
I
V
E
R
S
I
T
Y
<hidden name="myName" value="myValue" />
<hidden name="myName2" value="myValue2" type="session"/>
I
N
D
<dropdown>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Dropdown creates a list of options from which a user
selects. The following dropdown example includes 4
different options and sets the second option to be
selected by default:
<dropdown name="myDropdown">
<option title="option 1" value="a" />
<option title="option 2" value="b"
default="true" />
<option title="option 3" value="c" />
<option title="option 4" value="d" />
</dropdown>
I
N
D
Checkboxes & Radio Buttons
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<checkbox name="checkboxName"
default="checked" />
<radio-group name="myRadioGroup">
<radio title="Radio option 1"
value="1" default="true" />
<newline/>
<radio title="Radio option 2"
value="2" />
</radio-group>
I
N
D
submit, reset & image
I
A
N
A
U
N
I
<submit name="mysubmitbutton"
title="Submit the form" />
<reset name="myresetbutton"
title="Reset the form" />
V
E
R
S
I
T
Y
<image name="imageSubmit"
button-name="save" submit="true"/>
I
N
D
<validation> and <error>
I
A
N
A
These elements are used to ensure that form
values entered by users fit the criteria your
content is expecting.
U
N
I
V
E
R
S
I
T
Y
 Required fields
 Numeric values
 Date formatting
 See notes below for more
I
N
D
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<validation> and <error>
example
<textbox name="myNumber" size="10">
<validation type="required"
message="Please enter something."/>
<validation type="is-integer"
message="Please enter an integer."/>
<validation type="greater-than"
message="Must be greater than 30."
value="30"/>
</textbox>
<error name="myNumber"/>
I
N
D
I
XML Content Exercise #4
(Forms)
A
N
A
U
N
I
V
E
R
S
I
T
Y
In Eclipse, open the file "XML Content
Exercise 4.xml" contained in the folder
"publisherTraining/Exercises" and follow
the included instructions.
I
N
D
I
XML Content Exercise #5
(Preferences)
A
N
A
U
N
I
V
E
R
S
I
T
Y
In Eclipse, open the file "XML Content
Exercise 5.xml" contained in the folder
"publisherTraining/Exercises" and follow
the included instructions.
I
N
D
Data-writes
I
A
N
A
U
The data-write tag enables you to use
forms to add, update, and delete data
from your external databases.
N
I
V
E
R
S
I
T
Y
To do so, you must first specify a name
for your data-write, a datasource (just as
with datasets), and then create your SQL
queries.
I
N
D
Writing to a Database
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
The <sql-query> element defines the SQL statements
for maintaining your database.
select: retrieve a row from the database
new: inserts a new row in the database
update: modifies a row that currently exists in the
database
delete: deletes a row that currently exists in the
database
I
N
D
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<data-write> examples,
Select and Create
<data-write name="myDatawrite" datasource="myDB">
<sql-query name="mySelect" group="1"
type="select" sql="select my_column_1 from
my_table where my_column_2 = ?" />
<sql-query name="myNewQuery" group="1"
type="new" sql="insert into my_table
(my_column_1, my_column_2)
values (?, ?)" />
I
N
D
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<data-write> examples,
Update and Delete
<sql-query name="myUpdateQuery" group="1"
type="update" sql="update my_table set
my_column_2 = ?, my_column_3 = ? where
my_column_1 = ?" />
<sql-query name="myDeleteQuery" group="1"
type="delete" sql="delete from my_table where
my_column_1 = ?" />
</data-write>
I
N
D
Question Marks
I
A
N
A
 Question marks ('?') in our SQL are
replaced when the queries are executed
U
N
I
V
 Similar to dynamic dataset queries
discussed earlier
E
R
S
I
T
Y
 As part of form input, <bind-query>
specifies replacement value
I
N
D
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<bind-query>
(Delete)
<form action="delete" data-write="myDatabase"
content-page-number-success="2"
content-page-number-failure="5" id="myform1">
<textbox name="column_1_value" size="30">
<bind-query query-name="myDeleteQuery"
bind-param-index="1" database-type="string"
primary-key="true" database-column="my_column_1" />
<bind-query query-name="mySelectQuery"
bind-param-index="1" database-type="string"
primary-key="true" database-column="my_column_1" />
</textbox>
<submit name="mysubmitbutton" title="Submit the form"/>
</form>
I
N
D
<refresh-dataset-cache>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Used inside forms when you need to
refresh your dataset after the form has
been submitted.
<form action="delete"
data-write="myDatawrite"
content-page-number-success="1"
content-page-number-failure="5" id="myform">
<refresh-dataset-cache dataset="myDataset"/>
</form>
I
N
D
I
XML Content Exercise #6
(Datawrite)
A
N
A
U
N
I
V
E
R
S
I
T
Y
In Eclipse, open the file "XML Content
Exercise 6.xml" contained in the folder
"publisherTraining/Exercises" and follow
the included instructions.
I
N
Create Charts from Datasets
D
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
The following chart types are available via the
type attribute:





"pie"
"bar"
"line"
"timeseries"
"pie3d"
 "bar3d"
 "stacked-bar"
 "stacked-bar3d"
I
N
D
Charts
I
A
N
A
U
N
<chart name="chart2" dataset="production-ws"
type="bar" legend="right" height="550"
width="800">
…Other tags…
</chart>
I
V
E
R
S
I
T
Y
 Name, Dataset, and Type are required for all charts.
I
N
D
<chart-element>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<chart name="chart2" dataset="production-ws"
type="bar" legend="right" height="550"
width="800">
<chart-element name="category-name"
type="category" />
<chart-element name="production-level"
type="value" />
</chart>
Chart-element tags define the data to be plotted.
I
N
D
<chart-option>
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<chart name="chart2" dataset="production-ws"
type="bar" legend="right" height="550"
width="800">
<chart-option type="range-label"
type-value="Range"/>
<chart-element name="category-name"
type="category" />
<chart-element name="production-level"
type="value" />
</chart>
Chart-option tags can be used to change the
appearance and operation of the chart.
I
N
D
<chart-element-option>
I
A
N
A
U
<chart-element name="total" type="value" >
<chart-element-option type="integer-tick-units"
type-value="true"/>
</chart-element>
N
I
V
E
R
S
I
T
Y
 Children of <chart-element>
 Specific to an axis
 Used to format display of data, labels for an axis
I
N
D
Pie Chart Example
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<chart name="animal-chart-pie" dataset="animals"
type="pie" title="Preferred Household Pets"
legend="right">
<chart-element name="category-name"
type="category" />
<chart-element name="number-who-prefer"
type="value" />
</chart>
I
N
D
Time Series Example
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<chart name="timeseries-example" dataset="production-ts"
type="timeseries" title="Chart Example" legend="right" width="500">
<chart-option type="range-label" type-value="Production Level"/>
<chart-option type="shapes-visible" type-value="true"/>
<chart-element name="mydate" type="category" >
<chart-element-option type="time-increment" type-value="day" />
<chart-element-option type="date-format" type-value="yyyy/MM/dd" />
</chart-element>
<chart-element name="production-level" type="value"/>
<chart-element name="series-name" type="series"/>
</chart>
I
N
D
I
XML Content Exercise #7
(Charts)
A
N
A
U
N
I
V
E
R
S
I
T
Y
In Eclipse, open the file "XML Content
Exercise 7.xml" contained in the folder
"publisherTraining/Exercises" and follow
the included instructions.
I
N
D
<tree>
I
A
N
A
Creates a tree hierarchy in which you can
organize data in folders
U
N
I
V
E
R
S
I
T
Y
Example of basic tree structure:
I
N
D
Simple Tree Example
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<tree>
<category id="1" title="My Category">
<item id="1" title="My Item1">
<description>This is description 1</description>
<link url="http://www.google.com" title="Google" />
</item>
<item id="2" title="My Item2">
<description>This is description 2</description>
<link url="http://www.iu.edu" title="IU" />
</item>
</category>
</tree>
I
N
D
Tree version 2
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
 Load datasets into tree
 Uses Ajax to open and close folders
without reloading the page
 Can have nested folders and leaves.
I
N
D
Referencing Your Data
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Need at least two different, previously
defined datasets:
 Starting folders
 Starting "leaves" (folder contents)
 Each dataset needs to have parent
information for their contents
I
N
D
Setting up a dataset tree
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<tree version="2" name="Bookmarks"
starting-folder-dataset="folders"
starting-leaf-dataset="bookmarks"
starting-folder-id="0"
default-icon-image-folder="3">
<tree-dataset dataset="folders" type="folder"
xpath-node-id="/data/rows/row/FLDR_ID"
xpath-node-parentid="/data/rows/row/PRNT_FLDR_ID" bind-paramindex="2"/>
<tree-dataset dataset="bookmarks" type="leaf"
xpath-node-id="/data/rows/row/BKMRK_ID"
xpath-node-parent-id="/data/rows/row/FLDR_ID"
bind-param-index="2"/>
I
N
D
Customizing your dataset tree
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
Four customization options:
<tree-option type="height"
type-value="auto" />
<tree-option type="show-top-folder"
type-value="false" />
<tree-option type="show-column-headers"
type-value="true" />
<tree-option type="show-lines"
type-value="true" />
I
N
D
Defining your tree's columns
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
 Supports up to five columns
 Columns can be resized by dragging
column heading
 Contains internal/external links
(including email), more folders
I
N
D
Column Options
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
<tree-column-option type="column-name"
type-value="Folder" />
<tree-column-option type="column-width"
type-value="300" />
I
N
D
<tree-column-fragment>
I
A
N
A
Create both folders and leaves in
<tree-column-fragment>.
U
N
I
V
E
R
S
I
T
Y
Specify the following attributes:
 title: text that is displayed
 node-type: leaf and folder
I
N
Additional Attributes
D
I
A
N
A
U
N
I
V
E
R
S
I
T
Y










url
test
permission
content-page-number
portal-page-number
target
window-width
window-height
focus
status






scrollbars
resizable
toolbar
directories
location
menubar
I
N
D
I
Retrieve Data to Display in
Column
A
N
A
U
As with <dataset-bind-param> or
<link-param>, we can use xpath stored
in a variable to retrieve data.
N
I
V
E
R
S
I
T
Y
<tree-column-fragment fragment-number="1"
node-type="leaf" url="{1}" title="{2}">
<tree-column-variable position="1"
xpath="/data/rows/row/BKMRK_URL"/>
<tree-column-variable position="2"
xpath="/data/rows/row/BKMRK_TITLE"/>
</tree-column-fragment>
I
N
D
I
Content Page Navigation
Within Trees
A
N
A
U
N
I
V
E
R
S
I
T
Y
You can pass folder or leaf information to
other content pages.
<tree-column column-number="2">
<tree-column-option type="column-width"
type-value="250" />
<tree-column-fragment fragment-number="1"
node-type="folder" content-page-number="5"
title="delete {2}">
<tree-column-variable link-param="myId"
position="1" xpath="/data/rows/row/myId" />
<tree-column-variable position="2"
xpath="/data/rows/row/myTitle" />
</tree-column-fragment>
</tree-column>
I
N
D
I
XML Content Exercise #8
(Trees)
A
N
A
U
N
I
V
E
R
S
I
T
Y
In Eclipse, open the file "XML Content
Exercise 8.xml" contained in the folder
"publisherTraining/Exercises" and follow
the included instructions.
I
N
D
I
XML Content Future
Enhancements
A
N
A
U
N
I
V
E
R
S
I
T
Y
 Writing to multiple databases on a
single form submission
 Checkbox validation require at least 1 or
more are checked
 Disabled checkboxes
 More chart types
 Publishing Mode
I
N
D
Additional Resources
I
A
N
A
U
N
I
V
E
R
S
I
T
Y
OneStart Documentation:
https://onestart.iu.edu/confluence/display/OSD