From 8e8e2a9ca993a1a645bd3d57f3cdc0b4b745a6ea Mon Sep 17 00:00:00 2001 From: CyrilM <mammar@lal.in2p3.fr> Date: Thu, 20 Sep 2018 18:07:18 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20table=20'labels=5Flanguages'?= =?UTF-8?q?=20=C3=A0=20la=20DB.=20Le=20changement=20de=20langue=20est=20ok?= =?UTF-8?q?=20mais=20y=20faut=20juste=20rajouter=20un=20bouton=20pour=20ch?= =?UTF-8?q?anger=20de=20langue=20et=20modifier=20la=20fc=20init=5Fnew=5Fla?= =?UTF-8?q?bels=5Ftab().=20Voir=20le=20commentaire=20sous=20celle-ci.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/bdd_for_labels.db | Bin 38912 -> 38912 bytes app/createBdd.sql | 9 ++++++++- app/labelsTower.py | 2 ++ app/templates/browse.html | 8 ++++++-- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/bdd_for_labels.db b/app/bdd_for_labels.db index 9397a924f44d0336cb7b5912f1e72b0fa63cdb72..e29a40a1c527b5fca76f27c2ef37467fd6714a7e 100644 GIT binary patch delta 1581 zcmZXTO>7%Q6vuaF+{7PAY{zc=6~~*niR~snRHbT=_)wa9oUevxHj5OY5;pF{Sz_;& z^%|N(<rom<2Ehl!h4LW*xh0J_Pzedhv2a1<)<_@$hYFP&R0s*4XB*T8X;=Ec-+S|B z=FNMXJ9u*kznuu0k|d45-vz%5{`A(^X=LucaGfCE4cC<p#P>G5*MjdvT{CGkE|I(B zHu;9^l26FH<V{i|&l5^=WPk+lU-)PIJ^l*s;1BRM{4!SYV>pGq=r{Box`{qT@1fUF z6+MTFXnd=Ax6z$;p<rxORi0U0)l0m02+Z^-W#{S^*Xp+ZQk@3|UC2LpQk|`@aLeE} zuZ3lZ%H&{?Ra)aU+tO^^G{PxCDSL!=4Z!MHRy}W)*0~i-Ld;-BRVGct)^wx6ty-{O zFv{AD8@z7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UF&hvoP1G@FOy8I=pP7+k6H5gfW8&sYu6Du20uxxI zc$t(KSQzdwFvl`;GcE)&?l7)p_`@L2AV0CuaI&{T+QbRko9`%iGBUoL*!XlaxAGqj zM%K+7IzOZrGfrTc<ifU@&F8nYBoiA0JA*m{<84M)Mk%Im%!?S*nf5X;FfUpxmBBc9 Zqk_(4Z>0k)Oz#-BPi)-0d2g1pE&wPbF+l(T diff --git a/app/createBdd.sql b/app/createBdd.sql index 4b803b3..976227c 100644 --- a/app/createBdd.sql +++ b/app/createBdd.sql @@ -15,6 +15,13 @@ CREATE TABLE IF NOT EXISTS labels ( father_id UNISGNED MEDIUM INT DEFAULT NULL ); +CREATE TABLE IF NOT EXISTS labels_languages ( + id_label INTEGER, + country_code VARCHAR(3), + name VARCHAR(100), + CONSTRAINT pk_labels_languages PRIMARY KEY(id_label, country_code) +); + CREATE TABLE IF NOT EXISTS tutos_labels ( link VARCHAR(200) NOT NULL, id_label UNSIGNED MEDIUM INT, @@ -41,4 +48,4 @@ CREATE TABLE IF NOT EXISTS comments ( author_mail VARCHAR(100), date DATETIME DEFAULT CURRENT_TIMESTAMP, CONSTRAINT pk_comments PRIMARY KEY (message, author_mail, date) -); +); \ No newline at end of file diff --git a/app/labelsTower.py b/app/labelsTower.py index e5fe70e..1e202a1 100644 --- a/app/labelsTower.py +++ b/app/labelsTower.py @@ -29,6 +29,8 @@ def get_datas(name, id): ''' if (name == 'labels'): return (jsonify(send_sql_request('SELECT * FROM labels'))) + if (name == 'all_labels'): + return (jsonify(send_sql_request("SELECT id_label, labels_languages.name, father_id FROM labels_languages INNER JOIN labels ON labels.id = labels_languages.id_label WHERE labels_languages.country_code IN ('"+id+"', 'U')"))) elif (name == 'main_labels'): return (jsonify(send_sql_request('SELECT * FROM labels WHERE father_id IS NULL'))) elif (name == 'alias'): diff --git a/app/templates/browse.html b/app/templates/browse.html index d6e06ec..fa5b017 100644 --- a/app/templates/browse.html +++ b/app/templates/browse.html @@ -109,17 +109,20 @@ * If one of them is selected. It pass in old_tab. */ all_labels : [], + fathers_labels: [], old_labels_tab: [], new_labels_tab: [], unselect_tab: [], - url: "static/unchecked_swimming.small.png" + url: "static/unchecked_swimming.small.png", + language: "US" }, methods: { init_all_labels: function() { /** * Get all 'labels' table [id, name, father_id] */ - this.all_labels = JSON.parse(request_ajax("labels")); + this.fathers_labels = JSON.parse(request_ajax("labels")); + this.all_labels = JSON.parse(request_ajax("all_labels/"+this.language)); }, init_new_labels_tab: function() { /** @@ -127,6 +130,7 @@ * that don't have a father. */ this.new_labels_tab = JSON.parse(request_ajax("main_labels")); + //faire une fonction qui recup juste les null de all_labels }, reset : function() { /** -- GitLab