mirror of https://github.com/acanas/swad-core.git
Version19.70
This commit is contained in:
parent
23ef5cb1bd
commit
d1dfae9cde
|
@ -1513,6 +1513,19 @@ a:hover /* Default ==> underlined */
|
|||
background-image:-webkit-linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2)); /* Safari */
|
||||
background-image:linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.2));
|
||||
}
|
||||
|
||||
.BT_LINK
|
||||
{
|
||||
background:none;
|
||||
border:none;
|
||||
padding:0;
|
||||
font:inherit;
|
||||
}
|
||||
.BT_LINK:hover
|
||||
{
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/********************************** Notice ***********************************/
|
||||
.NOTICE_HIGHLIGHT
|
||||
|
@ -3463,8 +3476,7 @@ a:hover img.CENTRE_PHOTO_SHOW
|
|||
.TL_EXPAND_COM
|
||||
{
|
||||
text-align:center;
|
||||
vertical-align:top;
|
||||
padding-bottom:10px;
|
||||
padding:10px 0;
|
||||
}
|
||||
.TL_ICO_COM_OFF
|
||||
{
|
|
@ -811,14 +811,49 @@ function evalScriptsInElem (elem) {
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Show hidden comments social timeline using AJAX ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
//This function is called when user submit a form inside two parent divs
|
||||
function updateDivHiddenComments (form,Params) {
|
||||
var objXMLHttp = false;
|
||||
var id = form.parentNode.parentNode.id;
|
||||
|
||||
objXMLHttp = AJAXCreateObject ();
|
||||
if (objXMLHttp) {
|
||||
/* Send request to server */
|
||||
objXMLHttp.onreadystatechange = function() { // onreadystatechange must be lowercase
|
||||
if (objXMLHttp.readyState == 4) { // Check if data have been received
|
||||
if (objXMLHttp.status == 200)
|
||||
if (id) {
|
||||
var div = document.getElementById(id); // Access to DIV
|
||||
if (div) {
|
||||
div.innerHTML = objXMLHttp.responseText; // Update DIV content
|
||||
|
||||
// Scripts in div got via AJAX are not executed ==> execute them
|
||||
evalScriptsInElem (div);
|
||||
|
||||
// Process mathematics; see http://docs.mathjax.org/en/latest/advanced/typeset.html
|
||||
MathJax.Hub.Queue(["Typeset",MathJax.Hub,div]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
objXMLHttp.open('POST',ActionAJAX,true);
|
||||
objXMLHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
objXMLHttp.send(Params);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Update fav or share area in social timeline using AJAX ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
// This function is called when user submit a form just inside a parent div
|
||||
function updateDivFaversSharers (form,Params) {
|
||||
function updateDivLockUnlockProject (form,Params) {
|
||||
var objXMLHttp = false;
|
||||
var id = form.parentNode.parentNode.id;
|
||||
var id = form.parentNode.id;
|
||||
|
||||
objXMLHttp = AJAXCreateObject ();
|
||||
if (objXMLHttp) {
|
||||
|
@ -843,10 +878,10 @@ function updateDivFaversSharers (form,Params) {
|
|||
/************** Update lock/unlock area in project using AJAX ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// This function is called when user submit a form just inside a parent div
|
||||
function updateDivLockUnlockProject (form,Params) {
|
||||
// This function is called when user submit a form inside two parent divs
|
||||
function updateDivFaversSharers (form,Params) {
|
||||
var objXMLHttp = false;
|
||||
var id = form.parentNode.id;
|
||||
var id = form.parentNode.parentNode.id;
|
||||
|
||||
objXMLHttp = AJAXCreateObject ();
|
||||
if (objXMLHttp) {
|
||||
|
@ -1140,8 +1175,13 @@ function toggleAnswer (option) {
|
|||
/*****************************************************************************/
|
||||
|
||||
function toggleDisplay (elementID) {
|
||||
var stl = document.getElementById (elementID).style;
|
||||
stl.display = (stl.display === 'none') ? '' : 'none';
|
||||
var element = document.getElementById (elementID);
|
||||
var stl;
|
||||
|
||||
if (element) {
|
||||
stl = element.style;
|
||||
stl.display = (stl.display === 'none') ? '' : 'none';
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
1181
swad_action.c
1181
swad_action.c
File diff suppressed because it is too large
Load Diff
|
@ -64,9 +64,9 @@ typedef enum
|
|||
|
||||
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
||||
|
||||
#define Act_NUM_ACTIONS (1 + 4 + 64 + 38 + 12 + 42 + 36 + 19 + 110 + 180 + 437 + 176 + 169 + 16 + 68)
|
||||
#define Act_NUM_ACTIONS (1 + 4 + 66 + 38 + 12 + 42 + 36 + 19 + 110 + 180 + 437 + 176 + 169 + 16 + 68)
|
||||
|
||||
#define Act_MAX_ACTION_COD 1805
|
||||
#define Act_MAX_ACTION_COD 1807
|
||||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
|
||||
|
||||
|
@ -108,58 +108,60 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
|
|||
#define ActRefOldSocPubGbl (ActWebSvc + 16)
|
||||
#define ActRcvSocPstGbl (ActWebSvc + 17)
|
||||
#define ActRcvSocComGbl (ActWebSvc + 18)
|
||||
#define ActAllShaSocNotGbl (ActWebSvc + 19)
|
||||
#define ActAllFavSocNotGbl (ActWebSvc + 20)
|
||||
#define ActAllFavSocComGbl (ActWebSvc + 21)
|
||||
#define ActShaSocNotGbl (ActWebSvc + 22)
|
||||
#define ActUnsSocNotGbl (ActWebSvc + 23)
|
||||
#define ActFavSocNotGbl (ActWebSvc + 24)
|
||||
#define ActUnfSocNotGbl (ActWebSvc + 25)
|
||||
#define ActFavSocComGbl (ActWebSvc + 26)
|
||||
#define ActUnfSocComGbl (ActWebSvc + 27)
|
||||
#define ActReqRemSocPubGbl (ActWebSvc + 28)
|
||||
#define ActRemSocPubGbl (ActWebSvc + 29)
|
||||
#define ActReqRemSocComGbl (ActWebSvc + 30)
|
||||
#define ActRemSocComGbl (ActWebSvc + 31)
|
||||
#define ActShoHidSocComGbl (ActWebSvc + 19)
|
||||
#define ActAllShaSocNotGbl (ActWebSvc + 20)
|
||||
#define ActAllFavSocNotGbl (ActWebSvc + 21)
|
||||
#define ActAllFavSocComGbl (ActWebSvc + 22)
|
||||
#define ActShaSocNotGbl (ActWebSvc + 23)
|
||||
#define ActUnsSocNotGbl (ActWebSvc + 24)
|
||||
#define ActFavSocNotGbl (ActWebSvc + 25)
|
||||
#define ActUnfSocNotGbl (ActWebSvc + 26)
|
||||
#define ActFavSocComGbl (ActWebSvc + 27)
|
||||
#define ActUnfSocComGbl (ActWebSvc + 28)
|
||||
#define ActReqRemSocPubGbl (ActWebSvc + 29)
|
||||
#define ActRemSocPubGbl (ActWebSvc + 30)
|
||||
#define ActReqRemSocComGbl (ActWebSvc + 31)
|
||||
#define ActRemSocComGbl (ActWebSvc + 32)
|
||||
|
||||
#define ActReqOthPubPrf (ActWebSvc + 32)
|
||||
#define ActReqOthPubPrf (ActWebSvc + 33)
|
||||
|
||||
#define ActRefOldSocPubUsr (ActWebSvc + 33)
|
||||
#define ActRcvSocPstUsr (ActWebSvc + 34)
|
||||
#define ActRcvSocComUsr (ActWebSvc + 35)
|
||||
#define ActAllShaSocNotUsr (ActWebSvc + 36)
|
||||
#define ActAllFavSocNotUsr (ActWebSvc + 37)
|
||||
#define ActAllFavSocComUsr (ActWebSvc + 38)
|
||||
#define ActShaSocNotUsr (ActWebSvc + 39)
|
||||
#define ActUnsSocNotUsr (ActWebSvc + 40)
|
||||
#define ActFavSocNotUsr (ActWebSvc + 41)
|
||||
#define ActUnfSocNotUsr (ActWebSvc + 42)
|
||||
#define ActFavSocComUsr (ActWebSvc + 43)
|
||||
#define ActUnfSocComUsr (ActWebSvc + 44)
|
||||
#define ActReqRemSocPubUsr (ActWebSvc + 45)
|
||||
#define ActRemSocPubUsr (ActWebSvc + 46)
|
||||
#define ActReqRemSocComUsr (ActWebSvc + 47)
|
||||
#define ActRemSocComUsr (ActWebSvc + 48)
|
||||
#define ActRefOldSocPubUsr (ActWebSvc + 34)
|
||||
#define ActRcvSocPstUsr (ActWebSvc + 35)
|
||||
#define ActRcvSocComUsr (ActWebSvc + 36)
|
||||
#define ActShoHidSocComUsr (ActWebSvc + 37)
|
||||
#define ActAllShaSocNotUsr (ActWebSvc + 38)
|
||||
#define ActAllFavSocNotUsr (ActWebSvc + 39)
|
||||
#define ActAllFavSocComUsr (ActWebSvc + 40)
|
||||
#define ActShaSocNotUsr (ActWebSvc + 41)
|
||||
#define ActUnsSocNotUsr (ActWebSvc + 42)
|
||||
#define ActFavSocNotUsr (ActWebSvc + 43)
|
||||
#define ActUnfSocNotUsr (ActWebSvc + 44)
|
||||
#define ActFavSocComUsr (ActWebSvc + 45)
|
||||
#define ActUnfSocComUsr (ActWebSvc + 46)
|
||||
#define ActReqRemSocPubUsr (ActWebSvc + 47)
|
||||
#define ActRemSocPubUsr (ActWebSvc + 48)
|
||||
#define ActReqRemSocComUsr (ActWebSvc + 49)
|
||||
#define ActRemSocComUsr (ActWebSvc + 50)
|
||||
|
||||
#define ActSeeOthPubPrf (ActWebSvc + 49)
|
||||
#define ActCalFig (ActWebSvc + 50)
|
||||
#define ActSeeOthPubPrf (ActWebSvc + 51)
|
||||
#define ActCalFig (ActWebSvc + 52)
|
||||
|
||||
#define ActFolUsr (ActWebSvc + 51)
|
||||
#define ActUnfUsr (ActWebSvc + 52)
|
||||
#define ActSeeFlg (ActWebSvc + 53)
|
||||
#define ActSeeFlr (ActWebSvc + 54)
|
||||
#define ActFolUsr (ActWebSvc + 53)
|
||||
#define ActUnfUsr (ActWebSvc + 54)
|
||||
#define ActSeeFlg (ActWebSvc + 55)
|
||||
#define ActSeeFlr (ActWebSvc + 56)
|
||||
|
||||
#define ActPrnCal (ActWebSvc + 55)
|
||||
#define ActChgCal1stDay (ActWebSvc + 56)
|
||||
#define ActPrnCal (ActWebSvc + 57)
|
||||
#define ActChgCal1stDay (ActWebSvc + 58)
|
||||
|
||||
#define ActSeeNewNtf (ActWebSvc + 57)
|
||||
#define ActMrkNtfSee (ActWebSvc + 58)
|
||||
#define ActSeeMai (ActWebSvc + 59)
|
||||
#define ActEdiMai (ActWebSvc + 60)
|
||||
#define ActNewMai (ActWebSvc + 61)
|
||||
#define ActRemMai (ActWebSvc + 62)
|
||||
#define ActRenMaiSho (ActWebSvc + 63)
|
||||
#define ActRenMaiFul (ActWebSvc + 64)
|
||||
#define ActSeeNewNtf (ActWebSvc + 59)
|
||||
#define ActMrkNtfSee (ActWebSvc + 60)
|
||||
#define ActSeeMai (ActWebSvc + 61)
|
||||
#define ActEdiMai (ActWebSvc + 62)
|
||||
#define ActNewMai (ActWebSvc + 63)
|
||||
#define ActRemMai (ActWebSvc + 64)
|
||||
#define ActRenMaiSho (ActWebSvc + 65)
|
||||
#define ActRenMaiFul (ActWebSvc + 66)
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** System tab *********************************/
|
||||
|
|
|
@ -488,12 +488,18 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
|||
En OpenSWAD:
|
||||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.69.1 (2019-11-15)"
|
||||
#define CSS_FILE "swad19.47.css"
|
||||
#define JS_FILE "swad19.65.js"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.70 (2019-11-17)"
|
||||
#define CSS_FILE "swad19.70.css"
|
||||
#define JS_FILE "swad19.70.js"
|
||||
/*
|
||||
// TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.)
|
||||
// TODO: Impedir la creación y edición de proyectos si no son editables.
|
||||
// TODO: Fix bug: cuando se envía una nueva publicación al timeline, si se baja al final y se pulsa en Mostrar más", se repiten los mensajes.
|
||||
|
||||
Version 19.70: Nov 17, 2019 Hidden comments in timeline are loaded on request using AJAX. (247028 lines)
|
||||
1 change necessary in database:
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1806','es','N','Ver comentarios ocultos (global)');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1807','es','N','Ver comentarios ocultos (usuario)');
|
||||
|
||||
Version 19.69.1: Nov 15, 2019 Fixed bugs in lists of users and hidden parameters. (246760 lines)
|
||||
Version 19.69: Nov 15, 2019 Code refactoring related with lists of users and hidden parameters. (246752 lines)
|
||||
|
|
|
@ -3184,7 +3184,8 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void)
|
|||
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get of the database the data of the user
|
||||
if (Usr_CheckIfICanViewAsgWrk (&Gbl.Usrs.Other.UsrDat))
|
||||
{
|
||||
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
Gbl.Usrs.Other.UsrDat.Accepted =
|
||||
Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
/***** Show a row with the data of the owner of the works *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
|
|
@ -135,7 +135,7 @@ static void Frm_StartFormInternal (Act_Action_t NextAction,bool PutParameterLoca
|
|||
HTM_TxtF ("\" id=\"%s\"",Id);
|
||||
if (OnSubmit)
|
||||
if (OnSubmit[0])
|
||||
HTM_TxtF (" onsubmit=\"%s;\"",OnSubmit);
|
||||
HTM_TxtF (" onsubmit=\"%s\"",OnSubmit);
|
||||
switch (Act_GetBrowserTab (NextAction))
|
||||
{
|
||||
case Act_BRW_NEW_TAB:
|
||||
|
|
10
swad_theme.c
10
swad_theme.c
|
@ -230,6 +230,16 @@ const char *The_ClassFormInBoxNoWrap[The_NUM_THEMES] =
|
|||
"FORM_IN_PINK NOWRAP",
|
||||
};
|
||||
|
||||
const char *The_ClassFormLink[The_NUM_THEMES] =
|
||||
{
|
||||
"BT_LINK FORM_IN_WHITE",
|
||||
"BT_LINK FORM_IN_GREY",
|
||||
"BT_LINK FORM_IN_PURPLE",
|
||||
"BT_LINK FORM_IN_BLUE",
|
||||
"BT_LINK FORM_IN_YELLOW",
|
||||
"BT_LINK FORM_IN_PINK",
|
||||
};
|
||||
|
||||
const char *The_ClassFormOutBox[The_NUM_THEMES] =
|
||||
{
|
||||
"FORM_OUT_WHITE",
|
||||
|
|
373
swad_timeline.c
373
swad_timeline.c
|
@ -204,8 +204,19 @@ static void TL_PutIconCommentDisabled (void);
|
|||
static void TL_PutHiddenFormToWriteNewCommentToNote (long NotCod,
|
||||
const char IdNewComment[Frm_MAX_BYTES_ID + 1]);
|
||||
static unsigned long TL_GetNumCommentsInNote (long NotCod);
|
||||
static void TL_WriteCommentsInNote (const struct TL_Note *SocNot);
|
||||
static void TL_WriteCommentsInNote (const struct TL_Note *SocNot,
|
||||
unsigned NumComments);
|
||||
static void TL_FormToShowHiddenComments (Act_Action_t ActionGbl,Act_Action_t ActionUsr,
|
||||
long NotCod,
|
||||
char IdComments[Frm_MAX_BYTES_ID + 1],
|
||||
unsigned NumInitialComments);
|
||||
static unsigned TL_WriteHiddenComments (long NotCod,
|
||||
char IdComments[Frm_MAX_BYTES_ID + 1],
|
||||
unsigned NumInitialCommentsToGet);
|
||||
static void TL_WriteOneCommentInList (MYSQL_RES *mysql_res);
|
||||
static void TL_LinkToShowOnlyLatestComments (const char IdComments[Frm_MAX_BYTES_ID + 1]);
|
||||
static void TL_LinkToShowPreviousComments (const char IdComments[Frm_MAX_BYTES_ID + 1],
|
||||
unsigned NumInitialComments);
|
||||
static void TL_PutIconToToggleComments (const char *UniqueId,
|
||||
const char *Icon,const char *Text);
|
||||
static void TL_WriteComment (struct TL_Comment *SocCom,
|
||||
|
@ -1670,7 +1681,7 @@ static void TL_WriteNote (const struct TL_Note *SocNot,
|
|||
|
||||
/* Show comments */
|
||||
if (NumComments)
|
||||
TL_WriteCommentsInNote (SocNot);
|
||||
TL_WriteCommentsInNote (SocNot,NumComments);
|
||||
|
||||
/* End container for buttons and comments */
|
||||
HTM_DIV_End ();
|
||||
|
@ -2578,76 +2589,119 @@ static unsigned long TL_GetNumCommentsInNote (long NotCod)
|
|||
/*********************** Write comments in a note ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TL_WriteCommentsInNote (const struct TL_Note *SocNot)
|
||||
static void TL_WriteCommentsInNote (const struct TL_Note *SocNot,
|
||||
unsigned NumComments)
|
||||
{
|
||||
extern const char *Txt_See_the_previous_X_COMMENTS;
|
||||
extern const char *Txt_See_only_the_latest_COMMENTS;
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned long NumComments;
|
||||
unsigned long NumCommentsInitiallyHidden;
|
||||
unsigned long NumCom;
|
||||
unsigned NumInitialComments;
|
||||
unsigned NumFinalCommentsToGet;
|
||||
unsigned NumFinalCommentsGot;
|
||||
unsigned NumCom;
|
||||
char IdComments[Frm_MAX_BYTES_ID + 1];
|
||||
|
||||
/***** Get comments of this note from database *****/
|
||||
NumComments = DB_QuerySELECT (&mysql_res,"can not get comments",
|
||||
"SELECT social_pubs.PubCod," // row[0]
|
||||
"social_pubs.PublisherCod," // row[1]
|
||||
"social_pubs.NotCod," // row[2]
|
||||
"UNIX_TIMESTAMP("
|
||||
"social_pubs.TimePublish)," // row[3]
|
||||
"social_comments.Content," // row[4]
|
||||
"social_comments.MedCod" // row[5]
|
||||
" FROM social_pubs,social_comments"
|
||||
" WHERE social_pubs.NotCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod"
|
||||
" ORDER BY social_pubs.PubCod",
|
||||
SocNot->NotCod,(unsigned) TL_PUB_COMMENT_TO_NOTE);
|
||||
|
||||
/***** List comments *****/
|
||||
if (NumComments) // Comments to this note found
|
||||
/***** Compute how many initial comments will be hidden
|
||||
and how many final comments will be visible *****/
|
||||
// Never hide only one comment
|
||||
// So, the number of comments initially hidden must be 0 or >= 2
|
||||
if (NumComments <= TL_NUM_VISIBLE_COMMENTS + 1)
|
||||
{
|
||||
// Never hide only one comment
|
||||
// So, the number of comments initially hidden must be 0 or >= 2
|
||||
NumCommentsInitiallyHidden = (NumComments <= TL_NUM_VISIBLE_COMMENTS + 1) ? 0 : // Show all
|
||||
NumComments - TL_NUM_VISIBLE_COMMENTS;
|
||||
if (NumCommentsInitiallyHidden)
|
||||
{
|
||||
/***** Create unique id for list of hidden comments *****/
|
||||
Frm_SetUniqueId (IdComments);
|
||||
NumInitialComments = 0;
|
||||
NumFinalCommentsToGet = NumComments;
|
||||
}
|
||||
else
|
||||
{
|
||||
NumInitialComments = NumComments - TL_NUM_VISIBLE_COMMENTS;
|
||||
NumFinalCommentsToGet = TL_NUM_VISIBLE_COMMENTS;
|
||||
}
|
||||
|
||||
/***** Link to toggle on/off comments *****/
|
||||
HTM_DIV_Begin ("id=\"con_%s\" class=\"TL_EXPAND_COM TL_RIGHT_WIDTH\""
|
||||
" style=\"display:none;\"", // Initially hidden
|
||||
IdComments);
|
||||
TL_PutIconToToggleComments (IdComments,"angle-down.svg",
|
||||
Txt_See_only_the_latest_COMMENTS);
|
||||
HTM_DIV_End ();
|
||||
/***** Get last comments of this note from database *****/
|
||||
NumFinalCommentsGot = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get comments",
|
||||
"SELECT * FROM "
|
||||
"("
|
||||
"SELECT social_pubs.PubCod," // row[0]
|
||||
"social_pubs.PublisherCod," // row[1]
|
||||
"social_pubs.NotCod," // row[2]
|
||||
"UNIX_TIMESTAMP("
|
||||
"social_pubs.TimePublish)," // row[3]
|
||||
"social_comments.Content," // row[4]
|
||||
"social_comments.MedCod" // row[5]
|
||||
" FROM social_pubs,social_comments"
|
||||
" WHERE social_pubs.NotCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod"
|
||||
" ORDER BY social_pubs.PubCod DESC LIMIT %u"
|
||||
") AS comments"
|
||||
" ORDER BY PubCod",
|
||||
SocNot->NotCod,(unsigned) TL_PUB_COMMENT_TO_NOTE,
|
||||
NumFinalCommentsToGet);
|
||||
|
||||
/***** First list with comments initially hidden *****/
|
||||
HTM_UL_Begin ("id=\"com_%s\" class=\"LIST_LEFT\""
|
||||
" style=\"display:none;\"", // Initially hidden
|
||||
IdComments);
|
||||
for (NumCom = 0;
|
||||
NumCom < NumCommentsInitiallyHidden;
|
||||
NumCom++)
|
||||
TL_WriteOneCommentInList (mysql_res);
|
||||
HTM_UL_End ();
|
||||
/*
|
||||
Before clicking "See prev..." --> After clicking "See prev..."
|
||||
_________________________________ _________________________________
|
||||
| div con_<id> | | div con_<id> |
|
||||
| (hidden) | | (visible) |
|
||||
| _____________________________ | | _____________________________ |
|
||||
| | v See only the latest | | | | v See only the latest | |
|
||||
| |_____________________________| | | |_____________________________| |
|
||||
|_________________________________| |_________________________________|
|
||||
_________________________________ _________________________________
|
||||
| div <id> | | div <id> updated |
|
||||
| which content | | _____________________________ |
|
||||
| will be updated via AJAX | | | ul com_<id> | |
|
||||
| (parent of parent of form) | | | _________________________ | |
|
||||
| | | | | li (comment 1) | | |
|
||||
| | | | |_________________________| | |
|
||||
| | | | | ... | | |
|
||||
| | | | |_________________________| | |
|
||||
| | | | | li (comment n) | | |
|
||||
| | --> | | |_________________________| | |
|
||||
| | | |_____________________________| |
|
||||
| _____________________________ | | _____________________________ |
|
||||
| | div exp_<id> | | | | div exp_<id> | |
|
||||
| | _________________________ | | | | (hidden) | |
|
||||
| | | form | | | | | | |
|
||||
| | | _____________________ | | | | | _____________________ | |
|
||||
| | | | ^ See prev.comments | | | | | | | ^ See prev.comments | | |
|
||||
| | | |_____________________| | | | | | |_____________________| | |
|
||||
| | |_________________________| | | | | | |
|
||||
| |_____________________________| | | |_____________________________| |
|
||||
|_________________________________| |_________________________________|
|
||||
_________________________________ _________________________________
|
||||
| ul com_<id> | | ul com_<id> |
|
||||
| _________________________ | | _________________________ |
|
||||
| | li (comment 1) | | | | li (comment 1) | |
|
||||
| |_________________________| | | |_________________________| |
|
||||
| | ... | | | | ... | |
|
||||
| |_________________________| | | |_________________________| |
|
||||
| | li (comment n) | | | | li (comment n) | |
|
||||
| |_________________________| | | |_________________________| |
|
||||
|_________________________________| |_________________________________|
|
||||
*/
|
||||
/***** Link to show initial hidden comments *****/
|
||||
if (NumInitialComments)
|
||||
{
|
||||
/***** Create unique id for list of hidden comments *****/
|
||||
Frm_SetUniqueId (IdComments);
|
||||
|
||||
/***** Link to toggle on/off comments *****/
|
||||
HTM_DIV_Begin ("id=\"exp_%s\" class=\"TL_EXPAND_COM TL_RIGHT_WIDTH\"",
|
||||
IdComments);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_See_the_previous_X_COMMENTS,
|
||||
NumCommentsInitiallyHidden);
|
||||
TL_PutIconToToggleComments (IdComments,"angle-up.svg",Gbl.Title);
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
/***** Link (initially hidden) to show only the latest comments *****/
|
||||
TL_LinkToShowOnlyLatestComments (IdComments);
|
||||
|
||||
/***** Second list with comments initially visible *****/
|
||||
HTM_UL_Begin ("class=\"LIST_LEFT\"");
|
||||
for (NumCom = NumCommentsInitiallyHidden;
|
||||
NumCom < NumComments;
|
||||
/***** Div which content will be updated via AJAX *****/
|
||||
HTM_DIV_Begin ("id=\"%s\" class=\"TL_RIGHT_WIDTH\"",IdComments);
|
||||
TL_FormToShowHiddenComments (ActShoHidSocComGbl,ActShoHidSocComUsr,
|
||||
SocNot->NotCod,
|
||||
IdComments,
|
||||
NumInitialComments);
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
|
||||
/***** List final visible comments *****/
|
||||
if (NumFinalCommentsGot)
|
||||
{
|
||||
HTM_UL_Begin ("class=\"TL_LIST\"");
|
||||
for (NumCom = 0;
|
||||
NumCom < NumFinalCommentsGot;
|
||||
NumCom++)
|
||||
TL_WriteOneCommentInList (mysql_res);
|
||||
HTM_UL_End ();
|
||||
|
@ -2657,6 +2711,160 @@ static void TL_WriteCommentsInNote (const struct TL_Note *SocNot)
|
|||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Form to show hidden coments in global or user timeline ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TL_FormToShowHiddenComments (Act_Action_t ActionGbl,Act_Action_t ActionUsr,
|
||||
long NotCod,
|
||||
char IdComments[Frm_MAX_BYTES_ID + 1],
|
||||
unsigned NumInitialComments)
|
||||
{
|
||||
extern const char *The_ClassFormLink[The_NUM_THEMES];
|
||||
extern const char *Txt_See_the_previous_X_COMMENTS;
|
||||
char *OnSubmit;
|
||||
|
||||
HTM_DIV_Begin ("id=\"exp_%s\" class=\"TL_EXPAND_COM TL_RIGHT_WIDTH\"",
|
||||
IdComments);
|
||||
|
||||
/***** Form and icon-text to show hidden comments *****/
|
||||
/* Start form */
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
||||
{
|
||||
if (asprintf (&OnSubmit,"toggleComments('%s');"
|
||||
"updateDivHiddenComments(this,"
|
||||
"'act=%ld&ses=%s&NotCod=%ld&IdComments=%s&NumHidCom=%u&OtherUsrCod=%s');"
|
||||
" return false;", // return false is necessary to not submit form
|
||||
IdComments,
|
||||
Act_GetActCod (ActionUsr),
|
||||
Gbl.Session.Id,
|
||||
NotCod,
|
||||
IdComments,
|
||||
NumInitialComments,
|
||||
Gbl.Usrs.Other.UsrDat.EncryptedUsrCod) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
Frm_StartFormUniqueAnchorOnSubmit (ActUnk,"timeline",OnSubmit);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (asprintf (&OnSubmit,"toggleComments('%s');"
|
||||
"updateDivHiddenComments(this,"
|
||||
"'act=%ld&ses=%s&NotCod=%ld&IdComments=%s&NumHidCom=%u');"
|
||||
" return false;", // return false is necessary to not submit form
|
||||
IdComments,
|
||||
Act_GetActCod (ActionGbl),
|
||||
Gbl.Session.Id,
|
||||
NotCod,
|
||||
IdComments,
|
||||
NumInitialComments) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
Frm_StartFormUniqueAnchorOnSubmit (ActUnk,NULL,OnSubmit);
|
||||
}
|
||||
|
||||
/* Put icon and text with link to show the first hidden comments */
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_See_the_previous_X_COMMENTS,
|
||||
NumInitialComments);
|
||||
HTM_BUTTON_Begin (The_ClassFormLink[Gbl.Prefs.Theme],false);
|
||||
Ico_PutIconTextLink ("angle-up.svg",Gbl.Title);
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
/* End form */
|
||||
Frm_EndForm ();
|
||||
|
||||
/* Free allocated memory for subquery */
|
||||
free (OnSubmit);
|
||||
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Write hidden comments via AJAX ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void TL_ShowHiddenCommentsUsr (void)
|
||||
{
|
||||
/***** Get user whom profile is displayed *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
|
||||
|
||||
/***** Show hidden comments *****/
|
||||
TL_ShowHiddenCommentsGbl ();
|
||||
}
|
||||
|
||||
void TL_ShowHiddenCommentsGbl (void)
|
||||
{
|
||||
long NotCod;
|
||||
char IdComments[Frm_MAX_BYTES_ID + 1];
|
||||
unsigned NumInitialCommentsToGet;
|
||||
unsigned NumInitialCommentsGot;
|
||||
|
||||
/***** Get parameters *****/
|
||||
/* Get note code */
|
||||
NotCod = TL_GetParamNotCod ();
|
||||
|
||||
/* Get identifier */
|
||||
Par_GetParToText ("IdComments",IdComments,Frm_MAX_BYTES_ID);
|
||||
|
||||
/* Get number of comments to get */
|
||||
NumInitialCommentsToGet = (unsigned) Par_GetParToLong ("NumHidCom");
|
||||
|
||||
/***** Write HTML inside DIV with hidden comments *****/
|
||||
NumInitialCommentsGot = TL_WriteHiddenComments (NotCod,IdComments,NumInitialCommentsToGet);
|
||||
|
||||
/***** Link to show the first comments *****/
|
||||
TL_LinkToShowPreviousComments (IdComments,NumInitialCommentsGot);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Write hidden comments **************************/
|
||||
/*****************************************************************************/
|
||||
// Returns the number of comments got
|
||||
|
||||
static unsigned TL_WriteHiddenComments (long NotCod,
|
||||
char IdComments[Frm_MAX_BYTES_ID + 1],
|
||||
unsigned NumInitialCommentsToGet)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
unsigned long NumInitialCommentsGot;
|
||||
unsigned long NumCom;
|
||||
|
||||
/***** Get comments of this note from database *****/
|
||||
NumInitialCommentsGot = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get comments",
|
||||
"SELECT social_pubs.PubCod," // row[0]
|
||||
"social_pubs.PublisherCod," // row[1]
|
||||
"social_pubs.NotCod," // row[2]
|
||||
"UNIX_TIMESTAMP("
|
||||
"social_pubs.TimePublish)," // row[3]
|
||||
"social_comments.Content," // row[4]
|
||||
"social_comments.MedCod" // row[5]
|
||||
" FROM social_pubs,social_comments"
|
||||
" WHERE social_pubs.NotCod=%ld"
|
||||
" AND social_pubs.PubType=%u"
|
||||
" AND social_pubs.PubCod=social_comments.PubCod"
|
||||
" ORDER BY social_pubs.PubCod"
|
||||
" LIMIT %lu",
|
||||
NotCod,(unsigned) TL_PUB_COMMENT_TO_NOTE,
|
||||
NumInitialCommentsToGet);
|
||||
|
||||
/***** List with comments *****/
|
||||
HTM_UL_Begin ("id=\"com_%s\" class=\"TL_LIST\"",IdComments);
|
||||
for (NumCom = 0;
|
||||
NumCom < NumInitialCommentsGot;
|
||||
NumCom++)
|
||||
TL_WriteOneCommentInList (mysql_res);
|
||||
HTM_UL_End ();
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return NumInitialCommentsGot;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Write a comment in list ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TL_WriteOneCommentInList (MYSQL_RES *mysql_res)
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
|
@ -2678,6 +2886,45 @@ static void TL_WriteOneCommentInList (MYSQL_RES *mysql_res)
|
|||
Med_MediaDestructor (&SocCom.Media);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Link to show only the latest comments ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TL_LinkToShowOnlyLatestComments (const char IdComments[Frm_MAX_BYTES_ID + 1])
|
||||
{
|
||||
extern const char *Txt_See_only_the_latest_COMMENTS;
|
||||
|
||||
/***** Icon and text to show only the latest comments ****/
|
||||
HTM_DIV_Begin ("id=\"con_%s\" class=\"TL_EXPAND_COM TL_RIGHT_WIDTH\""
|
||||
" style=\"display:none;\"", // Hidden
|
||||
IdComments);
|
||||
TL_PutIconToToggleComments (IdComments,"angle-down.svg",
|
||||
Txt_See_only_the_latest_COMMENTS);
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Link to show the first comments ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void TL_LinkToShowPreviousComments (const char IdComments[Frm_MAX_BYTES_ID + 1],
|
||||
unsigned NumInitialComments)
|
||||
{
|
||||
extern const char *Txt_See_the_previous_X_COMMENTS;
|
||||
|
||||
/***** Build text to show *****/
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_See_the_previous_X_COMMENTS,
|
||||
NumInitialComments);
|
||||
|
||||
/***** Icon and text to show only the latest comments ****/
|
||||
HTM_DIV_Begin ("id=\"exp_%s\" class=\"TL_EXPAND_COM TL_RIGHT_WIDTH\""
|
||||
" style=\"display:none;\"", // Hidden
|
||||
IdComments);
|
||||
TL_PutIconToToggleComments (IdComments,"angle-up.svg",Gbl.Title);
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Put an icon to toggle on/off comments in a publication ***********/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -142,6 +142,9 @@ void TL_MarkNotesChildrenOfFolderAsUnavailable (const char *Path);
|
|||
void TL_ReceivePostUsr (void);
|
||||
void TL_ReceivePostGbl (void);
|
||||
|
||||
void TL_ShowHiddenCommentsUsr (void);
|
||||
void TL_ShowHiddenCommentsGbl (void);
|
||||
|
||||
void TL_PutHiddenParamPubCod (long PubCod);
|
||||
|
||||
void TL_ReceiveCommentUsr (void);
|
||||
|
|
Loading…
Reference in New Issue