You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2018/06/07 20:53:00 UTC
[airavata-php-gateway] 01/03: Removing links from input/output
files when file doesn't exist
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git
commit 88ffd282d68026a24e33a403274b2c6d68f56088
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Thu Jun 7 16:35:25 2018 -0400
Removing links from input/output files when file doesn't exist
---
app/libraries/ExperimentUtilities.php | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index b5c2100..7ccbb1c 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -99,8 +99,13 @@ class ExperimentUtilities
$fileName = basename($input->value);
}
- echo '<p>' . $input->name . ': <a target="_blank" href="' . URL::to("/") . '/download/?id='
- . $input->value . '">' . $fileName . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+ $path = parse_url($currentInputPath)['path'];
+ if(file_exists($path)){
+ echo '<p>' . $input->name . ': <a target="_blank" href="' . URL::to("/") . '/download/?id='
+ . $input->value . '">' . $fileName . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+ } else {
+ echo '<p>' . $input->name . ': ' . $fileName . '</p>';
+ }
}else if($input->type == DataType::URI_COLLECTION) {
$uriList = $input->value;
@@ -121,8 +126,13 @@ class ExperimentUtilities
$fileName = basename($input->value);
}
- $optFilesHtml = $optFilesHtml . '<a target="_blank" href="' . URL::to("/") . '/download/?id='
- . $uri . '">' . $fileName . ' <span class="glyphicon glyphicon-new-window"></span></a> ';
+ $path = parse_url($currentInputPath)['path'];
+ if(file_exists($path)){
+ $optFilesHtml = $optFilesHtml . '<a target="_blank" href="' . URL::to("/") . '/download/?id='
+ . $uri . '">' . $fileName . ' <span class="glyphicon glyphicon-new-window"></span></a> ';
+ } else {
+ $optFilesHtml = $optFilesHtml . $fileName . ' ';
+ }
}
@@ -965,17 +975,23 @@ class ExperimentUtilities
}
}
$path = parse_url($currentOutputPath)['path'];
+ $fileName = basename($currentOutputPath);
if(file_exists($path)){
- $fileName = basename($currentOutputPath);
echo '<p>' . $output->name . ': <a target="_blank" href="' . URL::to("/")
. '/download/?id=' . urlencode($output->value) . '">' . $fileName
. ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+ } else {
+ echo '<p>' . $output->name . ': ' . $fileName . ' </p>';
}
}else {
$fileName = basename($output->value);
- echo '<p>' . $output->name . ': <a target="_blank" href="' . URL::to("/")
- . '/download/?id=' . urlencode($output->value) . '">' . $fileName
- . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+ if(file_exists($path)){
+ echo '<p>' . $output->name . ': <a target="_blank" href="' . URL::to("/")
+ . '/download/?id=' . urlencode($output->value) . '">' . $fileName
+ . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+ } else {
+ echo '<p>' . $output->name . ': ' . $fileName . ' </p>';
+ }
}
}
} elseif ($output->type == DataType::STRING) {
--
To stop receiving notification emails like this one, please contact
machristie@apache.org.