mitarbeiter finished

This commit is contained in:
darthsandmann 2017-01-17 18:00:11 +01:00
parent 4552aa346a
commit 00ecaf25c6
20 changed files with 306 additions and 22 deletions

View File

@ -36,7 +36,8 @@ class Navigation_cl(object):
{'action': 'fehler' , 'text': 'Bearbeitung Fehlerdaten'},
{'action': 'projekt' , 'text': 'Pflege Projekte'},
{'action': 'komponente' , 'text': 'Pflege Komponenten'},
{'action': 'mitarbeiter' , 'text': 'Pflege Daten Mitarbeiter'},
{'action': 'qsmitarbeiter' , 'text': 'Pflege Daten QS-Mitarbeiter'},
{'action': 'swentwickler' , 'text': 'Pflege Daten SW-Entwickler'},
{'action': 'kategorien' , 'text': 'Pflege Kategorien'},
{'action': 'prolist' , 'text': 'Auswertung Projekte/Fehler'},
{'action': 'catlist' , 'text': 'Auswertung Kategorien/Fehler'}

View File

@ -3,12 +3,25 @@
import json
import cherrypy
#from .database import SourceDatabase_cl, EvaluatedDatabase_cl
from .database import QsMitarbeiterDatabase_cl, SwEntwicklerDatabase_cl
# Method-Dispatching!
# Übersicht Anforderungen / Methoden
# (beachte: / relativ zu /navigation, siehe Konfiguration Server!)
#-------------------------------------------------------
def adjustId_p(id_spl, data_opl):
#-------------------------------------------------------
if id_spl == None:
data_opl['id'] = ''
elif id_spl == '':
data_opl['id'] = ''
elif id_spl == '0':
data_opl['id'] = ''
else:
data_opl['id'] = id_spl
return data_opl
"""
@ -32,27 +45,87 @@ class QsMitarbeiter_cl(object):
#-------------------------------------------------------
def __init__(self):
#-------------------------------------------------------
pass
self.db_o = QsMitarbeiterDatabase_cl()
#-------------------------------------------------------
def GET(self):
def GET(self, id = None):
#-------------------------------------------------------
return json.dumps(retVal_o)
retVal_o = {
'data': None
}
if id == None:
# Anforderung der Liste
retVal_o['data'] = self.db_o.read_px()
else:
# Anforderung eines Dokuments
data_o = self.db_o.read_px(id)
if data_o != None:
retVal_o['data'] = adjustId_p(id, data_o)
return retVal_o
#-------------------------------------------------------
def PUT(self):
def PUT(self, data_opl):
#-------------------------------------------------------
return json.dumps(retVal_o)
# Sichern der Daten: jetzt wird keine vollständige Seite
# zurückgeliefert, sondern nur noch die Information, ob das
# Speichern erfolgreich war
retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
id_s = data_opl["id_s"]
data_o = {
'name': data_opl["name_s"],
'id': data_opl["id_s"]
}
# Update-Operation
retVal_o['id'] = id_s
if self.db_o.update_px(id_s, data_o):
pass
else:
retVal_o['id'] = None
return retVal_o
#-------------------------------------------------------
def POST(self):
def POST(self, data_opl):
#-------------------------------------------------------
return json.dumps(retVal_o)
retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
data_o = {
'name': data_opl["name_s"]
}
# Create-Operation
id_s = self.db_o.create_px(data_o)
retVal_o['id'] = id_s
return retVal_o
#-------------------------------------------------------
def DELETE(self):
def DELETE(self, id):
#-------------------------------------------------------
return json.dumps(retVal_o)
# Eintrag löschen, nur noch Rückmeldung liefern
retVal_o = {
'id': id
}
if self.db_o.delete_px(id):
pass
else:
retVal_o['id'] = None
return retVal_o
@ -75,26 +148,86 @@ class SwEntwickler_cl(object):
#-------------------------------------------------------
def __init__(self):
#-------------------------------------------------------
pass
self.db_o = SwEntwicklerDatabase_cl()
#-------------------------------------------------------
def GET(self):
def GET(self, id = None):
#-------------------------------------------------------
return json.dumps(retVal_o)
retVal_o = {
'data': None
}
if id == None:
# Anforderung der Liste
retVal_o['data'] = self.db_o.read_px()
else:
# Anforderung eines Dokuments
data_o = self.db_o.read_px(id)
if data_o != None:
retVal_o['data'] = adjustId_p(id, data_o)
return retVal_o
#-------------------------------------------------------
def PUT(self):
def PUT(self, data_opl):
#-------------------------------------------------------
return json.dumps(retVal_o)
# Sichern der Daten: jetzt wird keine vollständige Seite
# zurückgeliefert, sondern nur noch die Information, ob das
# Speichern erfolgreich war
retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
id_s = data_opl["id_s"]
data_o = {
'name': data_opl["name_s"],
'id': data_opl["id_s"]
}
# Update-Operation
retVal_o['id'] = id_s
if self.db_o.update_px(id_s, data_o):
pass
else:
retVal_o['id'] = None
return retVal_o
#-------------------------------------------------------
def POST(self):
def POST(self, data_opl):
#-------------------------------------------------------
return json.dumps(retVal_o)
retVal_o = {
'id': None
}
# data_opl: Dictionary mit den gelieferten key-value-Paaren
# hier müsste man prüfen, ob die Daten korrekt vorliegen!
data_o = {
'name': data_opl["name_s"]
}
# Create-Operation
id_s = self.db_o.create_px(data_o)
retVal_o['id'] = id_s
return retVal_o
#-------------------------------------------------------
def DELETE(self):
def DELETE(self, id):
#-------------------------------------------------------
return json.dumps(retVal_o)
# Eintrag löschen, nur noch Rückmeldung liefern
retVal_o = {
'id': id
}
if self.db_o.delete_px(id):
pass
else:
retVal_o['id'] = None
return retVal_o
# EOF

View File

@ -0,0 +1,4 @@
{
"name": "QS-Mitarbeiter1",
"id": "1"
}

View File

@ -0,0 +1,4 @@
{
"name": "QS-Mitarbeiter2",
"id": "2"
}

View File

@ -0,0 +1,4 @@
{
"name": "QS-Mitarbeiter3",
"id": "3"
}

View File

@ -0,0 +1,4 @@
{
"name": "QS-Mitarbeiter4",
"id": "4"
}

View File

@ -1 +1 @@
0
5

View File

@ -0,0 +1,4 @@
{
"name": "SW-Entwickler1",
"id": "1"
}

View File

@ -0,0 +1,4 @@
{
"name": "SW-Entwickler2",
"id": "2"
}

View File

@ -0,0 +1,4 @@
{
"name": "SW-Entwickler3",
"id": "3"
}

View File

@ -0,0 +1,4 @@
{
"name": "SW-Entwickler5",
"id": "5"
}

View File

@ -1 +1 @@
0
5

View File

@ -27,6 +27,12 @@ APP.Application_cl = class {
this.listKomponente_o = new APP.ListView_cl('komponente', '/komponente/', 'komponentelist.tpl');
this.detailKomponente_o = new APP.DetailView_cl('komponente', '/komponente/', 'komponentedetail.tpl');
this.listQsMitarbeiter_o = new APP.ListView_cl('qsmitarbeiter', '/qsmitarbeiter/', 'qsmitarbeiterlist.tpl');
this.detailQsMitarbeiter_o = new APP.DetailView_cl('qsmitarbeiter', '/qsmitarbeiter/', 'qsmitarbeiterdetail.tpl');
this.listSwEntwickler_o = new APP.ListView_cl('swentwickler', '/swentwickler/', 'swentwicklerlist.tpl');
this.detailSwEntwickler_o = new APP.DetailView_cl('swentwickler', '/swentwickler/', 'swentwicklerdetail.tpl');
// this.listSources_o = new APP.ListView_cl('source', '/source/', 'sourceslist.tpl');
// this.detailSources_o = new APP.SourceDetailView_cl('source', '/source/', 'sourcedetail.tpl');
// this.listEvaluated_o = new APP.ListView_cl('evaluated', '/evaluated/', 'evaluatedlist.tpl');
@ -69,6 +75,28 @@ APP.Application_cl = class {
// Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailKomponente_o, data_apl[1]);
break;
case 'qsmitarbeiter':
self_opl.setContent_p(self_opl.listQsMitarbeiter_o, data_apl[1]);
break;
case 'qsmitarbeiter.add':
// (leeres) Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailQsMitarbeiter_o, data_apl[1]);
break;
case 'qsmitarbeiter.edit':
// Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailQsMitarbeiter_o, data_apl[1]);
break;
case 'swentwickler':
self_opl.setContent_p(self_opl.listSwEntwickler_o, data_apl[1]);
break;
case 'swentwickler.add':
// (leeres) Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailSwEntwickler_o, data_apl[1]);
break;
case 'swentwickler.edit':
// Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailSwEntwickler_o, data_apl[1]);
break;
default:
console.warn('[Application_cl] unbekannte app-Notification: '+data_apl[0]);
break;

Binary file not shown.

View File

@ -0,0 +1,20 @@
<!-- Template -->
<form id="idForm" class="clContent">
<h2 id="idContentHeader" class="clContentHeader">
Pflege QS-Mitarbeiter
</h2>
<div id="idContentArea" class="clContentArea">
<input type="hidden" value="#context.data.id#" id="id_s" name="id_s" />
<div class="clFormRow">
<label for="name_s">Name <span class="clRequired"></span></label>
<input type="text" value="#context.data.name#" id="name_s" name="name_s" autofocus required />
</div>
</div>
<div id="idButtonArea" class="clButtonArea">
<button data-action="back" class="clButton">Zurück</button>
<button data-action="save" class="clButton">Speichern</button>
</div>
</form>
<!-- EOF -->

View File

@ -0,0 +1,25 @@
<!-- Template -->
<div id="idListContent" class="clContent">
<h2 id="idContentHeader" class="clContentHeader">
Pflege QS-Mitarbeiter
</h2>
<div id="idContentArea" class="clContentArea">
<table id="idList">
<tr class="listheader"><th>Name</th><th>ID</th></tr>
@var rows_o = context['data'];@
@for var key_s in rows_o@
<tr id='#key_s#'>
@var row_o = rows_o[key_s];@
<td>#row_o['name']#</td><td>#row_o['id']#</td>
</tr>
@endfor@
</table>
</div>
<div id="idButtonArea" class="clButtonArea">
<button data-action="add" class="clButton">Hinzufügen</button>
<button data-action="edit" class="clButton">Bearbeiten</button>
<button data-action="delete" class="clButton">Löschen</button>
</div>
</div>
<!-- EOF -->

View File

@ -0,0 +1,20 @@
<!-- Template -->
<form id="idForm" class="clContent">
<h2 id="idContentHeader" class="clContentHeader">
Pflege SW-Mitarbeiter
</h2>
<div id="idContentArea" class="clContentArea">
<input type="hidden" value="#context.data.id#" id="id_s" name="id_s" />
<div class="clFormRow">
<label for="name_s">Name <span class="clRequired"></span></label>
<input type="text" value="#context.data.name#" id="name_s" name="name_s" autofocus required />
</div>
</div>
<div id="idButtonArea" class="clButtonArea">
<button data-action="back" class="clButton">Zurück</button>
<button data-action="save" class="clButton">Speichern</button>
</div>
</form>
<!-- EOF -->

View File

@ -0,0 +1,25 @@
<!-- Template -->
<div id="idListContent" class="clContent">
<h2 id="idContentHeader" class="clContentHeader">
Pflege SW-Mitarbeiter
</h2>
<div id="idContentArea" class="clContentArea">
<table id="idList">
<tr class="listheader"><th>Name</th><th>ID</th></tr>
@var rows_o = context['data'];@
@for var key_s in rows_o@
<tr id='#key_s#'>
@var row_o = rows_o[key_s];@
<td>#row_o['name']#</td><td>#row_o['id']#</td>
</tr>
@endfor@
</table>
</div>
<div id="idButtonArea" class="clButtonArea">
<button data-action="add" class="clButton">Hinzufügen</button>
<button data-action="edit" class="clButton">Bearbeiten</button>
<button data-action="delete" class="clButton">Löschen</button>
</div>
</div>
<!-- EOF -->