Added owner thumbnail, post-completion sharing, and verified that the changes work
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/face8c53 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/face8c53 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/face8c53 Branch: refs/heads/develop Commit: face8c535732639870aa9fc9acf9e91692e9ba5c Parents: ebdc163 Author: Jeff Kinnison <[email protected]> Authored: Wed Aug 17 11:28:13 2016 -0400 Committer: Jeff Kinnison <[email protected]> Committed: Wed Aug 17 11:28:13 2016 -0400 ---------------------------------------------------------------------- app/controllers/ExperimentController.php | 17 +++++++++++++++-- app/libraries/ExperimentUtilities.php | 17 ++++++----------- app/views/experiment/edit.blade.php | 1 + app/views/partials/experiment-container.blade.php | 2 +- app/views/partials/experiment-info.blade.php | 10 ++++++++++ app/views/partials/sharing-form-modal.blade.php | 2 +- 6 files changed, 34 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/face8c53/app/controllers/ExperimentController.php ---------------------------------------------------------------------- diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php index b884a17..2cee7ab 100755 --- a/app/controllers/ExperimentController.php +++ b/app/controllers/ExperimentController.php @@ -135,6 +135,12 @@ class ExperimentController extends BaseController $users = SharingUtilities::getProfilesForSharedUsers(Input::get("expId"), ResourceType::EXPERIMENT); + $owner = array(); + if (strcmp(Session::get("username"), $experiment->userName) !== 0) { + $owner[$experiment->userName] = $users[$experiment->userName]; + $users = array_diff_key($users, $owner); + } + $data = array( "expId" => Input::get("expId"), "experiment" => $experiment, @@ -143,6 +149,7 @@ class ExperimentController extends BaseController "expVal" => $expVal, "autoRefresh"=> $autoRefresh, "users" => json_encode($users), + "owner" => json_encode($owner), "can_write" => SharingUtilities::userCanWrite(Session::get("username"), $experiment->experimentId, ResourceType::EXPERIMENT) ); if( Input::has("dashboard")) @@ -241,7 +248,13 @@ class ExperimentController extends BaseController $users = SharingUtilities::getProfilesForSharedUsers($_GET['expId'], ResourceType::EXPERIMENT); - return View::make("experiment/edit", array("expInputs" => $experimentInputs, "users" => json_encode($users))); + $owner = array(); + if (strcmp(Session::get("username"), $experiment->userName) !== 0) { + $owner[$experiment->userName] = $users[$experiment->userName]; + $users = array_diff_key($users, $owner); + } + + return View::make("experiment/edit", array("expInputs" => $experimentInputs, "users" => json_encode($users), "owner" => json_encode($owner))); } else { Redirect::to("experiment/summary?expId=" . $experiment->experimentId)->with("error", "You do not have permission to edit this experiment"); @@ -316,7 +329,7 @@ class ExperimentController extends BaseController $can_write = array(); foreach ($expContainer as $experiment) { - $can_write[$experiment->experimentId] = SharingUtilities::userCanWrite(Session::get("username"), $experiment->experimentId, ResourceType::EXPERIMENT); + $can_write[$experiment['experiment']->experimentId] = SharingUtilities::userCanWrite(Session::get("username"), $experiment['experiment']->experimentId, ResourceType::EXPERIMENT); } return View::make('experiment/browse', array( http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/face8c53/app/libraries/ExperimentUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php index d90d2ce..631cb98 100755 --- a/app/libraries/ExperimentUtilities.php +++ b/app/libraries/ExperimentUtilities.php @@ -572,12 +572,7 @@ class ExperimentUtilities '<p>AiravataSystemException: ' . $ase->getMessage() . '</p>'); } - $share = json_decode($share); - $share->{Session::get("username")} = new stdClass(); - $share->{Session::get("username")}->read = true; - $share->{Session::get("username")}->write = true; - - ExperimentUtilities::share_experiment($expId, $share); + ExperimentUtilities::share_experiment($expId, json_decode($share)); } @@ -826,11 +821,7 @@ class ExperimentUtilities CommonUtilities::print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage()); } - $share = json_decode($share); - $share->{Session::get('username')} = new stdClass(); - $share->{Session::get('username')}->read = true; - $share->{Session::get('username')}->write = true; - ExperimentUtilities::share_experiment($expId, $share); + ExperimentUtilities::share_experiment($expId, json_decode($share)); return $expId; } @@ -1335,6 +1326,10 @@ class ExperimentUtilities */ private static function share_experiment($expId, $users) { $experiment = ExperimentUtilities::get_experiment($expId); + $users->{$experiment->owner} = new stdClass(); + $users->{$experiment->owner}->read = true; + $users->{$experiment->owner}->write = true; + $wadd = array(); $wrevoke = array(); $radd = array(); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/face8c53/app/views/experiment/edit.blade.php ---------------------------------------------------------------------- diff --git a/app/views/experiment/edit.blade.php b/app/views/experiment/edit.blade.php index 75a6c5d..a4abe0e 100755 --- a/app/views/experiment/edit.blade.php +++ b/app/views/experiment/edit.blade.php @@ -54,6 +54,7 @@ @parent <script> var users = {{ $users }}; + var owner = {{ $owner }}; $('#project-share').data({url: "{{URL::to('/')}}/experiment/unshared-users", resourceId: "{{Input::get('expId')}}"}) </script> {{ HTML::script('js/sharing/sharing_utils.js') }} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/face8c53/app/views/partials/experiment-container.blade.php ---------------------------------------------------------------------- diff --git a/app/views/partials/experiment-container.blade.php b/app/views/partials/experiment-container.blade.php index 25f99c7..561063e 100644 --- a/app/views/partials/experiment-container.blade.php +++ b/app/views/partials/experiment-container.blade.php @@ -28,7 +28,7 @@ <a href="{{URL::to('/')}}/experiment/summary?expId={{$experiment['experiment']->experimentId}}" target="_blank"> {{ $experiment['experiment']->name }} </a> - @if( $experiment['expValue']['editable'] and $can_write[$experiment->experimentId] === true) + @if( $experiment['expValue']['editable'] and $can_write[$experiment['experiment']->experimentId] === true) <a href="{{URL::to('/')}}/experiment/edit?expId={{$experiment['experiment']->experimentId}}" title="Edit"><span class="glyphicon glyphicon-pencil"></span></a> @endif </td> http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/face8c53/app/views/partials/experiment-info.blade.php ---------------------------------------------------------------------- diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php index 36c9fe2..3ca3340 100644 --- a/app/views/partials/experiment-info.blade.php +++ b/app/views/partials/experiment-info.blade.php @@ -192,7 +192,11 @@ </table> <div class="form-group"> + @if($can_write === true) + @include('partials/sharing-display-body', array("form" => true)) + @else @include('partials/sharing-display-body', array("form" => false)) + @endif </div> @if( !isset( $dashboard)) @@ -320,11 +324,17 @@ </div> @endif +@if($can_write === true) +@include('partials/sharing-form-modal') +@endif + @section('scripts') @parent {{ HTML::script('js/time-conversion.js')}} <script> var users = {{ $users }}; + var owner = {{ $owner }}; + $('#project-share').data({url: "{{URL::to('/')}}/experiment/unshared-users", resourceId: "{{Input::get('expId')}}"}) </script> {{ HTML::script('js/sharing/sharing_utils.js') }} {{ HTML::script('js/sharing/share.js') }} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/face8c53/app/views/partials/sharing-form-modal.blade.php ---------------------------------------------------------------------- diff --git a/app/views/partials/sharing-form-modal.blade.php b/app/views/partials/sharing-form-modal.blade.php index b66a666..dee2036 100644 --- a/app/views/partials/sharing-form-modal.blade.php +++ b/app/views/partials/sharing-form-modal.blade.php @@ -10,7 +10,7 @@ @include('partials/sharing-form-body') </div> <div class="modal-footer"> - <button type="button" id="share-box-button" class="btn btn-primary">Save</button> + <button type="button" id="share-box-button" class="btn btn-primary">Update</button> <button type="button" id="share-box-close" class="btn btn-default" data-dismiss="modal">Cancel</button> </div> </div>
