fixing bug in optional input files when cloaning and editing

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

Branch: refs/heads/master
Commit: 1dbadf9b65a6cbafb606b06fbc841b7f73581cca
Parents: 683eeec
Author: scnakandala <[email protected]>
Authored: Wed Jul 6 15:05:13 2016 -0400
Committer: scnakandala <[email protected]>
Committed: Wed Jul 6 15:05:13 2016 -0400

----------------------------------------------------------------------
 app/libraries/ExperimentUtilities.php | 31 +++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/1dbadf9b/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php 
b/app/libraries/ExperimentUtilities.php
index da1a0d3..3c708d8 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -328,15 +328,14 @@ class ExperimentUtilities
         $experimentAssemblySuccessful = true;
         $newExperimentInputs = array();
 
-        ExperimentUtilities::create_experiment_folder_path($projectId, 
$experimentName);
-//        if (sizeof($_FILES) > 0) {
-//            if (ExperimentUtilities::file_upload_successful()) {
-//                // construct unique path
-//                
ExperimentUtilities::create_experiment_folder_path($projectId, $experimentName);
-//            } else {
-//                $experimentAssemblySuccessful = false;
-//            }
-//        }
+        if (sizeof($_FILES) > 0) {
+            if (ExperimentUtilities::file_upload_successful()) {
+                // construct unique path
+                ExperimentUtilities::create_experiment_folder_path($projectId, 
$experimentName);
+            } else {
+                $experimentAssemblySuccessful = false;
+            }
+        }
 
         //sending application inputs in the order defined by the admins.
         $order = array();
@@ -477,12 +476,14 @@ class ExperimentUtilities
                 }
             }
 
-            $uriList = substr($uriList,0, strlen($uriList) - 1);
-            $optInput = new InputDataObjectType();
-            $optInput->name = "Optional-File-Input-List";
-            $optInput->type = DataType::URI_COLLECTION;
-            $optInput->value = $uriList;
-            $newExperimentInputs[] = $optInput;
+            if(strlen($uriList) > 0){
+                $uriList = substr($uriList,0, strlen($uriList) - 1);
+                $optInput = new InputDataObjectType();
+                $optInput->name = "Optional-File-Input-List";
+                $optInput->type = DataType::URI_COLLECTION;
+                $optInput->value = $uriList;
+                $newExperimentInputs[] = $optInput;
+            }
         }
 
         if ($experimentAssemblySuccessful) {

Reply via email to