mirror of https://github.com/acanas/swad-core.git
Version 15.86
This commit is contained in:
parent
5a1ab2cc36
commit
4964a9913d
12
sql/swad.sql
12
sql/swad.sql
|
@ -917,7 +917,7 @@ CREATE TABLE IF NOT EXISTS sessions (
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS social (
|
CREATE TABLE IF NOT EXISTS social (
|
||||||
SocCod BIGINT NOT NULL AUTO_INCREMENT,
|
SocCod BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
SocialEvent TINYINT NOT NULL,
|
SocialNote TINYINT NOT NULL,
|
||||||
UsrCod INT NOT NULL,
|
UsrCod INT NOT NULL,
|
||||||
CtyCod INT NOT NULL DEFAULT -1,
|
CtyCod INT NOT NULL DEFAULT -1,
|
||||||
InsCod 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,
|
DegCod INT NOT NULL DEFAULT -1,
|
||||||
CrsCod INT NOT NULL DEFAULT -1,
|
CrsCod INT NOT NULL DEFAULT -1,
|
||||||
Cod INT NOT NULL DEFAULT -1,
|
Cod INT NOT NULL DEFAULT -1,
|
||||||
TimeEvent DATETIME NOT NULL,
|
TimeNote DATETIME NOT NULL,
|
||||||
UNIQUE INDEX(SocCod),
|
UNIQUE INDEX(SocCod),
|
||||||
INDEX(SocialEvent),
|
INDEX(SocialNote),
|
||||||
INDEX(UsrCod),
|
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,
|
PstCod INT NOT NULL AUTO_INCREMENT,
|
||||||
Content LONGTEXT NOT NULL,
|
Content LONGTEXT NOT NULL,
|
||||||
UNIQUE INDEX(PstCod),
|
UNIQUE INDEX(PstCod),
|
||||||
|
|
|
@ -1004,8 +1004,8 @@ Social:
|
||||||
|
|
||||||
839. ActReqSocPst Write a public social post to be displayed in the timeline
|
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
|
840. ActRcvSocPst Receive a public social post to be displayed in the timeline
|
||||||
841. ActReqRemSocEvn Request the removal of a social event
|
841. ActReqRemSocNot Request the removal of a social note (only if it is a post)
|
||||||
842. ActRemSocEvn Remove a social event
|
842. ActRemSocNot Remove a social note (only if it is a post)
|
||||||
843. ActSeePubPrf Show a public user's profile
|
843. ActSeePubPrf Show a public user's profile
|
||||||
844. ActCal1stClkTim Calculate first click time from log and store into user's figures
|
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
|
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},
|
/* 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},
|
/* 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},
|
/* ActReqRemSocNot */{1494,-1,TabSoc,ActSeeSocAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemovalSocialNote ,NULL},
|
||||||
/* ActRemSocEvn */{1493,-1,TabSoc,ActSeeSocAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialEvent ,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},
|
/* 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},
|
/* 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
|
ActSeeSocAct, // #1490
|
||||||
ActReqSocPst, // #1491
|
ActReqSocPst, // #1491
|
||||||
ActRcvSocPst, // #1492
|
ActRcvSocPst, // #1492
|
||||||
ActRemSocEvn, // #1493
|
ActRemSocNot, // #1493
|
||||||
ActReqRemSocEvn, // #1494
|
ActReqRemSocNot, // #1494
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -1043,8 +1043,8 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
|
||||||
// Secondary actions
|
// Secondary actions
|
||||||
#define ActReqSocPst (ActLstClk+ 5)
|
#define ActReqSocPst (ActLstClk+ 5)
|
||||||
#define ActRcvSocPst (ActLstClk+ 6)
|
#define ActRcvSocPst (ActLstClk+ 6)
|
||||||
#define ActReqRemSocEvn (ActLstClk+ 7)
|
#define ActReqRemSocNot (ActLstClk+ 7)
|
||||||
#define ActRemSocEvn (ActLstClk+ 8)
|
#define ActRemSocNot (ActLstClk+ 8)
|
||||||
|
|
||||||
#define ActSeePubPrf (ActLstClk+ 9)
|
#define ActSeePubPrf (ActLstClk+ 9)
|
||||||
#define ActCal1stClkTim (ActLstClk+ 10)
|
#define ActCal1stClkTim (ActLstClk+ 10)
|
||||||
|
|
|
@ -111,18 +111,30 @@
|
||||||
// TODO: Reply to all
|
// TODO: Reply to all
|
||||||
// TODO: Hour in exam announcement should start at six a.m.
|
// 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: 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 *****************************/
|
/****************************** 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 CSS_FILE "swad15.84.2.css"
|
||||||
#define JS_FILE "swad15.77.7.js"
|
#define JS_FILE "swad15.77.7.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// 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.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.5: Dec 30, 2015 Form to update connected users. (189430 lines)
|
||||||
Version 15.84.4: Dec 30, 2015 Code refactoring in profile. (189427 lines)
|
Version 15.84.4: Dec 30, 2015 Code refactoring in profile. (189427 lines)
|
||||||
|
|
|
@ -1935,28 +1935,28 @@ mysql> DESCRIBE sessions;
|
||||||
"UNIQUE INDEX(SessionId),"
|
"UNIQUE INDEX(SessionId),"
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
/***** Table social *****/
|
/***** Table social_notes *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE social;
|
mysql> DESCRIBE social_notes;
|
||||||
+-------------+------------+------+-----+---------+----------------+
|
+------------+------------+------+-----+---------+----------------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+-------------+------------+------+-----+---------+----------------+
|
+------------+------------+------+-----+---------+----------------+
|
||||||
| SocCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
| SocCod | bigint(20) | NO | PRI | NULL | auto_increment |
|
||||||
| SocialEvent | tinyint(4) | NO | MUL | NULL | |
|
| SocialNote | tinyint(4) | NO | MUL | NULL | |
|
||||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||||
| CtyCod | int(11) | NO | | -1 | |
|
| CtyCod | int(11) | NO | | -1 | |
|
||||||
| InsCod | int(11) | NO | | -1 | |
|
| InsCod | int(11) | NO | | -1 | |
|
||||||
| CtrCod | int(11) | NO | | -1 | |
|
| CtrCod | int(11) | NO | | -1 | |
|
||||||
| DegCod | int(11) | NO | | -1 | |
|
| DegCod | int(11) | NO | | -1 | |
|
||||||
| CrsCod | int(11) | NO | | -1 | |
|
| CrsCod | int(11) | NO | | -1 | |
|
||||||
| Cod | int(11) | NO | | -1 | |
|
| Cod | int(11) | NO | | -1 | |
|
||||||
| TimeEvent | datetime | NO | MUL | NULL | |
|
| TimeNote | datetime | NO | MUL | NULL | |
|
||||||
+-------------+------------+------+-----+---------+----------------+
|
+------------+------------+------+-----+---------+----------------+
|
||||||
10 rows in set (0.00 sec)
|
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,"
|
"SocCod BIGINT NOT NULL AUTO_INCREMENT,"
|
||||||
"SocialEvent TINYINT NOT NULL,"
|
"SocialNote TINYINT NOT NULL,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"CtyCod INT NOT NULL DEFAULT -1,"
|
"CtyCod INT NOT NULL DEFAULT -1,"
|
||||||
"InsCod INT NOT NULL DEFAULT -1,"
|
"InsCod INT NOT NULL DEFAULT -1,"
|
||||||
|
@ -1964,15 +1964,15 @@ mysql> DESCRIBE social;
|
||||||
"DegCod INT NOT NULL DEFAULT -1,"
|
"DegCod INT NOT NULL DEFAULT -1,"
|
||||||
"CrsCod INT NOT NULL DEFAULT -1,"
|
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||||
"Cod INT NOT NULL DEFAULT -1,"
|
"Cod INT NOT NULL DEFAULT -1,"
|
||||||
"TimeEvent DATETIME NOT NULL,"
|
"TimeNote DATETIME NOT NULL,"
|
||||||
"UNIQUE INDEX(SocCod),"
|
"UNIQUE INDEX(SocCod),"
|
||||||
"INDEX(SocialEvent),"
|
"INDEX(SocialNote),"
|
||||||
"INDEX(UsrCod),"
|
"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 |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+---------+----------+------+-----+---------+----------------+
|
+---------+----------+------+-----+---------+----------------+
|
||||||
|
@ -1981,7 +1981,7 @@ mysql> DESCRIBE social_post;
|
||||||
+---------+----------+------+-----+---------+----------------+
|
+---------+----------+------+-----+---------+----------------+
|
||||||
2 rows in set (0.00 sec)
|
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,"
|
"PstCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
"Content LONGTEXT NOT NULL,"
|
"Content LONGTEXT NOT NULL,"
|
||||||
"UNIQUE INDEX(PstCod),"
|
"UNIQUE INDEX(PstCod),"
|
||||||
|
|
|
@ -305,8 +305,8 @@ void Exa_ReceiveExamAnnouncement (void)
|
||||||
Exa_UpdateNumUsrsNotifiedByEMailAboutExamAnnouncement (ExaCod,NumUsrsToBeNotifiedByEMail);
|
Exa_UpdateNumUsrsNotifiedByEMailAboutExamAnnouncement (ExaCod,NumUsrsToBeNotifiedByEMail);
|
||||||
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
|
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
|
||||||
|
|
||||||
/***** Create a new social event about the new exam announcement *****/
|
/***** Create a new social note about the new exam announcement *****/
|
||||||
Soc_StoreSocialEvent (Soc_EVENT_EXAM_ANNOUNCEMENT,ExaCod);
|
Soc_StoreSocialNote (Soc_NOTE_EXAM_ANNOUNCEMENT,ExaCod);
|
||||||
|
|
||||||
/***** Show exam announcement *****/
|
/***** Show exam announcement *****/
|
||||||
Exa_ListExamAnnouncementsEdit ();
|
Exa_ListExamAnnouncementsEdit ();
|
||||||
|
|
|
@ -9684,28 +9684,28 @@ void Brw_ChgFileMetadata (void)
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
{
|
{
|
||||||
case Brw_ADMI_DOCUM_INS:
|
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;
|
break;
|
||||||
case Brw_ADMI_SHARE_INS:
|
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;
|
break;
|
||||||
case Brw_ADMI_DOCUM_CTR:
|
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;
|
break;
|
||||||
case Brw_ADMI_SHARE_CTR:
|
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;
|
break;
|
||||||
case Brw_ADMI_DOCUM_DEG:
|
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;
|
break;
|
||||||
case Brw_ADMI_SHARE_DEG:
|
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;
|
break;
|
||||||
case Brw_ADMI_DOCUM_CRS:
|
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;
|
break;
|
||||||
case Brw_ADMI_SHARE_CRS:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3831,12 +3831,12 @@ void For_RecForumPst (void)
|
||||||
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
|
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
|
switch (Gbl.Forum.ForumType) // Only if forum is public for any logged user
|
||||||
{
|
{
|
||||||
case For_FORUM_GLOBAL_USRS:
|
case For_FORUM_GLOBAL_USRS:
|
||||||
case For_FORUM_SWAD_USRS:
|
case For_FORUM_SWAD_USRS:
|
||||||
Soc_StoreSocialEvent (Soc_EVENT_FORUM_POST,PstCod);
|
Soc_StoreSocialNote (Soc_NOTE_FORUM_POST,PstCod);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -154,8 +154,8 @@ void Not_ReceiveNotice (void)
|
||||||
Not_UpdateNumUsrsNotifiedByEMailAboutNotice (NotCod,NumUsrsToBeNotifiedByEMail);
|
Not_UpdateNumUsrsNotifiedByEMailAboutNotice (NotCod,NumUsrsToBeNotifiedByEMail);
|
||||||
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
|
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
|
||||||
|
|
||||||
/***** Create a new social event about the new notice *****/
|
/***** Create a new social note about the new notice *****/
|
||||||
Soc_StoreSocialEvent (Soc_EVENT_NOTICE,NotCod);
|
Soc_StoreSocialNote (Soc_NOTE_NOTICE,NotCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
336
swad_social.c
336
swad_social.c
|
@ -1,4 +1,4 @@
|
||||||
// swad_social.c: social networking
|
// swad_social.c: social networking (timeline)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SWAD (Shared Workspace At a Distance),
|
SWAD (Shared Workspace At a Distance),
|
||||||
|
@ -50,37 +50,37 @@
|
||||||
|
|
||||||
#define Soc_MAX_BYTES_SUMMARY 100
|
#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 */
|
/* Institution tab */
|
||||||
ActSeeDocIns, // Soc_EVENT_INS_DOC_PUB_FILE
|
ActSeeDocIns, // Soc_NOTE_INS_DOC_PUB_FILE
|
||||||
ActAdmComIns, // Soc_EVENT_INS_SHA_PUB_FILE
|
ActAdmComIns, // Soc_NOTE_INS_SHA_PUB_FILE
|
||||||
|
|
||||||
/* Centre tab */
|
/* Centre tab */
|
||||||
ActSeeDocCtr, // Soc_EVENT_CTR_DOC_PUB_FILE
|
ActSeeDocCtr, // Soc_NOTE_CTR_DOC_PUB_FILE
|
||||||
ActAdmComCtr, // Soc_EVENT_CTR_SHA_PUB_FILE
|
ActAdmComCtr, // Soc_NOTE_CTR_SHA_PUB_FILE
|
||||||
|
|
||||||
/* Degree tab */
|
/* Degree tab */
|
||||||
ActSeeDocDeg, // Soc_EVENT_DEG_DOC_PUB_FILE
|
ActSeeDocDeg, // Soc_NOTE_DEG_DOC_PUB_FILE
|
||||||
ActAdmComDeg, // Soc_EVENT_DEG_SHA_PUB_FILE
|
ActAdmComDeg, // Soc_NOTE_DEG_SHA_PUB_FILE
|
||||||
|
|
||||||
/* Course tab */
|
/* Course tab */
|
||||||
ActSeeDocCrs, // Soc_EVENT_CRS_DOC_PUB_FILE
|
ActSeeDocCrs, // Soc_NOTE_CRS_DOC_PUB_FILE
|
||||||
ActAdmShaCrs, // Soc_EVENT_CRS_SHA_PUB_FILE
|
ActAdmShaCrs, // Soc_NOTE_CRS_SHA_PUB_FILE
|
||||||
|
|
||||||
/* Assessment tab */
|
/* Assessment tab */
|
||||||
ActSeeExaAnn, // Soc_EVENT_EXAM_ANNOUNCEMENT
|
ActSeeExaAnn, // Soc_NOTE_EXAM_ANNOUNCEMENT
|
||||||
|
|
||||||
/* Users tab */
|
/* Users tab */
|
||||||
|
|
||||||
/* Social tab */
|
/* Social tab */
|
||||||
ActSeeSocAct, // Soc_EVENT_SOCIAL_POST (action not used)
|
ActSeeSocAct, // Soc_NOTE_SOCIAL_POST (action not used)
|
||||||
ActSeeFor, // Soc_EVENT_FORUM_POST
|
ActSeeFor, // Soc_NOTE_FORUM_POST
|
||||||
|
|
||||||
/* Messages tab */
|
/* Messages tab */
|
||||||
ActShoNot, // Soc_EVENT_NOTICE
|
ActShoNot, // Soc_NOTE_NOTICE
|
||||||
|
|
||||||
/* Statistics tab */
|
/* Statistics tab */
|
||||||
|
|
||||||
|
@ -92,10 +92,10 @@ static const Act_Action_t Soc_DefaultActions[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
/****************************** Internal types *******************************/
|
/****************************** Internal types *******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
struct SocialEvent
|
struct SocialNote
|
||||||
{
|
{
|
||||||
long SocCod;
|
long SocCod;
|
||||||
Soc_SocialEvent_t SocialEvent;
|
Soc_SocialNote_t SocialNote;
|
||||||
long UsrCod;
|
long UsrCod;
|
||||||
long CtyCod;
|
long CtyCod;
|
||||||
long InsCod;
|
long InsCod;
|
||||||
|
@ -121,24 +121,24 @@ extern struct Globals Gbl;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static unsigned long Soc_ShowTimeline (const char *Query,Act_Action_t UpdateAction);
|
static unsigned long Soc_ShowTimeline (const char *Query,Act_Action_t UpdateAction);
|
||||||
static Soc_SocialEvent_t Soc_GetSocialEventFromDB (const char *Str);
|
static Soc_SocialNote_t Soc_GetSocialNoteFromDB (const char *Str);
|
||||||
static void Soc_WriteSocialEvent (const struct SocialEvent *Soc,
|
static void Soc_WriteSocialNote (const struct SocialNote *Soc,
|
||||||
struct UsrData *UsrDat,
|
struct UsrData *UsrDat,
|
||||||
bool PutIconRemove);
|
bool PutIconRemove);
|
||||||
static void Soc_WriteEventDate (time_t TimeUTC);
|
static void Soc_WriteNoteDate (time_t TimeUTC);
|
||||||
static void Soc_StartFormGoToAction (Soc_SocialEvent_t SocialEvent,
|
static void Soc_StartFormGoToAction (Soc_SocialNote_t SocialNote,
|
||||||
long CrsCod,long Cod);
|
long CrsCod,long Cod);
|
||||||
static void Soc_GetEventSummary (const struct SocialEvent *Soc,
|
static void Soc_GetNoteSummary (const struct SocialNote *Soc,
|
||||||
char *SummaryStr,unsigned MaxChars);
|
char *SummaryStr,unsigned MaxChars);
|
||||||
|
|
||||||
static void Soc_PutLinkToWriteANewPost (void);
|
static void Soc_PutLinkToWriteANewPost (void);
|
||||||
static void Soc_GetAndWriteSocialPost (long PstCod);
|
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 void Soc_PutHiddenParamSocCod (long SocCod);
|
||||||
static long Soc_GetParamSocCod (void);
|
static long Soc_GetParamSocCod (void);
|
||||||
static void Soc_GetDataOfSocialEventByCod (struct SocialEvent *Soc);
|
static void Soc_GetDataOfSocialNoteByCod (struct SocialNote *Soc);
|
||||||
static void Soc_GetDataOfSocialEventFromRow (MYSQL_ROW row,struct SocialEvent *Soc);
|
static void Soc_GetDataOfSocialNoteFromRow (MYSQL_ROW row,struct SocialNote *Soc);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********** Show social activity (timeline) of a selected user **************/
|
/*********** Show social activity (timeline) of a selected user **************/
|
||||||
|
@ -149,10 +149,10 @@ void Soc_ShowUsrTimeline (long UsrCod)
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
/***** Build query to show timeline including the users I am following *****/
|
/***** 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,"
|
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
|
||||||
"Cod,UNIX_TIMESTAMP(TimeEvent)"
|
"Cod,UNIX_TIMESTAMP(TimeNote)"
|
||||||
" FROM social"
|
" FROM social_notes"
|
||||||
" WHERE UsrCod='%ld'"
|
" WHERE UsrCod='%ld'"
|
||||||
" ORDER BY SocCod DESC LIMIT 10",
|
" ORDER BY SocCod DESC LIMIT 10",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
|
@ -169,7 +169,7 @@ void Soc_ShowFollowingTimeline (void)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
/***** Link to write a new social post *****/
|
/***** Link to write a new social post (public comment) *****/
|
||||||
if (Gbl.CurrentAct != ActReqSocPst)
|
if (Gbl.CurrentAct != ActReqSocPst)
|
||||||
Soc_PutLinkToWriteANewPost ();
|
Soc_PutLinkToWriteANewPost ();
|
||||||
|
|
||||||
|
@ -178,10 +178,10 @@ void Soc_ShowFollowingTimeline (void)
|
||||||
Lay_ShowAlert (Lay_INFO,"Usted no sigue a ningún usuario."); // Need translation!!!
|
Lay_ShowAlert (Lay_INFO,"Usted no sigue a ningún usuario."); // Need translation!!!
|
||||||
|
|
||||||
/***** Build query to show timeline including the users I am following *****/
|
/***** 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,"
|
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
|
||||||
"Cod,UNIX_TIMESTAMP(TimeEvent)"
|
"Cod,UNIX_TIMESTAMP(TimeNote)"
|
||||||
" FROM social"
|
" FROM social_notes"
|
||||||
" WHERE UsrCod IN"
|
" WHERE UsrCod IN"
|
||||||
" (SELECT '%ld'"
|
" (SELECT '%ld'"
|
||||||
" UNION"
|
" UNION"
|
||||||
|
@ -205,16 +205,16 @@ static unsigned long Soc_ShowTimeline (const char *Query,Act_Action_t UpdateActi
|
||||||
extern const char *Txt_Public_activity;
|
extern const char *Txt_Public_activity;
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned long NumEvents;
|
unsigned long NumNotes;
|
||||||
unsigned long NumEvent;
|
unsigned long NumNote;
|
||||||
struct SocialEvent Soc;
|
struct SocialNote Soc;
|
||||||
struct UsrData UsrDat;
|
struct UsrData UsrDat;
|
||||||
|
|
||||||
/***** Get timeline from database *****/
|
/***** 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 *****/
|
/***** List my timeline *****/
|
||||||
if (NumEvents) // Events found
|
if (NumNotes) // Notes found
|
||||||
{
|
{
|
||||||
/***** Initialize structure with user's data *****/
|
/***** Initialize structure with user's data *****/
|
||||||
Usr_UsrDataConstructor (&UsrDat);
|
Usr_UsrDataConstructor (&UsrDat);
|
||||||
|
@ -229,17 +229,17 @@ static unsigned long Soc_ShowTimeline (const char *Query,Act_Action_t UpdateActi
|
||||||
/***** Start list *****/
|
/***** Start list *****/
|
||||||
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
|
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
|
||||||
|
|
||||||
/***** List events one by one *****/
|
/***** List notes one by one *****/
|
||||||
for (NumEvent = 0;
|
for (NumNote = 0;
|
||||||
NumEvent < NumEvents;
|
NumNote < NumNotes;
|
||||||
NumEvent++)
|
NumNote++)
|
||||||
{
|
{
|
||||||
/* Get next social event */
|
/* Get next social note */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
Soc_GetDataOfSocialEventFromRow (row,&Soc);
|
Soc_GetDataOfSocialNoteFromRow (row,&Soc);
|
||||||
|
|
||||||
/* Write row for this social event */
|
/* Write row for this social note */
|
||||||
Soc_WriteSocialEvent (&Soc,&UsrDat,true);
|
Soc_WriteSocialNote (&Soc,&UsrDat,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End list *****/
|
/***** 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 *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
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;
|
unsigned UnsignedNum;
|
||||||
|
|
||||||
if (sscanf (Str,"%u",&UnsignedNum) == 1)
|
if (sscanf (Str,"%u",&UnsignedNum) == 1)
|
||||||
if (UnsignedNum < Soc_NUM_SOCIAL_EVENTS)
|
if (UnsignedNum < Soc_NUM_SOCIAL_NOTES)
|
||||||
return (Soc_SocialEvent_t) UnsignedNum;
|
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,
|
struct UsrData *UsrDat,
|
||||||
bool PutIconRemove)
|
bool PutIconRemove)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
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_Forum;
|
||||||
extern const char *Txt_Course;
|
extern const char *Txt_Course;
|
||||||
extern const char *Txt_Degree;
|
extern const char *Txt_Degree;
|
||||||
|
@ -325,7 +325,7 @@ static void Soc_WriteSocialEvent (const struct SocialEvent *Soc,
|
||||||
Crs_GetDataOfCourseByCod (&Crs);
|
Crs_GetDataOfCourseByCod (&Crs);
|
||||||
|
|
||||||
/* Get forum type of the post */
|
/* 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);
|
Gbl.Forum.ForumType = For_GetForumTypeOfAPost (Soc->Cod);
|
||||||
For_SetForumName (Gbl.Forum.ForumType,
|
For_SetForumName (Gbl.Forum.ForumType,
|
||||||
|
@ -363,34 +363,34 @@ static void Soc_WriteSocialEvent (const struct SocialEvent *Soc,
|
||||||
UsrDat->FullName,UsrDat->Nickname);
|
UsrDat->FullName,UsrDat->Nickname);
|
||||||
|
|
||||||
/* Write date and time */
|
/* 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 */
|
/* Write post content */
|
||||||
fprintf (Gbl.F.Out,"<div class=\"DAT\">");
|
fprintf (Gbl.F.Out,"<div class=\"DAT\">");
|
||||||
Soc_GetAndWriteSocialPost (Soc->Cod);
|
Soc_GetAndWriteSocialPost (Soc->Cod);
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
/* Write form to remove this event */
|
/* Write form to remove this note */
|
||||||
if (PutIconRemove &&
|
if (PutIconRemove &&
|
||||||
Gbl.Usrs.Me.Logged &&
|
Gbl.Usrs.Me.Logged &&
|
||||||
UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author
|
UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author
|
||||||
Soc_PutFormToRemoveSocialEvent (Soc->SocCod);
|
Soc_PutFormToRemoveSocialNote (Soc->SocCod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Write event type and location */
|
/* Write note type and location */
|
||||||
fprintf (Gbl.F.Out,"<div>");
|
fprintf (Gbl.F.Out,"<div>");
|
||||||
Soc_StartFormGoToAction (Soc->SocialEvent,Crs.CrsCod,Soc->Cod);
|
Soc_StartFormGoToAction (Soc->SocialNote,Crs.CrsCod,Soc->Cod);
|
||||||
Act_LinkFormSubmit (Txt_SOCIAL_EVENT[Soc->SocialEvent],
|
Act_LinkFormSubmit (Txt_SOCIAL_NOTE[Soc->SocialNote],
|
||||||
The_ClassForm[Gbl.Prefs.Theme]);
|
The_ClassForm[Gbl.Prefs.Theme]);
|
||||||
fprintf (Gbl.F.Out,"%s</a>",
|
fprintf (Gbl.F.Out,"%s</a>",
|
||||||
Txt_SOCIAL_EVENT[Soc->SocialEvent]);
|
Txt_SOCIAL_NOTE[Soc->SocialNote]);
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
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>",
|
fprintf (Gbl.F.Out,"<div class=\"DAT\">%s: %s</div>",
|
||||||
Txt_Forum,ForumName);
|
Txt_Forum,ForumName);
|
||||||
else if (Crs.CrsCod > 0)
|
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>",
|
fprintf (Gbl.F.Out,"<div class=\"DAT\">%s: %s</div>",
|
||||||
Txt_Country,Cty.Name[Gbl.Prefs.Language]);
|
Txt_Country,Cty.Name[Gbl.Prefs.Language]);
|
||||||
|
|
||||||
/* Write content of the event */
|
/* Write content of the note */
|
||||||
Soc_GetEventSummary (Soc,SummaryStr,Soc_MAX_BYTES_SUMMARY);
|
Soc_GetNoteSummary (Soc,SummaryStr,Soc_MAX_BYTES_SUMMARY);
|
||||||
fprintf (Gbl.F.Out,"<div class=\"DAT\">%s</div>",SummaryStr);
|
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)
|
// 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;
|
extern const char *Txt_Today;
|
||||||
static unsigned UniqueId = 0;
|
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)
|
long CrsCod,long Cod)
|
||||||
{
|
{
|
||||||
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
|
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];
|
char FileName[NAME_MAX+1];
|
||||||
Act_Action_t Action = ActUnk; // Initialized to avoid warning
|
Act_Action_t Action = ActUnk; // Initialized to avoid warning
|
||||||
|
|
||||||
/***** Parameters depending on the type of event *****/
|
/***** Parameters depending on the type of note *****/
|
||||||
switch (SocialEvent)
|
switch (SocialNote)
|
||||||
{
|
{
|
||||||
case Soc_EVENT_INS_DOC_PUB_FILE:
|
case Soc_NOTE_INS_DOC_PUB_FILE:
|
||||||
case Soc_EVENT_INS_SHA_PUB_FILE:
|
case Soc_NOTE_INS_SHA_PUB_FILE:
|
||||||
case Soc_EVENT_CTR_DOC_PUB_FILE:
|
case Soc_NOTE_CTR_DOC_PUB_FILE:
|
||||||
case Soc_EVENT_CTR_SHA_PUB_FILE:
|
case Soc_NOTE_CTR_SHA_PUB_FILE:
|
||||||
case Soc_EVENT_DEG_DOC_PUB_FILE:
|
case Soc_NOTE_DEG_DOC_PUB_FILE:
|
||||||
case Soc_EVENT_DEG_SHA_PUB_FILE:
|
case Soc_NOTE_DEG_SHA_PUB_FILE:
|
||||||
case Soc_EVENT_CRS_DOC_PUB_FILE:
|
case Soc_NOTE_CRS_DOC_PUB_FILE:
|
||||||
case Soc_EVENT_CRS_SHA_PUB_FILE:
|
case Soc_NOTE_CRS_SHA_PUB_FILE:
|
||||||
if (Cod > 0) // File code
|
if (Cod > 0) // File code
|
||||||
{
|
{
|
||||||
FileMetadata.FilCod = Cod;
|
FileMetadata.FilCod = Cod;
|
||||||
|
@ -483,30 +483,30 @@ static void Soc_StartFormGoToAction (Soc_SocialEvent_t SocialEvent,
|
||||||
PathUntilFileName,
|
PathUntilFileName,
|
||||||
FileName);
|
FileName);
|
||||||
}
|
}
|
||||||
switch (SocialEvent)
|
switch (SocialNote)
|
||||||
{
|
{
|
||||||
case Soc_EVENT_INS_DOC_PUB_FILE:
|
case Soc_NOTE_INS_DOC_PUB_FILE:
|
||||||
Action = (Cod > 0) ? ActReqDatSeeDocIns : ActSeeDocIns;
|
Action = (Cod > 0) ? ActReqDatSeeDocIns : ActSeeDocIns;
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_INS_SHA_PUB_FILE:
|
case Soc_NOTE_INS_SHA_PUB_FILE:
|
||||||
Action = (Cod > 0) ? ActReqDatShaIns : ActAdmComIns;
|
Action = (Cod > 0) ? ActReqDatShaIns : ActAdmComIns;
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_CTR_DOC_PUB_FILE:
|
case Soc_NOTE_CTR_DOC_PUB_FILE:
|
||||||
Action = (Cod > 0) ? ActReqDatSeeDocCtr : ActSeeDocCtr;
|
Action = (Cod > 0) ? ActReqDatSeeDocCtr : ActSeeDocCtr;
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_CTR_SHA_PUB_FILE:
|
case Soc_NOTE_CTR_SHA_PUB_FILE:
|
||||||
Action = (Cod > 0) ? ActReqDatShaCtr : ActAdmComCtr;
|
Action = (Cod > 0) ? ActReqDatShaCtr : ActAdmComCtr;
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_DEG_DOC_PUB_FILE:
|
case Soc_NOTE_DEG_DOC_PUB_FILE:
|
||||||
Action = (Cod > 0) ? ActReqDatSeeDocDeg : ActSeeDocDeg;
|
Action = (Cod > 0) ? ActReqDatSeeDocDeg : ActSeeDocDeg;
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_DEG_SHA_PUB_FILE:
|
case Soc_NOTE_DEG_SHA_PUB_FILE:
|
||||||
Action = (Cod > 0) ? ActReqDatShaDeg : ActAdmComDeg;
|
Action = (Cod > 0) ? ActReqDatShaDeg : ActAdmComDeg;
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_CRS_DOC_PUB_FILE:
|
case Soc_NOTE_CRS_DOC_PUB_FILE:
|
||||||
Action = (Cod > 0) ? ActReqDatSeeDocCrs : ActSeeDocCrs;
|
Action = (Cod > 0) ? ActReqDatSeeDocCrs : ActSeeDocCrs;
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_CRS_SHA_PUB_FILE:
|
case Soc_NOTE_CRS_SHA_PUB_FILE:
|
||||||
Action = (Cod > 0) ? ActReqDatShaCrs : ActAdmShaCrs;
|
Action = (Cod > 0) ? ActReqDatShaCrs : ActAdmShaCrs;
|
||||||
break;
|
break;
|
||||||
default: // Not aplicable here
|
default: // Not aplicable here
|
||||||
|
@ -517,16 +517,16 @@ static void Soc_StartFormGoToAction (Soc_SocialEvent_t SocialEvent,
|
||||||
if (Cod > 0) // File code
|
if (Cod > 0) // File code
|
||||||
Brw_PutParamsPathAndFile (Brw_IS_FILE,PathUntilFileName,FileName);
|
Brw_PutParamsPathAndFile (Brw_IS_FILE,PathUntilFileName,FileName);
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_NOTICE:
|
case Soc_NOTE_NOTICE:
|
||||||
Act_FormStart (Soc_DefaultActions[SocialEvent]);
|
Act_FormStart (Soc_DefaultActions[SocialNote]);
|
||||||
Not_PutHiddenParamNotCod (Cod);
|
Not_PutHiddenParamNotCod (Cod);
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_FORUM_POST:
|
case Soc_NOTE_FORUM_POST:
|
||||||
Act_FormStart (For_ActionsSeeFor[Gbl.Forum.ForumType]);
|
Act_FormStart (For_ActionsSeeFor[Gbl.Forum.ForumType]);
|
||||||
For_PutAllHiddenParamsForum ();
|
For_PutAllHiddenParamsForum ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Act_FormStart (Soc_DefaultActions[SocialEvent]);
|
Act_FormStart (Soc_DefaultActions[SocialNote]);
|
||||||
break;
|
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,
|
static void Soc_GetNoteSummary (const struct SocialNote *Soc,
|
||||||
char *SummaryStr,unsigned MaxChars)
|
char *SummaryStr,unsigned MaxChars)
|
||||||
{
|
{
|
||||||
SummaryStr[0] = '\0';
|
SummaryStr[0] = '\0';
|
||||||
|
|
||||||
switch (Soc->SocialEvent)
|
switch (Soc->SocialNote)
|
||||||
{
|
{
|
||||||
case Soc_EVENT_UNKNOWN:
|
case Soc_NOTE_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_INS_DOC_PUB_FILE:
|
case Soc_NOTE_INS_DOC_PUB_FILE:
|
||||||
case Soc_EVENT_INS_SHA_PUB_FILE:
|
case Soc_NOTE_INS_SHA_PUB_FILE:
|
||||||
case Soc_EVENT_CTR_DOC_PUB_FILE:
|
case Soc_NOTE_CTR_DOC_PUB_FILE:
|
||||||
case Soc_EVENT_CTR_SHA_PUB_FILE:
|
case Soc_NOTE_CTR_SHA_PUB_FILE:
|
||||||
case Soc_EVENT_DEG_DOC_PUB_FILE:
|
case Soc_NOTE_DEG_DOC_PUB_FILE:
|
||||||
case Soc_EVENT_DEG_SHA_PUB_FILE:
|
case Soc_NOTE_DEG_SHA_PUB_FILE:
|
||||||
case Soc_EVENT_CRS_DOC_PUB_FILE:
|
case Soc_NOTE_CRS_DOC_PUB_FILE:
|
||||||
case Soc_EVENT_CRS_SHA_PUB_FILE:
|
case Soc_NOTE_CRS_SHA_PUB_FILE:
|
||||||
Brw_GetSummaryAndContentOrSharedFile (SummaryStr,NULL,Soc->Cod,MaxChars,false);
|
Brw_GetSummaryAndContentOrSharedFile (SummaryStr,NULL,Soc->Cod,MaxChars,false);
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_EXAM_ANNOUNCEMENT:
|
case Soc_NOTE_EXAM_ANNOUNCEMENT:
|
||||||
Exa_GetSummaryAndContentExamAnnouncement (SummaryStr,NULL,Soc->Cod,MaxChars,false);
|
Exa_GetSummaryAndContentExamAnnouncement (SummaryStr,NULL,Soc->Cod,MaxChars,false);
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_SOCIAL_POST:
|
case Soc_NOTE_SOCIAL_POST:
|
||||||
// Not applicable
|
// Not applicable
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_FORUM_POST:
|
case Soc_NOTE_FORUM_POST:
|
||||||
For_GetSummaryAndContentForumPst (SummaryStr,NULL,Soc->Cod,MaxChars,false);
|
For_GetSummaryAndContentForumPst (SummaryStr,NULL,Soc->Cod,MaxChars,false);
|
||||||
break;
|
break;
|
||||||
case Soc_EVENT_NOTICE:
|
case Soc_NOTE_NOTICE:
|
||||||
Not_GetSummaryAndContentNotice (SummaryStr,NULL,Soc->Cod,MaxChars,false);
|
Not_GetSummaryAndContentNotice (SummaryStr,NULL,Soc->Cod,MaxChars,false);
|
||||||
break;
|
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];
|
char Query[512];
|
||||||
long CtyCod;
|
long CtyCod;
|
||||||
|
@ -587,7 +587,7 @@ void Soc_StoreSocialEvent (Soc_SocialEvent_t SocialEvent,long Cod)
|
||||||
long DegCod;
|
long DegCod;
|
||||||
long CrsCod;
|
long CrsCod;
|
||||||
|
|
||||||
if (SocialEvent == Soc_EVENT_FORUM_POST)
|
if (SocialNote == Soc_NOTE_FORUM_POST)
|
||||||
{
|
{
|
||||||
// CtyCod = Gbl.Forum.Cty.CtyCod;
|
// CtyCod = Gbl.Forum.Cty.CtyCod;
|
||||||
// InsCod = Gbl.Forum.Ins.InsCod;
|
// InsCod = Gbl.Forum.Ins.InsCod;
|
||||||
|
@ -609,17 +609,17 @@ void Soc_StoreSocialEvent (Soc_SocialEvent_t SocialEvent,long Cod)
|
||||||
CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
|
CrsCod = Gbl.CurrentCrs.Crs.CrsCod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Store notify event *****/
|
/***** Store social note *****/
|
||||||
sprintf (Query,"INSERT INTO social (SocialEvent,UsrCod,"
|
sprintf (Query,"INSERT INTO social_notes (SocialNote,UsrCod,"
|
||||||
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
|
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
|
||||||
"Cod,TimeEvent)"
|
"Cod,TimeNote)"
|
||||||
" VALUES ('%u','%ld',"
|
" VALUES ('%u','%ld',"
|
||||||
"'%ld','%ld','%ld','%ld','%ld',"
|
"'%ld','%ld','%ld','%ld','%ld',"
|
||||||
"'%ld',NOW())",
|
"'%ld',NOW())",
|
||||||
(unsigned) SocialEvent,Gbl.Usrs.Me.UsrDat.UsrCod,
|
(unsigned) SocialNote,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
CtyCod,InsCod,CtrCod,DegCod,CrsCod,
|
CtyCod,InsCod,CtrCod,DegCod,CrsCod,
|
||||||
Cod);
|
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);
|
Str_TO_RIGOROUS_HTML,true);
|
||||||
|
|
||||||
/* Insert post content in the database */
|
/* 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);
|
Content);
|
||||||
PstCod = DB_QueryINSERTandReturnCode (Query,"can not create post");
|
PstCod = DB_QueryINSERTandReturnCode (Query,"can not create post");
|
||||||
|
|
||||||
/* Insert post in social events */
|
/* Insert post in social notes */
|
||||||
Soc_StoreSocialEvent (Soc_EVENT_SOCIAL_POST,PstCod);
|
Soc_StoreSocialNote (Soc_NOTE_SOCIAL_POST,PstCod);
|
||||||
|
|
||||||
/***** Write current timeline *****/
|
/***** Write current timeline *****/
|
||||||
Soc_ShowFollowingTimeline ();
|
Soc_ShowFollowingTimeline ();
|
||||||
|
@ -710,7 +710,7 @@ static void Soc_GetAndWriteSocialPost (long PstCod)
|
||||||
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
|
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||||
|
|
||||||
/***** Get social post from database *****/
|
/***** 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);
|
PstCod);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get the content of a social post");
|
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;
|
extern const char *Txt_Remove;
|
||||||
|
|
||||||
/***** Form to remove social post *****/
|
/***** Form to remove social post *****/
|
||||||
Act_FormStart (ActReqRemSocEvn);
|
Act_FormStart (ActReqRemSocNot);
|
||||||
Soc_PutHiddenParamSocCod (SocCod);
|
Soc_PutHiddenParamSocCod (SocCod);
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT ICON_HIGHLIGHT\">"
|
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_OPT ICON_HIGHLIGHT\">"
|
||||||
"<input type=\"image\""
|
"<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)
|
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)
|
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;
|
long SocCod;
|
||||||
|
|
||||||
/* Get social event code */
|
/* Get social note code */
|
||||||
Par_GetParToText ("SocCod",LongStr,1+10);
|
Par_GetParToText ("SocCod",LongStr,1+10);
|
||||||
if (sscanf (LongStr,"%ld",&SocCod) != 1)
|
if (sscanf (LongStr,"%ld",&SocCod) != 1)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of social event.");
|
Lay_ShowErrorAndExit ("Wrong code of social note.");
|
||||||
|
|
||||||
return SocCod;
|
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_Do_you_really_want_to_remove_the_following_comment;
|
||||||
extern const char *Txt_Remove;
|
extern const char *Txt_Remove;
|
||||||
struct SocialEvent Soc;
|
struct SocialNote Soc;
|
||||||
bool ICanRemove;
|
bool ICanRemove;
|
||||||
struct UsrData UsrDat;
|
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 ();
|
Soc.SocCod = Soc_GetParamSocCod ();
|
||||||
|
|
||||||
/***** Get data of social event *****/
|
/***** Get data of social note *****/
|
||||||
Soc_GetDataOfSocialEventByCod (&Soc);
|
Soc_GetDataOfSocialNoteByCod (&Soc);
|
||||||
|
|
||||||
ICanRemove = (Gbl.Usrs.Me.Logged &&
|
ICanRemove = (Gbl.Usrs.Me.Logged &&
|
||||||
Soc.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
|
Soc.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
|
||||||
Soc.SocialEvent == Soc_EVENT_SOCIAL_POST);
|
Soc.SocialNote == Soc_NOTE_SOCIAL_POST);
|
||||||
if (ICanRemove)
|
if (ICanRemove)
|
||||||
{
|
{
|
||||||
/***** Initialize structure with user's data *****/
|
/***** Initialize structure with user's data *****/
|
||||||
|
@ -811,14 +811,14 @@ void Soc_RequestRemovalSocialEvent (void)
|
||||||
|
|
||||||
/***** Form to ask for confirmation to remove this social post *****/
|
/***** Form to ask for confirmation to remove this social post *****/
|
||||||
/* Start form */
|
/* Start form */
|
||||||
Act_FormStart (ActRemSocEvn);
|
Act_FormStart (ActRemSocNot);
|
||||||
Soc_PutHiddenParamSocCod (Soc.SocCod);
|
Soc_PutHiddenParamSocCod (Soc.SocCod);
|
||||||
Lay_ShowAlert (Lay_WARNING,Txt_Do_you_really_want_to_remove_the_following_comment);
|
Lay_ShowAlert (Lay_WARNING,Txt_Do_you_really_want_to_remove_the_following_comment);
|
||||||
|
|
||||||
/* Show social event */
|
/* Show social note */
|
||||||
Lay_StartRoundFrame ("560px",NULL);
|
Lay_StartRoundFrame ("560px",NULL);
|
||||||
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
|
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
|
||||||
Soc_WriteSocialEvent (&Soc,&UsrDat,false);
|
Soc_WriteSocialNote (&Soc,&UsrDat,false);
|
||||||
fprintf (Gbl.F.Out,"</ul>");
|
fprintf (Gbl.F.Out,"</ul>");
|
||||||
Lay_EndRoundFrame ();
|
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;
|
extern const char *Txt_Comment_removed;
|
||||||
struct SocialEvent Soc;
|
struct SocialNote Soc;
|
||||||
bool ICanRemove;
|
bool ICanRemove;
|
||||||
char Query[128];
|
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 ();
|
Soc.SocCod = Soc_GetParamSocCod ();
|
||||||
|
|
||||||
/***** Get data of social event *****/
|
/***** Get data of social note *****/
|
||||||
Soc_GetDataOfSocialEventByCod (&Soc);
|
Soc_GetDataOfSocialNoteByCod (&Soc);
|
||||||
|
|
||||||
ICanRemove = (Gbl.Usrs.Me.Logged &&
|
ICanRemove = (Gbl.Usrs.Me.Logged &&
|
||||||
Soc.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
|
Soc.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod &&
|
||||||
Soc.SocialEvent == Soc_EVENT_SOCIAL_POST);
|
Soc.SocialNote == Soc_NOTE_SOCIAL_POST);
|
||||||
if (ICanRemove)
|
if (ICanRemove)
|
||||||
{
|
{
|
||||||
/***** Remove social event *****/
|
/***** Remove social note *****/
|
||||||
sprintf (Query,"DELETE FROM social WHERE SocCod='%ld'",Soc.SocCod);
|
sprintf (Query,"DELETE FROM social_notes WHERE SocCod='%ld'",
|
||||||
DB_QueryDELETE (Query,"can not remove a social event");
|
Soc.SocCod);
|
||||||
|
DB_QueryDELETE (Query,"can not remove a social note");
|
||||||
|
|
||||||
/***** Remove social post *****/
|
/***** 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");
|
DB_QueryDELETE (Query,"can not remove a social post");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,29 +881,29 @@ void Soc_RemoveSocialEvent (void)
|
||||||
/******************* Get assignment data using its code **********************/
|
/******************* Get assignment data using its code **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Soc_GetDataOfSocialEventByCod (struct SocialEvent *Soc)
|
static void Soc_GetDataOfSocialNoteByCod (struct SocialNote *Soc)
|
||||||
{
|
{
|
||||||
char Query[256];
|
char Query[256];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
|
||||||
/***** Get data of social event from database *****/
|
/***** Get data of social note from database *****/
|
||||||
sprintf (Query,"SELECT SocCod,SocialEvent,UsrCod,"
|
sprintf (Query,"SELECT SocCod,SocialNote,UsrCod,"
|
||||||
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
|
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
|
||||||
"Cod,UNIX_TIMESTAMP(TimeEvent)"
|
"Cod,UNIX_TIMESTAMP(TimeNote)"
|
||||||
" FROM social"
|
" FROM social_notes"
|
||||||
" WHERE SocCod='%ld'",
|
" WHERE SocCod='%ld'",
|
||||||
Soc->SocCod);
|
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);
|
row = mysql_fetch_row (mysql_res);
|
||||||
Soc_GetDataOfSocialEventFromRow (row,Soc);
|
Soc_GetDataOfSocialNoteFromRow (row,Soc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/***** Reset fields of social event *****/
|
/***** Reset fields of social note *****/
|
||||||
Soc->SocialEvent = Soc_EVENT_UNKNOWN;
|
Soc->SocialNote = Soc_NOTE_UNKNOWN;
|
||||||
Soc->UsrCod = -1L;
|
Soc->UsrCod = -1L;
|
||||||
Soc->CtyCod =
|
Soc->CtyCod =
|
||||||
Soc->InsCod =
|
Soc->InsCod =
|
||||||
|
@ -917,13 +919,13 @@ static void Soc_GetDataOfSocialEventByCod (struct SocialEvent *Soc)
|
||||||
/******************* Get assignment data using its code **********************/
|
/******************* 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]) */
|
/* Get social code (row[0]) */
|
||||||
Soc->SocCod = Str_ConvertStrCodToLongCod (row[0]);
|
Soc->SocCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
|
||||||
/* Get event type (row[1]) */
|
/* Get note type (row[1]) */
|
||||||
Soc->SocialEvent = Soc_GetSocialEventFromDB ((const char *) row[1]);
|
Soc->SocialNote = Soc_GetSocialNoteFromDB ((const char *) row[1]);
|
||||||
|
|
||||||
/* Get (from) user code (row[2]) */
|
/* Get (from) user code (row[2]) */
|
||||||
Soc->UsrCod = Str_ConvertStrCodToLongCod (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]) */
|
/* Get file/post... code (row[8]) */
|
||||||
Soc->Cod = Str_ConvertStrCodToLongCod (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]);
|
Soc->DateTimeUTC = Dat_GetUNIXTimeFromStr (row[9]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// swad_social.c: social networking
|
// swad_social.c: social networking (timeline)
|
||||||
|
|
||||||
#ifndef _SWAD_SOC
|
#ifndef _SWAD_SOC
|
||||||
#define _SWAD_SOC
|
#define _SWAD_SOC
|
||||||
|
@ -35,47 +35,47 @@
|
||||||
/******************************** Public types *******************************/
|
/******************************** Public types *******************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Soc_NUM_SOCIAL_EVENTS 13
|
#define Soc_NUM_SOCIAL_NOTES 13
|
||||||
// If the numbers assigned to each event type change,
|
// 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
|
typedef enum
|
||||||
{
|
{
|
||||||
Soc_EVENT_UNKNOWN = 0,
|
Soc_NOTE_UNKNOWN = 0,
|
||||||
|
|
||||||
/* Institution tab */
|
/* Institution tab */
|
||||||
Soc_EVENT_INS_DOC_PUB_FILE = 1,
|
Soc_NOTE_INS_DOC_PUB_FILE = 1,
|
||||||
Soc_EVENT_INS_SHA_PUB_FILE = 2,
|
Soc_NOTE_INS_SHA_PUB_FILE = 2,
|
||||||
|
|
||||||
/* Centre tab */
|
/* Centre tab */
|
||||||
Soc_EVENT_CTR_DOC_PUB_FILE = 3,
|
Soc_NOTE_CTR_DOC_PUB_FILE = 3,
|
||||||
Soc_EVENT_CTR_SHA_PUB_FILE = 4,
|
Soc_NOTE_CTR_SHA_PUB_FILE = 4,
|
||||||
|
|
||||||
/* Degree tab */
|
/* Degree tab */
|
||||||
Soc_EVENT_DEG_DOC_PUB_FILE = 5,
|
Soc_NOTE_DEG_DOC_PUB_FILE = 5,
|
||||||
Soc_EVENT_DEG_SHA_PUB_FILE = 6,
|
Soc_NOTE_DEG_SHA_PUB_FILE = 6,
|
||||||
|
|
||||||
/* Course tab */
|
/* Course tab */
|
||||||
Soc_EVENT_CRS_DOC_PUB_FILE = 7,
|
Soc_NOTE_CRS_DOC_PUB_FILE = 7,
|
||||||
Soc_EVENT_CRS_SHA_PUB_FILE = 8,
|
Soc_NOTE_CRS_SHA_PUB_FILE = 8,
|
||||||
|
|
||||||
/* Assessment tab */
|
/* Assessment tab */
|
||||||
Soc_EVENT_EXAM_ANNOUNCEMENT = 9,
|
Soc_NOTE_EXAM_ANNOUNCEMENT = 9,
|
||||||
|
|
||||||
/* Users tab */
|
/* Users tab */
|
||||||
|
|
||||||
/* Social tab */
|
/* Social tab */
|
||||||
Soc_EVENT_SOCIAL_POST = 10,
|
Soc_NOTE_SOCIAL_POST = 10,
|
||||||
Soc_EVENT_FORUM_POST = 11,
|
Soc_NOTE_FORUM_POST = 11,
|
||||||
|
|
||||||
/* Messages tab */
|
/* Messages tab */
|
||||||
Soc_EVENT_NOTICE = 12,
|
Soc_NOTE_NOTICE = 12,
|
||||||
|
|
||||||
/* Statistics tab */
|
/* Statistics tab */
|
||||||
|
|
||||||
/* Profile tab */
|
/* Profile tab */
|
||||||
|
|
||||||
} Soc_SocialEvent_t;
|
} Soc_SocialNote_t;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Public prototypes ****************************/
|
/****************************** Public prototypes ****************************/
|
||||||
|
@ -84,12 +84,12 @@ typedef enum
|
||||||
void Soc_ShowUsrTimeline (long UsrCod);
|
void Soc_ShowUsrTimeline (long UsrCod);
|
||||||
void Soc_ShowFollowingTimeline (void);
|
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_FormSocialPost (void);
|
||||||
void Soc_ReceiveSocialPost (void);
|
void Soc_ReceiveSocialPost (void);
|
||||||
|
|
||||||
void Soc_RequestRemovalSocialEvent (void);
|
void Soc_RequestRemovalSocialNote (void);
|
||||||
void Soc_RemoveSocialEvent (void);
|
void Soc_RemoveSocialNote (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
28
swad_text.c
28
swad_text.c
|
@ -35247,9 +35247,9 @@ const char *Txt_Size_of_photos =
|
||||||
"Tamanho das fotos";
|
"Tamanho das fotos";
|
||||||
#endif
|
#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"
|
"Esdeveniment desconegut"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Unbekannt Ereignis"
|
"Unbekannt Ereignis"
|
||||||
|
@ -35269,7 +35269,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Evento desconhecido"
|
"Evento desconhecido"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_INS_DOC_PUB_FILE
|
#if L==1 // Soc_NOTE_INS_DOC_PUB_FILE
|
||||||
"Document públic"
|
"Document públic"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Öffentliche Dokumentdatei"
|
"Öffentliche Dokumentdatei"
|
||||||
|
@ -35289,7 +35289,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Arquivo de documento público"
|
"Arquivo de documento público"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_INS_SHA_PUB_FILE
|
#if L==1 // Soc_NOTE_INS_SHA_PUB_FILE
|
||||||
"Arxiu compartit públic"
|
"Arxiu compartit públic"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Öffentliche Freigegebene Datei"
|
"Öffentliche Freigegebene Datei"
|
||||||
|
@ -35309,7 +35309,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Arquivo compartilhado público"
|
"Arquivo compartilhado público"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_CTR_DOC_PUB_FILE
|
#if L==1 // Soc_NOTE_CTR_DOC_PUB_FILE
|
||||||
"Document públic"
|
"Document públic"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Öffentliche Dokumentdatei"
|
"Öffentliche Dokumentdatei"
|
||||||
|
@ -35329,7 +35329,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Arquivo de documento público"
|
"Arquivo de documento público"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_CTR_SHA_PUB_FILE
|
#if L==1 // Soc_NOTE_CTR_SHA_PUB_FILE
|
||||||
"Arxiu compartit públic"
|
"Arxiu compartit públic"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Öffentliche Freigegebene Datei"
|
"Öffentliche Freigegebene Datei"
|
||||||
|
@ -35349,7 +35349,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Arquivo compartilhado público"
|
"Arquivo compartilhado público"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_DEG_DOC_PUB_FILE
|
#if L==1 // Soc_NOTE_DEG_DOC_PUB_FILE
|
||||||
"Document públic"
|
"Document públic"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Öffentliche Dokumentdatei"
|
"Öffentliche Dokumentdatei"
|
||||||
|
@ -35369,7 +35369,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Arquivo de documento público"
|
"Arquivo de documento público"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_DEG_SHA_PUB_FILE
|
#if L==1 // Soc_NOTE_DEG_SHA_PUB_FILE
|
||||||
"Arxiu compartit públic"
|
"Arxiu compartit públic"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Öffentliche Freigegebene Datei"
|
"Öffentliche Freigegebene Datei"
|
||||||
|
@ -35389,7 +35389,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Arquivo compartilhado público"
|
"Arquivo compartilhado público"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_CRS_DOC_PUB_FILE
|
#if L==1 // Soc_NOTE_CRS_DOC_PUB_FILE
|
||||||
"Document públic"
|
"Document públic"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Öffentliche Dokumentdatei"
|
"Öffentliche Dokumentdatei"
|
||||||
|
@ -35409,7 +35409,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Arquivo de documento público"
|
"Arquivo de documento público"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_CRS_SHA_PUB_FILE
|
#if L==1 // Soc_NOTE_CRS_SHA_PUB_FILE
|
||||||
"Arxiu compartit públic"
|
"Arxiu compartit públic"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Öffentliche Freigegebene Datei"
|
"Öffentliche Freigegebene Datei"
|
||||||
|
@ -35429,7 +35429,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Arquivo compartilhado público"
|
"Arquivo compartilhado público"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_EXAM_ANNOUNCEMENT
|
#if L==1 // Soc_NOTE_EXAM_ANNOUNCEMENT
|
||||||
"Convocatòria d'examen"
|
"Convocatòria d'examen"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Aufrufe für Prüfung"
|
"Aufrufe für Prüfung"
|
||||||
|
@ -35449,7 +35449,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Chamada para exame"
|
"Chamada para exame"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_SOCIAL_POST (not used)
|
#if L==1 // Soc_NOTE_SOCIAL_POST (not used)
|
||||||
"Comentari"
|
"Comentari"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Kommentar"
|
"Kommentar"
|
||||||
|
@ -35469,7 +35469,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Comentário"
|
"Comentário"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_FORUM_POST
|
#if L==1 // Soc_NOTE_FORUM_POST
|
||||||
"Missatge en un fòrum"
|
"Missatge en un fòrum"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Beiträge in einem Forum"
|
"Beiträge in einem Forum"
|
||||||
|
@ -35489,7 +35489,7 @@ const char *Txt_SOCIAL_EVENT[Soc_NUM_SOCIAL_EVENTS] =
|
||||||
"Post em um fórum"
|
"Post em um fórum"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
#if L==1 // Soc_EVENT_NOTICE
|
#if L==1 // Soc_NOTE_NOTICE
|
||||||
"Avís"
|
"Avís"
|
||||||
#elif L==2
|
#elif L==2
|
||||||
"Ankündigungen"
|
"Ankündigungen"
|
||||||
|
|
Loading…
Reference in New Issue