Cleaning and restructuring PGA

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

Branch: refs/heads/master
Commit: 2fbd92892f9e4460dcaa65c72981a7b1017da832
Parents: 71890a7
Author: Supun Nakandala <[email protected]>
Authored: Fri Jun 5 03:45:04 2015 +0530
Committer: Supun Nakandala <[email protected]>
Committed: Fri Jun 5 03:45:04 2015 +0530

----------------------------------------------------------------------
 app/config/pga_config.php                       |    5 +
 app/controllers/AccountController.php           |  119 +-
 app/controllers/ComputeResource.php             |  439 ++--
 app/controllers/ExperimentController.php        |  528 +++--
 app/controllers/ProjectController.php           |  171 +-
 app/controllers/ResourceController.php          |  439 ++--
 app/filters.php                                 |   80 +-
 app/libraries/AdminUtilities.php                |   20 +-
 app/libraries/AiravataClientFactory.php         |   24 -
 app/libraries/AppUtilities.php                  |  514 +++--
 app/libraries/CRUtilities.php                   |  756 +++---
 app/libraries/CommonUtilities.php               |  246 ++
 app/libraries/ExperimentUtilities.php           |  965 ++++++++
 app/libraries/ProjectUtilities.php              |  282 +++
 app/libraries/Utilities.php                     | 2145 ------------------
 app/models/Constant.php                         |   48 -
 app/models/User.php                             |   25 -
 app/routes.php                                  |   26 +-
 app/views/account/create.blade.php              |   53 +-
 app/views/account/forgot-password.blade.php     |   17 +-
 app/views/account/login.blade.php               |   69 +-
 app/views/admin/dashboard.blade.php             |   97 +-
 app/views/admin/manage-admin.blade.php          |  315 +--
 app/views/admin/manage-credentials.blade.php    |  276 +--
 app/views/admin/manage-experiments.blade.php    |  766 ++++---
 app/views/admin/manage-gateway.blade.php        |  235 +-
 app/views/admin/manage-resources.blade.php      |  101 +-
 app/views/admin/manage-roles.blade.php          |  223 +-
 app/views/admin/manage-users.blade.php          |  255 ++-
 app/views/application/deployment.blade.php      |  343 +--
 app/views/application/interface.blade.php       |  290 +--
 app/views/application/module.blade.php          |  375 +--
 app/views/emails/auth/reminder.blade.php        |   20 +-
 app/views/experiment/browse.blade.php           |  222 +-
 app/views/experiment/create-complete.blade.php  |   51 +-
 app/views/experiment/create.blade.php           |   22 +-
 app/views/experiment/edit.blade.php             |   63 +-
 app/views/experiment/search.blade.php           |  367 ++-
 app/views/experiment/summary.blade.php          |   41 +-
 app/views/gateway/browse.blade.php              |  394 ++--
 app/views/gateway/create.blade.php              |   43 +-
 app/views/home.blade.php                        |   95 +-
 app/views/layout/basic.blade.php                |  154 +-
 app/views/partials/dashboard-block.blade.php    |  102 +-
 app/views/partials/deployment-block.blade.php   |  197 +-
 app/views/partials/experiment-info.blade.php    |   39 +-
 app/views/partials/experiment-inputs.blade.php  |  100 +-
 .../partials/experiment-queue-block.blade.php   |  192 +-
 .../partials/gateway-preferences.blade.php      |  147 +-
 app/views/partials/interface-block.blade.php    |   95 +-
 .../partials/interface-input-block.blade.php    |  216 +-
 .../partials/interface-output-block.blade.php   |  181 +-
 app/views/partials/module-block.blade.php       |   28 +-
 app/views/partials/queue-block.blade.php        |   35 +-
 app/views/project/browse.blade.php              |  165 +-
 app/views/project/create.blade.php              |   44 +-
 app/views/project/edit.blade.php                |   16 +-
 app/views/project/search.blade.php              |  204 +-
 app/views/project/summary.blade.php             |   29 +-
 app/views/resource/browse.blade.php             |  245 +-
 app/views/resource/create-step3.blade.php       |   31 +-
 app/views/resource/create.blade.php             |   61 +-
 app/views/resource/edit.blade.php               | 1355 +++++------
 app/views/resource/view.blade.php               |    0
 app/views/scigap-admin/manage-gateway.blade.php |  247 +-
 app/views/server-down.blade.php                 |   11 +-
 composer.json                                   |   67 +-
 67 files changed, 7599 insertions(+), 7927 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2fbd9289/app/config/pga_config.php
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php b/app/config/pga_config.php
index 48599b2..56f5fcb 100644
--- a/app/config/pga_config.php
+++ b/app/config/pga_config.php
@@ -92,6 +92,11 @@ return array(
         'server-allowed-file-size' => 64,
 
         /**
+         * directory in the web server where experiment data is staged. This 
path should be a relative path from app root
+         */
+        'experiment-data-root' => '/../experimentData/',
+
+        /**
          * Advanced experiments options
          */
         'advanced-experiment-options' => '',

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2fbd9289/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php 
b/app/controllers/AccountController.php
index 85ffd1d..91280c6 100755
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -1,29 +1,30 @@
 <?php
 
-class AccountController extends BaseController {
-
-       public function createAccountView()
-       {
-               return View::make('account/create');
-       }
-
-       public function createAccountSubmit()
-       {
-               $rules = array(
-                               "username" => "required|min:6",
-                               "password" => "required|min:6",
-                               "confirm_password" => "required|same:password",
-                               "email" => "required",
-               );
-
-               $validator = Validator::make( Input::all(), $rules);
-               if( $validator->fails()){
-                       $messages = $validator->messages();
-
-                       return Redirect::to("create")
-                                                                               
->withInput(Input::except('password', 'password_confirm'))
-                                                                               
->withErrors( $validator);
-               }
+class AccountController extends BaseController
+{
+
+    public function createAccountView()
+    {
+        return View::make('account/create');
+    }
+
+    public function createAccountSubmit()
+    {
+        $rules = array(
+            "username" => "required|min:6",
+            "password" => "required|min:6",
+            "confirm_password" => "required|same:password",
+            "email" => "required",
+        );
+
+        $validator = Validator::make(Input::all(), $rules);
+        if ($validator->fails()) {
+            $messages = $validator->messages();
+
+            return Redirect::to("create")
+                ->withInput(Input::except('password', 'password_confirm'))
+                ->withErrors($validator);
+        }
 
         $first_name = $_POST['first_name'];
         $last_name = $_POST['last_name'];
@@ -40,60 +41,62 @@ class AccountController extends BaseController {
         $url = $_POST['url'];
 
         if (WSIS::usernameExists($username)) {
-               return Redirect::to("create")
-                                                                               
->withInput(Input::except('password', 'password_confirm'))
-                                                                               
->with("username_exists", true);
-               }
-        else{
+            return Redirect::to("create")
+                ->withInput(Input::except('password', 'password_confirm'))
+                ->with("username_exists", true);
+        } else {
             WSIS::addUser($username, $password, $first_name, $last_name, 
$email, $organization,
-            $address, $country,$telephone, $mobile, $im, $url);
-            Utilities::print_success_message('New user created!');
+                $address, $country, $telephone, $mobile, $im, $url);
+            CommonUtilities::print_success_message('New user created!');
 
             return View::make('home');
-               }
-       }
+        }
+    }
 
-       public function loginView(){
-               return View::make('account/login');
-       }
+    public function loginView()
+    {
+        return View::make('account/login');
+    }
 
-       public function loginSubmit(){
+    public function loginSubmit()
+    {
 
-        if ( Utilities::form_submitted() ) {
+        if (CommonUtilities::form_submitted()) {
             $username = $_POST['username'];
             $password = $_POST['password'];
             try {
                 if (WSIS::authenticate($username, $password)) {
-                    if( 
in_array(Config::get('pga_config.wsis')['admin-role-name'], 
(array)WSIS::getUserRoles($username)))
-                    {
+                    if 
(in_array(Config::get('pga_config.wsis')['admin-role-name'], 
(array)WSIS::getUserRoles($username))) {
                         Session::put("admin", true);
                     }
 
-                    Utilities::store_id_in_session($username);
-                    Utilities::print_success_message('Login successful! You 
will be redirected to your home page shortly.');
-                       Session::put("gateway_id", 
Config::get('pga_config.wsis')['gateway-id']);
-                       //TODO::If this option is not safe, have to find a 
better method to send credentials to identity server on every connection.
-                       Session::put("password", $_POST["password"]);
-                       
-                       return Redirect::to( "home");
+                    CommonUtilities::store_id_in_session($username);
+                    CommonUtilities::print_success_message('Login successful! 
You will be redirected to your home page shortly.');
+                    Session::put("gateway_id", 
Config::get('pga_config.wsis')['gateway-id']);
+                    //TODO::If this option is not safe, have to find a better 
method to send credentials to identity server on every connection.
+                    Session::put("password", $_POST["password"]);
+
+                    return Redirect::to("home");
 
                 } else {
-                       return 
Redirect::to("login")->with("invalid-credentials", true); 
+                    return Redirect::to("login")->with("invalid-credentials", 
true);
                 }
             } catch (Exception $ex) {
-                return Redirect::to("login")->with("invalid-credentials", 
true); 
+                return Redirect::to("login")->with("invalid-credentials", 
true);
             }
         }
 
-       }
+    }
+
+    public function forgotPassword()
+    {
+        return View::make("account/forgot-password");
+    }
 
-       public function forgotPassword(){
-               return View::make("account/forgot-password");
-       }
+    public function logout()
+    {
+        Session::flush();
+        return Redirect::to('home');
+    }
 
-       public function logout(){
-               Session::flush();
-               return Redirect::to('home');
-       }
-       
 }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2fbd9289/app/controllers/ComputeResource.php
----------------------------------------------------------------------
diff --git a/app/controllers/ComputeResource.php 
b/app/controllers/ComputeResource.php
index 6644c73..e3295bb 100755
--- a/app/controllers/ComputeResource.php
+++ b/app/controllers/ComputeResource.php
@@ -1,238 +1,211 @@
 <?php
 
-class ComputeResource extends BaseController{
-       
-       /**
-       *    Instantiate a new Compute Resource Controller Instance
-       **/
-
-       public function __construct()
-       {
-               $this->beforeFilter('verifyadmin');
-               Session::put("nav-active", "compute-resource");
-
-       }
-
-       public function createView(){
-                       return View::make("resource/create");
-       }
-
-       public function createSubmit(){
-
-               $hostAliases = Input::get("hostaliases");
-               $ips = Input::get("ips");
-               $computeDescription = array( 
-                                                                       
"hostName"=> trim( Input::get("hostname") ),
-                                                                       
"hostAliases"=> array_unique( array_filter( $hostAliases) ),
-                                                                       
"ipAddresses"=> array_unique( array_filter( $ips) ),
-                                                                       
"resourceDescription"=>Input::get("description") 
-                                                                       );
-               $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription);
-               
-               return Redirect::to( "cr/edit?crId=" . 
$computeResource->computeResourceId);
-       }
-
-       public function editView(){
-               
-               $data = CRUtilities::getEditCRData();
-               $computeResourceId = "";
-               if( Input::has("crId"))
-                       $computeResourceId = Input::get("crId");
-               else if( Session::has("computeResource"))
-               {
-                       $computeResource = Session::get("computeResource");
-                       $computeResourceId = 
$computeResource->computeResourceId;
-               }
-
-               if( $computeResourceId != "")
-               {
-                       $computeResource = Utilities::get_compute_resource(  
$computeResourceId);
-                       $jobSubmissionInterfaces = array();
-                       $dataMovementInterfaces = array();
-                       $addedJSP = array();
-                       $addedDMI = array();
-                       //var_dump( $computeResource->jobSubmissionInterfaces); 
exit;
-                       if( count( $computeResource->jobSubmissionInterfaces) )
-                       {
-                               foreach( 
$computeResource->jobSubmissionInterfaces as $JSI )
-                               {
-                                       $jobSubmissionInterfaces[] = 
CRUtilities::getJobSubmissionDetails( $JSI->jobSubmissionInterfaceId, 
$JSI->jobSubmissionProtocol);
-                                       $addedJSP[] = 
$JSI->jobSubmissionProtocol;
-                               }
-                       }
-                       //var_dump( CRUtilities::getJobSubmissionDetails( 
$data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 
1) ); exit;
-                       if( count( $computeResource->dataMovementInterfaces) )
-                       {
-                               foreach( 
$computeResource->dataMovementInterfaces as $DMI )
-                               {
-                                       $dataMovementInterfaces[] = 
CRUtilities::getDataMovementDetails( $DMI->dataMovementInterfaceId, 
$DMI->dataMovementProtocol);
-                                       $addedDMI[] = 
$DMI->dataMovementProtocol;
-                               }
-                       }
-
-                       $data["computeResource"] = $computeResource;
-                       $data["jobSubmissionInterfaces"] = 
$jobSubmissionInterfaces;
-                       $data["dataMovementInterfaces"] = 
$dataMovementInterfaces;
-                       $data["addedJSP"] = $addedJSP;
-                       $data["addedDMI"] = $addedDMI;
-                       //var_dump($data["jobSubmissionInterfaces"]); exit;
-                       return View::make("resource/edit", $data);
-               }
-               else
-                       return 
View::make("resource/browse")->with("login-alert", "Unable to retrieve this 
Compute Resource. Please report this error to devs.");
-
-       }
-               
-       public function editSubmit(){
-
-               $tabName = "";
-               if( Input::get("cr-edit") == "resDesc") /* Modify compute 
Resource description */
-               {
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       $computeDescription->hostName = trim( 
Input::get("hostname") );
-                       $computeDescription->hostAliases = array_unique( 
array_filter( Input::get("hostaliases") ) );
-                       $computeDescription->ipAddresses = array_unique( 
array_filter( Input::get("ips") ) );
-                       $computeDescription->resourceDescription = 
Input::get("description");
-                       $computeDescription->maxMemoryPerNode = 
Input::get("maxMemoryPerNode");
-                       //var_dump( $computeDescription); exit;
-
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-
-                       $tabName =  "#tab-desc";
-               }
-               if( Input::get("cr-edit") == "queue") /* Add / Modify a Queue */
-               {
-                       $queue = array( "queueName"                     
=>Input::get("qname"),
-                                                       "queueDescription"      
=>Input::get("qdesc"),
-                                                       "maxRunTime"            
=>Input::get( "qmaxruntime"),
-                                                       "maxNodes"              
        =>Input::get("qmaxnodes"),
-                                                       "maxProcessors"         
=>Input::get("qmaxprocessors"),
-                                                       "maxJobsInQueue"        
=>Input::get("qmaxjobsinqueue"),
-                                                       "maxMemory"             
        =>Input::get("qmaxmemoryinqueue")
-                                               );
-
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       $computeDescription->batchQueues[] = 
CRUtilities::createQueueObject( $queue);
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-                       //var_dump( $computeResource); exit;
-                       $tabName = "#tab-queues";
-               }
-               else if( Input::get("cr-edit") == "delete-queue" )
-               {
-                       CRUtilities::deleteQueue( Input::get("crId"), 
Input::get("queueName") );
-                       $tabName = "#tab-queues";
-               } 
-               else if( Input::get("cr-edit") == "fileSystems")
-               {
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       $computeDescription->fileSystems = array_filter( 
Input::get("fileSystems"), "trim");
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-
-                       $tabName = "#tab-filesystem";
-               }
-               else if( Input::get("cr-edit") == "jsp" ||  
Input::get("cr-edit") == "edit-jsp" ) /* Add / Modify a Job Submission 
Interface */
-               {               
-                       $update = false;        
-                       if( Input::get("cr-edit") == "edit-jsp")
-                               $update = true;
-
-                       $jobSubmissionInterface = 
CRUtilities::create_or_update_JSIObject( Input::all(), $update );
-
-                       $tabName = "#tab-jobSubmission";
-               }
-               else if( Input::get("cr-edit") == "jsi-priority") 
-               {
-                       $inputs = Input::all();
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       foreach( $computeDescription->jobSubmissionInterfaces 
as $index => $jsi)
-                       {
-                               foreach( $inputs["jsi-id"] as $idIndex => 
$jsiId)
-                               {
-                                       if( $jsiId == 
$jsi->jobSubmissionInterfaceId )
-                                       {
-                                               
$computeDescription->jobSubmissionInterfaces[$index]->priorityOrder = 
$inputs["jsi-priority"][$idIndex];
-                                               break;
-                                       }
-                               }
-                       }
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-
-                       return 1; //currently done by ajax.
-               }
-               else if( Input::get("cr-edit") == "dmp" ||  
Input::get("cr-edit") == "edit-dmi" ) /* Add / Modify a Data Movement Interface 
*/
-               {
-                       $update = false;        
-                       if( Input::get("cr-edit") == "edit-dmi")
-                               $update = true;
-                       $dataMovementInterface = 
CRUtilities::create_or_update_DMIObject( Input::all(), $update );
-
-                       $tabName = "#tab-dataMovement";
-               }
-               else if( Input::get("cr-edit") == "dmi-priority") 
-               {
-                       $inputs = Input::all();
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       foreach( $computeDescription->dataMovementInterfaces as 
$index => $dmi)
-                       {
-                               foreach( $inputs["dmi-id"] as $idIndex => 
$dmiId)
-                               {
-                                       if( $dmiId == 
$dmi->dataMovementInterfaceId )
-                                       {
-                                               
$computeDescription->dataMovementInterfaces[$index]->priorityOrder = 
$inputs["dmi-priority"][$idIndex];
-                                               break;
-                                       }
-                               }
-                       }
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-
-                       return 1; //currently done by ajax.
-               }
-
-               return Redirect::to("cr/edit?crId=" . Input::get("crId") . 
$tabName );
-       }
-
-       public function deleteActions(){
-
-               $result = CRUtilities::deleteActions( Input::all() );
-               if( Input::has("jsiId"))
-               {
-                       return Redirect::to("cr/edit?crId=" . 
Input::get("crId"). "#tab-jobSubmission")
-                                                       ->with("message", "Job 
Submission Interface was deleted successfully");
-               }
-               if( Input::has("dmiId"))
-               {
-                       return Redirect::to("cr/edit?crId=" . 
Input::get("crId"). "#tab-dataMovement")
-                                                       ->with( "message", 
"Data Movement Protocol was deleted successfully");
-               }
-               elseif( Input::has("del-crId") )
-               {
-                       return Redirect::to("cr/browse")->with("message", "The 
Compute Resource has been successfully deleted.");
-               }
-               else
-                       return $result;
-       }
-
-       public function browseView(){
-               $data = CRUtilities::getBrowseCRData();
-               $allCRs = $data["crObjects"];
-               $appDeployments = $data["appDeployments"];
-
-               $connectedDeployments = array();
-               foreach( (array)$allCRs as $crId => $crName)
-               {
-                       $connectedDeployments[ $crId] = 0;
-                       foreach( (array)$appDeployments as $deploymentObject)
-                       {
-                               if( $crId == $deploymentObject->computeHostId)
-                                       $connectedDeployments[$crId]++;
-                       }
-               }
-               return View::make("resource/browse", array(
-                                                                               
                "allCRs" => $allCRs,
-                                                                               
                "connectedDeployments" => $connectedDeployments
-                                                                               
                ));
-
-       }
+class ComputeResource extends BaseController
+{
+
+    /**
+     *    Instantiate a new Compute Resource Controller Instance
+     **/
+
+    public function __construct()
+    {
+        $this->beforeFilter('verifyadmin');
+        Session::put("nav-active", "compute-resource");
+
+    }
+
+    public function createView()
+    {
+        return View::make("resource/create");
+    }
+
+    public function createSubmit()
+    {
+
+        $hostAliases = Input::get("hostaliases");
+        $ips = Input::get("ips");
+        $computeDescription = array(
+            "hostName" => trim(Input::get("hostname")),
+            "hostAliases" => array_unique(array_filter($hostAliases)),
+            "ipAddresses" => array_unique(array_filter($ips)),
+            "resourceDescription" => Input::get("description")
+        );
+        $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription);
+
+        return Redirect::to("cr/edit?crId=" . 
$computeResource->computeResourceId);
+    }
+
+    public function editView()
+    {
+
+        $data = CRUtilities::getEditCRData();
+        $computeResourceId = "";
+        if (Input::has("crId"))
+            $computeResourceId = Input::get("crId");
+        else if (Session::has("computeResource")) {
+            $computeResource = Session::get("computeResource");
+            $computeResourceId = $computeResource->computeResourceId;
+        }
+
+        if ($computeResourceId != "") {
+            $computeResource = 
AppUtilities::get_compute_resource($computeResourceId);
+            $jobSubmissionInterfaces = array();
+            $dataMovementInterfaces = array();
+            $addedJSP = array();
+            $addedDMI = array();
+            //var_dump( $computeResource->jobSubmissionInterfaces); exit;
+            if (count($computeResource->jobSubmissionInterfaces)) {
+                foreach ($computeResource->jobSubmissionInterfaces as $JSI) {
+                    $jobSubmissionInterfaces[] = 
CRUtilities::getJobSubmissionDetails($JSI->jobSubmissionInterfaceId, 
$JSI->jobSubmissionProtocol);
+                    $addedJSP[] = $JSI->jobSubmissionProtocol;
+                }
+            }
+            //var_dump( CRUtilities::getJobSubmissionDetails( 
$data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 
1) ); exit;
+            if (count($computeResource->dataMovementInterfaces)) {
+                foreach ($computeResource->dataMovementInterfaces as $DMI) {
+                    $dataMovementInterfaces[] = 
CRUtilities::getDataMovementDetails($DMI->dataMovementInterfaceId, 
$DMI->dataMovementProtocol);
+                    $addedDMI[] = $DMI->dataMovementProtocol;
+                }
+            }
+
+            $data["computeResource"] = $computeResource;
+            $data["jobSubmissionInterfaces"] = $jobSubmissionInterfaces;
+            $data["dataMovementInterfaces"] = $dataMovementInterfaces;
+            $data["addedJSP"] = $addedJSP;
+            $data["addedDMI"] = $addedDMI;
+            //var_dump($data["jobSubmissionInterfaces"]); exit;
+            return View::make("resource/edit", $data);
+        } else
+            return View::make("resource/browse")->with("login-alert", "Unable 
to retrieve this Compute Resource. Please report this error to devs.");
+
+    }
+
+    public function editSubmit()
+    {
+
+        $tabName = "";
+        if (Input::get("cr-edit") == "resDesc") /* Modify compute Resource 
description */ {
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            $computeDescription->hostName = trim(Input::get("hostname"));
+            $computeDescription->hostAliases = 
array_unique(array_filter(Input::get("hostaliases")));
+            $computeDescription->ipAddresses = 
array_unique(array_filter(Input::get("ips")));
+            $computeDescription->resourceDescription = 
Input::get("description");
+            $computeDescription->maxMemoryPerNode = 
Input::get("maxMemoryPerNode");
+            //var_dump( $computeDescription); exit;
+
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+            $tabName = "#tab-desc";
+        }
+        if (Input::get("cr-edit") == "queue") /* Add / Modify a Queue */ {
+            $queue = array("queueName" => Input::get("qname"),
+                "queueDescription" => Input::get("qdesc"),
+                "maxRunTime" => Input::get("qmaxruntime"),
+                "maxNodes" => Input::get("qmaxnodes"),
+                "maxProcessors" => Input::get("qmaxprocessors"),
+                "maxJobsInQueue" => Input::get("qmaxjobsinqueue"),
+                "maxMemory" => Input::get("qmaxmemoryinqueue")
+            );
+
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            $computeDescription->batchQueues[] = 
CRUtilities::createQueueObject($queue);
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+            //var_dump( $computeResource); exit;
+            $tabName = "#tab-queues";
+        } else if (Input::get("cr-edit") == "delete-queue") {
+            CRUtilities::deleteQueue(Input::get("crId"), 
Input::get("queueName"));
+            $tabName = "#tab-queues";
+        } else if (Input::get("cr-edit") == "fileSystems") {
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            $computeDescription->fileSystems = 
array_filter(Input::get("fileSystems"), "trim");
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+            $tabName = "#tab-filesystem";
+        } else if (Input::get("cr-edit") == "jsp" || Input::get("cr-edit") == 
"edit-jsp") /* Add / Modify a Job Submission Interface */ {
+            $update = false;
+            if (Input::get("cr-edit") == "edit-jsp")
+                $update = true;
+
+            $jobSubmissionInterface = 
CRUtilities::create_or_update_JSIObject(Input::all(), $update);
+
+            $tabName = "#tab-jobSubmission";
+        } else if (Input::get("cr-edit") == "jsi-priority") {
+            $inputs = Input::all();
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            foreach ($computeDescription->jobSubmissionInterfaces as $index => 
$jsi) {
+                foreach ($inputs["jsi-id"] as $idIndex => $jsiId) {
+                    if ($jsiId == $jsi->jobSubmissionInterfaceId) {
+                        
$computeDescription->jobSubmissionInterfaces[$index]->priorityOrder = 
$inputs["jsi-priority"][$idIndex];
+                        break;
+                    }
+                }
+            }
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+            return 1; //currently done by ajax.
+        } else if (Input::get("cr-edit") == "dmp" || Input::get("cr-edit") == 
"edit-dmi") /* Add / Modify a Data Movement Interface */ {
+            $update = false;
+            if (Input::get("cr-edit") == "edit-dmi")
+                $update = true;
+            $dataMovementInterface = 
CRUtilities::create_or_update_DMIObject(Input::all(), $update);
+
+            $tabName = "#tab-dataMovement";
+        } else if (Input::get("cr-edit") == "dmi-priority") {
+            $inputs = Input::all();
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            foreach ($computeDescription->dataMovementInterfaces as $index => 
$dmi) {
+                foreach ($inputs["dmi-id"] as $idIndex => $dmiId) {
+                    if ($dmiId == $dmi->dataMovementInterfaceId) {
+                        
$computeDescription->dataMovementInterfaces[$index]->priorityOrder = 
$inputs["dmi-priority"][$idIndex];
+                        break;
+                    }
+                }
+            }
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+            return 1; //currently done by ajax.
+        }
+
+        return Redirect::to("cr/edit?crId=" . Input::get("crId") . $tabName);
+    }
+
+    public function deleteActions()
+    {
+
+        $result = CRUtilities::deleteActions(Input::all());
+        if (Input::has("jsiId")) {
+            return Redirect::to("cr/edit?crId=" . Input::get("crId") . 
"#tab-jobSubmission")
+                ->with("message", "Job Submission Interface was deleted 
successfully");
+        }
+        if (Input::has("dmiId")) {
+            return Redirect::to("cr/edit?crId=" . Input::get("crId") . 
"#tab-dataMovement")
+                ->with("message", "Data Movement Protocol was deleted 
successfully");
+        } elseif (Input::has("del-crId")) {
+            return Redirect::to("cr/browse")->with("message", "The Compute 
Resource has been successfully deleted.");
+        } else
+            return $result;
+    }
+
+    public function browseView()
+    {
+        $data = CRUtilities::getBrowseCRData();
+        $allCRs = $data["crObjects"];
+        $appDeployments = $data["appDeployments"];
+
+        $connectedDeployments = array();
+        foreach ((array)$allCRs as $crId => $crName) {
+            $connectedDeployments[$crId] = 0;
+            foreach ((array)$appDeployments as $deploymentObject) {
+                if ($crId == $deploymentObject->computeHostId)
+                    $connectedDeployments[$crId]++;
+            }
+        }
+        return View::make("resource/browse", array(
+            "allCRs" => $allCRs,
+            "connectedDeployments" => $connectedDeployments
+        ));
+
+    }
 }
 
 ?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2fbd9289/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php 
b/app/controllers/ExperimentController.php
index cb2c1f3..60561de 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -1,6 +1,7 @@
- <?php
+<?php
 
-class ExperimentController extends BaseController {
+class ExperimentController extends BaseController
+{
 
     /**
      * Limit used in fetching paginated results
@@ -8,301 +9,277 @@ class ExperimentController extends BaseController {
      */
     var $limit = 10;
 
-       /**
-       *    Instantiate a new ExperimentController Instance
-       **/
-
-       public function __construct()
-       {
-               $this->beforeFilter('verifylogin');
-               Session::put("nav-active", "experiment");
-       }
-
-       public function createView()
-       {
-               Session::forget( 'exp_create_continue');
-               return View::make('experiment/create');
-       }
-
-       public function createSubmit()
-       {
-               $inputs = Input::all();
-
-               if( isset( $_POST['continue'] ))
-               {
-                       Session::put( 'exp_create_continue', true);
-                       
-                       $computeResources = 
Utilities::create_compute_resources_select($_POST['application'], null);
-
-                       $queueDefaults = array( "queueName" => 
Config::get('pga_config.airavata')["queue-name"],
-                                                               "nodeCount" => 
Config::get('pga_config.airavata')["node-count"],
-                                                               "cpuCount" => 
Config::get('pga_config.airavata')["total-cpu-count"],
-                                                               "wallTimeLimit" 
=> Config::get('pga_config.airavata')["wall-time-limit"]
-                                                       );
-
-                       $experimentInputs = array( 
-                                                               "disabled" => ' 
disabled',
-                                                       "experimentName" => 
$_POST['experiment-name'],
-                                                       "experimentDescription" 
=> $_POST['experiment-description'] . ' ',
-                                                       "project" => 
$_POST['project'],
-                                                       "application" => 
$_POST['application'],
-                                                       "allowedFileSize" => 
Config::get('pga_config.airavata')["server-allowed-file-size"],
-                                                       "echo" => 
($_POST['application'] == 'Echo')? ' selected' : '',
-                                                       "wrf" => 
($_POST['application'] == 'WRF')? ' selected' : '',
-                                                       "queueDefaults" => 
$queueDefaults,
-                                                       "advancedOptions" => 
Config::get('pga_config.airavata')["advanced-experiment-options"],
-                                                       "computeResources" => 
$computeResources,
-                                                       "resourceHostId" => 
null,
-                                                       "advancedOptions" => 
Config::get('pga_config.airavata')["advanced-experiment-options"]
-                                               );
-
-                       return View::make( "experiment/create-complete", array( 
"expInputs" => $experimentInputs) );
-               }
-
-               else if (isset($_POST['save']) || isset($_POST['launch']))
-               {
-                   $expId = Utilities::create_experiment();
-
-                   if (isset($_POST['launch']) && $expId)
-                   {
-                       Utilities::launch_experiment($expId);
-                   }
-                   /* Not required.
-                   else
-                   {
-                       Utilities::print_success_message("<p>Experiment 
{$_POST['experiment-name']} created!</p>" .
-                           '<p>You will be redirected to the summary page 
shortly, or you can
-                           <a href=' . URL::to('/') . 
'"/experiment/summary?expId=' . $expId . '">go directly</a> to experiment 
summary page.</p>');
-                       
-                   }*/
-               return Redirect::to('experiment/summary?expId=' . $expId);
-               }
-               else
-                       return Redirect::to("home")->with("message", "Something 
went wrong here. Please file a bug report using the link in the Help menu.");
-       }
-
-       public function summary()
-       {
-               $experiment = Utilities::get_experiment($_GET['expId']);
-               if( $experiment != null)
-               {
-                       $project = 
Utilities::get_project($experiment->projectID);
-                       $expVal = Utilities::get_experiment_values( 
$experiment, $project);
-                       $jobDetails = Utilities::get_job_details( 
$experiment->experimentID);
-                       $transferDetails = Utilities::get_transfer_details( 
$experiment->experimentID);
-                       //var_dump( $jobDetails); exit;
-                       // User should not clone or edit a failed experiment. 
Only create clones of it.
-                       if( $expVal["experimentStatusString"] == "FAILED")
-                               $expVal["editable"] = false;
-
-                       $expVal["cancelable"] = false;
-                       if( $expVal["experimentStatusString"] == "LAUNCHED" || 
$expVal["experimentStatusString"] == "EXECUTING" )
-                               $expVal["cancelable"] = true;
-
-                       $data = array(
-                                                                               
"expId" => Input::get("expId"),
-                                                                               
"experiment" => $experiment,
-                                                                               
"project" => $project,
-                                                                               
"jobDetails" => $jobDetails,
-                                                                               
"expVal" => $expVal
-                                               );
-
-                       if( Request::ajax() )
-                       {
-                               //admin wants to see an experiment summary
-                               if( Input::has("dashboard"))
-                               {
-                                       $data["dashboard"] = true;
-                                       return 
View::make("partials/experiment-info", $data);
-                               }
-                               else
-                                       return json_encode( $experiment);
-                       }
-                       else
-                       {
-                               return View::make( "experiment/summary", $data);
-                       }
-               }
-               else
-               {
-                       if( Input::has("dashboard"))
-                               return View::make( "partials/experiment-info", 
array("invalidExperimentId" => 1)); 
-                       else
-                               return View::make( "experiment/summary", 
array("invalidExperimentId" => 1));
-               }
-       }
-
-       public function expCancel()
-       {
-               Utilities::cancel_experiment( Input::get("expId"));
-
-               return Redirect::to('experiment/summary?expId=' . 
Input::get("expId"));
-       }
-
-       public function expChange()
-       {
-               //var_dump( Input::all() ); exit;
-               $experiment = Utilities::get_experiment( Input::get('expId') );
-               $project = Utilities::get_project($experiment->projectID);
-
-               $expVal = Utilities::get_experiment_values( $experiment, 
$project);
-               /*if (isset($_POST['save']))
-               {
-                   $updatedExperiment = 
Utilities::apply_changes_to_experiment($experiment);
-
-                   Utilities::update_experiment($experiment->experimentID, 
$updatedExperiment);
-               }*/
-               if (isset($_POST['launch']))
-               {
-                   Utilities::launch_experiment($experiment->experimentID);
-                       return Redirect::to('experiment/summary?expId=' . 
$experiment->experimentID);
-               }
-               elseif (isset($_POST['clone']))
-               {
-                   $cloneId = 
Utilities::clone_experiment($experiment->experimentID);
-                   $experiment = Utilities::get_experiment( $cloneId );
-                       $project = 
Utilities::get_project($experiment->projectID);
-
-                       $expVal = Utilities::get_experiment_values( 
$experiment, $project);
-
-                       return Redirect::to('experiment/edit?expId=' . 
$experiment->experimentID);
-
-               }
-               
-               elseif (isset($_POST['cancel']))
-               {
-                   Utilities::cancel_experiment($experiment->experimentID);
-                       return Redirect::to('experiment/summary?expId=' . 
$experiment->experimentID);
-
-               }
-       }
-
-       public function editView()
-       {
-               $queueDefaults = array( "queueName" => 
Config::get('pga_config.airavata')["queue-name"],
-                                                       "nodeCount" => 
Config::get('pga_config.airavata')["node-count"],
-                                                       "cpuCount" => 
Config::get('pga_config.airavata')["total-cpu-count"],
-                                                       "wallTimeLimit" => 
Config::get('pga_config.airavata')["wall-time-limit"]
-                                                       );
-
-               $experiment = Utilities::get_experiment($_GET['expId']);
-               $project = Utilities::get_project($experiment->projectID);
-
-               $expVal = Utilities::get_experiment_values( $experiment, 
$project);
-               //var_dump( $expVal); exit;
-               $computeResources = 
Utilities::create_compute_resources_select($experiment->applicationId, 
$expVal['scheduling']->resourceHostId);
-
-               $experimentInputs = array(      
-                                                               "disabled" => ' 
',
-                                                       "experimentName" => 
$experiment->name,
-                                                       "experimentDescription" 
=> $experiment->description,
-                                                       "application" => 
$experiment->applicationId,
-                                                       "allowedFileSize" => 
Config::get('pga_config.airavata')["server-allowed-file-size"],
-                                                               'experiment' => 
$experiment,
-                                                               "queueDefaults" 
=> $queueDefaults,
-                                                               'project' => 
$project,
-                                                               'expVal' => 
$expVal,
-                                                               'cloning' => 
true,
-                                                       'advancedOptions' => 
Config::get('pga_config.airavata')["advanced-experiment-options"],
-                                                       'computeResources' => 
$computeResources,
-                                                       "resourceHostId" => 
$expVal['scheduling']->resourceHostId,
-                                                               'project' => 
$project,
-                                                               'expVal' => 
$expVal,
-                                                               'cloning' => 
true,
-                                                       'advancedOptions' => 
Config::get('pga_config.airavata')["advanced-experiment-options"]
-                                                               );
-               return View::make("experiment/edit", array("expInputs" => 
$experimentInputs) );
-       }
-
-       public function editSubmit()
-       {
-               if (isset($_POST['save']) || isset($_POST['launch']))
-               {
-               $experiment = Utilities::get_experiment(Input::get('expId') ); 
// update local experiment variable
-                   $updatedExperiment = 
Utilities::apply_changes_to_experiment($experiment, Input::all() );
-
-                   Utilities::update_experiment($experiment->experimentID, 
$updatedExperiment);
-
-                   if (isset($_POST['save']))
-                   {
-                       $experiment = 
Utilities::get_experiment(Input::get('expId') ); // update local experiment 
variable
-                   }
-                   if (isset($_POST['launch']))
-                   {
-                       Utilities::launch_experiment($experiment->experimentID);
-                   }
-
-                       return Redirect::to('experiment/summary?expId=' . 
$experiment->experimentID);
-               }
-               else
-                       return View::make("home");
-       }
-
-       public function searchView()
-       {
-               $experimentStates = Utilities::getExpStates();
-               return View::make("experiment/search", array( "expStates" => 
$experimentStates ) );
-       }
-
-       public function searchSubmit()
-       {
+    /**
+     *    Instantiate a new ExperimentController Instance
+     **/
+
+    public function __construct()
+    {
+        $this->beforeFilter('verifylogin');
+        Session::put("nav-active", "experiment");
+    }
+
+    public function createView()
+    {
+        Session::forget('exp_create_continue');
+        return View::make('experiment/create');
+    }
+
+    public function createSubmit()
+    {
+        $inputs = Input::all();
+
+        if (isset($_POST['continue'])) {
+            Session::put('exp_create_continue', true);
+
+            $computeResources = 
CRUtilities::create_compute_resources_select($_POST['application'], null);
+
+            $queueDefaults = array("queueName" => 
Config::get('pga_config.airavata')["queue-name"],
+                "nodeCount" => 
Config::get('pga_config.airavata')["node-count"],
+                "cpuCount" => 
Config::get('pga_config.airavata')["total-cpu-count"],
+                "wallTimeLimit" => 
Config::get('pga_config.airavata')["wall-time-limit"]
+            );
+
+            $experimentInputs = array(
+                "disabled" => ' disabled',
+                "experimentName" => $_POST['experiment-name'],
+                "experimentDescription" => $_POST['experiment-description'] . 
' ',
+                "project" => $_POST['project'],
+                "application" => $_POST['application'],
+                "allowedFileSize" => 
Config::get('pga_config.airavata')["server-allowed-file-size"],
+                "echo" => ($_POST['application'] == 'Echo') ? ' selected' : '',
+                "wrf" => ($_POST['application'] == 'WRF') ? ' selected' : '',
+                "queueDefaults" => $queueDefaults,
+                "advancedOptions" => 
Config::get('pga_config.airavata')["advanced-experiment-options"],
+                "computeResources" => $computeResources,
+                "resourceHostId" => null,
+                "advancedOptions" => 
Config::get('pga_config.airavata')["advanced-experiment-options"]
+            );
+
+            return View::make("experiment/create-complete", array("expInputs" 
=> $experimentInputs));
+        } else if (isset($_POST['save']) || isset($_POST['launch'])) {
+            $expId = ExperimentUtilities::create_experiment();
+
+            if (isset($_POST['launch']) && $expId) {
+                ExperimentUtilities::launch_experiment($expId);
+            }
+            /* Not required.
+            else
+            {
+                Utilities::print_success_message("<p>Experiment 
{$_POST['experiment-name']} created!</p>" .
+                    '<p>You will be redirected to the summary page shortly, or 
you can
+                    <a href=' . URL::to('/') . '"/experiment/summary?expId=' . 
$expId . '">go directly</a> to experiment summary page.</p>');
+
+            }*/
+            return Redirect::to('experiment/summary?expId=' . $expId);
+        } else
+            return Redirect::to("home")->with("message", "Something went wrong 
here. Please file a bug report using the link in the Help menu.");
+    }
+
+    public function summary()
+    {
+        $experiment = ExperimentUtilities::get_experiment($_GET['expId']);
+        if ($experiment != null) {
+            $project = ProjectUtilities::get_project($experiment->projectID);
+            $expVal = ExperimentUtilities::get_experiment_values($experiment, 
$project);
+            $jobDetails = 
ExperimentUtilities::get_job_details($experiment->experimentID);
+            $transferDetails = 
ExperimentUtilities::get_transfer_details($experiment->experimentID);
+            //var_dump( $jobDetails); exit;
+            // User should not clone or edit a failed experiment. Only create 
clones of it.
+            if ($expVal["experimentStatusString"] == "FAILED")
+                $expVal["editable"] = false;
+
+            $expVal["cancelable"] = false;
+            if ($expVal["experimentStatusString"] == "LAUNCHED" || 
$expVal["experimentStatusString"] == "EXECUTING")
+                $expVal["cancelable"] = true;
+
+            $data = array(
+                "expId" => Input::get("expId"),
+                "experiment" => $experiment,
+                "project" => $project,
+                "jobDetails" => $jobDetails,
+                "expVal" => $expVal
+            );
+
+            if (Request::ajax()) {
+                //admin wants to see an experiment summary
+                if (Input::has("dashboard")) {
+                    $data["dashboard"] = true;
+                    return View::make("partials/experiment-info", $data);
+                } else
+                    return json_encode($experiment);
+            } else {
+                return View::make("experiment/summary", $data);
+            }
+        } else {
+            if (Input::has("dashboard"))
+                return View::make("partials/experiment-info", 
array("invalidExperimentId" => 1));
+            else
+                return View::make("experiment/summary", 
array("invalidExperimentId" => 1));
+        }
+    }
+
+    public function expCancel()
+    {
+        ExperimentUtilities::cancel_experiment(Input::get("expId"));
+
+        return Redirect::to('experiment/summary?expId=' . Input::get("expId"));
+    }
+
+    public function expChange()
+    {
+        //var_dump( Input::all() ); exit;
+        $experiment = ExperimentUtilities::get_experiment(Input::get('expId'));
+        $project = ProjectUtilities::get_project($experiment->projectID);
+
+        $expVal = ExperimentUtilities::get_experiment_values($experiment, 
$project);
+        /*if (isset($_POST['save']))
+        {
+            $updatedExperiment = 
Utilities::apply_changes_to_experiment($experiment);
+
+            Utilities::update_experiment($experiment->experimentID, 
$updatedExperiment);
+        }*/
+        if (isset($_POST['launch'])) {
+            ExperimentUtilities::launch_experiment($experiment->experimentID);
+            return Redirect::to('experiment/summary?expId=' . 
$experiment->experimentID);
+        } elseif (isset($_POST['clone'])) {
+            $cloneId = 
ExperimentUtilities::clone_experiment($experiment->experimentID);
+            $experiment = ExperimentUtilities::get_experiment($cloneId);
+            $project = ProjectUtilities::get_project($experiment->projectID);
+
+            $expVal = ExperimentUtilities::get_experiment_values($experiment, 
$project);
+
+            return Redirect::to('experiment/edit?expId=' . 
$experiment->experimentID);
+
+        } elseif (isset($_POST['cancel'])) {
+            ExperimentUtilities::cancel_experiment($experiment->experimentID);
+            return Redirect::to('experiment/summary?expId=' . 
$experiment->experimentID);
+
+        }
+    }
+
+    public function editView()
+    {
+        $queueDefaults = array("queueName" => 
Config::get('pga_config.airavata')["queue-name"],
+            "nodeCount" => Config::get('pga_config.airavata')["node-count"],
+            "cpuCount" => 
Config::get('pga_config.airavata')["total-cpu-count"],
+            "wallTimeLimit" => 
Config::get('pga_config.airavata')["wall-time-limit"]
+        );
+
+        $experiment = ExperimentUtilities::get_experiment($_GET['expId']);
+        $project = ProjectUtilities::get_project($experiment->projectID);
+
+        $expVal = ExperimentUtilities::get_experiment_values($experiment, 
$project);
+        //var_dump( $expVal); exit;
+        $computeResources = 
CRUtilities::create_compute_resources_select($experiment->applicationId, 
$expVal['scheduling']->resourceHostId);
+
+        $experimentInputs = array(
+            "disabled" => ' ',
+            "experimentName" => $experiment->name,
+            "experimentDescription" => $experiment->description,
+            "application" => $experiment->applicationId,
+            "allowedFileSize" => 
Config::get('pga_config.airavata')["server-allowed-file-size"],
+            'experiment' => $experiment,
+            "queueDefaults" => $queueDefaults,
+            'project' => $project,
+            'expVal' => $expVal,
+            'cloning' => true,
+            'advancedOptions' => 
Config::get('pga_config.airavata')["advanced-experiment-options"],
+            'computeResources' => $computeResources,
+            "resourceHostId" => $expVal['scheduling']->resourceHostId,
+            'project' => $project,
+            'expVal' => $expVal,
+            'cloning' => true,
+            'advancedOptions' => 
Config::get('pga_config.airavata')["advanced-experiment-options"]
+        );
+        return View::make("experiment/edit", array("expInputs" => 
$experimentInputs));
+    }
+
+    public function editSubmit()
+    {
+        if (isset($_POST['save']) || isset($_POST['launch'])) {
+            $experiment = 
ExperimentUtilities::get_experiment(Input::get('expId')); // update local 
experiment variable
+            $updatedExperiment = 
ExperimentUtilities::apply_changes_to_experiment($experiment, Input::all());
+
+            ExperimentUtilities::update_experiment($experiment->experimentID, 
$updatedExperiment);
+
+            if (isset($_POST['save'])) {
+                $experiment = 
ExperimentUtilities::get_experiment(Input::get('expId')); // update local 
experiment variable
+            }
+            if (isset($_POST['launch'])) {
+                
ExperimentUtilities::launch_experiment($experiment->experimentID);
+            }
+
+            return Redirect::to('experiment/summary?expId=' . 
$experiment->experimentID);
+        } else
+            return View::make("home");
+    }
+
+    public function searchView()
+    {
+        $experimentStates = ExperimentUtilities::getExpStates();
+        return View::make("experiment/search", array("expStates" => 
$experimentStates));
+    }
+
+    public function searchSubmit()
+    {
         $search = Input::get('search');
-        if(isset($search)){
+        if (isset($search)) {
             $pageNo = 1;
-        }else{
+        } else {
             $pageNo = Input::get('pageNo');
             $prev = Input::get('prev');
-            if(empty($pageNo)){
+            if (empty($pageNo)) {
                 $pageNo = 1;
-            }else{
-                if(isset($prev)){
+            } else {
+                if (isset($prev)) {
                     $pageNo -= 1;
-                }else{
+                } else {
                     $pageNo += 1;
                 }
             }
         }
 
-        $expContainer = Utilities::get_expsearch_results_with_pagination( 
Input::all(), $this->limit,
-            ($pageNo-1)*$this->limit);
-
-               $experimentStates = Utilities::getExpStates();
-               return View::make('experiment/search', array(
-                                                    'input' => Input::all(),
-                                                    'pageNo' => $pageNo,
-                                                    'limit' => $this->limit,
-                                                                               
                        'expStates' => $experimentStates,
-                                                                               
                        'expContainer' => $expContainer 
-                                                                               
                ));
-       }
-
-       public function getQueueView()
-       {
-               $queues = Utilities::getQueueDatafromResourceId( 
Input::get("crId"));
-               $queueDefaults = array( "queueName" => 
Config::get('pga_config.airavata')["queue-name"],
-                                                       "nodeCount" => 
Config::get('pga_config.airavata')["node-count"],
-                                                       "cpuCount" => 
Config::get('pga_config.airavata')["total-cpu-count"],
-                                                       "wallTimeLimit" => 
Config::get('pga_config.airavata')["wall-time-limit"]
-                                                       );
-               return View::make("partials/experiment-queue-block", array( 
"queues" => $queues, "queueDefaults" => $queueDefaults) );
-       }
+        $expContainer = 
ExperimentUtilities::get_expsearch_results_with_pagination(Input::all(), 
$this->limit,
+            ($pageNo - 1) * $this->limit);
+
+        $experimentStates = CommonUtilities::getExpStates();
+        return View::make('experiment/search', array(
+            'input' => Input::all(),
+            'pageNo' => $pageNo,
+            'limit' => $this->limit,
+            'expStates' => $experimentStates,
+            'expContainer' => $expContainer
+        ));
+    }
+
+    public function getQueueView()
+    {
+        $queues = 
ExperimentUtilities::getQueueDatafromResourceId(Input::get("crId"));
+        $queueDefaults = array("queueName" => 
Config::get('pga_config.airavata')["queue-name"],
+            "nodeCount" => Config::get('pga_config.airavata')["node-count"],
+            "cpuCount" => 
Config::get('pga_config.airavata')["total-cpu-count"],
+            "wallTimeLimit" => 
Config::get('pga_config.airavata')["wall-time-limit"]
+        );
+        return View::make("partials/experiment-queue-block", array("queues" => 
$queues, "queueDefaults" => $queueDefaults));
+    }
 
     public function browseView()
     {
         $pageNo = Input::get('pageNo');
         $prev = Input::get('prev');
-        if(empty($pageNo)){
+        if (empty($pageNo)) {
             $pageNo = 1;
-        }else{
-            if(isset($prev)){
+        } else {
+            if (isset($prev)) {
                 $pageNo -= 1;
-            }else{
+            } else {
                 $pageNo += 1;
             }
         }
 
-        $expContainer = 
Utilities::get_all_user_experiments_with_pagination($this->limit, 
($pageNo-1)*$this->limit);
-        $experimentStates = Utilities::getExpStates();
+        $expContainer = 
ExperimentUtilities::get_all_user_experiments_with_pagination($this->limit, 
($pageNo - 1) * $this->limit);
+        $experimentStates = ExperimentUtilities::getExpStates();
         return View::make('experiment/browse', array(
             'pageNo' => $pageNo,
             'limit' => $this->limit,
@@ -311,4 +288,5 @@ class ExperimentController extends BaseController {
         ));
     }
 }
+
 ?>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2fbd9289/app/controllers/ProjectController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ProjectController.php 
b/app/controllers/ProjectController.php
index 973227a..b455bb3 100755
--- a/app/controllers/ProjectController.php
+++ b/app/controllers/ProjectController.php
@@ -1,6 +1,7 @@
 <?php
 
-class ProjectController extends BaseController {
+class ProjectController extends BaseController
+{
 
     /**
      * Limit used in fetching paginated results
@@ -8,122 +9,114 @@ class ProjectController extends BaseController {
      */
     var $limit = 20;
 
-       /**
-       *    Instantiate a new ProjectController Instance
-       **/
+    /**
+     *    Instantiate a new ProjectController Instance
+     **/
 
-       public function __construct()
-       {
-               $this->beforeFilter('verifylogin');
-               Session::put("nav-active", "project");
+    public function __construct()
+    {
+        $this->beforeFilter('verifylogin');
+        Session::put("nav-active", "project");
 
-       }
+    }
 
-       public function createView()
-       {
-               return View::make("project/create");
-       }
+    public function createView()
+    {
+        return View::make("project/create");
+    }
 
-       public function createSubmit()
-       {
-               if (isset($_POST['save']))
-               {
-                       $projectId = Utilities::create_project();
+    public function createSubmit()
+    {
+        if (isset($_POST['save'])) {
+            $projectId = ProjectUtilities::create_project();
             return Redirect::to('project/summary?projId=' . $projectId);
-               }
-               else
-               {
-                       return Redirect::to('project/create');
-               }
-       }
-
-       public function summary()
-       {
-               if( Input::has("projId"))
-               {
-                       Session::put("projId", Input::get("projId"));
-                       return View::make("project/summary", 
-                                       array( "projectId" => 
Input::get("projId")) );
-               }
-               else
-                       return Redirect::to("home");
-       }
-
-       public function editView()
-       {
-               if( Input::has("projId"))
-               {
-                       return View::make("project/edit", 
-                                       array( "projectId" => 
Input::get("projId"),
-                                                       "project" => 
Utilities::get_project($_GET['projId']) 
-                                                ) );
-               }
-               else
-                       return Redirect::to("home");
-       }
-
-       public function editSubmit()
-       {
-               if (isset($_POST['save']))
-           {
-               $projectDetails["owner"] = Session::get("username");
-               $projectDetails["name"] = Input::get("project-name");
-               $projectDetails["description"] = 
Input::get("project-description");
-
-               Utilities::update_project( Input::get("projectId"), 
$projectDetails);
-
-               return Redirect::to("project/summary?projId=" . 
Input::get("projectId") )->with("project_edited", true);
-           }
-       }
-
-       public function searchView()
-       {
-               return View::make('project/search');
-       }
-
-       public function searchSubmit()
-       {
+        } else {
+            return Redirect::to('project/create');
+        }
+    }
+
+    public function summary()
+    {
+        if (Input::has("projId")) {
+            Session::put("projId", Input::get("projId"));
+            return View::make("project/summary",
+                array("projectId" => Input::get("projId")));
+        } else
+            return Redirect::to("home");
+    }
+
+    public function editView()
+    {
+        if (Input::has("projId")) {
+            return View::make("project/edit",
+                array("projectId" => Input::get("projId"),
+                    "project" => ProjectUtilities::get_project($_GET['projId'])
+                ));
+        } else
+            return Redirect::to("home");
+    }
+
+    public function editSubmit()
+    {
+        if (isset($_POST['save'])) {
+            $projectDetails["owner"] = Session::get("username");
+            $projectDetails["name"] = Input::get("project-name");
+            $projectDetails["description"] = Input::get("project-description");
+
+            ProjectUtilities::update_project(Input::get("projectId"), 
$projectDetails);
+
+            return Redirect::to("project/summary?projId=" . 
Input::get("projectId"))->with("project_edited", true);
+        }
+    }
+
+    public function searchView()
+    {
+        return View::make('project/search');
+    }
+
+    public function searchSubmit()
+    {
         $search = Input::get('search');
-        if(isset($search)){
+        if (isset($search)) {
             $pageNo = 1;
-        }else{
+        } else {
             $pageNo = Input::get('pageNo');
             $prev = Input::get('prev');
-            if(empty($pageNo)){
+            if (empty($pageNo)) {
                 $pageNo = 1;
-            }else{
-                if(isset($prev)){
+            } else {
+                if (isset($prev)) {
                     $pageNo -= 1;
-                }else{
+                } else {
                     $pageNo += 1;
                 }
             }
         }
 
-        $projects = Utilities::get_projsearch_results_with_pagination( 
Input::get("search-key"),
-            Input::get("search-value"), $this->limit, 
($pageNo-1)*$this->limit);
-               return View::make( 'project/search', array(
-            'pageNo' => $pageNo,
-            'limit' => $this->limit,
-            'projects' => $projects)
+        $projects = 
ProjectUtilities::get_projsearch_results_with_pagination(Input::get("search-key"),
+            Input::get("search-value"), $this->limit, ($pageNo - 1) * 
$this->limit);
+        return View::make('project/search', array(
+                'pageNo' => $pageNo,
+                'limit' => $this->limit,
+                'projects' => $projects)
         );
-       }
+    }
 
     public function browseView()
     {
         $pageNo = Input::get('pageNo');
         $prev = Input::get('prev');
-        if(empty($pageNo)){
+        if (empty($pageNo)) {
             $pageNo = 1;
-        }else{
-            if(isset($prev)){
+        } else {
+            if (isset($prev)) {
                 $pageNo -= 1;
-            }else{
+            } else {
                 $pageNo += 1;
             }
         }
 
-        $projects = Utilities::get_all_user_projects_with_pagination( 
$this->limit, ($pageNo-1)*$this->limit);
+        $projects = 
ProjectUtilities::get_all_user_projects_with_pagination($this->limit, ($pageNo 
- 1) * $this->limit);
         return View::make('project/browse', array(
             'pageNo' => $pageNo,
             'limit' => $this->limit,

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2fbd9289/app/controllers/ResourceController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ResourceController.php 
b/app/controllers/ResourceController.php
index d11d918..41eddcb 100755
--- a/app/controllers/ResourceController.php
+++ b/app/controllers/ResourceController.php
@@ -1,238 +1,211 @@
 <?php
 
-class ResourceController extends BaseController{
-       
-       /**
-       *    Instantiate a new Compute Resource Controller Instance
-       **/
-
-       public function __construct()
-       {
-               $this->beforeFilter('verifyadmin');
-               Session::put("nav-active", "compute-resource");
-
-       }
-
-       public function createView(){
-                       return View::make("resource/create");
-       }
-
-       public function createSubmit(){
-
-               $hostAliases = Input::get("hostaliases");
-               $ips = Input::get("ips");
-               $computeDescription = array( 
-                                                                       
"hostName"=> trim( Input::get("hostname") ),
-                                                                       
"hostAliases"=> array_unique( array_filter( $hostAliases) ),
-                                                                       
"ipAddresses"=> array_unique( array_filter( $ips) ),
-                                                                       
"resourceDescription"=>Input::get("description") 
-                                                                       );
-               $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription);
-               
-               return Redirect::to( "cr/edit?crId=" . 
$computeResource->computeResourceId);
-       }
-
-       public function editView(){
-               
-               $data = CRUtilities::getEditCRData();
-               $computeResourceId = "";
-               if( Input::has("crId"))
-                       $computeResourceId = Input::get("crId");
-               else if( Session::has("computeResource"))
-               {
-                       $computeResource = Session::get("computeResource");
-                       $computeResourceId = 
$computeResource->computeResourceId;
-               }
-
-               if( $computeResourceId != "")
-               {
-                       $computeResource = Utilities::get_compute_resource(  
$computeResourceId);
-                       $jobSubmissionInterfaces = array();
-                       $dataMovementInterfaces = array();
-                       $addedJSP = array();
-                       $addedDMI = array();
-                       //var_dump( $computeResource->jobSubmissionInterfaces); 
exit;
-                       if( count( $computeResource->jobSubmissionInterfaces) )
-                       {
-                               foreach( 
$computeResource->jobSubmissionInterfaces as $JSI )
-                               {
-                                       $jobSubmissionInterfaces[] = 
CRUtilities::getJobSubmissionDetails( $JSI->jobSubmissionInterfaceId, 
$JSI->jobSubmissionProtocol);
-                                       $addedJSP[] = 
$JSI->jobSubmissionProtocol;
-                               }
-                       }
-                       //var_dump( CRUtilities::getJobSubmissionDetails( 
$data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 
1) ); exit;
-                       if( count( $computeResource->dataMovementInterfaces) )
-                       {
-                               foreach( 
$computeResource->dataMovementInterfaces as $DMI )
-                               {
-                                       $dataMovementInterfaces[] = 
CRUtilities::getDataMovementDetails( $DMI->dataMovementInterfaceId, 
$DMI->dataMovementProtocol);
-                                       $addedDMI[] = 
$DMI->dataMovementProtocol;
-                               }
-                       }
-
-                       $data["computeResource"] = $computeResource;
-                       $data["jobSubmissionInterfaces"] = 
$jobSubmissionInterfaces;
-                       $data["dataMovementInterfaces"] = 
$dataMovementInterfaces;
-                       $data["addedJSP"] = $addedJSP;
-                       $data["addedDMI"] = $addedDMI;
-                       //var_dump($data["jobSubmissionInterfaces"]); exit;
-                       return View::make("resource/edit", $data);
-               }
-               else
-                       return 
View::make("resource/browse")->with("login-alert", "Unable to retrieve this 
Compute Resource. Please report this error to devs.");
-
-       }
-               
-       public function editSubmit(){
-
-               $tabName = "";
-               if( Input::get("cr-edit") == "resDesc") /* Modify compute 
Resource description */
-               {
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       $computeDescription->hostName = trim( 
Input::get("hostname") );
-                       $computeDescription->hostAliases = array_unique( 
array_filter( Input::get("hostaliases") ) );
-                       $computeDescription->ipAddresses = array_unique( 
array_filter( Input::get("ips") ) );
-                       $computeDescription->resourceDescription = 
Input::get("description");
-                       $computeDescription->maxMemoryPerNode = 
Input::get("maxMemoryPerNode");
-                       //var_dump( $computeDescription); exit;
-
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-
-                       $tabName =  "#tab-desc";
-               }
-               if( Input::get("cr-edit") == "queue") /* Add / Modify a Queue */
-               {
-                       $queue = array( "queueName"                     
=>Input::get("qname"),
-                                                       "queueDescription"      
=>Input::get("qdesc"),
-                                                       "maxRunTime"            
=>Input::get( "qmaxruntime"),
-                                                       "maxNodes"              
        =>Input::get("qmaxnodes"),
-                                                       "maxProcessors"         
=>Input::get("qmaxprocessors"),
-                                                       "maxJobsInQueue"        
=>Input::get("qmaxjobsinqueue"),
-                                                       "maxMemory"             
        =>Input::get("qmaxmemoryinqueue")
-                                               );
-
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       $computeDescription->batchQueues[] = 
CRUtilities::createQueueObject( $queue);
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-                       //var_dump( $computeResource); exit;
-                       $tabName = "#tab-queues";
-               }
-               else if( Input::get("cr-edit") == "delete-queue" )
-               {
-                       CRUtilities::deleteQueue( Input::get("crId"), 
Input::get("queueName") );
-                       $tabName = "#tab-queues";
-               } 
-               else if( Input::get("cr-edit") == "fileSystems")
-               {
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       $computeDescription->fileSystems = array_filter( 
Input::get("fileSystems"), "trim");
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-
-                       $tabName = "#tab-filesystem";
-               }
-               else if( Input::get("cr-edit") == "jsp" ||  
Input::get("cr-edit") == "edit-jsp" ) /* Add / Modify a Job Submission 
Interface */
-               {               
-                       $update = false;        
-                       if( Input::get("cr-edit") == "edit-jsp")
-                               $update = true;
-
-                       $jobSubmissionInterface = 
CRUtilities::create_or_update_JSIObject( Input::all(), $update );
-
-                       $tabName = "#tab-jobSubmission";
-               }
-               else if( Input::get("cr-edit") == "jsi-priority") 
-               {
-                       $inputs = Input::all();
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       foreach( $computeDescription->jobSubmissionInterfaces 
as $index => $jsi)
-                       {
-                               foreach( $inputs["jsi-id"] as $idIndex => 
$jsiId)
-                               {
-                                       if( $jsiId == 
$jsi->jobSubmissionInterfaceId )
-                                       {
-                                               
$computeDescription->jobSubmissionInterfaces[$index]->priorityOrder = 
$inputs["jsi-priority"][$idIndex];
-                                               break;
-                                       }
-                               }
-                       }
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-
-                       return 1; //currently done by ajax.
-               }
-               else if( Input::get("cr-edit") == "dmp" ||  
Input::get("cr-edit") == "edit-dmi" ) /* Add / Modify a Data Movement Interface 
*/
-               {
-                       $update = false;        
-                       if( Input::get("cr-edit") == "edit-dmi")
-                               $update = true;
-                       $dataMovementInterface = 
CRUtilities::create_or_update_DMIObject( Input::all(), $update );
-
-                       $tabName = "#tab-dataMovement";
-               }
-               else if( Input::get("cr-edit") == "dmi-priority") 
-               {
-                       $inputs = Input::all();
-                       $computeDescription = Utilities::get_compute_resource(  
Input::get("crId"));
-                       foreach( $computeDescription->dataMovementInterfaces as 
$index => $dmi)
-                       {
-                               foreach( $inputs["dmi-id"] as $idIndex => 
$dmiId)
-                               {
-                                       if( $dmiId == 
$dmi->dataMovementInterfaceId )
-                                       {
-                                               
$computeDescription->dataMovementInterfaces[$index]->priorityOrder = 
$inputs["dmi-priority"][$idIndex];
-                                               break;
-                                       }
-                               }
-                       }
-                       $computeResource = 
CRUtilities::register_or_update_compute_resource( $computeDescription, true);
-
-                       return 1; //currently done by ajax.
-               }
-
-               return Redirect::to("cr/edit?crId=" . Input::get("crId") . 
$tabName );
-       }
-
-       public function deleteActions(){
-
-               $result = CRUtilities::deleteActions( Input::all() );
-               if( Input::has("jsiId"))
-               {
-                       return Redirect::to("cr/edit?crId=" . 
Input::get("crId"). "#tab-jobSubmission")
-                                                       ->with("message", "Job 
Submission Interface was deleted successfully");
-               }
-               if( Input::has("dmiId"))
-               {
-                       return Redirect::to("cr/edit?crId=" . 
Input::get("crId"). "#tab-dataMovement")
-                                                       ->with( "message", 
"Data Movement Protocol was deleted successfully");
-               }
-               elseif( Input::has("del-crId") )
-               {
-                       return Redirect::to("cr/browse")->with("message", "The 
Compute Resource has been successfully deleted.");
-               }
-               else
-                       return $result;
-       }
-
-       public function browseView(){
-               $data = CRUtilities::getBrowseCRData();
-               $allCRs = $data["crObjects"];
-               $appDeployments = $data["appDeployments"];
-
-               $connectedDeployments = array();
-               foreach( (array)$allCRs as $crId => $crName)
-               {
-                       $connectedDeployments[ $crId] = 0;
-                       foreach( (array)$appDeployments as $deploymentObject)
-                       {
-                               if( $crId == $deploymentObject->computeHostId)
-                                       $connectedDeployments[$crId]++;
-                       }
-               }
-               return View::make("resource/browse", array(
-                                                                               
                "allCRs" => $allCRs,
-                                                                               
                "connectedDeployments" => $connectedDeployments
-                                                                               
                ));
-
-       }
+class ResourceController extends BaseController
+{
+
+    /**
+     *    Instantiate a new Compute Resource Controller Instance
+     **/
+
+    public function __construct()
+    {
+        $this->beforeFilter('verifyadmin');
+        Session::put("nav-active", "compute-resource");
+
+    }
+
+    public function createView()
+    {
+        return View::make("resource/create");
+    }
+
+    public function createSubmit()
+    {
+
+        $hostAliases = Input::get("hostaliases");
+        $ips = Input::get("ips");
+        $computeDescription = array(
+            "hostName" => trim(Input::get("hostname")),
+            "hostAliases" => array_unique(array_filter($hostAliases)),
+            "ipAddresses" => array_unique(array_filter($ips)),
+            "resourceDescription" => Input::get("description")
+        );
+        $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription);
+
+        return Redirect::to("cr/edit?crId=" . 
$computeResource->computeResourceId);
+    }
+
+    public function editView()
+    {
+
+        $data = CRUtilities::getEditCRData();
+        $computeResourceId = "";
+        if (Input::has("crId"))
+            $computeResourceId = Input::get("crId");
+        else if (Session::has("computeResource")) {
+            $computeResource = Session::get("computeResource");
+            $computeResourceId = $computeResource->computeResourceId;
+        }
+
+        if ($computeResourceId != "") {
+            $computeResource = 
CRUtilities::get_compute_resource($computeResourceId);
+            $jobSubmissionInterfaces = array();
+            $dataMovementInterfaces = array();
+            $addedJSP = array();
+            $addedDMI = array();
+            //var_dump( $computeResource->jobSubmissionInterfaces); exit;
+            if (count($computeResource->jobSubmissionInterfaces)) {
+                foreach ($computeResource->jobSubmissionInterfaces as $JSI) {
+                    $jobSubmissionInterfaces[] = 
CRUtilities::getJobSubmissionDetails($JSI->jobSubmissionInterfaceId, 
$JSI->jobSubmissionProtocol);
+                    $addedJSP[] = $JSI->jobSubmissionProtocol;
+                }
+            }
+            //var_dump( CRUtilities::getJobSubmissionDetails( 
$data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 
1) ); exit;
+            if (count($computeResource->dataMovementInterfaces)) {
+                foreach ($computeResource->dataMovementInterfaces as $DMI) {
+                    $dataMovementInterfaces[] = 
CRUtilities::getDataMovementDetails($DMI->dataMovementInterfaceId, 
$DMI->dataMovementProtocol);
+                    $addedDMI[] = $DMI->dataMovementProtocol;
+                }
+            }
+
+            $data["computeResource"] = $computeResource;
+            $data["jobSubmissionInterfaces"] = $jobSubmissionInterfaces;
+            $data["dataMovementInterfaces"] = $dataMovementInterfaces;
+            $data["addedJSP"] = $addedJSP;
+            $data["addedDMI"] = $addedDMI;
+            //var_dump($data["jobSubmissionInterfaces"]); exit;
+            return View::make("resource/edit", $data);
+        } else
+            return View::make("resource/browse")->with("login-alert", "Unable 
to retrieve this Compute Resource. Please report this error to devs.");
+
+    }
+
+    public function editSubmit()
+    {
+
+        $tabName = "";
+        if (Input::get("cr-edit") == "resDesc") /* Modify compute Resource 
description */ {
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            $computeDescription->hostName = trim(Input::get("hostname"));
+            $computeDescription->hostAliases = 
array_unique(array_filter(Input::get("hostaliases")));
+            $computeDescription->ipAddresses = 
array_unique(array_filter(Input::get("ips")));
+            $computeDescription->resourceDescription = 
Input::get("description");
+            $computeDescription->maxMemoryPerNode = 
Input::get("maxMemoryPerNode");
+            //var_dump( $computeDescription); exit;
+
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+            $tabName = "#tab-desc";
+        }
+        if (Input::get("cr-edit") == "queue") /* Add / Modify a Queue */ {
+            $queue = array("queueName" => Input::get("qname"),
+                "queueDescription" => Input::get("qdesc"),
+                "maxRunTime" => Input::get("qmaxruntime"),
+                "maxNodes" => Input::get("qmaxnodes"),
+                "maxProcessors" => Input::get("qmaxprocessors"),
+                "maxJobsInQueue" => Input::get("qmaxjobsinqueue"),
+                "maxMemory" => Input::get("qmaxmemoryinqueue")
+            );
+
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            $computeDescription->batchQueues[] = 
CRUtilities::createQueueObject($queue);
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+            //var_dump( $computeResource); exit;
+            $tabName = "#tab-queues";
+        } else if (Input::get("cr-edit") == "delete-queue") {
+            CRUtilities::deleteQueue(Input::get("crId"), 
Input::get("queueName"));
+            $tabName = "#tab-queues";
+        } else if (Input::get("cr-edit") == "fileSystems") {
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            $computeDescription->fileSystems = 
array_filter(Input::get("fileSystems"), "trim");
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+            $tabName = "#tab-filesystem";
+        } else if (Input::get("cr-edit") == "jsp" || Input::get("cr-edit") == 
"edit-jsp") /* Add / Modify a Job Submission Interface */ {
+            $update = false;
+            if (Input::get("cr-edit") == "edit-jsp")
+                $update = true;
+
+            $jobSubmissionInterface = 
CRUtilities::create_or_update_JSIObject(Input::all(), $update);
+
+            $tabName = "#tab-jobSubmission";
+        } else if (Input::get("cr-edit") == "jsi-priority") {
+            $inputs = Input::all();
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            foreach ($computeDescription->jobSubmissionInterfaces as $index => 
$jsi) {
+                foreach ($inputs["jsi-id"] as $idIndex => $jsiId) {
+                    if ($jsiId == $jsi->jobSubmissionInterfaceId) {
+                        
$computeDescription->jobSubmissionInterfaces[$index]->priorityOrder = 
$inputs["jsi-priority"][$idIndex];
+                        break;
+                    }
+                }
+            }
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+            return 1; //currently done by ajax.
+        } else if (Input::get("cr-edit") == "dmp" || Input::get("cr-edit") == 
"edit-dmi") /* Add / Modify a Data Movement Interface */ {
+            $update = false;
+            if (Input::get("cr-edit") == "edit-dmi")
+                $update = true;
+            $dataMovementInterface = 
CRUtilities::create_or_update_DMIObject(Input::all(), $update);
+
+            $tabName = "#tab-dataMovement";
+        } else if (Input::get("cr-edit") == "dmi-priority") {
+            $inputs = Input::all();
+            $computeDescription = 
CRUtilities::get_compute_resource(Input::get("crId"));
+            foreach ($computeDescription->dataMovementInterfaces as $index => 
$dmi) {
+                foreach ($inputs["dmi-id"] as $idIndex => $dmiId) {
+                    if ($dmiId == $dmi->dataMovementInterfaceId) {
+                        
$computeDescription->dataMovementInterfaces[$index]->priorityOrder = 
$inputs["dmi-priority"][$idIndex];
+                        break;
+                    }
+                }
+            }
+            $computeResource = 
CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+            return 1; //currently done by ajax.
+        }
+
+        return Redirect::to("cr/edit?crId=" . Input::get("crId") . $tabName);
+    }
+
+    public function deleteActions()
+    {
+
+        $result = CRUtilities::deleteActions(Input::all());
+        if (Input::has("jsiId")) {
+            return Redirect::to("cr/edit?crId=" . Input::get("crId") . 
"#tab-jobSubmission")
+                ->with("message", "Job Submission Interface was deleted 
successfully");
+        }
+        if (Input::has("dmiId")) {
+            return Redirect::to("cr/edit?crId=" . Input::get("crId") . 
"#tab-dataMovement")
+                ->with("message", "Data Movement Protocol was deleted 
successfully");
+        } elseif (Input::has("del-crId")) {
+            return Redirect::to("cr/browse")->with("message", "The Compute 
Resource has been successfully deleted.");
+        } else
+            return $result;
+    }
+
+    public function browseView()
+    {
+        $data = CRUtilities::getBrowseCRData();
+        $allCRs = $data["crObjects"];
+        $appDeployments = $data["appDeployments"];
+
+        $connectedDeployments = array();
+        foreach ((array)$allCRs as $crId => $crName) {
+            $connectedDeployments[$crId] = 0;
+            foreach ((array)$appDeployments as $deploymentObject) {
+                if ($crId == $deploymentObject->computeHostId)
+                    $connectedDeployments[$crId]++;
+            }
+        }
+        return View::make("resource/browse", array(
+            "allCRs" => $allCRs,
+            "connectedDeployments" => $connectedDeployments
+        ));
+
+    }
 }
 
 ?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2fbd9289/app/filters.php
----------------------------------------------------------------------
diff --git a/app/filters.php b/app/filters.php
index 409e642..eeea00c 100755
--- a/app/filters.php
+++ b/app/filters.php
@@ -11,20 +11,18 @@
 |
 */
 
-App::before(function($request)
-{
+App::before(function ($request) {
     $authzToken = new Airavata\Model\Security\AuthzToken();
     $authzToken->accessToken = "emptyToken";
     $apiVersion = Airavata::getAPIVersion($authzToken);
-       if(empty($apiVersion))
-               return View::make("server-down");
+    if (empty($apiVersion))
+        return View::make("server-down");
 });
 
 
-App::after(function($request, $response)
-{
-       //
-       // Test commit.
+App::after(function ($request, $response) {
+    //
+    // Test commit.
 });
 
 /*
@@ -38,25 +36,19 @@ App::after(function($request, $response)
 |
 */
 
-Route::filter('auth', function()
-{
-       if (Auth::guest())
-       {
-               if (Request::ajax())
-               {
-                       return Response::make('Unauthorized', 401);
-               }
-               else
-               {
-                       return Redirect::guest('login');
-               }
-       }
+Route::filter('auth', function () {
+    if (Auth::guest()) {
+        if (Request::ajax()) {
+            return Response::make('Unauthorized', 401);
+        } else {
+            return Redirect::guest('login');
+        }
+    }
 });
 
 
-Route::filter('auth.basic', function()
-{
-       return Auth::basic();
+Route::filter('auth.basic', function () {
+    return Auth::basic();
 });
 
 /*
@@ -70,9 +62,8 @@ Route::filter('auth.basic', function()
 |
 */
 
-Route::filter('guest', function()
-{
-       if (Auth::check()) return Redirect::to('/');
+Route::filter('guest', function () {
+    if (Auth::check()) return Redirect::to('/');
 });
 
 /*
@@ -86,30 +77,23 @@ Route::filter('guest', function()
 |
 */
 
-Route::filter('csrf', function()
-{
-       if (Session::token() != Input::get('_token'))
-       {
-               throw new Illuminate\Session\TokenMismatchException;
-       }
+Route::filter('csrf', function () {
+    if (Session::token() != Input::get('_token')) {
+        throw new Illuminate\Session\TokenMismatchException;
+    }
 });
 
 
-Route::filter('verifylogin',function()
-{
-       if( ! Utilities::verify_login() )
-               return Redirect::to("home")->with("login-alert", true);
+Route::filter('verifylogin', function () {
+    if (!CommonUtilities::verify_login())
+        return Redirect::to("home")->with("login-alert", true);
 });
 
-Route::filter('verifyadmin', function()
-{
-       if( Utilities::verify_login() )
-       {
-               if( !Session::has("admin"))
-               {
-                       return Redirect::to("home")->with("admin-alert", true);
-               }
-       } 
-       else
-               return Redirect::to("home")->with("login-alert", true);
+Route::filter('verifyadmin', function () {
+    if (CommonUtilities::verify_login()) {
+        if (!Session::has("admin")) {
+            return Redirect::to("home")->with("admin-alert", true);
+        }
+    } else
+        return Redirect::to("home")->with("login-alert", true);
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2fbd9289/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index c768874..38e4693 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -2,15 +2,17 @@
 
 use Airavata\Model\Workspace\Gateway;
 
-class AdminUtilities{
+class AdminUtilities
+{
 
-public static function addGateway( $input){
-       $gateway = new Gateway();
-       $gateway->gatewayId = $input["gatewayName"];
-       $gateway->domain = $input["domain"];
-       $gateway->gatewayName = $input["gatewayName"];
-       $gateway->emailAddress = $input["admin-email"];
-       return Airavata::addGateway( $gateway);
-}
+    public static function addGateway($input)
+    {
+        $gateway = new Gateway();
+        $gateway->gatewayId = $input["gatewayName"];
+        $gateway->domain = $input["domain"];
+        $gateway->gatewayName = $input["gatewayName"];
+        $gateway->emailAddress = $input["admin-email"];
+        return Airavata::addGateway($gateway);
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2fbd9289/app/libraries/AiravataClientFactory.php
----------------------------------------------------------------------
diff --git a/app/libraries/AiravataClientFactory.php 
b/app/libraries/AiravataClientFactory.php
deleted file mode 100755
index efd01a9..0000000
--- a/app/libraries/AiravataClientFactory.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-namespace Airavata\Client;
-
-class AiravataClientFactory
-{
-
-    private $airavataServerHost;
-    private $airavataServerPort;
-
-    public function __construct($options)
-    {
-        $this->airavataServerHost = isset($options['airavataServerHost']) ? 
$options['airavataServerHost'] : null;
-        $this->airavataServerPort = isset($options['airavataServerPort']) ? 
$options['airavataServerPort'] : null;
-    }
-
-    public function getAiravataClient()
-    {
-        $transport = new TSocket($this->airavataServerHost, 
$this->airavataServerPort);
-        $protocol = new TBinaryProtocol($transport);
-       $transport->open();
-        return new AiravataClient($protocol);
-    }
-}

Reply via email to