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 2017/02/07 20:16:32 UTC

airavata-php-gateway git commit: encode/decode url links for genome browser

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/dreg-gateway b3ba3e3bc -> ba4e57427


encode/decode url links for genome browser


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

Branch: refs/heads/dreg-gateway
Commit: ba4e57427548fe6dcc16bb8bb04c5bfa9941060d
Parents: b3ba3e3
Author: root <ro...@osboxes>
Authored: Tue Feb 7 17:05:25 2017 +0000
Committer: root <ro...@osboxes>
Committed: Tue Feb 7 17:05:25 2017 +0000

----------------------------------------------------------------------
 app/routes.php                               | 25 +++++++++++++++--------
 app/views/partials/experiment-info.blade.php |  2 +-
 2 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ba4e5742/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 4bfb433..955a77a 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -161,20 +161,20 @@ Route::get("files/browse", "FilemanagerController@browse");
 Route::get("files/get","FilemanagerController@get");
 
 // Added by dREG 
-Route::get("gbrowser", function(){
+Route::get("gbrowser/{filelist}", function($filelist){
     $protocol = 'http';
     if ( isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') 
         $protocol = 'https';
 
     $dataRoot = Config::get("pga_config.airavata")["experiment-data-absolute-path"];
-    $filelist = explode("\n", urldecode( Input::get('filelist') ) );
+    $filelist = explode("\n", base64_decode( $filelist ) );
     $folder_path=$filelist[0]. "ARCHIVE" ;
     $content = "[ \n";
     
     for($i=1; $i<3; $i++){    
          $content = $content . ' {
          type:"bigwig",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/download?path='. $filelist[$i*2] . '",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode($filelist[$i*2]). '",
          name: "'. $filelist[$i*2-1] .'",
          fixedscale:{min:0,max:20},
          colorpositive:"rgb(197,0,11)",
@@ -185,7 +185,7 @@ Route::get("gbrowser", function(){
 
     $content = $content . '{
        type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/download?path='. $folder_path . '/out.dREG.pred.gz",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode($folder_path . '/out.dREG.pred.gz').'",
          name: "dREG informative pos.:",
          mode: "show",
          colorpositive:"#0000e5/#B30086",
@@ -196,7 +196,7 @@ Route::get("gbrowser", function(){
 
     $content = $content . '{
        type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/download?path='. $folder_path . '/out.dREG.peak.gz",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.peak.gz').'",
          name: "dREG Peak Calling:",
          mode: "show",
          colorpositive:"#0000e5/#B30086",
@@ -207,7 +207,7 @@ Route::get("gbrowser", function(){
 
     $content = $content . '{
        type:"bigwig",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/download?path='. $folder_path . '/out.dREG.HD.imputedDnase.bw",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.HD.imputedDnase.bw').'",
          name: "imputed DNase-I signal:",
          fixedscale:{min:0,max:20},
          colorpositive:"rgb(197,0,11)",
@@ -217,7 +217,7 @@ Route::get("gbrowser", function(){
 
     $content = $content . '{
        type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/download?path='. $folder_path . '/out.dREG.HD.relaxed.bed",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.HD.relaxed.bed').'",
          name: "dREG.HD relaxed peaks:",
          mode: "show",
          colorpositive:"#0000e5/#B30086",
@@ -228,7 +228,7 @@ Route::get("gbrowser", function(){
 
     $content = $content . '{
        type:"bedgraph",
-         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/download?path='. $folder_path . '/out.dREG.HD.stringent.bed",
+         url:"'.$protocol.'://'. $_SERVER['HTTP_HOST'] .'/gbfile/'.base64_encode( $folder_path . '/out.dREG.HD.stringent.bed').'",
          name: "dREG.HD stringent peaks:",
          mode: "show",
          colorpositive:"#0000e5/#B30086",
@@ -244,6 +244,15 @@ Route::get("gbrowser", function(){
                   ->header('Content-Type', 'text/plain');
 });
 
+Route::get("gbfile/{file}", function($file){
+    $file = base64_decode( $file );
+    if(0 === strpos($file, '/')){
+        $file = substr($file, 1);
+    }
+    $downloadLink = Config::get('pga_config.airavata')['experiment-data-absolute-path'] . '/' . $file;
+    return Response::download( $downloadLink);
+});
+
 // dREG
 
 /*

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/ba4e5742/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 5a4e4a5..a11465a 100755
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -254,7 +254,7 @@ function download(d) {
     $filelist=$expDataDir ."\n". $filelist;
 ?>
 
-<a href="http://epigenomegateway.wustl.edu/browser/?genome=hg19&datahub={{$protocol}}://{{$_SERVER['HTTP_HOST']}}/gbrowser?filelist={{urlencode($filelist)}}" target="_blank">
+<a href="http://epigenomegateway.wustl.edu/browser/?genome=hg19&datahub={{ $protocol .'://'. $_SERVER['HTTP_HOST']. '/gbrowser/'. base64_encode( $filelist ) }}" target="_blank">
 Genome Browser&nbsp;<span class="glyphicon glyphicon-new-window" style="width:20px"></span></a>
         </td>
         </tr>