From 11752ff01a8791954852a02e0e2e0926436b070e Mon Sep 17 00:00:00 2001
From: Renaud Le Gac <renaud.legac@free.fr>
Date: Fri, 10 Dec 2010 20:03:56 +0000
Subject: [PATCH] refactorize the column publication.

---
 models/db_widgets.py | 76 ++++++++++++++------------------------------
 1 file changed, 23 insertions(+), 53 deletions(-)

diff --git a/models/db_widgets.py b/models/db_widgets.py
index 763bcd41..4be76325 100644
--- a/models/db_widgets.py
+++ b/models/db_widgets.py
@@ -122,6 +122,19 @@ tpl = ['{PublicationsTitle}<br>',
 	   	   '<tpl if="PublicationsLast_page">-{PublicationsLast_page}</tpl>',
 	   '</tpl>',
 	   '<tpl if="PublicationsE_print"><br>{PublicationsE_print}</tpl>',
+	   '<tpl if="PublicationsConference_title"><br><br>{PublicationsConference_title}',
+	   		'<tpl if="PublicationsConference_town"><br>{PublicationsConference_town}</tpl>',
+	   		'<tpl if="CountriesCountry">, {CountriesCountry}</tpl>',
+	   		'<tpl if="PublicationsConference_start">, {PublicationsConference_start}</tpl>',
+	   		'<tpl if="PublicationsConference_end"> - {PublicationsConference_end}</tpl>',
+	   		'<tpl if="PublicationsConference_url"><br>{PublicationsConference_url}</tpl>',
+	   		'<br>%s: {PublicationsConference_speaker}' % T('Speaker'),
+	   '</tpl>',
+	   '<tpl if="PublicationsReport_numbers"><br><br>',
+	   		'<tpl if="PublicationsId_reports &gt; 1">{ReportsType}, </tpl>',
+	   		'{PublicationsReport_numbers}',
+	   '</tpl>',
+	   '<br>Auteurs CPPM : {PublicationsAuthors_cppm}'
 	   ]
 
 hidden = ['title', 
@@ -130,64 +143,21 @@ hidden = ['title',
 		  'id_publishers',
 		  'doi', 
 		  'volume',
-#		  'year', 
 		  'first_page',
 		  'last_page',
-		  'e_print']
-
-pgm.customize_grid_with_template_column('publications', T('Publication'), tpl, 
-									                                   	  1, 
-									                                   	  hidden,
-									                                      width=350)
-
-# add a template column handling the conference information
-tpl = ['<tpl if="PublicationsConference_title">{PublicationsConference_title}',
-	       '<tpl if="PublicationsConference_town"><br>{PublicationsConference_town}',
-	       '<tpl if="CountriesCountry">, {CountriesCountry}</tpl>',
-	   	   '<tpl if="PublicationsConference_start"><br>{PublicationsConference_start}</tpl>',
-	   	   '<tpl if="PublicationsConference_end"> - {PublicationsConference_end}</tpl>',
-	       '<tpl if="PublicationsConference_url"><br>{PublicationsConference_url}</tpl>',
-	   	   '<br>%s: {PublicationsConference_speaker}' % T('Speaker'),
-	   '</tpl>']
-
-hidden = ['conference_title',
+		  'e_print',
+		  'conference_title',
 		  'conference_url',
 		  'conference_start',
 		  'conference_end',
 		  'conference_town',
 		  'id_countries',
-		  'conference_speaker']
-
-pgm.customize_grid_with_template_column('publications', T('Conference'), tpl, 
-									                                  	  2, 
-									                                  	  hidden,
-									                                  	  width=350)
-
-# add a template column handling the report information
-tpl = ['<tpl if="PublicationsReport_numbers">{PublicationsReport_numbers}',
-	       '<tpl if="PublicationsId_reports &gt; 1"><br>{ReportsType}',
-	   '</tpl>']
+		  'conference_speaker',
+		  'report_numbers',
+		  'id_reports',
+		  'authors_cppm']
 
-hidden = ['report_numbers', 'id_reports']
-
-pgm.customize_grid_with_template_column('publications', T('Report'), tpl, 
-									                                 3, 
-									                                 hidden,
-									                                 width=300)
-
-# add a template column handling CPPM information
-tpl = ['{PublicationsAuthors_cppm}',
-	   '<tpl if="PublicationsId_teams &gt; 1"><br>%s : {TeamsTeam}</tpl>' % T('Team'),
-	   '<tpl if="PublicationsId_projects &gt; 1"><br>%s : {ProjectsProject}</tpl>' % T('Project'),
-	   '<tpl if="PublicationsId_categories_aeres &gt; 1"><br>AERES : {Categories_aeresCode}</tpl>']
-
-hidden = ['authors_cppm', 
-		  'id_teams',
-		  'id_projects',
-		  'id_categories_aeres']
-
-pgm.customize_grid_with_template_column('publications', 'CPPM', 
-														tpl,
-														4,
-														hidden, 
-														width=200)
+pgm.customize_grid_with_template_column('publications', T('Publication'), tpl, 
+									                                   	  1, 
+									                                   	  hidden,
+									                                      width=700)
-- 
GitLab