This chapter describes how to customize &quantaplus; to your particular
needs and how you can help &quantaplus; become better.
</para>
<!--<sect1 id="kommander-3-2">
<title>Using Kommander With &quantaplus;</title>
<para>
Kommander, by Marc Britton.
</para>
</sect1> -->
<sect1 id="dtep-intro-3-2">
<title>Document Type Editing Package (&DTEP;)</title>
<para>
Document Type Editing Packages (&DTEP;s) are used in &quantaplus; to add
support for markup, scripting languages, and &CSS;. They allow
&quantaplus; to provide features like auto-completion and node trees.
Their simplicity and flexibility are what make &quantaplus; a fast,
developer friendly &IDE; for web developers. They are what make &quantaplus;
an easy-to-use, productive environment.
</para>
<para>
&DTEP;s come in two flavors, Family 1, which are markups, and Family 2,
which are scripting and &CSS;. &DTEP;s are made up of two parts, the Tag
Folder and the Toolbars. Tag Folders are composed of two types of files,
the &descriptionrc; and TagXML files, which carry the extension .tag.
Toolbars are the handy, icon-oriented tabs of buttons (above the editing
window) which place text into a document faster than the user can type.
</para>
<para>
&DTEP;s can be created manually (see below), <link linkend="download-resources">downloaded</link> or automatically created from an existing DTD. See <xref linkend="converting-dtd" /> for details about the conversion.
</para>
<para>
This document describes how to make TagXML files, the &descriptionrc;, and
toolbars. In short, a &DTEP;.
</para>
<para>
TagXML files (.tag) define both the attributes specific to a tag and the
layout and contents of the properties dialog &quantaplus; shows for the tag.
The &descriptionrc; file provides rules and information on the &DTEP;
itself. Toolbars provide a quick means for adding tags into a document
without worry of mis-spellings and such.
</para>
<sect2 id="dtep-packaging-3-2">
<title>Packaging</title>
<para>
Tag Folders are just that, folders. They are composed only of the
&descriptionrc; and TagXML files. Tag Folders carry the name of the mark-up
language and version, if applicable. (For example, html-4.01-strict)
</para>
</sect2>
<sect2 id="tagxml-3-2">
<title>TagXML</title>
<para>
The table below lists the elements defined in TagXML and declares whether
they are required or not. While not all are required, it is recommended
that you use as many as you can so that other users can have a better
experience and more information to work with.
</para>
<informaltable>
<tgroup cols="3">
<thead>
<row>
<entry>Element</entry>
<entry>Default Usage</entry>
<entry>Case Usage</entry>
</row>
</thead>
<tbody>
<row>
<entry>TAGS</entry>
<entry>required</entry>
<entry>always</entry>
</row>
<row>
<entry>tag</entry>
<entry>required</entry>
<entry>always</entry>
</row>
<row>
<entry>label</entry>
<entry>optional</entry>
<entry>required to create a properties dialog</entry>
</row>
<row>
<entry>attr</entry>
<entry>optional</entry>
<entry>required to define an attribute</entry>
</row>
<row>
<entry>tooltip</entry>
<entry>optional</entry>
<entry>required to have the properties dialog display a tooltip</entry>
</row>
<row>
<entry>whatsthis</entry>
<entry>optional</entry>
<entry>required to have the properties dialog display a <quote>What's This
</quote></entry>
</row>
<row>
<entry>list</entry>
<entry>optional</entry>
<entry>required when an attr is of the type <quote>list</quote></entry>
</row>
<row>
<entry>item</entry>
<entry>optional</entry>
<entry>required when <list> is used</entry>
</row>
<row>
<entry>textlocation</entry>
<entry>optional</entry>
<entry>always</entry>
</row>
<row>
<entry>location</entry>
<entry>optional</entry>
<entry>required when label is used</entry>
</row>
<row>
<entry>text</entry>
<entry>optional</entry>
<entry>required when label is used</entry>
</row>
<row>
<entry>children</entry>
<entry>optional</entry>
<entry>list of tags that can appear within the tag being defined</entry>
</row>
<row>
<entry>child</entry>
<entry>required</entry>
<entry>a children entry</entry>
</row>
<row>
<entry>stoppingtags</entry>
<entry>optional</entry>
<entry>list of tags that tell another tag to end</entry>
</row>
<row>
<entry>stoppingtag</entry>
<entry>required</entry>
<entry>a stoppingtags entry</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<sect3 id="dtep-element-descriptions-3-2">
<title>TagXML Element Descriptions</title>
<para>
The following sections will describe, in detail, each element. Everything
from where they can go to what goes in them is layed out in an
easy-to-follow manner.
</para>
<sect4 id="TAGS-3-2">
<title>TAGS</title>
<para>
This is the root element of a TagXML document. It may appear in a document
only once. It can contain the definition of multiple tags. This is an
element-only type element.
</para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Parent(s)</entry>
<entry>Children</entry>
</row>
</thead>
<tbody>
<row>
<entry><emphasis>NONE</emphasis></entry>
<entry>tag</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect4>
<sect4 id="tag-3-2">
<title>tag</title>
<para>
Wrapper for tag being defined. This is an element-only type element.
<entry>optional</entry><entry>Valid only if the type is "method". Specifies the name of the class to where this method belongs. (Family 2 only.)</entry>
<entry>optional</entry><entry>if "yes", the tag specifies a common attribute group and the attributes inside this tag can be attached to any other tag. (Family 1 only.)</entry>
<entry>optional</entry><entry>Requires source="dcop" and an interface name. The dcop method name from inside &quantaplus; used to get the source data.</entry>
<entry>optional</entry><entry>Requires source="dcop", an interface and a method name. The arguments passed to the method. It can be empty or "%tagname%", meaning the current tags name.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect4>
<sect4 id="tooltip-3-2">
<title>tooltip</title>
<para>
Defines the tooltip for a field in the dialog. This element is text-only.
</para>
<note>
<para>
Currently only plain text is supported (you cannot use any markup).
</para>
</note>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Parent(s)</entry>
<entry>Children</entry>
</row>
</thead>
<tbody>
<row>
<entry>attr</entry>
<entry><emphasis>NONE</emphasis></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect4>
<sect4 id="whatsthis-3-2">
<title>whatsthis</title>
<para>
Defines the 'What's This' help for a field in the dialog. This element is
text-only.
</para>
<note>
<para>
Currently only plain text is supported (you cannot use any markup).
</para>
</note>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Parent(s)</entry>
<entry>Children</entry>
</row>
</thead>
<tbody>
<row>
<entry>attr</entry>
<entry><emphasis>NONE</emphasis></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect4>
<sect4 id="list-3-2">
<title>list</title>
<para>
A container tag that groups together the items in a list. It may appear
only once for each attribute description. This is an element-only type
element.
</para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Parent(s)</entry>
<entry>Children</entry>
</row>
</thead>
<tbody>
<row>
<entry>attr</entry>
<entry>item</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect4>
<sect4 id="item-3-2">
<title>item</title>
<para>
Defines an item in a list. This element is text-only.
</para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Parent(s)</entry>
<entry>Children</entry>
</row>
</thead>
<tbody>
<row>
<entry>list</entry>
<entry><emphasis>NONE</emphasis></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect4>
<sect4 id="textlocation-3-2">
<title>textlocation</title>
<para>
Specifies the position of a tag's attribute text within a dialog. This tag
can only occur once for each attribute in the dialog (&ie; one for each
The &descriptionrc; file is, also, quite simple and there is an editor for it accessible from <menuchoice><guimenu>DTD</guimenu><guimenuitem>Edit DTD Settings</guimenuitem></menuchoice>. This will edit the &descriptionrc; for a &DTEP; you can select from a list. In order to
edit the &descriptionrc; for a newly created &DTEP; you should create a simple &descriptionrc; with the following entries:
</para>
<para>
<informalexample>
<literallayout>
<markup>
[General]
Version = Use 1 for &quantaplus; version <=3.1.2 and 2 for any version greater.
Name = DTD definition string. (-//&W3C;//DTD HTML 4.01 Transitional//EN)
NickName = The beautified name of the DTD. (HTML 4.01 Transitional). If not defined, Name is
used as NickName.
</markup>
</literallayout>
</informalexample>
</para>
<para>Once you have created it at put aside of the tag files, load the newly created &DTEP; with <menuchoice><guimenu>DTD</guimenu><guimenuitem>Load DTD Package (DTEP)</guimenuitem></menuchoice> and after it is loaded you can proceed with editing the settings of the &DTEP;. Check the tooltips and the whatsthis text of the entries in the editor dialog to understand the meaning of each entry. Alternatively you can read the <filename>quanta/data/dtep/dtd-description.txt</filename> from the source tarball containing a description about the format.
</para>
</sect2>
</sect1>
<sect1 id="user-actions">
<title>User Defined Actions</title>
<para>
Actions are very common in every application. You meed them often when you use any application. Clicking on a toolbar icon, selecting a menu item or using a shortcut usually executes an action. In &quantaplus; actions are taken to the next level. Instead of hardcoded actions (that are created by the application
programmer at the source code level) it is possible for the ordinary user to create and modify actions and by this way adding
new functionality to &quantaplus;. These are the user defined actions, and many of the standard &quantaplus; actions are user defined (and user modifiable) actions as well.
</para>
<para>There are three types of user definable actions:
<listitem><para>Specifies the action's type (<link linkend="text-actions">Text</link>, <link linkend="tag-actions">Tag</link>, <link linkend="script-actions">Script</link>).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><guilabel>Text</guilabel></term>
<listitem><para>The user visible name of the action.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>The button near the <guilabel>Text</guilabel> label</term>
<listitem><para>The icon assigned to this action. Click on it in order to change the current icon.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><guilabel>Tool tip</guilabel></term>
<listitem><para>Short description of what the action does.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><guilabel>Shortcut</guilabel></term>
<listitem><para>The shortcut assigned to this action. Click on <guilabel>Custom</guilabel> or the button near <guilabel>Custom</guilabel> to assign a shortcut; click on <guilabel>None</guilabel> to remove the currently assigned shortcut.</para>
The simplest actions. You can enter some text in the <guilabel>Detailed Settings</guilabel> area and whenever the action is executed this text will be inserted in your document
at the current cursor position. See the below example.
</para>
</sect2>
<sect2 id="tag-actions">
<title>Tag actions</title>
<para>
Useful to insert XML tags, but of course you can use them for other purposes as well.
<listitem><para>The name of the tag.</para></listitem>
</varlistentry>
<varlistentry>
<term><guilabel></tag></guilabel></term>
<listitem><para>If checked when the action is executed this text will be inserted as a closing tag. If there is a selected area in the document before you execute the action, the <tag> will be inserted before the selected area and the </tag> after.</para></listitem>
</varlistentry>
<varlistentry>
<term><guilabel>Run "Edit tag" dialog if available</guilabel></term>
<listitem><para>If checked and there is a tagXML file for this tag, a tag editing dialog will be shown prior of inserting the tag inside the document, so you can fine-tune the tag attributes.</para></listitem>
</varlistentry>
</variablelist>
The <tag> and </tag> will be inserted as you've typed there. The <, > or the / sign won't be automatically appended.
The most powerful action type. With the help of this action you
can run external applications (usually scripts, but it's
not limited to scripts), which can alter your document or use your document (or part of your document) as input. Examples from &quantaplus; itself are the <guibutton>Quick Start</guibutton> dialog, the various <guilabel>View In...</guilabel> actions for the (X)HTML DTEPs.
</para>
<para>
First you have to enter the name of your script with the interpreter as well. Example:
<command>sh /home/myHome/myScript.sh</command>.
</para>
<para>
Although you can use full paths, the recommended way is to use the <command>%scriptdir</command> variable in the command line, like <command>sh %scriptdir/myScript.sh</command>. This way &quantaplus; will try to locate your script in the following places:
There are other special variables that you can use in the command line:
<itemizedlist>
<listitem><para><command>%f</command>: will be replaced with the URL of the current document. In case of local documents, file:/ will be stripped from the document.</para></listitem>
<listitem><para><command>%input</command>: will be replaced with the selected input. See below.</para></listitem>
<listitem><para><command>%projectbase</command>: will be replaced with the URL of the current project. It is empty if no project is loaded.</para></listitem>
<listitem><para><command>%pid</command>: will be replaced with the PID of the running &quantaplus; process. If &quantaplus; is running in unique mode, the "unique " text will be prepended to the PID number. Useful when you use DCOP to control &quantaplus; from the external script.</para></listitem>
<listitem><para><command>%userarguments</command>: useful in case of events. This entry will be replaced by the event properties in the following order: <variablelist>
<varlistentry>
<term>First argument</term>
<listitem><para>The unique id of the script</para></listitem>
</varlistentry>
<varlistentry>
<term>Second argument</term>
<listitem><para>the event name</para></listitem>
</varlistentry>
<varlistentry>
<term>Third argument</term>
<listitem><para>the parameters for the event, usually the file name of the current document or the path to the project file.</para></listitem>
</varlistentry>
</variablelist>
</para></listitem>
</itemizedlist>
</para>
<para>
Aside of the above methods the script can receive input from &quantaplus; on the standard input. In the <guilabel>Input</guilabel> combobox you can select what to send to the standard input. Choices are:
<itemizedlist>
<listitem><para><guilabel>None</guilabel>: nothing is sent to the script.</para></listitem>
<listitem><para><guilabel>Current document</guilabel>: the whole document is sent to the script.</para></listitem>
<listitem><para><guilabel>Selected text</guilabel>: the selected area of the document is sent to the script. Using the <command>%input</command> variable usually makes sense only when using this setting.</para></listitem>
</itemizedlist>
</para>
<para>
Similar to the <guilabel>Input</guilabel> you can catch the output of the executed application. There are two kind of outputs:
<itemizedlist>
<listitem><para>normal output, printed to the standard output;</para>
</listitem>
<listitem><para>error messages, printed to the standard error.</para>
</listitem>
</itemizedlist>
You can specify what should happen with the text printed to the standard output. This can be done by modifying the value of the <guilabel>Output</guilabel> combobox:
<itemizedlist>
<listitem><para><guilabel>None</guilabel>: the output of the application is ignored.</para></listitem>
<listitem><para><guilabel>Insert in cursor position</guilabel>: the output will be inserted in the current document and the cursor position.</para></listitem>
<listitem><para><guilabel>Replace selection</guilabel>: the selected area of the document will be replaced with the output.</para></listitem>
<listitem><para><guilabel>Replace selection</guilabel>: the selected area of the document will be replaced with the output.</para></listitem>
<listitem><para><guilabel>Create a new document</guilabel>: a new document will be created and will contain all the output of the script.</para></listitem>
<listitem><para><guilabel>Replace current document</guilabel>: the entire document will be replaced with the output.</para></listitem>
<listitem><para><guilabel>Message window</guilabel>: the output will appear in the <guilabel>Messages</guilabel> toolview.</para></listitem>
</itemizedlist>
</para>
<para>The choices for the standard error output (<guilabel>Error</guilabel>) are the same as for the normal output.</para>
</sect2>
</sect1>
<sect1 id="creating-toolbars-3-2">
<title>Creating Toolbars</title>
<para>
The following will show you how to create toolbars for a &DTEP;. Toolbars
are graphical elements that are assigned to actions. Actions, in
&quantaplus;, are the basis for nearly all the extensions that
&quantaplus; has and will acquire in the future. The same mechanism that
defines an action in &quantaplus; also enables auto-completion and tag
dialogs. With actions, the limit of what you can do is virtually
limitless. For means of an example, we will use <ulink
url="http://tidy.sf.net">&HTML; tidy</ulink> on our web pages.
</para>
<sect2 id="from-scratch-to-complete-3-2">
<title>From Scratch to Complete</title>
<para>
To begin, you will need to create a user toolbar. Select
<menuchoice>
<guimenu>Toolbars</guimenu>
<guimenuitem>Add User Toolbar</guimenuitem>
</menuchoice>.
</para>
<para>
If there are many tags for the markup language, it is recommended that you
split up the tags into logical groups. You will need to create a new user
toolbar for each group. In this case, there are not many, so we will be
making one toolbar and naming it with the name of the markup.
</para>
<para>
Once all your toolbars are created, you must add and configure the
actions. To do this, select
<menuchoice>
<guimenu>Settings</guimenu>
<guimenuitem>Configure Actions</guimenuitem>
</menuchoice>
<emphasis>
</emphasis>.
</para>
<para>
The parts of this window are pretty straight forward. Press the
<guibutton>New action</guibutton> button at the bottom of the window to
enter the editing mode.
</para>
<para>
Fill in all of the necessary fields and add the tag to the appropriate
toolbar(s).
</para>
<para>
Complete the rest and, if the tag has attributes and you always plan to
use them, check the <guilabel>Run "Edit tag" dialog if available
</guilabel> box so that you will be prompted every time the action is used.
</para>
<para>
You should now have something much like the following.
repository</ulink> for use by the &quantaplus; community. You will not get
rich, but you will feel great knowing that you contributed to the best web
development platform around.
</para>
</sect1>
<sect1 id="sharing-resources">
<title>Sharing Resources</title>
<para>With &quantaplus; you are not alone. It is possible to share the various resources (DTEP packages, toolbars with actions, scripts, templates) with others. There are two ways to do it:
</para>
<variablelist>
<varlistentry>
<term>Sending in Email</term>
<listitem><para>The resources can be sent in email to your friends, partners or to whomever you want. You will see the <guilabel>Send in Email</guilabel> menu entries in various places, like <menuchoice><guimenu>DTD</guimenu><guimenuitem>Send DTD Package (DTEP) in Email</guimenuitem></menuchoice>, <menuchoice><guimenu>Toolbars</guimenu><guimenuitem>Send Toolbar in Email</guimenuitem></menuchoice>, in the context menu of the files and folders in the <guilabel>Templates</guilabel> and <guilabel>Scripts</guilabel> tree.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Uploading to the main server</term>
<listitem><para>The resources can be uploaded to our main repository, from where all other &quantaplus; users can download them. The submissions are reviewed and made available only if our team considers correct and useful will be published. In order to make a valid submission it is suggested to sign the resources, thus you need a GPG/PGP key. This information is used to verify the origin of the resources both by our team and by the downloaders.</para>
<para>About getting the resources from the main server see <xref linkend="download-resources" />.</para>
<para>When uploading you will be asked to enter the passphrase for your secret GPG key (the passphrase will not be stored), or in the case of having more secret keys, you will be able to pick up the one you want to use. In the <guilabel>Share Hot New Stuff</guilabel> dialog fill the input fields (the <guilabel>Preview URL</guilabel> may remain empty) and start the upload by clicking <guilabel>OK</guilabel>.</para>
<para>
The upload can be initiated from
<menuchoice><guimenu>DTD</guimenu><guimenuitem>Upload DTD Package (DTEP)</guimenuitem></menuchoice>, <menuchoice><guimenu>Toolbars</guimenu><guimenuitem>Upload Toolbar</guimenuitem></menuchoice>, in the context menu of the files and folders in the <guilabel>Templates</guilabel> and <guilabel>Scripts</guilabel> tree.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect1>
<sect1 id="download-resources">
<title>Getting Resources</title>
<para>It is possible to upgrade your &quantaplus; without getting a new version, by getting new resources like DTEP packages, toolbars with actions, templates, scripts and documentation. One possibility is that you got the resources in email or have downloaded from a web server, in which cases you usually need to manually install them. In lucky case you also got an install script when you have downloaded the resources. But &quantaplus; has a dedicated server holding resources that were either not included in the main distribution because of their sizes or infrequent usage, or they were contributed later by users, and these resources are automatically installed. Do download such resources use the various <guilabel>Download</guilabel> menu entries. You can find them at <menuchoice><guimenu>DTD</guimenu><guimenuitem>Download DTD Package (DTEP)</guimenuitem></menuchoice>, <menuchoice><guimenu>Toolbars</guimenu><guimenuitem>Download Toolbar</guimenuitem></menuchoice>, in the context menu of an empty area or toplevel item in the <guilabel>Templates</guilabel>, <guilabel>Scripts</guilabel> and <guilabel>Documentation</guilabel> trees.
</para>
<para>
After a resource was downloaded, but before it is installed, &quantaplus; verifies if the resource is valid, by checking the integrity and the signature. In case of problems it warns you and you can decide if you want to continue or not. Please read the warning dialogs carefully. In the case when the integrity is correct and the resource is correctly signed, you will still get an information dialog, so you can see who created the resource.
</para>
<para>
<caution><para>Be sure that you install resources, especially toolbars and scripts, only from trusted sources!</para></caution>
</para>
</sect1>
<sect1 id="converting-dtd">
<title>Converting a DTD to a &DTEP;</title>
<para>It is possible to work on XML languages currently not supported by &quantaplus; by creating a DTEP package. But the creation can be time consuming, as you may need to write hundreds of tag files in <link linkend="tagxml-3-2">tagXML</link> format. Of course, there is a nicer way to go, by converting the DTD automatically into a DTEP package.
</para>
<para>The conversion can be started from the <menuchoice><guimenu>DTD</guimenu><guimenuitem>Load & Convert DTD</guimenuitem></menuchoice> menu. Select the <filename>.dtd</filename> file which defines the DTD you want to use, and after that you will see the following dialog:
<listitem><para><guilabel>Target directory name:</guilabel>the newly created &DTEP; will go under this name to the <filename><envar>$TDEHOME</envar>/share/apps/quanta/dtep</filename> folder.
the string that should appear in the !DOCTYPE tag, like
HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"</para></listitem>
<listitem><para><guilabel>DTD URL:</guilabel> the URL pointing to the DTD file</para></listitem>
<listitem><para><guilabel>Default extension:</guilabel> the extension usually used for files that were written in this DTD</para></listitem>
<listitem><para><guilabel>Case-sensitive tags and attributes:</guilabel> self explaining, usually true for XML language variants</para></listitem>
<listitem><para><guilabel>Fine-tune the DTEP after conversion:</guilabel> if checked, after the conversion is done, &quantaplus; will bring up the &descriptionrc; editor, so you can fine tune the newly created &DTEP;. It is recommended to leave this options checked.</para></listitem>