diff --git a/css/styles.css b/css/styles.css
index a32fcc3..7ef8335 100644
--- a/css/styles.css
+++ b/css/styles.css
@@ -1,12 +1,17 @@
/* Document Layout */
body {
- line-height: 1.2;
+ line-height: 1.1em;
font-family: sans-serif;
- font-size: 1.5em
+ font-size: 1.0em;
background: "#ffffff";
}
+p {
+ padding: 0em;
+ margin: 0em;
+}
+
.container {
display: flex;
flex-direction: row;
@@ -87,7 +92,6 @@ body {
.budget-subtotal {
font-family: monospace;
font-size: 1.2em;
- display: table-row;
}
.subtotal-name {
@@ -95,15 +99,17 @@ body {
font-size: 1.1em;
padding-top: 0.5em;
padding-bottom: 0.1em;
- display: table-cell;
+ display: inline-block;
+ width: 60%;
}
.subtotal-amount {
font-family: sans-serif;
font-size: 1.1em;
font-weight: bold;
- padding-left: 20px;
- display: table-cell;
+ text-align: right;
+ display: inline-block;
+ width: 35%;
}
@@ -112,22 +118,26 @@ body {
.budget-item {
font-family: monospace;
font-size: 0.9em;
- display: table-row;
+ padding-top: 0em;
+ padding-bottom: 0em;
}
.item-name {
font-family: serif;
font-size: 0.9em;
- padding-top: 0.1em;
- padding-bottom: 0.1em;
- display: table-cell;
+ padding-top: 0em;
+ padding-bottom: 0em;
+ display: inline-block;
+ width: 60%;
}
.item-amount {
font-family: sans-serif;
font-size: 0.9em;
font-weight: bold;
- padding-left: 20px;
text-align: right;
- display: table-cell;
+ padding-top: 0em;
+ padding-bottom: 0em;
+ display: inline-block;
+ width: 35%;
}
diff --git a/f20-budget.pl b/f20-budget.pl
index 0024076..bead06d 100644
--- a/f20-budget.pl
+++ b/f20-budget.pl
@@ -73,45 +73,27 @@ $new_amount = sprintf "%.2f",$new_amount; ## 2 decimal places
$new_url=$q->param("new_url");
#$new_url=~ s/http\:\/\///g; # don't remove http://
-$new_item = $q->param("new_item");
-$new_item =~ s/\'/\'\'/g;
-$new_item =~ s/\x92/’/g;
-$new_labour = $q->param("new_labour");
-$new_labour =~ s/\'/\'\'/g;
-$new_labour =~ s/\x92/’/g;
-$new_resource = $q->param("new_resource");
-$new_resource =~ s/\'/\'\'/g;
-$new_resource =~ s/\x92/’/g;
-$new_status = $q->param("new_status");
-$new_lstatus = $q->param("new_lstatus");
-$new_rstatus = $q->param("new_rstatus");
-$type = $q->param("type");
+$new_item = sanitise($q->param("new_item"));
+$new_labour = sanitise($q->param("new_labour"));
+$new_resource = sanitise($q->param("new_resource"));
+$new_status = sanitise($q->param("new_status"));
+$new_lstatus = sanitise($q->param("new_lstatus"));
+$new_rstatus = sanitise($q->param("new_rstatus"));
+$type = sanitise($q->param("type"));
for ( $i=0; $i<=50; $i+=1) {
- $new_status{$i} = $q->param("new_status$i");
- $type{$i} = $q->param("type$i");
- $new_item{$i} = $q->param("new_item$i");
- $new_item{$i} =~ s/\'/\'\'/g;
- $new_item{$i} =~ s/\x92/’/g;
- $new_resource{$i} = $q->param("new_resource$i");
- $new_resource{$i} =~ s/\'/\'\'/g;
- $new_resource{$i} =~ s/\x92/’/g;
- $new_labour{$i} = $q->param("new_labour$i");
- $new_labour{$i} =~ s/\'/\'\'/g;
- $new_labour{$i} =~ s/\x92/’/g;
- $new_status{$i} = $q->param("new_status$i");
- $new_lstatus{$i} = $q->param("new_lstatus$i");
- $new_rstatus{$i} = $q->param("new_rstatus$i");
+ $new_status{$i} = sanitise($q->param("new_status$i"));
+ $type{$i} = sanitise($q->param("type$i"));
+ $new_item{$i} = sanitise($q->param("new_item$i"));
+ $new_resource{$i} = sanitise($q->param("new_resource$i"));
+ $new_labour{$i} = sanitise($q->param("new_labour$i"));
+ $new_status{$i} = sanitise($q->param("new_status$i"));
+ $new_lstatus{$i} = sanitise($q->param("new_lstatus$i"));
+ $new_rstatus{$i} = sanitise($q->param("new_rstatus$i"));
- $new_firstname{$i} = $q->param("new_firstname$i");
- $new_firstname{$i} =~ s/\'/\'\'/g;
- $new_firstname{$i} =~ s/\x92/’/g;
- $new_lastname{$i} = $q->param("new_lastname$i");
- $new_lastname{$i} =~ s/\'/\'\'/g;
- $new_lastname{$i} =~ s/\x92/’/g;
- $new_codename{$i} = $q->param("new_codename$i");
- $new_codename{$i} =~ s/\'/\'\'/g;
- $new_codename{$i} =~ s/\x92/’/g;
+ $new_firstname{$i} = sanitise($q->param("new_firstname$i"));
+ $new_lastname{$i} = sanitise($q->param("new_lastname$i"));
+ $new_codename{$i} = sanitise($q->param("new_codename$i"));
$cost{$i}=~ s/\€/@euro/g;
$cost{$i} = $q->param("cost$i");
@@ -183,10 +165,11 @@ given ($action) {
}
exit;
-# saniti[sz]e sql inputs as needed
+# saniti[sz]e parameters and sql inputs as needed
sub sanitise {
my $string = shift;
- $string =~ s/\'/\'\'/g;
+ $string =~ s/\'/\'\'/g; # convert ' to ''
+ $string =~ s/\x92/’/g; # convert "RIGHT SINGLE QUOTATION MARK" to html
return $string;
}
@@ -810,8 +793,10 @@ sub compile_budget {
$sthb->execute;
my $recordb = $sthb->fetchrow_hashref;
+ # page header
&print_header;
+ # budget header
print <