From 1dd34a051c34385faed91b9305c4ae04151bde98 Mon Sep 17 00:00:00 2001 From: S-Rey Date: Tue, 15 Aug 2017 17:07:00 +0200 Subject: [PATCH 1/9] Select --- Templates/.assigned.html.swp | Bin 0 -> 12288 bytes Templates/assigned.html | 50 ++++++++++++++++++++--------------- code.py | 19 +++++++++++-- fillDB.py | 10 +++---- 4 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 Templates/.assigned.html.swp diff --git a/Templates/.assigned.html.swp b/Templates/.assigned.html.swp new file mode 100644 index 0000000000000000000000000000000000000000..994718ff4db49ca584adb9e06ecdb19235ba3abb GIT binary patch literal 12288 zcmeI2TZkM*6oxDD5=V0}3PvPgWwM41>`d=wL$XeK2V)XLqDIN)W+W^<)78_J^h~#1 z)jL^(8j#?Nf}n^-eGyy}eGn8MML`r%;_X4i3xWs|@IeJ1Bt-qIx_f3ayF1xv9+Y&$ zx6@s9`qZhvPMw}%yE3?E+ud}eI7o0@OUQ|ZPu;ilrd4Fs3POZckC>-AdLK34?ro6t zJ{&tVHv846&Kgn}W1H_Vwr<;HNG9akW-}PKxsV~R7`s?K@GLYNmJqzwV0O`!^*O{c zr$92JOo2;Hfk--qkws*9&5+*eEAuPp_1Epb)Ktjkn<VnV(L zpMq21Lofx7fk%N4_Je(3FSrw|18czzU>^8u5g~tq-@td^8}K$b0j9vq;05p)I0g=a z-Czvt1lvIg;NPBPJt%@z;AU_mSPbTaFBcN>F?a_&2Oa=p;LJ6IoCe>5&%i6-5ZDU- zxSEikz}MgtFa-jz6D$E|bANWb#oaraA+0bD2;y=r$PP3WsUfd?G%LFQrxSSi2!-8dAAz zwDgi^FX`&1wuGA2ER zp#w#SheD34{$5r{@z^LCkUO*$XyU9y)Q0Fj%=QLRcKLSxVlth(D%a=uVaqAyjn=tn zd&Vv2?ocI&%d8oa3LUfVS+~45-G1u+c1)eoo9NiCwnuN1ZJVhbQMJ>1+ubupBk6IE zi}y}yOG-LNOV8D)d*Vz~ejC;Vui~oh9 z6Hx1sBkdWr%dCkCOu0Rp*QK}646Pv0Nr83L#aU-~Y@eiiyxuy^O#>-XFDH49P_V$d zL*IpEOfGUJZv>H~ax!3}c@b6WT;}P7;po#et=C0WnY#nb#Tz`i zNzFSs#r96s?oxKz)H~C)+yA)&&{TnBkbk%AtL#s~G{=UR^_5@G{ zN(d!jPZd<9pRVXEGge+_oUY!dT5416BU)$D^|2QNUtoJ!Rh84D`LwJjF4BUls&%q2 z)h5RGt$1UaMqGYPL&!<>Z3@4Waz37=j^{T^RwVrmMAvM3M0ZuJ>Y-ZbM-98QvNG&A zm0|RUrG|71RhN5qzi->CskDn~8b_3~&O6vT$6@PmN7~2|Cvw9PaTVt05@v9RDVN0#VNaF`0;!y|pAt&a_m zCpHLq&7Ii-4`A)7Yf)5r4lLW|jarG01cx{1f-Tu$S+G33S6)J`aU=#ndT^B*B^olk zc+MvH)O%F>fD!cD91DI*bnUYK7-d%V_o>7~LxTN9%p__>rrzq*OnS*Gg XOZ(F-7X$I`8)#J{45hxcuO@#37gzDs literal 0 HcmV?d00001 diff --git a/Templates/assigned.html b/Templates/assigned.html index be30027..6ab9e02 100644 --- a/Templates/assigned.html +++ b/Templates/assigned.html @@ -54,34 +54,40 @@ -
diff --git a/code.py b/code.py index f4c310f..66ba640 100644 --- a/code.py +++ b/code.py @@ -197,9 +197,24 @@ def POST(self): class assigned: def GET(self): browsers = db.query('SELECT * FROM browsers;').list() - websites = db.query('SELECT id, jahia, wordpress FROM websites;').list() + websites = db.query('SELECT id, name, jahia, wordpress FROM websites;').list() assigneds = db.query('SELECT * FROM assigned_websites;').list() - return render.assigned(assigneds, names, browsers, websites) + return render.assigned(assigneds, names_orderN, browsers, websites) + + def POST(self): + select_user = web.input(select = None).select_user + select_browser = web.input(select = None).select_browser + select_website = web.input(select = None).select_website + # Teste les valeurs + + db.query(('INSERT INTO assigned_websites VALUES (' + + str(select_user) + ',' + + str(select_browser) + ',' + + str(select_website) + ')')) + browsers = db.query('SELECT * FROM browsers;').list() + websites = db.query('SELECT id, name, jahia, wordpress FROM websites;').list() + assigneds = db.query('SELECT * FROM assigned_websites;').list() + return render.assigned(assigneds, names_orderN, browsers, websites) class stats: def GET(self): diff --git a/fillDB.py b/fillDB.py index e29d7d1..e0e64c5 100644 --- a/fillDB.py +++ b/fillDB.py @@ -31,11 +31,11 @@ users.close() print('Users OK') -#cur.execute('INSERT INTO browsers VALUES (0, "Firefox", "0", "Windows");') -#cur.execute('INSERT INTO browsers VALUES (1, "Firefox", "0", "Linux");') -#cur.execute('INSERT INTO assigned_websites VALUES (NULL, 1, 1);') -#cur.execute('INSERT INTO assigned_websites VALUES (3, 0, 25);') -#con.commit() +cur.execute('INSERT INTO browsers VALUES (0, "Firefox", "0", "Windows");') +cur.execute('INSERT INTO browsers VALUES (1, "Firefox", "0", "Linux");') +cur.execute('INSERT INTO assigned_websites VALUES (NULL, 1, 1);') +cur.execute('INSERT INTO assigned_websites VALUES (3, 0, 25);') +con.commit() con.close() From 37a9cf7ccf333e9f25b76d7cdccb6829bb6383e5 Mon Sep 17 00:00:00 2001 From: S-Rey Date: Wed, 16 Aug 2017 16:22:04 +0200 Subject: [PATCH 2/9] -- --- Templates/.assigned.html.swp | Bin 12288 -> 0 bytes Templates/assigned.html | 20 +++++++++++++++++++- Templates/compare.html | 1 + Templates/index.html | 2 ++ Templates/logs.html | 1 + Templates/stats.html | 1 + code.py | 30 +++++++++++++++++++++--------- fillDB.py | 13 +++++++++---- start.sh | 32 +++++++++++++++----------------- version.py | 2 +- 10 files changed, 70 insertions(+), 32 deletions(-) delete mode 100644 Templates/.assigned.html.swp diff --git a/Templates/.assigned.html.swp b/Templates/.assigned.html.swp deleted file mode 100644 index 994718ff4db49ca584adb9e06ecdb19235ba3abb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2TZkM*6oxDD5=V0}3PvPgWwM41>`d=wL$XeK2V)XLqDIN)W+W^<)78_J^h~#1 z)jL^(8j#?Nf}n^-eGyy}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1f-Tu$S+G33S6)J`aU=#ndT^B*B^olk zc+MvH)O%F>fD!cD91DI*bnUYK7-d%V_o>7~LxTN9%p__>rrzq*OnS*Gg XOZ(F-7X$I`8)#J{45hxcuO@#37gzDs diff --git a/Templates/assigned.html b/Templates/assigned.html index 6ab9e02..4ff0e23 100644 --- a/Templates/assigned.html +++ b/Templates/assigned.html @@ -1,7 +1,8 @@ -$def with (assigneds, names, browsers, sites) +$def with (assigneds, names, browsers, sites, message) Liste des sites + @@ -88,6 +98,12 @@
+
+
+ $if message: +

$message

+
+
@@ -100,6 +116,7 @@ + @@ -118,6 +135,7 @@ +
ID du site Jahia WordpressSuppression
$assigned.website_id $sites[assigned.website_id].jahia $sites[assigned.website_id].wordpress
diff --git a/Templates/compare.html b/Templates/compare.html index 3a978d5..983bc54 100644 --- a/Templates/compare.html +++ b/Templates/compare.html @@ -1,5 +1,6 @@ $def with (names, user_id, status, url1, url2) + Comparateur de pages diff --git a/Templates/index.html b/Templates/index.html index 83c5a67..7ec4e50 100644 --- a/Templates/index.html +++ b/Templates/index.html @@ -1,5 +1,6 @@ $def with (users, version) + Comparateur de pages @@ -71,7 +74,7 @@ @@ -98,9 +101,9 @@
-
+
+ $if message:
- $if message:

$message

@@ -120,23 +123,25 @@ - $for assigned in assigneds: - - + $for assigned in assigneds: + + $if assigned.user_id: $assigned.user_id - $names[assigned.user_id-1].first_name $names[assigned.user_id-1].last_name $else: - Tous + N'importe quel utilisateur - $assigned.browser_id - $browsers[assigned.browser_id].name - $browsers[assigned.browser_id].version - $browsers[assigned.browser_id].os - $assigned.website_id - $sites[assigned.website_id].jahia - $sites[assigned.website_id].wordpress - - + $assigned.browser_id + $browsers[assigned.browser_id].name + $browsers[assigned.browser_id].version + $browsers[assigned.browser_id].os + $assigned.website_id + $sites[assigned.website_id].jahia + $sites[assigned.website_id].wordpress +
+ +
+
diff --git a/code.py b/code.py index b98f794..a4bdbf5 100644 --- a/code.py +++ b/code.py @@ -33,7 +33,8 @@ def debug(string): '/compare', 'compare', '/assigned', 'assigned', '/stats', 'stats', - '/next', 'next' + '/next', 'next', + '/delete', 'delete' ) @@ -277,6 +278,17 @@ def POST(self): assigneds = db.query('SELECT * FROM assigned_websites;').list() return render.assigned(assigneds, names, names_orderN, browsers, websites, message) +class delete: + def POST(self): + values = web.input().keys()[0] + values = values.split(',') + db.delete('assigned_websites', where=('user_id=' + values[0] + + ' AND browser_id=' + values[1] + + ' AND website_id=' + values[2])) + print(values) + print('Hellllllo') + raise web.seeother('/assigned') + class stats: def GET(self): stats = db.query('SELECT * FROM stats').list() diff --git a/create_table.sql b/create_table.sql index 3e1a630..2047f92 100644 --- a/create_table.sql +++ b/create_table.sql @@ -28,10 +28,10 @@ CREATE TABLE "browsers"( UNIQUE("id") ); CREATE TABLE "assigned_websites"( - "user_id" INTEGER, + "user_id" INTEGER NOT NULL, "browser_id" INTEGER NOT NULL, "website_id" INTEGER NOT NULL, - PRIMARY KEY("browser_id", "website_id"), + PRIMARY KEY("user_id", "browser_id", "website_id"), FOREIGN KEY("browser_id") REFERENCES "browsers"("id") FOREIGN KEY("website_id") REFERENCES "websites"("id") ); diff --git a/fillDB.py b/fillDB.py index f864684..8f9a9df 100644 --- a/fillDB.py +++ b/fillDB.py @@ -33,15 +33,15 @@ print('Users OK') # Insere l'utilisateur "Tous" et le browser "Tous" -cur.execute('INSERT INTO users VALUES (0, "Tous", "Tous")') -cur.execute('INSERT INTO browsers VALUES (0, "Tous", "0", "Tous");') +cur.execute('INSERT INTO users VALUES (0, "N\'importe quel utilisateur", "N\'importe quel utilisateur")') +cur.execute('INSERT INTO browsers VALUES (0, "N\'import quel navigateur", "0", "N\'importe quel OS");') cur.execute('INSERT INTO browsers VALUES (1, "Firefox", "0", "Linux");') cur.execute('INSERT INTO browsers VALUES (2, "Firefox", "0", "Windows");') -cur.execute('INSERT INTO assigned_websites VALUES (0, 1, 1);') -#cur.execute('INSERT INTO assigned_websites VALUES (0, 0, 1);') -#cur.execute('INSERT INTO assigned_websites VALUES (1, 0, 1);') -#cur.execute('INSERT INTO assigned_websites VALUES (1, 1, 1);') +cur.execute('INSERT INTO assigned_websites VALUES (0, 1, 4);') +cur.execute('INSERT INTO assigned_websites VALUES (0, 0, 1);') +cur.execute('INSERT INTO assigned_websites VALUES (1, 0, 1);') +cur.execute('INSERT INTO assigned_websites VALUES (1, 1, 1);') con.commit() con.close() From 707b13254f942c62820f92c43e32d936583c5c09 Mon Sep 17 00:00:00 2001 From: streitlua Date: Tue, 22 Aug 2017 14:59:23 +0200 Subject: [PATCH 9/9] =?UTF-8?q?Correction=20de=20faute=20d'ortographe=20et?= =?UTF-8?q?=20du=20bug=20qui=20ne=20permettait=20pas=20d'ajouter=20n'impor?= =?UTF-8?q?te=20quel=20utilisateur=20=C3=A0=20assigned?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Templates/assigned.html | 2 +- fillDB.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/assigned.html b/Templates/assigned.html index 17cb1e1..697afa3 100644 --- a/Templates/assigned.html +++ b/Templates/assigned.html @@ -74,7 +74,7 @@ diff --git a/fillDB.py b/fillDB.py index 8f9a9df..675bd5c 100644 --- a/fillDB.py +++ b/fillDB.py @@ -34,7 +34,7 @@ # Insere l'utilisateur "Tous" et le browser "Tous" cur.execute('INSERT INTO users VALUES (0, "N\'importe quel utilisateur", "N\'importe quel utilisateur")') -cur.execute('INSERT INTO browsers VALUES (0, "N\'import quel navigateur", "0", "N\'importe quel OS");') +cur.execute('INSERT INTO browsers VALUES (0, "N\'importe quel navigateur", "0", "N\'importe quel OS");') cur.execute('INSERT INTO browsers VALUES (1, "Firefox", "0", "Linux");') cur.execute('INSERT INTO browsers VALUES (2, "Firefox", "0", "Windows");')