Customizing the User interface

From DLXS Documentation

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
-
<p>Please read the <a href="index.html">User Interface Overview</a> if you have
+
<p>Please read the [[User Interface Overview]] if you have
not yet. </p>
not yet. </p>
-
<ul>
+
==Figuring Out How to Make a Change==
-
<li><a href="#Figuring">Figuring Out How to Make a Change</a>
+
-
<ul>
+
-
<li><a href="#overview">Overview</a></li>
+
-
<li><a href="#pointers">Pointers for deciding how to approach a user interface customization
+
-
task.</a> <ul>
+
-
<li><a href="#CollectionManager">How to tell if the change can be made in Collection
+
-
Manager</a></li>
+
-
<li><a href="#CSS">How to tell if the change can be made with Cascading Style Sheets
+
-
(CSS)</a> </li>
+
-
<li><a href="#XSL">How to tell if the change can be made with XSL</a></li>
+
===Overview===
-
<li><a href="#XML">How to tell if a change can be made in an XML Template and/or Perl</a></li>
+
-
</ul>
+
-
</li>
+
-
</ul>
+
-
</li>
+
-
<li><a href="#Correct">Finding the Correct Files: More about Fallback
+
-
</a>
+
-
<ul>
 
-
<li><a href="#XMLTemplate">XML Template</a></li>
 
-
<li><a href="#Chunks">XML Template Chunks</a></li>
 
-
<li><a href="#XSLStylesheet">XSL Stylesheet</a></li>
 
-
<li><a href="#Oxygen">Oxygen for Dissecting XML and XSL</a></li>
 
-
<li><a href="#LanguageMap">Language Map</a></li>
 
- 
-
</ul>
 
-
</li>
 
-
</ul>
 
-
<h2><a name="Figuring"></a>Figuring Out How to Make a Change </h2>
 
-
<h3><a name="Overview"></a>Overview</h3>
 
<p>Given the complexity of DLXS and the variety of options for making
<p>Given the complexity of DLXS and the variety of options for making
interface customizations, it can be difficult to determine how to make a
interface customizations, it can be difficult to determine how to make a
change, let alone the the <em>best</em> way to make a change.</p>
change, let alone the the <em>best</em> way to make a change.</p>
-
<p>First of all, there are some <a href="../troubleshooting/tools.html">web
+
 
-
development tools</a> available that can greatly simplify
+
<p>First of all, there are some [[Useful Tools|web development tools]] available that can greatly simplify
your effort. For now, get these three and keep the others in mind.</p>
your effort. For now, get these three and keep the others in mind.</p>
Line 46: Line 18:
<li>Web Developer extension for Firefox</li>
<li>Web Developer extension for Firefox</li>
</ol>
</ol>
 +
<p>Next, get a little more familiar with the potential places customizations
<p>Next, get a little more familiar with the potential places customizations
can be made. Listed below are the options, from simplest to most advanced.
can be made. Listed below are the options, from simplest to most advanced.
It probably goes without saying that you want to choose a simple option
It probably goes without saying that you want to choose a simple option
whenever possible. </p>
whenever possible. </p>
 +
<table width="100%" border="1" >
<table width="100%" border="1" >
<tr>
<tr>
Line 58: Line 32:
</tr>
</tr>
<tr>
<tr>
-
<td><a href="http://www.dlxs.org/docs/13/collmeta/collmgr.html" target="_blank">Collection Manager</a> </td>
+
<td>[[Working with the Collection Manager|Collection Manager]] </td>
<td>Change the most common interface elements such as collection title and
<td>Change the most common interface elements such as collection title and
field labels. Include or exclude certain functionality. Varies significantly
field labels. Include or exclude certain functionality. Varies significantly
Line 114: Line 88:
example, you may need to change the XSL to add a class to an element so that
example, you may need to change the XSL to add a class to an element so that
you can change it's appearance in the browser using CSS. </p>
you can change it's appearance in the browser using CSS. </p>
-
<h3><a name="pointers"></a>Pointers for deciding how to approach a user interface
 
-
customization task. </h3>
 
-
<h4><a name="CollectionManager"></a>How to tell if the change can be made in <a href="http://www.dlxs.org/docs/13/collmeta/collmgr.html" target="_blank">Collection Manager</a></h4>
+
==Pointers for deciding how to approach a user interface customization task.===
-
<ol>
+
 
-
<li> Study the Collection Manager fields for the Class and Group, specifically
+
====How to tell if the change can be made in [[Working with the Collection Manager|Collection Manager]]====
 +
 
 +
* Study the Collection Manager fields for the Class and Group, specifically
looking for an option that would cause the desired change. Click the Collection
looking for an option that would cause the desired change. Click the Collection
Manager field labels for contextual help. Many fields apply to all classes,
Manager field labels for contextual help. Many fields apply to all classes,
-
but each class has unique fields as well.</li>
+
but each class has unique fields as well.
-
</ol>
+
-
<h4><a name="CSS"></a>How to tell if the change can be made with Cascading Style Sheets (CSS) </h4>
+
-
<ol>
+
-
<li>First of all, you need to have a basic understanding of what <a href="http://en.wikipedia.org/wiki/Css" target="_blank">CSS</a> is
+
-
good for and how it works. </li>
+
-
<li>Use the <a href="../troubleshooting/tools.html">Firebug</a> extension to Firefox to <em>inspect</em> the structure
+
 
 +
====How to tell if the change can be made with Cascading Style Sheets (CSS)====
 +
 
 +
* First of all, you need to have a basic understanding of what [[User Interface Overview#Cascading Stylesheets (CSS)|CSS]] is good for and how it works.
 +
 
 +
* Use the [[Useful Tools|Firebug]] extension to Firefox to <em>inspect</em> the structure
of the page including element class and id attributes. Firebug also
of the page including element class and id attributes. Firebug also
shows the styles that are currently affecting the element. In fact, you can
shows the styles that are currently affecting the element. In fact, you can
even experiment with style definitions in Firebug. This should give you
even experiment with style definitions in Firebug. This should give you
-
a very good idea of whether the change can be made with CSS, or not.</li>
+
a very good idea of whether the change can be made with CSS, or not.
-
</ol>
+
 
-
<h4><a name="XSL"></a>How to tell if the change can be made with XSL</h4>
+
====How to tell if the change can be made with XSL====
-
<ol>
+
 
-
<li>Add debug=xml to the URL to view the XML for the page. Take a close look
+
* Add debug=xml to the URL to view the XML for the page. Take a close look
at the XML to see if the the information needed is present in the XML and
at the XML to see if the the information needed is present in the XML and
structured in a way amenable to use with XSL. If the right information is
structured in a way amenable to use with XSL. If the right information is
-
in the XML, then XSL modifications will probably bring the desired change.</li>
+
in the XML, then XSL modifications will probably bring the desired change.
-
</ol>
+
 
 +
====How to tell if a change can be made in an XML Template and/or Perl====
-
<h4><a name="XML"></a>How to tell if a change can be made in an XML Template and/or Perl </h4>
 
<p>At this point, things get quite a bit more complicated. Often, changing
<p>At this point, things get quite a bit more complicated. Often, changing
the XML also means changing the Perl CGI and changing the XSL as well. In
the XML also means changing the Perl CGI and changing the XSL as well. In
Line 149: Line 123:
For instance, the PI you need may exist already and you just need to add
For instance, the PI you need may exist already and you just need to add
it to the XML template for the page you are working on. </p>
it to the XML template for the page you are working on. </p>
 +
<p>It would be appropriate at this point to contact DLXS Support with a question
<p>It would be appropriate at this point to contact DLXS Support with a question
such as, &quot;I'm thinking about doing X, and I'm wondering if it is reasonable
such as, &quot;I'm thinking about doing X, and I'm wondering if it is reasonable
as well as what type of expertise would be needed to do the job.&quot;</p>
as well as what type of expertise would be needed to do the job.&quot;</p>
-
<p>However, if you are an experienced programmer, we encourage you to <a href="http://dev-linux.umdl.umich.edu/d/dlxs/training/workshop200707/troubleshooting/troubleshooting.html#misctech">use
+
 
-
the Perl debugger to step through the code</a> to see what you can figure
+
<p>However, if you are an experienced programmer, we encourage you to [[Installation Troubleshooting#Tools, checks and techniques|use
 +
the Perl debugger to step through the code]] to see what you can figure
out on your own. If you think you see a solution, you might choose to contact
out on your own. If you think you see a solution, you might choose to contact
DLXS Support to say, &quot;I'm thinking about doing X, and this is how I propose
DLXS Support to say, &quot;I'm thinking about doing X, and this is how I propose
to do it. What do you think?&quot;. It is not that you need our blessing, but
to do it. What do you think?&quot;. It is not that you need our blessing, but
perhaps we can make a suggestion that would save you a lot of time, or difficulty. </p>
perhaps we can make a suggestion that would save you a lot of time, or difficulty. </p>
 +
<p>Basically, at this level, you need to be a programmer comfortable with using
<p>Basically, at this level, you need to be a programmer comfortable with using
the Perl debugger to step through a large body of object oriented code.</p>
the Perl debugger to step through a large body of object oriented code.</p>
 +
<p>In general, it is not a bad idea to contact DLXS Support for
<p>In general, it is not a bad idea to contact DLXS Support for
guidance. Tell us what you are trying to do and a we'll be able to suggest
guidance. Tell us what you are trying to do and a we'll be able to suggest
Line 165: Line 143:
find one. </p>
find one. </p>
-
<h2 class="mainpalette"><a name="Correct"></a>Finding the Correct Files: More about Fallback</h2>
+
==Finding the Correct Files: More about Fallback==
-
<h3><a name="XMLTemplate"></a>XML Template </h3>
+
 
 +
===XML Template===
 +
 
<p>It can be difficult to locate the files that are directly involved in constructing
<p>It can be difficult to locate the files that are directly involved in constructing
an HTML page. Add <strong>debug=tpl</strong> to any DLXS URL for a report
an HTML page. Add <strong>debug=tpl</strong> to any DLXS URL for a report
Line 173: Line 153:
us that the search.xml template was found in the class (t/text for Text Class)
us that the search.xml template was found in the class (t/text for Text Class)
level web directory. </p>
level web directory. </p>
-
<h4><font color="red">HIT</font>: standard template path: /n1/web/t/text/search.xml,
+
 
-
xcollmode=singlecoll, on disk</h4>
+
====<font color="red">HIT</font>: standard template path: /n1/web/t/text/search.xml,
-
<h3><a name="Chunks"></a>XML Template Chunks </h3>
+
xcollmode=singlecoll, on disk====
 +
 
 +
===XML Template Chunks===
<p>There is a special Processing Instruction called &quot;CHUNK&quot;. The CHUNK PI is
<p>There is a special Processing Instruction called &quot;CHUNK&quot;. The CHUNK PI is
Line 184: Line 166:
it automatically take advantage of the change, making maintenance easy. Keep
it automatically take advantage of the change, making maintenance easy. Keep
in mind that chunks can contain PIs, including CHUNK PIs. </p>
in mind that chunks can contain PIs, including CHUNK PIs. </p>
 +
<p>Fallback applies to CHUNKS too. A collection level chunk, if it exists and
<p>Fallback applies to CHUNKS too. A collection level chunk, if it exists and
the situation is right, will be used instead of class or group level chunk.</p>
the situation is right, will be used instead of class or group level chunk.</p>
 +
<p>&lt;DlxsGlobals&gt;&lt;?CHUNK filename=&quot;dlxsclassglobals.xml&quot;?&gt;&lt;/DlxsGlobals&gt;</p>
<p>&lt;DlxsGlobals&gt;&lt;?CHUNK filename=&quot;dlxsclassglobals.xml&quot;?&gt;&lt;/DlxsGlobals&gt;</p>
-
<h3><a name="XSLStylesheet"></a>XSL Stylesheet </h3>
+
 
 +
===XSL Stylesheet===
<p>You will likely need to know which XSL files are being used. DLXS has a special
<p>You will likely need to know which XSL files are being used. DLXS has a special
Line 198: Line 183:
is to copy as little code as possible and rely on Fallback to draw together
is to copy as little code as possible and rely on Fallback to draw together
the proper set of files for a given situation.</p>
the proper set of files for a given situation.</p>
 +
<p>Support for this principle required development of a special method for specifying,
<p>Support for this principle required development of a special method for specifying,
locating, and importing one or more XSL Stylesheets for XML transformation
locating, and importing one or more XSL Stylesheets for XML transformation
to HTML. The <strong>Virtual XSL Stylesheet</strong> serves this purpose.</p>
to HTML. The <strong>Virtual XSL Stylesheet</strong> serves this purpose.</p>
 +
<p>Each primary XML Template includes an <strong>XSL Fallback File
<p>Each primary XML Template includes an <strong>XSL Fallback File
List</strong> where XSL filenames are specified in import order. Paths are
List</strong> where XSL filenames are specified in import order. Paths are
not necessary, because the Fallback mechanism will find the file at the collection,
not necessary, because the Fallback mechanism will find the file at the collection,
group or class level depending on the situation and the presence of files. </p>
group or class level depending on the situation and the presence of files. </p>
 +
<blockquote>
<blockquote>
<p>&lt;XslFallbackFileList&gt;<br>
<p>&lt;XslFallbackFileList&gt;<br>
&lt;Filename&gt;<strong>bookbagitemsstring.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>bookbagitemsstring.xsl</strong>&lt;/Filename&gt;<br>
- 
&lt;Filename&gt;<strong>search.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>search.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>htmlhead.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>htmlhead.xsl</strong>&lt;/Filename&gt;<br>
Line 214: Line 201:
&lt;Filename&gt;<strong>footer.import.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>footer.import.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>searchforms.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>searchforms.xsl</strong>&lt;/Filename&gt;<br>
- 
&lt;Filename&gt;<strong>xsl2htmlutils.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>xsl2htmlutils.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>globalvariables.xsl</strong>&lt;/Filename&gt;<br>
&lt;Filename&gt;<strong>globalvariables.xsl</strong>&lt;/Filename&gt;<br>
Line 220: Line 206:
&lt;/XslFallbackFileList&gt; </p>
&lt;/XslFallbackFileList&gt; </p>
</blockquote>
</blockquote>
-
<p>All Fallback is handled by the Perl CGI. To build the <a href="search_virtualstylesheet.xml">Virtual
+
 
-
XSL Stylesheet (example)</a>, the CGI parses the XSL Fallback File List, performs Fallback on
+
<p>All Fallback is handled by the Perl CGI. To build the [http://www.dlxs.org/training/workshop200707/ui/search_virtualstylesheet.xml Virtual
 +
XSL Stylesheet (example)], the CGI parses the XSL Fallback File List, performs Fallback on
each file, and assembles a list of XSL import statements. </p>
each file, and assembles a list of XSL import statements. </p>
<p>Here you can see the import statements from the Virtual XSL Stylesheet the
<p>Here you can see the import statements from the Virtual XSL Stylesheet the
CGI builds. In this case, all of the files are in the class level web directory.</p>
CGI builds. In this case, all of the files are in the class level web directory.</p>
 +
<blockquote>
<blockquote>
<p>&lt;xsl:import href=&quot;<strong>/n1/web/t/text/bookbagitemsstring.xsl</strong>&quot;/&gt;<br>
<p>&lt;xsl:import href=&quot;<strong>/n1/web/t/text/bookbagitemsstring.xsl</strong>&quot;/&gt;<br>
Line 231: Line 219:
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/htmlhead.xsl</strong>&quot;/&gt;<br>
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/htmlhead.xsl</strong>&quot;/&gt;<br>
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/navheader.xsl</strong>&quot;/&gt;<br>
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/navheader.xsl</strong>&quot;/&gt;<br>
- 
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/footer.import.xsl</strong>&quot;/&gt;<br>
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/footer.import.xsl</strong>&quot;/&gt;<br>
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/searchforms.xsl</strong>&quot;/&gt;<br>
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/searchforms.xsl</strong>&quot;/&gt;<br>
Line 237: Line 224:
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/globalvariables.xsl</strong>&quot;/&gt;<br>
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/globalvariables.xsl</strong>&quot;/&gt;<br>
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/searchheader.xsl</strong>&quot;/&gt;</p>
&lt;xsl:import href=&quot;<strong>/n1/web/t/text/searchheader.xsl</strong>&quot;/&gt;</p>
- 
</blockquote>
</blockquote>
 +
<p>The order of the import statements is significant. The <strong>first</strong> import &quot;wins&quot; in
<p>The order of the import statements is significant. The <strong>first</strong> import &quot;wins&quot; in
cases where an XSL template (don't confuse XSL templates with XML templates)
cases where an XSL template (don't confuse XSL templates with XML templates)
Line 249: Line 236:
file. Here are the steps you should take.</p>
file. Here are the steps you should take.</p>
-
<ol>
+
# Create a collection specific web directory, if one does not already exist.
-
<li>Create a collection specific web directory, if one does not already exist.</li>
+
# Create an XSL file called search.xsl in the collection specific web
-
<li>Create an XSL file called search.xsl in the collection specific web
+
directory and include in it just the template(s) requiring modification.
directory and include in it just the template(s) requiring modification.
You probably want to copy the single template from the Class level XSL search.xsl
You probably want to copy the single template from the Class level XSL search.xsl
-
file. </li>
+
file.
-
<li>Add an import statement to the collection level search.xsl file that imports
+
# Add an import statement to the collection level search.xsl file that imports
-
the Class level file.</li>
+
the Class level file.
-
<li>Modify the collection level template to your liking.</li>
+
# Modify the collection level template to your liking.
-
</ol>
+
 
<p>When the Virtual Stylesheet is assembled, Fallback will find the collection
<p>When the Virtual Stylesheet is assembled, Fallback will find the collection
level search.xsl file and import it. This will in-turn cause the Class level
level search.xsl file and import it. This will in-turn cause the Class level
Line 264: Line 250:
will be used since it was imported first. </p>
will be used since it was imported first. </p>
-
<h3><a name="Oxygen"></a>Oxygen for Dissecting XML and XSL</h3>
+
===Oxygen for Dissecting XML and XSL===
-
<p><strong>Oxygen</strong> is an application for editing and debugging XML and XSL (see also <a href="../troubleshooting/tools.html">web
+
 
-
development tools</a>).
+
<p><strong>Oxygen</strong> is an application for editing and debugging XML and XSL (see also [[Useful Tools|web development tools]]).
It also does XSL transformations so you clearly see the relationship among
It also does XSL transformations so you clearly see the relationship among
the XML, XSL and the resulting HTML. Oxygen enables you
the XML, XSL and the resulting HTML. Oxygen enables you
Line 272: Line 258:
in the HTML output and it will show you the XML and XSL that generated it.
in the HTML output and it will show you the XML and XSL that generated it.
What a powerful timesaver!</p>
What a powerful timesaver!</p>
 +
<p>To make the most effective use of Oxygen, you should use an XWindows server
<p>To make the most effective use of Oxygen, you should use an XWindows server
to run it remotely on the DLXS server. This provides direct access to all
to run it remotely on the DLXS server. This provides direct access to all
Line 279: Line 266:
the Virtual XSL Stylesheet to the XML. Oxygen will find and open the imported
the Virtual XSL Stylesheet to the XML. Oxygen will find and open the imported
XSL files allowing you to make edits and rerun the transform. </p>
XSL files allowing you to make edits and rerun the transform. </p>
-
<h3><a name="LanguageMap"></a>Language Map</h3>
+
 
 +
===Language Map===
<p>All text that appears as part of the user interface is stored in an XML file
<p>All text that appears as part of the user interface is stored in an XML file
per Class called <strong>langmap.en.xml</strong>. Phrases are assigned keys, and the keys are
per Class called <strong>langmap.en.xml</strong>. Phrases are assigned keys, and the keys are
used in the XSL to retrieve phrases. </p>
used in the XSL to retrieve phrases. </p>
 +
<p>Customization of the Language Map requires finding the key and phrase that
<p>Customization of the Language Map requires finding the key and phrase that
needs to be changed. There are a couple of ways to go at this. You can open
needs to be changed. There are a couple of ways to go at this. You can open
Line 289: Line 278:
key in the XSL and then look for the key in Language Map. Once the key and
key in the XSL and then look for the key in Language Map. Once the key and
phrase have been identified, it is recommended that you create a <strong>langmapextra.en.xml</strong> file and make your changes there. </p>
phrase have been identified, it is recommended that you create a <strong>langmapextra.en.xml</strong> file and make your changes there. </p>
 +
<p>For example, if you need to change the word &quot;login&quot; to &quot;sign in&quot; for all Text
<p>For example, if you need to change the word &quot;login&quot; to &quot;sign in&quot; for all Text
Class collections, do the following.</p>
Class collections, do the following.</p>
-
<ol>
+
# Open $DLXSROOT/web/t/text/langmap.en.xml and locate the term &quot;login&quot;. There
-
<li>Open $DLXSROOT/web/t/text/langmap.en.xml and locate the term &quot;login&quot;. There
+
may be several occurrences, but you confirm three are relevant by grepping
may be several occurrences, but you confirm three are relevant by grepping
the XSL files for the keys. Here are the three. <br>
the XSL files for the keys. Here are the three. <br>
Line 302: Line 291:
&lt;Item key=&quot;results.str.9&quot;&gt;<strong>Login</strong> for full access
&lt;Item key=&quot;results.str.9&quot;&gt;<strong>Login</strong> for full access
to this item&lt;/Item&gt; <br>
to this item&lt;/Item&gt; <br>
-
</span></li>
+
</span>
-
<li>Create a new file in the Text Class web directory called <strong>langmapextra.en.xml</strong> containing
+
# Create a new file in the Text Class web directory called <strong>langmapextra.en.xml</strong> containing
the following text. The &quot;Lookup id&quot; value is arbitrary. &quot;auth&quot; is used here
the following text. The &quot;Lookup id&quot; value is arbitrary. &quot;auth&quot; is used here
-
just to be consistent with what appears in <strong>langmap.en.xml</strong>. <br>
+
just to be consistent with what appears in <strong>langmap.en.xml</strong>.
-
 
+
-
<br>
+
<span class="markupsnippet style1">&lt;LookupTables&gt;<br>
<span class="markupsnippet style1">&lt;LookupTables&gt;<br>
&lt;Lookup id=&quot;auth&quot;&gt; <br>
&lt;Lookup id=&quot;auth&quot;&gt; <br>
Line 319: Line 306:
&lt;/LookupTables&gt;
&lt;/LookupTables&gt;
-
</span></li>
+
</span>
-
</ol>
+
<p>That's all it takes. The DlxsGlobals.xml chunk file already specifies that
<p>That's all it takes. The DlxsGlobals.xml chunk file already specifies that
<strong>langmapextra.en.xml</strong> be loaded if present. Item keys in it
<strong>langmapextra.en.xml</strong> be loaded if present. Item keys in it
Line 327: Line 313:
<p>It is possible to use Language Maps to create a multi-lingual user
<p>It is possible to use Language Maps to create a multi-lingual user
interface. </p>
interface. </p>
-
<h3 align="left">&nbsp;</h3>
 
-
</body>
 
- 
-
</html>
 

Revision as of 17:57, 10 August 2007

Please read the User Interface Overview if you have not yet.

Contents

Figuring Out How to Make a Change

Overview

Given the complexity of DLXS and the variety of options for making interface customizations, it can be difficult to determine how to make a change, let alone the the best way to make a change.

First of all, there are some web development tools available that can greatly simplify your effort. For now, get these three and keep the others in mind.

  1. Firefox web browser
  2. Firebug extension for Firefox
  3. Web Developer extension for Firefox

Next, get a little more familiar with the potential places customizations can be made. Listed below are the options, from simplest to most advanced. It probably goes without saying that you want to choose a simple option whenever possible.

  What can you do? What do you need to know?
Collection Manager Change the most common interface elements such as collection title and
     field labels. Include or exclude certain functionality. Varies significantly
by Class.
You need to know how to use your browser. There is contextual help in Collection Manager for each field.
CSS Change colors and font styles. Hide elements. Control positioning of some elements in Image Class. Requires knowledge of CSS and a basic understanding of Fallback.
Language Map Change user interface text. Requires basic knowledge of XSL, XML and Fallback.
XSL Alter the structure/layout of the HTML including the application of CSS styles. Requires knowledge of XSL, HTML, and CSS and a very good understanding of Fallback.
Javascript Control dynamic interactions that occur in the browser. Requires knowledge of Javascript and HTML and a basic understanding of Fallback.
XML Template Include/exclude Processing Instructions to control the availability of data generated by the CGI. Requires very good knowledge of all aspects of the user interface, Fallback, and the role of the CGI in DLXS.
Perl Control the data generated by the CGI. Alter Processing Instructions, or create new ones. Requires very good knowledge of object oriented Perl, the architecture
     of DLXS code, and all other aspects of the user interface. We recommend
consulting with DLXS support before making Perl code changes.

 

Customization may require changes in more than one of the above areas. For example, you may need to change the XSL to add a class to an element so that you can change it's appearance in the browser using CSS.

Pointers for deciding how to approach a user interface customization task.=

How to tell if the change can be made in Collection Manager

  • Study the Collection Manager fields for the Class and Group, specifically
   looking for an option that would cause the desired change. Click the Collection
   Manager field labels for contextual help. Many fields apply to all classes,
   but each class has unique fields as well.


How to tell if the change can be made with Cascading Style Sheets (CSS)

  • First of all, you need to have a basic understanding of what CSS is good for and how it works.
  • Use the Firebug extension to Firefox to inspect the structure
   of the page including element class and id attributes. Firebug also 
   shows the styles that are currently affecting the element. In fact, you can
   even experiment with style definitions in Firebug. This should give you
   a very good idea of whether the change can be made with CSS, or not.

How to tell if the change can be made with XSL

  • Add debug=xml to the URL to view the XML for the page. Take a close look
   at the XML to see if the the information needed is present in the XML and
   structured in a way amenable to use with XSL. If the right information is
   in the XML, then XSL modifications will probably bring the desired change.

How to tell if a change can be made in an XML Template and/or Perl

At this point, things get quite a bit more complicated. Often, changing the XML also means changing the Perl CGI and changing the XSL as well. In the best case, it is only a matter of shifting existing code around a little. For instance, the PI you need may exist already and you just need to add it to the XML template for the page you are working on.

It would be appropriate at this point to contact DLXS Support with a question such as, "I'm thinking about doing X, and I'm wondering if it is reasonable as well as what type of expertise would be needed to do the job."

However, if you are an experienced programmer, we encourage you to use the Perl debugger to step through the code to see what you can figure out on your own. If you think you see a solution, you might choose to contact DLXS Support to say, "I'm thinking about doing X, and this is how I propose to do it. What do you think?". It is not that you need our blessing, but perhaps we can make a suggestion that would save you a lot of time, or difficulty.

Basically, at this level, you need to be a programmer comfortable with using the Perl debugger to step through a large body of object oriented code.

In general, it is not a bad idea to contact DLXS Support for guidance. Tell us what you are trying to do and a we'll be able to suggest the most reasonable approach. If you are not a programmer, you may need to find one.

Finding the Correct Files: More about Fallback

XML Template

It can be difficult to locate the files that are directly involved in constructing an HTML page. Add debug=tpl to any DLXS URL for a report on the Fallback file selection process. The first file attempted will generally be the XML template file. In the example below, taken from the debug output, "HIT" tells us that the search.xml template was found in the class (t/text for Text Class) level web directory.

====HIT: standard template path: /n1/web/t/text/search.xml,

 xcollmode=singlecoll, on disk====

XML Template Chunks

There is a special Processing Instruction called "CHUNK". The CHUNK PI is for inserting a "chunk" of XML into the XML Template. Chunks are helpful where the same XML needs to occur in more than one XML Template. The best example is dlxsclassglobals.xml. This is an XML chunk that is used in just about every XML Template. When the chunk file is modified, all of the templates that use it automatically take advantage of the change, making maintenance easy. Keep in mind that chunks can contain PIs, including CHUNK PIs.

Fallback applies to CHUNKS too. A collection level chunk, if it exists and the situation is right, will be used instead of class or group level chunk.

<DlxsGlobals><?CHUNK filename="dlxsclassglobals.xml"?></DlxsGlobals>

XSL Stylesheet

You will likely need to know which XSL files are being used. DLXS has a special way of linking XSL Stylesheets to XML files that allows for a lot of flexibility. The ability to make very specific customizations at the collection and group levels is extremely useful, but also introduces the potential for lots of XML and XSL to be duplicated needlessly. For example, you might be tempted to begin customizing a collection by first copying all of the class level web files to the collection's web directory (a very bad idea by the way). The best approach is to copy as little code as possible and rely on Fallback to draw together the proper set of files for a given situation.

Support for this principle required development of a special method for specifying, locating, and importing one or more XSL Stylesheets for XML transformation to HTML. The Virtual XSL Stylesheet serves this purpose.

Each primary XML Template includes an XSL Fallback File List where XSL filenames are specified in import order. Paths are not necessary, because the Fallback mechanism will find the file at the collection, group or class level depending on the situation and the presence of files.

<XslFallbackFileList>
<Filename>bookbagitemsstring.xsl</Filename>
<Filename>search.xsl</Filename>
<Filename>htmlhead.xsl</Filename>
<Filename>navheader.xsl</Filename>
<Filename>footer.import.xsl</Filename>
<Filename>searchforms.xsl</Filename>
<Filename>xsl2htmlutils.xsl</Filename>
<Filename>globalvariables.xsl</Filename>
<Filename>searchheader.xsl</Filename>
</XslFallbackFileList>

All Fallback is handled by the Perl CGI. To build the [http://www.dlxs.org/training/workshop200707/ui/search_virtualstylesheet.xml Virtual XSL Stylesheet (example)], the CGI parses the XSL Fallback File List, performs Fallback on each file, and assembles a list of XSL import statements.

Here you can see the import statements from the Virtual XSL Stylesheet the CGI builds. In this case, all of the files are in the class level web directory.

<xsl:import href="/n1/web/t/text/bookbagitemsstring.xsl"/>
<xsl:import href="/n1/web/t/text/search.xsl"/>
<xsl:import href="/n1/web/t/text/htmlhead.xsl"/>
<xsl:import href="/n1/web/t/text/navheader.xsl"/>
<xsl:import href="/n1/web/t/text/footer.import.xsl"/>
<xsl:import href="/n1/web/t/text/searchforms.xsl"/>
<xsl:import href="/n1/web/lib/xsl2htmlutils.xsl"/>
<xsl:import href="/n1/web/t/text/globalvariables.xsl"/>
<xsl:import href="/n1/web/t/text/searchheader.xsl"/>

The order of the import statements is significant. The first import "wins" in cases where an XSL template (don't confuse XSL templates with XML templates) of the same name occurs in more than one file. This feature allows XSL template overrides to occur in a logical fashion. This is very important concept to understand. Imagine you want to customize the search form for a single collection and that the change requires modification to just one of several XSL templates that exist in the Class level search.xsl file. Here are the steps you should take.

  1. Create a collection specific web directory, if one does not already exist.
  2. Create an XSL file called search.xsl in the collection specific web
   directory and include in it just the template(s) requiring modification.
   You probably want to copy the single template from the Class level XSL search.xsl
   file. 
  1. Add an import statement to the collection level search.xsl file that imports
   the Class level file. 
  1. Modify the collection level template to your liking.

When the Virtual Stylesheet is assembled, Fallback will find the collection level search.xsl file and import it. This will in-turn cause the Class level search.xsl file to be imported too, except the modified collection level template will be used since it was imported first.

Oxygen for Dissecting XML and XSL

Oxygen is an application for editing and debugging XML and XSL (see also web development tools). It also does XSL transformations so you clearly see the relationship among the XML, XSL and the resulting HTML. Oxygen enables you to step through the transform, but even better, you can click on an element in the HTML output and it will show you the XML and XSL that generated it. What a powerful timesaver!

To make the most effective use of Oxygen, you should use an XWindows server to run it remotely on the DLXS server. This provides direct access to all of the XML and XSL files. Adding debug=xsltwrite to a DLXS URL will cause the CGI to write the Virtual XSL Stylesheet and the populated XML files to disk in $DLXSROOT/web/cache. Open these files in Oxygen, and transform the Virtual XSL Stylesheet to the XML. Oxygen will find and open the imported XSL files allowing you to make edits and rerun the transform.

Language Map

All text that appears as part of the user interface is stored in an XML file per Class called langmap.en.xml. Phrases are assigned keys, and the keys are used in the XSL to retrieve phrases.

Customization of the Language Map requires finding the key and phrase that needs to be changed. There are a couple of ways to go at this. You can open the Language Map file and search for the phrase, or you can locate the associated key in the XSL and then look for the key in Language Map. Once the key and phrase have been identified, it is recommended that you create a langmapextra.en.xml file and make your changes there.

For example, if you need to change the word "login" to "sign in" for all Text Class collections, do the following.

  1. Open $DLXSROOT/web/t/text/langmap.en.xml and locate the term "login". There
   may be several occurrences, but you confirm three are relevant by grepping
   the XSL files for the keys. Here are the three. 

<Item key="standardlogin.str">Login&#xa0;</Item>

<Item key="header.str.login">Login </Item>

<Item key="results.str.9">Login for full access to this item</Item>

 
  1. Create a new file in the Text Class web directory called langmapextra.en.xml containing
   the following text. The "Lookup id" value is arbitrary. "auth" is used here
   just to be consistent with what appears in langmap.en.xml.
 <LookupTables>
<Lookup id="auth">
<Item key="standardlogin.str">Sign In&#xa0;</Item>

<Item key="header.str.login">Sign In </Item>
<Item key="results.str.9">Sign In for full

 access to this item</Item>
</Lookup>
</LookupTables>
 

That's all it takes. The DlxsGlobals.xml chunk file already specifies that langmapextra.en.xml be loaded if present. Item keys in it trump items with the same keys in langmap.en.xml. To limit the changes to a specific group or collection, place the langmapextra.en.xml file in the collection or group level web directory.

It is possible to use Language Maps to create a multi-lingual user interface.

Personal tools