Tags:
integration1Add my vote for this tag linking1Add my vote for this tag create new tag
, view all tags

SlashFilenamePlugin

This plugin implements rendering slash filenames detected in wiki text into RFC2396 URI specifications; if installed, it creates links such as: readme.txt.

Syntax Rules

File Specification Type What You Type (Wiki Text) What You Would See, If Plugin Were Installed (Rendered Version)
Microsoft "WINS" File Sharing and Samba (SMB) pathnames Type the WINS/SMB name of the server and full pathname/filename. Spaces in the pathname or filename are not allowed.
   * \\INTRANET-SERVER\SOME_SHARE_NAME\path\name\here
   * \\d2fs1/projects/
   * //d2fs1/library/releases/ExamplePackingList.doc
Pre-defined directory names (configured by TWiki admin). Unix pathname style. Type the full pathname/filename. Spaces in the pathname or filename are not allowed. Only pre-configured directory names will work.
   * \library\releases\ExampleReleaseNotes.doc
   * Quick link to my home directory: /home/jcline
Files on a Microsoft Windows local hard drive or Microsoft/Samba "Mapped Network Drive" Type the drive letter and path. Spaces in either the directory name or the filename are allowed. If the file has at least a one character extension, the name can be typed anywhere. If the file does not have an extension, the full pathname must be either:
  • within markup (in equal signs or underlines), or
  • in parenthesis, or
  • followed by a colon.

   * C:\My Documents\Corporate\Word and PPT Templates\Sales 2003.dot
   * K:\Support\Customer FAQs\index.html
   * The latest updates are in the =K:\Support\Customer FAQs\README=.
   * Please read the license (R:\Cairo Release\LICENSE) thoroughly.
   * c:/poor+file$name,choice.txt 

These types of filenames are always displayed in uppercase.
Relating Files to HTTP: Links, such as Source Code "cvsweb" Repository Browsing Type the name of the configured mount plus the name of the file. The result is an http: link to the complete file path within cvsweb (or viewcvs, etc).

   * Linux kernel /linux/kernel/ 
   * NetBSD kernels (/src/sys/arch) 
      * 'arm32' entry point: /src/sys/arch/arm/arm32/locore.S
   * Check out part of TWiki's source code, /twiki/lib/TWiki/Net.pm

Other Examples (Will Work if Plugin is Installed)

  • If you click on this file (c:\program files/windows nt\Accessories\wordpad.exe) from a Windows 2000 machine, it will ask you if you want to install/run it. If you chose "Yes" (don't worry, there is no security risk in this case), it will launch wordpad.
  • Either c:\WINDOWS\explorer.exe or c:\WINNT/explorer.exe will bring up a file explorer, if you run Windows 95, 98, NT, 2000, or XP. (Chose "yes" to run it.)
  • a mono filename, c:/winnt/explorer.exe in a paragraph.
  • a bold mono filename, c:/winnt/explorer.exe in a paragraph.
  • an emphasized filename, c:/winnt/explorer.exe in a paragraph.
  • a strongly emphasized filename, c:/winnt/explorer.exe in a paragraph.
  • \\d2fs1\jcline\webdata\data\debug.txt is the twiki debug output file which is helpful for troubleshooting plugins.
  • The coding standard H:\share\Docs/coding standard2.doc must be followed.
  • /var/log/messages would link to kernel messages, if you were on a BSD unix client.
  • /src/sys/arch/i386/i386 is in active development.

SlashFilenamePlugin Limitations

Pathname Length

To avoid run-on links (due to invalid wiki text), the entire pathname is limited to 255 characters.

Security Considerations

  • In order to open some files, the user may have to configure their browser security settings.
  • A malicious user on the intranet can create a link to any file on your local machine by simply typing the name of the file when this plugin is installed. However, this can be done on any web site by entering a normal file: link. The user always has the ability to deny the execution of any such file.
  • Intranet users should always be aware of security risks before executing files from web sites, including intranet sites.

Spaces in Filenames

Spaces in filenames and pathnames create a problem: How is the name delimited? This plugin takes the following approach.

  1. Only certain types of paths are allowed to use spaces.
    • Drive letter filenames allow spaces. Other types do not.
  2. A filename with spaces usually ends in an extension. Thus, for filenames with an extension, the extension can be searched for and a link is created.
    • An extension is defined as a period followed by a one to nine character string. Multiple extensions are handled; only the last extension is treated as the limiting extension. Examples are:
      • .txt .zip .tar.gz
      • c:\My Documents\Financial Statements\By Ticker\TOL.pdf
  3. For filenames which do not have an extension, the plugin looks for additional delimiters around the filename. When entering the filename, you must:
    • Use equal signs around the filename. This creates mono type anchors which also look nice.
      • Example: c:\program files/windows nt\Accessories\filename
    • Use underline(s) around the filename. This creates emphasis anchors.
      • Example: c:\program files/windows nt\Accessories\filename
    • Use parenthesis around the filename. This creates a substring (like this).
      • Example: (c:\program files/windows nt\Accessories\filename)
    • Use a colon at the end of the filename, as in a declaration.
      • c:\program files/windows nt\Accessories\filename: like this.
    • Place the filename in a table.
c:\program files/windows nt\Accessories\filename like this.

The following are examples of how not to use filenames with spaces. The following example(s) will not create valid links.

  • A filename referenced like the following, c:\program files/windows nt\Accessories\wordpad, will never be a valid link, since it has no extension and it is not delimited properly, leading to a run-on link. This link will continue until either a delimiter is found, until the end of the line, or until the maximum pathname length is reached.

Validating links

The plugin has no way to validate filenames or verify if links are to existing files. It is up to the user to enter the correct location of the file (as with any link).

SlashFilenamePlugin Global Settings

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Creates file: links to \\servers, /pathnames or /pathname/filenames; also creates http: relationships between /pathnames and specific URLs.

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = off

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the attached SlashFilenamePlugin.pm file and copy to your lib directory (see below).
  • Create a new Plugins topic on your intranet called SlashFilenamePlugin and cut & paste this topic's wiki text into it.
  • The files in your twiki installation directory should be:
    File: Description:
    data/Admin/SlashFilenamePlugin.txt Plugin topic
    data/Admin/SlashFilenamePlugin.txt Plugin topic repository
    lib/TWiki/Plugins/SlashFilenamePlugin.pm Plugin Perl module

  • Test if the installation was successful:
    • See all of the above examples. They should produce links.
  • Modify the plugin .pm code between the CONFIG sections to customize the mount points, share names, and cvs URLs.

Plugin Info

Plugin Author: TWiki:Main/JonathanCline
Plugin Version: 06 Jun 2003 (V1.000)
Change History:  
06 Jun 2003: Initial version
20 Jun 2003: 1.050: initial release
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005; tested on 5.8
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/SlashFilenamePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/SlashFilenamePluginDev

Related Topics: TWikiPreferences, TWikiPlugins

-- TWiki:Main/JonathanCline - 06 Jun 2003 -- JonathanCline - 21 Jun 2003

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 SlashFilenamePlugin.md5 r2 r1 manage 0.2 K 2008-12-12 - 12:03 SopanShewale checksum file , Uploaded as a part of Release Process
Perl source code filepm SlashFilenamePlugin.pm r1 manage 11.5 K 2003-06-21 - 05:10 JonathanCline SlashFilenamePlugin v1050
Compressed Zip archivetgz SlashFilenamePlugin.tgz r2 r1 manage 5.1 K 2008-12-12 - 12:03 SopanShewale See SlashFilenamePlugin for details. Untar and run the installer script, Uploaded as a part of Release Process
Compressed Zip archivezip SlashFilenamePlugin.zip r2 r1 manage 6.0 K 2008-12-12 - 12:03 SopanShewale See SlashFilenamePlugin for details. Unzip and run the installer script , Uploaded as a part of Release Process
Unknown file formatEXT SlashFilenamePlugin_installer r2 r1 manage 3.4 K 2008-12-12 - 12:03 SopanShewale Installer Script, Uploaded as a part of Release Process
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2012-12-03 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.