diff --git a/Praktikum1_Kai/webteams/app/__pycache__/application.cpython-35.pyc b/Praktikum1_Kai/webteams/app/__pycache__/application.cpython-35.pyc index cc5e836..a1f3f56 100644 Binary files a/Praktikum1_Kai/webteams/app/__pycache__/application.cpython-35.pyc and b/Praktikum1_Kai/webteams/app/__pycache__/application.cpython-35.pyc differ diff --git a/Praktikum1_Kai/webteams/app/__pycache__/view.cpython-35.pyc b/Praktikum1_Kai/webteams/app/__pycache__/view.cpython-35.pyc index 8d7cbb7..4407e6d 100644 Binary files a/Praktikum1_Kai/webteams/app/__pycache__/view.cpython-35.pyc and b/Praktikum1_Kai/webteams/app/__pycache__/view.cpython-35.pyc differ diff --git a/Praktikum1_Kai/webteams/app/application.py b/Praktikum1_Kai/webteams/app/application.py index c303add..7c5aa0e 100644 --- a/Praktikum1_Kai/webteams/app/application.py +++ b/Praktikum1_Kai/webteams/app/application.py @@ -19,28 +19,33 @@ class Application_cl(object): #------------------------------------------------------- - def index(self, form="NULL"): + def index(self, form=None): #------------------------------------------------------- if(form == "0"): - return self.createListAufz_p() + return self.createList_p(form) elif(form == "1"): - return self.createList_p() - elif(form == "NULL"): - return self.createList_p() + return self.createList_p(form) + elif(form == None): + if (self.liste == 0): + self.liste = 1; + return self.createList_p("0") + else: + return self.createList_p("1") @cherrypy.expose #------------------------------------------------------- - def add(self): + def add(self, form=None): #------------------------------------------------------- - return self.createForm_p() + + return self.createForm_p(form) @cherrypy.expose #------------------------------------------------------- - def edit(self, id): + def edit(self, id, form=None): #------------------------------------------------------- - return self.createForm_p(id) + return self.createForm_p(form, id) @cherrypy.expose @@ -75,12 +80,12 @@ class Application_cl(object): #------------------------------------------------------- - def delete(self, id): + def delete(self, id, form=None): #------------------------------------------------------- # Eintrag löschen, dann Liste neu anzeigen - self.db_o.delete_px(id) - - return self.createListAufz_p() + self.db_o.delete_px(id) + print("Delete",form) + return self.createList_p(form) @cherrypy.expose @@ -96,27 +101,17 @@ class Application_cl(object): #------------------------------------------------------- - def createList_p(self): + def createList_p(self, form): #------------------------------------------------------- - print("---------- List ----------") data_o = self.db_o.read_px() # mit diesen Daten Markup erzeugen + print("List: ", form) - return self.view_o.createList_px(data_o) + return self.view_o.createList_px(data_o, form) #------------------------------------------------------- - 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): + def createForm_p(self, form, id_spl = None): #------------------------------------------------------- if id_spl != None: data_o = self.db_o.read_px(id_spl) @@ -124,7 +119,7 @@ class Application_cl(object): data_o = self.db_o.getDefault_px() # mit diesen Daten Markup erzeugen - return self.view_o.createForm_px(id_spl, data_o) + return self.view_o.createForm_px(id_spl, data_o, form) # EOF \ No newline at end of file diff --git a/Praktikum1_Kai/webteams/app/view.py b/Praktikum1_Kai/webteams/app/view.py index 13e58db..021c43e 100644 --- a/Praktikum1_Kai/webteams/app/view.py +++ b/Praktikum1_Kai/webteams/app/view.py @@ -24,67 +24,63 @@ class View_cl(object): #------------------------------------------------------- - def createList_px(self, data_opl): + def createList_px(self, data_opl, form=None): #------------------------------------------------------- # hier müsste noch eine Fehlerbehandlung ergänzt werden ! + print("CreateList: ", form) markup_s = '' - markup_s += self.readFile_p('list0.tpl') - markupV_s = self.readFile_p('list1.tpl') - lineT_o = string.Template(markupV_s) + if (form == "0" or form == None): + markup_s += self.readFile_p('list0.tpl') + markupV_s = self.readFile_p('list1.tpl') + lineT_o = string.Template(markupV_s) + 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('list2.tpl') + return markup_s + + elif(form == "1"): + 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) - ) + # 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 - markup_s += self.readFile_p('list2.tpl') - - 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): + def createForm_px(self, id_spl, data_opl, form): #------------------------------------------------------- # hier müsste noch eine Fehlerbehandlung ergänzt werden ! markup_s = '' markup_s += self.readFile_p('form0.tpl') markupV_s = self.readFile_p('form1.tpl') + markupV_s += self.readFile_p('form2.tpl') lineT_o = string.Template(markupV_s) markup_s += lineT_o.safe_substitute (name1_s=data_opl[0] , vorname1_s=data_opl[1] @@ -95,8 +91,9 @@ class View_cl(object): , matrnr2_s=data_opl[6] , semesteranzahl2_s=data_opl[7] , id_s=id_spl + , form_s=form ) - markup_s += self.readFile_p('form2.tpl') + return markup_s diff --git a/Praktikum1_Kai/webteams/content/webteams.js b/Praktikum1_Kai/webteams/content/webteams.js index 2ae20fe..e25424c 100644 --- a/Praktikum1_Kai/webteams/content/webteams.js +++ b/Praktikum1_Kai/webteams/content/webteams.js @@ -9,6 +9,7 @@ function confirmDelete_p (event_opl) { } else { + event_opl.preventDefault(); return false; } } diff --git a/Praktikum1_Kai/webteams/data/webteams.json b/Praktikum1_Kai/webteams/data/webteams.json index 1c9b79e..a039017 100644 --- a/Praktikum1_Kai/webteams/data/webteams.json +++ b/Praktikum1_Kai/webteams/data/webteams.json @@ -1 +1 @@ -{"13": ["", "", "", "", "", "", "", ""], "12": ["", "", "", "", "", "", "", ""], "2": ["", "", "", "", "", "", "", ""], "7": ["", "", "", "", "", "", "", ""], "6": ["", "", "", "", "", "", "", ""], "0": ["", "", "", "", "", "", "", ""], "3": ["", "", "", "", "", "", "", ""], "5": ["", "", "", "", "", "", "", ""], "8": ["", "", "", "", "", "", "", ""], "11": ["", "", "", "", "", "", "", ""], "9": ["", "", "", "", "", "", "", ""], "10": ["", "", "", "", "", "", "", ""], "4": ["", "", "", "", "", "", "", ""], "1": ["", "", "", "", "", "", "", ""], "14": ["", "", "", "", "", "", "", ""]} \ No newline at end of file +{"9": ["", "", "", "", "", "", "", ""], "3": ["", "", "", "", "", "", "", ""], "11": ["", "", "", "", "", "", "", ""], "13": ["", "", "", "", "", "", "", ""], "2": ["", "", "", "", "", "", "", ""], "14": ["", "", "", "", "", "", "", ""], "10": ["", "", "", "", "", "", "", ""], "4": ["", "", "", "", "", "", "", ""], "8": ["", "", "", "", "", "", "", ""], "12": ["", "", "", "", "", "", "", ""], "0": ["", "", "", "", "", "", "", ""], "7": ["", "", "", "", "", "", "", ""], "6": ["", "", "", "", "", "", "", ""], "5": ["", "", "", "", "", "", "", ""], "1": ["", "", "", "", "", "", "", ""]} \ No newline at end of file diff --git a/Praktikum1_Kai/webteams/doc/Dokumentation- WEB Praktikum 1.html b/Praktikum1_Kai/webteams/doc/Dokumentation- WEB Praktikum 1.html new file mode 100644 index 0000000..e65448a --- /dev/null +++ b/Praktikum1_Kai/webteams/doc/Dokumentation- WEB Praktikum 1.html @@ -0,0 +1,418 @@ + + + +
+ + +