Skip to content

Commit

Permalink
Item479: rebrand BarcodePlugin
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/BarcodePlugin@1378 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
WillNorris authored and WillNorris committed Dec 16, 2008
1 parent 6411813 commit e0ebfd4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
20 changes: 11 additions & 9 deletions data/Foswiki/BarcodePlugin.txt
@@ -1,3 +1,4 @@

%META:TOPICINFO{author="StevenSprouse" date="1100553250" format="1.0" version="1.5"}%
%META:TOPICPARENT{name="SearchResult"}%
---+ <nop>%TOPIC%
Expand Down Expand Up @@ -59,34 +60,35 @@ headercolor="#FFFFCC" databg="#CCCCCC, #EFEFEF" headerrows="1" footerrows="1" }%
</verbatim>
---+++ Plugin Installation Instructions

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

* Make sure your Perl administrator has installed the Barcode::Code128 module. (perl -MCPAN -e "install Barcode::Code128")
* Make sure you have GD 1.20 or later installed.
* Download the ZIP file from the Plugin web (see below)
* Unzip ==%TOPIC%.zip== in your twiki installation directory. Content:
* Unzip ==%TOPIC%.zip== in your Foswiki installation directory. Content:
| *File:* | *Description:* |
| ==lib/Foswiki/Plugins/%TOPIC%.pm== | Plugin Perl module |
| ==data/System/%TOPIC%.txt== | Plugin topic |
| ==data/System/%TOPIC%.txt,v== | Plugin topic repository |
| ==pub/TWiki/BarcodePlugin/example_0.png== | Sample =barcode= image |
| ==pub/TWiki/BarcodePlugin/example_1.png== | Sample =barcode= image|
| ==pub/TWiki/BarcodePlugin/example_0.png,v== | Sample =barcode= repository |
| ==pub/TWiki/BarcodePlugin/example_1.png,v== | Sample =barcode= repository |
* (Dakar) Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section.
| ==pub/Foswiki/BarcodePlugin/example_0.png== | Sample =barcode= image |
| ==pub/Foswiki/BarcodePlugin/example_1.png== | Sample =barcode= image|
| ==pub/Foswiki/BarcodePlugin/example_0.png,v== | Sample =barcode= repository |
| ==pub/Foswiki/BarcodePlugin/example_1.png,v== | Sample =barcode= repository |
* (Dakar) Visit =configure= in your Foswiki installation, and enable the plugin in the {Plugins} section.
* Test if the plugin is correctly installed:
* Check above examples if the "if installed" column shows images instead of variables.


---+++ Plugin Info

| Plugin Author: | TWiki:Main/StevenSprouse |
| Plugin Version: | 8 Sep 2004 |
| Plugin Version: | 15 Dec 2008 |
| Change History: | |
| 15 Dec 2008| v1.003 - Rebranded to Foswiki |
| 11 Nov 2004| v1.002 - Improved benchmarks by changing Perl module load timing. |
| 5 Nov 2004| v1.001 - Added cue_cat flag |
| 4 Nov 2004| v1.000 - Initial release |
| TWiki Dependency: | $TWiki::Plugins::VERSION 1.024 |
| Foswiki Dependency: | $Foswiki::Plugins::VERSION 1.024 |
| CPAN Dependencies: | Barcode::Code128 |
| | GD v1.20 or later |
| Other Dependencies: | none |
Expand Down
26 changes: 13 additions & 13 deletions lib/Foswiki/Plugins/BarcodePlugin.pm
Expand Up @@ -23,7 +23,7 @@


# =========================
package TWiki::Plugins::BarcodePlugin; # change the package name and $pluginName!!!
package Foswiki::Plugins::BarcodePlugin; # change the package name and $pluginName!!!
# =========================

use vars qw(
Expand All @@ -43,7 +43,7 @@ use vars qw(
$pluginInitialized;
);

# This should always be $Rev$ so that TWiki can determine the checked-in
# This should always be $Rev$ so that Foswiki can determine the checked-in
# status of the plugin. It is used by the build automation tools, so
# you should leave it alone.
$VERSION = '$Rev$';
Expand All @@ -61,21 +61,21 @@ sub initPlugin
( $topic, $web, $user, $installWeb ) = @_;

# check for Plugins.pm versions
if( $TWiki::Plugins::VERSION < 1 ) {
TWiki::Func::writeWarning( "Version mismatch between $pluginName and Plugins.pm" );
if( $Foswiki::Plugins::VERSION < 1 ) {
Foswiki::Func::writeWarning( "Version mismatch between $pluginName and Plugins.pm" );
return 0;
}

# Get plugin debug flag
$debug = TWiki::Func::getPreferencesFlag( "\U$pluginName\E_DEBUG" );
$debug = Foswiki::Func::getPreferencesFlag( "\U$pluginName\E_DEBUG" );

# Get plugin preferences, the variable defined by: * Set EXAMPLE = ...
# $barcodeCount is used to assign a unique filename to each barcode in a topic.
$barcodeCount=0;
$pluginInitialized = 0;

# Plugin correctly initialized
TWiki::Func::writeDebug( "- TWiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK" ) if $debug;
Foswiki::Func::writeDebug( "- Foswiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK" ) if $debug;
return 1;
}

Expand Down Expand Up @@ -139,7 +139,7 @@ sub _parse_parameters
return %args;
}

# Return the value for the specified TWiki plugin parameter. If the
# Return the value for the specified Foswiki plugin parameter. If the
# parameter does not exist, then return the specified default value. The
# parameter is deleted from the list of specified parameters allowing the
# code to determine what parameters remain and were not requested.
Expand Down Expand Up @@ -172,7 +172,7 @@ sub _make_filename

# before save, create directories if they don't exist.
# If the top level "pub/$web" directory doesn't exist, create it.
my $dir = TWiki::Func::getPubDir() . "/$web";
my $dir = Foswiki::Func::getPubDir() . "/$web";
if( ! -e "$dir" ) {
umask( 002 );
mkdir( $dir, 0775 );
Expand All @@ -193,7 +193,7 @@ sub commonTagsHandler
{
### my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead

TWiki::Func::writeDebug( "- ${pluginName}::commonTagsHandler( $_[2].$_[1] )" ) if $debug;
Foswiki::Func::writeDebug( "- ${pluginName}::commonTagsHandler( $_[2].$_[1] )" ) if $debug;

# This is the place to define customized tags and variables
# Called by sub handleCommonTags, after %INCLUDE:"..."%
Expand All @@ -204,7 +204,7 @@ sub commonTagsHandler

# =========================
sub _makeBarcode {
TWiki::Func::writeDebug( "- ::makeBarcode " ) if $debug;
Foswiki::Func::writeDebug( "- ::makeBarcode " ) if $debug;
my ($args, $topic, $web) = @_;
if (!$pluginInitialized) {
$pluginInitialized = 1;
Expand All @@ -217,14 +217,14 @@ sub _makeBarcode {
#Parse the args
my %parameters = _parse_parameters($args);

TWiki::Func::writeDebug( "- ${pluginName}::handleBarcode( arg=$args )" ) if $debug;
Foswiki::Func::writeDebug( "- ${pluginName}::handleBarcode( arg=$args )" ) if $debug;

#Create the PNG
my $bc = new Barcode::Code128;

# Get text
my ($text) = _get_parameter("text",$defaultText, \%parameters);
TWiki::Func::writeDebug( "- ${pluginName}::handleBarcode text=$text" ) if $debug;
Foswiki::Func::writeDebug( "- ${pluginName}::handleBarcode text=$text" ) if $debug;
# Get Default Paramters
my ($padding) = _get_parameter("padding",$defaultPadding, \%parameters);
my ($height) = _get_parameter("height",$defaultHeight, \%parameters);
Expand All @@ -249,7 +249,7 @@ sub _makeBarcode {
$text =~ tr|A-Za-z\-|a-zA-Z/|;
}
my ($dir, $filename) = _make_filename("barcode",$barcodeCount++, $topic, $web);
TWiki::Func::writeDebug( "- ${pluginName}::handleBarcode file=$dir $filename" ) if $debug;
Foswiki::Func::writeDebug( "- ${pluginName}::handleBarcode file=$dir $filename" ) if $debug;

my $bc_png;
eval {$bc_png=$bc->png($text)} || return _make_error $@;
Expand Down
8 changes: 4 additions & 4 deletions lib/Foswiki/Plugins/BarcodePlugin/MANIFEST
@@ -1,4 +1,4 @@
data/TWiki/BarcodePlugin.txt NEW
lib/TWiki/Plugins/BarcodePlugin.pm NEW
pub/TWiki/BarcodePlugin/example_0.png NEW
pub/TWiki/BarcodePlugin/example_1.png NEW
data/Foswiki/BarcodePlugin.txt NEW
lib/Foswiki/Plugins/BarcodePlugin.pm NEW
pub/Foswiki/BarcodePlugin/example_0.png NEW
pub/Foswiki/BarcodePlugin/example_1.png NEW
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/BarcodePlugin/build.pl
Expand Up @@ -8,10 +8,10 @@ BEGIN
}
}

use TWiki::Contrib::Build;
use Foswiki::Contrib::Build;

# Create the build object
$build = new TWiki::Contrib::Build( 'BarcodePlugin' );
$build = new Foswiki::Contrib::Build( 'BarcodePlugin' );

# Build the target on the command line, or the default target
$build->build($build->{target});
Expand Down

0 comments on commit e0ebfd4

Please sign in to comment.