Praktikum1_Kai
This commit is contained in:
parent
c9f3117da1
commit
a3450f2675
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
{ }
|
@ -1,14 +0,0 @@
|
||||
<input type="hidden" value="$id_s" id="id_s" name="id_s" />
|
||||
<div>
|
||||
<label for="name1_s">1. Name</label>
|
||||
<input type="text" value="$name1_s" id="name1_s" name="name1_s" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="vorname1_s">1. Vorname</label>
|
||||
<input type="text" value="$vorname1_s" id="vorname1_s" name="vorname1_s" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="matrnr1_s">1. Matrikelnummer</label>
|
||||
<input type="text" value="$matrnr1_s" id="matrnr1_s" name="matrnr1_s" required />
|
||||
</div>
|
||||
<!-- Ihre Ergänzung -->
|
@ -1,6 +0,0 @@
|
||||
<div>
|
||||
<input type="submit" value="Speichern" /><!-- Ihre Ergänzung -->
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -1,5 +0,0 @@
|
||||
<tr> <!-- HIER müssen Sie eine Ergänzung vornehmen -->
|
||||
<td>$name1_s</td><td>$vorname1_s</td><td>$matrnr1_s</td>
|
||||
<td>$name2_s</td><td>$vorname2_s</td><td>$matrnr2_s</td>
|
||||
<td><a href="/edit/$id_s">bearbeiten</a> <a href="/delete/$id_s">löschen</a></td>
|
||||
</tr>
|
@ -1,7 +0,0 @@
|
||||
<!-- Sie müssen Ergänzungen vornehmen -->
|
||||
<li>Gruppe $nr: <a href="/edit/$id_s">bearbeiten</a> <a href="/delete/$id_s">löschen</a>
|
||||
<ul>
|
||||
<li>$name1_s, $vorname1_s, $matrnr1_s</li>
|
||||
<li>$name2_s, $vorname2_s, $matrnr2_s</li>
|
||||
</ul>
|
||||
</li>
|
Binary file not shown.
BIN
Praktikum1_Kai/webteams/app/__pycache__/database.cpython-35.pyc
Normal file
BIN
Praktikum1_Kai/webteams/app/__pycache__/database.cpython-35.pyc
Normal file
Binary file not shown.
BIN
Praktikum1_Kai/webteams/app/__pycache__/view.cpython-35.pyc
Normal file
BIN
Praktikum1_Kai/webteams/app/__pycache__/view.cpython-35.pyc
Normal file
Binary file not shown.
@ -14,12 +14,18 @@ class Application_cl(object):
|
||||
# spezielle Initialisierung können hier eingetragen werden
|
||||
self.db_o = Database_cl()
|
||||
self.view_o = View_cl()
|
||||
self.liste = 0
|
||||
@cherrypy.expose
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def index(self):
|
||||
def index(self, form="NULL"):
|
||||
#-------------------------------------------------------
|
||||
if(form == "0"):
|
||||
return self.createListAufz_p()
|
||||
elif(form == "1"):
|
||||
return self.createList_p()
|
||||
elif(form == "NULL"):
|
||||
return self.createList_p()
|
||||
@cherrypy.expose
|
||||
|
||||
@ -50,9 +56,11 @@ class Application_cl(object):
|
||||
data_a = [ data_opl["name1_s"]
|
||||
, data_opl["vorname1_s"]
|
||||
, data_opl["matrnr1_s"]
|
||||
, data_opl["semesteranzahl1_s"]
|
||||
, data_opl["name2_s"]
|
||||
, data_opl["vorname2_s"]
|
||||
, data_opl["matrnr2_s"]
|
||||
, data_opl["semesteranzahl2_s"]
|
||||
]
|
||||
|
||||
if id_s != "None":
|
||||
@ -72,7 +80,7 @@ class Application_cl(object):
|
||||
# Eintrag löschen, dann Liste neu anzeigen
|
||||
self.db_o.delete_px(id)
|
||||
|
||||
return self.createList_p()
|
||||
return self.createListAufz_p()
|
||||
@cherrypy.expose
|
||||
|
||||
|
||||
@ -90,12 +98,23 @@ class Application_cl(object):
|
||||
#-------------------------------------------------------
|
||||
def createList_p(self):
|
||||
#-------------------------------------------------------
|
||||
print("---------- List ----------")
|
||||
data_o = self.db_o.read_px()
|
||||
# mit diesen Daten Markup erzeugen
|
||||
|
||||
return self.view_o.createList_px(data_o)
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def createListAufz_p(self):
|
||||
#-------------------------------------------------------
|
||||
print("---------- ListAufz ----------")
|
||||
data_o = self.db_o.read_px()
|
||||
# mit diesen Daten Markup erzeugen
|
||||
|
||||
return self.view_o.createListAufz_px(data_o)
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def createForm_p(self, id_spl = None):
|
||||
#-------------------------------------------------------
|
@ -73,12 +73,17 @@ class Database_cl(object):
|
||||
#-------------------------------------------------------
|
||||
def delete_px(self, id_spl):
|
||||
#-------------------------------------------------------
|
||||
#print("\n---------------------- DELETE ---------------------")
|
||||
status_b = False
|
||||
if id_spl in self.data_o:
|
||||
pass
|
||||
# hier müssen Sie den Code ergänzen
|
||||
# Löschen als Zurücksetzen auf die Default-Werte implementieren
|
||||
# Ihre Ergänzung
|
||||
self.data_o[id_spl] = {}
|
||||
default_s = self.getDefault_px()
|
||||
self.data_o[id_spl] = default_s
|
||||
self.saveData_p()
|
||||
|
||||
return status_b
|
||||
|
||||
@ -86,7 +91,7 @@ class Database_cl(object):
|
||||
#-------------------------------------------------------
|
||||
def getDefault_px(self):
|
||||
#-------------------------------------------------------
|
||||
return ['', '', '', '', '', ''] # HIER müssen Sie eine Ergänzung vornehmen
|
||||
return ['', '', '', '', '', '', '', ''] # HIER müssen Sie eine Ergänzung vornehmen
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
@ -96,8 +101,9 @@ class Database_cl(object):
|
||||
fp_o = codecs.open(os.path.join('data', 'webteams.json'), 'r', 'utf-8')
|
||||
except:
|
||||
# Datei neu anlegen self.data_o = {}
|
||||
self.data_o = {}
|
||||
for loop_i in range(0,15):
|
||||
self.data_o[str(loop_i)] = ['', '', '', '', '', ''] # HIER müssen Sie eine Ergänzung vornehmen
|
||||
self.data_o[str(loop_i)] = ['', '', '', '', '', '', '', '']
|
||||
self.saveData_p()
|
||||
else:
|
||||
with fp_o:
|
@ -35,12 +35,14 @@ class View_cl(object):
|
||||
# mehrfach nutzen, um die einzelnen Zeilen der Tabelle zu erzeugen
|
||||
for loop_i in range(0,15):
|
||||
data_a = data_opl[str(loop_i)]
|
||||
markup_s += lineT_o.safe_substitute (name1_s=data_a[0] # HIER müssen Sie eine Ergänzung vornehmen
|
||||
markup_s += lineT_o.safe_substitute (name1_s=data_a[0]
|
||||
, vorname1_s=data_a[1]
|
||||
, matrnr1_s=data_a[2]
|
||||
, name2_s=data_a[3]
|
||||
, vorname2_s=data_a[4]
|
||||
, matrnr2_s=data_a[5]
|
||||
, semesteranzahl1_s=data_a[3]
|
||||
, name2_s=data_a[4]
|
||||
, vorname2_s=data_a[5]
|
||||
, matrnr2_s=data_a[6]
|
||||
, semesteranzahl2_s=data_a[7]
|
||||
, id_s=str(loop_i)
|
||||
)
|
||||
|
||||
@ -48,6 +50,33 @@ class View_cl(object):
|
||||
|
||||
return markup_s
|
||||
|
||||
#-------------------------------------------------------
|
||||
def createListAufz_px(self, data_opl):
|
||||
#-------------------------------------------------------
|
||||
# hier müsste noch eine Fehlerbehandlung ergänzt werden !
|
||||
markup_s = ''
|
||||
markup_s += self.readFile_p('listaufz0.tpl')
|
||||
markupV_s = self.readFile_p('listaufz1.tpl')
|
||||
lineT_o = string.Template(markupV_s)
|
||||
|
||||
# mehrfach nutzen, um die einzelnen Zeilen der Tabelle zu erzeugen
|
||||
for loop_i in range(0,15):
|
||||
data_a = data_opl[str(loop_i)]
|
||||
markup_s += lineT_o.safe_substitute (name1_s=data_a[0]
|
||||
, vorname1_s=data_a[1]
|
||||
, matrnr1_s=data_a[2]
|
||||
, semesteranzahl1_s=data_a[3]
|
||||
, name2_s=data_a[4]
|
||||
, vorname2_s=data_a[5]
|
||||
, matrnr2_s=data_a[6]
|
||||
, semesteranzahl2_s=data_a[7]
|
||||
, id_s=str(loop_i)
|
||||
)
|
||||
|
||||
markup_s += self.readFile_p('listaufz2.tpl')
|
||||
|
||||
return markup_s
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
def createForm_px(self, id_spl, data_opl):
|
||||
@ -57,12 +86,14 @@ class View_cl(object):
|
||||
markup_s += self.readFile_p('form0.tpl')
|
||||
markupV_s = self.readFile_p('form1.tpl')
|
||||
lineT_o = string.Template(markupV_s)
|
||||
markup_s += lineT_o.safe_substitute (name1_s=data_opl[0] # HIER müssen Sie eine Ergänzung vornehmen
|
||||
markup_s += lineT_o.safe_substitute (name1_s=data_opl[0]
|
||||
, vorname1_s=data_opl[1]
|
||||
, matrnr1_s=data_opl[2]
|
||||
, name2_s=data_opl[3]
|
||||
, vorname2_s=data_opl[4]
|
||||
, matrnr2_s=data_opl[5]
|
||||
, semesteranzahl1_s=data_opl[3]
|
||||
, name2_s=data_opl[4]
|
||||
, vorname2_s=data_opl[5]
|
||||
, matrnr2_s=data_opl[6]
|
||||
, semesteranzahl2_s=data_opl[7]
|
||||
, id_s=id_spl
|
||||
)
|
||||
markup_s += self.readFile_p('form2.tpl')
|
72
Praktikum1_Kai/webteams/content/webteams.css
Normal file
72
Praktikum1_Kai/webteams/content/webteams.css
Normal file
@ -0,0 +1,72 @@
|
||||
body {
|
||||
font-family: "Open Sans", sans-serif;
|
||||
font-size: 12pt;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
th {
|
||||
height: 50px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
li {
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 30px;
|
||||
list-style-type: square;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
label {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 200px;
|
||||
border: none;
|
||||
border-bottom: 2px solid black;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
input.button {
|
||||
background-color: #eeeeee;
|
||||
color: black;
|
||||
padding: 5px 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
border: none;
|
||||
}
|
||||
|
||||
input.button:hover, input.button:active {
|
||||
background-color: #e7e7e7;
|
||||
}
|
||||
|
||||
idWTForm {
|
||||
}
|
||||
|
||||
|
||||
|
||||
a:link, a:visited {
|
||||
background-color: #eeeeee;
|
||||
color: black;
|
||||
padding: 5px 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
a:hover, a:active {
|
||||
background-color: #e7e7e7;
|
||||
}
|
||||
|
||||
a.clDelete {
|
||||
}
|
||||
|
@ -2,6 +2,15 @@ function confirmDelete_p (event_opl) {
|
||||
if ((event_opl.target.tagName.toLowerCase() == 'a') && (event_opl.target.className == "clDelete")) {
|
||||
// Klick auf Link zum Löschen
|
||||
// Ihre Ergänzung
|
||||
var result = confirm("Sind Sie sicher, dass der Eintrag gelöscht werden soll?");
|
||||
if(result)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
Praktikum1_Kai/webteams/data/webteams.json
Normal file
1
Praktikum1_Kai/webteams/data/webteams.json
Normal file
@ -0,0 +1 @@
|
||||
{"13": ["", "", "", "", "", "", "", ""], "12": ["", "", "", "", "", "", "", ""], "2": ["", "", "", "", "", "", "", ""], "7": ["", "", "", "", "", "", "", ""], "6": ["", "", "", "", "", "", "", ""], "0": ["", "", "", "", "", "", "", ""], "3": ["", "", "", "", "", "", "", ""], "5": ["", "", "", "", "", "", "", ""], "8": ["", "", "", "", "", "", "", ""], "11": ["", "", "", "", "", "", "", ""], "9": ["", "", "", "", "", "", "", ""], "10": ["", "", "", "", "", "", "", ""], "4": ["", "", "", "", "", "", "", ""], "1": ["", "", "", "", "", "", "", ""], "14": ["", "", "", "", "", "", "", ""]}
|
37
Praktikum1_Kai/webteams/template/form1.tpl
Normal file
37
Praktikum1_Kai/webteams/template/form1.tpl
Normal file
@ -0,0 +1,37 @@
|
||||
<input type="hidden" value="$id_s" id="id_s" name="id_s" />
|
||||
|
||||
<!-- Mitglied 1 -->
|
||||
<div>
|
||||
<label for="name1_s">1. Name</label>
|
||||
<input type="text" value="$name1_s" id="name1_s" name="name1_s" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="vorname1_s">1. Vorname</label>
|
||||
<input type="text" value="$vorname1_s" id="vorname1_s" name="vorname1_s" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="matrnr1_s">1. Matrikelnummer</label>
|
||||
<input type="text" value="$matrnr1_s" id="matrnr1_s" name="matrnr1_s" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="semesteranzahl1_s">1. Anzahl Semester</label>
|
||||
<input type="text" value="$semesteranzahl1_s" id="semesteranzahl1_s" name="semesteranzahl1_s" required />
|
||||
</div>
|
||||
|
||||
<!-- Mitglied 2 -->
|
||||
<div>
|
||||
<label for="name2_s">2. Name</label>
|
||||
<input type="text" value="$name2_s" id="name2_s" name="name2_s" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="vorname2_s">2. Vorname</label>
|
||||
<input type="text" value="$vorname2_s" id="vorname2_s" name="vorname2_s" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="matrnr2_s">2. Matrikelnummer</label>
|
||||
<input type="text" value="$matrnr2_s" id="matrnr2_s" name="matrnr2_s" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="semesteranzahl2_s">2. Anzahl Semester</label>
|
||||
<input type="text" value="$semesteranzahl2_s" id="semesteranzahl2_s" name="semesteranzahl2_s" required />
|
||||
</div>
|
12
Praktikum1_Kai/webteams/template/form2.tpl
Normal file
12
Praktikum1_Kai/webteams/template/form2.tpl
Normal file
@ -0,0 +1,12 @@
|
||||
<div>
|
||||
<input class="button" type="submit" value="Speichern" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form id="idWTForm" action="/index" method="POST">
|
||||
<div>
|
||||
<input class="button" type="submit" value="Abbrechen" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -9,9 +9,9 @@
|
||||
<script type="text/javascript" src="/webteams.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<table> <!-- HIER müssen Sie eine Ergänzung vornehmen -->
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name (1)</th><th>Vorname (1)</th><th>Matr.-Nr. (1)</th>
|
||||
<th>Name (2)</th><th>Vorname (2)</th><th>Matr.-Nr. (2)</th>
|
||||
<th>Name (1)</th><th>Vorname (1)</th><th>Matr.-Nr. (1)</th><th>Anzahl Semester (1)</th>
|
||||
<th>Name (2)</th><th>Vorname (2)</th><th>Matr.-Nr. (2)</th><th>Anzahl Semester (2)</th>
|
||||
<th>Aktion</th>
|
||||
</tr>
|
5
Praktikum1_Kai/webteams/template/list1.tpl
Normal file
5
Praktikum1_Kai/webteams/template/list1.tpl
Normal file
@ -0,0 +1,5 @@
|
||||
<tr> <!-- HIER müssen Sie eine Ergänzung vornehmen -->
|
||||
<td>$name1_s</td><td>$vorname1_s</td><td>$matrnr1_s</td><td>$semesteranzahl1_s</td>
|
||||
<td>$name2_s</td><td>$vorname2_s</td><td>$matrnr2_s</td><td>$semesteranzahl2_s</td>
|
||||
<td><a href="/edit/$id_s">bearbeiten</a> <a class="clDelete" href="/delete/$id_s">löschen</a></td>
|
||||
</tr>
|
@ -1,6 +1,7 @@
|
||||
</table>
|
||||
<div>
|
||||
<a href="/add">erfassen</a>
|
||||
<a href="/?form=0">Ansicht</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
7
Praktikum1_Kai/webteams/template/listaufz1.tpl
Normal file
7
Praktikum1_Kai/webteams/template/listaufz1.tpl
Normal file
@ -0,0 +1,7 @@
|
||||
<!-- Sie müssen Ergänzungen vornehmen -->
|
||||
<li>Gruppe $id_s: <a href="/edit/$id_s">bearbeiten</a> <a class="clDelete" href="/delete/$id_s">löschen</a>
|
||||
<ul>
|
||||
<li>$name1_s, $vorname1_s, $matrnr1_s, $semesteranzahl1_s</li>
|
||||
<li>$name2_s, $vorname2_s, $matrnr2_s, $semesteranzahl2_s</li>
|
||||
</ul>
|
||||
</li>
|
@ -1,6 +1,7 @@
|
||||
</ul>
|
||||
<div>
|
||||
<a href="/add">erfassen</a>
|
||||
<a href="/?form=1">Ansicht</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user