#29801 - Fix for broken Newsletter signup form action url.
authorManoj K <manoj.k@zyxware.com>
Wed, 29 Oct 2014 12:10:30 +0000 (17:40 +0530)
committerManoj K <manoj.k@zyxware.com>
Wed, 29 Oct 2014 12:10:30 +0000 (17:40 +0530)
extern/wciwidget.php
templates/CRM/Wci/Form/CreateWidget.tpl
templates/CRM/Wci/Page/wciwidget.tpl
wci-helper-functions.php

index d86822833e02cf746681ff693f8915773d7b0b88..85161266e62199d0067728bc67c26717f12f58c3 100644 (file)
@@ -56,6 +56,9 @@ if (isset($format)) {
 
   $template->assign('wciform', $data);
   $template->assign('cpageId', $data['button_link_to']);
+  if(!empty($data['email_signup_group_id'])) {
+    $template->assign('emailSignupGroupFormURL', getEmailSignupFormUrl());
+  }
 
   if ($data["override"] == '0') {
     $template->template_dir[] = getWciWidgetTemplatePath();
index d43f6de2085f5e77641c139e1b0ddea04fee1bc2..c91646cd7f998cd19c9208c3a198a0520c61569e 100644 (file)
@@ -38,7 +38,9 @@
     <div class="content">
       <div class="resizable-textarea">
         <span>{literal}
-          <textarea name="embd_code" id="embd_code" class="form-textarea textarea-processed"><script type="text/javascript">
+          <textarea name="embd_code" id="embd_code" class="form-textarea textarea-processed">
+<script type="text/javascript" src="{/literal}{php}echo $widget_controller_path;{/php}{literal}?widgetId={/literal}{php}echo $wid_id;{/php}{literal}"></script>
+<script type="text/javascript">
 // Cleanup functions for the document ready method
 if ( document.addEventListener ) {
     DOMContentLoaded = function() {
index 6ee3e24d68478bc6cb53415f11a90cdee0f6fe31..537bd387439f8faa18d6ff42e6b4e94d5f5ac50b 100644 (file)
@@ -25,7 +25,7 @@
       width: 250px;
     }
     
-    .crm-wci-widget h5 {
+    h5 {
         font-size:14px;
         padding:3px;
         margin: 0px;
         background-color: {/literal}{$wciform.color_title_bg}{literal};
     } /* title */
 
-    .crm-wci-widget .crm-amounts {
+    .crm-amounts {
         height:1em;
         margin:.8em 0px;
         font-size:13px;
     }
-    .crm-wci-widget .crm-amount-low {
+    .crm-amount-low {
         float:left;
     }
-    .crm-wci-widget .crm-amount-high {
+    .crm-amount-high {
         float:right;
     }
-    .crm-wci-widget .crm-percentage {
+    .crm-percentage {
         margin:0px 30%;
         text-align:center;
     }
-    .crm-wci-widget .crm-amount-bar { /* progress bar */
+    .crm-amount-bar { /* progress bar */
         background-color:#FFF;
         width:100%;
         display:block;
@@ -68,7 +68,7 @@
         background-color:{/literal}{$wciform.color_bar}{literal};
         border-color:#CECECE;
     }
-    .crm-wci-widget .crm-amount-fill {
+    .crm-amount-fill {
         background-color:#2786C2;
         height:1em;
         display:block;
         text-align:left;
         width: {/literal}{$wciform.pb_percentage}{literal}%; /* progress bar percentage */
     }
-    .crm-wci-widget .crm-amount-raised-wrapper {
+    .crm-amount-raised-wrapper {
         margin-bottom:.8em;
     }
-    .crm-wci-widget .crm-amount-raised {
+    .crm-amount-raised {
         font-weight:bold;
         color:#000;
     }
 
-    .crm-wci-widget .crm-logo {
+    .crm-logo {
         text-align:center;
     }
 
-    .crm-wci-widget .crm-comments,
-    .crm-wci-widget .crm-donors,
-    .crm-wci-widget .crm-campaign {
+    .crm-comments,
+    .crm-donors,
+    .crm-campaign {
         font-size:11px;
         margin-bottom:.8em;
         color:{/literal}{$wciform.color_description}{literal} /* other color*/
     }
 
-    .crm-wci-widget .crm-wci-button {
+    .crm-wci-button {
         display:block;
         background-color:#CECECE;
         -moz-border-radius:       4px;
         font-size:13px;
     }
 
-    .crm-wci-widget .crm-home-url {
+    .crm-home-url {
         text-decoration:none;
         border:0px;
         color:{/literal}{$wciform.color_homepage_link}{literal} /* home page link color*/
     }
 
-    .crm-wci-widget a.crm-wci-button { /* button color */
+    a.crm-wci-button { /* button color */
         background-color:{/literal}{$wciform.color_button_bg}{literal};
     }
 
-    .crm-wci-widget .crm-wci-button-inner { /* button text color */
+    .crm-wci-button-inner { /* button text color */
         padding:2px;
         display:block;
         color:{/literal}{$wciform.color_button}{literal};
     }
-
+    #crm_wci_image_container {
+      text-align: center;
+      padding: 10px 20px;
+    }
+    #crm_wci_image {
+      margin: auto;
+    }
 </style>
 
 <style>
       {$wciform.title}
     </h5>
     {if $wciform.image}
-    <div style="text-align: center;">
-    <img src='{$wciform.image}' style="margin: 0 auto;"/>
-    </div>
+      <div id="crm_wci_image_container">
+        <img id="crm_wci_image" src='{$wciform.image}'/>
+      </div>
     {/if}
     <div class="crm-amounts">
         <div id="crm_wid_{$wciform.widgetId}_amt_hi" class="crm-amount-high"></div>
     </div>
     {$wciform.embed}
     {if $wciform.email_signup_group_id}
-        <form method="get" action="http://{php}echo $_SERVER['SERVER_NAME'];{/php}/civicrm/mailing/subscribe"
+        <form method="post" action="{$emailSignupGroupFormURL}" name="Subscribe">
         <p style="text-align:center;">
-          <input type="text" id="frmEmail" name="email-Primary" size="10">
+          <input type="text" id="frmEmail" name="email" size="10">
         </p>
+        <input id="mark_x_2" name="mark_x_2" type="hidden" value="1">
         <p style="text-align: center; margin-top: 10px;">
-          <input type="submit" name="_qf_Edit_next" value="Subscribe Me">
+          <input type="submit" name="_qf_Subscribe_next" value="Subscribe Me">
         </p>
         </form>
     {/if}
index 5022cf2fe8605d44a140c7140ef3c7c70ff27962..9c34fca09b87ec0772c3992a7fe5b721e7d524f3 100644 (file)
@@ -27,4 +27,8 @@
     $widget_tpl_path = __DIR__ . '/templates/CRM/Wci/Page';
     
     return $widget_tpl_path;
+  }
+  
+  function getEmailSignupFormUrl() {
+    return 'http://' . $_SERVER['SERVER_NAME'] . str_replace($_SERVER['PHP_SELF'], '', str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_FILENAME'])) . '/civicrm/mailing/subscribe';
   }
\ No newline at end of file