mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-02 14:55:23 +02:00
Version 15.120.1
This commit is contained in:
parent
3ee4adff19
commit
36b060b29a
|
@ -1787,7 +1787,12 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
vertical-align:bottom;
|
vertical-align:bottom;
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
.SOCIAL_NUM_SHARES {color:#A0A0A0; font-size:12pt; font-weight:bold;}
|
.SOCIAL_NUM_SHARES_FAVS
|
||||||
|
{
|
||||||
|
color:#A0A0A0;
|
||||||
|
font-size:12pt;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
.SOCIAL_SHARER
|
.SOCIAL_SHARER
|
||||||
{
|
{
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
|
|
12
sql/swad.sql
12
sql/swad.sql
|
@ -923,14 +923,6 @@ CREATE TABLE IF NOT EXISTS social_comments (
|
||||||
UNIQUE INDEX(ComCod),
|
UNIQUE INDEX(ComCod),
|
||||||
FULLTEXT(Content)) ENGINE = MYISAM;
|
FULLTEXT(Content)) ENGINE = MYISAM;
|
||||||
--
|
--
|
||||||
-- Table social_comments_fav: stores users who marked social comments as favourite
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS social_comments_fav (
|
|
||||||
ComCod BIGINT NOT NULL,
|
|
||||||
UsrCod INT NOT NULL,
|
|
||||||
UNIQUE INDEX(ComCod,UsrCod),
|
|
||||||
INDEX(UsrCod));
|
|
||||||
--
|
|
||||||
-- Table social_notes: stores social notes
|
-- Table social_notes: stores social notes
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS social_notes (
|
CREATE TABLE IF NOT EXISTS social_notes (
|
||||||
|
@ -951,8 +943,10 @@ CREATE TABLE IF NOT EXISTS social_notes (
|
||||||
CREATE TABLE IF NOT EXISTS social_notes_fav (
|
CREATE TABLE IF NOT EXISTS social_notes_fav (
|
||||||
NotCod BIGINT NOT NULL,
|
NotCod BIGINT NOT NULL,
|
||||||
UsrCod INT NOT NULL,
|
UsrCod INT NOT NULL,
|
||||||
|
TimeFav DATETIME NOT NULL,
|
||||||
UNIQUE INDEX(NotCod,UsrCod),
|
UNIQUE INDEX(NotCod,UsrCod),
|
||||||
INDEX(UsrCod));
|
INDEX(UsrCod),
|
||||||
|
INDEX(TimeFav));
|
||||||
--
|
--
|
||||||
-- Table social_posts: stores social posts (public comments written by users)
|
-- Table social_posts: stores social posts (public comments written by users)
|
||||||
--
|
--
|
||||||
|
|
|
@ -122,18 +122,18 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.120 (2016-01-19)"
|
#define Log_PLATFORM_VERSION "SWAD 15.120.1 (2016-01-19)"
|
||||||
#define CSS_FILE "swad15.117.css"
|
#define CSS_FILE "swad15.117.css"
|
||||||
#define JS_FILE "swad15.118.4.js"
|
#define JS_FILE "swad15.118.4.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.120.1: Jan 19, 2016 Show number of users who marked a social note as favourite. (193533 lines)
|
||||||
Version 15.120: Jan 19, 2016 Mark/unmark social notes as favourites. (193475 lines)
|
Version 15.120: Jan 19, 2016 Mark/unmark social notes as favourites. (193475 lines)
|
||||||
Version 15.119: Jan 18, 2016 New tables to mark social notes and comments as favourites. (193036 lines)
|
Version 15.119: Jan 18, 2016 New table to mark social notes as favourites. (193036 lines)
|
||||||
2 changes necessary in database:
|
1 change necessary in database:
|
||||||
CREATE TABLE IF NOT EXISTS social_comments_fav (ComCod BIGINT NOT NULL,UsrCod INT NOT NULL,UNIQUE INDEX(ComCod,UsrCod),INDEX(UsrCod));
|
CREATE TABLE IF NOT EXISTS social_notes_fav (NotCod BIGINT NOT NULL,UsrCod INT NOT NULL,TimeFav DATETIME NOT NULL,UNIQUE INDEX(NotCod,UsrCod),INDEX(UsrCod),INDEX(TimeFav));
|
||||||
CREATE TABLE IF NOT EXISTS social_notes_fav (NotCod BIGINT NOT NULL,UsrCod INT NOT NULL,UNIQUE INDEX(NotCod,UsrCod),INDEX(UsrCod));
|
|
||||||
|
|
||||||
Version 15.118.4: Jan 18, 2016 Date-time without seconds in user's public profile. (192984 lines)
|
Version 15.118.4: Jan 18, 2016 Date-time without seconds in user's public profile. (192984 lines)
|
||||||
Version 15.118.3: Jan 18, 2016 Fixed bug in date-time of files in file-browsers. (192975 lines)
|
Version 15.118.3: Jan 18, 2016 Fixed bug in date-time of files in file-browsers. (192975 lines)
|
||||||
|
|
|
@ -1957,23 +1957,6 @@ mysql> DESCRIBE social_comments;
|
||||||
"UNIQUE INDEX(ComCod),"
|
"UNIQUE INDEX(ComCod),"
|
||||||
"FULLTEXT(Content)) ENGINE = MYISAM;");
|
"FULLTEXT(Content)) ENGINE = MYISAM;");
|
||||||
|
|
||||||
/***** Table social_comments_fav *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE social_comments_fav;
|
|
||||||
+--------+------------+------+-----+---------+-------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+--------+------------+------+-----+---------+-------+
|
|
||||||
| ComCod | bigint(20) | NO | PRI | NULL | |
|
|
||||||
| UsrCod | int(11) | NO | PRI | NULL | |
|
|
||||||
+--------+------------+------+-----+---------+-------+
|
|
||||||
2 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_comments_fav ("
|
|
||||||
"ComCod BIGINT NOT NULL,"
|
|
||||||
"UsrCod INT NOT NULL,"
|
|
||||||
"UNIQUE INDEX(ComCod,UsrCod),"
|
|
||||||
"INDEX(UsrCod))");
|
|
||||||
|
|
||||||
/***** Table social_notes *****/
|
/***** Table social_notes *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE social_notes;
|
mysql> DESCRIBE social_notes;
|
||||||
|
@ -2006,19 +1989,22 @@ mysql> DESCRIBE social_notes;
|
||||||
/***** Table social_notes_fav *****/
|
/***** Table social_notes_fav *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE social_notes_fav;
|
mysql> DESCRIBE social_notes_fav;
|
||||||
+--------+------------+------+-----+---------+-------+
|
+---------+------------+------+-----+---------+-------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+--------+------------+------+-----+---------+-------+
|
+---------+------------+------+-----+---------+-------+
|
||||||
| NotCod | bigint(20) | NO | PRI | NULL | |
|
| NotCod | bigint(20) | NO | PRI | NULL | |
|
||||||
| UsrCod | int(11) | NO | PRI | NULL | |
|
| UsrCod | int(11) | NO | PRI | NULL | |
|
||||||
+--------+------------+------+-----+---------+-------+
|
| TimeFav | datetime | NO | MUL | NULL | |
|
||||||
2 rows in set (0.00 sec)
|
+---------+------------+------+-----+---------+-------+
|
||||||
|
3 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_notes_fav ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_notes_fav ("
|
||||||
"NotCod BIGINT NOT NULL,"
|
"NotCod BIGINT NOT NULL,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
|
"TimeFav DATETIME NOT NULL,"
|
||||||
"UNIQUE INDEX(NotCod,UsrCod),"
|
"UNIQUE INDEX(NotCod,UsrCod),"
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod),"
|
||||||
|
"INDEX(TimeFav))");
|
||||||
|
|
||||||
/***** Table social_posts *****/
|
/***** Table social_posts *****/
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Soc_WIDTH_TIMELINE "560px"
|
#define Soc_WIDTH_TIMELINE "560px"
|
||||||
#define Soc_MAX_NUM_SHARERS_SHOWN 10 // Maximum number of users shown who have share a social note
|
#define Soc_MAX_SHARERS_FAVERS_SHOWN 10 // Maximum number of users shown who have share/fav a social note
|
||||||
|
|
||||||
#define Soc_MAX_BYTES_SUMMARY 1000
|
#define Soc_MAX_BYTES_SUMMARY 1000
|
||||||
#define Soc_MAX_CHARS_IN_POST 1000
|
#define Soc_MAX_CHARS_IN_POST 1000
|
||||||
|
@ -311,6 +311,7 @@ static void Soc_UpdateNumTimesANoteHasBeenShared (struct SocialNote *SocNot);
|
||||||
static void Soc_UpdateNumTimesANoteHasBeenFav (struct SocialNote *SocNot);
|
static void Soc_UpdateNumTimesANoteHasBeenFav (struct SocialNote *SocNot);
|
||||||
|
|
||||||
static void Soc_ShowUsrsWhoHaveSharedSocialNote (const struct SocialNote *SocNot);
|
static void Soc_ShowUsrsWhoHaveSharedSocialNote (const struct SocialNote *SocNot);
|
||||||
|
static void Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (const struct SocialNote *SocNot);
|
||||||
|
|
||||||
static void Soc_GetDataOfSocialNoteByCod (struct SocialNote *SocNot);
|
static void Soc_GetDataOfSocialNoteByCod (struct SocialNote *SocNot);
|
||||||
static void Soc_GetDataOfSocialCommentByCod (struct SocialComment *SocCom);
|
static void Soc_GetDataOfSocialCommentByCod (struct SocialComment *SocCom);
|
||||||
|
@ -1261,6 +1262,9 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
|
||||||
Soc_PutFormToFavSocialNote (SocNot->NotCod);
|
Soc_PutFormToFavSocialNote (SocNot->NotCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Show who have marked this social note as favourite */
|
||||||
|
Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (SocNot);
|
||||||
|
|
||||||
/* Put icon to remove this social note */
|
/* Put icon to remove this social note */
|
||||||
if (IAmTheAuthor)
|
if (IAmTheAuthor)
|
||||||
Soc_PutFormToRemoveSocialPublishing (SocNot->NotCod);
|
Soc_PutFormToRemoveSocialPublishing (SocNot->NotCod);
|
||||||
|
@ -3424,8 +3428,8 @@ static void Soc_ShowUsrsWhoHaveSharedSocialNote (const struct SocialNote *SocNot
|
||||||
bool ShowPhoto;
|
bool ShowPhoto;
|
||||||
char PhotoURL[PATH_MAX+1];
|
char PhotoURL[PATH_MAX+1];
|
||||||
|
|
||||||
/* Show number of users who have shared this social note */
|
/***** Show number of users who have shared this social note *****/
|
||||||
fprintf (Gbl.F.Out,"<span class=\"SOCIAL_NUM_SHARES\"> %u</span>",
|
fprintf (Gbl.F.Out,"<span class=\"SOCIAL_NUM_SHARES_FAVS\"> %u</span>",
|
||||||
SocNot->NumShared);
|
SocNot->NumShared);
|
||||||
|
|
||||||
if (SocNot->NumShared)
|
if (SocNot->NumShared)
|
||||||
|
@ -3440,8 +3444,8 @@ static void Soc_ShowUsrsWhoHaveSharedSocialNote (const struct SocialNote *SocNot
|
||||||
SocNot->NotCod,
|
SocNot->NotCod,
|
||||||
SocNot->UsrCod,
|
SocNot->UsrCod,
|
||||||
(unsigned) Soc_PUB_SHARED_NOTE,
|
(unsigned) Soc_PUB_SHARED_NOTE,
|
||||||
Soc_MAX_NUM_SHARERS_SHOWN);
|
Soc_MAX_SHARERS_FAVERS_SHOWN);
|
||||||
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get data of social publishing");
|
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get users who shared a social note");
|
||||||
if (NumUsrs)
|
if (NumUsrs)
|
||||||
{
|
{
|
||||||
/***** Initialize structure with user's data *****/
|
/***** Initialize structure with user's data *****/
|
||||||
|
@ -3488,6 +3492,86 @@ static void Soc_ShowUsrsWhoHaveSharedSocialNote (const struct SocialNote *SocNot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********* Show users who have marked this social note as favourite **********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// All forms in this function and nested functions must have unique identifiers
|
||||||
|
|
||||||
|
static void Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (const struct SocialNote *SocNot)
|
||||||
|
{
|
||||||
|
char Query[256];
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
unsigned NumUsrs;
|
||||||
|
unsigned NumUsr;
|
||||||
|
unsigned NumUsrsShown = 0;
|
||||||
|
struct UsrData UsrDat;
|
||||||
|
bool ShowPhoto;
|
||||||
|
char PhotoURL[PATH_MAX+1];
|
||||||
|
|
||||||
|
/***** Show number of users who have marked this social note as favourite *****/
|
||||||
|
fprintf (Gbl.F.Out,"<span class=\"SOCIAL_NUM_SHARES_FAVS\"> %u</span>",
|
||||||
|
SocNot->NumFavs);
|
||||||
|
|
||||||
|
if (SocNot->NumFavs)
|
||||||
|
{
|
||||||
|
/***** Get list of publishers from database (only the first) *****/
|
||||||
|
sprintf (Query,"SELECT UsrCod"
|
||||||
|
" FROM social_notes_fav"
|
||||||
|
" WHERE NotCod='%ld'"
|
||||||
|
" AND UsrCod<>'%ld'" // Extra check
|
||||||
|
" ORDER BY TimeFav LIMIT %u",
|
||||||
|
SocNot->NotCod,
|
||||||
|
SocNot->UsrCod,
|
||||||
|
Soc_MAX_SHARERS_FAVERS_SHOWN);
|
||||||
|
NumUsrs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get users who fav a social note");
|
||||||
|
if (NumUsrs)
|
||||||
|
{
|
||||||
|
/***** Initialize structure with user's data *****/
|
||||||
|
Usr_UsrDataConstructor (&UsrDat);
|
||||||
|
|
||||||
|
/***** List users *****/
|
||||||
|
for (NumUsr = 0;
|
||||||
|
NumUsr < NumUsrs;
|
||||||
|
NumUsr++)
|
||||||
|
{
|
||||||
|
/***** Get user *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
|
/* Get user's code (row[0]) */
|
||||||
|
UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
|
||||||
|
/***** Get user's data and show user's photo *****/
|
||||||
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat))
|
||||||
|
{
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_SHARER\">");
|
||||||
|
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
|
||||||
|
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
|
||||||
|
NULL,
|
||||||
|
"PHOTO18x24",Pho_ZOOM,true); // Use unique id
|
||||||
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
|
NumUsrsShown++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Free memory used for user's data *****/
|
||||||
|
Usr_UsrDataDestructor (&UsrDat);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SocNot->NumFavs > NumUsrsShown)
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_SHARER\">"
|
||||||
|
"<img src=\"%s/ellipsis32x32.gif\""
|
||||||
|
" alt=\"%u\" title=\"%u\""
|
||||||
|
" class=\"ICON20x20\" />"
|
||||||
|
"</div>",
|
||||||
|
Gbl.Prefs.IconsURL,
|
||||||
|
SocNot->NumFavs - NumUsrsShown,
|
||||||
|
SocNot->NumFavs - NumUsrsShown);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************** Get data of social note using its code *********************/
|
/**************** Get data of social note using its code *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user