2021-02-08 18:33:16 +01:00
|
|
|
|
// swad_timeline_share.c: social timeline shared
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2021-02-09 12:43:45 +01:00
|
|
|
|
Copyright (C) 1999-2021 Antonio Ca<EFBFBD>as Vargas
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General 3 License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************************** Headers *********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "swad_database.h"
|
|
|
|
|
#include "swad_global.h"
|
|
|
|
|
#include "swad_timeline.h"
|
2021-02-11 13:10:08 +01:00
|
|
|
|
#include "swad_timeline_publication.h"
|
2021-02-08 18:33:16 +01:00
|
|
|
|
#include "swad_timeline_share.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Public constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Private constants and types ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#define TL_ICON_SHARE "share-alt.svg"
|
|
|
|
|
#define TL_ICON_SHARED "share-alt-green.svg"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Private global variables **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void TL_Sha_PutDisabledIconShare (unsigned NumShared);
|
|
|
|
|
|
2021-02-08 20:16:00 +01:00
|
|
|
|
static void TL_Sha_PutFormToShaNote (long ParamCod);
|
|
|
|
|
static void TL_Sha_PutFormToUnsNote (long ParamCod);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void TL_Sha_ShaNote (struct TL_Not_Note *Not);
|
|
|
|
|
static void TL_Sha_UnsNote (struct TL_Not_Note *Not);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
static bool TL_Sha_CheckIfNoteIsSharedByUsr (long NotCod,long UsrCod);
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void TL_Sha_ShowUsrsWhoHaveSharedNote (const struct TL_Not_Note *Not,
|
2021-02-08 18:33:16 +01:00
|
|
|
|
TL_HowManyUsrs_t HowManyUsrs);
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Put disabled icon to share **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void TL_Sha_PutDisabledIconShare (unsigned NumShared)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_TIMELINE_NOTE_Shared_by_X_USERS;
|
|
|
|
|
extern const char *Txt_TIMELINE_NOTE_Not_shared_by_anyone;
|
|
|
|
|
|
|
|
|
|
/***** Disabled icon to share *****/
|
|
|
|
|
if (NumShared)
|
|
|
|
|
{
|
|
|
|
|
Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_SHARE,
|
|
|
|
|
Str_BuildStringLong (Txt_TIMELINE_NOTE_Shared_by_X_USERS,
|
|
|
|
|
(long) NumShared));
|
|
|
|
|
Str_FreeString ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Ico_PutDivIcon ("TL_ICO_DISABLED",TL_ICON_SHARE,
|
|
|
|
|
Txt_TIMELINE_NOTE_Not_shared_by_anyone);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Form to share/unshare note **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-08 20:16:00 +01:00
|
|
|
|
static void TL_Sha_PutFormToShaNote (long ParamCod)
|
2021-02-08 18:33:16 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Share;
|
|
|
|
|
|
|
|
|
|
/***** Form and icon to mark note as favourite *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_FormFavSha (ActShaTL_NotGbl,ActShaTL_NotUsr,
|
2021-02-08 20:16:00 +01:00
|
|
|
|
"NotCod=%ld",ParamCod,
|
2021-02-08 18:33:16 +01:00
|
|
|
|
TL_ICON_SHARE,Txt_Share);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-08 20:16:00 +01:00
|
|
|
|
static void TL_Sha_PutFormToUnsNote (long ParamCod)
|
2021-02-08 18:33:16 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_TIMELINE_NOTE_Shared;
|
|
|
|
|
|
|
|
|
|
/***** Form and icon to mark note as favourite *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_FormFavSha (ActUnsTL_NotGbl,ActUnsTL_NotUsr,
|
2021-02-08 20:16:00 +01:00
|
|
|
|
"NotCod=%ld",ParamCod,
|
2021-02-08 18:33:16 +01:00
|
|
|
|
TL_ICON_SHARED,Txt_TIMELINE_NOTE_Shared);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************** Share a note *******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void TL_Sha_ShowAllSharersNoteUsr (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get user whom profile is displayed *****/
|
|
|
|
|
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
|
|
|
|
|
|
|
|
|
|
/***** Show all sharers *****/
|
|
|
|
|
TL_Sha_ShowAllSharersNoteGbl ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TL_Sha_ShowAllSharersNoteGbl (void)
|
|
|
|
|
{
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct TL_Not_Note Not;
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Get data of note *****/
|
2021-02-11 00:58:53 +01:00
|
|
|
|
Not.NotCod = TL_Not_GetParamNotCod ();
|
|
|
|
|
TL_Not_GetDataOfNoteByCod (&Not);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Write HTML inside DIV with form to share/unshare *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_PutFormToShaUnsNote (&Not,TL_SHOW_ALL_USRS);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TL_Sha_ShaNoteUsr (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get user whom profile is displayed *****/
|
|
|
|
|
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
|
|
|
|
|
|
|
|
|
|
/***** Share note *****/
|
|
|
|
|
TL_Sha_ShaNoteGbl ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TL_Sha_ShaNoteGbl (void)
|
|
|
|
|
{
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct TL_Not_Note Not;
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Share note *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_ShaNote (&Not);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Write HTML inside DIV with form to unshare *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_PutFormToShaUnsNote (&Not,TL_SHOW_FEW_USRS);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void TL_Sha_ShaNote (struct TL_Not_Note *Not)
|
2021-02-08 18:33:16 +01:00
|
|
|
|
{
|
2021-02-11 13:10:08 +01:00
|
|
|
|
struct TL_Pub_Publication Pub;
|
2021-02-08 18:33:16 +01:00
|
|
|
|
bool ItsMe;
|
|
|
|
|
long OriginalPubCod;
|
|
|
|
|
|
|
|
|
|
/***** Get data of note *****/
|
2021-02-11 00:58:53 +01:00
|
|
|
|
Not->NotCod = TL_Not_GetParamNotCod ();
|
|
|
|
|
TL_Not_GetDataOfNoteByCod (Not);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
2021-02-10 19:53:57 +01:00
|
|
|
|
if (Not->NotCod > 0)
|
2021-02-08 18:33:16 +01:00
|
|
|
|
{
|
2021-02-10 19:53:57 +01:00
|
|
|
|
ItsMe = Usr_ItsMe (Not->UsrCod);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
if (Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
2021-02-10 19:53:57 +01:00
|
|
|
|
if (!TL_Sha_CheckIfNoteIsSharedByUsr (Not->NotCod,
|
2021-02-11 00:58:53 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // Not yet shared by me
|
2021-02-08 18:33:16 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Share (publish note in timeline) *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
Pub.NotCod = Not->NotCod;
|
|
|
|
|
Pub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
|
|
|
|
Pub.PubType = TL_PUB_SHARED_NOTE;
|
2021-02-11 13:10:08 +01:00
|
|
|
|
TL_Pub_PublishPubInTimeline (&Pub); // Set Pub.PubCod
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/* Update number of times this note is shared */
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_UpdateNumTimesANoteHasBeenShared (Not);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/**** Create notification about shared post
|
|
|
|
|
for the author of the post ***/
|
2021-02-11 00:58:53 +01:00
|
|
|
|
OriginalPubCod = TL_Not_GetPubCodOfOriginalNote (Not->NotCod);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
if (OriginalPubCod > 0)
|
2021-02-11 13:10:08 +01:00
|
|
|
|
TL_Pub_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod,Ntf_EVENT_TIMELINE_SHARE);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Unshare a previously shared note ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void TL_Sha_UnsNoteUsr (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get user whom profile is displayed *****/
|
|
|
|
|
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
|
|
|
|
|
|
|
|
|
|
/***** Unshare note *****/
|
|
|
|
|
TL_Sha_UnsNoteGbl ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TL_Sha_UnsNoteGbl (void)
|
|
|
|
|
{
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct TL_Not_Note Not;
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Unshare note *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_UnsNote (&Not);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Write HTML inside DIV with form to share *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_PutFormToShaUnsNote (&Not,TL_SHOW_FEW_USRS);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void TL_Sha_UnsNote (struct TL_Not_Note *Not)
|
2021-02-08 18:33:16 +01:00
|
|
|
|
{
|
|
|
|
|
// extern const char *Txt_The_original_post_no_longer_exists;
|
|
|
|
|
long OriginalPubCod;
|
|
|
|
|
bool ItsMe;
|
|
|
|
|
|
|
|
|
|
/***** Get data of note *****/
|
2021-02-11 00:58:53 +01:00
|
|
|
|
Not->NotCod = TL_Not_GetParamNotCod ();
|
|
|
|
|
TL_Not_GetDataOfNoteByCod (Not);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
2021-02-10 19:53:57 +01:00
|
|
|
|
if (Not->NotCod > 0)
|
2021-02-08 18:33:16 +01:00
|
|
|
|
{
|
2021-02-10 19:53:57 +01:00
|
|
|
|
ItsMe = Usr_ItsMe (Not->UsrCod);
|
|
|
|
|
if (Not->NumShared &&
|
2021-02-08 18:33:16 +01:00
|
|
|
|
Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
2021-02-10 19:53:57 +01:00
|
|
|
|
if (TL_Sha_CheckIfNoteIsSharedByUsr (Not->NotCod,
|
2021-02-08 18:33:16 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // I am a sharer
|
|
|
|
|
{
|
|
|
|
|
/***** Delete publication from database *****/
|
|
|
|
|
DB_QueryDELETE ("can not remove a publication",
|
|
|
|
|
"DELETE FROM tl_pubs"
|
|
|
|
|
" WHERE NotCod=%ld"
|
|
|
|
|
" AND PublisherCod=%ld"
|
|
|
|
|
" AND PubType=%u",
|
2021-02-10 19:53:57 +01:00
|
|
|
|
Not->NotCod,
|
2021-02-08 18:33:16 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
(unsigned) TL_PUB_SHARED_NOTE);
|
|
|
|
|
|
|
|
|
|
/***** Update number of times this note is shared *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_UpdateNumTimesANoteHasBeenShared (Not);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Mark possible notifications on this note as removed *****/
|
2021-02-11 00:58:53 +01:00
|
|
|
|
OriginalPubCod = TL_Not_GetPubCodOfOriginalNote (Not->NotCod);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
if (OriginalPubCod > 0)
|
|
|
|
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_SHARE,OriginalPubCod);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
void TL_Sha_PutFormToShaUnsNote (const struct TL_Not_Note *Not,
|
2021-02-08 18:33:16 +01:00
|
|
|
|
TL_HowManyUsrs_t HowManyUsrs)
|
|
|
|
|
{
|
|
|
|
|
bool IAmTheAuthor;
|
2021-02-10 19:53:57 +01:00
|
|
|
|
bool IAmASharerOfThisNot;
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Put form to share/unshare this note *****/
|
|
|
|
|
HTM_DIV_Begin ("class=\"TL_ICO\"");
|
2021-02-10 19:53:57 +01:00
|
|
|
|
IAmTheAuthor = Usr_ItsMe (Not->UsrCod);
|
|
|
|
|
if (Not->Unavailable || // Unavailable notes can not be shared
|
2021-02-08 18:33:16 +01:00
|
|
|
|
IAmTheAuthor) // I am the author
|
|
|
|
|
/* Put disabled icon */
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_PutDisabledIconShare (Not->NumShared);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
else // Available and I am not the author
|
|
|
|
|
{
|
|
|
|
|
/* Put icon to share/unshare */
|
2021-02-10 19:53:57 +01:00
|
|
|
|
IAmASharerOfThisNot = TL_Sha_CheckIfNoteIsSharedByUsr (Not->NotCod,
|
2021-02-08 18:33:16 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
2021-02-10 19:53:57 +01:00
|
|
|
|
if (IAmASharerOfThisNot) // I have shared this note
|
|
|
|
|
TL_Sha_PutFormToUnsNote (Not->NotCod);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
else // I have not shared this note
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_PutFormToShaNote (Not->NotCod);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
}
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
/***** Show who have shared this note *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_Sha_ShowUsrsWhoHaveSharedNote (Not,HowManyUsrs);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Check if a user has published a note *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static bool TL_Sha_CheckIfNoteIsSharedByUsr (long NotCod,long UsrCod)
|
|
|
|
|
{
|
|
|
|
|
return (DB_QueryCOUNT ("can not check if a user has shared a note",
|
|
|
|
|
"SELECT COUNT(*) FROM tl_pubs"
|
|
|
|
|
" WHERE NotCod=%ld"
|
|
|
|
|
" AND PublisherCod=%ld"
|
|
|
|
|
" AND PubType=%u",
|
|
|
|
|
NotCod,
|
|
|
|
|
UsrCod,
|
|
|
|
|
(unsigned) TL_PUB_SHARED_NOTE) != 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get number of times a note has been shared in timeline ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
void TL_Sha_UpdateNumTimesANoteHasBeenShared (struct TL_Not_Note *Not)
|
2021-02-08 18:33:16 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get number of times (users) this note has been shared *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
Not->NumShared =
|
2021-02-08 18:33:16 +01:00
|
|
|
|
(unsigned) DB_QueryCOUNT ("can not get number of times"
|
|
|
|
|
" a note has been shared",
|
|
|
|
|
"SELECT COUNT(*) FROM tl_pubs"
|
|
|
|
|
" WHERE NotCod=%ld"
|
|
|
|
|
" AND PublisherCod<>%ld"
|
|
|
|
|
" AND PubType=%u",
|
2021-02-10 19:53:57 +01:00
|
|
|
|
Not->NotCod,
|
|
|
|
|
Not->UsrCod, // The author
|
2021-02-08 18:33:16 +01:00
|
|
|
|
(unsigned) TL_PUB_SHARED_NOTE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Show users who have shared this note ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void TL_Sha_ShowUsrsWhoHaveSharedNote (const struct TL_Not_Note *Not,
|
2021-02-08 18:33:16 +01:00
|
|
|
|
TL_HowManyUsrs_t HowManyUsrs)
|
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
2021-02-08 19:04:47 +01:00
|
|
|
|
unsigned NumFirstUsrs;
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Get users who have shared this note *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
if (Not->NumShared)
|
2021-02-08 18:33:16 +01:00
|
|
|
|
NumFirstUsrs =
|
|
|
|
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get users",
|
|
|
|
|
"SELECT PublisherCod FROM tl_pubs"
|
|
|
|
|
" WHERE NotCod=%ld"
|
|
|
|
|
" AND PublisherCod<>%ld"
|
|
|
|
|
" AND PubType=%u"
|
|
|
|
|
" ORDER BY PubCod LIMIT %u",
|
2021-02-10 19:53:57 +01:00
|
|
|
|
Not->NotCod,
|
|
|
|
|
Not->UsrCod,
|
2021-02-08 18:33:16 +01:00
|
|
|
|
(unsigned) TL_PUB_SHARED_NOTE,
|
|
|
|
|
HowManyUsrs == TL_SHOW_FEW_USRS ? TL_DEF_USRS_SHOWN :
|
2021-02-08 19:04:47 +01:00
|
|
|
|
TL_MAX_USRS_SHOWN);
|
|
|
|
|
else
|
|
|
|
|
NumFirstUsrs = 0;
|
2021-02-08 18:33:16 +01:00
|
|
|
|
|
|
|
|
|
/***** Show users *****/
|
2021-02-08 19:04:47 +01:00
|
|
|
|
/* Number of users */
|
2021-02-08 18:33:16 +01:00
|
|
|
|
HTM_DIV_Begin ("class=\"TL_NUM_USRS\"");
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_ShowNumSharersOrFavers (Not->NumShared);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
2021-02-08 19:04:47 +01:00
|
|
|
|
/* List users one by one */
|
2021-02-08 18:33:16 +01:00
|
|
|
|
HTM_DIV_Begin ("class=\"TL_USRS\"");
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_ShowSharersOrFavers (&mysql_res,Not->NumShared,NumFirstUsrs);
|
|
|
|
|
if (NumFirstUsrs < Not->NumShared)
|
2021-02-08 19:04:47 +01:00
|
|
|
|
/* Clickable ellipsis to show all users */
|
2021-02-10 19:53:57 +01:00
|
|
|
|
TL_PutFormToSeeAllFaversSharers (ActAllShaTL_NotGbl,ActAllShaTL_NotUsr,
|
|
|
|
|
"NotCod=%ld",Not->NotCod,
|
2021-02-08 20:16:00 +01:00
|
|
|
|
HowManyUsrs);
|
2021-02-08 18:33:16 +01:00
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
2021-02-10 19:53:57 +01:00
|
|
|
|
if (Not->NumShared)
|
2021-02-08 18:33:16 +01:00
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|