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/01/19 19:50:34 UTC
[01/10] airavata-php-gateway git commit: AIRAVATA-1397 File size
detection for opt. input files
Repository: airavata-php-gateway
Updated Branches:
refs/heads/develop fc04148bd -> bfd2c06da
AIRAVATA-1397 File size detection for opt. input files
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/65ef21b2
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/65ef21b2
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/65ef21b2
Branch: refs/heads/develop
Commit: 65ef21b2a8bdaf3d3d32d1faf917554fea45c6ba
Parents: 4ece55f
Author: Marcus Christie <ma...@apache.org>
Authored: Tue Jan 10 16:03:28 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Tue Jan 10 16:03:28 2017 -0500
----------------------------------------------------------------------
app/libraries/ExperimentUtilities.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/65ef21b2/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 92c54e0..d939f7d 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -830,7 +830,7 @@ class ExperimentUtilities
if($appInterface->hasOptionalFileInputs){
echo '<div>
<label>Optional Input Files</label>
- <input type="file" id="optInputFiles" name="optInputFiles[]" multiple onchange="javascript:updateList()" >
+ <input type="file" class="file-input" id="optInputFiles" name="optInputFiles[]" multiple onchange="javascript:updateList()" >
<div id="optFileList"></div>
</div>';
}
@@ -870,7 +870,7 @@ class ExperimentUtilities
CommonUtilities::print_error_message('AiravataSystemException!<br><br>' . $ase->getMessage());
}
- if(Config::get('pga_config.airavata')["data-sharing-enabled"]){
+ if(Config::get('pga_config.airavata')["data-sharing-enabled"] && $expId){
ExperimentUtilities::share_experiment($expId, json_decode($share));
}
[09/10] airavata-php-gateway git commit: AIRAVATA-1397 edit
experiment: add updateList function
Posted by ma...@apache.org.
AIRAVATA-1397 edit experiment: add updateList function
updateList function, which displays a list of optional upload files
selected, was not there on the experiemnt edit page (was only on
experiment create page).
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/561fbe30
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/561fbe30
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/561fbe30
Branch: refs/heads/develop
Commit: 561fbe3027d83782917732dabcb8327e1c0da85e
Parents: 0edd8bd
Author: Marcus Christie <ma...@apache.org>
Authored: Thu Jan 19 14:41:35 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Thu Jan 19 14:41:35 2017 -0500
----------------------------------------------------------------------
app/views/experiment/edit.blade.php | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/561fbe30/app/views/experiment/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/edit.blade.php b/app/views/experiment/edit.blade.php
index cbefee3..db21068 100755
--- a/app/views/experiment/edit.blade.php
+++ b/app/views/experiment/edit.blade.php
@@ -111,5 +111,16 @@
}
});
});
+
+ updateList = function() {
+ var input = document.getElementById('optInputFiles');
+ var output = document.getElementById('optFileList');
+
+ output.innerHTML = '<ul>';
+ for (var i = 0; i < input.files.length; ++i) {
+ output.innerHTML += '<li>' + input.files.item(i).name + '</li>';
+ }
+ output.innerHTML += '</ul>';
+ }
</script>
@stop
[08/10] airavata-php-gateway git commit: AIRAVATA-1397 Fixing editing
optional upload files
Posted by ma...@apache.org.
AIRAVATA-1397 Fixing editing optional upload files
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/0edd8bdd
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/0edd8bdd
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/0edd8bdd
Branch: refs/heads/develop
Commit: 0edd8bdd5aa07023802ff2b82185c5cf6fbc53aa
Parents: 2232fe6
Author: Marcus Christie <ma...@apache.org>
Authored: Thu Jan 19 14:40:37 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Thu Jan 19 14:40:37 2017 -0500
----------------------------------------------------------------------
app/libraries/ExperimentUtilities.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0edd8bdd/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 005ddee..47a0c0e 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -475,8 +475,7 @@ class ExperimentUtilities
. $_FILES['optInputFiles']['name'][$i] . "'. File upload error code is " . $_FILES['optInputFiles']['error'][$i] . ".");
}
- $filePath = ExperimentUtilities::$experimentPath . $_FILES['optInputFiles']['name'][$i];
-
+ $filePath = $experimentFilePath . $_FILES['optInputFiles']['name'][$i];
// check if file already exists
if (is_file($filePath)) {
unlink($filePath);
[04/10] airavata-php-gateway git commit: AIRAVATA-1397 Display error
when file upload too big
Posted by ma...@apache.org.
AIRAVATA-1397 Display error when file upload too big
Throws and displays error when file upload exceeds upload_max_filesize
or any other error with uploading the file.
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/bc6ded07
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/bc6ded07
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/bc6ded07
Branch: refs/heads/develop
Commit: bc6ded07f8067b86846cd171fd8eda27f7d0ccac
Parents: 6cdc2a1
Author: Marcus Christie <ma...@apache.org>
Authored: Wed Jan 18 15:18:38 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Wed Jan 18 15:18:38 2017 -0500
----------------------------------------------------------------------
app/controllers/ExperimentController.php | 17 +++++++++++++++--
app/libraries/ExperimentUtilities.php | 12 ++++++++++++
app/views/experiment/create.blade.php | 7 +++++++
app/views/experiment/edit.blade.php | 6 ++++++
4 files changed, 40 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bc6ded07/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 7bfd8c5..6f4364f 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -89,7 +89,13 @@ class ExperimentController extends BaseController
}
} else if (isset($_POST['save']) || isset($_POST['launch'])) {
- $expId = ExperimentUtilities::create_experiment();
+ try {
+ $expId = ExperimentUtilities::create_experiment();
+ } catch (Exception $ex) {
+ Log::error("Failed to create experiment!");
+ Log::error($ex);
+ return Redirect::to("experiment/create")->with("error-message", "Failed to create experiment: " . $ex->getMessage());
+ }
if (isset($_POST['launch']) && $expId) {
ExperimentUtilities::launch_experiment($expId);
@@ -354,7 +360,14 @@ class ExperimentController extends BaseController
public function editSubmit()
{
$experiment = ExperimentUtilities::get_experiment(Input::get('expId')); // update local experiment variable
- $updatedExperiment = ExperimentUtilities::apply_changes_to_experiment($experiment, Input::all());
+ try {
+ $updatedExperiment = ExperimentUtilities::apply_changes_to_experiment($experiment, Input::all());
+ } catch (Exception $ex) {
+ $errMessage = "Failed to update experiment: " . $ex->getMessage();
+ Log::error($errMessage);
+ Log::error($ex);
+ return Redirect::to("experiment/edit?expId=" . urlencode(Input::get('expId')))->with("error-message", $errMessage);
+ }
if(Config::get('pga_config.airavata')["data-sharing-enabled"]){
if (SharingUtilities::userCanWrite(Session::get("username"), Input::get('expId'), ResourceType::EXPERIMENT)) {
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bc6ded07/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 0b89df1..005ddee 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -396,7 +396,12 @@ class ExperimentUtilities
}
} elseif ($applicationInput->type == DataType::URI) {
if ($_FILES[$applicationInput->sanitizedFormName]['name']) {
+
$file = $_FILES[$applicationInput->sanitizedFormName];
+ if ($file['error'] != 0) {
+ throw new Exception("Failure occurred while uploading file '"
+ . $file['name'] . "'. File upload error code is " . $file['error'] . ".");
+ }
//
// move file to experiment data directory
@@ -463,6 +468,13 @@ class ExperimentUtilities
$uriList = "";
for($i=0; $i < count($_FILES['optInputFiles']['name']); $i++){
if(!empty($_FILES['optInputFiles']['name'][$i])){
+
+ // Check if there is an error with the upload (like if it exceeded upload_max_filesize)
+ if ($_FILES['optInputFiles']['error'][$i] != 0) {
+ throw new Exception("Failure occurred while uploading file '"
+ . $_FILES['optInputFiles']['name'][$i] . "'. File upload error code is " . $_FILES['optInputFiles']['error'][$i] . ".");
+ }
+
$filePath = ExperimentUtilities::$experimentPath . $_FILES['optInputFiles']['name'][$i];
// check if file already exists
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bc6ded07/app/views/experiment/create.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/create.blade.php b/app/views/experiment/create.blade.php
index 82687c0..87225d4 100755
--- a/app/views/experiment/create.blade.php
+++ b/app/views/experiment/create.blade.php
@@ -6,6 +6,13 @@
@stop
@section('content')
+
+@if( Session::has("error-message" ) )
+ <div class="alert alert-danger">
+ {{{ Session::get("error-message") }}}
+ </div>
+@endif
+
<div class="col-md-offset-3 col-md-6">
<h1>Create a new experiment</h1>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bc6ded07/app/views/experiment/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/edit.blade.php b/app/views/experiment/edit.blade.php
index 52e035b..00fd008 100755
--- a/app/views/experiment/edit.blade.php
+++ b/app/views/experiment/edit.blade.php
@@ -17,6 +17,12 @@
<div class="container">
+ @if (Session::has("error-message"))
+ <div class="alert alert-danger">
+ {{{ Session::get("error-message") }}}
+ </div>
+ @endif
+
<div class="col-md-offset-3 col-md-6">
<h1>Edit Experiment</h1>
[03/10] airavata-php-gateway git commit: AIRAVATA-1397 Couple small
fixes I noticed
Posted by ma...@apache.org.
AIRAVATA-1397 Couple small fixes I noticed
* fix for updating memory when editing an experiment
* removing unused "selected-queue" form parameter
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/6cdc2a11
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/6cdc2a11
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/6cdc2a11
Branch: refs/heads/develop
Commit: 6cdc2a1188960b1b82c65df157b3c20f7c8d2342
Parents: d0af4e3
Author: Marcus Christie <ma...@apache.org>
Authored: Fri Jan 13 17:06:15 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Fri Jan 13 17:06:15 2017 -0500
----------------------------------------------------------------------
app/libraries/ExperimentUtilities.php | 2 +-
app/views/partials/experiment-inputs.blade.php | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6cdc2a11/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index a4fee3b..0b89df1 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -1282,7 +1282,7 @@ class ExperimentUtilities
$schedulingUpdated->totalCPUCount = $input['cpu-count'];
//$schedulingUpdated->numberOfThreads = $input['threads'];
$schedulingUpdated->wallTimeLimit = $input['wall-time'];
- //$schedulingUpdated->totalPhysicalMemory = $input['memory'];
+ $schedulingUpdated->totalPhysicalMemory = $input['total-physical-memory'];
/*
switch ($_POST['compute-resource'])
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/6cdc2a11/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 dfe9d6c..bd3ef79 100644
--- a/app/views/partials/experiment-inputs.blade.php
+++ b/app/views/partials/experiment-inputs.blade.php
@@ -81,8 +81,6 @@
<div class="loading-img text-center hide">
<img src="../assets/ajax-loader.gif"/>
</div>
- <input type="hidden" name="selected-queue"
- value="@if(isset($expInputs['expVal']) ){{ $expInputs['expVal']['scheduling']->queueName }} @endif"/>
<div class="queue-view">
@if(isset($expInputs['expVal']) )
[07/10] airavata-php-gateway git commit: AIRAVATA-1397 removed
savedExp, clonedExp flags
Posted by ma...@apache.org.
AIRAVATA-1397 removed savedExp, clonedExp flags
savedExp wasn't consistently applied, but rather than consistently
applying it I removed this flag along with clonedExp since it doesn't
appear to be needed. The only relevant fact is whether an existing
experiment is being edited which is easily derivable.
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/2232fe65
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/2232fe65
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/2232fe65
Branch: refs/heads/develop
Commit: 2232fe650a88968c3d5940abd76ec27bc1605050
Parents: 9e75b85
Author: Marcus Christie <ma...@apache.org>
Authored: Thu Jan 19 10:57:52 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Thu Jan 19 10:57:52 2017 -0500
----------------------------------------------------------------------
app/controllers/ExperimentController.php | 18 +-----------------
app/views/partials/experiment-info.blade.php | 2 +-
app/views/partials/experiment-inputs.blade.php | 6 +-----
3 files changed, 3 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2232fe65/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 6f4364f..cb71bfb 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -44,15 +44,7 @@ class ExperimentController extends BaseController
);
- $clonedExp = false; $savedExp = false;
- if( Input::has("clonedExp"))
- $clonedExp = true;
- if( Input::has("savedExp"))
- $savedExp = true;
-
$experimentInputs = array(
- "clonedExp" => $clonedExp,
- "savedExp" => $savedExp,
"disabled" => ' disabled',
"experimentName" => $_POST['experiment-name'],
"experimentDescription" => $_POST['experiment-description'] . ' ',
@@ -281,15 +273,7 @@ class ExperimentController extends BaseController
$userComputeResourcePreferences = URPUtilities::get_all_user_compute_resource_prefs();
$userHasComputeResourcePreference = array_key_exists($expVal['scheduling']->resourceHostId, $userComputeResourcePreferences);
- $clonedExp = false; $savedExp = false;
- if( Input::has("clonedExp"))
- $clonedExp = true;
- if( Input::has("savedExp"))
- $savedExp = true;
-
$experimentInputs = array(
- "clonedExp" => $clonedExp,
- "savedExp" => $savedExp,
"disabled" => ' ',
"experimentName" => $experiment->experimentName,
"experimentDescription" => $experiment->description,
@@ -350,7 +334,7 @@ class ExperimentController extends BaseController
{
try{
$cloneId = ExperimentUtilities::clone_experiment(Input::get('expId'), Input::get('projectId'));
- return Redirect::to('experiment/edit?expId=' . urlencode($cloneId) . "&clonedExp=true");
+ return Redirect::to('experiment/edit?expId=' . urlencode($cloneId));
}catch (Exception $ex){
return Redirect::to("experiment/summary?expId=" . urlencode(Input::get('expId')))
->with("cloning-error", "Failed to clone experiment: " . $ex->getMessage());
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2232fe65/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 4b4c44b..cb1a156 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -250,7 +250,7 @@
Cancel
</button>
<input type="hidden" name="expId" value="{{{ Input::get('expId') }}}"/>
- <a href="{{URL::to('/') }}/experiment/edit?expId={{ urlencode($experiment->experimentId) }}&savedExp=true"
+ <a href="{{URL::to('/') }}/experiment/edit?expId={{ urlencode($experiment->experimentId) }}"
class="btn btn-primary"
role="button"
title="Edit experiment" <?php if (!$expVal["editable"]) echo 'style="display: none"' ?>>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2232fe65/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 bd3ef79..90cb2fa 100644
--- a/app/views/partials/experiment-inputs.blade.php
+++ b/app/views/partials/experiment-inputs.blade.php
@@ -14,11 +14,7 @@
</div>
<div class="form-group required">
<label for="project" class="control-label">Project</label>
- {{-- @if( $expInputs["clonedExp"] || $expInputs["savedExp"]) --}}
{{ ProjectUtilities::create_project_select($expInputs["project"], false) }}
- {{-- @else --}}
- {{-- {{ ProjectUtilities::create_project_select($expInputs["project"], true) }} --}}
- {{-- @endif --}}
</div>
<div class="form-group">
<label for="application">Application</label>
@@ -35,7 +31,7 @@
<label>Application Inputs</label>
<div class="well">
- @if( $expInputs["clonedExp"] || $expInputs["savedExp"])
+ @if( isset( $expInputs['experiment'] ) )
<div class="form-group">
<p><strong>Current Inputs</strong></p>
{{ ExperimentUtilities::list_input_files($expInputs['experiment']->experimentInputs) }}
[10/10] airavata-php-gateway git commit: Merge branch
'AIRAVATA-1397-max-filesize-exceeded-uploads' into develop
Posted by ma...@apache.org.
Merge branch 'AIRAVATA-1397-max-filesize-exceeded-uploads' into develop
This should fix AIRAVATA-1397
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/bfd2c06d
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/bfd2c06d
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/bfd2c06d
Branch: refs/heads/develop
Commit: bfd2c06da6a19b3fa2c9dc0acdd481154dc79ce9
Parents: fc04148 561fbe3
Author: Marcus Christie <ma...@apache.org>
Authored: Thu Jan 19 14:50:12 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Thu Jan 19 14:50:12 2017 -0500
----------------------------------------------------------------------
app/config/pga_config.php.template | 5 --
app/controllers/ExperimentController.php | 61 +++++++++++----------
app/libraries/ExperimentUtilities.php | 32 ++++++++---
app/views/experiment/create-complete.blade.php | 11 ++--
app/views/experiment/create.blade.php | 7 +++
app/views/experiment/edit.blade.php | 29 ++++++++--
app/views/partials/experiment-info.blade.php | 2 +-
app/views/partials/experiment-inputs.blade.php | 12 +---
public/.htaccess | 5 ++
public/css/bootstrap.min.css | 18 ++++++
public/js/util.js | 25 ++++++++-
11 files changed, 148 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
[02/10] airavata-php-gateway git commit: AIRAVATA-1397 Display max
upload file size in form
Posted by ma...@apache.org.
AIRAVATA-1397 Display max upload file size in form
Also no longer using 'server-allowed'file-size' from pga_config.php.
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/d0af4e3b
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/d0af4e3b
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/d0af4e3b
Branch: refs/heads/develop
Commit: d0af4e3b43c72cfb4c9c405cfe8f39202f439a19
Parents: 65ef21b
Author: Marcus Christie <ma...@apache.org>
Authored: Wed Jan 11 10:16:45 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Wed Jan 11 10:18:57 2017 -0500
----------------------------------------------------------------------
app/config/pga_config.php.template | 5 ----
app/controllers/ExperimentController.php | 26 ++++++++++++++-------
app/libraries/ExperimentUtilities.php | 15 ++++++++----
app/views/experiment/edit.blade.php | 1 +
app/views/partials/experiment-inputs.blade.php | 4 ++--
public/css/bootstrap.min.css | 18 ++++++++++++++
6 files changed, 49 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d0af4e3b/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index 7a18f5a..ac378f6 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -114,11 +114,6 @@ return array(
'gateway-id' => 'default',
/**
- * Maximum size of a file which is allowed to upload to the server
- */
- 'server-allowed-file-size' => 64,
-
- /**
* absolute path of the data dir
*/
'experiment-data-absolute-path' => '/var/www/experimentData',
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d0af4e3b/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 5f1533f..7bfd8c5 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -50,13 +50,6 @@ class ExperimentController extends BaseController
if( Input::has("savedExp"))
$savedExp = true;
- // Condition added to deal with php ini default value set for post_max_size issue.
- $allowedFileSize = Config::get('pga_config.airavata')["server-allowed-file-size"];
- $serverLimit = intval( ini_get( 'post_max_size') );
- if( $serverLimit < $allowedFileSize)
- $allowedFileSize = $serverLimit;
-
-
$experimentInputs = array(
"clonedExp" => $clonedExp,
"savedExp" => $savedExp,
@@ -72,7 +65,7 @@ class ExperimentController extends BaseController
"computeResources" => $computeResources,
"resourceHostId" => null,
"advancedOptions" => Config::get('pga_config.airavata')["advanced-experiment-options"],
- "allowedFileSize" => $allowedFileSize
+ "allowedFileSize" => $this->getAllowedFileSize()
);
if(Config::get('pga_config.airavata')["data-sharing-enabled"]){
@@ -299,7 +292,7 @@ class ExperimentController extends BaseController
"userDN" => $experiment->userConfigurationData->userDN,
"userHasComputeResourcePreference" => $userHasComputeResourcePreference,
"useUserCRPref" => $experiment->userConfigurationData->useUserCRPref,
- "allowedFileSize" => Config::get('pga_config.airavata')["server-allowed-file-size"],
+ "allowedFileSize" => $this->getAllowedFileSize(),
'experiment' => $experiment,
"queueDefaults" => $queueDefaults,
'computeResources' => $computeResources,
@@ -503,6 +496,21 @@ class ExperimentController extends BaseController
return Response::json(array("success" => false, "error" => "Error: failed to update sharing: " . $ex->getMessage()));
}
}
+
+ private function getAllowedFileSize()
+ {
+ // Condition added to deal with php ini default value set for post_max_size issue.
+ // NOTE: the following assumes that upload_max_filesize and
+ // post_max_size are in megabytes (for example, if
+ // upload_max_filesize is 8M then $allowedFileSize is 8, but the 'M'
+ // is assumed and not considered)
+ $allowedFileSize = intval( ini_get( 'upload_max_filesize' ) );
+ $serverLimit = intval( ini_get( 'post_max_size' ) );
+ if( $serverLimit < $allowedFileSize) {
+ $allowedFileSize = $serverLimit;
+ }
+ return $allowedFileSize;
+ }
}
?>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d0af4e3b/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index d939f7d..a4fee3b 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -753,9 +753,10 @@ class ExperimentUtilities
* Create form inputs to accept the inputs to the given application
* @param $id
* @param $isRequired
+ * @param $allowedFileSize maximum file size in megabytes
* @internal param $required
*/
- public static function create_inputs($id, $isRequired)
+ public static function create_inputs($id, $isRequired, $allowedFileSize)
{
$inputs = AppUtilities::get_application_inputs($id);
@@ -812,8 +813,11 @@ class ExperimentUtilities
<label for="experiment-input">' . $input->name . '</label>
<div data-file-id="' . $input->sanitizedFormName . '" class="readBytesButtons btn btn-default btn-xs"
data-toggle="modal" style="float: right">view file</div>
- <input class="file-input" type="file" name="' . $input->sanitizedFormName .
- '" id="' . $input->sanitizedFormName . '" ' . $required . '>
+ <div class="file-upload-container">
+ <input class="file-input" type="file" name="' . $input->sanitizedFormName .
+ '" id="' . $input->sanitizedFormName . '" ' . $required . '>
+ <div class="file-upload-max-size">Max Upload Size: ' . $allowedFileSize .'M</div>
+ </div>
<p class="help-block">' . $input->userFriendlyDescription . '</p>
</div>';
break;
@@ -830,7 +834,10 @@ class ExperimentUtilities
if($appInterface->hasOptionalFileInputs){
echo '<div>
<label>Optional Input Files</label>
- <input type="file" class="file-input" id="optInputFiles" name="optInputFiles[]" multiple onchange="javascript:updateList()" >
+ <div class="file-upload-container">
+ <input type="file" class="file-input" id="optInputFiles" name="optInputFiles[]" multiple onchange="javascript:updateList()" >
+ <div class="file-upload-max-size">Max Upload Size: ' . $allowedFileSize .'M</div>
+ </div>
<div id="optFileList"></div>
</div>';
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d0af4e3b/app/views/experiment/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/edit.blade.php b/app/views/experiment/edit.blade.php
index bfa5331..52e035b 100755
--- a/app/views/experiment/edit.blade.php
+++ b/app/views/experiment/edit.blade.php
@@ -39,6 +39,7 @@
This experiment is connected with an Application which is currently not deployed on any Resource. The experiment cannot be launched at the moment.
</p>
@endif
+ <input type="hidden" id="allowedFileSize" value="{{ $expInputs['allowedFileSize'] }}"/>
</form>
</div>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d0af4e3b/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 c2c85f8..dfe9d6c 100644
--- a/app/views/partials/experiment-inputs.blade.php
+++ b/app/views/partials/experiment-inputs.blade.php
@@ -41,9 +41,9 @@
{{ ExperimentUtilities::list_input_files($expInputs['experiment']->experimentInputs) }}
<hr/>
</div>
- {{ ExperimentUtilities::create_inputs($expInputs['application'], false) }}
+ {{ ExperimentUtilities::create_inputs($expInputs['application'], false, $expInputs['allowedFileSize']) }}
@else
- {{ ExperimentUtilities::create_inputs($expInputs['application'], true) }}
+ {{ ExperimentUtilities::create_inputs($expInputs['application'], true, $expInputs['allowedFileSize']) }}
@endif
</div>
<!-- Modal to view file inputs-->
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/d0af4e3b/public/css/bootstrap.min.css
----------------------------------------------------------------------
diff --git a/public/css/bootstrap.min.css b/public/css/bootstrap.min.css
index 69ea7f4..0f7ca0c 100644
--- a/public/css/bootstrap.min.css
+++ b/public/css/bootstrap.min.css
@@ -144,4 +144,22 @@ body{
top: 0px;
bottom: 0px;
right: 0px;
+}
+
+.file-upload-container {
+ position: relative;
+ padding-right: 120px;
+}
+.file-upload-container > input[type="file"] {
+ width: 100%;
+}
+.file-upload-container > .file-upload-max-size {
+ position: absolute;
+ right: 0px;
+ top: 50%;
+ /* negative one half of the height of this element (which is approx. font-size * line-height) */
+ margin-top: calc( -1/2 * (12px * 1.42) );
+ font-size: 12px;
+ font-style: italic;
+ color: #737373;
}
\ No newline at end of file
[05/10] airavata-php-gateway git commit: AIRAVATA-1397 Set
upload_max_filesize to 64M in .htaccess
Posted by ma...@apache.org.
AIRAVATA-1397 Set upload_max_filesize to 64M in .htaccess
These settings in .htaccess override whatever is in /etc/php.ini. This
provides a better out of the box default max upload size.
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/71f32f4e
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/71f32f4e
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/71f32f4e
Branch: refs/heads/develop
Commit: 71f32f4ee5c3eb200750f22aaf45692f3d45c308
Parents: bc6ded0
Author: Marcus Christie <ma...@apache.org>
Authored: Wed Jan 18 15:36:56 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Wed Jan 18 15:36:56 2017 -0500
----------------------------------------------------------------------
public/.htaccess | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/71f32f4e/public/.htaccess
----------------------------------------------------------------------
diff --git a/public/.htaccess b/public/.htaccess
index 77827ae..6963271 100755
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -13,3 +13,8 @@
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
+
+# Allow uploading files up to 64MB in size.
+# NOTE: if you change one of these values you will need to change the other one likewise.
+php_value upload_max_filesize 64M
+php_value post_max_size 64M
\ No newline at end of file
[06/10] airavata-php-gateway git commit: AIRAVATA-1397 Fix client
side checking for opt input files
Posted by ma...@apache.org.
AIRAVATA-1397 Fix client side checking for opt input files
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/9e75b854
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/9e75b854
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/9e75b854
Branch: refs/heads/develop
Commit: 9e75b854f6b0f0165f97c5e2095cf8fb5434faa8
Parents: 71f32f4
Author: Marcus Christie <ma...@apache.org>
Authored: Wed Jan 18 16:27:23 2017 -0500
Committer: Marcus Christie <ma...@apache.org>
Committed: Wed Jan 18 16:27:23 2017 -0500
----------------------------------------------------------------------
app/views/experiment/create-complete.blade.php | 11 +++++----
app/views/experiment/edit.blade.php | 11 +++++----
public/js/util.js | 25 ++++++++++++++++++++-
3 files changed, 38 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9e75b854/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 8860df2..7f085ca 100755
--- a/app/views/experiment/create-complete.blade.php
+++ b/app/views/experiment/create-complete.blade.php
@@ -52,6 +52,7 @@
</script>
{{ HTML::script('js/sharing/sharing_utils.js') }}
{{ HTML::script('js/sharing/share.js') }}
+{{ HTML::script('js/util.js') }}
<script>
var warn = true;
@@ -62,12 +63,14 @@
$('.file-input').bind('change', function () {
- var inputFileSize = Math.round(this.files[0].size / (1024 * 1024));
- if (inputFileSize > $("#allowedFileSize").val()) {
- alert("The input file size is greater than the allowed file size (" + $("#allowedFileSize").val() + " MB) in a form. Please upload another file.");
+ var allowedFileSize = $("#allowedFileSize").val();
+ var tooLargeFilenames = util.validateMaxUploadFileSize(this.files, allowedFileSize);
+
+ if (tooLargeFilenames.length > 0) {
+ var singleOrMultiple = tooLargeFilenames.length === 1 ? " the file [" : " each of the files [";
+ alert("The size of " + singleOrMultiple + tooLargeFilenames.join(", ") + "] is greater than the allowed file size (" + allowedFileSize + " MB) in a form. Please upload another file.");
$(this).val("");
}
-
});
$("#enableEmail").change(function () {
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9e75b854/app/views/experiment/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/edit.blade.php b/app/views/experiment/edit.blade.php
index 00fd008..cbefee3 100755
--- a/app/views/experiment/edit.blade.php
+++ b/app/views/experiment/edit.blade.php
@@ -67,15 +67,18 @@
</script>
{{ HTML::script('js/sharing/sharing_utils.js') }}
{{ HTML::script('js/sharing/share.js') }}
+{{ HTML::script('js/util.js') }}
<script>
$('.file-input').bind('change', function () {
- var inputFileSize = Math.round(this.files[0].size / (1024 * 1024));
- if (inputFileSize > $("#allowedFileSize").val()) {
- alert("The input file size is greater than the allowed file size (" + $("#allowedFileSize").val() + " MB) in a form. Please upload another file.");
+ var allowedFileSize = $("#allowedFileSize").val();
+ var tooLargeFilenames = util.validateMaxUploadFileSize(this.files, allowedFileSize);
+
+ if (tooLargeFilenames.length > 0) {
+ var singleOrMultiple = tooLargeFilenames.length === 1 ? " the file [" : " each of the files [";
+ alert("The size of " + singleOrMultiple + tooLargeFilenames.join(", ") + "] is greater than the allowed file size (" + allowedFileSize + " MB) in a form. Please upload another file.");
$(this).val("");
}
-
});
$("#enableEmail").change(function () {
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9e75b854/public/js/util.js
----------------------------------------------------------------------
diff --git a/public/js/util.js b/public/js/util.js
index c5cbb24..0b7d1e6 100644
--- a/public/js/util.js
+++ b/public/js/util.js
@@ -1,12 +1,35 @@
var util = (function(){
"use strict";
-
+
return {
sanitizeHTMLId: function(id) {
// Replace anything that isn't an HTML safe id character with underscore
// Here safe means allowable by HTML5 and also safe to use in a jQuery selector
return id.replace(/[^a-zA-Z0-9_-]/g, "_");
+ },
+
+ /**
+ * Return a list of filenames that exceed the given maxUploadFileSize.
+ *
+ * @param fileList is of type FileList
+ * @param maxUploadFileSize is a number of megabytes
+ * @return Array of string filenames. Array is empty if none of the
+ * files exceed the given maxUploadFileSize.
+ */
+ validateMaxUploadFileSize: function(fileList, maxUploadFileSize) {
+
+ var tooLargeFilenames = [];
+ for (var i=0; i < fileList.length; i++) {
+
+ var file = fileList[i];
+ var inputFileSize = file.size / (1024 * 1024);
+ if (inputFileSize > maxUploadFileSize) {
+ tooLargeFilenames.push(file.name);
+ }
+ }
+
+ return tooLargeFilenames;
}
};
})();
\ No newline at end of file