Version 16.155.1

This commit is contained in:
Antonio Cañas Vargas 2017-03-09 21:11:06 +01:00
parent b787992053
commit 1cbccc3b5f
5 changed files with 57 additions and 46 deletions

View File

@ -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),

View File

@ -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,

View File

@ -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:

View File

@ -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 *****/
/*

View File

@ -889,15 +889,14 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
fprintf (Gbl.F.Out,"</td>");
/***** User's name *****/
fprintf (Gbl.F.Out,"<td class=\"CON_USR CON_CRS COLOR%u\""
" style=\"width:68px;\">",
fprintf (Gbl.F.Out,"<td class=\"CON_USR_NARROW CON_CRS COLOR%u\">",
Gbl.RowEvenOdd);
if (Visible)
{
/* Put form to go to public profile */
Act_FormStart (ActSeeOthPubPrf);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
fprintf (Gbl.F.Out,"<div class=\"CON_NAME\">"); // Limited width
fprintf (Gbl.F.Out,"<div class=\"CON_NAME_NARROW\">"); // Limited width
Act_LinkFormSubmit (Txt_Another_user_s_profile,"CON_CRS",NULL);
Usr_WriteFirstNameBRSurnames (UsrDat);
fprintf (Gbl.F.Out,"</a>"