You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/03/23 22:37:57 UTC

airavata-php-gateway git commit: fixing download inputFiles issue

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop 93aa91ee6 -> 02fb21112


fixing download inputFiles issue


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

Branch: refs/heads/develop
Commit: 02fb211128981311862d6be76bd031a91e873eb8
Parents: 93aa91e
Author: scnakandala <su...@gmail.com>
Authored: Wed Mar 23 17:37:53 2016 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Wed Mar 23 17:37:53 2016 -0400

----------------------------------------------------------------------
 app/libraries/ExperimentUtilities.php | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/02fb2111/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 108904b..d03eaab 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -78,19 +78,21 @@ class ExperimentUtilities
             $matchingAppInput = null;
 
             if ($input->type == DataType::URI && empty($input->metaData)) {
-                $inputArray = explode('/', $input->value);
+                $hostName = $_SERVER['SERVER_NAME'];
+                $hostPathConstant = 'file://' . $hostName . ':';
+                $dataProductModel = Airavata::getDataProduct(Session::get('authz-token'), $input->value);
+                $currentInputPath = "";
+                foreach ($dataProductModel->replicaLocations as $rp) {
+                    if($rp->replicaLocationCategory == ReplicaLocationCategory::GATEWAY_DATA_STORE){
+                        $currentInputPath = $rp->filePath;
+                        break;
+                    }
+                }
+                $filePath = str_replace($hostPathConstant . Config::get("pga_config.airavata")["experiment-data-absolute-path"], "", $currentInputPath);
                 echo '<p><a target="_blank"
-                        href="' . URL::to("/") . '/download?path=' .
-                                    $inputArray[ count($inputArray)-4] . "/" .
-                                    $inputArray[ count($inputArray)-3] . '/' . 
-                                    $inputArray[ count($inputArray)-2] . '/' . 
-                                    $inputArray[ count($inputArray)-1] . '">' .
-                                        $inputArray[ count($inputArray)-1] . 
-                ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
-            }elseif($input->type == DataType::URI && !empty($input->metaData)
-                && json_decode($input->metaData)->location=="remote"){
-                echo '<p>' . $input->name . ': ' . $input->value . '</p>';
-            }elseif ($input->type == DataType::STRING || $input->type == DataType::INTEGER
+                        href="' . URL::to("/") . '/download?path=' . $filePath . '>' . basename($filePath) .
+                    ' <span class="glyphicon glyphicon-new-window"></span></a></p>';
+            } elseif ($input->type == DataType::STRING || $input->type == DataType::INTEGER
                 || $input->type == DataType::FLOAT) {
                 echo '<p>' . $input->name . ': ' . $input->value . '</p>';
             }