From 1c0c51c7fcf57de1d18df8f309a27a0f8942031a Mon Sep 17 00:00:00 2001 From: james Date: Tue, 9 Oct 2007 17:42:00 +0000 Subject: [PATCH] Update all Avery templates, add new avery template for 1 1/3" x 4" Fix a register_globals reliance --- admin/reports_mailinglabels.php | 13 ++++++++----- admin/reports_mailinglabels_generator.php | 16 +++++++++------- lpdf.php | 5 +++-- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/admin/reports_mailinglabels.php b/admin/reports_mailinglabels.php index d96f3d6..a049cea 100644 --- a/admin/reports_mailinglabels.php +++ b/admin/reports_mailinglabels.php @@ -38,7 +38,8 @@ function stockChange() document.forms.mailinglabels.yspacer.value=v[3]; document.forms.mailinglabels.xspacer.value=v[4]; document.forms.mailinglabels.fontsize.value=v[5]; - document.forms.mailinglabels.type.value=v[6]; + document.forms.mailinglabels.toppadding.value=v[6]; + document.forms.mailinglabels.type.value=v[7]; } function reportChange() @@ -70,10 +71,11 @@ function reportChange() echo ""; echo ""; @@ -82,6 +84,7 @@ function reportChange() echo ""; echo ""; echo ""; + echo ""; echo "
Label Y-Space:\"
Label X-Space:\"
Font Size:pt
Top Padding:\"
"; echo ""; diff --git a/admin/reports_mailinglabels_generator.php b/admin/reports_mailinglabels_generator.php index 0b3ea51..a594e38 100644 --- a/admin/reports_mailinglabels_generator.php +++ b/admin/reports_mailinglabels_generator.php @@ -32,19 +32,21 @@ if($_GET['report']) $report=$_GET['report']; if($_GET['reportname']) $reportname=$_GET['reportname']; else $reportname=$_GET['report']; if($report) { - if($type=="pdf") + if($_GET['type']=="pdf") { $card_width=4.00; $card_height=2.00; $xspacer=0.125; $yspacer=0.125; $fontsize=10; + $toppadding=0; if($_GET['width']) $card_width=$_GET['width']; if($_GET['height']) $card_height=$_GET['height']; if($_GET['xspacer']) $xspacer=$_GET['xspacer']; if($_GET['yspacer']) $yspacer=$_GET['yspacer']; if($_GET['fontsize']) $fontsize=$_GET['fontsize']; + if($_GET['toppadding']) $toppadding=$_GET['toppadding']; $rep=new lpdf( i18n($config['fairname']), "$reportname Mailing Labels", @@ -53,9 +55,9 @@ if($report) $rep->setPageStyle("labels"); $rep->newPage(8.5,11); - $rep->setLabelDimensions($card_width,$card_height,$xspacer,$yspacer,$fontsize); + $rep->setLabelDimensions($card_width,$card_height,$xspacer,$yspacer,$fontsize,$toppadding); } - else if($type=="csv") { + else if($_GET['type']=="csv") { $rep=new lcsv(i18n("$reportname Mailing Labels")); } @@ -128,7 +130,7 @@ if($report) } - if($type=="csv") + if($_GET['type']=="csv") { $table=array(); $table['header'] = array( @@ -153,18 +155,18 @@ if($report) } else $co="C/O $r->co"; - if($type=="pdf") + if($_GET['type']=="pdf") { $rep->newLabel(); $rep->mailingLabel($r->name,$co,$r->address,$r->city,$r->province,$r->postalcode); } - else if($type=="csv") + else if($_GET['type']=="csv") { $table['data'][]=array($r->name,$co,$r->address,$r->city,$r->province,$r->postalcode); } } - if($type=="csv") + if($_GET['type']=="csv") $rep->addTable($table); $rep->output(); diff --git a/lpdf.php b/lpdf.php index 0582de1..925e6db 100644 --- a/lpdf.php +++ b/lpdf.php @@ -710,15 +710,16 @@ class lpdf $this->page_style=$style; } - function setLabelDimensions($width,$height,$xspacer=0.125,$yspacer=0.125,$fontsize=10) + function setLabelDimensions($width,$height,$xspacer=0.125,$yspacer=0.125,$fontsize=10,$toppadding=0) { $this->label_width=$width; $this->label_height=$height; $this->label_xspacer=$xspacer; $this->label_yspacer=$yspacer; + $this->label_toppadding=$toppadding; $this->labels_per_row=floor($this->page_width/($width+$xspacer)); - $this->labels_per_column=floor($this->page_height/($height+$yspacer)); + $this->labels_per_column=floor(($this->page_height-$toppadding)/($height+$yspacer)); $this->labels_per_page=$this->labels_per_row * $this->labels_per_column; $this->labels_start_xpos=($this->page_width-$this->labels_per_row*$width - $this->label_xspacer*($this->labels_per_row-1))/2;