From c52df8d765ef290aee958df0eafe6bb445088632 Mon Sep 17 00:00:00 2001 From: konrad Date: Mon, 10 Jan 2011 21:05:14 +0000 Subject: [PATCH] more work on web order process implement web login settings for gui git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@705 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- src/dialogs/customerdlg.cpp | 27 ++++++- src/dialogs/customerdlg.h | 4 + wob/db/customer.wolf | 5 + wob/transact/customer.wolf | 7 ++ www/inc/classes/autoload.php | 1 + www/inc/classes/basevars.php | 152 ++++++++++++++++++++++++++++++++++++ www/inc/global_functions.php | 17 ++++- www/inc/loader_nonadmin.php | 9 ++ www/inc/rendering/cart_listing.php | 75 +++++++++++++++++- www/inc/wext/customer.php | 50 ++++++++++++ www/inc/wext/webcart.php | 3 +- www/index.php | 98 +---------------------- www/template/en/cart.html | 4 +- www/template/en/loginerror.html | 12 +++ www/template/en/orderlogin.html | 89 +++++++++++++++++++++ www/template/en/resetlogin.txt | 22 +++++ www/template/en/vouchers.html | 25 ++++++ 17 files changed, 499 insertions(+), 101 deletions(-) create mode 100644 www/inc/classes/basevars.php create mode 100644 www/template/en/loginerror.html create mode 100644 www/template/en/orderlogin.html create mode 100644 www/template/en/resetlogin.txt create mode 100644 www/template/en/vouchers.html diff --git a/src/dialogs/customerdlg.cpp b/src/dialogs/customerdlg.cpp index 7a96063..2c1f843 100644 --- a/src/dialogs/customerdlg.cpp +++ b/src/dialogs/customerdlg.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -227,6 +228,10 @@ MCustomerDialog::MCustomerDialog(MOCustomer c,QWidget*par) vl->addWidget(tab=new QTabWidget); tab->addTab(w=new QWidget,tr("Customer")); + QMenu*menu=new QMenu(this); + menu->addAction(tr("Change Mail Address"),this,SLOT(changeMail())); + menu->addAction(tr("Reset Password"),this,SLOT(resetLogin())); + w->setLayout(gl=new QGridLayout); int lc=0; gl->addWidget(new QLabel(tr("Name:")),lc,0); @@ -239,7 +244,7 @@ MCustomerDialog::MCustomerDialog(MOCustomer c,QWidget*par) gl->addWidget(new QLabel(tr("Web-Login/eMail:")),++lc,0); gl->addWidget(m_mail=new QLabel(m_cust.email()),lc,1); gl->addWidget(p=new QPushButton(tr("Edit Login")),++lc,1); - p->setEnabled(false);//TODO: implement edit customer login + p->setMenu(menu); gl->setRowMinimumHeight(++lc,10); gl->addWidget(new QLabel(tr("Comment:")),++lc,0,1,2); gl->addWidget(m_comm=new QTextEdit,++lc,0,1,2); @@ -356,6 +361,26 @@ void MCustomerDialog::save() m_cust=cc.getcustomer(); } } + +void MCustomerDialog::changeMail() +{ + QString mail=QInputDialog::getText(this, tr("Change Mail Address"), tr("Please enter the mail address for this customer to log into the web portal:"),QLineEdit::Normal, m_mail->text()); + if(mail!=""){ + m_mail->setText(mail); + m_cust.setemail(mail); + } +} + +void MCustomerDialog::resetLogin() +{ + MTResetCustomerPassword rcp=req->queryResetCustomerPassword(m_cust.customerid()); + if(rcp.hasError()) + QMessageBox::warning(this,tr("Warning"),tr("Error while resetting password: %1").arg(rcp.errorString())); + else + QMessageBox::information(this,tr("Password Reset"),tr("A password reset mail has been sent to the customer.")); +} + + /********************************************************************************/ MContactTableDelegate::MContactTableDelegate(QObject*p) diff --git a/src/dialogs/customerdlg.h b/src/dialogs/customerdlg.h index 0538f6c..97f77bf 100644 --- a/src/dialogs/customerdlg.h +++ b/src/dialogs/customerdlg.h @@ -243,6 +243,10 @@ class MCustomerDialog:public QDialog void addContact(); /**internal: remove contact*/ void removeContact(); + ///internal: change mail address + void changeMail(); + ///internal: send a reset mail + void resetLogin(); private: MOCustomer m_cust; diff --git a/wob/db/customer.wolf b/wob/db/customer.wolf index f893ae9..d5d7de1 100644 --- a/wob/db/customer.wolf +++ b/wob/db/customer.wolf @@ -25,6 +25,11 @@ + + + + + diff --git a/wob/transact/customer.wolf b/wob/transact/customer.wolf index 797e1c4..00af319 100644 --- a/wob/transact/customer.wolf +++ b/wob/transact/customer.wolf @@ -103,4 +103,11 @@ + + + + + + + \ No newline at end of file diff --git a/www/inc/classes/autoload.php b/www/inc/classes/autoload.php index 54017a2..4c520c1 100644 --- a/www/inc/classes/autoload.php +++ b/www/inc/classes/autoload.php @@ -7,4 +7,5 @@ wob_autoclass('LanguageManager','./inc/classes/language_manager.php'); wob_autoclass('ConfigManager','./inc/classes/config_manager.php'); wob_autoclass('Websession','./inc/classes/websession.php'); +wob_autoclass('BaseVars','./inc/classes/basevars.php'); ?> \ No newline at end of file diff --git a/www/inc/classes/basevars.php b/www/inc/classes/basevars.php new file mode 100644 index 0000000..3c4155b --- /dev/null +++ b/www/inc/classes/basevars.php @@ -0,0 +1,152 @@ + + +\param script.* variables contain URLs for different modes of the web site:
+
+ + + + + + + + + + + + + +
script.rootroot URL for the index.php script
script.thisthe URL of the currently called script mode
script.indexURL of the list index
script.eventDetailsURL for event detail pages, append the event ID to it to complete it
script.eventOrderURL for ordering tickets for a specific event, arguments are expected as POST or GET parameters
script.vouchersURL for listing vouchers
script.voucherOrderURL for ordering vouchers, arguments are expected as POST or GET parameters
script.removeItemURL for removing tickets/vouchers/items from the cart, arguments are expected as POST or GET parameters
script.shopURL for listing shop items
script.cartURL of the cart, the cart must exist when calling it, otherwise a cookie error will be displayed
script.mycartURL of the cart that transparently creates the cart if it does not exist yet
script.checkoutURL to check out the cart
script.setlanguageURL for setting the language cookie, add the language code to it to complete it

+\param inputnames.* variables contain names for specific form input elements:
+ + + + + +
inputnames.amountTicketsamount of tickets to be ordered
inputnames.eventcontains the event ID
inputnames.modecontains the display mode
inputnames.cartidID of the cart of the current customer, usually the cart cookie is used instead

+\param cartcookie variable contains the name of the cookie that contains the cart ID.

+\param lang variable is an object of type LanguageManager - it represents translations done for the language the user has chosen.

+ + +\section tpl_error error.html + +This template is used whenever an error occurs during processing. + +\param ErrorText the text to be shown for an error +\param ErrorTrace a full ASCII version of an exception trace. This is only filled if the $WebShowErrors option is set to true in the config.php file. +**/ + +class BaseVars{ + +///if Twig is not yet initialized: initialize it, sets the $twig variable to the interpreter +static public function initTwig(){ + global $twig; + if(!isset($twig))self::initTwigPriv(); +} + +/// \internal actually initializes Twig +static private function initTwigPriv() +{ + Twig_Autoloader::register(); + global $loader,$twig,$twigoptions,$twigextensions; + $loader = new Twig_Loader_Filesystem(LanguageManager::singleton()->templateFolders()); + $twig = new Twig_Environment($loader, $twigoptions ); + foreach($twigextensions as $te){ + $t='Twig_Extension_'.$te; + $twig->addExtension(new $t()); + } + $twig->addExtension(new LangFilterExtension); + $twig->addExtension(new SmokeFilterExtension); +} + +/// initializes the $basevars array +public static function init(){ + global $basevars; + if(!isset($basevars))self::initPriv(); +} + +/// \internal actually initializes $basevars +public static function initPriv(){ + global $basevars,$_SERVER,$BaseUrl; + self::initBaseUrlPriv(); + //basic variables shared by all templates + // script URLs + $basevars['script']['root']=$BaseUrl; + $basevars['script']['this']=$BaseUrl; + if(isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']!="") + $basevars['script']['this'].="?".$_SERVER['QUERY_STRING']; + $basevars['script']['index']=$BaseUrl."?mode=index"; + $basevars['script']['eventDetails']=$BaseUrl."?mode=eventDetails&event="; + $basevars['script']['eventOrder']=$BaseUrl."?mode=eventOrder"; + $basevars['script']['vouchers']=$BaseUrl."?mode=vouchers"; + $basevars['script']['voucherOrder']=$BaseUrl."?mode=voucherOrder"; + $basevars['script']['shop']=$BaseUrl."?mode=shop"; + $basevars['script']['cart']=$BaseUrl."?mode=cart"; + $basevars['script']['mycart']=$BaseUrl."?mode=mycart"; + $basevars['script']['checkout']=$BaseUrl."?mode=checkout"; + $basevars['script']['removeItem']=$BaseUrl."?mode=removeItem"; + $basevars['script']['orderLogin']=$BaseUrl."?mode=orderLogin"; + $basevars['script']['customerLogin']=$BaseUrl."?mode=customerLogin"; + $basevars['script']['customerRegistration']=$BaseUrl."?mode=customerRegistration"; + $basevars['script']['customerResetLogin']=$BaseUrl."?mode=customerResetLogin"; + //$basevars['script']['orderOverview']=$BaseUrl."?mode=orderOverview"; + //$basevars['script']['editShippingAddress']=$BaseUrl."?mode=editShippingAddress"; + //$basevars['script']['editOrderComments']=$BaseUrl."?mode=editOrderComments"; + $basevars['script']['setlanguage']=$BaseUrl."?mode=setlanguage&lang="; + // form elements + $basevars['inputnames']['amountTickets']="amountTickets"; + $basevars['inputnames']['event']="event"; + $basevars['inputnames']['ticket']="event"; + $basevars['inputnames']['voucher']="voucher"; + $basevars['inputnames']['mode']="mode"; + $basevars['inputnames']['login']['name']='customer_mail'; + $basevars['inputnames']['login']['passwd']='customer_passwd'; + $basevars['inputnames']['login']['passwdrepeat']='customer_passwd2'; + $basevars['inputnames']['login']['name']='customer_name'; + $basevars['inputnames']['login']['firstname']='customer_firstname'; + $basevars['inputnames']['login']['title']='customer_title'; + //end of basevars +} + +private static function initBaseUrlPriv(){ + global $BaseUrl,$_SERVER; + //check whether it is already set + if(!isset($BaseUrl))$BaseUrl=""; + if($BaseUrl!="")return; + //reconstruct + $BaseUrl="http"; + // HTTPS? + if(isset($_SERVER["HTTPS"])){ + if($_SERVER["HTTPS"]!="" && $_SERVER["HTTPS"]!="off") + $BaseUrl.="s"; + } + $BaseUrl.="://"; + // host name + if(isset($_SERVER["SERVER_NAME"]))$BaseUrl.=$_SERVER["SERVER_NAME"]; + else if(isset($_SERVER["HTTP_HOST"]))$BaseUrl.=$_SERVER["HTTP_HOST"]; + else $BaseUrl="";//darn! no host found + // add path, correct machine.php to index.php + $pl=explode("/",$_SERVER["SCRIPT_NAME"]); + $path=""; + $last=array_pop($pl); + foreach($pl as $p){ + if($p=="")continue; + $path.="/".$p; + } + $pl=explode(".",$last); + if(count($pl)!=2)$path.="/".$last; + else $path.="/index.".$pl[1]; + $BaseUrl.=$path; +} + +//end of class +} + +?> \ No newline at end of file diff --git a/www/inc/global_functions.php b/www/inc/global_functions.php index 8d56643..56c253f 100644 --- a/www/inc/global_functions.php +++ b/www/inc/global_functions.php @@ -15,10 +15,11 @@ function isEmpty($var) return empty($var); } -/** checks if given value is a valid email address */ +/** checks if given value is a valid email address +\returns true if the value has e-mail syntax */ function isEmail($value) { - return ereg("^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\._-]+$", $value); + return preg_match("/^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\._-]+$/", $value) != false; } /**redirects the browser to index.php*/ @@ -43,4 +44,16 @@ function redirectHome(array $query=array()) exit(); } +///redirects back to the referer page +function redirectBack() +{ + global $_SERVER; + if(isset($_SERVER['HTTP_REFERER'])){ + Header("Location: ".$_SERVER['HTTP_REFERER']); + exit(); + }else{ + redirectHome(); + } +} + ?> diff --git a/www/inc/loader_nonadmin.php b/www/inc/loader_nonadmin.php index 5cc3d69..50b95ee 100644 --- a/www/inc/loader_nonadmin.php +++ b/www/inc/loader_nonadmin.php @@ -9,5 +9,14 @@ if(!$db->canUseDb()) die("Database is not correctly configured. Giving up."); //TODO: convert random into class and move to framework include_once('./inc/classes/random.php'); +//load external Twig library +require_once 'inc/Twig/Autoloader.php'; + +//load web-UI specific class-files +include('inc/classes/autoload.php'); +include("inc/rendering/autoload.php"); +//load globals +include('inc/global_functions.php'); + ?> \ No newline at end of file diff --git a/www/inc/rendering/cart_listing.php b/www/inc/rendering/cart_listing.php index 8bc9679..8d8d146 100644 --- a/www/inc/rendering/cart_listing.php +++ b/www/inc/rendering/cart_listing.php @@ -5,7 +5,8 @@ // see COPYING.AGPL -/** helper class wrapping Web Cart handling */ +/** helper class wrapping Web Cart handling logic, +the class wrapping the tables is WOWebCart in wext/webcart.php */ class WebCart{ static private $cartid=false; @@ -266,7 +267,7 @@ and \ref tpl_base Base Variables */ static public function orderLoginPage() { - global $twig,$basevars; + global $twig,$basevars,$HTTPARGS; //get cart id and check it $cartid=self::getCart(); if($cartid==""){ @@ -283,11 +284,81 @@ static public function orderLoginPage() } $list=$basevars; $list["cart"]=$cart; + $list["customer_name"]=""; + if(isset($HTTPARGS["customer_name"])) + $list["customer_name"]=$HTTPARGS["customer_name"]; + else{ + $cust=$cart->getcustomer(); + if(is_a($cust,"WOCustomer")) + $list["customer_name"]=$cust->getemail(); + } //display $p=$twig->loadTemplate("orderlogin.html"); return $p->render($list); } + +/** \page templates Templates +\section tpl_logerr Login Error + +The loginerror.html template is used to render customer login and registering errors. + +\param errorType the type of error: "login" - the login failed (wrong mail or password), "exist" - an account with the same mail already exists, "mismatch" - the new passwords do no match +\param backUrl the URL to call back to the login page +*/ + +///renders a login error page, see \ref tpl_logerr Login Error Template +static private function loginError($errorType) +{ + global $basevars,$HTTPARGS,$SERVER,$twig; + //find some basics + $vars=$basevars; + $vars["errorType"]=$errorType; + //construct URL back to login page + if(isset($_SERVER["HTTP_REFERER"])){ + $vars["backUrl"]=$_SERVER["HTTP_REFERER"]; + }else{ + $vars["backUrl"]=$basevars['script']['orderLogin']; + } + if(strstr($vars["backUrl"],"?")===false) + $vars["backUrl"].="?"; + else + $vars["backUrl"].="&"; + $idx=$basevars['inputnames']['login']['name']; + $vars["backUrl"].=$idx."="; + if(isset($HTTPARGS[$idx]))$vars["backUrl"].=$HTTPARGS[$idx]; + //render page + $p=$twig->loadTemplate("loginerror.html"); + return $p->render($vars); +} + +///check the login of the customer, either forwards to the checkout page or shows the loginerror page +static public function checkOrderLogin() +{ + global $HTTPARGS,$db,$basevars; + //find customer + $nameidx=$basevars['inputnames']['login']['name']; + $passidx=$basevars['inputnames']['login']['passwd']; + if(!isset($HTTPARGS[$nameidx]) || !isset($HTTPARGS[$passidx])){ + return self::loginError("param"); + } + $ct=WTcustomer::selectFromDB("email=".$db->escapeString($HTTPARGS[$nameidx])); + if(count($ct)<1){ + return self::loginError("login"); + } + //check password + $cust=WOCustomer::fromTablecustomer($ct[0]); + if(!$cust->checkPassword($HTTPARGS[$passidx])){ + return self::loginError("login"); + } +} + +static public function registerCustomer() +{ + global $HTTPARGS; + +} + //end of WebCart }; diff --git a/www/inc/wext/customer.php b/www/inc/wext/customer.php index 8c78274..8ac2d02 100644 --- a/www/inc/wext/customer.php +++ b/www/inc/wext/customer.php @@ -64,6 +64,9 @@ class WOCustomer extends WOCustomerAbstract } //create customer $cc->toTablecustomer($ct); + $ct->revert("passwd"); + $ct->revert("rstcode"); + $ct->revert("rsttill"); if($ct->isChanged())$ct->update(); //sync addresses foreach($cc->getaddresses() as $addr){ @@ -241,5 +244,52 @@ class WOCustomer extends WOCustomerAbstract //return $trans->setcontacttype(WOContactType::fromTablecontacttype($tab)); } + + ///the ResetCustomerPassword transaction + public static function resetPassword($trans) + { + //check for customer + $ct=WTcustomer::getFromDB($trans->getcustomerid()); + if(!is_a($ct,"WTcustomer")){ + $trans->abortWithError(tr("Not a valid customer.")); + return; + } + if(!isEmail($ct->email)){ + $trans->abortWithError(tr("Customer has no email address.")); + return; + } + //set reset parameters + global $CustomerResetTime,$MailFrom; + $ct->rstcode=getRandom(160); + $ct->rsttill=time()+$CustomerResetTime; + $ct->update(); + //init twig + BaseVars::initTwig(); + BaseVars::init(); + //gather basics and render mail + global $twig,$basevars; + $p=$twig->loadTemplate("resetlogin.txt"); + $list['customer']=WOCustomer::fromTablecustomer($ct); + $list['resetUrl']=$basevars['script']['customerResetLogin'] + ."&customer=".urlencode($ct->email) + ."&passcode=".$ct->rstcode; + $list['passcode']=$ct->rstcode; + $page=explode("\n",trim($p->render($list))); + //parse mail + if(count($page)<2)return; + $subject=array_shift($page); + $mode=0; + $mailtext="";$mailheader=""; + foreach($page as $line){ + if($mode==0){ + if(trim($line)=="")$mode=1; + else $mailheader.=$line."\n"; + }else{ + $mailtext.=$line."\n"; + } + } + //send mail + mb_send_mail($ct->email,$subject,$mailtext,$mailheader); + } }; ?> \ No newline at end of file diff --git a/www/inc/wext/webcart.php b/www/inc/wext/webcart.php index 7850ed9..a1772e0 100644 --- a/www/inc/wext/webcart.php +++ b/www/inc/wext/webcart.php @@ -3,7 +3,8 @@ // protected under the GNU AGPL version 3 or at your option any newer // see COPYING.AGPL - +///this is the class wrapping the cart tables, +///the business logic class is WebCart in rendering/cart_listing.php class WOWebCart extends WOWebCartAbstract { /**returns is empty attribute for twig*/ diff --git a/www/index.php b/www/index.php index d6dde21..bd7f2ef 100644 --- a/www/index.php +++ b/www/index.php @@ -7,14 +7,6 @@ //basics include('inc/loader.php'); include('inc/loader_nonadmin.php'); -//load web-UI specific class-files -include('inc/classes/autoload.php'); -include("inc/rendering/autoload.php"); -//load external Twig library -require_once 'inc/Twig/Autoloader.php'; -Twig_Autoloader::register(); -//load globals -include('inc/global_functions.php'); //unify arguments $HTTPARGS=$_GET; @@ -30,89 +22,10 @@ if(isset($_GET["mode"])){ Session::setWebSession(); //initialize TWIG -$loader = new Twig_Loader_Filesystem(LanguageManager::singleton()->templateFolders()); -$twig = new Twig_Environment($loader, $twigoptions ); -foreach($twigextensions as $te){ - $t='Twig_Extension_'.$te; - $twig->addExtension(new $t()); -} -$twig->addExtension(new LangFilterExtension); -$twig->addExtension(new SmokeFilterExtension); - - -/** \page templates Templates -\section tpl_base Base Variables - -There are some variables available for all templates.

- -\param script.* variables contain URLs for different modes of the web site:
- - - - - - - - - - - - - - -
script.rootroot URL for the index.php script
script.thisthe URL of the currently called script mode
script.indexURL of the list index
script.eventDetailsURL for event detail pages, append the event ID to it to complete it
script.eventOrderURL for ordering tickets for a specific event, arguments are expected as POST or GET parameters
script.vouchersURL for listing vouchers
script.voucherOrderURL for ordering vouchers, arguments are expected as POST or GET parameters
script.removeItemURL for removing tickets/vouchers/items from the cart, arguments are expected as POST or GET parameters
script.shopURL for listing shop items
script.cartURL of the cart, the cart must exist when calling it, otherwise a cookie error will be displayed
script.mycartURL of the cart that transparently creates the cart if it does not exist yet
script.checkoutURL to check out the cart
script.setlanguageURL for setting the language cookie, add the language code to it to complete it

-\param inputnames.* variables contain names for specific form input elements:
- - - - - -
inputnames.amountTicketsamount of tickets to be ordered
inputnames.eventcontains the event ID
inputnames.modecontains the display mode
inputnames.cartidID of the cart of the current customer, usually the cart cookie is used instead

-\param cartcookie variable contains the name of the cookie that contains the cart ID.

-\param lang variable is an object of type LanguageManager - it represents translations done for the language the user has chosen.

- - -\section tpl_error error.html - -This template is used whenever an error occurs during processing. - -\param ErrorText the text to be shown for an error -\param ErrorTrace a full ASCII version of an exception trace. This is only filled if the $WebShowErrors option is set to true in the config.php file. -**/ +BaseVars::initTwig(); -//basic variables shared by all templates -// script URLs -$basevars['script']['root']=$_SERVER['SCRIPT_NAME']; -$basevars['script']['this']=$_SERVER['REQUEST_URI']; -$basevars['script']['index']=$_SERVER['SCRIPT_NAME']."?mode=index"; -$basevars['script']['eventDetails']=$_SERVER['SCRIPT_NAME']."?mode=eventDetails&event="; -$basevars['script']['eventOrder']=$_SERVER['SCRIPT_NAME']."?mode=eventOrder"; -$basevars['script']['vouchers']=$_SERVER['SCRIPT_NAME']."?mode=vouchers"; -$basevars['script']['voucherOrder']=$_SERVER['SCRIPT_NAME']."?mode=voucherOrder"; -$basevars['script']['shop']=$_SERVER['SCRIPT_NAME']."?mode=shop"; -$basevars['script']['cart']=$_SERVER['SCRIPT_NAME']."?mode=cart"; -$basevars['script']['mycart']=$_SERVER['SCRIPT_NAME']."?mode=mycart"; -$basevars['script']['checkout']=$_SERVER['SCRIPT_NAME']."?mode=checkout"; -$basevars['script']['removeItem']=$_SERVER['SCRIPT_NAME']."?mode=removeItem"; -$basevars['script']['orderLogin']=$_SERVER['SCRIPT_NAME']."?mode=orderLogin"; -$basevars['script']['customerLogin']=$_SERVER['SCRIPT_NAME']."?mode=customerLogin"; -$basevars['script']['customerRegistration']=$_SERVER['SCRIPT_NAME']."?mode=customerRegistration"; -//$basevars['script']['orderOverview']=$_SERVER['SCRIPT_NAME']."?mode=orderOverview"; -//$basevars['script']['editShippingAddress']=$_SERVER['SCRIPT_NAME']."?mode=editShippingAddress"; -//$basevars['script']['editOrderComments']=$_SERVER['SCRIPT_NAME']."?mode=editOrderComments"; -$basevars['script']['setlanguage']=$_SERVER['SCRIPT_NAME']."?mode=setlanguage&lang="; -// form elements -$basevars['inputnames']['amountTickets']="amountTickets"; -$basevars['inputnames']['event']="event"; -$basevars['inputnames']['ticket']="event"; -$basevars['inputnames']['voucher']="voucher"; -$basevars['inputnames']['mode']="mode"; -$basevars['inputnames']['login']['name']='customer_mail'; -$basevars['inputnames']['login']['passwd']='customer_passwd'; -$basevars['inputnames']['login']['passwdrepeat']='customer_passwd2'; -$basevars['inputnames']['login']['name']='customer_name'; -$basevars['inputnames']['login']['firstname']='customer_firstname'; -$basevars['inputnames']['login']['title']='customer_title'; +//initialize basevars +BaseVars::init(); $basevars['inputnames']['cartid']=WebCart::cartIdName; $basevars['cartcookie']=WebCart::cartIdName; // other info @@ -147,7 +60,6 @@ try{ WebCart::addVoucher(); break; case "shop": - //TODO: implement redirectHome(); break; case "checkout": @@ -157,10 +69,10 @@ try{ $page=WebCart::orderLoginPage(); break; case "customerLogin": - WebCart::checkOrderLogin(); + $page=WebCart::checkOrderLogin(); break; case "customerRegistration": - WebCart::registerUser(); + $page=WebCart::registerCustomer(); break; /* case "orderOverview": orderTickets(); diff --git a/www/template/en/cart.html b/www/template/en/cart.html index ed81349..071f1cb 100644 --- a/www/template/en/cart.html +++ b/www/template/en/cart.html @@ -23,7 +23,7 @@ {% for ticket in cart.tickets %} {% set pricesum=ticket.price * ticket.amount %} - Ticket: {{ticket.event.title}} + Ticket: {{ticket.event.title}} ({{ticket.eventprice.pricecategory.name}}) {{ticket.price|asMoney}} {{ticket.amount}} {{pricesum|asMoney}} @@ -63,7 +63,7 @@ {# actions the user may want to take #} -

Checkout

+

Checkout

{# end of the non-empty cart... #} {% endif %} diff --git a/www/template/en/loginerror.html b/www/template/en/loginerror.html new file mode 100644 index 0000000..968a459 --- /dev/null +++ b/www/template/en/loginerror.html @@ -0,0 +1,12 @@ + +Login Error + +

Login Error

+ +Error Type: {{errorType}}

+ +Try Again

+ +


+Back to Index + \ No newline at end of file diff --git a/www/template/en/orderlogin.html b/www/template/en/orderlogin.html new file mode 100644 index 0000000..33c126f --- /dev/null +++ b/www/template/en/orderlogin.html @@ -0,0 +1,89 @@ +{# Example Template for MagicSmoke + ================================ + this one is called to show the login page for a customer +#} +{% extends 'layout.html' %} + +{% block title %}Login{% endblock %} + +{% block page %} +I already have an account:

+ +{# the login dialog #} +

+
+ + + +
E-mail address:
Password:

+ +

+

+ +I do not have have an account yet:

+ +{# the create account dialog #} +

+
+ + + + +
E-mail address:
Select a Password:
Repeat Password:

+ + + + +
Title: + + +
+ Mr.
+ Mrs.
+ Herr
+ Frau +
+
Name:
First Name:

+ +

+
+ +


+{# in any case: allow the user to shop some more... #} +

Abort and Continue Shopping

+ +{# helper JavaScript: makes one or the other dialog visible #} + + +{% endblock page %} diff --git a/www/template/en/resetlogin.txt b/www/template/en/resetlogin.txt new file mode 100644 index 0000000..14eecaa --- /dev/null +++ b/www/template/en/resetlogin.txt @@ -0,0 +1,22 @@ +{# +This template contains the mail sent to a customer +when he/she requests a password reset. + +The first non-empty line contains the subject, +subsequent lines contain the headers, then an empty line +and after that the body of the mail. +#} +Password Reset at MagicSmoke.silmor.de +From: no-reply@localdomain.com + +Hello {{customer.title}} {{customer.name}}! + +You or someone else requested to change your password. +If you do intend to change your password please click the +link below within the next 24 hours and enter a new password +on the page you will see. + +If you do not intend to change your password please ignore +this mail. + +{{resetUrl|raw}} \ No newline at end of file diff --git a/www/template/en/vouchers.html b/www/template/en/vouchers.html new file mode 100644 index 0000000..518285b --- /dev/null +++ b/www/template/en/vouchers.html @@ -0,0 +1,25 @@ +{# Example Template for MagicSmoke + ================================ + this one is called to create the voucher order page +#} +{% extends 'layout.html' %} + +{% block title %}Order Vouchers{% endblock %} + +{% block page %} +
+ Please select a voucher price: + + {# end of the form... just add a button... #} + +
+

+ +{# in any case: allow the user to shop some more... #} +

Continue Shopping

+ +{% endblock page %} -- 1.7.2.5