From cfc4a53504c3bf2358921d8e31d037ffc3f72818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 20 Sep 2017 14:06:24 +0200 Subject: [PATCH] Version 17.3.11 --- swad_changelog.h | 3 +- swad_project.c | 117 ++++++++++++++++++----------------------------- 2 files changed, 46 insertions(+), 74 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 161ce8ff9..d79731c60 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -252,13 +252,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 17.3.10 (2017-09-19)" +#define Log_PLATFORM_VERSION "SWAD 17.3.11 (2017-09-20)" #define CSS_FILE "swad17.0.css" #define JS_FILE "swad16.206.3.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 17.3.11: Sep 20, 2017 Code refactoring in listing of projects. (229981 lines) Version 17.3.10: Sep 19, 2017 New row in listing of projects for students. (230009 lines) Version 17.3.9: Sep 19, 2017 Tutor code moved from table projects to table prj_grp. (229987 lines) 1 change necessary in database: diff --git a/swad_project.c b/swad_project.c index 396f0b84e..46d6a361a 100644 --- a/swad_project.c +++ b/swad_project.c @@ -79,6 +79,8 @@ static void Prj_PutIconsListProjects (void); static void Prj_PutIconToCreateNewPrj (void); static void Prj_PutButtonToCreateNewPrj (void); static void Prj_ShowOneProject (struct Project *Prj,bool PrintView); +static void Prj_ShowOneProjectTxtRow (struct Project *Prj,bool PrintView, + const char *Label,char *TxtField); static void Prj_WriteUsrs (long PrjCod,Prj_RoleInProject_t RoleInProject); static void Prj_GetParamPrjOrder (void); @@ -433,84 +435,18 @@ static void Prj_ShowOneProject (struct Project *Prj,bool PrintView) (Prj->Preassigned == Prj_PREASSIGNED) ? Txt_Yes : Txt_No); - /***** Write second row of data of this project *****/ + /***** Write rows of data of this project *****/ /* Description of the project */ - Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, - Prj->Description,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML - Str_InsertLinks (Prj->Description,Cns_MAX_BYTES_TEXT,60); // Insert links - - fprintf (Gbl.F.Out,"" - "" - "%s:" - "" - "Hidden ? "ASG_LABEL_LIGHT" : - "ASG_LABEL", - Txt_Description); - if (!PrintView) - fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd); - fprintf (Gbl.F.Out," %s\">" - "%s" - "" - "", - Prj->Hidden ? "DAT_LIGHT" : - "DAT", - Prj->Description); + Prj_ShowOneProjectTxtRow (Prj,PrintView, + Txt_Description,Prj->Description); /* Required knowledge to carry out the project */ - Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, - Prj->Knowledge,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML - Str_InsertLinks (Prj->Knowledge,Cns_MAX_BYTES_TEXT,60); // Insert links - - fprintf (Gbl.F.Out,"" - "" - "%s:" - "" - "Hidden ? "ASG_LABEL_LIGHT" : - "ASG_LABEL", - Txt_Required_knowledge); - if (!PrintView) - fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd); - fprintf (Gbl.F.Out," %s\">" - "%s" - "" - "", - Prj->Hidden ? "DAT_LIGHT" : - "DAT", - Prj->Knowledge); + Prj_ShowOneProjectTxtRow (Prj,PrintView, + Txt_Required_knowledge,Prj->Knowledge); /* Required materials to carry out the project */ - Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, - Prj->Materials,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML - Str_InsertLinks (Prj->Materials,Cns_MAX_BYTES_TEXT,60); // Insert links - - fprintf (Gbl.F.Out,"" - "" - "%s:" - "" - "Hidden ? "ASG_LABEL_LIGHT" : - "ASG_LABEL", - Txt_Required_materials); - if (!PrintView) - fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd); - fprintf (Gbl.F.Out," %s\">" - "%s" - "" - "", - Prj->Hidden ? "DAT_LIGHT" : - "DAT", - Prj->Materials); + Prj_ShowOneProjectTxtRow (Prj,PrintView, + Txt_Required_materials,Prj->Materials); /* Project tutors */ fprintf (Gbl.F.Out,"" @@ -557,6 +493,41 @@ static void Prj_ShowOneProject (struct Project *Prj,bool PrintView) Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; } +/*****************************************************************************/ +/*********************** Show test info about a project **********************/ +/*****************************************************************************/ + +static void Prj_ShowOneProjectTxtRow (struct Project *Prj,bool PrintView, + const char *Label,char *TxtField) + { + /***** Change format *****/ + Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, + TxtField,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML + Str_InsertLinks (TxtField,Cns_MAX_BYTES_TEXT,60); // Insert links + + /***** Row with label and text *****/ + fprintf (Gbl.F.Out,"" + "" + "%s:" + "" + "Hidden ? "ASG_LABEL_LIGHT" : + "ASG_LABEL", + Label); + if (!PrintView) + fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd); + fprintf (Gbl.F.Out," %s\">" + "%s" + "" + "", + Prj->Hidden ? "DAT_LIGHT" : + "DAT", + TxtField); + } + /*****************************************************************************/ /*************** Write list of users with a role in a project ****************/ /*****************************************************************************/