You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by nd...@apache.org on 2015/11/03 21:48:28 UTC

[2/2] airavata-php-gateway git commit: 1) Google Analytics capability added for portals 2) Improved code conditions so that changes in pga_config do not affect existing portals.

1) Google Analytics capability added for portals
2) Improved code conditions so that changes in pga_config do not affect
existing portals.

pga_config should be updated for jira-help and google analytics to work.

Signed-off-by: Nipurn Doshi <Nipurn Doshi>


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/6aae243f
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/6aae243f
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/6aae243f

Branch: refs/heads/master
Commit: 6aae243f35a7d57c9aac6e88f78849ad4bffc3b6
Parents: 5e910ed
Author: Nipun Doshi <Nipun Doshi>
Authored: Tue Nov 3 15:47:48 2015 -0500
Committer: Nipun Doshi <Nipun Doshi>
Committed: Tue Nov 3 15:47:48 2015 -0500

----------------------------------------------------------------------
 app/config/pga_config.php.template       | 13 +++++++++++-
 app/libraries/CommonUtilities.php        | 29 +++++++++++++++------------
 app/views/layout/basic.blade.php         | 20 ++++++++++++++++++
 app/views/layout/fixed-scripts.blade.php |  4 ++--
 4 files changed, 50 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6aae243f/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index 54ee652..44b81ce 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -223,6 +223,17 @@ return array(
              * Collector id at the end of the above script
              */
             'request-feature-collector-id' => ''
-        ]
+        ],
+
+        /**
+         * Set Google Analytics Id here. ID format that generates from  
+         * creating tracker object should be 
+         *
+         * UA-XXXXX-Y 
+         *
+         * for it to be working correctly. Currently it is only set for 
+         * sending pageviews.
+         */
+        'google-analytics-id' => ''
     ]
 );
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6aae243f/app/libraries/CommonUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CommonUtilities.php b/app/libraries/CommonUtilities.php
index f8f96fb..4c55d7b 100644
--- a/app/libraries/CommonUtilities.php
+++ b/app/libraries/CommonUtilities.php
@@ -129,21 +129,24 @@ class CommonUtilities
 //                );
 //            }
 
-            $menus['Help'] = array();
-            if( Config::get('pga_config.portal')['jira-help']['report-issue-script'] != '' 
-                && Config::get('pga_config.portal')['jira-help']['report-issue-collector-id'] != '')
+            if( isset( Config::get('pga_config.portal')['jira-help']))
             {
-                $menus['Help'][] = array('label' => 'Report Issue', 'url' => '#', "nav-active", "");
-            }  
-//                array('label' => 'Forgot Password?', 'url' => URL::to('/') . '/forgot-password', "nav-active" => "")
-            if( Config::get('pga_config.portal')['jira-help']['request-feature-script'] != '' 
-                && Config::get('pga_config.portal')['jira-help']['request-feature-collector-id'] != '')
-            {
-                $menus['Help'][] = array('label' => 'Request Feature', 'url' => '#', "nav-active", "");
-            }
+                $menus['Help'] = array();
+                if( Config::get('pga_config.portal')['jira-help']['report-issue-script'] != '' 
+                    && Config::get('pga_config.portal')['jira-help']['report-issue-collector-id'] != '')
+                {
+                    $menus['Help'][] = array('label' => 'Report Issue', 'url' => '#', "nav-active", "");
+                }  
+    //                array('label' => 'Forgot Password?', 'url' => URL::to('/') . '/forgot-password', "nav-active" => "")
+                if( Config::get('pga_config.portal')['jira-help']['request-feature-script'] != '' 
+                    && Config::get('pga_config.portal')['jira-help']['request-feature-collector-id'] != '')
+                {
+                    $menus['Help'][] = array('label' => 'Request Feature', 'url' => '#', "nav-active", "");
+                }
 
-            if( count( $menus['Help'] ) == 0 )
-                unset( $menus['Help']);
+                if( count( $menus['Help'] ) == 0 )
+                    unset( $menus['Help']);
+            }
         }
 
         echo '<nav class="navbar navbar-inverse navbar-static-top" role="navigation">

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6aae243f/app/views/layout/basic.blade.php
----------------------------------------------------------------------
diff --git a/app/views/layout/basic.blade.php b/app/views/layout/basic.blade.php
index fae702a..475ba6e 100755
--- a/app/views/layout/basic.blade.php
+++ b/app/views/layout/basic.blade.php
@@ -104,6 +104,26 @@ var fullName = "{{Session::get("user-profile")["firstname"] . " " . Session::get
         $(".seagrid-info").scrollTop( $(window).scrollTop() + 150);
     })
 </script>
+
+<!-- Google Analytics for portal-->
+
+@if( isset( Config::get('pga_config.portal')['google-analytics-id']))
+
+    @if( Config::get("pga_config.portal")["google-analytics-id"] != '')
+    <script>
+      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+      ga('create', '{{ Config::get("pga_config.portal")["google-analytics-id"] }}', 'auto');
+      ga('send', 'pageview');
+
+    </script>
+    @endif
+
+@endif
+<!-- end google analytics --> 
 @show
 
 </html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6aae243f/app/views/layout/fixed-scripts.blade.php
----------------------------------------------------------------------
diff --git a/app/views/layout/fixed-scripts.blade.php b/app/views/layout/fixed-scripts.blade.php
index e4963a3..30c186e 100644
--- a/app/views/layout/fixed-scripts.blade.php
+++ b/app/views/layout/fixed-scripts.blade.php
@@ -4,7 +4,7 @@
 <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
 
 <!-- Jira Issue Collector - Request Feature -->
-
+@if( isset( Config::get('pga_config.portal')['jira-help']))
 <script type="text/javascript"
         src="{{ Config::get('pga_config.portal')['jira-help']['report-issue-script'] }}"></script>
 
@@ -41,7 +41,7 @@
         }
     });
 </script>
-
+@endif
 <script type="text/javascript">
 
     var highest = null;