]> _ Git - fluidbook-v3.git/commitdiff
Done #522 @4
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 1 Jul 2016 17:32:36 +0000 (17:32 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 1 Jul 2016 17:32:36 +0000 (17:32 +0000)
framework/application/controllers/AjaxController.php
framework/application/controllers/AjaxpopupController.php
framework/application/views/helpers/HeaderContactNav.php
framework/application/views/helpers/LinkQuote.php
framework/application/views/helpers/QuoteForm.php

index c89c577a31e70bc6302ebed58827f3f9718907ea..c82be1f3b3a8358c9bd63c0e96b18849cbd8e6f2 100644 (file)
@@ -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', '<div id="confirmationQuote">' . $okmessage . '</div>');
+                       $this->_datas->addReplace('#'. $formID, '<div id="confirmationQuote">' . $okmessage . '</div>');
                } else {
                        $this->_datas->refreshForm($form); // Respond with validation errors
                        $this->_datas->addAction('eval', 'displayErrors()');
index 842bc4d012987d2d811a6b8f23d87fcd570976d5..5a4147a697069db72164d3cd2811d4e7ea8cd5f6 100644 (file)
@@ -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
+    }
 
 }
 
index 1b56cd7c03c057345b6e8a93d51c98a3f88f89cc..e3af51fb8c3df2a64fb542c5465d81eb5257cf5e 100644 (file)
@@ -6,6 +6,8 @@ class Fluidbook_View_Helper_HeaderContactNav extends CubeIT_View_Helper_Abstract
         */\r
        public function headerContactNav() {\r
 \r
+               $this->headScript()->addScriptAndStyle('315-quote'); // Needed for styling and handling the AJAX quote form\r
+\r
                $res = array();\r
 \r
                $res[] = $this->linkInternal(null, 'internal:agences',array('class'=>'agencies'));\r
index d3f11958e579f8e628683465901c7683258f7694..032f1a697a5d07e21f37f5bd5b8d3d4f6369850f 100644 (file)
@@ -5,6 +5,6 @@ class Fluidbook_View_Helper_LinkQuote extends CubeIT_View_Helper_Abstract {
         * @return string\r
         */\r
        public function linkQuote($label) {\r
-               return $this->linkInternal($label, 'internal:contact', array('class' => 'quoteLink'));\r
+               return $this->linkPopup($label, '/ajaxpopup/quoteForm', array('class' => 'quoteLink'));\r
        }\r
 }
\ No newline at end of file
index 69bb6650907574726db3ad15be0900132f059b59..4735ec8426cd6aeaaa67579ba52462391627bf8f 100644 (file)
@@ -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  = '<div class="request-quote content-wrapper grid">';
         $res .= '<div class="text col-2">';
         $res .= '<h1 class="title">'. nl2br($this->option('quote_heading')) .'</h1>';
         $res .= $this->markupDotclear($this->option('quote_description'));
         $res .= '</div>'; // .text
         $res .= '<div class="form col-4">';
-        $form = new Fluidbook_Form_RequestQuote();
         $res .= $form;
         $res .= '<div class="validation-messages"></div>';
         $res .= '</div>'; // .form