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/09/18 17:18:51 UTC

[3/3] airavata-php-gateway git commit: First Implementation of theming completed.

First Implementation of theming completed.


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/014bbe92
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/014bbe92
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/014bbe92

Branch: refs/heads/master
Commit: 014bbe92639dd9528c25bfe30133b8578b392ecd
Parents: 3d249a5
Author: Nipurn Doshi <ni...@gmail.com>
Authored: Fri Sep 18 11:18:02 2015 -0400
Committer: Nipurn Doshi <ni...@gmail.com>
Committed: Fri Sep 18 11:18:02 2015 -0400

----------------------------------------------------------------------
 app/config/packages/teepluss/theme/config.php |   4 +-
 app/controllers/BaseController.php            |   5 +
 app/views/home.blade.php                      |  93 +++++-------
 app/views/layout/basic.blade.php              | 159 +++++++--------------
 app/views/layout/fixed-footer.blade.php       |   0
 app/views/layout/fixed-header.blade.php       |  13 ++
 app/views/layout/fixed-scripts.blade.php      |  71 +++++++++
 themes/base/layouts/default.blade.php         |   1 +
 themes/base/partials/footer.blade.php         |   0
 themes/base/partials/header.php               |   0
 themes/base/partials/template.blade.php       |   0
 themes/base/views/index.blade.php             |   0
 themes/base/views/test.blade.php              |   1 +
 13 files changed, 181 insertions(+), 166 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/app/config/packages/teepluss/theme/config.php
----------------------------------------------------------------------
diff --git a/app/config/packages/teepluss/theme/config.php b/app/config/packages/teepluss/theme/config.php
index a0631cd..e36f52c 100644
--- a/app/config/packages/teepluss/theme/config.php
+++ b/app/config/packages/teepluss/theme/config.php
@@ -63,7 +63,7 @@ return array(
 	|
 	*/
 
-	'themeDefault' => 'default',
+	'themeDefault' => 'base',
 
 	/*
 	|--------------------------------------------------------------------------
@@ -86,7 +86,7 @@ return array(
 	|
 	*/
 
-	'themeDir' => 'themes',
+	'themeDir' => '/../themes',
 
 	/*
 	|--------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/app/controllers/BaseController.php
----------------------------------------------------------------------
diff --git a/app/controllers/BaseController.php b/app/controllers/BaseController.php
index 2bee464..f8b3724 100755
--- a/app/controllers/BaseController.php
+++ b/app/controllers/BaseController.php
@@ -9,6 +9,11 @@ class BaseController extends Controller {
 	 */
 	protected function setupLayout()
 	{
+		//set your chosen theme here. default is basic.
+		$theme = Theme::uses("base"); 
+		Session::put( "theme", "base");
+
+		
 		if ( ! is_null($this->layout))
 		{
 			$this->layout = View::make($this->layout);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/app/views/home.blade.php
----------------------------------------------------------------------
diff --git a/app/views/home.blade.php b/app/views/home.blade.php
index 7ba99ee..9fd2493 100755
--- a/app/views/home.blade.php
+++ b/app/views/home.blade.php
@@ -1,68 +1,45 @@
 @extends('layout.basic')
 
-@section('page-header')
-@parent
-@stop
-
 @section('content')
 
+<?php
+
+if (CommonUtilities::id_in_session()) {
+
+    if (Session::has("admin"))
+        $admin = " Admin";
+    else
+        $admin = "";
+
+    echo '<div class="well"><div class="container"><h4>Welcome' . $admin . ', ' . Session::get("username") . '!</h4></div></div>';
+}
+
+?>
+
+<?php 
+if( Session::get("theme") == "base"){?>
 <div class="well">
     <div class="container">
-
-        <?php
-
-        if (CommonUtilities::id_in_session()) {
-            $columnClass = 'col-md-4';
-            if (Session::has("admin"))
-                $admin = " Admin";
-            else
-                $admin = "";
-
-            echo '<h4>Welcome' . $admin . ', ' . Session::get("username") . '!</h4>';
-        } else {
-            $columnClass = 'col-md-6';
-
-            echo '
-                <h1>PHP Gateway with Airavata</h1>
-                <p>
-                    PGA is a science gateway built with the Airavata API. You can reference PGA as you integrate Airavata
-                    into your own gateway, or you can create your gateway on top of PGA by cloning it at the link below.
-                    PGA is known to work well in the Chrome, Firefox, and Internet Explorer browsers.
-                </p>
-                <p><a href="https://github.com/apache/airavata-php-gateway"
-                        target="_blank">See the code <span class="glyphicon glyphicon-new-window"></span></a></p>
-                <p><a href="https://cwiki.apache.org/confluence/display/AIRAVATA/XSEDE+2015+Tutorial"
-                    target="_blank">XSEDE 2015 tutorial documentation <span class="glyphicon glyphicon-new-window"></span></a></p>
-            ';
-        }
-        ?>
+        <h1>PHP Gateway with Airavata</h1>
+        <p>
+            PGA is a science gateway built with the Airavata API. You can reference PGA as you integrate Airavata
+            into your own gateway, or you can create your gateway on top of PGA by cloning it at the link below.
+            PGA is known to work well in the Chrome, Firefox, and Internet Explorer browsers.
+        </p>
+        <p><a href="https://github.com/apache/airavata-php-gateway"
+                target="_blank">See the code <span class="glyphicon glyphicon-new-window"></span></a></p>
+        <p><a href="https://cwiki.apache.org/confluence/display/AIRAVATA/XSEDE+2015+Tutorial"
+            target="_blank">XSEDE 2015 tutorial documentation <span class="glyphicon glyphicon-new-window"></span></a>
+        </p>
     </div>
 </div>
 
+
 <div class="container">
 
     <div class="row">
-        <?php
-
-        if (CommonUtilities::id_in_session()) {
-            echo '
-                <div class="col-md-4">
-                    <h2>PHP Gateway with Airavata</h2>
-                    <p>
-                        PGA is a science gateway built with the Airavata API. You can reference PGA as you integrate
-                        Airavata into your own gateway, or you can create your gateway on top of PGA by cloning it at
-                        the link below. PGA is known to work well in the Chrome, Firefox, and Internet Explorer browsers.
-                    </p>
-                    <p><a href="https://github.com/apache/airavata-php-gateway/"
-                        target="_blank">See the code <span class="glyphicon glyphicon-new-window"></span></a></p>
-                    <p><a href="https://cwiki.apache.org/confluence/display/AIRAVATA/XSEDE+2015+Tutorial"
-                        target="_blank">View the XSEDE 2015 tutorial documentation <span class="glyphicon glyphicon-new-window"></span></a></p>
-                </div>
-            ';
-        }
 
-        ?>
-        <div class="<?php echo $columnClass; ?>">
+        <div class="col-md-6">
             <div class="thumbnail" style="border:none">
                 <img src="assets/scigap-header-logo.png" alt="SciGaP">
 
@@ -85,13 +62,13 @@
                 </div>
             </div>
         </div>
-        <div class="<?php echo $columnClass; ?>">
+        <div class="col-md-6">
             <div class="thumbnail" style="border:none">
                 <img src="assets/PoweredbyAiravata_Small.png" alt="Apache Airavata">
 
                 <div class="caption">
                     <p>
-                        Apache Airavata is a software framework which is dominantly used to build Web-based science
+                        Apache Airavata is a softwar    e framework which is dominantly used to build Web-based science
                         gateways and assist to compose, manage, execute and monitor large scale applications and
                         workflows on distributed computing resources such as local clusters, supercomputers, national
                         grids, academic and commercial clouds. Airavata mainly supports long running applications and
@@ -107,5 +84,13 @@
 
 </div>
 
+<?php 
+}
+else
+{
+    $theme = Theme::uses( Session::get("theme"));
+    echo $theme->partial("template");
+}
+?>
 @stop
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/app/views/layout/basic.blade.php
----------------------------------------------------------------------
diff --git a/app/views/layout/basic.blade.php b/app/views/layout/basic.blade.php
index 0b9637a..b1d941c 100755
--- a/app/views/layout/basic.blade.php
+++ b/app/views/layout/basic.blade.php
@@ -1,125 +1,64 @@
+<?php 
+$theme = Theme::uses(Session::get("theme"));
+?>
+
 @section ('page-header')
 
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <title>PHP Reference Gateway</title>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <link rel="icon" href="resources/assets/favicon.ico" type="image/x-icon">
-    {{ HTML::style('css/bootstrap.min.css')}}
-    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
-    <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
-
-    <?php
-        if(Session::has("user-profile")){
-            echo "<script>\n";
-            echo "var email = '" . Session::get("user-profile")["email"] . "'\n";
-            echo "var fullName = '" . Session::get("user-profile")["firstname"]
-                . " " . Session::get("user-profile")["lastname"] . "'";
-            echo "</script>";
-        }
-    ?>
-</head>
-
-<?php
-
-//Is there a need to connect to id store at this point? Commented for now.
-//Utilities::connect_to_id_store();
+@include("layout/fixed-header", array(
+                            "title" => "PHP Reference Gateway"
+                        ))
+
+@show
+
+<!-- Header from theme -->
+@if( isset($theme) )
+{{ $theme->partial("header") }}
+@endif
 
-?>
 
 <body>
 
-<?php CommonUtilities::create_nav_bar(); ?>
-
-<?php
-// Alerts if guests users try to go to the link without signing in.
-if (Session::has("login-alert")) {
-    CommonUtilities::print_error_message("You need to login to use this service.");
-    Session::forget("login-alert");
-}
-// if signed in user is not an admin.
-if (Session::has("admin-alert")) {
-    CommonUtilities::print_error_message("You need to be an admin to use this service.");
-    Session::forget("admin-alert");
-}
-?>
+<!-- Getting user info -->
+@if(Session::has("user-profile"))
+<script>
+var email = {{ Session::get("user-profile")["email"] }} . "'\n";
+var fullName = {{ Session::get("user-profile")["firstname"] . " " . Session::get("user-profile")["lastname"] . "'" }}
+</script>
+@endif
 
-@show
+{{ CommonUtilities::create_nav_bar() }}
+
+
+<!-- Handling error on pages --> 
+<!--  Alerts if guests users try to go to the link without signing in. -->
+@if (Session::has("login-alert")) 
+    {{ CommonUtilities::print_error_message("You need to login to use this service.") }}
+    {{ Session::forget("login-alert") }}
+@endif
+<!-- if signed in user is not an admin. -->
+@if (Session::has("admin-alert"))
+    {{ CommonUtilities::print_error_message("You need to be an admin to use this service.") }}
+    {{ Session::forget("admin-alert") }}
+@endif
 
+<!--  PGA UI lies here. Do not touch. -->
 @yield('content')
 
+
+@include('layout/fixed-footer')
+
 </body>
-@section('scripts')
-<!-- Jira Issue Collector - Report Issue -->
-<script type="text/javascript"
-        src="https://gateways.atlassian.net/s/31280375aecc888d5140f63e1dc78a93-T/en_USmlc07/6328/46/1.4.13/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=b1572922"></script>
-
-<!-- Jira Issue Collector - Request Feature -->
-<script type="text/javascript"
-        src="https://gateways.atlassian.net/s/31280375aecc888d5140f63e1dc78a93-T/en_USmlc07/6328/46/1.4.13/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=674243b0"></script>
-
-
-<script type="text/javascript">
-    window.ATL_JQ_PAGE_PROPS = $.extend(window.ATL_JQ_PAGE_PROPS, {
-        "b1572922": {
-            "triggerFunction": function (showCollectorDialog) {
-                //Requries that jQuery is available!
-                jQuery("#report-issue").click(function (e) {
-                    e.preventDefault();
-                    showCollectorDialog();
-                });
-            },fieldValues: {
-                email : email !== 'undefined' ? email : "",
-                fullname : fullName !== 'undefined' ? fullName : ""
-            }
-        },
-        "674243b0": {
-            "triggerFunction": function (showCollectorDialog) {
-                //Requries that jQuery is available!
-                jQuery("#request-feature").click(function (e) {
-                    e.preventDefault();
-                    showCollectorDialog();
-                });
-            },fieldValues: {
-                email : email !== 'undefined' ? email : "",
-                fullname : fullName !== 'undefined' ? fullName : ""
-            }
-        }
-    });
-
-    var highest = null;
-    $(".nav-tabs a").each(function () {  //find the height of your highest link
-        var h = $(this).height();
-        if (h > highest) {
-            highest = $(this).height();
-        }
-    });
-
-    $(".nav-tabs a").height(highest);  //set all your links to that height.
-
-
-    // not letting users to add only spaces in text boxes.
-    $("body").on("blur", ".form-control", function () {
-        $(this).val($.trim($(this).val()));
-    });
-
-    //find users' current time.
-    if ("{{ Session::get('user_time') }}".length == 0) {
-        var visitortime = new Date();
-        var visitortimezone = visitortime.getTimezoneOffset() / 60;
-        $.ajax({
-            type: "GET",
-            url: "{{URL::to('/')}}/setUserTimezone",
-            data: 'timezone=' + visitortimezone,
-            success: function () {
-                //location.reload();
-            }
-        });
-    }
-</script>
 
 @show
 
+
+@section('scripts')
+@include('layout/fixed-scripts')
+@show
+
+@if( isset( $theme))
+{{ $theme->partial("footer") }}
+@endif
+
+
 </html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/app/views/layout/fixed-footer.blade.php
----------------------------------------------------------------------
diff --git a/app/views/layout/fixed-footer.blade.php b/app/views/layout/fixed-footer.blade.php
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/app/views/layout/fixed-header.blade.php
----------------------------------------------------------------------
diff --git a/app/views/layout/fixed-header.blade.php b/app/views/layout/fixed-header.blade.php
new file mode 100644
index 0000000..7f3054d
--- /dev/null
+++ b/app/views/layout/fixed-header.blade.php
@@ -0,0 +1,13 @@
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <title>{{ $title }}</title>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <link rel="icon" href="resources/assets/favicon.ico" type="image/x-icon">
+    {{ HTML::style('css/bootstrap.min.css')}}
+
+    
+</head>
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/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
new file mode 100644
index 0000000..b245d97
--- /dev/null
+++ b/app/views/layout/fixed-scripts.blade.php
@@ -0,0 +1,71 @@
+<!-- Jira Issue Collector - Report Issue -->
+
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
+
+<script type="text/javascript"
+        src="https://gateways.atlassian.net/s/31280375aecc888d5140f63e1dc78a93-T/en_USmlc07/6328/46/1.4.13/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=b1572922"></script>
+
+<!-- Jira Issue Collector - Request Feature -->
+<script type="text/javascript"
+        src="https://gateways.atlassian.net/s/31280375aecc888d5140f63e1dc78a93-T/en_USmlc07/6328/46/1.4.13/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?locale=en-US&collectorId=674243b0"></script>
+
+
+<script type="text/javascript">
+    window.ATL_JQ_PAGE_PROPS = $.extend(window.ATL_JQ_PAGE_PROPS, {
+        "b1572922": {
+            "triggerFunction": function (showCollectorDialog) {
+                //Requries that jQuery is available!
+                jQuery("#report-issue").click(function (e) {
+                    e.preventDefault();
+                    showCollectorDialog();
+                });
+            },fieldValues: {
+                email : email !== 'undefined' ? email : "",
+                fullname : fullName !== 'undefined' ? fullName : ""
+            }
+        },
+        "674243b0": {
+            "triggerFunction": function (showCollectorDialog) {
+                //Requries that jQuery is available!
+                jQuery("#request-feature").click(function (e) {
+                    e.preventDefault();
+                    showCollectorDialog();
+                });
+            },fieldValues: {
+                email : email !== 'undefined' ? email : "",
+                fullname : fullName !== 'undefined' ? fullName : ""
+            }
+        }
+    });
+
+    var highest = null;
+    $(".nav-tabs a").each(function () {  //find the height of your highest link
+        var h = $(this).height();
+        if (h > highest) {
+            highest = $(this).height();
+        }
+    });
+
+    $(".nav-tabs a").height(highest);  //set all your links to that height.
+
+
+    // not letting users to add only spaces in text boxes.
+    $("body").on("blur", ".form-control", function () {
+        $(this).val($.trim($(this).val()));
+    });
+
+    //find users' current time.
+    if ("{{ Session::get('user_time') }}".length == 0) {
+        var visitortime = new Date();
+        var visitortimezone = visitortime.getTimezoneOffset() / 60;
+        $.ajax({
+            type: "GET",
+            url: "{{URL::to('/')}}/setUserTimezone",
+            data: 'timezone=' + visitortimezone,
+            success: function () {
+                //location.reload();
+            }
+        });
+    }
+</script>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/themes/base/layouts/default.blade.php
----------------------------------------------------------------------
diff --git a/themes/base/layouts/default.blade.php b/themes/base/layouts/default.blade.php
new file mode 100644
index 0000000..5f7513a
--- /dev/null
+++ b/themes/base/layouts/default.blade.php
@@ -0,0 +1 @@
+@include('home')
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/themes/base/partials/footer.blade.php
----------------------------------------------------------------------
diff --git a/themes/base/partials/footer.blade.php b/themes/base/partials/footer.blade.php
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/themes/base/partials/header.php
----------------------------------------------------------------------
diff --git a/themes/base/partials/header.php b/themes/base/partials/header.php
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/themes/base/partials/template.blade.php
----------------------------------------------------------------------
diff --git a/themes/base/partials/template.blade.php b/themes/base/partials/template.blade.php
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/themes/base/views/index.blade.php
----------------------------------------------------------------------
diff --git a/themes/base/views/index.blade.php b/themes/base/views/index.blade.php
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/014bbe92/themes/base/views/test.blade.php
----------------------------------------------------------------------
diff --git a/themes/base/views/test.blade.php b/themes/base/views/test.blade.php
new file mode 100644
index 0000000..30d74d2
--- /dev/null
+++ b/themes/base/views/test.blade.php
@@ -0,0 +1 @@
+test
\ No newline at end of file