From: stephen@cubedesigners.com Date: Fri, 1 Jul 2016 17:32:36 +0000 (+0000) Subject: Done #522 @4 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=30142163c6c617c27cfd2483b569464c174004d8;p=fluidbook-v3.git Done #522 @4 --- diff --git a/framework/application/controllers/AjaxController.php b/framework/application/controllers/AjaxController.php index c89c577..c82be1f 100644 --- a/framework/application/controllers/AjaxController.php +++ b/framework/application/controllers/AjaxController.php @@ -2,9 +2,17 @@ class AjaxController extends CubeIT_Controller_AjaxController { - public function requestQuote() { + public function requestQuote($formID = null) { $form = new Fluidbook_Form_RequestQuote(); + // Take form ID from URL so we can differentiate between the popup and the embedded versions of the form + if ($formID) { + $form->setId($formID); + $form->setAction($form->getAction() .'/'. $formID); + } else { + $formID = $form->getId(); + } + if ($form->isValid($_POST)) { $url = 'https://workshop.fluidbook.com/ajax/demandeDevis?devis_form=' . base64_encode(serialize($_POST)); $xml = simplexml_load_file($url); @@ -14,7 +22,7 @@ class AjaxController extends CubeIT_Controller_AjaxController { $okmessage=(string)$okmessage->content; } - $this->_datas->addReplace('#requestQuote', '
' . $okmessage . '
'); + $this->_datas->addReplace('#'. $formID, '
' . $okmessage . '
'); } else { $this->_datas->refreshForm($form); // Respond with validation errors $this->_datas->addAction('eval', 'displayErrors()'); diff --git a/framework/application/controllers/AjaxpopupController.php b/framework/application/controllers/AjaxpopupController.php index 842bc4d..5a4147a 100644 --- a/framework/application/controllers/AjaxpopupController.php +++ b/framework/application/controllers/AjaxpopupController.php @@ -2,6 +2,11 @@ class AjaxpopupController extends CubeIT_Controller_AjaxpopupController { + public function quoteForm() { + $this->setPopupMaxWidth('1440'); + $this->setPopupPadding('20'); + return $this->view->quoteForm('requestQuotePopup'); // Different ID for popup form so it doesn't conflict with contact page form + } } diff --git a/framework/application/views/helpers/HeaderContactNav.php b/framework/application/views/helpers/HeaderContactNav.php index 1b56cd7..e3af51f 100644 --- a/framework/application/views/helpers/HeaderContactNav.php +++ b/framework/application/views/helpers/HeaderContactNav.php @@ -6,6 +6,8 @@ class Fluidbook_View_Helper_HeaderContactNav extends CubeIT_View_Helper_Abstract */ public function headerContactNav() { + $this->headScript()->addScriptAndStyle('315-quote'); // Needed for styling and handling the AJAX quote form + $res = array(); $res[] = $this->linkInternal(null, 'internal:agences',array('class'=>'agencies')); diff --git a/framework/application/views/helpers/LinkQuote.php b/framework/application/views/helpers/LinkQuote.php index d3f1195..032f1a6 100644 --- a/framework/application/views/helpers/LinkQuote.php +++ b/framework/application/views/helpers/LinkQuote.php @@ -5,6 +5,6 @@ class Fluidbook_View_Helper_LinkQuote extends CubeIT_View_Helper_Abstract { * @return string */ public function linkQuote($label) { - return $this->linkInternal($label, 'internal:contact', array('class' => 'quoteLink')); + return $this->linkPopup($label, '/ajaxpopup/quoteForm', array('class' => 'quoteLink')); } } \ No newline at end of file diff --git a/framework/application/views/helpers/QuoteForm.php b/framework/application/views/helpers/QuoteForm.php index 69bb665..4735ec8 100644 --- a/framework/application/views/helpers/QuoteForm.php +++ b/framework/application/views/helpers/QuoteForm.php @@ -2,17 +2,23 @@ class Fluidbook_View_Helper_QuoteForm extends CubeIT_View_Helper_Abstract { - public function quoteForm() { + public function quoteForm($formID = null) { $this->headScript()->addScriptAndStyle('315-quote'); + $form = new Fluidbook_Form_RequestQuote(); + + if ($formID) { + $form->setId($formID); + $form->setAction($form->getAction() .'/'. $formID); + } + $res = '
'; $res .= '
'; $res .= '

'. nl2br($this->option('quote_heading')) .'

'; $res .= $this->markupDotclear($this->option('quote_description')); $res .= '
'; // .text $res .= '
'; - $form = new Fluidbook_Form_RequestQuote(); $res .= $form; $res .= '
'; $res .= '
'; // .form