Merge pull request #88 from shivamriky/re_route_admin

Reroute admin module to Django portal.
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index 5a85cc8..41c0e9e 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -276,7 +276,17 @@
          * Set this to true if theme has set links to login
          */
         'theme-based-login-links-configured' => false,
-        
+
+        /**
+         * Set the URL of the new Django portal for re-routing
+         */
+        'airavata-django-url' => "https://django.seagrid.org/",
+
+        /**
+         * Set to true to enable reroute to the new Django portal
+         */
+        'reroute-to-django' => true,
+
         /**
          * Set JIRA Issue Collector scripts here.
          */
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index e05d2ce..7c40615 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -8,6 +8,11 @@
 		Session::put("nav-active", "user-console");
 	}
 
+	public function reRoute(){
+		$data["djangoURL"] = Config::get('pga_config.portal')['airavata-django-url'];
+		return View::make("admin/redirect-django", $data);
+	}
+
 	public function dashboard(){
         $userInfo = array();
         $data = array();
diff --git a/app/routes.php b/app/routes.php
index 9e876d6..4935d71 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -302,8 +302,13 @@
 
 
 //Management Dashboard
-
-Route::get("admin/dashboard", "AdminController@dashboard");
+//Added to reroute the admin page to the new django portal
+if(  Config::get('pga_config.portal')['super-admin-portal'] == false and  Config::get('pga_config.portal')['reroute-to-django'] == true){
+  Route::get("admin/dashboard", "AdminController@reRoute");
+}
+else{
+  Route::get("admin/dashboard", "AdminController@dashboard");
+}
 
 Route::get("admin/dashboard/gateway", "AdminController@gatewayView");
 
diff --git a/app/views/admin/redirect-django.blade.php b/app/views/admin/redirect-django.blade.php
new file mode 100644
index 0000000..98372ce
--- /dev/null
+++ b/app/views/admin/redirect-django.blade.php
@@ -0,0 +1,39 @@
+@extends('layout.basic')
+
+@section('page-header')
+@parent
+{{ HTML::style('css/admin.css')}}
+@stop
+<META HTTP-EQUIV="refresh" CONTENT="10;URL={{ $djangoURL }}">
+@section('content')
+<div class="container">
+  <p style="color:red;font-size:300%"> ATTENTION!!! </p>
+  <p style="color:black;font-size:150%;font-weight:bold">
+  We are moving to the new Django portal. For admin related activies, please
+  go to the new Django portal <a href={{ $djangoURL }} >{{ $djangoURL}}. </a>
+  This page will automatically redirect to the new Django portal in 10 seconds.</p>
+  <p id="demo" style="color:black;font-weight:bold;font-size:200%;text-align:center"></p>
+</div>
+
+@stop
+
+@section('scripts')
+@parent
+<script>
+// Set the date we're counting down to
+num = 10;
+// Update the count down every 1 second
+var x = setInterval(function() {
+
+  num = num-1;
+  // Output the result in an element with id="demo"
+  document.getElementById("demo").innerHTML = num;
+
+  // If the count down is over, write some text
+  if (num < 0) {
+    clearInterval(x);
+    document.getElementById("demo").innerHTML = "EXPIRED";
+  }
+}, 1000);
+</script>
+@stop