(This is a posting of an editor daemon developed by
TimEdwards for use within Motorola. I asked Tim to release it because I found it very useful - and easy to use - when I worked in Motorola. I haven't done any repackaging, so what you see in the attached zip is exactly what Tim has released. As is usual with such packages, there is absolutely no comeback on Motorola, Tim or myself if it fails to function as advertised. Caveat Emptor. --
CrawfordCurrie - 20 May 2004)
TWILOC
This initial proof-of-concept implementation of Twiloc allows a local
editor to be triggered by the browser (using CGI apptype) for Twiki
edits. Whenever the local file is saved, the Twiloc daemon refreshes
a preview in the connected browser. When editing is done, the user
simply commits the preview in their browser and exits the edit
session. Twiloc attempts to cleanup after itself when the editor
exits.
The twiki_resources/ subdirectory includes the templates necessary to
enable a 'twiloc' edit button on your twiki, as well as the two-line
change necessary to enable the 'apptype' directive for the edit
script (see the README in that directory).
There is a hiccup in the methodology related to Internet Explorer.
The problem with IE is that it
ignores the apptype directive and
chooses to interpret such files as it pleases. There doesn't seem to
be a good way to fix this other than using a suffix to force the
behavior. But file suffixes are not easy beasts to register, and I
grew disgusted with the whole IE mess before finding a decent
solution.
The daemon remembers authentication information for a given server,
but uses shallow encryption (caveat emptor) and simply fails if the
cached password doesn't match in later sessions -- The cache must be
manually cleared to proceed (see .twilocauthinfo).
Imbedded form data is maintained (no small feat!) but not exposed in
this version of the tool. It would be possible to display that data
for edit as well, either as an addendum to the rest of the data or in
another window.
For better or worse, this initial version of Twiloc is implemented in
Tcl/Tk. I can easily imagine a Perl implementation, which would be
more in the Twiki spirit of things, but I enjoy prototyping in Tcl/Tk
for the easy graphical interface. The tclkit package
(
http://www.equi4.com/tclkit.html
) is used to bundle the script into a
standalone executable for either a UNIX or Windows platform. The
two-button (EXIT/console) window that comes up is for debug purposes.
See the "build" script for UNIX, or the build.bat batch file for
Windows.
INSTALLATION & USAGE
- Get tclkit for your platform (http://www.equi4.com/tclkit.html
).
- Name the binary "tclkit" or "tclkit.exe", and then make a copy to "tclkit_copy" or "tclkit_copy.exe".
- Use "build" (unix) or "build.bat" (windows) to build a binary. NOTE: Both a 'tclkit' and a 'tclkit_copy" executable are required for building, since the latter is used by the former during the build process. I know, it seems weird.
- Install the templates in twiloc_resources/, and make the small change described there to the 'edit' script to enable apptype.
- View a page with the 'twiloc' skin to enable the twiloc edit button, and trigger an edit.
- Associate the apptype with the twiloc binary you built in step 3. (saved by your browser for later sessions).
- Pick your editor (saved in the .twiloc preferences file for later sessions).
- Edit the content and 'save' in your editor.
- Examine the preview in your browser.
DEBUGGING
You can press the "console" button to get a Tcl prompt, where you can
interact with runtime variables. A debugging toplevel '.t' is
available if you issue the command 'wm deiconify .t', and can be used
to view runtime messages from the script.
The most common problem will likely be the interaction with the
browser when saving in the editor. On UNIX platforms, the command
"netscape" is used to trigger this interaction... You may need to
change this to some other name ("firefox.exe", for example) on the
"set ::netscape" line near the top of the script. After making such a
change, you'll need to re-build the binary. This should really be
part of an install script or somesuch...
- May 2004 - Tim J. Edwards
Copyright
This code is an original development of Motorola Inc. and is protected by the following copyrights:
- Copyright (C) 2004 Motorola Inc. All Rights Reserved.
- Copyright (C) 2004 Freescale Inc. All Rights Reserved.
License
As required for the publication of all extensions to TWiki, this
software is published under the terms of the GNU General Public
License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details, published at
http://www.gnu.org/copyleft/gpl.html
Add-On Info
- Set SHORTDESCRIPTION = Edit TWiki topics with a client side editor
Related Topic: TWikiAddOns
--
CrawfordCurrie - 20 May 2004