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 2016/04/29 21:00:30 UTC
airavata-php-gateway git commit: Notices User Side Implementation
Repository: airavata-php-gateway
Updated Branches:
refs/heads/develop 2fb0e4c29 -> 396346f6a
Notices User Side Implementation
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/396346f6
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/396346f6
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/396346f6
Branch: refs/heads/develop
Commit: 396346f6a9b29909b37c95d5f9d04ce5349965ca
Parents: 2fb0e4c
Author: Nipurn Doshi <ni...@gmail.com>
Authored: Fri Apr 29 14:59:47 2016 -0400
Committer: Nipurn Doshi <ni...@gmail.com>
Committed: Fri Apr 29 14:59:47 2016 -0400
----------------------------------------------------------------------
app/controllers/AccountController.php | 5 ++
app/controllers/AdminController.php | 2 +-
app/libraries/AdminUtilities.php | 4 --
app/libraries/CommonUtilities.php | 80 ++++++++++++++++++++-------
app/routes.php | 2 +
app/views/admin/manage-notices.blade.php | 3 +
app/views/layout/basic.blade.php | 9 +++
public/css/bootstrap.min.css | 26 +++++++--
8 files changed, 102 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/396346f6/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index ffc49b5..89b408b 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -438,4 +438,9 @@ class AccountController extends BaseController
return 'result';
}
+ public function noticeSeenAck(){
+ Session::put( "notice-count", Input::get("notice-count"));
+ Session::put("notice-seen", true);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/396346f6/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 520ce5a..dae85b4 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -370,7 +370,7 @@ class AdminController extends BaseController {
public function noticesView(){
Session::put("admin-nav", "notices");
$notices = array();
- $notices = array_reverse( AdminUtilities::get_all_notices() );
+ $notices = array_reverse( CommonUtilities::get_all_notices() );
return View::make("admin/manage-notices", array("notices" => $notices));
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/396346f6/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index 8fb15ec..23994e0 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -111,10 +111,6 @@ class AdminUtilities
}
}
- public static function get_all_notices(){
- return Airavata::getAllNotifications( Session::get('authz-token'), Session::get("gateway_id"));
- }
-
public static function add_or_update_notice( $notifData, $update = false){
$notification = new Notification();
$notification->gatewayId = Session::get("gateway_id");
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/396346f6/app/libraries/CommonUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CommonUtilities.php b/app/libraries/CommonUtilities.php
index bfb1e5c..d5ce6c0 100644
--- a/app/libraries/CommonUtilities.php
+++ b/app/libraries/CommonUtilities.php
@@ -1,4 +1,5 @@
<?php
+use Airavata\Model\Workspace\Notification;
class CommonUtilities
{
@@ -115,20 +116,6 @@ class CommonUtilities
)
);
-// if (Session::has("admin")) {
-// $menus['Compute Resource'] = array
-// (
-// array('label' => 'Register', 'url' => URL::to('/') . '/cr/create', "nav-active" => "compute-resource"),
-// array('label' => 'Browse', 'url' => URL::to('/') . '/cr/browse', "nav-active" => "compute-resource")
-// );
-// $menus['App Catalog'] = array
-// (
-// array('label' => 'Module', 'url' => URL::to('/') . '/app/module', "nav-active" => "app-catalog"),
-// array('label' => 'Interface', 'url' => URL::to('/') . '/app/interface', "nav-active" => "app-catalog"),
-// array('label' => 'Deployment', 'url' => URL::to('/') . '/app/deployment', "nav-active" => "app-catalog")
-// );
-// }
-
if( isset( Config::get('pga_config.portal')['jira-help']))
{
$menus['Help'] = array();
@@ -153,7 +140,7 @@ class CommonUtilities
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-2">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@@ -165,7 +152,7 @@ class CommonUtilities
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
- <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+ <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
<ul class="nav navbar-nav">';
@@ -212,10 +199,13 @@ class CommonUtilities
if ("user-console" == Session::get("nav-active"))
$active = " active ";
}
- echo '<li style="color:#fff; relative">' .
- '<span class="glyphicon glyphicon-bell notif-bell"></span>' .
- '<span class="notif-num" style="">2</span>' .
- '</li>';
+
+ //notification bell
+ $notices = array();
+ $notices = array_reverse( CommonUtilities::get_all_notices() );
+ echo CommonUtilities::get_notices_ui( $notices);
+
+
if (Session::has("admin") || Session::has("admin-read-only"))
echo '<li class="' . $active . '"><a href="' . URL::to("/") . '/admin/dashboard"><span class="glyphicon glyphicon-user"></span>Admin Dashboard</a></li>';
// else
@@ -238,6 +228,47 @@ class CommonUtilities
echo '</div></div></nav>';
}
+ public static function get_notices_ui( $notices){
+
+ $notifVisibility = "";
+ $countOfNotices = count( $notices);
+ $newNotices = 0;
+ if( Session::has("notice-count")){
+ $newNotices = $countOfNotices - Session::get("notice-count");
+ if( !$newNotices)
+ $notifVisibility = "hide";
+ }
+ else
+ $newNotices = count( $notices);
+
+ $noticesUI = '<li clas="dropdown" style="color:#fff; relative">' .
+ '<a href="#" class="dropdown-toggle notif-link" data-toggle="dropdown">' .
+ '<span class="glyphicon glyphicon-bell notif-bell"></span>' .
+ '<span class="notif-num ' . $notifVisibility . '" data-total-notices="' . $countOfNotices . '">' . $newNotices . '</span>'.
+ '<div class="dropdown-menu widget-notifications no-padding" style="width: 300px"><div class="slimScrollDiv" style="position: relative; overflow-y: scroll; overflow-x:hidden; width: auto; height: 250px;"><div class="notifications-list" id="main-navbar-notifications" style=" width: auto; height: 250px;">';
+
+ foreach( $notices as $notice){
+ $noticesUI .= '
+ <div class="notification">
+ <div class="notification-title text-primary">' . $notice->title . '</div>
+ <div class="notification-description"><strong></strong>' . $notice->notifcationMessage . '</div>
+ <div class="notification-ago">' . date("m/d/Y h:i:s A T", $notice->publishedtime) . '</div>
+ <div class="notification-icon"></div>
+ </div> <!-- / .notification -->
+ ';
+ }
+ $noticesUI .= '
+ </div><div class="slimScrollBar" style="width: 7px; position: absolute; top: 0px; opacity: 0.4; display: none; border-radius: 7px; z-index: 99; right: 1px; height: 195.925px; background: rgb(0, 0, 0);"></div>
+
+ <div class="slimScrollRail" style="width: 7px; height: 100%; position: absolute; top: 0px; display: none; border-radius: 7px; opacity: 0.2; z-index: 90; right: 1px; background: rgb(51, 51, 51);"></div></div> <!-- / .notifications-list -->
+ <a href="#" class="notifications-link">MORE NOTIFICATIONS</a>
+ </div>'.
+ '</a>'.
+ '</li>';
+
+ return $noticesUI;
+ }
+
/**
* Add attributes to the HTTP header.
*/
@@ -266,5 +297,14 @@ class CommonUtilities
throw new Exception('Error: Cannot open tokens database!');
}
}
+
+ /**
+ * Get All Notifications for a gateway
+ * @param
+ *
+ */
+ public static function get_all_notices(){
+ return Airavata::getAllNotifications( Session::get('authz-token'), Session::get("gateway_id"));
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/396346f6/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 42b59f9..9391d52 100644
--- a/app/routes.php
+++ b/app/routes.php
@@ -293,6 +293,8 @@ Route::post("update-notice", "AdminController@updateNotice");
Route::post("delete-notice", "AdminController@deleteNotice");
+Route::post("notice-seen-ack", "AccountController@noticeSeenAck");
+
//Super Admin Specific calls
Route::post("admin/add-gateway", "AdminController@addGateway");
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/396346f6/app/views/admin/manage-notices.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-notices.blade.php b/app/views/admin/manage-notices.blade.php
index 24c0a6e..2c0a84d 100644
--- a/app/views/admin/manage-notices.blade.php
+++ b/app/views/admin/manage-notices.blade.php
@@ -38,6 +38,7 @@
</div>
@endif
<h4 class="text-center">Existing Notices</h4>
+ <div class="table-responsive">
<table class="table table-bordered table-condensed" style="word-wrap: break-word;">
<tr>
<th>Notice</th>
@@ -56,6 +57,7 @@
</td>
<td>
{{ $notice->notifcationMessage}}
+ </td>
<td class="time" unix-time="{{ $notice->publishedtime/1000 }}">
{{ $notice->publishedtime }}
</td>
@@ -79,6 +81,7 @@
@endforeach
</tbody>
</table>
+ </div>
</div>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/396346f6/app/views/layout/basic.blade.php
----------------------------------------------------------------------
diff --git a/app/views/layout/basic.blade.php b/app/views/layout/basic.blade.php
index 575eca4..0895883 100755
--- a/app/views/layout/basic.blade.php
+++ b/app/views/layout/basic.blade.php
@@ -108,6 +108,15 @@ var fullName = "{{Session::get("user-profile")["firstname"] . " " . Session::get
'slow');
$(".seagrid-info").scrollTop( $(window).scrollTop() + 150);
})
+
+ $(".notif-link").click( function(){
+ $.ajax({
+ type:"post",
+ url:"{{URL::to('/')}}/notice-seen-ack",
+ data:{"notice-count": $(".notif-num").data("total-notices")}
+ });
+ $(".notif-num").addClass("fade");
+ })
</script>
<!-- Google Analytics for portal-->
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/396346f6/public/css/bootstrap.min.css
----------------------------------------------------------------------
diff --git a/public/css/bootstrap.min.css b/public/css/bootstrap.min.css
index 715c62e..3e364dd 100644
--- a/public/css/bootstrap.min.css
+++ b/public/css/bootstrap.min.css
@@ -65,16 +65,34 @@ body{
}
.notif-bell{
- margin:15px;
+
font-size:1.5em;
}
.notif-num{
background: red;
border-radius: 20px;
- padding: 7px;
+ padding: 5px;
position: absolute;
top: 0px;
left: 50%;
- font-size: 0.6em;
- }
\ No newline at end of file
+ color: #efefef;
+ }
+
+ .notif-link, .notif-link:hover, .notif-link:active, .notif-link:focus{
+ text-decoration: none;
+ cursor: default;
+ padding: 15px !important;
+ padding-bottom: 0 !important;
+ }
+
+
+.widget-notifications .notification{position:relative;padding:7px 12px; text-decoration:none;}
+.widget-notifications .notification+.notification{border-top:1px solid #e4e4e4}
+.widget-notifications .notifications-list{position:relative}
+.widget-notifications .notification-ago,.widget-notifications .notification-description,.widget-notifications .notification-title{display:block;margin-right:35px}
+.widget-notifications .notification-title{font-size:11px;font-weight:700;padding-bottom:1px}.widget-notifications .notification-description{font-size:11px;color:#666}.widget-notifications .notification-ago{font-size:11px;font-style:italic;color:#bbb}
+.widget-notifications .notification-icon{width:26px;height:26px;line-height:26px;text-align:center;border-radius:2px;position:absolute;top:50%;right:0;margin:-13px 12px 0 0;font-size:14px}
+.widget-notifications .notifications-link{text-align:center;padding:8px 0!important;border-top:1px solid #e4e4e4;display:block;text-decoration:none!important;font-size:10px;font-weight:800;color:#999;line-height:18px!important;height:auto!important}
+.widget-notifications .notifications-link:hover{background:#f4f4f4;color:#555; text-decoration:none;}
+.widget-notifications:hover{text-decoration:none;}
\ No newline at end of file