!!!CVS View Plugin
By [RoyPhillips]

~CVSViewPlugin loads a file from a named CVS repository and displays it in the wiki page

[{CVSViewPlugin cvsview.pserver='scott/tiger@delphi:2401/export/cvsroot'

Lines [{$cvsview.range.lower}] thru [{$cvsview.range.upper}] 
of __[{$cvsview.filename}]__ version [{$cvsview.version}]\\
(Module: {{[{$cvsview.module}]}} path: {{[{$cvsview.path}]}})

This example will attempt to retrieve the current version of the file "/src/java/org/tigris/scarab/actions/MoveIssue.java" in the module "Scarab"
from the CVS repository :
* located in "/export/cvsroot"
* on server "delphi" at port 2401
* using user "scott" and password "tiger" [1]

It will call the [ColorCodePlugin|ColorCodePlugin_page] to render the file (it will detect the syntax type from the file name), and display only lines 90 thru 100.

[#1] The password is mandatory, otherwise plugin insersion fails and the logs contain {{ Plugin failed while executing: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1}}

The example also demonstrates the use of variables temporarily injected into the page context (may be used after the plugin invocation only).

[{Image src='cvsview-eg1.bmp' width='99%;' }]

In the absence of either {{colorcode}} or {{plugin}} parameters, the source is rendered using a version of [MaxVoelkel]'s [FormatCodePlugin], to get <tt> style and CamelCase support.

!Rendering with other plugins
To use another plugin to the render the file, such as [Java2HtmlPlugin], use the {{cvsview.plugin}} parameter to name the plugin, and pass its parameters prefixed with the plugin name:

{{~[~{CVSViewPlugin cvsview.pserver='scott/tiger@delphi:2401/export/cvsroot'}}\\
{{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cvsview.title='!FILENAME\n{{PATH}} \'\'Version\'\': VERSION'}}\\

This example also demonstrates the {{cvsview.title}} facility, which precedes the file inclusion with the specified JSPWiki markup, substituting the strings {{FILENAME, VERSION, MODULE, PATH}} with the values returned from CVS.

|cvsview.pserver|Connection string to CVS via pserver
|cvsview.module|Name of module in CVS repository
|cvsview.filepath|Full path and filename to be retrieved
|cvsview.colorcode|'true' if the ~ColorCode plugin should be used
|cvsview.title|JSPWiki markup for title or heading
|cvsview.plugin|Name of plugin to use to render source

#Question: how about :ext: support?

As the plugin requires both username and password for the cvs repository to be specified in a publicly-editable page, the plugin should be used for {{anonymous}}-accessible repositories, or internal intranets.  This plugin only allows file viewing, but the user ID and password can be used in other tools, so it's best to use an Id that isn't in the {{writers}} file. 
Having said that, pserver passwords aren't exactly the most secure...
*Specify required version, ID, etc. for resource
*Other CVS protocols than pserver
*Safer authentication (use Wiki ID/password? Use certs?)
*Wrap text returned in specified plugin (e.g., Java2HtmlPlugin) (''done, use:'' {{cvsview.plugin='__name__'}})
*Name method to extract from source or line number range (''done for range'')

If the {{cvsview.colorcode='true'}} parameter setting is used, the [Color Code|ColorCodePlugin_page] plugin should be installed, likewise for {{cvsview.java2html}}.

*Download the [distribution jar|cvsview-plugin.jar] into the local {{JSPWiki/WEB-INF/lib}} directory.
*Either invoke with full package name, or add to {{JSPWiki/WEB-INF/jspwiki.properties}} plugin search path:
;:{{jspwiki.plugin.searchPath = ...,lu.intrasoft.jspwiki.plugin, ...}}

*Unpack the [source jar|cvsview-plugin-src.jar] into some convenient directory
*Edit the {{build.properties}} file to set the local webserver path
** E.g., {{webserver.dir=C:/Program Files/Apache Software Foundation/Tomcat 5.5}}
*Run the ant task {{deploy}}

|[CVSViewPlugin.java|]|A {{~WikiPlugin}} wrapper around {{CVSFile}}
|[CVSFile.java|]|Non-plugin specific code to check-out a single named file from CVS
|[CVSItem.java|]|Representation of a CVS entry, incudes filename, version, size and contents
|[CVSPassword.java|]|CVS's trivial password algorithm

[<< Back to Contributed Plugins|ContributedPlugins]