mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Upload documents for notes in FAS
This commit is contained in:
+1
-1
@@ -373,7 +373,7 @@ if(isset($_REQUEST['delete']))
|
||||
// Alle Versionen der Datei vom Filesystem löschen
|
||||
foreach($dms->result as $obj)
|
||||
{
|
||||
if(!unlink(DMS_PATH.$obj->filename))
|
||||
if(is_file(DMS_PATH.$obj->filename) && !unlink(DMS_PATH.$obj->filename))
|
||||
$error = true;
|
||||
}
|
||||
if($error)
|
||||
|
||||
+201
-4
@@ -86,6 +86,10 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
class="sortDirectionIndicator"
|
||||
sort="rdf:http://www.technikum-wien.at/notiz/rdf#endeISO" />
|
||||
<xul:splitter class="tree-splitter"/>
|
||||
<xul:treecol anonid="treecol-notiz-dokumente" label="Dokumente" flex="2" hidden="false" persist="hidden width ordinal"
|
||||
class="sortDirectionIndicator"
|
||||
sort="rdf:http://www.technikum-wien.at/notiz/rdf#dokumente" />
|
||||
<xul:splitter class="tree-splitter"/>
|
||||
<xul:treecol anonid="treecol-notiz-erledigt" label="Erledigt" flex="2" hidden="false" persist="hidden width ordinal"
|
||||
class="sortDirectionIndicator" type="checkbox"
|
||||
sort="rdf:http://www.technikum-wien.at/notiz/rdf#erledigt_boolean" />
|
||||
@@ -114,6 +118,7 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
<xul:treecell label="rdf:http://www.technikum-wien.at/notiz/rdf#bearbeiter_uid"/>
|
||||
<xul:treecell label="rdf:http://www.technikum-wien.at/notiz/rdf#start"/>
|
||||
<xul:treecell label="rdf:http://www.technikum-wien.at/notiz/rdf#ende"/>
|
||||
<xul:treecell label="rdf:http://www.technikum-wien.at/notiz/rdf#dokumente"/>
|
||||
<xul:treecell label="erledigt" value="rdf:http://www.technikum-wien.at/notiz/rdf#erledigt"/>
|
||||
<xul:treecell label="rdf:http://www.technikum-wien.at/notiz/rdf#notiz_id"/>
|
||||
<xul:treecell label="rdf:http://www.technikum-wien.at/notiz/rdf#startISO"/>
|
||||
@@ -150,6 +155,16 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
<xul:label value="Text"/>
|
||||
<xul:box class="WYSIWYG" anonid="textbox-notiz-text" flex="1"/>
|
||||
</xul:row>
|
||||
<xul:row>
|
||||
<xul:spacer flex="1" />
|
||||
<xul:hbox anonid="hbox-notiz-dokumente"></xul:hbox>
|
||||
</xul:row>
|
||||
<xul:row>
|
||||
<xul:spacer flex="1" />
|
||||
<xul:hbox>
|
||||
<xul:button anonid="button-notiz-upload-dokument" oncommand="document.getBindingParent(this).UploadDokument()" label="Dokument hinzufügen" disabled="true" />
|
||||
</xul:hbox>
|
||||
</xul:row>
|
||||
<xul:row>
|
||||
<xul:label value="Gültig von"/>
|
||||
<xul:hbox>
|
||||
@@ -267,6 +282,8 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'menulist-notiz-bearbeiter').disabled=val;
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'checkbox-notiz-erledigt').disabled=val;
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'button-notiz-speichern').disabled=val;
|
||||
if(val)
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'button-notiz-upload-dokument').disabled=val;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
@@ -292,6 +309,11 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'menulist-notiz-bearbeiter').value='';
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'checkbox-notiz-erledigt').checked=false;
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'label-notiz-updateamum').value='';
|
||||
var notizdoks = document.getAnonymousElementByAttribute(this ,'anonid', 'hbox-notiz-dokumente');
|
||||
while(notizdoks.hasChildNodes())
|
||||
{
|
||||
notizdoks.removeChild(notizdoks.firstChild);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
@@ -402,6 +424,7 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
<![CDATA[
|
||||
this.ResetDetails();
|
||||
this.DisableDetails(false);
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'button-notiz-upload-dokument').disabled=true;
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'caption-notiz-detail').label="Neue Notiz";
|
||||
]]>
|
||||
</body>
|
||||
@@ -415,6 +438,15 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="RefreshNotizBlocking">
|
||||
<body>
|
||||
<![CDATA[
|
||||
//debug('Refresh Notiz');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
this.TreeNotizDatasource.Refresh(true); //blocking
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="Loeschen">
|
||||
<body>
|
||||
<![CDATA[
|
||||
@@ -429,7 +461,7 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
//Abfrage ob wirklich geloescht werden soll
|
||||
if (confirm('Wollen Sie die Notiz mit der ID: '+notiz_id+' wirklich loeschen?'))
|
||||
{
|
||||
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'button-notiz-upload-dokument').disabled=true;
|
||||
var soapBody = new SOAPObject("deleteNotiz");
|
||||
soapBody.appendChild(new SOAPObject("notiz_id")).val(notiz_id);
|
||||
|
||||
@@ -539,7 +571,14 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
|
||||
if(id!='')
|
||||
{
|
||||
this.DisableDetails(false);
|
||||
var notizdoks = document.getAnonymousElementByAttribute(this ,'anonid', 'hbox-notiz-dokumente');
|
||||
while(notizdoks.hasChildNodes())
|
||||
{
|
||||
notizdoks.removeChild(notizdoks.firstChild);
|
||||
}
|
||||
|
||||
this.DisableDetails(false);
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'button-notiz-upload-dokument').disabled=false;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
//Daten holen
|
||||
var url = '<?php echo APP_ROOT ?>rdf/notiz.rdf.php?notiz_id='+id+'&'+gettimestamp();
|
||||
@@ -554,8 +593,7 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
var predicateNS = "http://www.technikum-wien.at/notiz/rdf";
|
||||
|
||||
//RDF parsen
|
||||
|
||||
titel = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#titel" ));
|
||||
titel = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#titel" ));
|
||||
text = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#text" ));
|
||||
start = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#start" ));
|
||||
ende = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#ende" ));
|
||||
@@ -596,6 +634,47 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
}
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'caption-notiz-detail').label="Bearbeiten";
|
||||
|
||||
// Dokumente auslesen
|
||||
var url = '<?php echo APP_ROOT ?>rdf/dms.rdf.php?notiz_id='+id+'&'+gettimestamp();
|
||||
|
||||
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
|
||||
getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
dsource = rdfService.GetDataSourceBlocking(url);
|
||||
|
||||
// Alle Elemente aus dem RDF holen
|
||||
var dsResources = dsource.GetAllResources();
|
||||
var thisResource = null;
|
||||
|
||||
// Durchlaufen der Elemente
|
||||
while(dsResources.hasMoreElements())
|
||||
{
|
||||
thisResource = dsResources.getNext().QueryInterface( Components.interfaces.nsIRDFResource);
|
||||
|
||||
var predicateNS = "http://www.technikum-wien.at/dms/rdf";
|
||||
|
||||
//Spalten holen
|
||||
name = getTargetHelper(dsource,thisResource,rdfService.GetResource( predicateNS + "#name" ));
|
||||
dms_id = getTargetHelper(dsource,thisResource,rdfService.GetResource( predicateNS + "#dms_id" ));
|
||||
|
||||
if(dms_id!='')
|
||||
{
|
||||
// Download-Link für Dokument einfügen
|
||||
var dokurl = '<?php echo APP_ROOT ?>content/notizdokdownload.php?id='+dms_id;
|
||||
var dokbtn = document.createElement("button");
|
||||
dokbtn.setAttribute("label", name);
|
||||
dokbtn.setAttribute("onclick", "window.open('"+dokurl+"')");
|
||||
dokbtn.setAttribute("style", "margin-right: -5px;");
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'hbox-notiz-dokumente').appendChild(dokbtn);
|
||||
|
||||
// Link zum Löschen des Dokuments
|
||||
var delbtn = document.createElement("button");
|
||||
delbtn.setAttribute("image", "<?php echo APP_ROOT;?>skin/images/delete_x.png");
|
||||
delbtn.setAttribute("tooltiptext", "Datei "+name+" löschen");
|
||||
delbtn.setAttribute("onclick", "document.getBindingParent(this).LoeschenDokument("+dms_id+",'"+name+"')");
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'hbox-notiz-dokumente').appendChild(delbtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
@@ -807,6 +886,124 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="UploadDokument">
|
||||
<body>
|
||||
<![CDATA[
|
||||
notiz_id = document.getAnonymousElementByAttribute(this ,'anonid', 'textbox-notiz-notiz_id').value;
|
||||
|
||||
if(notiz_id != '')
|
||||
{
|
||||
NotizDokumentUploadScope = this;
|
||||
this.selectID=notiz_id;
|
||||
var new_window = window.open("<?php echo APP_ROOT; ?>content/notizdokupload.php?notiz_id="+notiz_id ,"","chrome, status=no, width=800, height=350, centerscreen, resizable");
|
||||
}
|
||||
else
|
||||
alert("keine Notiz ausgewählt");
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="LoeschenDokument">
|
||||
<parameter name="dms_id"/>
|
||||
<parameter name="dateiname"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
|
||||
//Abfrage ob wirklich geloescht werden soll
|
||||
if (confirm('Wollen Sie die Datei '+dateiname+' wirklich loeschen?'))
|
||||
{
|
||||
var soapBody = new SOAPObject("deleteDokument");
|
||||
soapBody.appendChild(new SOAPObject("dms_id")).val(dms_id);
|
||||
|
||||
var sr = new SOAPRequest("deleteDokument",soapBody);
|
||||
|
||||
SOAPClient.Proxy="<?php echo APP_ROOT;?>soap/notiz.soap.php?"+gettimestamp();
|
||||
SOAPClient.AjaxAsync=false;
|
||||
|
||||
function mycallb(obj) {
|
||||
var me=obj;
|
||||
this.invoke=function (respObj) {
|
||||
try
|
||||
{
|
||||
var result = respObj.Body[0].deleteDokumentResponse[0].message[0].Text;
|
||||
}
|
||||
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);
|
||||
|
||||
// Alle Download-Buttons der Dokumente entfernen
|
||||
var notizdoks = document.getAnonymousElementByAttribute(this ,'anonid', 'hbox-notiz-dokumente');
|
||||
while(notizdoks.hasChildNodes())
|
||||
{
|
||||
notizdoks.removeChild(notizdoks.firstChild);
|
||||
}
|
||||
|
||||
// Dokumente auslesen
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var id = document.getAnonymousElementByAttribute(this ,'anonid', 'textbox-notiz-notiz_id').value;
|
||||
var url = '<?php echo APP_ROOT ?>rdf/dms.rdf.php?notiz_id='+id+'&'+gettimestamp();
|
||||
|
||||
var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
|
||||
getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
dsource = rdfService.GetDataSourceBlocking(url);
|
||||
|
||||
// Alle Elemente aus dem RDF holen
|
||||
var dsResources = dsource.GetAllResources();
|
||||
var thisResource = null;
|
||||
|
||||
// Durchlaufen der Elemente
|
||||
while(dsResources.hasMoreElements())
|
||||
{
|
||||
thisResource = dsResources.getNext().QueryInterface( Components.interfaces.nsIRDFResource);
|
||||
|
||||
var predicateNS = "http://www.technikum-wien.at/dms/rdf";
|
||||
|
||||
//Spalten holen
|
||||
name = getTargetHelper(dsource,thisResource,rdfService.GetResource( predicateNS + "#name" ));
|
||||
dms_id = getTargetHelper(dsource,thisResource,rdfService.GetResource( predicateNS + "#dms_id" ));
|
||||
|
||||
if(dms_id!='')
|
||||
{
|
||||
// Download-Link für Dokument einfügen
|
||||
var dokurl = '<?php echo APP_ROOT ?>content/notizdokdownload.php?id='+dms_id;
|
||||
var dokbtn = document.createElement("button");
|
||||
dokbtn.setAttribute("label", name);
|
||||
dokbtn.setAttribute("onclick", "window.open('"+dokurl+"')");
|
||||
dokbtn.setAttribute("style", "margin-right: -5px;");
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'hbox-notiz-dokumente').appendChild(dokbtn);
|
||||
|
||||
// Link zum Löschen des Dokuments
|
||||
var delbtn = document.createElement("button");
|
||||
delbtn.setAttribute("image", "<?php echo APP_ROOT;?>skin/images/delete_x.png");
|
||||
delbtn.setAttribute("tooltiptext", "Datei "+name+" löschen");
|
||||
delbtn.setAttribute("onclick", "document.getBindingParent(this).LoeschenDokument("+dms_id+",'"+name+"')");
|
||||
document.getAnonymousElementByAttribute(this ,'anonid', 'hbox-notiz-dokumente').appendChild(delbtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<constructor>
|
||||
//debug('load notiz:'+this.getAttribute('id'));
|
||||
this.DisableControls(true);
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Nikolaus Krondraf <nikolaus.krondraf@technikum-wien.at>
|
||||
*/
|
||||
/**
|
||||
* Die Dokumente werden entweder base64 kodiert in der Datenbank in der Spalte inhalt gespeichert
|
||||
* oder im Filesystem, in diesem Fall ist die Akte mit einer DMS ID verknuepft in welcher der Dateiname steht.
|
||||
*/
|
||||
require_once('../config/vilesci.config.inc.php');
|
||||
require_once('../include/dms.class.php');
|
||||
require_once('../include/benutzerberechtigung.class.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
|
||||
$user = get_uid();
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($user);
|
||||
if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('assistenz') && !$rechte->isBerechtigt('mitarbeiter'))
|
||||
die('Keine Berechtigung');
|
||||
|
||||
if(isset($_GET['id']) && is_numeric($_GET['id']))
|
||||
{
|
||||
$dms = new dms();
|
||||
if(!$dms->load($_GET['id']))
|
||||
die('Kein Dokument vorhanden');
|
||||
|
||||
$filename=DMS_PATH.$dms->filename;
|
||||
|
||||
if(!isset($_GET['notimeupdate']))
|
||||
$dms->touch($dms->dms_id, $dms->version);
|
||||
|
||||
if(file_exists($filename))
|
||||
{
|
||||
if($handle = fopen($filename,"r"))
|
||||
{
|
||||
if($dms->mimetype=='')
|
||||
$dms->mimetype='application/octetstream';
|
||||
|
||||
header('Content-type: '.$dms->mimetype);
|
||||
header('Content-Disposition: inline; filename="'.$dms->name.'"');
|
||||
header('Content-Length: ' .filesize($filename));
|
||||
|
||||
while (!feof($handle))
|
||||
{
|
||||
echo fread($handle, 8192);
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
else
|
||||
echo 'Fehler: Datei konnte nicht geoeffnet werden';
|
||||
}
|
||||
else
|
||||
echo 'Die Datei existiert nicht';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Ungueltige DMS-ID";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Nikolaus Krondraf <nikolaus.krondraf@technikum-wien.at>
|
||||
*/
|
||||
|
||||
// Oberflaeche zum Upload von Dokumenten zu Notizen aus dem FAS
|
||||
require_once('../config/vilesci.config.inc.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
require_once('../include/benutzerberechtigung.class.php');
|
||||
require_once('../include/dms.class.php');
|
||||
require_once('../include/notiz.class.php');
|
||||
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
|
||||
$PHP_SELF = $_SERVER['PHP_SELF'];
|
||||
echo "<html><body>";
|
||||
|
||||
$user = get_uid();
|
||||
$rechte = new benutzerberechtigung();
|
||||
$rechte->getBerechtigungen($user);
|
||||
if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('assistenz') && !$rechte->isBerechtigt('mitarbeiter'))
|
||||
die('Keine Berechtigung');
|
||||
|
||||
$kategorie_kurzbz = 'notiz';
|
||||
$dokument_kurzbz = isset($_REQUEST['dokument_kurzbz'])?$_REQUEST['dokument_kurzbz']:'';
|
||||
|
||||
if(isset($_POST['fileupload']))
|
||||
{
|
||||
$error = false;
|
||||
|
||||
// dms Eintrag anlegen
|
||||
if(isset($_GET['notiz_id']))
|
||||
{
|
||||
$ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
|
||||
$filename = uniqid();
|
||||
$filename.=".".$ext;
|
||||
$uploadfile = DMS_PATH.$filename;
|
||||
|
||||
|
||||
if(move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile))
|
||||
{
|
||||
if(!chgrp($uploadfile,'dms'))
|
||||
echo 'CHGRP failed';
|
||||
if(!chmod($uploadfile, 0774))
|
||||
echo 'CHMOD failed';
|
||||
exec('sudo chown wwwrun '.$uploadfile);
|
||||
|
||||
$dms = new dms();
|
||||
$dms->version='0';
|
||||
$dms->kategorie_kurzbz=$kategorie_kurzbz;
|
||||
$dms->insertamum=date('Y-m-d H:i:s');
|
||||
$dms->insertvon = $user;
|
||||
$dms->mimetype=$_FILES['file']['type'];
|
||||
$dms->filename = $filename;
|
||||
$dms->name = $_FILES['file']['name'];
|
||||
$dms->beschreibung = $_POST['anmerkung_intern'];
|
||||
|
||||
if($dms->save(true))
|
||||
{
|
||||
$dms_id=$dms->dms_id;
|
||||
|
||||
$notiz = new notiz($_GET['notiz_id']);
|
||||
if(!$notiz->saveDokument($dms_id))
|
||||
{
|
||||
echo 'Fehler beim Speichern des Dokuments';
|
||||
$error = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<script>window.opener.NotizDokumentUploadScope.RefreshNotizBlocking();window.opener.NotizDokumentUploadScope.selectItem();window.close();</script>';
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'Fehler beim Speichern der Daten';
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'Fehler beim Hochladen der Datei';
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'Es muss eine Notiz ausgewaehlt werden';
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET['notiz_id']))
|
||||
{
|
||||
echo " <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
|
||||
<link href='../skin/style.css.php' rel='stylesheet' type='text/css'>
|
||||
<link rel='stylesheet' href='../skin/jquery.css' type='text/css'/>
|
||||
</head>
|
||||
<body style='padding:10px;'>
|
||||
<h1>Upload Dokumente</h1>
|
||||
<form method='POST' enctype='multipart/form-data' action='$PHP_SELF?notiz_id=".$_GET['notiz_id']."'>
|
||||
<table>
|
||||
<tr>
|
||||
<td align='right'>Dokument:</td>
|
||||
<td><input type='file' name='file' /></td>
|
||||
</tr>";
|
||||
|
||||
echo " <tr>
|
||||
<td align='right'>Anmerkung:</td><td><textarea name='anmerkung_intern' cols='45' id='anmerkung_intern'></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type='hidden' name='fileupload' id='fileupload'></td>
|
||||
<td><input type='submit' name='submitdok' value='Upload'></td>
|
||||
|
||||
</tr></table></form></body></html>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Es wurde keine notiz_id angegeben";
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+70
-1
@@ -254,6 +254,10 @@ class dms extends basis_db
|
||||
*/
|
||||
public function deleteDms($dms_id)
|
||||
{
|
||||
$this->load($dms_id);
|
||||
$this->getAllVersions($dms_id);
|
||||
$error = false;
|
||||
|
||||
// lösche Versionen
|
||||
$qry ="BEGIN;DELETE FROM campus.tbl_dms_version WHERE dms_id =".$this->db_add_param($dms_id, FHC_INTEGER)."; ";
|
||||
$qry.="DELETE FROM fue.tbl_projekt_dokument WHERE dms_id=".$this->db_add_param($dms_id, FHC_INTEGER)."; ";
|
||||
@@ -261,7 +265,23 @@ class dms extends basis_db
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
$this->db_query('COMMIT;');
|
||||
return true;
|
||||
|
||||
// Alle Versionen der Datei im Filesystem löschen
|
||||
foreach($this->result as $obj)
|
||||
{
|
||||
if(is_file(DMS_PATH.$obj->filename) && !unlink(DMS_PATH.$obj->filename))
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if($error)
|
||||
{
|
||||
$this->errormsg = "Fehler beim Löschen des Dokuments aufgetreten";
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -842,6 +862,55 @@ class dms extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die Dokumente einer Notiz zurück
|
||||
* @param int $notiz_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDokumenteNotiz($notiz_id)
|
||||
{
|
||||
$qry = "SELECT *
|
||||
FROM
|
||||
campus.tbl_dms
|
||||
JOIN campus.tbl_dms_version USING(dms_id)
|
||||
JOIN public.tbl_notiz_dokument USING(dms_id)
|
||||
WHERE (dms_id, version) in(
|
||||
SELECT dms_id, max(version)
|
||||
FROM campus.tbl_dms_version
|
||||
GROUP BY dms_id)
|
||||
AND tbl_notiz_dokument.notiz_id=".$this->db_add_param($notiz_id)."
|
||||
ORDER BY name;";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new dms();
|
||||
|
||||
$obj->dms_id = $row->dms_id;
|
||||
$obj->version = $row->version;
|
||||
$obj->oe_kurzbz = $row->oe_kurzbz;
|
||||
$obj->dokument_kurzbz = $row->dokument_kurzbz;
|
||||
$obj->kategorie_kurzbz = $row->kategorie_kurzbz;
|
||||
$obj->filename = $row->filename;
|
||||
$obj->mimetype = $row->mimetype;
|
||||
$obj->name = $row->name;
|
||||
$obj->beschreibung = $row->beschreibung;
|
||||
$obj->letzterzugriff = $row->letzterzugriff;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die Dokumente einer Projektphase
|
||||
*
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
//Singleton SOAP Client
|
||||
var SOAPClient = {
|
||||
AjaxAsync: true,
|
||||
Proxy: "",
|
||||
SOAPServer: "",
|
||||
ContentType: "text/xml",
|
||||
@@ -44,7 +45,8 @@ var SOAPClient = {
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
async: SOAPClient.AjaxAsync,
|
||||
type: "POST",
|
||||
url: SOAPClient.Proxy,
|
||||
dataType: "xml",
|
||||
processData: false,
|
||||
|
||||
@@ -18,11 +18,13 @@
|
||||
* Authors: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
require_once(dirname(__FILE__).'/dms.class.php');
|
||||
|
||||
class notiz extends basis_db
|
||||
{
|
||||
public $new;
|
||||
public $result=array();
|
||||
public $dokumente=array();
|
||||
|
||||
//Tabellenspalten
|
||||
public $notiz_id;
|
||||
@@ -91,6 +93,7 @@ class notiz extends basis_db
|
||||
$this->insertvon=$row->insertvon;
|
||||
$this->updateamum=$row->updateamum;
|
||||
$this->updatevon=$row->updatevon;
|
||||
$this->getDokumente($row->notiz_id);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -120,6 +123,18 @@ class notiz extends basis_db
|
||||
return false;
|
||||
}
|
||||
|
||||
// Dokumente der Notiz löschen
|
||||
$this->getDokumente($notiz_id);
|
||||
if(!empty($this->dokumente))
|
||||
{
|
||||
$dms = new dms();
|
||||
|
||||
foreach($this->dokumente as $dms_id)
|
||||
{
|
||||
$dms->deleteDms($dms_id);
|
||||
}
|
||||
}
|
||||
|
||||
$qry = "Delete FROM public.tbl_notiz WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
||||
|
||||
if(!$this->db_query($qry))
|
||||
@@ -252,6 +267,28 @@ class notiz extends basis_db
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert ein Dokument zur Notiz
|
||||
* @param int $dms_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function saveDokument($dms_id)
|
||||
{
|
||||
$qry = "INSERT INTO public.tbl_notiz_dokument(notiz_id, dms_id) VALUES(".
|
||||
$this->db_add_param($this->notiz_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($dms_id, FHC_INTEGER).');';
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Laedt die Notizen
|
||||
@@ -325,6 +362,7 @@ class notiz extends basis_db
|
||||
$obj->insertvon=$row->insertvon;
|
||||
$obj->updateamum=$row->updateamum;
|
||||
$obj->updatevon=$row->updatevon;
|
||||
$obj->getDokumente($row->notiz_id);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
@@ -455,4 +493,28 @@ class notiz extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die Dokumente der Notiz
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDokumente($notiz_id)
|
||||
{
|
||||
$qry = "SELECT dms_id FROM public.tbl_notiz_dokument WHERE notiz_id=".$this->db_add_param($notiz_id, FHC_INTEGER);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->dokumente[] = $row->dms_id;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,11 @@ elseif(isset($_GET['filter']))
|
||||
$filter = $_GET['filter'];
|
||||
$dms->search($filter);
|
||||
}
|
||||
elseif(isset($_GET['notiz_id']))
|
||||
{
|
||||
$notiz_id = $_GET['notiz_id'];
|
||||
$dms->getDokumenteNotiz($notiz_id);
|
||||
}
|
||||
else
|
||||
die('projekt_kurzbz oder projektphase_id muss uebergeben werden');
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ foreach($notiz->result as $row)
|
||||
<NOTIZ:startISO><![CDATA['.$row->start.']]></NOTIZ:startISO>
|
||||
<NOTIZ:endeISO><![CDATA['.$row->ende.']]></NOTIZ:endeISO>
|
||||
<NOTIZ:erledigt><![CDATA['.($row->erledigt?'true':'false').']]></NOTIZ:erledigt>
|
||||
<NOTIZ:dokumente><![CDATA['.count($row->dokumente).']]></NOTIZ:dokumente>
|
||||
<NOTIZ:insertamum><![CDATA['.$row->insertamum.']]></NOTIZ:insertamum>
|
||||
<NOTIZ:insertvon><![CDATA['.$row->insertvon.']]></NOTIZ:insertvon>
|
||||
<NOTIZ:updateamum><![CDATA['.$datum_obj->formatDatum($row->updateamum,'d.m.Y H:i:s').']]></NOTIZ:updateamum>
|
||||
|
||||
@@ -30,10 +30,12 @@ require_once('../include/notiz.class.php');
|
||||
require_once('../include/datum.class.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
require_once('../include/benutzerberechtigung.class.php');
|
||||
require_once('../include/dms.class.php');
|
||||
|
||||
$SOAPServer = new SoapServer(APP_ROOT."/soap/notiz.wsdl.php?".microtime());
|
||||
$SOAPServer->addFunction("saveNotiz");
|
||||
$SOAPServer->addFunction("deleteNotiz");
|
||||
$SOAPServer->addFunction("deleteDokument");
|
||||
$SOAPServer->addFunction("setErledigt");
|
||||
$SOAPServer->handle();
|
||||
|
||||
@@ -133,6 +135,29 @@ function deleteNotiz($username, $passwort, $notiz_id)
|
||||
return new SoapFault("Server", $projekttask->errormsg);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Löscht das Dokument mit der vom Webservice übergebenen DMS-ID
|
||||
* @param $dms_id
|
||||
*/
|
||||
function deleteDokument($username, $passwort, $dms_id)
|
||||
{
|
||||
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 Loeschen von Dokumenten");
|
||||
|
||||
$dms = new dms();
|
||||
if($dms->deleteDms($dms_id))
|
||||
return "OK";
|
||||
else
|
||||
return new SoapFault("Server", $dms->errormsg);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Setzt den erledigt Status
|
||||
|
||||
@@ -49,6 +49,14 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<wsdl:message name="deleteNotizResponse">
|
||||
<wsdl:part name="message" type="xsd:string"></wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="deleteDokumentRequest">
|
||||
<wsdl:part name="username" type="xsd:string" minOccurs="0"></wsdl:part>
|
||||
<wsdl:part name="passwort" type="xsd:string" minOccurs="0"></wsdl:part>
|
||||
<wsdl:part name="dms_id" type="xsd:string"></wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="deleteDokumentResponse">
|
||||
<wsdl:part name="message" type="xsd:string"></wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="setErledigtRequest">
|
||||
<wsdl:part name="notiz_id" type="xsd:string"></wsdl:part>
|
||||
<wsdl:part name="erledigt" type="xsd:boolean"></wsdl:part>
|
||||
@@ -66,6 +74,10 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<wsdl:input message="tns:deleteNotizRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:deleteNotizResponse"></wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="deleteDokument">
|
||||
<wsdl:input message="tns:deleteDokumentRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:deleteDokumentResponse"></wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="setErledigt">
|
||||
<wsdl:input message="tns:setErledigtRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:setErledigtResponse"></wsdl:output>
|
||||
@@ -92,6 +104,15 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body use="encoded" namespace="http://www.technikum-wien.at/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="deleteDokument">
|
||||
<soap:operation soapAction="<?php echo APP_ROOT."soap/deleteDokument";?>" />
|
||||
<wsdl:input>
|
||||
<soap:body use="encoded" namespace="http://www.technikum-wien.at/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="encoded" namespace="http://www.technikum-wien.at/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="setErledigt">
|
||||
<soap:operation soapAction="<?php echo APP_ROOT."soap/setErledigt";?>" />
|
||||
<wsdl:input>
|
||||
|
||||
+26
-1
@@ -2826,6 +2826,30 @@ if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants
|
||||
}
|
||||
}
|
||||
|
||||
// Dokumentenupload für Notizen
|
||||
if(!$result = @$db->db_query("SELECT 1 FROM public.tbl_notiz_dokument LIMIT 1;"))
|
||||
{
|
||||
$qry = "
|
||||
|
||||
CREATE TABLE public.tbl_notiz_dokument
|
||||
(
|
||||
notiz_id integer NOT NULL,
|
||||
dms_id integer NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE public.tbl_notiz_dokument ADD CONSTRAINT fk_notiz_dokument_notiz FOREIGN KEY (notiz_id) REFERENCES public.tbl_notiz (notiz_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
ALTER TABLE public.tbl_notiz_dokument ADD CONSTRAINT fk_notiz_dokument_dms FOREIGN KEY (dms_id) REFERENCES campus.tbl_dms (dms_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
||||
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_notiz_dokument TO vilesci;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON public.tbl_notiz_dokument TO web;
|
||||
";
|
||||
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>Dokumentenupload fuer Notizen: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo ' Tabellen fuer Dokumentenupload fuer Notizen hinzugefuegt!<br>';
|
||||
}
|
||||
|
||||
echo '<br><br><br>';
|
||||
|
||||
$tabellen=array(
|
||||
@@ -3003,7 +3027,8 @@ $tabellen=array(
|
||||
"public.tbl_mitarbeiter" => array("mitarbeiter_uid","personalnummer","telefonklappe","kurzbz","lektor","fixangestellt","bismelden","stundensatz","ausbildungcode","ort_kurzbz","standort_id","anmerkung","insertamum","insertvon","updateamum","updatevon","ext_id","kleriker"),
|
||||
"public.tbl_notiz" => array("notiz_id","titel","text","verfasser_uid","bearbeiter_uid","start","ende","erledigt","insertamum","insertvon","updateamum","updatevon","ext_id"),
|
||||
"public.tbl_notizzuordnung" => array("notizzuordnung_id","notiz_id","projekt_kurzbz","projektphase_id","projekttask_id","uid","person_id","prestudent_id","bestellung_id","lehreinheit_id","ext_id","anrechnung_id"),
|
||||
"public.tbl_ort" => array("ort_kurzbz","bezeichnung","planbezeichnung","max_person","lehre","reservieren","aktiv","lageplan","dislozierung","kosten","ausstattung","updateamum","updatevon","insertamum","insertvon","ext_id","stockwerk","standort_id","telefonklappe","content_id","m2","gebteil","oe_kurzbz"),
|
||||
"public.tbl_notiz_dokument" => array("notiz_id","dms_id"),
|
||||
"public.tbl_ort" => array("ort_kurzbz","bezeichnung","planbezeichnung","max_person","lehre","reservieren","aktiv","lageplan","dislozierung","kosten","ausstattung","updateamum","updatevon","insertamum","insertvon","ext_id","stockwerk","standort_id","telefonklappe","content_id","m2","gebteil","oe_kurzbz"),
|
||||
"public.tbl_ortraumtyp" => array("ort_kurzbz","hierarchie","raumtyp_kurzbz"),
|
||||
"public.tbl_organisationseinheit" => array("oe_kurzbz", "oe_parent_kurzbz", "bezeichnung","organisationseinheittyp_kurzbz", "aktiv","mailverteiler","freigabegrenze","kurzzeichen","lehre"),
|
||||
"public.tbl_organisationseinheittyp" => array("organisationseinheittyp_kurzbz", "bezeichnung", "beschreibung"),
|
||||
|
||||
Reference in New Issue
Block a user