#29801 - Fixed title encoding bug and made long js in embed as including file.
authorManoj K <manoj.k@zyxware.com>
Mon, 3 Nov 2014 13:09:25 +0000 (18:39 +0530)
committerManoj K <manoj.k@zyxware.com>
Mon, 3 Nov 2014 13:09:25 +0000 (18:39 +0530)
CRM/Wci/BAO/Widget.php
CRM/Wci/Form/CreateWidget.php
extern/wciembed.js [new file with mode: 0644]
templates/CRM/Wci/Form/CreateWidget.tpl
templates/CRM/Wci/Page/wciwidget.tpl

index 4c08e5f153566d5eec5b548047dcbdd7be1b03b5..3cedbec48c0a7550718c3037938e22b61440c340 100644 (file)
@@ -135,7 +135,7 @@ class CRM_Wci_BAO_Widget extends CRM_Wci_DAO_Widget {
 
     $data = array();
     while ($dao->fetch()) {
-      $data["title"] = base64_decode($dao->title);
+      $data["title"] = $dao->title;
       $data["logo_image"] = $dao->logo_image;
       $data["image"] = $dao->image;
       $data["button_title"] = $dao->button_title;
index d014af19f24ac2ea7a77e18a28fb1d5585b92471..b746bd8f976bc1aa36bbf48b7f74cc7292833745 100644 (file)
@@ -140,7 +140,7 @@ where w.id=" . $this->_id;*/
         CRM_Core_DAO::storeValues($dao, $wid_page[$dao->id]);
 
         $this->setDefaults(array(
-              'title' => base64_decode($wid_page[$dao->id]['title'])));
+              'title' => $wid_page[$dao->id]['title']));
         $this->setDefaults(array(
               'logo_image' => $wid_page[$dao->id]['logo_image']));
         $this->setDefaults(array(
diff --git a/extern/wciembed.js b/extern/wciembed.js
new file mode 100644 (file)
index 0000000..9fb0125
--- /dev/null
@@ -0,0 +1,39 @@
+// Cleanup functions for the document ready method
+if ( document.addEventListener ) {
+    DOMContentLoaded = function() {
+        document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+        onReady();
+    };
+} else if ( document.attachEvent ) {
+    DOMContentLoaded = function() {
+        // Make sure body exists, at least, in case IE gets a little overzealous
+        if ( document.readyState === "complete" ) {
+            document.detachEvent( "onreadystatechange", DOMContentLoaded );
+            onReady();
+        }
+    };
+}
+if ( document.readyState === "complete" ) {
+    // Handle it asynchronously to allow scripts the opportunity to delay ready
+    setTimeout( onReady, 1 );
+}
+
+// Mozilla, Opera and webkit support this event
+if ( document.addEventListener ) {
+    // Use the handy event callback
+    document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+    // A fallback to window.onload, that will always work
+    window.addEventListener( "load", onReady, false );
+    // If IE event model is used
+} else if ( document.attachEvent ) {
+    // ensure firing before onload,
+    // maybe late but safe also for iframes
+    document.attachEvent("onreadystatechange", DOMContentLoaded);
+
+    // A fallback to window.onload, that will always work
+    window.attachEvent( "onload", onReady );
+}
+
+function onReady( ) {
+  document.getElementById('widgetwci').innerHTML = wciwidgetcode;
+}
\ No newline at end of file
index 8067b71e94af0a63b9c60adbc03e50f35ea5f200..5737d69a569af96693d9444a552f28d0106b7f24 100644 (file)
@@ -28,6 +28,7 @@
         $wcidata = $template->fetch('string:' . base64_decode($wid_page[$dao->id]['custom_template']));
       }
       $widget_controller_path = getWciWidgetControllerPath();
+      $extension_root_path = getExtensionRootPath();
     }
   {/php}
 
         <span>{literal}
           <textarea rows="5" 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}&embed=1"></script>
-<script type="text/javascript">
-// Cleanup functions for the document ready method
-if ( document.addEventListener ) {
-    DOMContentLoaded = function() {
-        document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-        onReady();
-    };
-} else if ( document.attachEvent ) {
-    DOMContentLoaded = function() {
-        // Make sure body exists, at least, in case IE gets a little overzealous
-        if ( document.readyState === "complete" ) {
-            document.detachEvent( "onreadystatechange", DOMContentLoaded );
-            onReady();
-        }
-    };
-}
-if ( document.readyState === "complete" ) {
-    // Handle it asynchronously to allow scripts the opportunity to delay ready
-    setTimeout( onReady, 1 );
-}
-
-// Mozilla, Opera and webkit support this event
-if ( document.addEventListener ) {
-    // Use the handy event callback
-    document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-    // A fallback to window.onload, that will always work
-    window.addEventListener( "load", onReady, false );
-    // If IE event model is used
-} else if ( document.attachEvent ) {
-    // ensure firing before onload,
-    // maybe late but safe also for iframes
-    document.attachEvent("onreadystatechange", DOMContentLoaded);
-
-    // A fallback to window.onload, that will always work
-    window.attachEvent( "onload", onReady );
-}
-
-function onReady( ) {
-  document.getElementById('widgetwci').innerHTML = wciwidgetcode;
-}
-</script>
+<script type="text/javascript" src="{/literal}{php}echo $extension_root_path;{/php}{literal}/extern/wciembed.js"></script>
 <div id='widgetwci'></div></textarea>{/literal}
           <div class="grippie" style="margin-right: 18px;"></div>
         </span>
@@ -92,13 +53,8 @@ function onReady( ) {
     <div class="content">
    {* {include file="CRM/Wci/Page/wciwidget.tpl"} *}
 
-<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
 <script type="text/javascript" src="{php}echo $widget_controller_path;{/php}?widgetId={php}echo $wid_id;{/php}&embed=0"></script>
-<script>
-  $( document ).ready(function()  {ldelim} 
-    $('#widgetwci').html(wciwidgetcode);
-   {rdelim} );
-</script>
+<script type="text/javascript" src="{/literal}{php}echo $extension_root_path;{/php}{literal}/extern/wciembed.js"></script>
 <div id='widgetwci'></div>
 
     </div>
index 4c3320e6657acc2ad021a524887dc4853ee18d13..4f61252677cfa876119e8fdf50e3d37a6992def6 100644 (file)
         <p style="text-align:center; margin: 0;">
           Get the monthly newsletter
         </p>
-        <p style="text-align:left;">email id:
-          <input type="text" id="frmEmail" name="email" size="10">
-        </p>
+          <input type="text" id="frmEmail" name="email" size="10" placeholder="Email id" style="margin: 0 11%; width: 75%;">
         <p style="text-align: center; margin-top: 10px;">
           {if $embed eq 1 }
             <input type="submit" name="_qf_Subscribe_next" value="Subscribe Me">