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 2015/10/21 23:56:24 UTC
airavata-php-gateway git commit: experiment file input view option
Repository: airavata-php-gateway
Updated Branches:
refs/heads/master f77a65576 -> 27750754b
experiment file input view option
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/27750754
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/27750754
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/27750754
Branch: refs/heads/master
Commit: 27750754bd6ce300acd73649c4c5318a8d8b2827
Parents: f77a655
Author: scnakandala <su...@gmail.com>
Authored: Wed Oct 21 17:56:19 2015 -0400
Committer: scnakandala <su...@gmail.com>
Committed: Wed Oct 21 17:56:19 2015 -0400
----------------------------------------------------------------------
app/libraries/ExperimentUtilities.php | 2 ++
app/views/experiment/create-complete.blade.php | 40 +++++++++++++++++++++
app/views/partials/experiment-inputs.blade.php | 15 +++++++-
3 files changed, 56 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/27750754/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index a865af8..d35a269 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -558,6 +558,8 @@ class ExperimentUtilities
}else{
echo '<div class="form-group">
<label for="experiment-input">' . $input->name . '</label>
+ <div data-file-id="' . $input->name . '" class="readBytesButtons btn btn-default btn-xs"
+ data-toggle="modal" style="float: right">view file</div>
<input class="file-input" type="file" name="' . $input->name .
'" id="' . $input->name . '" ' . $required . '>
<p class="help-block">' . $input->userFriendlyDescription . '</p>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/27750754/app/views/experiment/create-complete.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/create-complete.blade.php b/app/views/experiment/create-complete.blade.php
index b095fe7..137422c 100644
--- a/app/views/experiment/create-complete.blade.php
+++ b/app/views/experiment/create-complete.blade.php
@@ -112,5 +112,45 @@
}
});
});
+
+ //Setting the file input view JS code
+ $( document ).ready(function() {
+ function readBlob(opt_startByte, opt_stopByte, fileId) {
+
+ var files = document.getElementById(fileId).files;
+ if (!files.length) {
+ alert('Please select a file!');
+ return;
+ }
+
+ var file = files[0];
+ var start = 0;
+ var stop = Math.min(512*1024,file.size - 1);
+
+ var reader = new FileReader();
+
+ // If we use onloadend, we need to check the readyState.
+ reader.onloadend = function(evt) {
+ if (evt.target.readyState == FileReader.DONE) { // DONE == 2
+ $('#byte_content').html(evt.target.result.replace(/(?:\r\n|\r|\n)/g, '<br />'));
+ $('#byte_range').html(
+ ['Read bytes: ', start + 1, ' - ', stop + 1,
+ ' of ', file.size, ' byte file'].join(''));
+ }
+ };
+
+ var blob = file.slice(start, stop + 1);
+ reader.readAsBinaryString(blob);
+
+ $('#input-file-view').modal('show');
+ }
+
+ $( ".readBytesButtons" ).click(function() {
+ var startByte = $(this).data('startbyte');
+ var endByte = $(this).data('endbyte');
+ var fileId = $(this).data('file-id');
+ readBlob(startByte, endByte, fileId);
+ });
+ });
</script>
@stop
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/27750754/app/views/partials/experiment-inputs.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-inputs.blade.php b/app/views/partials/experiment-inputs.blade.php
index fc0af55..a13da15 100644
--- a/app/views/partials/experiment-inputs.blade.php
+++ b/app/views/partials/experiment-inputs.blade.php
@@ -45,7 +45,20 @@
@else
{{ ExperimentUtilities::create_inputs($expInputs['application'], true) }}
@endif
-
+ </div>
+ <!-- Modal to view file inputs-->
+ <div class="modal fade" id="input-file-view" tabindex="-1" role="dialog" aria-labelledby="add-modal"
+ aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <div id="byte_range"></div>
+ </div>
+ <div class="modal-body">
+ <div id="byte_content"></div>
+ </div>
+ </div>
+ </div>
</div>
<div class="form-group required">
<label class="control-label" for="compute-resource">Compute Resource</label>