Make deletion of plants work
authorJoachim Breitner <mail@joachim-breitner.de>
Fri, 26 Jun 2009 08:21:49 +0000 (10:21 +0200)
committerJoachim Breitner <mail@joachim-breitner.de>
Fri, 26 Jun 2009 08:21:49 +0000 (10:21 +0200)
web/php/Communication.php
web/php/Controller.php

index 733ba5a..39c1976 100644 (file)
@@ -28,7 +28,8 @@
                                $pw = $_POST["pw"];
                                $plantname = $_POST["plant"];
                                $code = $_POST["code"];
-                               $response = $controller->HandleRemoteProcedureCall($_POST["func"], $username, $pw, $plantname, $code);
+                               $plantid = $_POST["id"];
+                               $response = $controller->HandleRemoteProcedureCall($_POST["func"], $username, $pw, $plantname, $code, $plantid);
                                break;
 
                        case "ContentRequest":
index f70cf01..991ba50 100644 (file)
                        return $result;
                }
 
-               public function HandleRemoteProcedureCall($func, $username, $pw, $plantname, $code) {
+               public function HandleRemoteProcedureCall($func, $username, $pw, $plantname, $code, $plantid) {
                        $plant = null;
                        if ($this->m_User == null) {
                                $this->m_User = $this->m_Database->GetUser($username);
                        }
                        if ($this->m_User != null) {
-                               $plant = $this->m_User->GetPlant($plantname);
+                               if ($plantid != null) {
+                                       $plant = $this->m_User->GetPlantById($plantid);
+                               } else {
+                                       $plant = $this->m_User->GetPlant($plantname);
+                               }
                        }
                        
                        $res = "";