From 1cbccc3b5fd75d2207642bec366b2ef25a584b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 9 Mar 2017 21:11:06 +0100 Subject: [PATCH] Version 16.155.1 --- sql/swad.sql | 4 ++-- swad_centre.c | 25 ++++++++++++------- swad_changelog.h | 7 +++++- swad_database.c | 62 ++++++++++++++++++++++++------------------------ swad_follow.c | 5 ++-- 5 files changed, 57 insertions(+), 46 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index 5b48f69ba..104690b5d 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -161,8 +161,8 @@ CREATE TABLE IF NOT EXISTS centres ( PlcCod INT NOT NULL DEFAULT -1, Status TINYINT NOT NULL DEFAULT 0, RequesterUsrCod INT NOT NULL DEFAULT -1, - ShortName VARCHAR(32) COLLATE latin1_spanish_ci NOT NULL, - FullName VARCHAR(127) COLLATE latin1_spanish_ci NOT NULL, + ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL, + FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL, WWW VARCHAR(255) NOT NULL, PhotoAttribution TEXT NOT NULL, UNIQUE INDEX(CtrCod), diff --git a/swad_centre.c b/swad_centre.c index 786fa6057..d8864c332 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -137,7 +137,8 @@ void Ctr_SeeCtrWithPendingDegs (void) sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)" " FROM degrees,ctr_admin,centres" " WHERE (degrees.Status & %u)<>0" - " AND degrees.CtrCod=ctr_admin.CtrCod AND ctr_admin.UsrCod='%ld'" + " AND degrees.CtrCod=ctr_admin.CtrCod" + " AND ctr_admin.UsrCod='%ld'" " AND degrees.CtrCod=centres.CtrCod" " GROUP BY degrees.CtrCod ORDER BY centres.ShortName", (unsigned) Deg_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod); @@ -1087,12 +1088,12 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr) Ctr->Status = (Ctr_Status_t) 0; Ctr->RequesterUsrCod = -1L; Ctr->ShrtName[0] = '\0'; - Ctr->FullName[0] = '\0'; - Ctr->WWW[0] = '\0'; + Ctr->FullName[0] = '\0'; + Ctr->WWW[0] = '\0'; Ctr->NumUsrsWhoClaimToBelongToCtr = 0; Ctr->Degs.Num = Ctr->NumCrss = 0; - Ctr->NumUsrs = 0; + Ctr->NumUsrs = 0; /***** Check if centre code is correct *****/ if (Ctr->CtrCod > 0) @@ -1594,9 +1595,9 @@ static void Ctr_ListCentresForEdition (void) static bool Ctr_CheckIfICanEditACentre (struct Centre *Ctr) { - return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM || // I am an institution administrator or higher - ((Ctr->Status & Ctr_STATUS_BIT_PENDING) != 0 && // Centre is not yet activated - Gbl.Usrs.Me.UsrDat.UsrCod == Ctr->RequesterUsrCod)); // I am the requester + return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM || // I am an institution administrator or higher + ((Ctr->Status & Ctr_STATUS_BIT_PENDING) != 0 && // Centre is not yet activated + Gbl.Usrs.Me.UsrDat.UsrCod == Ctr->RequesterUsrCod)); // I am the requester } /*****************************************************************************/ @@ -1750,13 +1751,19 @@ void Ctr_ChangeCtrInsInConfig (void) Ins_GetDataOfInstitutionByCod (&NewIns,Ins_GET_BASIC_DATA); /***** Check if it already exists a centre with the same name in the new institution *****/ - if (Ctr_CheckIfCtrNameExistsInIns ("ShortName",Gbl.CurrentCtr.Ctr.ShrtName,Gbl.CurrentCtr.Ctr.CtrCod,NewIns.InsCod)) + if (Ctr_CheckIfCtrNameExistsInIns ("ShortName", + Gbl.CurrentCtr.Ctr.ShrtName, + Gbl.CurrentCtr.Ctr.CtrCod, + NewIns.InsCod)) { Gbl.Error = true; sprintf (Gbl.Message,Txt_The_centre_X_already_exists, Gbl.CurrentCtr.Ctr.ShrtName); } - else if (Ctr_CheckIfCtrNameExistsInIns ("FullName",Gbl.CurrentCtr.Ctr.FullName,Gbl.CurrentCtr.Ctr.CtrCod,NewIns.InsCod)) + else if (Ctr_CheckIfCtrNameExistsInIns ("FullName", + Gbl.CurrentCtr.Ctr.FullName, + Gbl.CurrentCtr.Ctr.CtrCod, + NewIns.InsCod)) { Gbl.Error = true; sprintf (Gbl.Message,Txt_The_centre_X_already_exists, diff --git a/swad_changelog.h b/swad_changelog.h index a96dfac81..7253ae0dc 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -204,13 +204,18 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.155 (2017-03-09)" +#define Log_PLATFORM_VERSION "SWAD 16.155.1 (2017-03-09)" #define CSS_FILE "swad16.147.css" #define JS_FILE "swad16.144.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 16.155.1: Mar 09, 2017 Adjusting size of database fields. (216593 lines) + 2 changes necessary in database: +ALTER TABLE centres CHANGE COLUMN ShortName ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL; +ALTER TABLE centres CHANGE COLUMN FullName FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL; + Version 16.155: Mar 09, 2017 Adjusting size of database fields. Code refactoring related with renaming some fields. (216583 lines) 2 changes necessary in database: diff --git a/swad_database.c b/swad_database.c index f75adad35..5222bc32a 100644 --- a/swad_database.c +++ b/swad_database.c @@ -402,43 +402,43 @@ mysql> DESCRIBE birthdays_today; 2 rows in set (0.09 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS birthdays_today (" - "UsrCod INT NOT NULL," - "Today DATE NOT NULL," - "UNIQUE INDEX(UsrCod)," - "INDEX(Today))"); + "UsrCod INT NOT NULL," + "Today DATE NOT NULL," + "UNIQUE INDEX(UsrCod)," + "INDEX(Today))"); /***** Table centres *****/ /* mysql> DESCRIBE centres; -+------------------+--------------+------+-----+---------+----------------+ -| Field | Type | Null | Key | Default | Extra | -+------------------+--------------+------+-----+---------+----------------+ -| CtrCod | int(11) | NO | PRI | NULL | auto_increment | -| InsCod | int(11) | NO | MUL | NULL | | -| PlcCod | int(11) | NO | MUL | -1 | | -| Status | tinyint(4) | NO | MUL | 0 | | -| RequesterUsrCod | int(11) | NO | | -1 | | -| ShortName | varchar(32) | NO | | NULL | | -| FullName | varchar(127) | NO | | NULL | | -| WWW | varchar(255) | NO | | NULL | | -| PhotoAttribution | text | NO | | NULL | | -+------------------+--------------+------+-----+---------+----------------+ -9 rows in set (0.00 sec) ++------------------+---------------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++------------------+---------------+------+-----+---------+----------------+ +| CtrCod | int(11) | NO | PRI | NULL | auto_increment | +| InsCod | int(11) | NO | MUL | NULL | | +| PlcCod | int(11) | NO | MUL | -1 | | +| Status | tinyint(4) | NO | MUL | 0 | | +| RequesterUsrCod | int(11) | NO | | -1 | | +| ShortName | varchar(511) | NO | | NULL | | +| FullName | varchar(2047) | NO | | NULL | | +| WWW | varchar(255) | NO | | NULL | | +| PhotoAttribution | text | NO | | NULL | | ++------------------+---------------+------+-----+---------+----------------+ +9 rows in set (0,00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS centres (" - "CtrCod INT NOT NULL AUTO_INCREMENT," - "InsCod INT NOT NULL," - "PlcCod INT NOT NULL," - "Status TINYINT NOT NULL DEFAULT 0," - "RequesterUsrCod INT NOT NULL DEFAULT -1," - "ShortName VARCHAR(32) COLLATE latin1_spanish_ci NOT NULL," - "FullName VARCHAR(127) COLLATE latin1_spanish_ci NOT NULL," - "WWW VARCHAR(255) NOT NULL," - "PhotoAttribution TEXT NOT NULL," - "UNIQUE INDEX(CtrCod)," - "INDEX(InsCod)," - "INDEX(PlcCod)," - "INDEX(Status))"); + "CtrCod INT NOT NULL AUTO_INCREMENT," + "InsCod INT NOT NULL," + "PlcCod INT NOT NULL," + "Status TINYINT NOT NULL DEFAULT 0," + "RequesterUsrCod INT NOT NULL DEFAULT -1," + "ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_SHRT_NAME + "FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_FULL_NAME + "WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW + "PhotoAttribution TEXT NOT NULL," + "UNIQUE INDEX(CtrCod)," + "INDEX(InsCod)," + "INDEX(PlcCod)," + "INDEX(Status))"); /***** Table chat *****/ /* diff --git a/swad_follow.c b/swad_follow.c index 01d95107f..6b99f36f1 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -889,15 +889,14 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat) fprintf (Gbl.F.Out,""); /***** User's name *****/ - fprintf (Gbl.F.Out,"", + fprintf (Gbl.F.Out,"", Gbl.RowEvenOdd); if (Visible) { /* Put form to go to public profile */ Act_FormStart (ActSeeOthPubPrf); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - fprintf (Gbl.F.Out,"
"); // Limited width + fprintf (Gbl.F.Out,"
"); // Limited width Act_LinkFormSubmit (Txt_Another_user_s_profile,"CON_CRS",NULL); Usr_WriteFirstNameBRSurnames (UsrDat); fprintf (Gbl.F.Out,""