airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata-php-gateway git commit: showing download file link only when file exists
Date Tue, 04 Apr 2017 20:01:33 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop dc556d73d -> 026bb9d09


showing download file link only when file exists


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

Branch: refs/heads/develop
Commit: 026bb9d09ac2b941b8dc1f0e45056a3195136c26
Parents: dc556d7
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Tue Apr 4 16:01:29 2017 -0400
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Tue Apr 4 16:01:29 2017 -0400

----------------------------------------------------------------------
 app/libraries/ExperimentUtilities.php | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/026bb9d0/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 8248851..81f44f8 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -921,14 +921,19 @@ class ExperimentUtilities
                                 break;
                             }
                         }
-                        $fileName = basename($currentOutputPath);
-                    }else{
+                        $path = parse_url($currentOutputPath);
+                        if(file_exists($path)){
+                            $fileName = basename($currentOutputPath);
+                            echo '<p>' . $output->name . ':&nbsp;<a target="_blank"
href="' . URL::to("/")
+                                . '/download/?id=' . urlencode($output->value) . '">'
. $fileName
+                                . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+                        }
+                    }else {
                         $fileName = basename($output->value);
+                        echo '<p>' . $output->name . ':&nbsp;<a target="_blank"
href="' . URL::to("/")
+                            . '/download/?id=' . urlencode($output->value) . '">' .
$fileName
+                            . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
                     }
-                    echo '<p>' . $output->name . ':&nbsp;<a target="_blank"
href="' . URL::to("/")
-                        . '/download/?id=' . urlencode($output->value) . '">' . $fileName
-                        . ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
-
                 }
             } elseif ($output->type == DataType::STRING) {
                 echo '<p>' . $output->value . '</p>';


Mime
View raw message