Version 15.86

This commit is contained in:
Antonio Cañas Vargas 2015-12-31 14:25:28 +01:00
parent 5a1ab2cc36
commit 4964a9913d
12 changed files with 268 additions and 254 deletions

View File

@ -917,7 +917,7 @@ CREATE TABLE IF NOT EXISTS sessions (
--
CREATE TABLE IF NOT EXISTS social (
SocCod BIGINT NOT NULL AUTO_INCREMENT,
SocialEvent TINYINT NOT NULL,
SocialNote TINYINT NOT NULL,
UsrCod INT NOT NULL,
CtyCod INT NOT NULL DEFAULT -1,
InsCod INT NOT NULL DEFAULT -1,
@ -925,15 +925,15 @@ CREATE TABLE IF NOT EXISTS social (
DegCod INT NOT NULL DEFAULT -1,
CrsCod INT NOT NULL DEFAULT -1,
Cod INT NOT NULL DEFAULT -1,
TimeEvent DATETIME NOT NULL,
TimeNote DATETIME NOT NULL,
UNIQUE INDEX(SocCod),
INDEX(SocialEvent),
INDEX(SocialNote),
INDEX(UsrCod),
INDEX(TimeEvent));
INDEX(TimeNote));
--
-- Table social_post: stores social posts
-- Table social_posts: stores social posts (public comments written by users)
--
CREATE TABLE IF NOT EXISTS social_post (
CREATE TABLE IF NOT EXISTS social_posts (
PstCod INT NOT NULL AUTO_INCREMENT,
Content LONGTEXT NOT NULL,
UNIQUE INDEX(PstCod),

View File

@ -1004,8 +1004,8 @@ Social:
839. ActReqSocPst Write a public social post to be displayed in the timeline
840. ActRcvSocPst Receive a public social post to be displayed in the timeline
841. ActReqRemSocEvn Request the removal of a social event
842. ActRemSocEvn Remove a social event
841. ActReqRemSocNot Request the removal of a social note (only if it is a post)
842. ActRemSocNot Remove a social note (only if it is a post)
843. ActSeePubPrf Show a public user's profile
844. ActCal1stClkTim Calculate first click time from log and store into user's figures
845. ActCalNumClk Calculate number of clicks from log and store into user's figures
@ -2315,8 +2315,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActReqSocPst */{1491,-1,TabSoc,ActSeeSocAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_FormSocialPost ,NULL},
/* ActRcvSocPst */{1492,-1,TabSoc,ActSeeSocAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_ReceiveSocialPost ,NULL},
/* ActReqRemSocEvn */{1494,-1,TabSoc,ActSeeSocAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemovalSocialEvent ,NULL},
/* ActRemSocEvn */{1493,-1,TabSoc,ActSeeSocAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialEvent ,NULL},
/* ActReqRemSocNot */{1494,-1,TabSoc,ActSeeSocAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemovalSocialNote ,NULL},
/* ActRemSocNot */{1493,-1,TabSoc,ActSeeSocAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialNote ,NULL},
/* ActSeePubPrf */{1402,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_GetUsrCodAndShowUserProfile,NULL},
/* ActCal1stClkTim */{1405,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateFirstClickTime ,NULL},
@ -4157,8 +4157,8 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActSeeSocAct, // #1490
ActReqSocPst, // #1491
ActRcvSocPst, // #1492
ActRemSocEvn, // #1493
ActReqRemSocEvn, // #1494
ActRemSocNot, // #1493
ActReqRemSocNot, // #1494
};
/*****************************************************************************/

View File

@ -1043,8 +1043,8 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
// Secondary actions
#define ActReqSocPst (ActLstClk+ 5)
#define ActRcvSocPst (ActLstClk+ 6)
#define ActReqRemSocEvn (ActLstClk+ 7)
#define ActRemSocEvn (ActLstClk+ 8)
#define ActReqRemSocNot (ActLstClk+ 7)
#define ActRemSocNot (ActLstClk+ 8)
#define ActSeePubPrf (ActLstClk+ 9)
#define ActCal1stClkTim (ActLstClk+ 10)

View File

@ -111,18 +111,30 @@
// TODO: Reply to all
// TODO: Hour in exam announcement should start at six a.m.
// TODO: When a file, notice, etc. is removed, it should be removed from social events?
// TODO: New database table used to store users who write or share social
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.85 (2015-12-30)"
#define Log_PLATFORM_VERSION "SWAD 15.86 (2015-12-30)"
#define CSS_FILE "swad15.84.2.css"
#define JS_FILE "swad15.77.7.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 15.86: Dec 30, 2015 Renamed database tables related to social events. (? lines)
4 changes necessary in database:
RENAME TABLE social_post TO social_posts;
RENAME TABLE social TO social_notes;
ALTER TABLE social_notes CHANGE COLUMN SocialEvent SocialNote TINYINT NOT NULL;
ALTER TABLE social_notes CHANGE COLUMN TimeEvent TimeNote DATETIME NOT NULL;
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1492','es','N','Crear comentario social');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1493','es','N','Eliminar comentario social');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1494','es','N','Solicitar elim. comentario social');
Version 15.85.1: Dec 30, 2015 Remove social events when a user is removed. (189439 lines)
Version 15.85: Dec 30, 2015 Forums option is moved to social tab. (189439 lines)
Version 15.84.5: Dec 30, 2015 Form to update connected users. (189430 lines)
Version 15.84.4: Dec 30, 2015 Code refactoring in profile. (189427 lines)

View File

@ -1935,28 +1935,28 @@ mysql> DESCRIBE sessions;
"UNIQUE INDEX(SessionId),"
"INDEX(UsrCod))");
/***** Table social *****/
/***** Table social_notes *****/
/*
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 | |
+-------------+------------+------+-----+---------+----------------+
mysql> DESCRIBE social_notes;
+------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+------------+------+-----+---------+----------------+
| SocCod | bigint(20) | NO | PRI | NULL | auto_increment |
| SocialNote | 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 | |
| TimeNote | datetime | NO | MUL | NULL | |
+------------+------------+------+-----+---------+----------------+
10 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social ("
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_notes ("
"SocCod BIGINT NOT NULL AUTO_INCREMENT,"
"SocialEvent TINYINT NOT NULL,"
"SocialNote TINYINT NOT NULL,"
"UsrCod INT NOT NULL,"
"CtyCod INT NOT NULL DEFAULT -1,"
"InsCod INT NOT NULL DEFAULT -1,"
@ -1964,15 +1964,15 @@ mysql> DESCRIBE social;
"DegCod INT NOT NULL DEFAULT -1,"
"CrsCod INT NOT NULL DEFAULT -1,"
"Cod INT NOT NULL DEFAULT -1,"
"TimeEvent DATETIME NOT NULL,"
"TimeNote DATETIME NOT NULL,"
"UNIQUE INDEX(SocCod),"
"INDEX(SocialEvent),"
"INDEX(SocialNote),"
"INDEX(UsrCod),"
"INDEX(TimeEvent))");
"INDEX(TimeNote))");
/***** Table social_post *****/
/***** Table social_posts *****/
/*
mysql> DESCRIBE social_post;
mysql> DESCRIBE social_posts;
+---------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+----------+------+-----+---------+----------------+
@ -1981,7 +1981,7 @@ mysql> DESCRIBE social_post;
+---------+----------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_post ("
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_posts ("
"PstCod INT NOT NULL AUTO_INCREMENT,"
"Content LONGTEXT NOT NULL,"
"UNIQUE INDEX(PstCod),"

View File

@ -305,8 +305,8 @@ void Exa_ReceiveExamAnnouncement (void)
Exa_UpdateNumUsrsNotifiedByEMailAboutExamAnnouncement (ExaCod,NumUsrsToBeNotifiedByEMail);
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
/***** Create a new social event about the new exam announcement *****/
Soc_StoreSocialEvent (Soc_EVENT_EXAM_ANNOUNCEMENT,ExaCod);
/***** Create a new social note about the new exam announcement *****/
Soc_StoreSocialNote (Soc_NOTE_EXAM_ANNOUNCEMENT,ExaCod);
/***** Show exam announcement *****/
Exa_ListExamAnnouncementsEdit ();

View File

@ -9684,28 +9684,28 @@ void Brw_ChgFileMetadata (void)
switch (Gbl.FileBrowser.Type)
{
case Brw_ADMI_DOCUM_INS:
Soc_StoreSocialEvent (Soc_EVENT_INS_DOC_PUB_FILE,FileMetadata.FilCod);
Soc_StoreSocialNote (Soc_NOTE_INS_DOC_PUB_FILE,FileMetadata.FilCod);
break;
case Brw_ADMI_SHARE_INS:
Soc_StoreSocialEvent (Soc_EVENT_INS_SHA_PUB_FILE,FileMetadata.FilCod);
Soc_StoreSocialNote (Soc_NOTE_INS_SHA_PUB_FILE,FileMetadata.FilCod);
break;
case Brw_ADMI_DOCUM_CTR:
Soc_StoreSocialEvent (Soc_EVENT_CTR_DOC_PUB_FILE,FileMetadata.FilCod);
Soc_StoreSocialNote (Soc_NOTE_CTR_DOC_PUB_FILE,FileMetadata.FilCod);
break;
case Brw_ADMI_SHARE_CTR:
Soc_StoreSocialEvent (Soc_EVENT_CTR_SHA_PUB_FILE,FileMetadata.FilCod);
Soc_StoreSocialNote (Soc_NOTE_CTR_SHA_PUB_FILE,FileMetadata.FilCod);
break;
case Brw_ADMI_DOCUM_DEG:
Soc_StoreSocialEvent (Soc_EVENT_DEG_DOC_PUB_FILE,FileMetadata.FilCod);
Soc_StoreSocialNote (Soc_NOTE_DEG_DOC_PUB_FILE,FileMetadata.FilCod);
break;
case Brw_ADMI_SHARE_DEG:
Soc_StoreSocialEvent (Soc_EVENT_DEG_SHA_PUB_FILE,FileMetadata.FilCod);
Soc_StoreSocialNote (Soc_NOTE_DEG_SHA_PUB_FILE,FileMetadata.FilCod);
break;
case Brw_ADMI_DOCUM_CRS:
Soc_StoreSocialEvent (Soc_EVENT_CRS_DOC_PUB_FILE,FileMetadata.FilCod);
Soc_StoreSocialNote (Soc_NOTE_CRS_DOC_PUB_FILE,FileMetadata.FilCod);
break;
case Brw_ADMI_SHARE_CRS:
Soc_StoreSocialEvent (Soc_EVENT_CRS_SHA_PUB_FILE,FileMetadata.FilCod);
Soc_StoreSocialNote (Soc_NOTE_CRS_SHA_PUB_FILE,FileMetadata.FilCod);
break;
default:
break;

View File

@ -3831,12 +3831,12 @@ void For_RecForumPst (void)
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
}
/***** Insert post into public social activity *****/
/***** Insert forum post into public social activity *****/
switch (Gbl.Forum.ForumType) // Only if forum is public for any logged user
{
case For_FORUM_GLOBAL_USRS:
case For_FORUM_SWAD_USRS:
Soc_StoreSocialEvent (Soc_EVENT_FORUM_POST,PstCod);
Soc_StoreSocialNote (Soc_NOTE_FORUM_POST,PstCod);
break;
default:
break;

View File

@ -154,8 +154,8 @@ void Not_ReceiveNotice (void)
Not_UpdateNumUsrsNotifiedByEMailAboutNotice (NotCod,NumUsrsToBeNotifiedByEMail);
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
/***** Create a new social event about the new notice *****/
Soc_StoreSocialEvent (Soc_EVENT_NOTICE,NotCod);
/***** Create a new social note about the new notice *****/
Soc_StoreSocialNote (Soc_NOTE_NOTICE,NotCod);
}
/*****************************************************************************/

View File

@ -1,4 +1,4 @@
// swad_social.c: social networking
// swad_social.c: social networking (timeline)
/*
SWAD (Shared Workspace At a Distance),
@ -50,37 +50,37 @@
#define Soc_MAX_BYTES_SUMMARY 100
static const Act_Action_t Soc_DefaultActions[Soc_NUM_SOCIAL_EVENTS] =
static const Act_Action_t Soc_DefaultActions[Soc_NUM_SOCIAL_NOTES] =
{
ActUnk, // Soc_EVENT_UNKNOWN
ActUnk, // Soc_NOTE_UNKNOWN
/* Institution tab */
ActSeeDocIns, // Soc_EVENT_INS_DOC_PUB_FILE
ActAdmComIns, // Soc_EVENT_INS_SHA_PUB_FILE
ActSeeDocIns, // Soc_NOTE_INS_DOC_PUB_FILE
ActAdmComIns, // Soc_NOTE_INS_SHA_PUB_FILE
/* Centre tab */
ActSeeDocCtr, // Soc_EVENT_CTR_DOC_PUB_FILE
ActAdmComCtr, // Soc_EVENT_CTR_SHA_PUB_FILE
ActSeeDocCtr, // Soc_NOTE_CTR_DOC_PUB_FILE
ActAdmComCtr, // Soc_NOTE_CTR_SHA_PUB_FILE
/* Degree tab */
ActSeeDocDeg, // Soc_EVENT_DEG_DOC_PUB_FILE
ActAdmComDeg, // Soc_EVENT_DEG_SHA_PUB_FILE
ActSeeDocDeg, // Soc_NOTE_DEG_DOC_PUB_FILE
ActAdmComDeg, // Soc_NOTE_DEG_SHA_PUB_FILE
/* Course tab */
ActSeeDocCrs, // Soc_EVENT_CRS_DOC_PUB_FILE
ActAdmShaCrs, // Soc_EVENT_CRS_SHA_PUB_FILE
ActSeeDocCrs, // Soc_NOTE_CRS_DOC_PUB_FILE
ActAdmShaCrs, // Soc_NOTE_CRS_SHA_PUB_FILE
/* Assessment tab */
ActSeeExaAnn, // Soc_EVENT_EXAM_ANNOUNCEMENT
ActSeeExaAnn, // Soc_NOTE_EXAM_ANNOUNCEMENT
/* Users tab */
/* Social tab */
ActSeeSocAct, // Soc_EVENT_SOCIAL_POST (action not used)
ActSeeFor, // Soc_EVENT_FORUM_POST
ActSeeSocAct, // Soc_NOTE_SOCIAL_POST (action not used)
ActSeeFor, // Soc_NOTE_FORUM_POST
/* Messages tab */
ActShoNot, // Soc_EVENT_NOTICE
ActShoNot, // Soc_NOTE_NOTICE
/* Statistics tab */
@ -92,10 +92,10 @@ static const Act_Action_t Soc_DefaultActions[Soc_NUM_SOCIAL_EVENTS] =
/****************************** Internal types *******************************/
/*****************************************************************************/
struct SocialEvent
struct SocialNote
{
long SocCod;
Soc_SocialEvent_t SocialEvent;
Soc_SocialNote_t SocialNote;
long UsrCod;
long CtyCod;
long InsCod;
@ -121,24 +121,24 @@ extern struct Globals Gbl;
/*****************************************************************************/
static unsigned long Soc_ShowTimeline (const char *Query,Act_Action_t UpdateAction);
static Soc_SocialEvent_t Soc_GetSocialEventFromDB (const char *Str);
static void Soc_WriteSocialEvent (const struct SocialEvent *Soc,
static Soc_SocialNote_t Soc_GetSocialNoteFromDB (const char *Str);
static void Soc_WriteSocialNote (const struct SocialNote *Soc,
struct UsrData *UsrDat,
bool PutIconRemove);
static void Soc_WriteEventDate (time_t TimeUTC);
static void Soc_StartFormGoToAction (Soc_SocialEvent_t SocialEvent,
static void Soc_WriteNoteDate (time_t TimeUTC);
static void Soc_StartFormGoToAction (Soc_SocialNote_t SocialNote,
long CrsCod,long Cod);
static void Soc_GetEventSummary (const struct SocialEvent *Soc,
char *SummaryStr,unsigned MaxChars);
static void Soc_GetNoteSummary (const struct SocialNote *Soc,
char *SummaryStr,unsigned MaxChars);
static void Soc_PutLinkToWriteANewPost (void);
static void Soc_GetAndWriteSocialPost (long PstCod);
static void Soc_PutFormToRemoveSocialEvent (long SocCod);
static void Soc_PutFormToRemoveSocialNote (long SocCod);
static void Soc_PutHiddenParamSocCod (long SocCod);
static long Soc_GetParamSocCod (void);
static void Soc_GetDataOfSocialEventByCod (struct SocialEvent *Soc);
static void Soc_GetDataOfSocialEventFromRow (MYSQL_ROW row,struct SocialEvent *Soc);
static void Soc_GetDataOfSocialNoteByCod (struct SocialNote *Soc);
static void Soc_GetDataOfSocialNoteFromRow (MYSQL_ROW row,struct SocialNote *Soc);
/*****************************************************************************/
/*********** Show social activity (timeline) of a selected user **************/
@ -149,10 +149,10 @@ void Soc_ShowUsrTimeline (long UsrCod)
char Query[512];
/***** Build query to show timeline including the users I am following *****/
sprintf (Query,"SELECT SocCod,SocialEvent,UsrCod,"
sprintf (Query,"SELECT SocCod,SocialNote,UsrCod,"
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
"Cod,UNIX_TIMESTAMP(TimeEvent)"
" FROM social"
"Cod,UNIX_TIMESTAMP(TimeNote)"
" FROM social_notes"
" WHERE UsrCod='%ld'"
" ORDER BY SocCod DESC LIMIT 10",
UsrCod);
@ -169,7 +169,7 @@ void Soc_ShowFollowingTimeline (void)
{
char Query[512];
/***** Link to write a new social post *****/
/***** Link to write a new social post (public comment) *****/
if (Gbl.CurrentAct != ActReqSocPst)
Soc_PutLinkToWriteANewPost ();
@ -178,10 +178,10 @@ void Soc_ShowFollowingTimeline (void)
Lay_ShowAlert (Lay_INFO,"Usted no sigue a ningún usuario."); // Need translation!!!
/***** Build query to show timeline including the users I am following *****/
sprintf (Query,"SELECT SocCod,SocialEvent,UsrCod,"
sprintf (Query,"SELECT SocCod,SocialNote,UsrCod,"
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
"Cod,UNIX_TIMESTAMP(TimeEvent)"
" FROM social"
"Cod,UNIX_TIMESTAMP(TimeNote)"
" FROM social_notes"
" WHERE UsrCod IN"
" (SELECT '%ld'"
" UNION"
@ -205,16 +205,16 @@ static unsigned long Soc_ShowTimeline (const char *Query,Act_Action_t UpdateActi
extern const char *Txt_Public_activity;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned long NumEvents;
unsigned long NumEvent;
struct SocialEvent Soc;
unsigned long NumNotes;
unsigned long NumNote;
struct SocialNote Soc;
struct UsrData UsrDat;
/***** Get timeline from database *****/
NumEvents = DB_QuerySELECT (Query,&mysql_res,"can not get social events");
NumNotes = DB_QuerySELECT (Query,&mysql_res,"can not get social notes");
/***** List my timeline *****/
if (NumEvents) // Events found
if (NumNotes) // Notes found
{
/***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat);
@ -229,17 +229,17 @@ static unsigned long Soc_ShowTimeline (const char *Query,Act_Action_t UpdateActi
/***** Start list *****/
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
/***** List events one by one *****/
for (NumEvent = 0;
NumEvent < NumEvents;
NumEvent++)
/***** List notes one by one *****/
for (NumNote = 0;
NumNote < NumNotes;
NumNote++)
{
/* Get next social event */
/* Get next social note */
row = mysql_fetch_row (mysql_res);
Soc_GetDataOfSocialEventFromRow (row,&Soc);
Soc_GetDataOfSocialNoteFromRow (row,&Soc);
/* Write row for this social event */
Soc_WriteSocialEvent (&Soc,&UsrDat,true);
/* Write row for this social note */
Soc_WriteSocialNote (&Soc,&UsrDat,true);
}
/***** End list *****/
@ -255,34 +255,34 @@ static unsigned long Soc_ShowTimeline (const char *Query,Act_Action_t UpdateActi
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
return NumEvents;
return NumNotes;
}
/*****************************************************************************/
/****** Get social event type from string number coming from database ********/
/****** Get social note type from string number coming from database ********/
/*****************************************************************************/
static Soc_SocialEvent_t Soc_GetSocialEventFromDB (const char *Str)
static Soc_SocialNote_t Soc_GetSocialNoteFromDB (const char *Str)
{
unsigned UnsignedNum;
if (sscanf (Str,"%u",&UnsignedNum) == 1)
if (UnsignedNum < Soc_NUM_SOCIAL_EVENTS)
return (Soc_SocialEvent_t) UnsignedNum;
if (UnsignedNum < Soc_NUM_SOCIAL_NOTES)
return (Soc_SocialNote_t) UnsignedNum;
return Soc_EVENT_UNKNOWN;
return Soc_NOTE_UNKNOWN;
}
/*****************************************************************************/
/**************************** Write social event *****************************/
/**************************** Write social note ******************************/
/*****************************************************************************/
static void Soc_WriteSocialEvent (const struct SocialEvent *Soc,
static void Soc_WriteSocialNote (const struct SocialNote *Soc,
struct UsrData *UsrDat,
bool PutIconRemove)
{
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS];
extern const char *Txt_SOCIAL_NOTE[Soc_NUM_SOCIAL_NOTES];
extern const char *Txt_Forum;
extern const char *Txt_Course;
extern const char *Txt_Degree;
@ -325,7 +325,7 @@ static void Soc_WriteSocialEvent (const struct SocialEvent *Soc,
Crs_GetDataOfCourseByCod (&Crs);
/* Get forum type of the post */
if (Soc->SocialEvent == Soc_EVENT_FORUM_POST)
if (Soc->SocialNote == Soc_NOTE_FORUM_POST)
{
Gbl.Forum.ForumType = For_GetForumTypeOfAPost (Soc->Cod);
For_SetForumName (Gbl.Forum.ForumType,
@ -363,34 +363,34 @@ static void Soc_WriteSocialEvent (const struct SocialEvent *Soc,
UsrDat->FullName,UsrDat->Nickname);
/* Write date and time */
Soc_WriteEventDate (Soc->DateTimeUTC);
Soc_WriteNoteDate (Soc->DateTimeUTC);
if (Soc->SocialEvent == Soc_EVENT_SOCIAL_POST)
if (Soc->SocialNote == Soc_NOTE_SOCIAL_POST)
{
/* Write post content */
fprintf (Gbl.F.Out,"<div class=\"DAT\">");
Soc_GetAndWriteSocialPost (Soc->Cod);
fprintf (Gbl.F.Out,"</div>");
/* Write form to remove this event */
/* Write form to remove this note */
if (PutIconRemove &&
Gbl.Usrs.Me.Logged &&
UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author
Soc_PutFormToRemoveSocialEvent (Soc->SocCod);
Soc_PutFormToRemoveSocialNote (Soc->SocCod);
}
else
{
/* Write event type and location */
/* Write note type and location */
fprintf (Gbl.F.Out,"<div>");
Soc_StartFormGoToAction (Soc->SocialEvent,Crs.CrsCod,Soc->Cod);
Act_LinkFormSubmit (Txt_SOCIAL_EVENT[Soc->SocialEvent],
Soc_StartFormGoToAction (Soc->SocialNote,Crs.CrsCod,Soc->Cod);
Act_LinkFormSubmit (Txt_SOCIAL_NOTE[Soc->SocialNote],
The_ClassForm[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"%s</a>",
Txt_SOCIAL_EVENT[Soc->SocialEvent]);
Txt_SOCIAL_NOTE[Soc->SocialNote]);
Act_FormEnd ();
fprintf (Gbl.F.Out,"</div>");
if (Soc->SocialEvent == Soc_EVENT_FORUM_POST)
if (Soc->SocialNote == Soc_NOTE_FORUM_POST)
fprintf (Gbl.F.Out,"<div class=\"DAT\">%s: %s</div>",
Txt_Forum,ForumName);
else if (Crs.CrsCod > 0)
@ -409,8 +409,8 @@ static void Soc_WriteSocialEvent (const struct SocialEvent *Soc,
fprintf (Gbl.F.Out,"<div class=\"DAT\">%s: %s</div>",
Txt_Country,Cty.Name[Gbl.Prefs.Language]);
/* Write content of the event */
Soc_GetEventSummary (Soc,SummaryStr,Soc_MAX_BYTES_SUMMARY);
/* Write content of the note */
Soc_GetNoteSummary (Soc,SummaryStr,Soc_MAX_BYTES_SUMMARY);
fprintf (Gbl.F.Out,"<div class=\"DAT\">%s</div>",SummaryStr);
}
@ -422,11 +422,11 @@ static void Soc_WriteSocialEvent (const struct SocialEvent *Soc,
}
/*****************************************************************************/
/**************** Write the date of creation of a social event ***************/
/**************** Write the date of creation of a social note ***************/
/*****************************************************************************/
// TimeUTC holds UTC date and time in UNIX format (seconds since 1970)
static void Soc_WriteEventDate (time_t TimeUTC)
static void Soc_WriteNoteDate (time_t TimeUTC)
{
extern const char *Txt_Today;
static unsigned UniqueId = 0;
@ -450,10 +450,10 @@ static void Soc_WriteEventDate (time_t TimeUTC)
/*****************************************************************************/
/*********** Put form to go to an action depending on the event **************/
/********* Put form to go to an action depending on the social note **********/
/*****************************************************************************/
static void Soc_StartFormGoToAction (Soc_SocialEvent_t SocialEvent,
static void Soc_StartFormGoToAction (Soc_SocialNote_t SocialNote,
long CrsCod,long Cod)
{
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
@ -463,17 +463,17 @@ static void Soc_StartFormGoToAction (Soc_SocialEvent_t SocialEvent,
char FileName[NAME_MAX+1];
Act_Action_t Action = ActUnk; // Initialized to avoid warning
/***** Parameters depending on the type of event *****/
switch (SocialEvent)
/***** Parameters depending on the type of note *****/
switch (SocialNote)
{
case Soc_EVENT_INS_DOC_PUB_FILE:
case Soc_EVENT_INS_SHA_PUB_FILE:
case Soc_EVENT_CTR_DOC_PUB_FILE:
case Soc_EVENT_CTR_SHA_PUB_FILE:
case Soc_EVENT_DEG_DOC_PUB_FILE:
case Soc_EVENT_DEG_SHA_PUB_FILE:
case Soc_EVENT_CRS_DOC_PUB_FILE:
case Soc_EVENT_CRS_SHA_PUB_FILE:
case Soc_NOTE_INS_DOC_PUB_FILE:
case Soc_NOTE_INS_SHA_PUB_FILE:
case Soc_NOTE_CTR_DOC_PUB_FILE:
case Soc_NOTE_CTR_SHA_PUB_FILE:
case Soc_NOTE_DEG_DOC_PUB_FILE:
case Soc_NOTE_DEG_SHA_PUB_FILE:
case Soc_NOTE_CRS_DOC_PUB_FILE:
case Soc_NOTE_CRS_SHA_PUB_FILE:
if (Cod > 0) // File code
{
FileMetadata.FilCod = Cod;
@ -483,30 +483,30 @@ static void Soc_StartFormGoToAction (Soc_SocialEvent_t SocialEvent,
PathUntilFileName,
FileName);
}
switch (SocialEvent)
switch (SocialNote)
{
case Soc_EVENT_INS_DOC_PUB_FILE:
case Soc_NOTE_INS_DOC_PUB_FILE:
Action = (Cod > 0) ? ActReqDatSeeDocIns : ActSeeDocIns;
break;
case Soc_EVENT_INS_SHA_PUB_FILE:
case Soc_NOTE_INS_SHA_PUB_FILE:
Action = (Cod > 0) ? ActReqDatShaIns : ActAdmComIns;
break;
case Soc_EVENT_CTR_DOC_PUB_FILE:
case Soc_NOTE_CTR_DOC_PUB_FILE:
Action = (Cod > 0) ? ActReqDatSeeDocCtr : ActSeeDocCtr;
break;
case Soc_EVENT_CTR_SHA_PUB_FILE:
case Soc_NOTE_CTR_SHA_PUB_FILE:
Action = (Cod > 0) ? ActReqDatShaCtr : ActAdmComCtr;
break;
case Soc_EVENT_DEG_DOC_PUB_FILE:
case Soc_NOTE_DEG_DOC_PUB_FILE:
Action = (Cod > 0) ? ActReqDatSeeDocDeg : ActSeeDocDeg;
break;
case Soc_EVENT_DEG_SHA_PUB_FILE:
case Soc_NOTE_DEG_SHA_PUB_FILE:
Action = (Cod > 0) ? ActReqDatShaDeg : ActAdmComDeg;
break;
case Soc_EVENT_CRS_DOC_PUB_FILE:
case Soc_NOTE_CRS_DOC_PUB_FILE:
Action = (Cod > 0) ? ActReqDatSeeDocCrs : ActSeeDocCrs;
break;
case Soc_EVENT_CRS_SHA_PUB_FILE:
case Soc_NOTE_CRS_SHA_PUB_FILE:
Action = (Cod > 0) ? ActReqDatShaCrs : ActAdmShaCrs;
break;
default: // Not aplicable here
@ -517,16 +517,16 @@ static void Soc_StartFormGoToAction (Soc_SocialEvent_t SocialEvent,
if (Cod > 0) // File code
Brw_PutParamsPathAndFile (Brw_IS_FILE,PathUntilFileName,FileName);
break;
case Soc_EVENT_NOTICE:
Act_FormStart (Soc_DefaultActions[SocialEvent]);
case Soc_NOTE_NOTICE:
Act_FormStart (Soc_DefaultActions[SocialNote]);
Not_PutHiddenParamNotCod (Cod);
break;
case Soc_EVENT_FORUM_POST:
case Soc_NOTE_FORUM_POST:
Act_FormStart (For_ActionsSeeFor[Gbl.Forum.ForumType]);
For_PutAllHiddenParamsForum ();
break;
default:
Act_FormStart (Soc_DefaultActions[SocialEvent]);
Act_FormStart (Soc_DefaultActions[SocialNote]);
break;
}
@ -537,48 +537,48 @@ static void Soc_StartFormGoToAction (Soc_SocialEvent_t SocialEvent,
}
/*****************************************************************************/
/******************* Get social event summary and content ********************/
/******************* Get social note summary and content ********************/
/*****************************************************************************/
static void Soc_GetEventSummary (const struct SocialEvent *Soc,
char *SummaryStr,unsigned MaxChars)
static void Soc_GetNoteSummary (const struct SocialNote *Soc,
char *SummaryStr,unsigned MaxChars)
{
SummaryStr[0] = '\0';
switch (Soc->SocialEvent)
switch (Soc->SocialNote)
{
case Soc_EVENT_UNKNOWN:
case Soc_NOTE_UNKNOWN:
break;
case Soc_EVENT_INS_DOC_PUB_FILE:
case Soc_EVENT_INS_SHA_PUB_FILE:
case Soc_EVENT_CTR_DOC_PUB_FILE:
case Soc_EVENT_CTR_SHA_PUB_FILE:
case Soc_EVENT_DEG_DOC_PUB_FILE:
case Soc_EVENT_DEG_SHA_PUB_FILE:
case Soc_EVENT_CRS_DOC_PUB_FILE:
case Soc_EVENT_CRS_SHA_PUB_FILE:
case Soc_NOTE_INS_DOC_PUB_FILE:
case Soc_NOTE_INS_SHA_PUB_FILE:
case Soc_NOTE_CTR_DOC_PUB_FILE:
case Soc_NOTE_CTR_SHA_PUB_FILE:
case Soc_NOTE_DEG_DOC_PUB_FILE:
case Soc_NOTE_DEG_SHA_PUB_FILE:
case Soc_NOTE_CRS_DOC_PUB_FILE:
case Soc_NOTE_CRS_SHA_PUB_FILE:
Brw_GetSummaryAndContentOrSharedFile (SummaryStr,NULL,Soc->Cod,MaxChars,false);
break;
case Soc_EVENT_EXAM_ANNOUNCEMENT:
case Soc_NOTE_EXAM_ANNOUNCEMENT:
Exa_GetSummaryAndContentExamAnnouncement (SummaryStr,NULL,Soc->Cod,MaxChars,false);
break;
case Soc_EVENT_SOCIAL_POST:
case Soc_NOTE_SOCIAL_POST:
// Not applicable
break;
case Soc_EVENT_FORUM_POST:
case Soc_NOTE_FORUM_POST:
For_GetSummaryAndContentForumPst (SummaryStr,NULL,Soc->Cod,MaxChars,false);
break;
case Soc_EVENT_NOTICE:
case Soc_NOTE_NOTICE:
Not_GetSummaryAndContentNotice (SummaryStr,NULL,Soc->Cod,MaxChars,false);
break;
}
}
/*****************************************************************************/
/********************* Store a social event into database ********************/
/********************* Store a social note into database ********************/
/*****************************************************************************/
void Soc_StoreSocialEvent (Soc_SocialEvent_t SocialEvent,long Cod)
void Soc_StoreSocialNote (Soc_SocialNote_t SocialNote,long Cod)
{
char Query[512];
long CtyCod;
@ -587,7 +587,7 @@ void Soc_StoreSocialEvent (Soc_SocialEvent_t SocialEvent,long Cod)
long DegCod;
long CrsCod;
if (SocialEvent == Soc_EVENT_FORUM_POST)
if (SocialNote == Soc_NOTE_FORUM_POST)
{
// CtyCod = Gbl.Forum.Cty.CtyCod;
// InsCod = Gbl.Forum.Ins.InsCod;
@ -609,17 +609,17 @@ void Soc_StoreSocialEvent (Soc_SocialEvent_t SocialEvent,long Cod)
CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
}
/***** Store notify event *****/
sprintf (Query,"INSERT INTO social (SocialEvent,UsrCod,"
/***** Store social note *****/
sprintf (Query,"INSERT INTO social_notes (SocialNote,UsrCod,"
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
"Cod,TimeEvent)"
"Cod,TimeNote)"
" VALUES ('%u','%ld',"
"'%ld','%ld','%ld','%ld','%ld',"
"'%ld',NOW())",
(unsigned) SocialEvent,Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) SocialNote,Gbl.Usrs.Me.UsrDat.UsrCod,
CtyCod,InsCod,CtrCod,DegCod,CrsCod,
Cod);
DB_QueryINSERT (Query,"can not create new social event");
DB_QueryINSERT (Query,"can not create new social note");
}
/*****************************************************************************/
@ -686,12 +686,12 @@ void Soc_ReceiveSocialPost (void)
Str_TO_RIGOROUS_HTML,true);
/* Insert post content in the database */
sprintf (Query,"INSERT INTO social_post (Content) VALUES ('%s')",
sprintf (Query,"INSERT INTO social_posts (Content) VALUES ('%s')",
Content);
PstCod = DB_QueryINSERTandReturnCode (Query,"can not create post");
/* Insert post in social events */
Soc_StoreSocialEvent (Soc_EVENT_SOCIAL_POST,PstCod);
/* Insert post in social notes */
Soc_StoreSocialNote (Soc_NOTE_SOCIAL_POST,PstCod);
/***** Write current timeline *****/
Soc_ShowFollowingTimeline ();
@ -710,7 +710,7 @@ static void Soc_GetAndWriteSocialPost (long PstCod)
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
/***** Get social post from database *****/
sprintf (Query,"SELECT Content FROM social_post WHERE PstCod='%ld'",
sprintf (Query,"SELECT Content FROM social_posts WHERE PstCod='%ld'",
PstCod);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get the content of a social post");
@ -735,15 +735,15 @@ static void Soc_GetAndWriteSocialPost (long PstCod)
}
/*****************************************************************************/
/*********************** Form to remove social event *************************/
/*********************** Form to remove social note *************************/
/*****************************************************************************/
static void Soc_PutFormToRemoveSocialEvent (long SocCod)
static void Soc_PutFormToRemoveSocialNote (long SocCod)
{
extern const char *Txt_Remove;
/***** Form to remove social post *****/
Act_FormStart (ActReqRemSocEvn);
Act_FormStart (ActReqRemSocNot);
Soc_PutHiddenParamSocCod (SocCod);
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT ICON_HIGHLIGHT\">"
"<input type=\"image\""
@ -758,7 +758,7 @@ static void Soc_PutFormToRemoveSocialEvent (long SocCod)
}
/*****************************************************************************/
/************** Put parameter with the code of a social event ****************/
/************** Put parameter with the code of a social note ****************/
/*****************************************************************************/
static void Soc_PutHiddenParamSocCod (long SocCod)
@ -767,43 +767,43 @@ static void Soc_PutHiddenParamSocCod (long SocCod)
}
/*****************************************************************************/
/************** Get parameter with the code of a social event ****************/
/************** Get parameter with the code of a social note ****************/
/*****************************************************************************/
static long Soc_GetParamSocCod (void)
{
char LongStr[1+10+1]; // String that holds the social event code
char LongStr[1+10+1]; // String that holds the social note code
long SocCod;
/* Get social event code */
/* Get social note code */
Par_GetParToText ("SocCod",LongStr,1+10);
if (sscanf (LongStr,"%ld",&SocCod) != 1)
Lay_ShowErrorAndExit ("Wrong code of social event.");
Lay_ShowErrorAndExit ("Wrong code of social note.");
return SocCod;
}
/*****************************************************************************/
/******************* Request the removal of a social event *******************/
/******************* Request the removal of a social note *******************/
/*****************************************************************************/
void Soc_RequestRemovalSocialEvent (void)
void Soc_RequestRemovalSocialNote (void)
{
extern const char *Txt_Do_you_really_want_to_remove_the_following_comment;
extern const char *Txt_Remove;
struct SocialEvent Soc;
struct SocialNote Soc;
bool ICanRemove;
struct UsrData UsrDat;
/***** Get the code of the social event to remove *****/
/***** Get the code of the social note to remove *****/
Soc.SocCod = Soc_GetParamSocCod ();
/***** Get data of social event *****/
Soc_GetDataOfSocialEventByCod (&Soc);
/***** Get data of social note *****/
Soc_GetDataOfSocialNoteByCod (&Soc);
ICanRemove = (Gbl.Usrs.Me.Logged &&
Soc.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
Soc.SocialEvent == Soc_EVENT_SOCIAL_POST);
Soc.SocialNote == Soc_NOTE_SOCIAL_POST);
if (ICanRemove)
{
/***** Initialize structure with user's data *****/
@ -811,14 +811,14 @@ void Soc_RequestRemovalSocialEvent (void)
/***** Form to ask for confirmation to remove this social post *****/
/* Start form */
Act_FormStart (ActRemSocEvn);
Act_FormStart (ActRemSocNot);
Soc_PutHiddenParamSocCod (Soc.SocCod);
Lay_ShowAlert (Lay_WARNING,Txt_Do_you_really_want_to_remove_the_following_comment);
/* Show social event */
/* Show social note */
Lay_StartRoundFrame ("560px",NULL);
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
Soc_WriteSocialEvent (&Soc,&UsrDat,false);
Soc_WriteSocialNote (&Soc,&UsrDat,false);
fprintf (Gbl.F.Out,"</ul>");
Lay_EndRoundFrame ();
@ -835,35 +835,37 @@ void Soc_RequestRemovalSocialEvent (void)
}
/*****************************************************************************/
/************************** Remove a social event ****************************/
/************************** Remove a social note ****************************/
/*****************************************************************************/
void Soc_RemoveSocialEvent (void)
void Soc_RemoveSocialNote (void)
{
extern const char *Txt_Comment_removed;
struct SocialEvent Soc;
struct SocialNote Soc;
bool ICanRemove;
char Query[128];
/***** Get the code of the social event to remove *****/
/***** Get the code of the social note to remove *****/
Soc.SocCod = Soc_GetParamSocCod ();
/***** Get data of social event *****/
Soc_GetDataOfSocialEventByCod (&Soc);
/***** Get data of social note *****/
Soc_GetDataOfSocialNoteByCod (&Soc);
ICanRemove = (Gbl.Usrs.Me.Logged &&
Soc.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
Soc.SocialEvent == Soc_EVENT_SOCIAL_POST);
Soc.SocialNote == Soc_NOTE_SOCIAL_POST);
if (ICanRemove)
{
/***** Remove social event *****/
sprintf (Query,"DELETE FROM social WHERE SocCod='%ld'",Soc.SocCod);
DB_QueryDELETE (Query,"can not remove a social event");
/***** Remove social note *****/
sprintf (Query,"DELETE FROM social_notes WHERE SocCod='%ld'",
Soc.SocCod);
DB_QueryDELETE (Query,"can not remove a social note");
/***** Remove social post *****/
if (Soc.SocialEvent == Soc_EVENT_SOCIAL_POST)
if (Soc.SocialNote == Soc_NOTE_SOCIAL_POST)
{
sprintf (Query,"DELETE FROM social_post WHERE PstCod='%ld'",Soc.Cod);
sprintf (Query,"DELETE FROM social_posts WHERE PstCod='%ld'",
Soc.Cod);
DB_QueryDELETE (Query,"can not remove a social post");
}
@ -879,29 +881,29 @@ void Soc_RemoveSocialEvent (void)
/******************* Get assignment data using its code **********************/
/*****************************************************************************/
static void Soc_GetDataOfSocialEventByCod (struct SocialEvent *Soc)
static void Soc_GetDataOfSocialNoteByCod (struct SocialNote *Soc)
{
char Query[256];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
/***** Get data of social event from database *****/
sprintf (Query,"SELECT SocCod,SocialEvent,UsrCod,"
/***** Get data of social note from database *****/
sprintf (Query,"SELECT SocCod,SocialNote,UsrCod,"
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
"Cod,UNIX_TIMESTAMP(TimeEvent)"
" FROM social"
"Cod,UNIX_TIMESTAMP(TimeNote)"
" FROM social_notes"
" WHERE SocCod='%ld'",
Soc->SocCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of social event"))
if (DB_QuerySELECT (Query,&mysql_res,"can not get data of social note"))
{
/***** Get social event *****/
/***** Get social note *****/
row = mysql_fetch_row (mysql_res);
Soc_GetDataOfSocialEventFromRow (row,Soc);
Soc_GetDataOfSocialNoteFromRow (row,Soc);
}
else
{
/***** Reset fields of social event *****/
Soc->SocialEvent = Soc_EVENT_UNKNOWN;
/***** Reset fields of social note *****/
Soc->SocialNote = Soc_NOTE_UNKNOWN;
Soc->UsrCod = -1L;
Soc->CtyCod =
Soc->InsCod =
@ -917,13 +919,13 @@ static void Soc_GetDataOfSocialEventByCod (struct SocialEvent *Soc)
/******************* Get assignment data using its code **********************/
/*****************************************************************************/
static void Soc_GetDataOfSocialEventFromRow (MYSQL_ROW row,struct SocialEvent *Soc)
static void Soc_GetDataOfSocialNoteFromRow (MYSQL_ROW row,struct SocialNote *Soc)
{
/* Get social code (row[0]) */
Soc->SocCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get event type (row[1]) */
Soc->SocialEvent = Soc_GetSocialEventFromDB ((const char *) row[1]);
/* Get note type (row[1]) */
Soc->SocialNote = Soc_GetSocialNoteFromDB ((const char *) row[1]);
/* Get (from) user code (row[2]) */
Soc->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
@ -946,6 +948,6 @@ static void Soc_GetDataOfSocialEventFromRow (MYSQL_ROW row,struct SocialEvent *S
/* Get file/post... code (row[8]) */
Soc->Cod = Str_ConvertStrCodToLongCod (row[8]);
/* Get time of the event (row[9]) */
/* Get time of the note (row[9]) */
Soc->DateTimeUTC = Dat_GetUNIXTimeFromStr (row[9]);
}

View File

@ -1,4 +1,4 @@
// swad_social.c: social networking
// swad_social.c: social networking (timeline)
#ifndef _SWAD_SOC
#define _SWAD_SOC
@ -35,47 +35,47 @@
/******************************** Public types *******************************/
/*****************************************************************************/
#define Soc_NUM_SOCIAL_EVENTS 13
#define Soc_NUM_SOCIAL_NOTES 13
// If the numbers assigned to each event type change,
// it is necessary to change old numbers to new ones in database table social
// it is necessary to change old numbers to new ones in database table social_notes
typedef enum
{
Soc_EVENT_UNKNOWN = 0,
Soc_NOTE_UNKNOWN = 0,
/* Institution tab */
Soc_EVENT_INS_DOC_PUB_FILE = 1,
Soc_EVENT_INS_SHA_PUB_FILE = 2,
Soc_NOTE_INS_DOC_PUB_FILE = 1,
Soc_NOTE_INS_SHA_PUB_FILE = 2,
/* Centre tab */
Soc_EVENT_CTR_DOC_PUB_FILE = 3,
Soc_EVENT_CTR_SHA_PUB_FILE = 4,
Soc_NOTE_CTR_DOC_PUB_FILE = 3,
Soc_NOTE_CTR_SHA_PUB_FILE = 4,
/* Degree tab */
Soc_EVENT_DEG_DOC_PUB_FILE = 5,
Soc_EVENT_DEG_SHA_PUB_FILE = 6,
Soc_NOTE_DEG_DOC_PUB_FILE = 5,
Soc_NOTE_DEG_SHA_PUB_FILE = 6,
/* Course tab */
Soc_EVENT_CRS_DOC_PUB_FILE = 7,
Soc_EVENT_CRS_SHA_PUB_FILE = 8,
Soc_NOTE_CRS_DOC_PUB_FILE = 7,
Soc_NOTE_CRS_SHA_PUB_FILE = 8,
/* Assessment tab */
Soc_EVENT_EXAM_ANNOUNCEMENT = 9,
Soc_NOTE_EXAM_ANNOUNCEMENT = 9,
/* Users tab */
/* Social tab */
Soc_EVENT_SOCIAL_POST = 10,
Soc_EVENT_FORUM_POST = 11,
Soc_NOTE_SOCIAL_POST = 10,
Soc_NOTE_FORUM_POST = 11,
/* Messages tab */
Soc_EVENT_NOTICE = 12,
Soc_NOTE_NOTICE = 12,
/* Statistics tab */
/* Profile tab */
} Soc_SocialEvent_t;
} Soc_SocialNote_t;
/*****************************************************************************/
/****************************** Public prototypes ****************************/
@ -84,12 +84,12 @@ typedef enum
void Soc_ShowUsrTimeline (long UsrCod);
void Soc_ShowFollowingTimeline (void);
void Soc_StoreSocialEvent (Soc_SocialEvent_t SocialEvent,long Cod);
void Soc_StoreSocialNote (Soc_SocialNote_t SocialNote,long Cod);
void Soc_FormSocialPost (void);
void Soc_ReceiveSocialPost (void);
void Soc_RequestRemovalSocialEvent (void);
void Soc_RemoveSocialEvent (void);
void Soc_RequestRemovalSocialNote (void);
void Soc_RemoveSocialNote (void);
#endif

View File

@ -35247,9 +35247,9 @@ const char *Txt_Size_of_photos =
"Tamanho das fotos";
#endif
const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
const char *Txt_SOCIAL_NOTE[Soc_NUM_SOCIAL_NOTES] =
{
#if L==1 // Soc_EVENT_UNKNOWN
#if L==1 // Soc_NOTE_UNKNOWN
"Esdeveniment desconegut"
#elif L==2
"Unbekannt Ereignis"
@ -35269,7 +35269,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Evento desconhecido"
#endif
,
#if L==1 // Soc_EVENT_INS_DOC_PUB_FILE
#if L==1 // Soc_NOTE_INS_DOC_PUB_FILE
"Document p&uacute;blic"
#elif L==2
"&Ouml;ffentliche Dokumentdatei"
@ -35289,7 +35289,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Arquivo de documento p&uacute;blico"
#endif
,
#if L==1 // Soc_EVENT_INS_SHA_PUB_FILE
#if L==1 // Soc_NOTE_INS_SHA_PUB_FILE
"Arxiu compartit p&uacute;blic"
#elif L==2
"&Ouml;ffentliche Freigegebene Datei"
@ -35309,7 +35309,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Arquivo compartilhado p&uacute;blico"
#endif
,
#if L==1 // Soc_EVENT_CTR_DOC_PUB_FILE
#if L==1 // Soc_NOTE_CTR_DOC_PUB_FILE
"Document p&uacute;blic"
#elif L==2
"&Ouml;ffentliche Dokumentdatei"
@ -35329,7 +35329,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Arquivo de documento p&uacute;blico"
#endif
,
#if L==1 // Soc_EVENT_CTR_SHA_PUB_FILE
#if L==1 // Soc_NOTE_CTR_SHA_PUB_FILE
"Arxiu compartit p&uacute;blic"
#elif L==2
"&Ouml;ffentliche Freigegebene Datei"
@ -35349,7 +35349,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Arquivo compartilhado p&uacute;blico"
#endif
,
#if L==1 // Soc_EVENT_DEG_DOC_PUB_FILE
#if L==1 // Soc_NOTE_DEG_DOC_PUB_FILE
"Document p&uacute;blic"
#elif L==2
"&Ouml;ffentliche Dokumentdatei"
@ -35369,7 +35369,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Arquivo de documento p&uacute;blico"
#endif
,
#if L==1 // Soc_EVENT_DEG_SHA_PUB_FILE
#if L==1 // Soc_NOTE_DEG_SHA_PUB_FILE
"Arxiu compartit p&uacute;blic"
#elif L==2
"&Ouml;ffentliche Freigegebene Datei"
@ -35389,7 +35389,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Arquivo compartilhado p&uacute;blico"
#endif
,
#if L==1 // Soc_EVENT_CRS_DOC_PUB_FILE
#if L==1 // Soc_NOTE_CRS_DOC_PUB_FILE
"Document p&uacute;blic"
#elif L==2
"&Ouml;ffentliche Dokumentdatei"
@ -35409,7 +35409,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Arquivo de documento p&uacute;blico"
#endif
,
#if L==1 // Soc_EVENT_CRS_SHA_PUB_FILE
#if L==1 // Soc_NOTE_CRS_SHA_PUB_FILE
"Arxiu compartit p&uacute;blic"
#elif L==2
"&Ouml;ffentliche Freigegebene Datei"
@ -35429,7 +35429,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Arquivo compartilhado p&uacute;blico"
#endif
,
#if L==1 // Soc_EVENT_EXAM_ANNOUNCEMENT
#if L==1 // Soc_NOTE_EXAM_ANNOUNCEMENT
"Convocat&ograve;ria d'examen"
#elif L==2
"Aufrufe für Pr&uuml;fung"
@ -35449,7 +35449,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Chamada para exame"
#endif
,
#if L==1 // Soc_EVENT_SOCIAL_POST (not used)
#if L==1 // Soc_NOTE_SOCIAL_POST (not used)
"Comentari"
#elif L==2
"Kommentar"
@ -35469,7 +35469,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Coment&aacute;rio"
#endif
,
#if L==1 // Soc_EVENT_FORUM_POST
#if L==1 // Soc_NOTE_FORUM_POST
"Missatge en un f&ograve;rum"
#elif L==2
"Beitr&auml;ge in einem Forum"
@ -35489,7 +35489,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
"Post em um f&oacute;rum"
#endif
,
#if L==1 // Soc_EVENT_NOTICE
#if L==1 // Soc_NOTE_NOTICE
"Av&iacute;s"
#elif L==2
"Ank&uuml;ndigungen"