From 67b07bb7ae4fe610938d977d65a8cbe58dc4da32 Mon Sep 17 00:00:00 2001 From: hdl Date: Wed, 18 Dec 2002 16:58:28 +0000 Subject: [PATCH] Templating newmember.pl newjmember.tmpl bugfixes --- .../intranet-tmpl/default/en/newjmember.tmpl | 18 +- .../intranet-tmpl/default/en/newmember.tmpl | 258 ++++++++++++++++++ newjmember.pl | 2 +- newmember.pl | 108 ++++---- 4 files changed, 315 insertions(+), 71 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/default/en/newmember.tmpl diff --git a/koha-tmpl/intranet-tmpl/default/en/newjmember.tmpl b/koha-tmpl/intranet-tmpl/default/en/newjmember.tmpl index e22c43ac62..30b1e8fece 100644 --- a/koha-tmpl/intranet-tmpl/default/en/newjmember.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/newjmember.tmpl @@ -9,7 +9,7 @@ " > " >
"> - NEW MEMBER + NEW MEMBER &nbpsq; @@ -17,7 +17,7 @@
- Name + Name @@ -25,7 +25,7 @@
"> - MEMBERSHIP DETAILS + MEMBERSHIP DETAILS &nbpsq; @@ -33,7 +33,7 @@
- Membership Number + Membership Number @@ -41,7 +41,7 @@
- Date Of Birth + Date Of Birth @@ -49,7 +49,7 @@
- Sex + Sex @@ -57,7 +57,7 @@
- School + School @@ -65,7 +65,7 @@
- General Notes + General Notes @@ -82,4 +82,4 @@ - \ No newline at end of file + diff --git a/koha-tmpl/intranet-tmpl/default/en/newmember.tmpl b/koha-tmpl/intranet-tmpl/default/en/newmember.tmpl new file mode 100644 index 0000000000..b789a5d507 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/newmember.tmpl @@ -0,0 +1,258 @@ + + +

Confirm Record

+ + + " > + + + + + + + + " > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + " > + + + + + + + + + + + + + + + + " > + + + + + + + + + + + + " > + + + + + + + + + + + + + + + + + + + + " > + + + + + + + + + + + + + + + + + + + + " > + + + + + + + +
"> + NEW MEMBER + +   +
+ Name + + +
"> + MEMBERSHIP DETAILS + +   +
+ Membership Number + + +
+ Card Number + + +
+ Membership Category + + +
+ Area + + +
+ Fee + + +
+ Joining Date + + +
+ Expiry Date + + +
+ Joining Branch + + +
"> + PERSONAL DETAILS + +   +
+ Ethnicity + + +
+ Date Of Birth + + +
+ Sex + + +
"> + MEMBER ADRESS + +   +
+ Postal Adress + + +
+ Home Adress + + +
"> + MEMBER CONTACT DETAIL + +   +
+ Phone (Home) + + +
+ Phone (Daytime) + + +
+ Fax + + +
+ E-mail + + +
"> + ALTERNATIVE CONTACT DETAIL + +   +
+ Name + + +
+ Phone + + +
+ Relationship + + +
+ Notes + + +
"> + NOTES + +   +
+ General Notes + + +

+

+ + " value=""> + + +
+ + +
+ + + \ No newline at end of file diff --git a/newjmember.pl b/newjmember.pl index 199443dd80..7d6fff48a5 100755 --- a/newjmember.pl +++ b/newjmember.pl @@ -118,4 +118,4 @@ $template->param( NOK => (ok==1), inputsloop => \@inputsloop, string => $string); -print "Content-Type:Text/html\n\n",$template->output; +print "Content-Type: text/html\n\n", $template->output; diff --git a/newmember.pl b/newmember.pl index a0cbf1ba3a..5644996c66 100755 --- a/newmember.pl +++ b/newmember.pl @@ -4,6 +4,7 @@ #script to print confirmation screen, then if accepted calls itself to insert data # FIXME - Yes, but what does it _do_? +# 2002/12/18 hdl@ifrance.com templating # Copyright 2000-2002 Katipo Communications # @@ -27,6 +28,7 @@ use C4::Output; use C4::Input; use CGI; use Date::Manip; +use HTML::Template; my %env; my $input = new CGI; @@ -40,9 +42,11 @@ my @names=$input->param; foreach my $key (@names){ $data{$key}=$input->param($key); } -print $input->header; -print startpage(); -print startmenu('member'); + +my $template = gettemplate("newmember.tmpl"); +#print $input->header; +#print startpage(); +#print startmenu('member'); my $main="#99cc33"; my $image="/images/background-mem.gif"; if ($insert eq ''){ @@ -87,10 +91,9 @@ if ($insert eq ''){ $ok=1; } #we are printing confirmation page - print mkheadr(1,'Confirm Record'); +$template->param( OK=> ($ok==0), + string=> $string); if ($ok ==0){ - print mktablehdr; - print mktablerow(2,$main,bold('NEW MEMBER'),"",$image); my $name=$data{'title'}." "; if ($data{'othernames'} ne ''){ $name.=$data{'othernames'}." "; @@ -98,38 +101,21 @@ if ($insert eq ''){ $name.=$data{'firstname'}." "; } $name.="$data{'surname'} ( $data{'firstname'}, $data{'initials'})"; - print mktablerow(2,'white',bold('Name'),$name); - print mktablerow(2,$main,bold('MEMBERSHIP DETAILS'),"",$image); - print mktablerow(2,'white',bold('Membership Number'),$data{'borrowernumber'}); - print mktablerow(2,'white',bold('Cardnumber'),$data{'cardnumber'}); - print mktablerow(2,'white',bold('Membership Category'),$data{'categorycode'}); - print mktablerow(2,'white',bold('Area'),$data{'area'}); - print mktablerow(2,'white',bold('Fee'),$data{'fee'}); + my $sex; + if ($data{'sex'} eq 'M'){ + $sex="Male"; + } else { + $sex="Female"; + } if ($data{'joining'} eq ''){ $data{'joining'}=ParseDate('today'); $data{'joining'}=&UnixDate($data{'joining'},'%Y-%m-%d'); } - print mktablerow(2,'white',bold('Joining Date'),$data{'joining'}); if ($data{'expiry'} eq ''){ $data{'expiry'}=ParseDate('in 1 year'); $data{'expiry'}=&UnixDate($data{'expiry'},'%Y-%m-%d'); } - print mktablerow(2,'white',bold('Expiry Date'),$data{'expiry'}); - print mktablerow(2,'white',bold('Joining Branch'),$data{'joinbranch'}); - print mktablerow(2,$main,bold('PERSONAL DETAILS'),"",$image); my $ethnic=$data{'ethnicity'}." ".$data{'ethnicnotes'}; - print mktablerow(2,'white',bold('Ethnicity'),$ethnic); - $data{'dateofbirth'}=ParseDate($data{'dateofbirth'}); - $data{'dateofbirth'}=UnixDate($data{'dateofbirth'},'%Y-%m-%d'); - print mktablerow(2,'white',bold('Date of Birth'),$data{'dateofbirth'}); - my $sex; - if ($data{'sex'} eq 'M'){ - $sex="Male"; - } else { - $sex="Female"; - } - print mktablerow(2,'white',bold('Sex'),$sex); - print mktablerow(2,$main,bold('MEMBER ADDRESS'),"",$image); my $postal=$data{'address'}."
".$data{'city'}; my $home; if ($data{'streetaddress'} ne ''){ @@ -137,40 +123,40 @@ if ($insert eq ''){ } else { $home=$postal; } - print mktablerow(2,'white',bold('Postal Address'),$postal); - print mktablerow(2,'white',bold('Home Address'),$home); - print mktablerow(2,$main,bold('MEMBER CONTACT DETAILS'),"",$image); - print mktablerow(2,'white',bold('Phone (Home)'),$data{'phone'}); - print mktablerow(2,'white',bold('Phone (Daytime)'),$data{'phoneday'}); - print mktablerow(2,'white',bold('Fax'),$data{'faxnumber'}); - print mktablerow(2,'white',bold('Email'),$data{'emailaddress'}); - print mktablerow(2,$main,bold('ALTERNATIVE CONTACT DETAILS'),"",$image); - print mktablerow(2,'white',bold('Name'),$data{'contactname'}); - print mktablerow(2,'white',bold('Phone'),$data{'altphone'}); - print mktablerow(2,'white',bold('Relationship'),$data{'altrelationship'}); - print mktablerow(2,'white',bold('Notes'),$data{'altnotes'}); - print mktablerow(2,$main,bold('Notes'),"",$image); - print mktablerow(2,'white',bold('General Notes'),$data{'borrowernotes'}); - - print mktableft; - #set up form to post data thru for modification or insertion - my $i=0; - my @inputs; + my @inputsloop; while (my ($key, $value) = each %data) { $value=~ s/\"/%22/g; - $inputs[$i]=["hidden","$key","$value"]; - $i++; - } - $inputs[$i]=["submit","submit","submit"]; - print mkformnotable("/cgi-bin/koha/insertdata.pl",@inputs); - } else { - print $string; + my %line; + $line{'key'}=$key; + $line{'value'}=$value; + push(@inputsloop, \%line); } -} -#print $input->dump; -print mktablehdr; + $template->param(name => $name, + bornum => $data{'borrowernumber'}, + cardnum => $data{'cardnumber'}, + memcat => $data{'categorycode'}, + area => $data{'area'}, + fee => $data{'fee'}, + joindate => $data{'joining'}, + expdate => $data{'expiry'}, + joinbranch => $data{'joinbranch'}, + ethnic => $ethnic, + dob => $data{'dateofbirth'}, + sex => $sex, + postal => $postal, + home => $home, + phone => $data{'phone'}, + phoneday => $data{'phoneday'}, + faxnumber => $data{'faxnumber'}, + emailaddress => $data{'emailaddress'}, + contactname => $data{'contactname'}, + altphone => $data{'altphone'}, + altrelationship => $data{'altrelationship'}, + altnotes => $data{'altnotes'}, + bornotes => $data{'borrowernotes'}, + inputsloop => \@inputsloop); + } +print "Content-Type: text/html\n\n", $template->output; + -print mktableft; -print endmenu('member'); -print endpage(); -- 2.20.1