AIRAVATA-2174 Can change sharing of experiment after launch
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/b4899d1f Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/b4899d1f Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/b4899d1f Branch: refs/heads/develop Commit: b4899d1f2add5e9a5eecdb7f3c7028571ee49890 Parents: cb00163 Author: Marcus Christie <machr...@iu.edu> Authored: Mon Oct 17 16:37:28 2016 -0400 Committer: Marcus Christie <machr...@iu.edu> Committed: Mon Oct 17 16:37:28 2016 -0400 ---------------------------------------------------------------------- app/controllers/ExperimentController.php | 7 ++++- app/libraries/ExperimentUtilities.php | 4 +++ app/views/partials/experiment-info.blade.php | 35 ++++++++++++++++------- 3 files changed, 34 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b4899d1f/app/controllers/ExperimentController.php ---------------------------------------------------------------------- diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php index 7da421b..d7fb40c 100755 --- a/app/controllers/ExperimentController.php +++ b/app/controllers/ExperimentController.php @@ -210,7 +210,12 @@ class ExperimentController extends BaseController } elseif (isset($_POST['cancel'])) { ExperimentUtilities::cancel_experiment($experiment->experimentId); return Redirect::to('experiment/summary?expId=' . $experiment->experimentId); - + } elseif (isset($_POST['update-sharing'])) { + if(Config::get('pga_config.airavata')["data-sharing-enabled"]){ + $share = $_POST['share-settings']; + ExperimentUtilities::update_experiment_sharing($experiment->experimentId, json_decode($share)); + } + return Redirect::to('experiment/summary?expId=' . $experiment->experimentId); } } http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b4899d1f/app/libraries/ExperimentUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php index 49bcd19..8c137ea 100755 --- a/app/libraries/ExperimentUtilities.php +++ b/app/libraries/ExperimentUtilities.php @@ -1335,6 +1335,10 @@ class ExperimentUtilities echo '</select>'; } + public static function update_experiment_sharing($expId, $users) { + ExperimentUtilities::share_experiment($expId, $users); + } + /** * Set sharing privileges for a given experiment. * @param $expId http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/b4899d1f/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 dbdf579..08fca8e 100644 --- a/app/views/partials/experiment-info.blade.php +++ b/app/views/partials/experiment-info.blade.php @@ -77,7 +77,7 @@ <tr> <td>Name</td> <td>ID</td> - <td>Status</td>SharingUtilities::userCanWrite(Session::get("username"), $experiment->experimentId, ResourceType::EXPERIMENT) + <td>Status</td> <td>Creation Time</td> </tr> <tr> @@ -203,22 +203,24 @@ @endforeach </table> - <div class="form-group"> - @if(Config::get('pga_config.airavata')["data-sharing-enabled"]) - @if($can_write === true) - @include('partials/sharing-display-body', array("form" => true)) - @else - @include('partials/sharing-display-body', array("form" => false)) - @endif - @endif - </div> - @if(strcmp($expVal["applicationInterface"]->applicationName, "OpenMM_Stampede") === 0) @include('partials/streaming-data') @endif @if( !isset( $dashboard)) + <form action="{{URL::to('/') }}/experiment/summary" method="post" role="form"> + + <div class="form-group"> + @if(Config::get('pga_config.airavata')["data-sharing-enabled"]) + @if($can_write === true) + <!-- Only allow editing sharing here if the experiment isn't editable --> + @include('partials/sharing-display-body', array("form" => !$expVal["editable"])) + @else + @include('partials/sharing-display-body', array("form" => false)) + @endif + @endif + </div> <div class="btn-toolbar"> <input name="launch" type="submit" @@ -258,6 +260,17 @@ </a> @endif @endif + <!-- Only owner can update sharing --> + @if(Config::get('pga_config.airavata')["data-sharing-enabled"] && Session::get('username') === $experiment->userName && !$expVal["editable"]) + <button name="update-sharing" + type="submit" + class="btn btn-primary" + value="Update Sharing" + title="Update sharing settings"> + <span class="glyphicon glyphicon-share"></span> + Update Sharing + </button> + @endif </div> </form> @endif