AIRAVATA-2193 Distinguish projects owned by other users
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/9faea85c Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/9faea85c Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/9faea85c Branch: refs/heads/develop Commit: 9faea85c25360f3df18eb967fcc2f83c764d781d Parents: 4487dd7 Author: Marcus Christie <[email protected]> Authored: Fri Nov 11 10:41:29 2016 -0500 Committer: Marcus Christie <[email protected]> Committed: Fri Nov 11 10:41:29 2016 -0500 ---------------------------------------------------------------------- app/libraries/ProjectUtilities.php | 13 ++++++++++++- app/views/partials/experiment-info.blade.php | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9faea85c/app/libraries/ProjectUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/ProjectUtilities.php b/app/libraries/ProjectUtilities.php index eeeadb2..baf2da1 100755 --- a/app/libraries/ProjectUtilities.php +++ b/app/libraries/ProjectUtilities.php @@ -22,6 +22,17 @@ class ProjectUtilities try { $userProjects = Airavata::getUserProjects(Session::get('authz-token'), $gatewayId, $username, -1, 0); + + // Add a optionLabel that disambiguates shared projects + foreach ($userProjects as $project) { + + $optionLabel = $project->name; + if ($project->owner != Session::get('username')) { + $optionLabel = $optionLabel . ' (owned by ' . $project->owner . ')'; + } + $project->optionLabel = $optionLabel; + } + //var_dump( $userProjects); exit; } catch (InvalidRequestException $ire) { CommonUtilities::print_error_message('<p>There was a problem getting the user\'s projects. @@ -107,7 +118,7 @@ class ProjectUtilities $selected = ''; } - echo '<option value="' . $project->projectID . '" ' . $selected . '>' . $project->name . '</option>'; + echo '<option value="' . $project->projectID . '" ' . $selected . '>' . $project->optionLabel . '</option>'; } } echo '</select>'; http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9faea85c/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 6ba71df..eec614d 100644 --- a/app/views/partials/experiment-info.blade.php +++ b/app/views/partials/experiment-info.blade.php @@ -289,7 +289,7 @@ @if( $project->projectID == $experiment->projectId) selected @endif - >{{{ $project->name }}}</option> + >{{{ $project->optionLabel }}}</option> @endforeach </select> </div>
