projekt finished

This commit is contained in:
darthsandmann 2017-01-17 14:23:08 +01:00
parent 0ef842e09e
commit d87d70c980
18 changed files with 105 additions and 64 deletions

Binary file not shown.

View File

@ -36,6 +36,7 @@ class Database_cl(object):
#------------------------------------------------------- #-------------------------------------------------------
# Überprüfung der Datenn müsste ergänzt werden! # Überprüfung der Datenn müsste ergänzt werden!
id_s = self.nextId_p() id_s = self.nextId_p()
data_opl['id'] = id_s
# Datei erzeugen # Datei erzeugen
file_o = codecs.open(os.path.join(self.path_s , id_s+'.dat'), 'w', 'utf-8') file_o = codecs.open(os.path.join(self.path_s , id_s+'.dat'), 'w', 'utf-8')
file_o.write(json.dumps(data_opl, indent=3, ensure_ascii=True)) file_o.write(json.dumps(data_opl, indent=3, ensure_ascii=True))

View File

@ -33,13 +33,13 @@ class Navigation_cl(object):
#------------------------------------------------------- #-------------------------------------------------------
# Hinweis: könnte man auch aus einer Datei einlesen # Hinweis: könnte man auch aus einer Datei einlesen
retVal_o = [ retVal_o = [
{'action': 'modError' , 'text': 'Bearbeitung Fehlerdaten'}, {'action': 'fehler' , 'text': 'Bearbeitung Fehlerdaten'},
{'action': 'modProj' , 'text': 'Pflege Projekte'}, {'action': 'projekt' , 'text': 'Pflege Projekte'},
{'action': 'modComp' , 'text': 'Pflege Komponenten'}, {'action': 'komponente' , 'text': 'Pflege Komponenten'},
{'action': 'modStaff' , 'text': 'Pflege Daten Mitarbeiter'}, {'action': 'mitarbeiter' , 'text': 'Pflege Daten Mitarbeiter'},
{'action': 'modCat' , 'text': 'Pflege Kategorien'}, {'action': 'kategorien' , 'text': 'Pflege Kategorien'},
{'action': 'evalProj' , 'text': 'Auswertung Projekte/Fehler'}, {'action': 'prolist' , 'text': 'Auswertung Projekte/Fehler'},
{'action': 'evalCat' , 'text': 'Auswertung Kategorien/Fehler'} {'action': 'catlist' , 'text': 'Auswertung Kategorien/Fehler'}
] ]
return json.dumps(retVal_o) return json.dumps(retVal_o)

View File

@ -67,19 +67,67 @@ class Projekt_cl(object):
#return json.dumps(retVal_o) #return json.dumps(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

View File

@ -42,7 +42,7 @@ class Templates_cl(object):
files_a = os.listdir('templates') files_a = os.listdir('templates')
for fileName_s in files_a: for fileName_s in files_a:
file_o = codecs.open(os.path.join('templates', fileName_s), 'rU', 'utf-8') file_o = codecs.open(os.path.join('templates', fileName_s), 'rU', 'utf-8', errors='ignore')
content_s = file_o.read() content_s = file_o.read()
file_o.close() file_o.close()
retVal_o["templates"][fileName_s] = content_s retVal_o["templates"][fileName_s] = content_s

View File

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

View File

@ -1 +1 @@
0 3

View File

@ -20,6 +20,10 @@ APP.Application_cl = class {
constructor () { constructor () {
this.content_o = null; // das jeweils aktuelle Objekt im Contentbereich this.content_o = null; // das jeweils aktuelle Objekt im Contentbereich
this.nav_o = new APP.Nav_cl(); this.nav_o = new APP.Nav_cl();
this.listProjekt_o = new APP.ListView_cl('projekt', '/projekt/', 'projektlist.tpl');
this.detailProjekt_o = new APP.DetailView_cl('projekt', '/projekt/', 'projektdetail.tpl');
// this.listSources_o = new APP.ListView_cl('source', '/source/', 'sourceslist.tpl'); // this.listSources_o = new APP.ListView_cl('source', '/source/', 'sourceslist.tpl');
// this.detailSources_o = new APP.SourceDetailView_cl('source', '/source/', 'sourcedetail.tpl'); // this.detailSources_o = new APP.SourceDetailView_cl('source', '/source/', 'sourcedetail.tpl');
// this.listEvaluated_o = new APP.ListView_cl('evaluated', '/evaluated/', 'evaluatedlist.tpl'); // this.listEvaluated_o = new APP.ListView_cl('evaluated', '/evaluated/', 'evaluatedlist.tpl');
@ -40,30 +44,17 @@ APP.Application_cl = class {
// Liste Quellen im Content-Bereich anzeigen // Liste Quellen im Content-Bereich anzeigen
// self_opl.setContent_p(self_opl.listSources_o, data_apl[1]); // self_opl.setContent_p(self_opl.listSources_o, data_apl[1]);
break; break;
/* case 'source': case 'projekt':
// Liste Quellen im Content-Bereich anzeigen self_opl.setContent_p(self_opl.listProjekt_o, data_apl[1]);
self_opl.setContent_p(self_opl.listSources_o, data_apl[1]);
break; break;
case 'source.add': case 'projekt.add':
// (leeres) Detailformular im Content-Bereich anzeigen // (leeres) Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailSources_o, data_apl[1]); self_opl.setContent_p(self_opl.detailProjekt_o, data_apl[1]);
break; break;
case 'source.edit': case 'projekt.edit':
// Detailformular im Content-Bereich anzeigen // Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailSources_o, data_apl[1]); self_opl.setContent_p(self_opl.detailProjekt_o, data_apl[1]);
break; break;
case 'evaluated':
// Liste Quellen im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.listEvaluated_o, data_apl[1]);
break;
case 'evaluated.add':
// (leeres) Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailEvaluated_o, data_apl[1]);
break;
case 'evaluated.edit':
// Detailformular im Content-Bereich anzeigen
self_opl.setContent_p(self_opl.detailEvaluated_o, data_apl[1]);
break;*/
default: default:
console.warn('[Application_cl] unbekannte app-Notification: '+data_apl[0]); console.warn('[Application_cl] unbekannte app-Notification: '+data_apl[0]);
break; break;

BIN
Praktikum3/bt/templates/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,26 +0,0 @@
<!-- Template -->
<!-- evaluated -->
<div id="idListContent" class="clContent">
<h2 id="idContentHeader" class="clContentHeader">
Literaturauswertung
</h2>
<div id="idContentArea" class="clContentArea">
<table id="idList">
<tr class="listheader"><th>Titel</th><th>Autor</th><th>Auswertungsjahr</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['title']#</td><td>#row_o['author']#</td><td>#row_o['evalyear']#</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 Projekte
</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

@ -1,17 +1,16 @@
<!-- Template --> <!-- Template -->
<!-- sources -->
<div id="idListContent" class="clContent"> <div id="idListContent" class="clContent">
<h2 id="idContentHeader" class="clContentHeader"> <h2 id="idContentHeader" class="clContentHeader">
Literatur- / Quellenverzeichnis Pflege Projekte
</h2> </h2>
<div id="idContentArea" class="clContentArea"> <div id="idContentArea" class="clContentArea">
<table id="idList"> <table id="idList">
<tr class="listheader"><th>Name</th><th>Typ</th><th>Referenz</th></tr> <tr class="listheader"><th>Name</th><th>ID</th></tr>
@var rows_o = context['data'];@ @var rows_o = context['data'];@
@for var key_s in rows_o@ @for var key_s in rows_o@
<tr id='#key_s#'> <tr id='#key_s#'>
@var row_o = rows_o[key_s];@ @var row_o = rows_o[key_s];@
<td>#row_o['name']#</td><td>#row_o['typ']#</td><td>#row_o['referenz']#</td> <td>#row_o['name']#</td><td>#row_o['id']#</td>
</tr> </tr>
@endfor@ @endfor@
</table> </table>

Binary file not shown.

View File

@ -0,0 +1,4 @@
curl \
--request GET \
-D- \
http://localhost:8080/templates