diff --git a/content/notiz.xml.php b/content/notiz.xml.php index ac77a6f97..8553c4ff6 100755 --- a/content/notiz.xml.php +++ b/content/notiz.xml.php @@ -43,7 +43,8 @@ echo ''; - + + @@ -393,6 +394,10 @@ echo ''; this.ResetDetails(); this.DisableDetails(false); document.getAnonymousElementByAttribute(this ,'anonid', 'caption-notiz-detail').label="Neue Notiz"; + + var sr = new SOAPRequest("saveNotiz",soapBody); + + SOAPClient.Proxy="soap/notiz.soap.php?"+gettimestamp(); ]]> @@ -405,6 +410,64 @@ echo ''; ]]> + + + soap/notiz.soap.php?"+gettimestamp(); + + function mycallb(obj) { + var me=obj; + this.invoke=function (respObj) { + try + { + var id = respObj.Body[0].deleteNotizResponse[0].message[0].Text; + me.selectID=id; + } + catch(e) + { + try + { + var fehler = respObj.Body[0].Fault[0].faultstring[0].Text; + } + catch(e) + { + var fehler = e; + } + alert('Fehler: '+fehler); + return; + } + me.RefreshNotiz(); + } + } + + var cb=new mycallb(this); + + SOAPClient.SendRequest(sr, cb.invoke); + } + } + ]]> + + + @@ -425,6 +488,7 @@ echo ''; var col = tree.columns.getColumnFor(document.getAnonymousElementByAttribute(this ,'anonid', 'treecol-notiz-notiz_id')); var id = tree.view.getCellText(row.value, col); + document.getAnonymousElementByAttribute(this ,'anonid', 'toolbarbutton-notiz-del').disabled=false; if(text=='erledigt') { @@ -503,6 +567,7 @@ echo ''; menulist.selectedItem=children[0]; } document.getAnonymousElementByAttribute(this ,'anonid', 'caption-notiz-detail').label="Bearbeiten"; + } ]]> @@ -694,6 +759,7 @@ echo ''; //Sicherstellen, dass die Zeile im sichtbaren Bereich liegt tree.treeBoxObject.ensureRowIsVisible(i); this.selectID=null; + return true; } } diff --git a/include/notiz.class.php b/include/notiz.class.php index d27caf8b2..c7bb78eaf 100644 --- a/include/notiz.class.php +++ b/include/notiz.class.php @@ -96,6 +96,29 @@ class notiz extends basis_db return false; } } + + /** + * Löscht eine Notiz + * @param $notiz_id + * @return true wenn ok, false im Fehlerfall + */ + public function delete($notiz_id) + { + if(!is_numeric($notiz_id)) + { + $this->errormsg = 'NotizID ist ungueltig'; + return false; + } + + $qry = "Delete FROM public.tbl_notiz WHERE notiz_id='".addslashes($notiz_id)."'"; + + if(!$this->db_query($qry)) + { + $this->errormsg = 'Fehler beim Loeschen der Daten'; + return false; + } + return true; + } /** * Prueft die Daten vor dem Speichern diff --git a/soap/notiz.soap.php b/soap/notiz.soap.php index 062d687fe..effb3b18b 100755 --- a/soap/notiz.soap.php +++ b/soap/notiz.soap.php @@ -128,15 +128,17 @@ function saveNotiz($username, $passwort, $notiz) * Löscht die Notiz mit der vom Webservice übergebenen ID * @param $notiz_id */ -function deleteNotiz($notiz_id) +function deleteNotiz($username, $passwort, $notiz_id) { - $user = get_uid(); - + + if(!$user = check_user($username, $passwort)) + return new SoapFault("Server", "Invalid Credentials"); + $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); if(!$rechte->isBerechtigt('basis/notiz', null, 'suid')) - return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Notizen"); + return new SoapFault("Server", "Sie haben keine Berechtigung zum Loeschen von Notizen"); $notiz = new notiz(); if($notiz->delete($notiz_id)) diff --git a/soap/notiz.wsdl.php b/soap/notiz.wsdl.php index daf4970d0..c41563876 100755 --- a/soap/notiz.wsdl.php +++ b/soap/notiz.wsdl.php @@ -41,6 +41,8 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> + +