Table of Contents

businessunknownInternet και Εφαρμογές Web

12 Νοε 2013 (πριν από 3 χρόνια και 1 μήνα)

70 εμφανίσεις

Online Activity Editor

Richard Benton

Template Specifications

1.1

9
/
19
/03


Page
1

of
6

Table of Contents

Table of Contents

................................
................................
................................
................................
..........

1

Overview
................................
................................
................................
................................
........................

1

XML Declaration

................................
................................
................................
................................
..........

1

Activity Top Node

................................
................................
................................
................................
.........

1

XML
-
to
-
HTML Translation

................................
................................
................................
........................

2

Defining HTML Form Elements in X
ML

................................
................................
................................
..

2

Instruction Lines

................................
................................
................................
................................
.........

3

Labels

................................
................................
................................
................................
.........................

3

Text Fields

................................
................................
................................
................................
..................

3

Single Line

................................
................................
................................
................................
.............

3

Multiple Lines

................................
................................
................................
................................
........

4

Checkboxes

................................
................................
................................
................................
................

4

Drop
-
Down Select Menus

................................
................................
................................
..........................

5

Empty Line Break Spacers

................................
................................
................................
.........................

5

Hidden Elements

................................
................................
................................
................................
........

6

Version History

................................
................................
................................
................................
.............

6

Version 1.1

................................
................................
................................
................................
.................

6


Overview


The VPG Online Activity Editor (OAE) consists largely of two parts: (1) XML activity templates and (2)
the

HTML form with which their conten
t fields can be edited online.
This document describes all required
and optional elements of the XML templates, and how these relate to the

available

HTML
form elements.



XML Declaration


T
he first line in each XML activi
ty template should contain the following string:



<?xml version="1.0" encoding="UTF
-
8"?>


The OAE expects all XML templates to be encoded as 8
-
bit Unicode, and saves them with the same
encoding every time an HTML form is submitted.



Activity Top Node


An

XML file must contain at least one top level node.
A potential standard for the structure of this node
might be:


<activity acttype="020" version="1.0"
oae
-
label="
Concentration
">





content nodes




</activity>

Online Activity Editor

Richard Benton

Template Specifications

1.1

9
/
19
/03


Page
2

of
6


The
acttype
node's value would match the t
emplate with its corresponding activity engine code; the
version

node would allow the template's creator to keep track of changes applied to the template, and
simplify the automation of transforming old templates into the latest structure (e.g., with XSL);

and
the
oae
-
l
abel

node is for use by the OAE, and is described in more detail below.



XML
-
to
-
HTML Translation


The OAE uses a single generic set of XSL transformation templates to transform any given XML activity
template into an editable and ideally eas
ily readable HTML form. The following general translations are
made:


XML Node Type

HTML Form Element Appearance

XML node containing only other nodes


The name (or designated
Label
, see below) of this
node is presented on a single table row in red bold
te
xt.


The translations of all nodes within this node will
each appear below and indented 15 pixels from the
left side of this table row.

XML node containing character data

The name (or designated label, see below) of this
node is presented in the left
-
hand
, 100
-
pixel wide
cell of a 2
-
cell table row, followed by a colon.


By default, a 60
-
pixel wide, single row text input
field will appear in the right
-
hand cell of this table
row.

XML node containing no data

Currently, the only empty nodes supported are
com
ment nodes, and nodes of type "hidden" and
"spacer" (see below).

XML comment node

The content of this node is presented on a single
table row in blue bold text, and is well suited for
instructions pertaining to the node
s

below it.



Defining

HTML

Form El
ements

in XML


In designing the structure of an XML activity template, authors are free to choose the names of any given
node freely, however the OAE reserves several node attribute names and values for use in
"hinting"

how
the

template

is transformed

into

a readable HTML form.

The following
form elements

can be created by
using the attributes and values specified below:

Online Activity Editor

Richard Benton

Template Specifications

1.1

9
/
19
/03


Page
3

of
6

Instruction

Line
s


Node Type

Node Attributes

Node Contents

Comment

-

-

Description

Any XML comment node in your template will appear as
an instruction line in the online form.

XML Example

<!
--

Enter your question in the field below.
--
>


Label
s


Node Type

Node Attributes

Node Contents

*

oae
-
label

*

Description

By default, the label next to each form element is the same as the name of the

XML node to which it
corresponds. However, if an
oae
-
l
abel

attribute is present in the node, its value will be used instead.


XML Example

<qtext
oae
-
label="Question Text">***Enter a question here***</qtext>


Text Field
s

Single Line


Node Type

Node Attribu
tes

Node Contents

Element

oae
-
label

oae
-
maxchars

oae
-
readonly

CDATA

Description

This is the default appearance of any XML node with opening and closing tags. It can only be overriden by
setting the
oae
-
t
ype

attribute of the node to an alternate value sup
ported below.


If an
oae
-
maxchars

attribute is present, the resulting single

line text field will limit the maximum
number of enterable characters to its value.

The width of
the

field
will be set to the
lesser

of two values:



its XML node's
oae
-
maxchars

att
ribute



$gdefault_size

in your project's
prefs.php

file.


If an
oae
-
readonly="true"

attribute/value pair is present, the XML node will be translated into a
disabled

single line text field.

XML Example
s

<qtext></qtext>

<zipcode
oae
-
maxchars
="5"></zipcode>

<t
itle oae
-
readonly="true">
Fixed
Activity Title</title>


Online Activity Editor

Richard Benton

Template Specifications

1.1

9
/
19
/03


Page
4

of
6

Multiple Lines


Node Type

Node Attributes

Node Contents

Element

oae
-
type="textarea"

oae
-
label

oae
-
maxchars

oae
-
cols

oae
-
rows

oae
-
readonly

CDATA

Description

If an
oae
-
type="textarea
"

attribute/value i
s present in an XML node with open and close tags, it
will appear as a scrollable text box


ideal for multi
-
line text entry.


If an
oae
-
maxchars

attribute is present, the resulting
multi
-
line
text field

will limit the maximum
number of enterable character
s to its value.


Optional attributes for this node are
oae
-
cols

(to set field width) and
oae
-
rows

(to set field height)


if not included, these properties will be set by
$gdefault_cols

and $gdefault_rows

in your
project's
prefs.php

file.


If an
oae
-
readon
ly="true"

attribute/value pair is present, the XML node will be translated into a
disabled

multi
-
line text field.

XML Example

<paragraph
oae
-
type="textfield">*** Enter Paragraph Here***</paragraph>


Checkbox
es


Node Type

Node Attributes

Node Contents

Elem
ent

oae
-
type="checkbox"

oae
-
label

checked

Empty

Description

If an
oae
-
type="checkbox"

attribute/value is present in an empty XML node, it will appear as a
checkbox. The additional attribute
checked

must be included to indicate the default state of the box



"true"

(checked) or
"false"

(unchecked).

XML Example

<gotmilk oae
-
type="checkbox" oae
-
label="I have milk"

checked="true"
/>


Online Activity Editor

Richard Benton

Template Specifications

1.1

9
/
19
/03


Page
5

of
6

Drop
-
Down Select Menu
s


Node Type

Node Attributes

Node Contents

Element

oae
-
type="select"

oae
-
label

opt1, opt2,
…,

optN

value

Em
pty

Description

If an
oae
-
type="select"

attribute/value is present in an empty XML node, it will appear as a select
menu. Each option attribute should be named in the form
opt#
, and a
value

attribute must be assigned
the value of the default option to be
selected.

XML Example

<mystooge

oae
-
type="select"
oae
-
label="Pick a stooge"

opt1="Larry"
opt2="Moe" opt3="Cu
rly" opt4="Shemp" value="Shemp"
/>


Empty Line Break Spacer
s


Node Type

Node Attributes

Node Contents

Element

oae
-
type="spacer"

Empty

Description

I
f an
oae
-
type="spacer"
attribute/value is present in an empty XML node, it will appear as an empty
line between other elements


good for creating blocks of grouped HTML form elements with vertical
white space.

XML Example

<spacer
oae
-
type="spacer"/>


Online Activity Editor

Richard Benton

Template Specifications

1.1

9
/
19
/03


Page
6

of
6

Hidd
en Element
s


Node Type

Node Attributes

Node Contents

Element

oae
-
type="hidden"

Empty

Element

CDATA

Description

If an
oae
-
type="hidden"
attribute/value is present in an XML node, the node

(and any
attributes,
elements

or CDATA sections therein)

will be pr
eserved as the document is transformed back and forth
between XML and HTML, but it will not be visible in the HTML form.

XML Example
s

<coordinates
oae
-
type="hidden" x="100" y="200"/>


<coordinates oae
-
type="hidden">


<![CDATA[100,200]]>

</coordinates>


<co
ordinates oae
-
type="hidden">


<x>100</x>


<y>200</y>

</coordinates>


Version History

Version 1.1

Enhancements



oae
-
maxchars

can now be used to limit the maximum numb
er of characters entered into a
multi
-
line
text field
.



oae
-
readonly="true"

can now be added
to single
-

and multi
-
line text
field
s.



oae
-
type="hidden"

elements can now properly hide and preserve nested elements and
CDATA sections.

Issues Addressed



A value assigned to
oae
-
cols

now properly overrides the one in
prefs.php
's
$gdefault
-
cols

for multi
-
li
ne
text fields
.

Changed Files



act_edit.php



act_edit.xsl



utils.js