This can be used to test some TWiki Markup Language (TML), or to
simply inspect a TWiki variable without having to go through a
complete view/edit/save/view cycle. Available in three flavours: an
one-line input field, a text area, and a real sandbox.
All these share some shortcoming: The TWiki Variables describing the
current web and topic (e.g. TOPIC) are showing a
"wrong" value (so searches etc. are having the wrong defaults), and a
"Save" function is not implemented (though the latter would be
possible).
One Line Input Field
Enter Text, TML, or TWikiVariables. Try, for example, [[MendedDrum]] or %SEARCH{"Topic Explorer"}%.
To use in your own topic, say:
%INCLUDE{"Legolab.MiniAHAH" section="tmlinput"}%
Multiline Text Area
Use this one for trying bullet lists, table layouts, ...
To use in your own topic, say:
%INCLUDE{"Legolab.MiniAHAH" section="tmltextarea"}%
A Sandbox Within A Topic
With a sandbox like this, guests can try editing and formatting
without having to think about topic names. No trace will be left on
the server side.
To use in your own topic, say:
%INCLUDE{"Legolab.MiniAHAH" section="tmlsandbox"}%
A Dynamic Topic Selector Form
This is similar to the "Jump" box in pattern skin,
but allows selecting from existing webs and topics instead of having to guess.
Clicking on the will convert the
text boxes to dropdown menues, which will be filled with values only on request,
but cached for quick access.
Be careful when using this to select topics from a web with many
topics, this may take quite a while.
To use in your own topic, say:
%INCLUDE{"Legolab.MiniAHAH" section="topicselector"}%
A Dynamic Topic Explorer
This is similar to the Windows Explorer. Clicking on the will
expand the webs, or topics, respectively.
Be careful when using this for webs with many
topics, this may take quite a while.
(TWiki)
To use in your own topic, say:
%INCLUDE{"Legolab.MiniAHAH" section="topicexplorer"}%
Is TWikiVariables too fat for you? Mind you, it has
~150kB, includes lots of stuff and - per design - expands almost every
conceivable variable. Then read only the parts you really need.
A drawback is that the links to "Related" variables are broken. As
broken as if you access individual variable topics like
VarACTIVATEDPLUGINS, and for a similar reason.
(All TWiki Variables)
To use in your own topic, say:
%INCLUDE{"Legolab.MiniAHAH" section="twikivarexplorer"}%
Conveniently Getting/Setting Session Variables
Usually, to set a session variable you need to edit and save a topic. This is inconvenient, as I'd dare to say, since topics live longer than sessions (most of the time) and unless you remember to update the topic at the end of the session, everyone reading this topic will get the session variable thrust upon him.
Set Using Key-Value Boxes
Enter the name of a session variable (for example _SESSION_REMOTE_ADDR) to read its value, set if you want.
To use in your own topic, say:
%INCLUDE{"Legolab.MiniAHAH" section="sessionvariable"}%
A Table of Frequently Used Session Variables
Set your Session variables:
To use in your own topic, say:
%INCLUDE{"Legolab.MiniAHAH" section="sessionvariabletable"}%
Preparation for Usage in Your Topics
Create the two topics MiniAHAH and MiniAHAHSelector, either by copying the contents from this web or by expanding the zip files which I have still been to lazy to attach.
Include the following either in one of your templates, or only in the text those pages where you want to use the examples (you'll see it in raw or edit mode at the top of this topic):
<script type="text/javascript"><!--
var ahah_web = '%WEB%';
var ahah_topic_type = 'input';
// -->
</script>
See the demonstrations above for how to use the particular functions.
You don't have to stick with the functions given here. Take them just
as a examples, extend as you like.
Technical Section
Purpose of this topic
Short of a AJAX Framework, let's have a look what can be done with today's (TWiki4) functions, by leveraging a technique called "AHAH". AHAH (Asynchronous HTML and HTTP), also known as JAH (Javascript Asynchronous HTML) is sort of a lightweight AJAX (Asynchronous HTML And XML).
Today methods to expand or collapse parts of a HTML page with
Javascript are quite frequently found in the internet. For TWiki,
there are several extensions which help authors doing this. So, why
yet another technique? Let's compare with some of those:
In contrast to TWiki:Plugins.TwistyContrib,
TWiki:Plugins.RenderListPlugin, TWiki:Plugins.TooltipPlugin and the
like, with AHAH the "expandable" data are not fetched in advance.
They're only fetched from the server when unfolding is requested,
using the AJAXoid XMLHttpRequest(). If you are doing many unfolds,
the "traditional" CSS folding techniques are faster because only one
request to the server is required - however, even then the perceived
speed may be better with AHAH, where the first screen is readily
available.
Comparing to JSPopupPlugin, this extension is not a plugin.
It does not define a new TWiki tag to the author. Instead, it is
targeted at TWiki power users who want to define blocks (see below)
for ready-to-use dynamic content.
Overview
To dynamically read things like a %TOPICLIST% into a TWiki
topic, we need a possibility to 1) retrieve that information from the
server, and 2) display the list in the browser.
The first part is possible using Javascript: Modern browsers support a
function XMLHttpRequest, which allows to pull (XML) contents via
HTTP from a web server into a Javascript variable.
For the second part, we will use the DOM property innerHTML, which
describes the complete contents of a HTML element. We are not going
to bother with parsing the results from XMLHttpRequest (that is, by
the way, the difference between AJAX and AHAH). We simply replace
the contents of an element which has been present in a topic by the
contents from the server. Fortunately TWiki usually throws out valid
XHTML, which is valid XML as well.
The Gory Details
Formulating the =XMLHttpRequest
Formatting the Result
Mini AHAH Templates
The following templates implement what you can see in the demonstrations above.
They will look strange (at least) when viewed they bear no useful function, and only minimal effort has been taken to
maintain thie section as valid (X)HTML.
Templates for the TML Previewer
TML Single Line Template
TML Textarea Template
Sandbox Template
Templates for the Topic Selector Form
Template =topicselector
This is the template for the dynamic topic selector above.
The place to learn about TWiki features and perform TWiki system maintenance.
TWiki® is a flexible, powerful, secure, yet simple Enterprise Wiki and Web Application Platform. Use TWiki for team collaboration, project management, document management, as a knowledge base and more on an intranet or on the Internet.
Installed: TWiki-6.1.0, Mon, 16 Jul 2018, build 30610, Plugin API version 6.10
Disclaimer
TWiki® is a registered trademarks of TWiki founder Peter Thoeny, TWiki.org. The TWiki logo and the "Collaborate with TWiki" tagline are trademarks of Peter Thoeny.
Twiki (with a lower case "w") is a robot character from the Buck Rogers™ in the 25th Century TV series. TWiki (with an upper case "W") is not affiliated with the Dille Family Trust, the registered trademark owner of the Buck Rogers name.
TWiki is developed as Free Software under the GNU/GPL.