diff --git a/sql/cambios.sql b/sql/cambios.sql index 739341302..131ba76b4 100644 --- a/sql/cambios.sql +++ b/sql/cambios.sql @@ -11181,4 +11181,11 @@ UPDATE timetable_crs SET Hour=Hour+2; UPDATE timetable_tut SET Hour=Hour+2; -SELECT COUNT(DISTINCT crs_usr.UsrCod) FROM institutions,centres,degrees,courses,crs_usr WHERE institutions.CtyCod='724' AND institutions.InsCod=centres.InsCod AND centres.CtrCod=degrees.CtrCod AND degrees.DegCod=courses.DegCod AND courses.CrsCod=crs_usr.CrsCod; \ No newline at end of file +SELECT COUNT(DISTINCT crs_usr.UsrCod) FROM institutions,centres,degrees,courses,crs_usr WHERE institutions.CtyCod='724' AND institutions.InsCod=centres.InsCod AND centres.CtrCod=degrees.CtrCod AND degrees.DegCod=courses.DegCod AND courses.CrsCod=crs_usr.CrsCod; + + + +----- SWAD 15.77 (2015/12/28) ----- + +CREATE TABLE IF NOT EXISTS social (SocCod BIGINT NOT NULL AUTO_INCREMENT,SocialEvent TINYINT NOT NULL,UsrCod INT NOT NULL,CtyCod INT NOT NULL DEFAULT -1,InsCod INT NOT NULL DEFAULT -1,CtrCod INT NOT NULL DEFAULT -1,DegCod INT NOT NULL DEFAULT -1,CrsCod INT NOT NULL DEFAULT -1,Cod INT NOT NULL DEFAULT -1,TimeEvent DATETIME NOT NULL,Status TINYINT NOT NULL DEFAULT 0,UNIQUE INDEX(SocCod),INDEX(SocialEvent),INDEX(UsrCod),INDEX(TimeEvent)); + diff --git a/sql/swad.sql b/sql/swad.sql index 1b84a6c9c..aacb5f309 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -913,6 +913,25 @@ CREATE TABLE IF NOT EXISTS sessions ( UNIQUE INDEX(SessionId), INDEX(UsrCod)); -- +-- Table social: stores social events (timeline) +-- +CREATE TABLE IF NOT EXISTS social ( + SocCod BIGINT NOT NULL AUTO_INCREMENT, + SocialEvent TINYINT NOT NULL, + UsrCod INT NOT NULL, + CtyCod INT NOT NULL DEFAULT -1, + InsCod INT NOT NULL DEFAULT -1, + CtrCod INT NOT NULL DEFAULT -1, + DegCod INT NOT NULL DEFAULT -1, + CrsCod INT NOT NULL DEFAULT -1, + Cod INT NOT NULL DEFAULT -1, + TimeEvent DATETIME NOT NULL, + Status TINYINT NOT NULL DEFAULT 0, + UNIQUE INDEX(SocCod), + INDEX(SocialEvent), + INDEX(UsrCod), + INDEX(TimeEvent)); +-- -- Table sta_degrees: stores statistics about degrees -- CREATE TABLE IF NOT EXISTS sta_degrees ( diff --git a/swad_changelog.h b/swad_changelog.h index d6358c136..8866c310b 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -114,12 +114,17 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.76.1 (2015-12-28)" +#define Log_PLATFORM_VERSION "SWAD 15.77 (2015-12-28)" #define CSS_FILE "swad15.75.css" // 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 15.77: Dec 28, 2015 New table in database for social activity. (188287 lines) + 2 changes necessary in database: +CREATE TABLE IF NOT EXISTS social (SocCod BIGINT NOT NULL AUTO_INCREMENT,SocialEvent TINYINT NOT NULL,UsrCod INT NOT NULL,CtyCod INT NOT NULL DEFAULT -1,InsCod INT NOT NULL DEFAULT -1,CtrCod INT NOT NULL DEFAULT -1,DegCod INT NOT NULL DEFAULT -1,CrsCod INT NOT NULL DEFAULT -1,Cod INT NOT NULL DEFAULT -1,TimeEvent DATETIME NOT NULL,Status TINYINT NOT NULL DEFAULT 0,UNIQUE INDEX(SocCod),INDEX(SocialEvent),INDEX(UsrCod),INDEX(TimeEvent)); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1490','es','N','Ver actividad social (timeline)'); + Version 15.76.1: Dec 28, 2015 Refactoring in swad_database. (187926 lines) Version 15.76: Dec 28, 2015 New option for social network activity (timeline). New module swad_social. (187807 lines) diff --git a/swad_database.c b/swad_database.c index ad071c472..97c7630c3 100644 --- a/swad_database.c +++ b/swad_database.c @@ -1935,6 +1935,43 @@ mysql> DESCRIBE sessions; "UNIQUE INDEX(SessionId)," "INDEX(UsrCod))"); + /***** Table social *****/ +/* +mysql> DESCRIBE social; ++-------------+------------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++-------------+------------+------+-----+---------+----------------+ +| SocCod | bigint(20) | NO | PRI | NULL | auto_increment | +| SocialEvent | tinyint(4) | NO | MUL | NULL | | +| UsrCod | int(11) | NO | MUL | NULL | | +| CtyCod | int(11) | NO | | -1 | | +| InsCod | int(11) | NO | | -1 | | +| CtrCod | int(11) | NO | | -1 | | +| DegCod | int(11) | NO | | -1 | | +| CrsCod | int(11) | NO | | -1 | | +| Cod | int(11) | NO | | -1 | | +| TimeEvent | datetime | NO | MUL | NULL | | +| Status | tinyint(4) | NO | | 0 | | ++-------------+------------+------+-----+---------+----------------+ +11 rows in set (0.00 sec) +*/ + DB_CreateTable ("CREATE TABLE IF NOT EXISTS social (" + "SocCod BIGINT NOT NULL AUTO_INCREMENT," + "SocialEvent TINYINT NOT NULL," + "UsrCod INT NOT NULL," + "CtyCod INT NOT NULL DEFAULT -1," + "InsCod INT NOT NULL DEFAULT -1," + "CtrCod INT NOT NULL DEFAULT -1," + "DegCod INT NOT NULL DEFAULT -1," + "CrsCod INT NOT NULL DEFAULT -1," + "Cod INT NOT NULL DEFAULT -1," + "TimeEvent DATETIME NOT NULL," + "Status TINYINT NOT NULL DEFAULT 0," + "UNIQUE INDEX(SocCod)," + "INDEX(SocialEvent)," + "INDEX(UsrCod)," + "INDEX(TimeEvent))"); + /***** Table sta_degrees *****/ /* mysql> DESCRIBE sta_degrees; diff --git a/swad_forum.c b/swad_forum.c index 329b5aff0..9ea27c50f 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -1273,11 +1273,13 @@ static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC, } /*****************************************************************************/ -/********************* Show brief subject of a forum post ********************/ +/***************** Get summary and content for a forum post ******************/ /*****************************************************************************/ // This function may be called inside a web service, so don't report error -void For_GetNotifForumPst (char *SummaryStr,char **ContentStr,long PstCod,unsigned MaxChars,bool GetContent) +void For_GetSummaryAndContentForumPst (char *SummaryStr,char **ContentStr, + long PstCod, + unsigned MaxChars,bool GetContent) { char Query[512]; MYSQL_RES *mysql_res; diff --git a/swad_forum.h b/swad_forum.h index c86ef60b8..0ab34b1b0 100644 --- a/swad_forum.h +++ b/swad_forum.h @@ -109,7 +109,9 @@ unsigned long For_GetNumPostsUsr (long UsrCod); void For_DeleteThrFromReadThrs (long ThrCod); void For_RemoveUsrFromReadThrs (long UsrCod); -void For_GetNotifForumPst (char *SummaryStr,char **ContentStr,long PstCod,unsigned MaxChars,bool GetContent); +void For_GetSummaryAndContentForumPst (char *SummaryStr,char **ContentStr, + long PstCod, + unsigned MaxChars,bool GetContent); void For_PutAllHiddenParamsForum (void); void For_SetForumTypeAndRestrictAccess (void); diff --git a/swad_notification.c b/swad_notification.c index d1a5aa0e1..bbd627c67 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -535,7 +535,7 @@ void Ntf_ShowMyNotifications (void) fprintf (Gbl.F.Out,"-"); fprintf (Gbl.F.Out,""); - /* Write date and time (DateTime holds date and time in YYYYMMDDHHMMSS format) */ + /* Write date and time */ Msg_WriteMsgDate (DateTimeUTC,ClassBackground); /* Write status (sent by email / pending to be sent by email) */ @@ -722,7 +722,7 @@ Ntf_StatusTxt_t Ntf_GetStatusTxtFromStatusBits (Ntf_Status_t Status) } /*****************************************************************************/ -/********************* Mark possible notification as seen ********************/ +/******************* Get notification summary and content ********************/ /*****************************************************************************/ void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr,Ntf_NotifyEvent_t NotifyEvent, @@ -759,7 +759,7 @@ void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr,Ntf_Notif break; case Ntf_EVENT_FORUM_POST_COURSE: case Ntf_EVENT_FORUM_REPLY: - For_GetNotifForumPst (SummaryStr,ContentStr,Cod,MaxChars,GetContent); + For_GetSummaryAndContentForumPst (SummaryStr,ContentStr,Cod,MaxChars,GetContent); break; case Ntf_EVENT_MESSAGE: Msg_GetNotifMessage (SummaryStr,ContentStr,Cod,MaxChars,GetContent); @@ -774,10 +774,6 @@ void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr,Ntf_Notif Fol_GetNotifFollower (SummaryStr,ContentStr); break; } - - //if (Gbl.WebService.IsWebService) - /* Set the notification as seen, because I can see it in an extern application */ - // Ntf_SetNotifAsSeen (NotifyEvent,Cod,UsrCod); } /*****************************************************************************/ diff --git a/swad_text.c b/swad_text.c index 9518dcdbf..9e5ff565d 100644 --- a/swad_text.c +++ b/swad_text.c @@ -27613,6 +27613,27 @@ const char *Txt_posts = "posts"; #endif +const char *Txt_Public_activity = +#if L==1 + "Activitat pública"; +#elif L==2 + "Öffentliche Aktivität"; +#elif L==3 + "Public activity"; +#elif L==4 + "Actividad pública"; +#elif L==5 + "Activité public"; +#elif L==6 + "Actividad pública"; // Okoteve traducción +#elif L==7 + "Attività pubblica"; +#elif L==8 + "Aktywność publiczne"; +#elif L==9 + "Atividade pública"; +#endif + const char *Txt_public_FILES = #if L==1 "públics";