diff --git a/sql/swad.sql b/sql/swad.sql index ecdebc555..64c4513cb 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -607,7 +607,8 @@ CREATE TABLE IF NOT EXISTS locations ( NumNotif INT NOT NULL DEFAULT 0, StartTime DATETIME NOT NULL, EndTime DATETIME NOT NULL, - Title VARCHAR(255) NOT NULL, + Location VARCHAR(255) NOT NULL, + Event VARCHAR(255) NOT NULL, Txt TEXT NOT NULL, UNIQUE INDEX(LocCod), INDEX(UsrCod,Hidden)); diff --git a/swad_changelog.h b/swad_changelog.h index 1ec788db0..51d46fb59 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -183,13 +183,20 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.78 (2016-11-30)" +#define Log_PLATFORM_VERSION "SWAD 16.79 (2016-11-30)" #define CSS_FILE "swad16.69.css" #define JS_FILE "swad16.46.1.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.79: Nov 30, 2016 In locations, split Title into Event (What?) and Location (Where?). (209534 lines) + 4 changes necessary in database: +ALTER TABLE locations ADD COLUMN Location VARCHAR(255) NOT NULL AFTER Title; +ALTER TABLE locations ADD COLUMN Event VARCHAR(255) NOT NULL AFTER Location; +UPDATE locations SET Location=Title,Event=Title; +ALTER TABLE locations DROP COLUMN Title; + Version 16.78: Nov 30, 2016 Changes in location. Not finished. (209486 lines) 2 changes necessary in database: DROP TABLE IF EXISTS locations; diff --git a/swad_database.c b/swad_database.c index 91299e926..7b25d0ca4 100644 --- a/swad_database.c +++ b/swad_database.c @@ -1309,10 +1309,11 @@ mysql> DESCRIBE locations; | NumNotif | int(11) | NO | | 0 | | | StartTime | datetime | NO | | NULL | | | EndTime | datetime | NO | | NULL | | -| Title | varchar(255) | NO | | NULL | | +| Location | varchar(255) | NO | | NULL | | +| Event | varchar(255) | NO | | NULL | | | Txt | text | NO | | NULL | | +-----------+---------------+------+-----+---------+----------------+ -8 rows in set (0,01 sec) +9 rows in set (0,00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS locations (" "LocCod INT NOT NULL AUTO_INCREMENT," @@ -1321,7 +1322,8 @@ mysql> DESCRIBE locations; "NumNotif INT NOT NULL DEFAULT 0," "StartTime DATETIME NOT NULL," "EndTime DATETIME NOT NULL," - "Title VARCHAR(255) NOT NULL," + "Location VARCHAR(255) NOT NULL," + "Event VARCHAR(255) NOT NULL," "Txt TEXT NOT NULL," "UNIQUE INDEX(LocCod)," "INDEX(UsrCod,Hidden))"); diff --git a/swad_location.c b/swad_location.c index fecd56b2b..be19ca6f5 100644 --- a/swad_location.c +++ b/swad_location.c @@ -107,6 +107,7 @@ static void Loc_ShowAllLocations (void) extern const char *Txt_ASG_ATT_OR_SVY_HELP_ORDER[2]; extern const char *Txt_ASG_ATT_OR_SVY_ORDER[2]; extern const char *Txt_Location; + extern const char *Txt_Event; extern const char *Txt_No_locations; Loc_Order_t Order; struct Pagination Pagination; @@ -154,10 +155,14 @@ static void Loc_ShowAllLocations (void) fprintf (Gbl.F.Out,""); } fprintf (Gbl.F.Out,"
" @@ -349,7 +363,7 @@ static void Loc_ShowOneLocation (long LocCod) } /*****************************************************************************/ -/********************** Write the author of an location **********************/ +/********************** Write the author of a location ***********************/ /*****************************************************************************/ static void Loc_WriteLocAuthor (struct Location *Loc) @@ -502,10 +516,10 @@ void Loc_GetListLocations (void) switch (Gbl.Usrs.Me.Locs.SelectedOrderType) { case Loc_ORDER_BY_START_DATE: - sprintf (OrderBySubQuery,"StartTime DESC,EndTime DESC,Title DESC"); + sprintf (OrderBySubQuery,"StartTime DESC,EndTime DESC,Location DESC,Event DESC"); break; case Loc_ORDER_BY_END_DATE: - sprintf (OrderBySubQuery,"EndTime DESC,StartTime DESC,Title DESC"); + sprintf (OrderBySubQuery,"EndTime DESC,StartTime DESC,Location DESC,Event DESC"); break; } sprintf (Query,"SELECT LocCod" @@ -556,7 +570,7 @@ void Loc_GetDataOfLocationByCod (struct Location *Loc) "UNIX_TIMESTAMP(StartTime)," "UNIX_TIMESTAMP(EndTime)," "NOW() BETWEEN StartTime AND EndTime," - "Title" + "Location,Event" " FROM locations" " WHERE LocCod='%ld' AND UsrCod='%ld'", Loc->LocCod,Gbl.Usrs.Me.UsrDat.UsrCod); @@ -582,7 +596,8 @@ static void Loc_GetDataOfLocation (struct Location *Loc,const char *Query) Loc->TimeUTC[Loc_START_TIME] = Loc->TimeUTC[Loc_END_TIME ] = (time_t) 0; Loc->Open = false; - Loc->Title[0] = '\0'; + Loc->Location[0] = '\0'; + Loc->Event[0] = '\0'; /***** Get data of location from database *****/ NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get location data"); @@ -610,8 +625,11 @@ static void Loc_GetDataOfLocation (struct Location *Loc,const char *Query) /* Get whether the location is open or closed (row(5)) */ Loc->Open = (row[5][0] == '1'); - /* Get the title of the location (row[6]) */ - strcpy (Loc->Title,row[6]); + /* Get the location (row[6]) */ + strcpy (Loc->Location,row[6]); + + /* Get the event (row[7]) */ + strcpy (Loc->Event,row[7]); } /***** Free structure that stores the query result *****/ @@ -721,7 +739,7 @@ void Loc_AskRemLocation (void) /***** Ask for confirmation of removing *****/ sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_the_location_X, - Loc.Title); + Loc.Event); Lay_ShowAlert (Lay_WARNING,Gbl.Message); Lay_PutRemoveButton (Txt_Remove_location); Act_FormEnd (); @@ -754,8 +772,7 @@ void Loc_RemoveLocation (void) DB_QueryDELETE (Query,"can not remove location"); /***** Write message to show the change made *****/ - sprintf (Gbl.Message,Txt_Location_X_removed, - Loc.Title); + sprintf (Gbl.Message,Txt_Location_X_removed,Loc.Event); Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); /***** Show locations again *****/ @@ -786,8 +803,7 @@ void Loc_HideLocation (void) DB_QueryUPDATE (Query,"can not hide location"); /***** Write message to show the change made *****/ - sprintf (Gbl.Message,Txt_Location_X_is_now_hidden, - Loc.Title); + sprintf (Gbl.Message,Txt_Location_X_is_now_hidden,Loc.Event); Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); /***** Show locations again *****/ @@ -818,8 +834,7 @@ void Loc_ShowLocation (void) DB_QueryUPDATE (Query,"can not show location"); /***** Write message to show the change made *****/ - sprintf (Gbl.Message,Txt_Location_X_is_now_visible, - Loc.Title); + sprintf (Gbl.Message,Txt_Location_X_is_now_visible,Loc.Event); Lay_ShowAlert (Lay_SUCCESS,Gbl.Message); /***** Show locations again *****/ @@ -827,7 +842,7 @@ void Loc_ShowLocation (void) } /*****************************************************************************/ -/********* Check if the title or the folder of an location exists ************/ +/********* Check if the title or the folder of a location exists *************/ /*****************************************************************************/ static bool Loc_CheckIfSimilarLocationExists (const char *Field,const char *Value,long LocCod) @@ -852,7 +867,8 @@ void Loc_RequestCreatOrEditLoc (void) extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *Txt_New_location; extern const char *Txt_Edit_location; - extern const char *Txt_Title; + extern const char *Txt_Location; + extern const char *Txt_Event; extern const char *Txt_Description; extern const char *Txt_Create_location; extern const char *Txt_Save; @@ -877,7 +893,8 @@ void Loc_RequestCreatOrEditLoc (void) Loc.TimeUTC[Loc_START_TIME] = Gbl.StartExecutionTimeUTC; Loc.TimeUTC[Loc_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours Loc.Open = true; - Loc.Title[0] = '\0'; + Loc.Location[0] = '\0'; + Loc.Event[0] = '\0'; } else { @@ -909,25 +926,40 @@ void Loc_RequestCreatOrEditLoc (void) Hlp_PROFILE_Location_edit_location, 2); - /***** Location title *****/ + /***** Location *****/ fprintf (Gbl.F.Out,"