Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop 3e6d93b56 -> 7a825b33b


ammending the last commit


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

Branch: refs/heads/develop
Commit: 7a825b33bb3f42e9224071a700af08c2befa39de
Parents: 3e6d93b
Author: scnakandala <[email protected]>
Authored: Wed Mar 23 17:49:49 2016 -0400
Committer: scnakandala <[email protected]>
Committed: Wed Mar 23 17:49:49 2016 -0400

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


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7a825b33/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php 
b/app/libraries/ExperimentUtilities.php
index 872cf71..78403ac 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -73,7 +73,7 @@ class ExperimentUtilities
             $order[$index] = $input->inputOrder;
         }
         array_multisort($order, SORT_ASC, $experimentInputs);
-
+        $html = "";
         foreach ($experimentInputs as $input) {
             $matchingAppInput = null;
 
@@ -88,15 +88,23 @@ class ExperimentUtilities
                         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=' . $filePath 
. '>' . basename($filePath) .
-                    ' <span class="glyphicon 
glyphicon-new-window"></span></a></p>';
+                $dataRoot = 
Config::get("pga_config.airavata")["experiment-data-absolute-path"];
+                if(!ExperimentUtilities::endsWith($dataRoot, "/"))
+                    $dataRoot += "/";
+                $filePath = str_replace($hostPathConstant . $dataRoot . 
Session::get('username'), "", $currentInputPath);
+                $html .= '<p><a target="_blank" 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>';
+                $html .= '<p>' . $input->name . ': ' . $input->value . '</p>';
             }
         }
+
+        return $html;
+    }
+
+    private  static function endsWith($haystack, $needle) {
+        // search forward starting from end minus needle length characters
+        return $needle === "" || (($temp = strlen($haystack) - 
strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
     }
 
     /**

Reply via email to