Some changes for file management module dateien

This commit is contained in:
Xenomporio 2022-08-12 20:13:15 +02:00
parent 1e6812dbd4
commit f08c9ecc09
5 changed files with 92 additions and 89 deletions

View File

@ -12174,6 +12174,7 @@ url:strUrl, success:function(html){strReturn = html;}, async:false
}
}
/* NOT USED
function AutoCompleteAuftrag($fieldname, $filter, $onlyfirst = 0, $extendurl = "") {
$module = $this->app->Secure->GetGET("module");
@ -12328,6 +12329,8 @@ return false;
$this->app->Tpl->Set(strtoupper($fieldname) . 'START', '<div style="font-size: 8pt;"><div class="ui-widget" style="font-size: 8pt;">');
$this->app->Tpl->Set(strtoupper($fieldname) . 'ENDE', '</div></div>');
}
*/
function AutoCompleteAdd($fieldname, $filter, $onlyfirst = 0, $extendurl = "") {
@ -12382,7 +12385,10 @@ return false;
$this->app->Tpl->Set(strtoupper($fieldname) . 'START', '<div style="font-size: 8pt;"><div class="ui-widget" style="font-size: 8pt;">');
$this->app->Tpl->Set(strtoupper($fieldname) . 'ENDE', '</div></div>');
}
/* NOT USED
function AutoCompleteAddEvent($fieldname, $filter, $onlyfirst = 0, $extendurl = "") {
if ($onlyfirst) {
$tpl = '
@ -12399,7 +12405,8 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
$this->app->Tpl->Set(strtoupper($fieldname) . 'START', '<div style="font-size: 8pt;"><div class="ui-widget" style="font-size: 8pt;">');
$this->app->Tpl->Set(strtoupper($fieldname) . 'ENDE', '</div></div>');
}
function AutoCompleteJSON($fieldname, $filter, $onlyfirst = 0, $extendurl = "", $extendedelement = "", $extendurl2 ="", $extendedelement2 = "", $appendto = "", $return = false)
{
if($extendedelement)
@ -12472,6 +12479,7 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
}
*/
function AutoComplete($fieldname, $filter, $onlyfirst = 0, $extendurl = "", $extendedelement = "", $extendurl2 ="", $extendedelement2 = "", $appendto = "", $return = false) {

View File

@ -1,44 +1,35 @@
<div id="tabs">
<ul>
<li><a href="#tab1">&Uuml;bersicht</a></li>
<li><a href="#tab2">neue Version anlegen</a></li>
</ul>
<!-- ende gehort zu tabview -->
<!-- erstes tab -->
<div id="tab1">
<form action="" method="post" name="eprooform" enctype="multipart/form-data">
<h2>Beschreibung</h2>
<table border="0" width="100%">
<h2>Beschreibung</h2>
<table border="0" width="100%">
<tr><td>Titel</td><td colspan="3"><input type="text" size="30" name="titel" value="[TITEL]"></td></tr>
<tr><td>Beschreibung</td><td colspan="3"><textarea cols="35" rows="5" name="beschreibung">[BESCHREIBUNG]</textarea></td></tr>
</table>
<h2>Versionen</h2>[VERSIONEN]
<h2>Stichworte</h2>[STICHWORTE]
<table border="0" width="100%">
<tr valign="" height="" bgcolor="" align="" bordercolor="" class="klein" classname="klein">
<td width="" valign="" height="" bgcolor="" align="right" colspan="4" bordercolor="" classname="orange2" class="orange2">
<input type="submit" name="speichern"
value="Speichern" /> <input type="button" value="Abbrechen" /></td>
</tr>
</table>
</table>
<h2>Versionen</h2>
[VERSIONEN]
<h2>Zuordnungen</h2>
[STICHWOERTER]
<table border="0" width="100%">
<tr>
<td width="" valign="" height="" bgcolor="" align="right" bordercolor="" classname="orange2" class="orange2">
<input type="submit" name="speichern" value="Speichern" />
</td>
</tr>
<tr>
<td width="" valign="" height="" bgcolor="" align="right" bordercolor="" classname="orange2" class="orange2">
<input type="submit" value="Abbrechen" />
</td>
</tr>
</table>
</form>
</div>
<div id="tab2">
[NEUEVERSION]

View File

@ -19,7 +19,7 @@
<tr valign="middle"><td>Stichwort:</td><td colspan="3">
<table>
<tr>
<td><select name="huhu" onchange="document.getElementById('subjekt').value=document.eprooform.huhu.options[document.eprooform.huhu.selectedIndex].value">
<td><select name="subjektselect" onchange="document.getElementById('subjekt').value=document.eprooform.subjektselect.options[document.eprooform.subjektselect.selectedIndex].value">
<option value=""></option>
<option value="Bild">Bild</option>
<option value="Schaltplan">Schaltplan</option>
@ -32,17 +32,17 @@
<option value="Schaltplan">UST-Pr&uuml;fung</option>
</select></td>
<td>von</td>
<td><select>
<option value="Projekt">Projekt %</option>
<option value="Kunde">Kunde %</option>
<option value="Artikel">Artikel %</option>
<option value="Auftrag">Auftrag %</option>
<td><select name="objekt">
<option value="Projekt">Projekt ID</option>
<option value="Kunde">Kunde ID</option>
<option value="Artikel">Artikel ID</option>
<option value="Auftrag">Auftrag ID</option>
</select></td>
</tr>
<tr>
<td><input type="text" size="15" name="subjekt" id="subjekt" value="[SUBJEKT]"></td>
<td>&nbsp;</td>
<td><input type="text" size="15" name="objekt" value="[OBJEKT]"></td>
<td><input type="text" size="15" name="nummer" value="[NUMMER]"></td>
</tr>
</table>
</td></tr>

View File

@ -39,7 +39,6 @@ class Dateien {
// alle artikel die ein Kunde kaufen kann mit preisen netto brutto
$cmd = $app->Secure->GetGET("smodule");
$cmd = strtolower($_objekt);
$adresse = $app->DB->Select("SELECT adresse FROM {$cmd} WHERE id='$id' LIMIT 1");
// headings
$heading = array('','','','Titel', 'Stichwort', 'Version','Gr&ouml;&szlig;e', 'Ersteller','Version','Datum','Men&uuml;');
@ -89,6 +88,31 @@ class Dateien {
LEFT JOIN datei_version v ON v.datei=d.id WHERE $where";
}
switch ($name) {
case "dateien_list":
$allowed['dateien_list'] = array('list');
$heading = array('ID','Titel', 'Beschreibung', 'Verkn&uuml;pfung', 'Geloescht', 'Logdatei', 'Men&uuml;');
$width = array('10%'); // Fill out manually later
$findcols = array('d.id','d.titel', 'd.beschreibung', 'd.nummer', 'd.geloescht', 'd.logdatei');
$searchsql = array('d.titel', 'd.beschreibung', 'd.nummer', 'd.geloescht', 'd.logdatei');
$defaultorder = 1;
$defaultorderdesc = 0;
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=dateien&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a></td></tr></table>";
$sql = "SELECT SQL_CALC_FOUND_ROWS d.id, d.id, d.titel, d.beschreibung, GROUP_CONCAT(ds.objekt SEPARATOR ', '), d.geloescht, d.logdatei, d.id FROM datei d LEFT join datei_stichwoerter ds ON ds.datei = d.id";
$where = "1";
$count = "SELECT count(DISTINCT id) FROM datei WHERE $where";
$groupby = " GROUP BY d.id ";
break;
}
$erg = [];
foreach($erlaubtevars as $k => $v)
@ -113,7 +137,7 @@ class Dateien {
$this->app->ActionHandler("create","DateienCreate");
$this->app->ActionHandler("edit","DateienEdit");
$this->app->ActionHandler("list","DateienList");
$this->app->ActionHandler("list","datei_list");
$this->app->ActionHandler("archiv","DateienArchiv");
$this->app->ActionHandler("artikel","DateienArtikel");
$this->app->ActionHandler("send","DateienSend");
@ -172,23 +196,16 @@ class Dateien {
$this->app->erp->Headlines('Dateien');
}
function datei_list() {
$this->app->erp->MenuEintrag("index.php?module=dateien&action=list", "&Uuml;bersicht");
$this->app->erp->MenuEintrag("index.php?module=dateien&action=create", "Neu anlegen");
function DateienList()
{
$this->DateienHauptMenu();
/* Dateiene zur Nachbesserung */
$this->app->Tpl->Set('HEADING','Dateien');
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
$this->app->YUI->TableSearch('TAB1', 'dateien_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "dateien_list.tpl");
}
$this->app->Tpl->Set('SUBHEADING','Neuste Dateien');
//Jeder der in Nachbesserung war egal ob auto oder manuell wandert anschliessend in Manuelle-Freigabe");
$table = new EasyTable($this->app);
$table->Query("SELECT d.titel, s.subjekt, v.version, v.ersteller, v.bemerkung, d.id FROM datei d LEFT JOIN datei_stichwoerter s ON d.id=s.datei LEFT JOIN datei_version v ON v.datei=d.id ORDER by d.id DESC LIMIT 10",0,"");
$table->Display('INHALT');
$this->app->Tpl->Parse('PAGE',"rahmen.tpl");
$this->app->Tpl->Set('INHALT','');
}
function DateienDownload()
{
$typ = $this->app->Secure->GetGET('typ');
@ -274,7 +291,7 @@ class Dateien {
$fileid = $this->app->erp->CreateDatei($_FILES['upload']['name'],$titel,$beschreibung,$nummer,$_FILES['upload']['tmp_name'],$this->app->User->GetName());
// stichwoerter hinzufuegen
$this->app->erp->AddDateiStichwort($fileid,$subjekt,$objekt);
$this->app->erp->AddDateiStichwort($fileid,$subjekt,$objekt,$nummer);
$this->app->Location->execute('index.php?module=dateien&action=edit&id='.$fileid);
//loeschen von /tmp
}
@ -305,7 +322,6 @@ class Dateien {
$beschreibung = $this->app->DB->Select("SELECT beschreibung FROM datei WHERE id='$id' LIMIT 1");
$nummer= $this->app->DB->Select("SELECT nummer FROM datei WHERE id='$id' LIMIT 1");
$this->app->Tpl->Set('TITEL',$titel);
$this->app->Tpl->Set('KURZUEBERSCHRIFT2',$titel);
$this->app->Tpl->Set('BESCHREIBUNG',$beschreibung);
@ -313,17 +329,22 @@ class Dateien {
$table = new EasyTable($this->app);
$table->Query("SELECT version,dateiname,datum,ersteller,bemerkung,id FROM datei_version WHERE datei='$id'",0,"");
$table->DisplayNew('VERSIONEN',"
/* $table->DisplayNew('VERSIONEN',"
<!--<a href=\"index.php?module=adresse&action=dateiversion&id=$id&lid=%value%\">edit</a>-->
<a href=\"#\"onclick=\"if(!confirm('Wirklich löschen?')) return false; else window.location.href='index.php?module=dateien&action=delete&fid=%value%&version=true&id=$id';\" ><img src=\"./themes/new/images/delete.svg\" border=\"0\"></a>
<a href=\"index.php?module=dateien&action=send&fid=%value%&id=$id\"><img src=\"./themes/new/images/download.svg\" border=\"0\"></a>
",
"<!--<a href=\"index.php?module=adresse&action=lieferadresseneu&id=$id\">Neue Version anlegen</a>-->");
"<!--<a href=\"index.php?module=adresse&action=lieferadresseneu&id=$id\">Neue Version anlegen</a>-->");*/
$table->DisplayNew('VERSIONEN',"
<a href=\"index.php?module=dateien&action=send&fid=%value%&id=$id\"><img src=\"./themes/new/images/download.svg\" border=\"0\"></a>
");
$table = new EasyTable($this->app);
$table->Query("SELECT subjekt,objekt,parameter FROM datei_stichwoerter WHERE datei='$id'",0,"");
$table->DisplayNew('STICHWORTE',"Parameter","noAction");
$table->DisplayNew('STICHWOERTER',"Parameter","noAction");
$this->app->YUI->AutoComplete("auftrag_zuordnen","auftrag");
$this->app->YUI->AutoComplete("verbindlichkeit_zuordnen","verbindlichkeit");
$this->app->Tpl->Set('HEADING',"Datei (Bearbeiten)");
$this->app->Tpl->Parse('PAGE',"datei.tpl");
@ -346,32 +367,9 @@ class Dateien {
$this->app->erp->RunHook('LayouttemplateAttachmentItemsDelete', 2, $id, $cmd);
$version = $this->app->Secure->GetGET("version");
if($version!='')
{
if(is_numeric($fid)){
$this->app->DB->Delete("DELETE FROM datei_version WHERE id='$fid' AND datei='$id' LIMIT 1");
}
// TODO Datei aus dem Dateisystem entfernen
$this->app->Location->execute("index.php?module=dateien&action=edit&id=$id");
}
// stichweoeter loeschen
if(is_numeric($id)){
// Deletion of files removed, they only get marketd
if($cmd!="")
{
$this->app->DB->Delete("DELETE FROM datei_stichwoerter WHERE datei='$id' AND objekt LIKE '$cmd' LIMIT 1");
} else {
$this->app->DB->Delete("DELETE FROM datei_stichwoerter WHERE datei='$id'");
}
$check = $this->app->DB->Select("SELECT COUNT(id) FROM datei_stichwoerter WHERE datei='$id'");
if($check <=0)
{
$this->app->DB->Delete("DELETE FROM datei_version WHERE datei='$id'");
$this->app->DB->Update("UPDATE datei SET geloescht=1 WHERE id='$id'");
}
}
$this->app->DB->Update("UPDATE datei SET geloescht=1 WHERE id='$id'");
$refer = $_SERVER['HTTP_REFERER'];
$this->app->Location->execute($refer);
}

View File

@ -248,10 +248,16 @@ class Ticket {
if ($showdelete) {
$deletetext = '<a href=index.php?module=ticket&action=edit&id='.$ticket_id.'&cmd=deleteattachment'.'&fileid='.$file_attachment.'>'.
'<img src="./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/delete.svg" />';
'<img src="./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/delete.svg" /></a>';
} else {
$deletetext = "";
}
}
$attachtext = "";
/* Not implemented -> Attachment of ticket_nachricht to business object is the better option -> implement later
$attachtext = '<a href=index.php?module=dateien&action=edit&id='.$file_attachment.'>'.
'<img src="./themes/' . $this->app->Conf->WFconf['defaulttheme'] . '/images/copy.svg" /></a>'; */
$this->app->Tpl->Add($templatepos,
"<a href=\"index.php?module=dateien&action=send&id=".$file_attachment.
@ -262,8 +268,8 @@ class Ticket {
")".
"</a>".
$deletetext.
"</a>".
"</br>");
$attachtext.
"<br>");
}
}
}