airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndo...@apache.org
Subject [2/3] airavata-php-gateway git commit: Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/airavata-php-gateway into develop
Date Tue, 03 May 2016 19:16:27 GMT
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/airavata-php-gateway into
develop

# Conflicts:
#	app/libraries/CommonUtilities.php
#	app/views/admin/manage-notices.blade.php


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

Branch: refs/heads/develop
Commit: b280206b5841b45190f6df3e1da4a90189350193
Parents: b01d107 cfdd539
Author: Nipurn Doshi <nipunhere@gmail.com>
Authored: Tue May 3 15:15:22 2016 -0400
Committer: Nipurn Doshi <nipunhere@gmail.com>
Committed: Tue May 3 15:15:22 2016 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php    |   17 +-
 app/filters.php                          |    2 +
 app/libraries/Airavata/API/Airavata.php  | 1175 +++++++++----------------
 app/libraries/CommonUtilities.php        |   56 +-
 app/views/account/dashboard.blade.php    |    2 +-
 app/views/admin/manage-notices.blade.php |   38 +-
 6 files changed, 488 insertions(+), 802 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b280206b/app/libraries/CommonUtilities.php
----------------------------------------------------------------------
diff --cc app/libraries/CommonUtilities.php
index fed4c17,6744079..3c7e248
--- a/app/libraries/CommonUtilities.php
+++ b/app/libraries/CommonUtilities.php
@@@ -101,7 -100,7 +101,7 @@@ class CommonUtilitie
      public static function create_nav_bar()
      {
          $menus = array();
--        if (Session::has('loggedin') && (Session::has('authorized-user') || Session::has('admin')
++        if ( Session::has('loggedin') && (Session::has('authorized-user') || Session::has('admin')
                  || Session::has('admin-read-only'))) {
              $menus = array
              (
@@@ -203,7 -202,7 +203,7 @@@
  
              //notification bell
              $notices = array();
--            $notices = array_reverse( CommonUtilities::get_all_notices() );
++            $notices = CommonUtilities::get_all_notices();
              echo CommonUtilities::get_notices_ui( $notices);
  
  
@@@ -230,43 -229,42 +230,61 @@@
      }
  
      public static function get_notices_ui( $notices){
- 
 +        $notifVisibility = "";
-         $countOfNotices = count( $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){
++        $publishedNoticesCount = 0;
++        $currentTime = floatval( time()*1000);
++        $noticesUI = "";
++        foreach( $notices as $notice){
++            if( $currentTime >= $notice->publishedTime && $currentTime <=
$notice->expirationTime)
++            {
++                $publishedNoticesCount++;
++                $textColor = "text-info";
++                if( $notice->priority == NotificationPriority::LOW)
++                    $textColor = "text-primary";
++                elseif( $notice->priority ==NotificationPriority::NORMAL)
++                    $textColor = "text-warning";
++                elseif( $notice->priority == NotificationPriority::HIGH)
++                    $textColor = "text-danger";
+                 $noticesUI .= '
+                 <div class="notification">
 -                    <div class="notification-title text-primary">' . $notice->title
. '</div>
++                    <div class="notification-title ' . $textColor . '">' . $notice->title
. '</div>
+                     <div class="notification-description"><strong></strong>'
. $notice->notificationMessage . '</div>
 -                    <div class="notification-ago">' . date("m/d/Y h:i:s A T", $notice->publishedTime)
. '</div>
++                    <div class="notification-ago">' . date("m/d/Y h:i:s A T", $notice->publishedTime/1000)
. '</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>
++        }
++
++        $countOfNotices = $publishedNoticesCount;
 +        $newNotices = 0;
 +        if( Session::has("notice-count")){
 +            $newNotices = $countOfNotices - Session::get("notice-count");
 +        }
 +        else
 +            $newNotices = $countOfNotices;
 +
 +        if( !$newNotices)
 +            $notifVisibility = "hide";
 +
 +        $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;">';
++                        '<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; max-height: 250px;"><div class="notifications-list" id="main-navbar-notifications"
style=" width: auto; max-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->notificationMessage . '</div>
-                 <div class="notification-ago">' . date("m/d/Y h:i:s A T", $notice->publishedTime)
. '</div>
-                 <div class="notification-icon"></div>
-             </div> <!-- / .notification -->
-             ';
-         }
 -            <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>';
++                    . $noticesUI;
++
++        
 +        $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>
++        <a href="#" class="notifications-link"><!--MORE NOTIFICATIONS--></a>
 +        </div>'.
 +        '</a>'.
 +            '</li>';
  
          return $noticesUI;
      }   

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b280206b/app/views/admin/manage-notices.blade.php
----------------------------------------------------------------------
diff --cc app/views/admin/manage-notices.blade.php
index 9413e5b,009d84c..3dba216
--- a/app/views/admin/manage-notices.blade.php
+++ b/app/views/admin/manage-notices.blade.php
@@@ -101,7 -100,7 +101,7 @@@
                      
                  </div>
                  <div class="modal-footer">
-                     <input type="submit" class="btn btn-primary submit-add-notice-form"
class="btn btn-primary form-control" value="Create"/>
 -                    <button type="submit" class="btn btn-primary submit-add-notice-form"
class="btn btn-primary form-control" value="Submit">Create</button>
++                    <button type="submit" class="btn btn-primary submit-add-notice-form"
class="btn btn-primary form-control">Create</button>
                  </div>
              </form>
  
@@@ -121,7 -120,7 +121,7 @@@
                      
                  </div>
                  <div class="modal-footer">
-                     <input type="submit" class="btn btn-primary submit-update-notice-form"
class="btn btn-primary form-control" value="Update"/>
 -                    <button type="submit" class="btn btn-primary submit-update-notice-form"
class="btn btn-primary form-control" value="Submit">Update</button>
++                    <button type="submit" class="btn btn-primary submit-update-notice-form"
class="btn btn-primary form-control">Update</button
                  </div>
              </form>
          </div>
@@@ -225,92 -224,72 +225,94 @@@
  
          $(".notices-list").on("click", ".update-notice-icon", function(){
              var noticeData = $(this).parent().data("notice-info");
++            if( typeof noticeData != "object")
++                noticeData = $.parseJSON( noticeData);
              $("#update-notice .modal-body").html( $(".notice-form").html());
  
++            $("#update-notice").modal( "show");
++
              for( var key in noticeData){
                  var formInput = $("#update-notice .notice-" + key);
                  formInput.val( noticeData[key]);
              }
 -            $("#update-notice .notice-publishedTime").val( moment( parseInt( $("#update-notice
.notice-publishedTime").val()) ).format('MM/DD/YYYY hh:mm a') );
 -            $("#update-notice .notice-expirationTime").val( moment( parseInt( $("#update-notice
.notice-expirationTime").val()) ).format('MM/DD/YYYY hh:mm a') );
 -            setDateProperties("#update-notice");
 +            var publishedTimeElem = $("#update-notice .notice-publishedTime");
 +            if( publishedTimeElem.val() != "")
 +                publishedTimeElem.val( moment( parseInt( publishedTimeElem.val())).format('MM/DD/YYYY
hh:mm a') );
  
 -            $("#update-notice").modal( "show");
 +            var expirationTimeElem = $("#update-notice .notice-expirationTime");
 +            if( expirationTimeElem.val() != "")
 +                expirationTimeElem.val( moment( parseInt( expirationTimeElem.val())).format('MM/DD/YYYY
hh:mm a') );
-             
-             setDateProperties("#update-notice");
 +
-             $("#update-notice").modal( "show");
++            setDateProperties("#update-notice");
          });
  
          //Add notice submit
--        $("body").on("click", ".submit-add-notice-form", function(ev){
++        $("body").on("submit", "#create-notice .notice-form-values", function(ev){
              ev.preventDefault();
-             if( $('#create-notice .notice-form-values')[0].checkValidity() ){
-                 $(this).html("<img src='{{URL::to('/')}}/assets/ajax-loader.gif'/>");
 -            $(this).html("<img src='{{URL::to('/')}}/assets/ajax-loader.gif'/>");
 -            var formData = $("#create-notice .notice-form-values").serialize();
 -            formData += "&publishedTime="+ moment( $("#publishedTime").val() ).utc().format('MM/DD/YYYY
hh:mm a');
 -            formData += "&expirationTime="+ moment( $("#expirationTime").val() ).utc().format('MM/DD/YYYY
hh:mm a');
 -            $.ajax({
 -                url: '{{URL::to('/')}}/add-notice',
 -                type: "post",
 -                data: formData,
 -                success: function( data){
 -                    var addedNotice = $.parseJSON( data);
 -                    $(".notices-list").prepend(
 -                        "<tr class='alert alert-success' data-notice-info='" + data +
"'>" + updateRow( addedNotice) + "</tr>"
 -                    );
 -                    $("#create-notice").modal("hide");  
 -                },
 -                error: function(){
 -                    $(".submit-add-notice-form").after("<span alert alert-danger'>An
error has occurred. Please try again later.</span>");
 -                }
 -            }).complete( function(){
 -                    $(".submit-add-notice-form").html("Submit");
 -            });
++
++            if( $(this)[0].checkValidity() ){
++                $(".submit-add-notice-form").html("<img src='{{URL::to('/')}}/assets/ajax-loader.gif'/>");
 +                var formData = $("#create-notice .notice-form-values").serialize();
 +                formData += "&publishedTime="+ moment( $("#create-notice .notice-publishedTime").val()
).utc().format('MM/DD/YYYY hh:mm a');
 +                formData += "&expirationTime="+ moment( $("#create-notice .notice-expirationTime").val()
).utc().format('MM/DD/YYYY hh:mm a');
 +                $.ajax({
 +                    url: '{{URL::to('/')}}/add-notice',
 +                    type: "post",
 +                    data: formData,
 +                    success: function( data){
 +                        var addedNotice = $.parseJSON( data);
 +                        $(".notices-list").prepend(
 +                            "<tr id='notice-'" + addedNotice.notificationId + "' class='alert
alert-success' data-notice-info='" + data + "'>" + updateRow( addedNotice) + "</tr>"
 +                        );
 +                        $("#create-notice").modal("hide");  
 +                    },
 +                    error: function(){
 +                        $(".submit-add-notice-form").after("<span alert alert-danger'>An
error has occurred. Please try again later.</span>");
 +                    }
 +                }).complete( function(){
-                         $(".submit-add-notice-form").html("Submit");
++                        $(".submit-add-notice-form").html("Create");
 +                });
 +            }
          });
  
          //Update Notice Submit
--        $("body").on("click", ".submit-update-notice-form", function(ev){
++        $("body").on("submit", "#update-notice .notice-form-values", function(ev){
              ev.preventDefault();
-             if( $('#update-notice .notice-form-values')[0].checkValidity() ){
-                 $(this).html("<img src='{{URL::to('/')}}/assets/ajax-loader.gif'/>");
 -            $(this).html("<img src='{{URL::to('/')}}/assets/ajax-loader.gif'/>");
 -            var formData = $("#update-notice .notice-form-values").serialize();
 -            formData += "&publishedTime="+ moment( $("#publishedTime").val() ).utc().format('MM/DD/YYYY
hh:mm a');
 -            formData += "&expirationTime="+ moment( $("#expirationTime").val() ).utc().format('MM/DD/YYYY
hh:mm a');
 -            $.ajax({
 -                url: '{{URL::to('/')}}/update-notice',
 -                type: "post",
 -                data: formData,
 -                success: function( data){
 -                    var addedNotice = $.parseJSON( data);
 -                    $("#notice-" + $("#update-notice .notice-notificationId").val() ).html(updateRow(
addedNotice));
 -
 -                    $("#notice-" + $("#update-notice .notice-notificationId").val())
 -                        .addClass("alert")
 -                        .addClass("alert-success")
 -                        .data("notice-info", data);
 -                    $("#update-notice").modal("hide");  
 -                },
 -                error: function(){
 -                    $(".submit-update-notice-form").after("<span alert alert-danger'>An
error has occurred. Please try again later.</span>");
 -                }
 -            }).complete( function(){
 -                    $(".submit-add-notice-form").html("Update");
 -            });
++            if( $(this)[0].checkValidity() ){
++                $(".submit-update-notice-form").html("<img src='{{URL::to('/')}}/assets/ajax-loader.gif'/>");
 +                var formData = $("#update-notice .notice-form-values").serialize();
 +                var publishedTime = $("#update-notice .notice-publishedTime").val();
 +                if( publishedTime != "")
-                     formData += "&publishedTime="+ moment().utc( publishedTime).format('MM/DD/YYYY
hh:mm a');
++                    formData += "&publishedTime="+ publishedTime;
 +                else
 +                    formData += "&publishedTime=";
-                 var expirationTime = $("#ipdate-notice .notice-expirationTime").val();
++                var expirationTime = $("#update-notice .notice-expirationTime").val();
 +                if( expirationTime != "")
-                     formData += "&expirationTime="+ moment(  ).utc().format('MM/DD/YYYY
hh:mm a');
++                    formData += "&expirationTime="+expirationTime;
 +                else
 +                    formData += "&expirationTime=";
 +
 +                $.ajax({
 +                    url: '{{URL::to('/')}}/update-notice',
 +                    type: "post",
 +                    data: formData,
 +                    success: function( data){
 +                        var addedNotice = $.parseJSON( data);
 +                        elemToUpdate = $("#notice-" + $("#update-notice .notice-notificationId").val()
);
 +                        elemToUpdate.html(updateRow( addedNotice));
- 
 +                        elemToUpdate.addClass("alert").addClass("alert-success").data("notice-info",
data);
 +                        $("#update-notice").modal("hide");  
 +
 +                    },
 +                    error: function(){
 +                        $(".submit-update-notice-form").after("<span alert alert-danger'>An
error has occurred. Please try again later.</span>");
 +                    }
 +                }).complete( function(){
 +                        $(".submit-update-notice-form").html("Update");
 +                });
 +            }
 +            else
 +                $('#update-notice .notice-form-values').submit();
          });
  
          $(".notices-list").on("click", ".delete-notice-icon", function(){
@@@ -334,6 -313,6 +336,8 @@@
                  success: function( data){
                      if( data == 1){
                          $("#notice-" +$("#delete-notice .notice-notificationId").val()).fadeOut().remove();
++                        $("#delete-notice").modal("hide");  
++
                      }
                      else{
                          $(".delete-notice-submit").after("<span alert alert-danger'>An
error has occurred. Please try again later.</span>");
@@@ -343,7 -322,7 +347,7 @@@
                      $(".submit-update-notice-form").after("<span alert alert-danger'>An
error has occurred. Please try again later.</span>");
                  }
              }).complete( function(){
--                    $(".submit-add-notice-form").html("Update");
++                    $(".delete-notice-submit").html("Delete");
              });
          });
  


Mime
View raw message