public function editSubmit()
 {
     $tabName = "";
     if (Input::get("cr-edit") == "resDesc") {
         $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") {
         $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") {
                     $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") {
                             $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);
 }