[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/barcodes label-item-search.pl label-manage... [dev_week]
From: |
Mason James |
Subject: |
[Koha-cvs] koha/barcodes label-item-search.pl label-manage... [dev_week] |
Date: |
Mon, 02 Oct 2006 22:01:39 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Mason James <sushi> 06/10/02 22:01:39
Modified files:
barcodes : label-item-search.pl label-manager.pl
label-print-pdf.pl
Added files:
barcodes : 1 @! create_all_labels_tables.sql
dump.all.labels.tables.sh
label-create-template.pl label-edit-template.pl
label-home.pl label-print-opus-pdf.pl
label-save-template.pl label-select-pdf.pl
label-templates.pl ~
Log message:
commiting spine-labels II code for joshua.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-item-search.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.1.2.2&r2=1.1.2.1.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-manager.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.1.2.1&r2=1.1.2.1.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-print-pdf.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.2.2.1&r2=1.1.2.2.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/1?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/%64%33?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/create_all_labels_tables.sql?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/dump.all.labels.tables.sh?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-create-template.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-edit-template.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-home.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.3.4.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-print-opus-pdf.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.2.4.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-save-template.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-select-pdf.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/label-templates.pl?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/barcodes/%126?cvsroot=koha&only_with_tag=dev_week&rev=1.1.2.1
Patches:
Index: label-item-search.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/label-item-search.pl,v
retrieving revision 1.1.2.1.2.2
retrieving revision 1.1.2.1.2.3
diff -u -b -r1.1.2.1.2.2 -r1.1.2.1.2.3
--- label-item-search.pl 27 Jul 2006 18:13:03 -0000 1.1.2.1.2.2
+++ label-item-search.pl 2 Oct 2006 22:01:39 -0000 1.1.2.1.2.3
@@ -31,6 +31,7 @@
use C4::Interface::CGI::Output;
use C4::Biblio;
use C4::Acquisition;
+use C4::SearchMarc;
use C4::Koha; # XXX subfield_is_koha_internal_p
# Creates a scrolling list with the associated default value.
Index: label-manager.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/label-manager.pl,v
retrieving revision 1.1.2.1.2.1
retrieving revision 1.1.2.1.2.2
diff -u -b -r1.1.2.1.2.1 -r1.1.2.1.2.2
--- label-manager.pl 27 Jul 2006 18:13:03 -0000 1.1.2.1.2.1
+++ label-manager.pl 2 Oct 2006 22:01:39 -0000 1.1.2.1.2.2
@@ -3,6 +3,7 @@
use strict;
use CGI;
use C4::Auth;
+use C4::Labels;
use C4::Output;
use C4::Interface::CGI::Output;
use HTML::Template;
@@ -21,14 +22,15 @@
my $itemcallnumber = $query->param('itemcallnumber');
my $subclass = $query->param('subclass');
my $author = $query->param('author');
-my $papertype = $query->param('papertype');
+my $tmpl_id = $query->param('tmpl_id');
my $itemnumber = $query->param('itemnumber');
my $summary = $query->param('summary');
-my $startrow = $query->param('startrow');
+my $startlabel = $query->param('startlabel');
my $printingtype = $query->param('printingtype');
my $guidebox = $query->param('guidebox');
+my $fontsize = $query->param('fontsize');
-warn $printingtype;
+warn "ID =$tmpl_id";
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
@@ -42,23 +44,12 @@
);
if ( $op eq 'save_conf' ) {
- my $query2 = "DELETE FROM labels_conf";
- my $sth2 = $dbh->prepare($query2);
- $sth2->execute();
- $sth2->finish;
- my $query2 = "INSERT INTO labels_conf
- ( barcodetype, title, isbn, itemtype, barcode,
- dewey, class, subclass, itemcallnumber, author,
papertype, printingtype,
- guidebox, startrow)
- values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
- my $sth2 = $dbh->prepare($query2);
- $sth2->execute(
+ SaveConf(
$barcodetype, $title, $isbn, $itemtype,
$bcn, $dcn, $classif, $subclass,
- $itemcallnumber, $author, $papertype,$printingtype,
- $guidebox, $startrow
+ $itemcallnumber, $author, $tmpl_id ,$printingtype,
+ $guidebox, $startlabel
);
- $sth2->finish;
}
elsif ( $op eq 'add' ) {
@@ -118,7 +109,6 @@
# this script can be run from the side nav, and is not passed a value for
$startrow
# so lets get it from the DB
-if ( !$startrow ) {
my $dbh = C4::Context->dbh;
my $query2 = "SELECT * FROM labels_conf LIMIT 1";
@@ -126,24 +116,22 @@
$sth->execute();
my $data = $sth->fetchrow_hashref;
- $startrow = $data->{'startrow'};
$sth->finish;
-}
#calc-ing number of sheets
-my $number_of_results = scalar @resultsloop;
-my $sheets_needed = ( ( --$number_of_results + $startrow ) / 8 );
-$sheets_needed = ceil($sheets_needed); # rounding up int's
-
-my $tot_labels = ( $sheets_needed * 8 );
-my $start_results = ( $number_of_results + $startrow );
-my $labels_remaining = ( $tot_labels - $start_results );
+#my $number_of_results = scalar @resultsloop;
+#my $sheets_needed = ( ( --$number_of_results + $startrow ) / 8 );
+#$sheets_needed = ceil($sheets_needed); # rounding up int's
+
+#my $tot_labels = ( $sheets_needed * 8 );
+#my $start_results = ( $number_of_results + $startrow );
+#my $labels_remaining = ( $tot_labels - $start_results );
$template->param(
resultsloop => address@hidden,
- startrow => $startrow,
- sheets => $sheets_needed,
- labels_remaining => $labels_remaining,
+ # startrow => $startrow,
+ # sheets => $sheets_needed,
+ # labels_remaining => $labels_remaining,
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
Index: label-print-pdf.pl
===================================================================
RCS file: /sources/koha/koha/barcodes/label-print-pdf.pl,v
retrieving revision 1.1.2.2.2.1
retrieving revision 1.1.2.2.2.2
diff -u -b -r1.1.2.2.2.1 -r1.1.2.2.2.2
--- label-print-pdf.pl 27 Jul 2006 18:13:03 -0000 1.1.2.2.2.1
+++ label-print-pdf.pl 2 Oct 2006 22:01:39 -0000 1.1.2.2.2.2
@@ -11,48 +11,77 @@
# the reason for this goofyness, it that i couldnt find a single perl package
that handled both barcodes and decent text placement.
-#use lib '/usr/local/opus-import/intranet/modules';
-#use C4::Context("/etc/koha-opus-import.conf");
+#use lib '/usr/local/hlt/intranet/modules';
+#use C4::Context("/etc/koha-hlt.conf");
use strict;
use CGI;
use C4::Labels;
use C4::Auth;
-use C4::Bull;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Context;
use HTML::Template;
use PDF::Reuse;
use PDF::Reuse::Barcode;
-use PDF::Report;
use POSIX;
+use C4::Labels;
+use Acme::Comment;
+
+use Data::Dumper;
-#use Data::Dumper;
-#use Acme::Comment;
my $htdocs_path = C4::Context->config('intrahtdocs');
my $cgi = new CGI;
my $spine_text = "";
# get the printing settings
+my $template = GetActiveLabelTemplate();
my $conf_data = get_label_options();
my @resultsloop = get_label_items();
my $barcodetype = $conf_data->{'barcodetype'};
my $printingtype = $conf_data->{'printingtype'};
my $guidebox = $conf_data->{'guidebox'};
-my $startrow = $conf_data->{'startrow'};
+my $start_label = $conf_data->{'startlabel'};
+my $fontsize = $template->{'fontsize'};
+my $units = $template->{'units'};
-# if none selected, then choose 'both'
-if ( !$printingtype ) {
- $printingtype = 'both';
-}
+warn "UNITS $units";
+warn "fontsize = $fontsize";
+warn Dumper $template;
+
+my $unitvalue = GetUnitsValue($units);
+warn $unitvalue;
+warn $units;
+
+
+my $tmpl_code = $template->{'tmpl_code'};
+my $tmpl_desc = $template->{'tmpl_desc'};
+
+my $page_height = ($template->{'page_height'} * $unitvalue );
+my $page_width = ($template->{'page_width'} * $unitvalue );
+my $label_height = ($template->{'label_height'} * $unitvalue );
+my $label_width = ($template->{'label_width'} * $unitvalue );
+my $spine_width = ($template->{'label_width'} * $unitvalue );
+my $circ_width = ($template->{'label_width'} * $unitvalue );
+my $top_margin = ($template->{'topmargin'} * $unitvalue );
+my $left_margin = ($template->{'leftmargin'} * $unitvalue );
+my $colspace = ($template->{'colgap'} * $unitvalue );
+my $rowspace = ($template->{'rowgap'} * $unitvalue );
+
+my $label_cols = $template->{'cols'};
+my $label_rows = $template->{'rows'};
-# dimensions of gaylord paper
+my $text_wrap_cols = GetTextWrapCols($fontsize, $label_width);
+
+
+warn $label_cols, $label_rows;
+
+# set the paper size
my $lowerLeftX = 0;
my $lowerLeftY = 0;
-my $upperRightX = 612;
-my $upperRightY = 792;
+my $upperRightX = $page_width;
+my $upperRightY = $page_height;
# setting up the pdf doc
#remove the file before write, for testing
@@ -60,172 +89,114 @@
prFile("$htdocs_path/barcodes/new.pdf");
prLogDir("$htdocs_path/barcodes");
prMbox( $lowerLeftX, $lowerLeftY, $upperRightX, $upperRightY );
-prFont('Times-Roman'); # Just setting a font
-prFontSize(10);
-my $margin = 36;
-my $label_height = 90;
-my $spine_width = 72;
-my $circ_width = 207;
-my $colspace = 27;
-my $x_pos_spine = 36;
-my $x_pos_circ1 = 135;
-my $x_pos_circ2 = 369;
-my $pageheight = 792;
+# later feature, change the font-type and size?
+prFont('C'); # Just setting a font
+prFontSize($fontsize);
-#warn "STARTROW = $startrow\n";
+my $margin = $top_margin;
+my $left_text_margin = 3;
-my $y_pos_initial = ( ( $pageheight - $margin ) - $label_height );
-my $y_pos_initial_startrow =
- ( ( $pageheight - $margin ) - ( $label_height * $startrow ) );
-my $y_pos = $y_pos_initial_startrow;
-
-#warn "Y POS INITAL : $y_pos_initial";
-#warn "Y POS : $y_pos";
-#warn "Y START ROW = $y_pos_initial_startrow";
-my $rowspace = 36;
-my $page_break_count = $startrow;
-my $codetype = 'Code39';
+my $str;
-# do border---------------
-my $str = "q\n"; # save the graphic state
-$str .= "4 w\n"; # border color red
-$str .= "0.0 0.0 0.0 RG\n"; # border color red
-$str .= "1 1 1 rg\n"; # fill color blue
-$str .= "0 0 612 792 re\n"; # a rectangle
-$str .= "B\n"; # fill (and a little more)
-$str .= "Q\n"; # save the graphic state
+#warn "STARTROW = $startrow\n";
-# do border---------------
+#my $page_break_count = $startrow;
+my $codetype = 'Code39';
+
+#do page border
+#drawbox( $lowerLeftX, $lowerLeftY, $upperRightX, $upperRightY );
-prAdd($str);
my $item;
+my ( $i, $i2 ); # loop counters
-# for loop
-my $i2 = 1;
-foreach $item (@resultsloop) {
- if ( $i2 == 1 && $guidebox == 1 ) {
- draw_boundaries(
- $x_pos_spine, $x_pos_circ1, $x_pos_circ2, $y_pos,
- $spine_width, $label_height, $circ_width
- );
- }
+# big row loop
- #warn Dumper $item->{'itemtype'};
- #warn "COUNT = $cnt1";
+warn " $lowerLeftX, $lowerLeftY, $upperRightX, $upperRightY";
+warn "$label_rows, $label_cols\n";
+warn "$label_height, $label_width\n";
+warn "$page_height, $page_width\n";
- #building up spine text
- my $line = 75;
- my $line_spacer = 16;
-
- #warn
- "COUNT=$i2, PBREAKCNT=$page_break_count, X,Y POS x=$x_pos_circ1, y=$y_pos";
- if ( $printingtype eq 'barcode' || $printingtype eq 'both' ) {
- build_circ_barcode( $x_pos_circ1, $y_pos, $item->{'barcode'},
- $conf_data->{'barcodetype'}, \$item );
- build_circ_barcode( $x_pos_circ2, $y_pos, $item->{'barcode'},
- $conf_data->{'barcodetype'}, \$item );
- }
-# added for xpdf compat. doesnt use type3 fonts., but increases filesize from
20k to 200k
-# i think its embedding extra fonts in the pdf file.
-# mode => 'graphic',
+my ($rowcount, $colcount, $x_pos, $y_pos, $rowtemp, $coltemp);
+
+ if ($start_label eq 1) {
+ $rowcount = 1;
+ $colcount = 1;
+ $x_pos = $left_margin;
+ $y_pos = ( $page_height - $top_margin - $label_height );
+}
+
+
+else {
+ $rowcount = ceil($start_label / $label_cols);
+ $colcount = ($start_label - (($rowcount-1)*$label_cols));
+
+ $x_pos = $left_margin + ($label_width*($colcount-1))+
+ ($colspace * ($colcount - 1));
+
+ $y_pos = $page_height -
+ $top_margin - ($label_height*$rowcount)-
+ ($rowspace * ($rowcount-1));
+
- $y_pos = ( $y_pos - $label_height );
- # the gaylord labels have 8 rows per sheet, this pagebreaks after 8 rows
- if ( $page_break_count == 8 ) {
- prPage();
- $page_break_count = 0;
- $i2 = 0;
- $y_pos = $y_pos_initial;
- }
- $page_break_count++;
- $i2++;
}
-############## end of loop
-prEnd();
-#----------------------------------------------------------------------------
-# this second section of the script uses a diff perl class than the previous
section
-# it opens the 'new.pdf' file that the previous section has just saved
-
-if ( $printingtype eq 'spine' || $printingtype eq 'both' ) {
- my $font = 'Courier';
- my $text_height = 90;
- my $file = "$htdocs_path/barcodes/new.pdf";
- my $pdf = new PDF::Report( File => $file );
-
- #$pdf->newpage($nopage);
- my $pagenumber = 1;
- $pdf->openpage($pagenumber);
- my ( $pagewidth, $pageheight ) = $pdf->getPageDimensions();
-
- #warn "PAGE DIM = $pagewidth, $pageheight";
- #warn "Y START ROW = $y_pos_initial_startrow";
- $pdf->setAlign('left');
- $pdf->setFont($font);
- $pdf->setSize(9);
- my $fontname = $pdf->getFont();
- my $fontsize = $pdf->getSize();
- my $page_break_count = $startrow;
-
- #warn "INIT PAGEBREAK COUNT = $page_break_count";
- #warn "INIT VPOS = $vPos, hPos = $hPos";
- my $vPosSpacer = 10;
- my $start_text_pos = 39; # ( 36 - 5 = 31 ) 5 is an inside border for
text.
- my $spine_label_text_with = 67;
- my $y_pos = ( $y_pos_initial_startrow + 90 );
-
- #warn "Y POS = $y_pos";
- foreach $item (@resultsloop) {
-
- # add your printable fields manually in here
- my @fields =
- qw (dewey isbn classification itemtype subclass itemcallnumber);
- my $vPos = $y_pos;
- my $hPos = 36;
- foreach my $field (@fields) {
-
- # if the display option for this field is selected in the DB,
- # and the item record has some values for this field, display it.
- if ( $conf_data->{"$field"} && $item->{"$field"} ) {
-
- # chop the string up into 12 char's per line
- $str = $item->{"$field"};
- my $strlen = length($str);
- my $num_lines = ceil( $strlen / 12 );
- my $start_pos = 0;
- my $len = 12;
-
- # then loop for each string line
- for ( 1 .. $num_lines ) {
- $pdf->setAddTextPos( $hPos, $vPos - 10 );
- my $chop_str = substr( $str, $start_pos, $len );
- my ( $h, $v ) = $pdf->getAddTextPos();
-
- # using '1000' width, so that addText wont use it's
- # own internal wordwrap, (as it doesnt work so well)
- $pdf->addText( $chop_str, 10, 1000, 90 );
+warn "ROW COL $rowcount, $colcount";
+
+foreach $item (@resultsloop) {
+
- $start_pos = $start_pos + $len;
- $vPos = $vPos - 10;
+ warn "-----------------";
+ if ($guidebox){
+ drawbox( $x_pos, $y_pos, $label_width, $label_height);
}
- } # if field is valid
- } #foreach feild
- $y_pos = ( $y_pos - $label_height );
-
- if ( $page_break_count == 8 ) {
- $pagenumber++;
- $pdf->openpage($pagenumber);
- $page_break_count = 0;
- $i2 = 0;
- $y_pos = ( $y_pos_initial + 90 );
- } # end if
- $page_break_count++;
- $i2++;
- } # end of foreach result loop
- $pdf->saveAs($file);
-}
+ DrawSpineText( $y_pos,$label_height, $fontsize,
+ $x_pos, $left_text_margin, $text_wrap_cols,
+ \$item, \$conf_data);
+ if ( $colcount lt $label_cols ) {
+ warn "new col";
+ $x_pos = ( $x_pos + $label_width + $colspace );
+ $colcount++;
+ }
+ else {
+ $x_pos = $left_margin;
+ if ( $rowcount eq $label_rows ) {
+ warn "new page";
+ prPage();
+ $y_pos = ( $page_height - $top_margin - $label_height );
+ $rowcount = 1;
+ }
+ else {
+ warn "new row";
+ $y_pos = ( $y_pos - $rowspace - $label_height );
+ $rowcount++;
+ }
+ $colcount = 1;
+ }
+
+
+
+
+} # end for item loop
+prEnd();
+
print $cgi->redirect("/intranet-tmpl/barcodes/new.pdf");
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: 1
===================================================================
RCS file: 1
diff -N 1
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ 1 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Context;
+use C4::Output;
+use C4::Labels;
+use C4::Interface::CGI::Output;
+use HTML::Template;
+use POSIX;
+
+use Data::Dumper;
+
+my $dbh = C4::Context->dbh;
+my $query = new CGI;
+my $op = $query->param('op');
+my $tmpl_code = $query->param('tmpl_code');
+
+if (!$op) {
+ $op = 'display';
+}
+
+
+my $width = $query->param('width');
+my $height = $query->param('height');
+my $topmargin = $query->param('topmargin');
+my $leftmargin = $query->param('leftmargin');
+my $columns = $query->param('columns');
+my $rows = $query->param('rows');
+my $colgap = $query->param('colgap');
+my $rowgap = $query->param('rowgap');
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "barcodes/label-templates.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 1,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+);
+
+my @resultsloop;
+
+
+
+if ( $op eq 'display' ) {
+ @resultsloop=GetAllLabelTemplates();
+}
+
+elsif ( $op eq 'delete' ) {
+ DeleteTemplate($tmpl_code);
+ @resultsloop=GetAllLabelTemplates();
+}
+
+
+elsif ( $op eq 'save' ) {
+warn "SSSSSSSSSSSSSSSSSSSSSSSSSAVING!!!!!!!!!!!!!!!!!!";
+ SaveTemplate($tmpl_code);
+ @resultsloop=GetAllLabelTemplates();
+}
+
+$template->param(
+ resultsloop => address@hidden,
+
+ intranetcolorstylesheet =>
+ C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;
Index: @!
===================================================================
RCS file: @!
diff -N @!
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ @! 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1,9 @@
+typo.
+CVS: ----------------------------------------------------------------------
+CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
+CVS:
+CVS: Committing in .
+CVS:
+CVS: Modified Files:
+CVS: label-manager.pl
+CVS: ----------------------------------------------------------------------
Index: create_all_labels_tables.sql
===================================================================
RCS file: create_all_labels_tables.sql
diff -N create_all_labels_tables.sql
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ create_all_labels_tables.sql 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1,106 @@
+-- MySQL dump 9.11
+--
+-- Host: localhost Database: hlt
+-- ------------------------------------------------------
+-- Server version 4.0.24_Debian-10sarge1-log
+
+--
+-- Table structure for table `labels_conf`
+--
+
+DROP TABLE IF EXISTS `labels_conf`;
+CREATE TABLE `labels_conf` (
+ `id` int(4) NOT NULL auto_increment,
+ `barcodetype` char(100) default '',
+ `title` tinyint(1) default '0',
+ `isbn` tinyint(1) default '0',
+ `itemtype` tinyint(1) default '0',
+ `barcode` tinyint(1) default '0',
+ `dewey` tinyint(1) default '0',
+ `class` tinyint(1) default '0',
+ `subclass` tinyint(1) default '0',
+ `itemcallnumber` tinyint(1) default '0',
+ `author` tinyint(1) default '0',
+ `startlabel` int(2) default NULL,
+ `printingtype` char(10) default NULL,
+ `guidebox` tinyint(1) default NULL,
+ `fonttype` char(10) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+--
+-- Dumping data for table `labels_conf`
+--
+
+INSERT INTO `labels_conf` VALUES
(7,'Code39',NULL,1,1,NULL,1,1,1,1,NULL,1,'spine',1,NULL);
+
+--
+-- Table structure for table `labels_templates`
+--
+
+DROP TABLE IF EXISTS `labels_templates`;
+CREATE TABLE `labels_templates` (
+ `tmpl_id` int(4) NOT NULL auto_increment,
+ `tmpl_code` char(100) default '',
+ `tmpl_desc` char(100) default '',
+ `page_width` float default '0',
+ `page_height` float default '0',
+ `label_width` float default '0',
+ `label_height` float default '0',
+ `topmargin` float default '0',
+ `leftmargin` float default '0',
+ `cols` int(2) default '0',
+ `rows` int(2) default '0',
+ `colgap` float default '0',
+ `rowgap` float default '0',
+ `active` int(1) default NULL,
+ `units` char(20) default 'PX',
+ `fontsize` int(4) default NULL,
+ PRIMARY KEY (`tmpl_id`)
+) TYPE=MyISAM;
+
+--
+-- Dumping data for table `labels_templates`
+--
+
+INSERT INTO `labels_templates` VALUES (22,'2 x2 inch test','2 x2 inch
test',2.78,2.78,1,1,0.2,0.2,2,2,0.2,0.2,NULL,'INCH',4);
+INSERT INTO `labels_templates` VALUES (20,'3 x 4 mm','3 x 4
mm',120,67,30,15,5,5,3,3,5,5,1,'MM',4);
+INSERT INTO `labels_templates` VALUES (21,'3 x 3
inch','',4,2,2,2,1,1,2,2,1,1,NULL,'INCH',4);
+INSERT INTO `labels_templates` VALUES (10,'2 x 5
PTS','test1',250,320,100,50,10,10,2,5,10,10,NULL,'POINT',6);
+INSERT INTO `labels_templates` VALUES (9,'SIMPLE2','easy test
def2.',200,200,50,50,25,25,2,2,25,25,NULL,'POINT',9);
+INSERT INTO `labels_templates` VALUES (19,'3 x 3 test pts','3 x 3 test
pts',340,190,100,50,10,10,3,3,10,10,NULL,'POINT',4);
+INSERT INTO `labels_templates` VALUES (23,'2 x 2 mm test','2 x 2 mm
test',70.6,70.6,30,30,2,2,2,2,2,2,NULL,'MM',4);
+INSERT INTO `labels_templates` VALUES (24,'2 x 2 cm test','2 x 2 cm
test',7.6,7.6,2,2,1,1,2,2,1,1,NULL,'CM',4);
+
+--
+-- Table structure for table `labels`
+--
+
+DROP TABLE IF EXISTS `labels`;
+CREATE TABLE `labels` (
+ `labelid` int(11) NOT NULL auto_increment,
+ `itemnumber` varchar(100) NOT NULL default '',
+ `timestamp` timestamp(14) NOT NULL,
+ PRIMARY KEY (`labelid`)
+) TYPE=MyISAM;
+
+--
+-- Dumping data for table `labels`
+--
+
+INSERT INTO `labels` VALUES (1,'132945',20060911152413);
+INSERT INTO `labels` VALUES (2,'95011',20060911152415);
+INSERT INTO `labels` VALUES (3,'76026',20060911152417);
+INSERT INTO `labels` VALUES (4,'94783',20060911152418);
+INSERT INTO `labels` VALUES (5,'28420',20060911152421);
+INSERT INTO `labels` VALUES (6,'112626',20060918130024);
+INSERT INTO `labels` VALUES (7,'46806',20060918130026);
+INSERT INTO `labels` VALUES (8,'19557',20060918130029);
+INSERT INTO `labels` VALUES (9,'138750',20060918130031);
+INSERT INTO `labels` VALUES (10,'122441',20060918130035);
+INSERT INTO `labels` VALUES (11,'96643',20060918130037);
+INSERT INTO `labels` VALUES (12,'107685',20060918130039);
+INSERT INTO `labels` VALUES (13,'149683',20060918130041);
+INSERT INTO `labels` VALUES (14,'143217',20060918130043);
+INSERT INTO `labels` VALUES (15,'149684',20060918130045);
+
Index: dump.all.labels.tables.sh
===================================================================
RCS file: dump.all.labels.tables.sh
diff -N dump.all.labels.tables.sh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dump.all.labels.tables.sh 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1 @@
+mysqldump -uhltadmin -pranjit hlt --add-drop-table labels labels_conf
labels_templates
Index: label-create-template.pl
===================================================================
RCS file: label-create-template.pl
diff -N label-create-template.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ label-create-template.pl 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1,112 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Context;
+use C4::Output;
+use C4::Labels;
+use C4::Interface::CGI::Output;
+use HTML::Template;
+use POSIX;
+
+use Data::Dumper;
+
+my $dbh = C4::Context->dbh;
+my $query = new CGI;
+
+my $tmpl_code = $query->param('tmpl_code');
+my $tmpl_desc = $query->param('tmpl_desc');
+my $page_height = $query->param('page_height');
+my $page_width = $query->param('page_width');
+my $label_height = $query->param('label_height');
+my $label_width = $query->param('label_width');
+my $topmargin = $query->param('topmargin');
+my $leftmargin = $query->param('leftmargin');
+my $cols = $query->param('cols');
+my $rows = $query->param('rows');
+my $colgap = $query->param('colgap');
+my $rowgap = $query->param('rowgap');
+my $active = $query->param('active');
+my $units = $query->param('units');
+my $fontsize = $query->param('fontsize');
+
+$active = 1 if ($active eq 'on');
+
+my $op = $query->param('op');
+my @resultsloop;
+
+my ( $template, $loggedinuser, $cookie );
+
+if ($op eq 'blank') {
+
+my @units = (
+ {unit => 'INCH', desc => 'Inches' },
+ {unit => 'CM', desc => 'Centimeters' },
+ {unit => 'MM', desc => 'Millimeters' },
+ {unit => 'POINT', desc => 'Postscript Points' },
+);
+
+
+( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "barcodes/label-create-template.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 1,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+ );
+
+ $template->param(
+ units => address@hidden,
+ intranetcolorstylesheet =>
+ C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+);
+
+}
+
+
+
+elsif ($op eq 'create') {
+
+
+( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "barcodes/label-templates.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 1,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+ );
+
+
+ CreateTemplate(
+
+ $tmpl_code, $tmpl_desc, $page_width,
+ $page_height, $label_width, $label_height, $topmargin,
+ $leftmargin, $cols, $rows, $colgap,
+ $rowgap, $active, $fontsize, $units
+
+ );
+
+
+ @resultsloop=GetAllLabelTemplates();
+
+$template->param(
+ resultsloop => address@hidden,
+
+ intranetcolorstylesheet =>
+ C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+);
+
+
+}
+output_html_with_http_headers $query, $cookie, $template->output;
Index: label-edit-template.pl
===================================================================
RCS file: label-edit-template.pl
diff -N label-edit-template.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ label-edit-template.pl 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1,82 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Context;
+use C4::Output;
+use C4::Labels;
+use C4::Interface::CGI::Output;
+use HTML::Template;
+use POSIX;
+
+use Data::Dumper;
+
+my $dbh = C4::Context->dbh;
+my $query = new CGI;
+my $tmpl_code = $query->param('tmpl_code');
+
+my $width = $query->param('width');
+my $height = $query->param('height');
+my $topmargin = $query->param('topmargin');
+my $leftmargin = $query->param('leftmargin');
+my $columns = $query->param('columns');
+my $rows = $query->param('rows');
+my $colgap = $query->param('colgap');
+my $rowgap = $query->param('rowgap');
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "barcodes/label-edit-template.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 1,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+);
+
+my $tmpl = GetSingleLabelTemplate($tmpl_code);
+warn Dumper $tmpl;
+
+my @units = (
+ {unit => 'INCH', desc => 'Inches' },
+ {unit => 'CM', desc => 'Centimeters' },
+ {unit => 'MM', desc => 'Millimeters' },
+ {unit => 'POINT', desc => 'Postscript Points' },
+);
+
+foreach my $unit (@units) {
+ if ( $unit->{'unit'} eq $tmpl->{'units'} ) {
+ $unit->{'selected'} = 1;
+ }
+}
+warn Dumper @units;
+
+$template->param(
+
+ units => address@hidden,
+
+ tmpl_id => $tmpl->{'tmpl_id'},
+ tmpl_code => $tmpl->{'tmpl_code'},
+ tmpl_desc => $tmpl->{'tmpl_desc'},
+ page_width => $tmpl->{'page_width'},
+ page_height => $tmpl->{'page_height'},
+ label_width => $tmpl->{'label_width'},
+ label_height => $tmpl->{'label_height'},
+ topmargin => $tmpl->{'topmargin'},
+ leftmargin => $tmpl->{'leftmargin'},
+ cols => $tmpl->{'cols'},
+ rows => $tmpl->{'rows'},
+ colgap => $tmpl->{'colgap'},
+ rowgap => $tmpl->{'rowgap'},
+ fontsize => $tmpl->{'fontsize'},
+ active => $tmpl->{'active'},
+
+ intranetcolorstylesheet =>
+ C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;
Index: label-home.pl
===================================================================
RCS file: label-home.pl
diff -N label-home.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ label-home.pl 2 Oct 2006 22:01:39 -0000 1.3.4.1
@@ -0,0 +1,71 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Output;
+use C4::Labels;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use HTML::Template;
+
+use Data::Dumper;
+
+my $query = new CGI;
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "barcodes/label-home.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+);
+
+my $data = get_label_options();
+
+my $active_template =GetActiveLabelTemplate();
+my @label_templates = GetAllLabelTemplates();
+
+warn Dumper @label_templates;
+
+
+$template->param( guidebox => 1 ) if ( $data->{'guidebox'} );
+
+$data->{'printingtype'} = 'both' if ( !$data->{'printingtype'} );
+$template->param( "printingtype_$data->{'printingtype'}" => 1 );
+$template->param( "papertype_$data->{'papertype'}" => 1 );
+
+$template->param( "$data->{'barcodetype'}_checked" => 1 );
+
+$template->param( "startrow" . $data->{'startrow'} . "_checked" => 1 );
+$template->param(
+ itemtype => $data->{'itemtype'},
+ active_template => $data->{'active_template'},
+ label_templates => address@hidden,
+
+ papertype => $data->{'papertype'},
+ author => $data->{'author'},
+ barcode => $data->{'barcode'},
+ id => $data->{'id'},
+ barcodetype => $data->{'barcodetype'},
+ title => $data->{'title'},
+ isbn => $data->{'isbn'},
+ dewey => $data->{'dewey'},
+ class => $data->{'class'},
+ subclass => $data->{'subclass'},
+ itemcallnumber => $data->{'itemcallnumber'},
+ startlabel => $data->{'startlabel'},
+ fontsize => $active_template->{'fontsize'},
+
+
+ intranetcolorstylesheet =>
+ C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+);
+
+
+
+output_html_with_http_headers $query, $cookie, $template->output;
Index: label-print-opus-pdf.pl
===================================================================
RCS file: label-print-opus-pdf.pl
diff -N label-print-opus-pdf.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ label-print-opus-pdf.pl 2 Oct 2006 22:01:39 -0000 1.2.4.1
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+
+#use lib '/usr/local/opus-dev/intranet/modules';
+#use C4::Context("/etc/koha-opus-dev.conf");
+
+use strict;
+use CGI;
+use C4::Labels;
+use C4::Auth;
+use C4::Bull;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use PDF::Reuse;
+use PDF::Reuse::Barcode;
+use PDF::Report;
+use PDF::Create;
+use PDF::Labels;
+use Acme::Comment;
+use Data::Dumper;
+warn "-------";
+
+my $htdocs_path = C4::Context->config('intrahtdocs');
+my $cgi = new CGI;
+
+my $pdf = new PDF::Labels(
+ $PDF::Labels::PageFormats[1],
+ filename => "$htdocs_path/barcodes/opus.pdf",
+ Author => 'PDF Labelmaker',
+ 'PageMode' => 'UseOutlines',
+ Title => 'My Labels'
+);
+
+warn "$htdocs_path/barcodes/opus.pdf";
+
+my @resultsloop = get_label_items();
+
+#warn Dumper @resultsloop;
+warn Dumper $pdf->{'filename'};
+
+$pdf->setlabel(0); # Start with label 5 on first page
+
+foreach my $result (@resultsloop) {
+ warn Dumper $result;
+ $pdf->label( $result->{'itemtype'}, $result->{'number'}, 'LAK',
+ $result->{'barcode'} );
+ $pdf->label( $result->{'itemtype'}, $result->{'dewey'}, 'LAK',
+ $result->{'barcode'} );
+
+}
+warn "HERE";
+$pdf->close();
+
+#--------------------------------------------------
+
+use PDF::Reuse;
+prFile("$htdocs_path/barcodes/opus1.pdf");
+prDoc("$htdocs_path/barcodes/opus.pdf");
+prEnd();
+
+print $cgi->redirect("/intranet-tmpl/barcodes/opus1.pdf");
+
Index: label-save-template.pl
===================================================================
RCS file: label-save-template.pl
diff -N label-save-template.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ label-save-template.pl 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Context;
+use C4::Output;
+use C4::Labels;
+use C4::Interface::CGI::Output;
+use HTML::Template;
+use POSIX;
+
+use Data::Dumper;
+
+my $dbh = C4::Context->dbh;
+my $query = new CGI;
+
+my $tmpl_id = $query->param('tmpl_id');
+my $tmpl_code = $query->param('tmpl_code');
+my $tmpl_desc = $query->param('tmpl_desc');
+my $page_height = $query->param('page_height');
+my $page_width = $query->param('page_width');
+my $label_height = $query->param('label_height');
+my $label_width = $query->param('label_width');
+my $topmargin = $query->param('topmargin');
+my $leftmargin = $query->param('leftmargin');
+my $cols = $query->param('cols');
+my $rows = $query->param('rows');
+my $colgap = $query->param('colgap');
+my $rowgap = $query->param('rowgap');
+my $fontsize = $query->param('fontsize');
+my $units = $query->param('units');
+my $active = $query->param('active');
+
+warn "ACTIVE = $active $fontsize";
+$active = 1 if ($active == 'on');
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "barcodes/label-templates.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 1,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+);
+
+my @resultsloop;
+
+SaveTemplate(
+
+ $tmpl_id, $tmpl_code, $tmpl_desc, $page_width,
+ $page_height, $label_width, $label_height, $topmargin,
+ $leftmargin, $cols, $rows, $colgap,
+ $rowgap, $active, $fontsize, $units
+
+);
address@hidden = GetAllLabelTemplates();
+
+$template->param(
+ resultsloop => address@hidden,
+
+ intranetcolorstylesheet =>
+ C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;
Index: label-select-pdf.pl
===================================================================
RCS file: label-select-pdf.pl
diff -N label-select-pdf.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ label-select-pdf.pl 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+use lib '/usr/local/opus-dev/intranet/modules';
+use C4::Context("/etc/koha-opus-dev.conf");
+
+use strict;
+use CGI;
+use C4::Labels;
+use C4::Auth;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use HTML::Template;
+
+use Data::Dumper;
+
+
+# get the printing settings
+my $conf_data = get_label_options();
+my $cgi = new CGI;
+
+my $papertype = $conf_data->{'papertype'};
+warn $papertype;
+
+
+if ($papertype eq "Gaylord8511") {
+ warn "GAY";
+ print $cgi->redirect("/cgi-bin/koha/barcodes/label-print-pdf.pl")
+}
+elsif ($papertype eq "OPUS-Dot Matrix") {
+ warn "OPUS labes";
+ print $cgi->redirect("/cgi-bin/koha/barcodes/label-print-opus-pdf.pl")
+}
+
Index: label-templates.pl
===================================================================
RCS file: label-templates.pl
diff -N label-templates.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ label-templates.pl 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Context;
+use C4::Output;
+use C4::Labels;
+use C4::Interface::CGI::Output;
+use HTML::Template;
+use POSIX;
+
+use Data::Dumper;
+
+my $dbh = C4::Context->dbh;
+my $query = new CGI;
+my $op = $query->param('op');
+my $tmpl_code = $query->param('tmpl_code');
+
+if (!$op) {
+ $op = 'display';
+}
+
+
+my $width = $query->param('width');
+my $height = $query->param('height');
+my $topmargin = $query->param('topmargin');
+my $leftmargin = $query->param('leftmargin');
+my $columns = $query->param('columns');
+my $rows = $query->param('rows');
+my $colgap = $query->param('colgap');
+my $rowgap = $query->param('rowgap');
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "barcodes/label-templates.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 1,
+ flagsrequired => { catalogue => 1 },
+ debug => 1,
+ }
+);
+
+my @resultsloop;
+
+
+
+if ( $op eq 'display' ) {
+ @resultsloop=GetAllLabelTemplates();
+}
+
+elsif ( $op eq 'delete' ) {
+ DeleteTemplate($tmpl_code);
+ @resultsloop=GetAllLabelTemplates();
+}
+
+
+elsif ( $op eq 'save' ) {
+warn "SSSSSSSSSSSSSSSSSSSSSSSSSAVING!!!!!!!!!!!!!!!!!!";
+ SaveTemplate($tmpl_code);
+ @resultsloop=GetAllLabelTemplates();
+}
+
+$template->param(
+ resultsloop => address@hidden,
+
+ intranetcolorstylesheet =>
+ C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;
Index: ~
===================================================================
RCS file: ~
diff -N ~
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ~ 2 Oct 2006 22:01:39 -0000 1.1.2.1
@@ -0,0 +1,9 @@
+reverting back ver 1.9
+CVS: ----------------------------------------------------------------------
+CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
+CVS:
+CVS: Committing in .
+CVS:
+CVS: Modified Files:
+CVS: label-manager.pl
+CVS: ----------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/barcodes label-item-search.pl label-manage... [dev_week],
Mason James <=