Update all Avery templates, add new avery template for 1 1/3" x 4"

Fix a register_globals reliance
This commit is contained in:
james 2007-10-09 17:42:00 +00:00
parent f922adb9af
commit 1c0c51c7fc
3 changed files with 20 additions and 14 deletions

View File

@ -38,7 +38,8 @@ function stockChange()
document.forms.mailinglabels.yspacer.value=v[3]; document.forms.mailinglabels.yspacer.value=v[3];
document.forms.mailinglabels.xspacer.value=v[4]; document.forms.mailinglabels.xspacer.value=v[4];
document.forms.mailinglabels.fontsize.value=v[5]; 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() function reportChange()
@ -70,10 +71,11 @@ function reportChange()
echo "<select name=\"stock\" onchange=\"stockChange()\">"; echo "<select name=\"stock\" onchange=\"stockChange()\">";
echo "<option value=\"Custom::::::\">".i18n("Choose label stock")."</option>\n"; echo "<option value=\"Custom::::::\">".i18n("Choose label stock")."</option>\n";
echo "<option value=\"Avery #05163:2:4:0.125:0.125:12:pdf\">Avery #05163 2\"x4\"</option>\n"; echo "<option value=\"Avery #05161:1:4:0.00:0.25:10:0.5:pdf\">Avery #05161 1\"x4\"</option>\n";
echo "<option value=\"Avery #05261:1:4:0.08:0.08:10:pdf\">Avery #05261 1\"x4\"</option>\n"; echo "<option value=\"Avery #05162:1.3333:4:0.00:0.25:10:0.75:pdf\">Avery #05162 1 1/3\"x4\"</option>\n";
echo "<option value=\"Custom::::::pdf\">Custom</option>\n"; echo "<option value=\"Avery #05163:2:4:0.0:0.25:12:0:pdf\">Avery #05163 2\"x4\"</option>\n";
echo "<option value=\"CSV::::::csv\">CSV (Plain Text)</option>\n"; echo "<option value=\"Custom:::::::pdf\">Custom</option>\n";
echo "<option value=\"CSV:::::::csv\">CSV (Plain Text)</option>\n";
echo "</select>"; echo "</select>";
echo "<table>"; echo "<table>";
@ -82,6 +84,7 @@ function reportChange()
echo "<tr><td>Label Y-Space:</td><td><input size=\"5\" type=\"text\" name=\"yspacer\" id=\"yspacer\">\"</td></tr>"; echo "<tr><td>Label Y-Space:</td><td><input size=\"5\" type=\"text\" name=\"yspacer\" id=\"yspacer\">\"</td></tr>";
echo "<tr><td>Label X-Space:</td><td><input size=\"5\" type=\"text\" name=\"xspacer\" id=\"xspacer\">\"</td></tr>"; echo "<tr><td>Label X-Space:</td><td><input size=\"5\" type=\"text\" name=\"xspacer\" id=\"xspacer\">\"</td></tr>";
echo "<tr><td>Font Size:</td><td><input size=\"5\" type=\"text\" name=\"fontsize\" id=\"fontsize\">pt</td></tr>"; echo "<tr><td>Font Size:</td><td><input size=\"5\" type=\"text\" name=\"fontsize\" id=\"fontsize\">pt</td></tr>";
echo "<tr><td>Top Padding:</td><td><input size=\"5\" type=\"text\" name=\"toppadding\" id=\"toppadding\">\"</td></tr>";
echo "</table>"; echo "</table>";
echo "<input type=\"submit\" value=\"Generate Mailing Labels\">"; echo "<input type=\"submit\" value=\"Generate Mailing Labels\">";

View File

@ -32,19 +32,21 @@ if($_GET['report']) $report=$_GET['report'];
if($_GET['reportname']) $reportname=$_GET['reportname']; else $reportname=$_GET['report']; if($_GET['reportname']) $reportname=$_GET['reportname']; else $reportname=$_GET['report'];
if($report) if($report)
{ {
if($type=="pdf") if($_GET['type']=="pdf")
{ {
$card_width=4.00; $card_width=4.00;
$card_height=2.00; $card_height=2.00;
$xspacer=0.125; $xspacer=0.125;
$yspacer=0.125; $yspacer=0.125;
$fontsize=10; $fontsize=10;
$toppadding=0;
if($_GET['width']) $card_width=$_GET['width']; if($_GET['width']) $card_width=$_GET['width'];
if($_GET['height']) $card_height=$_GET['height']; if($_GET['height']) $card_height=$_GET['height'];
if($_GET['xspacer']) $xspacer=$_GET['xspacer']; if($_GET['xspacer']) $xspacer=$_GET['xspacer'];
if($_GET['yspacer']) $yspacer=$_GET['yspacer']; if($_GET['yspacer']) $yspacer=$_GET['yspacer'];
if($_GET['fontsize']) $fontsize=$_GET['fontsize']; if($_GET['fontsize']) $fontsize=$_GET['fontsize'];
if($_GET['toppadding']) $toppadding=$_GET['toppadding'];
$rep=new lpdf( i18n($config['fairname']), $rep=new lpdf( i18n($config['fairname']),
"$reportname Mailing Labels", "$reportname Mailing Labels",
@ -53,9 +55,9 @@ if($report)
$rep->setPageStyle("labels"); $rep->setPageStyle("labels");
$rep->newPage(8.5,11); $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")); $rep=new lcsv(i18n("$reportname Mailing Labels"));
} }
@ -128,7 +130,7 @@ if($report)
} }
if($type=="csv") if($_GET['type']=="csv")
{ {
$table=array(); $table=array();
$table['header'] = array( $table['header'] = array(
@ -153,18 +155,18 @@ if($report)
} }
else $co="C/O $r->co"; else $co="C/O $r->co";
if($type=="pdf") if($_GET['type']=="pdf")
{ {
$rep->newLabel(); $rep->newLabel();
$rep->mailingLabel($r->name,$co,$r->address,$r->city,$r->province,$r->postalcode); $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); $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->addTable($table);
$rep->output(); $rep->output();

View File

@ -710,15 +710,16 @@ class lpdf
$this->page_style=$style; $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_width=$width;
$this->label_height=$height; $this->label_height=$height;
$this->label_xspacer=$xspacer; $this->label_xspacer=$xspacer;
$this->label_yspacer=$yspacer; $this->label_yspacer=$yspacer;
$this->label_toppadding=$toppadding;
$this->labels_per_row=floor($this->page_width/($width+$xspacer)); $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_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; $this->labels_start_xpos=($this->page_width-$this->labels_per_row*$width - $this->label_xspacer*($this->labels_per_row-1))/2;