mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-08 09:45:26 +02:00
Version 18.57.1
This commit is contained in:
parent
f56c2f3d34
commit
ae5f8fadad
|
@ -1925,6 +1925,7 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************* User's photo ********************************/
|
/******************************* User's photo ********************************/
|
||||||
|
.PHOTO12x16 {width: 12px; height: 16px; border-radius:1px; vertical-align:middle; margin-top:-2px;}
|
||||||
.PHOTO15x20 {width: 15px; height: 20px; border-radius:2px; vertical-align:middle;}
|
.PHOTO15x20 {width: 15px; height: 20px; border-radius:2px; vertical-align:middle;}
|
||||||
.PHOTO15x20B {width: 15px; height: 20px; border-radius:2px; display:block; margin:0 auto;}
|
.PHOTO15x20B {width: 15px; height: 20px; border-radius:2px; display:block; margin:0 auto;}
|
||||||
.PHOTO18x24 {width: 18px; height: 24px; border-radius:2px; vertical-align:middle;}
|
.PHOTO18x24 {width: 18px; height: 24px; border-radius:2px; vertical-align:middle;}
|
|
@ -689,7 +689,75 @@ function expandTextarea (textareaElem,idButton,rows) {
|
||||||
document.getElementById(idButton).style.display = '';
|
document.getElementById(idButton).style.display = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Change display of a project
|
/*****************************************************************************/
|
||||||
|
/************** Update fav area in social timeline using AJAX ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
var objXMLHttpReqFavSocNot = false;
|
||||||
|
var idDivFav = null;
|
||||||
|
|
||||||
|
// This function is called when user clicks in icon to fav/unfav
|
||||||
|
function refreshFavSocNot (elem,ActCod,NotCod) {
|
||||||
|
idDivFav = elem.parentNode.id;
|
||||||
|
|
||||||
|
objXMLHttpReqFavSocNot = AJAXCreateObject ();
|
||||||
|
if (objXMLHttpReqFavSocNot) {
|
||||||
|
/* Build request parameters */
|
||||||
|
var RefreshParams = 'act=' + ActCod + '&' +
|
||||||
|
RefreshParamIdSes + '&' +
|
||||||
|
'NotCod=' + NotCod;
|
||||||
|
if (RefreshParamUsr) {
|
||||||
|
if (RefreshParamUsr.length)
|
||||||
|
RefreshParams += '&' + RefreshParamUsr;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (RefreshParamWhichUsrs.length)
|
||||||
|
RefreshParams += '&' + RefreshParamWhichUsrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Send request to server */
|
||||||
|
objXMLHttpReqFavSocNot.onreadystatechange = readAndUpdateFav; // onreadystatechange must be lowercase
|
||||||
|
objXMLHttpReqFavSocNot.open('POST',ActionAJAX,true);
|
||||||
|
objXMLHttpReqFavSocNot.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||||
|
objXMLHttpReqFavSocNot.send(RefreshParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Receives and shows fav note area: icon and users who have faved a social note or comment
|
||||||
|
function readAndUpdateFav () {
|
||||||
|
if (objXMLHttpReqFavSocNot.readyState == 4) { // Check if data have been received
|
||||||
|
if (objXMLHttpReqFavSocNot.status == 200)
|
||||||
|
if (idDivFav) {
|
||||||
|
var htmlFav = objXMLHttpReqFavSocNot.responseText;
|
||||||
|
var divFav = document.getElementById(idDivFav); // Access to last click DIV
|
||||||
|
if (divFav) {
|
||||||
|
divFav.innerHTML = htmlFav; // Update fav area DIV
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function readLastClicksData () {
|
||||||
|
if (objXMLHttpReqLog.readyState == 4) { // Check if data have been received
|
||||||
|
if (objXMLHttpReqLog.status == 200) {
|
||||||
|
var endOfDelay = objXMLHttpReqLog.responseText.indexOf('|',0); // Get separator position
|
||||||
|
|
||||||
|
var delay = parseInt(objXMLHttpReqLog.responseText.substring(0,endOfDelay)); // Get refresh delay
|
||||||
|
var htmlLastClicks = objXMLHttpReqLog.responseText.substring(endOfDelay + 1); // Get HTML code for last clicks
|
||||||
|
|
||||||
|
var divLastClicks = document.getElementById('lastclicks'); // Access to last click DIV
|
||||||
|
if (divLastClicks)
|
||||||
|
divLastClicks.innerHTML = htmlLastClicks; // Update global connected DIV
|
||||||
|
if (delay > 200) // If refresh slower than 1 time each 0.2 seconds, do refresh; else abort
|
||||||
|
setTimeout('refreshLastClicks()',delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************ Change display of a project ************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
function toggleProject (prjID) {
|
function toggleProject (prjID) {
|
||||||
toggleDisplay('prj_exp_' + prjID);
|
toggleDisplay('prj_exp_' + prjID);
|
||||||
toggleDisplay('prj_con_' + prjID);
|
toggleDisplay('prj_con_' + prjID);
|
||||||
|
@ -700,14 +768,20 @@ function toggleProject (prjID) {
|
||||||
toggleDisplay('prj_url_' + prjID);
|
toggleDisplay('prj_url_' + prjID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change display of a test answer
|
/*****************************************************************************/
|
||||||
|
/********************** Change display of a test answer **********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
function toggleAnswer (option) {
|
function toggleAnswer (option) {
|
||||||
toggleDisplay('ans_' + option);
|
toggleDisplay('ans_' + option);
|
||||||
toggleDisplay('con_' + option);
|
toggleDisplay('con_' + option);
|
||||||
toggleDisplay('exp_' + option);
|
toggleDisplay('exp_' + option);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change display of a element (hidden or visible)
|
/*****************************************************************************/
|
||||||
|
/************* Change display of an element (hidden or visible) **************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
function toggleDisplay (elementID) {
|
function toggleDisplay (elementID) {
|
||||||
var stl = document.getElementById (elementID).style;
|
var stl = document.getElementById (elementID).style;
|
||||||
stl.display = (stl.display === 'none') ? '' : 'none';
|
stl.display = (stl.display === 'none') ? '' : 'none';
|
|
@ -12598,3 +12598,16 @@ SELECT Weekday,TIME_TO_SEC(StartTime) AS S,TIME_TO_SEC(Duration) AS D,Place,Clas
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS firewall (ClickTime DATETIME NOT NULL,IP CHAR(15) NOT NULL,INDEX(ClickTime),INDEX(IP));
|
CREATE TABLE IF NOT EXISTS firewall (ClickTime DATETIME NOT NULL,IP CHAR(15) NOT NULL,INDEX(ClickTime),INDEX(IP));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SELECT UsrCod,FavCod FROM
|
||||||
|
(
|
||||||
|
(SELECT UsrCod,FavCod FROM social_notes_fav WHERE NotCod=278 ORDER BY FavCod)
|
||||||
|
UNION
|
||||||
|
(SELECT 1,(SELECT FavCod FROM social_notes_fav WHERE NotCod=278 AND UsrCod=1) AS FavCod)
|
||||||
|
ORDER BY FavCod LIMIT 7
|
||||||
|
) AS favers;
|
||||||
|
|
||||||
|
SELECT UsrCod FROM social_notes_fav WHERE NotCod=278 AND UsrCod<>7 AND UsrCod<>1 ORDER BY FavCod LIMIT 7;
|
||||||
|
|
||||||
|
SELECT CAST(~0 AS UNSIGNED);
|
||||||
|
|
|
@ -1615,10 +1615,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
||||||
/* ActRcvSocComGbl */{1503,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_ReceiveCommentGbl ,NULL},
|
/* ActRcvSocComGbl */{1503,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_ReceiveCommentGbl ,NULL},
|
||||||
/* ActShaSocNotGbl */{1495,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_ShareSocialNoteGbl ,NULL},
|
/* ActShaSocNotGbl */{1495,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_ShareSocialNoteGbl ,NULL},
|
||||||
/* ActUnsSocNotGbl */{1496,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_UnshareSocialNoteGbl ,NULL},
|
/* ActUnsSocNotGbl */{1496,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_UnshareSocialNoteGbl ,NULL},
|
||||||
// /* ActFavSocNotGbl */{1512,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_FavSocialNoteGbl ,NULL},
|
/* ActFavSocNotGbl */{1512,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Soc_FavSocialNoteGbl_new ,NULL},
|
||||||
/* ActFavSocNotGbl */{1512,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_204_NO_CONT,Soc_FavSocialNoteGbl_new ,NULL ,NULL},
|
/* ActUnfSocNotGbl */{1513,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Soc_UnfavSocialNoteGbl_new ,NULL},
|
||||||
// /* ActUnfSocNotGbl */{1513,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_UnfavSocialNoteGbl ,NULL},
|
|
||||||
/* ActUnfSocNotGbl */{1513,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_204_NO_CONT,Soc_UnfavSocialNoteGbl_new ,NULL ,NULL},
|
|
||||||
/* ActFavSocComGbl */{1516,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_FavSocialCommentGbl ,NULL},
|
/* ActFavSocComGbl */{1516,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_FavSocialCommentGbl ,NULL},
|
||||||
/* ActUnfSocComGbl */{1517,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_UnfavSocialCommentGbl ,NULL},
|
/* ActUnfSocComGbl */{1517,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_UnfavSocialCommentGbl ,NULL},
|
||||||
/* ActReqRemSocPubGbl*/{1494,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_RequestRemSocialNoteGbl ,NULL},
|
/* ActReqRemSocPubGbl*/{1494,-1,TabUnk,ActSeeSocTmlGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Soc_ShowTimelineGbl1 ,Soc_RequestRemSocialNoteGbl ,NULL},
|
||||||
|
|
|
@ -429,11 +429,12 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.56 (2019-02-23)"
|
#define Log_PLATFORM_VERSION "SWAD 18.57.1 (2019-02-23)"
|
||||||
#define CSS_FILE "swad18.55.css"
|
#define CSS_FILE "swad18.57.css"
|
||||||
#define JS_FILE "swad18.56.js"
|
#define JS_FILE "swad18.57.js"
|
||||||
/*
|
/*
|
||||||
Version 18.56: Feb 23, 2019 Favourite is made in Javascript without reloading page. (237787 lines)
|
Version 18.57.1: Feb 24, 2019 Changes in social timeline related to AJAX and favourites. (237862 lines)
|
||||||
|
Version 18.57: Feb 23, 2019 Favourites in social notes is made in AJAX without reloading page. (237892 lines)
|
||||||
Version 18.55: Feb 22, 2019 Changes in CSS styles related to forms. (237585 lines)
|
Version 18.55: Feb 22, 2019 Changes in CSS styles related to forms. (237585 lines)
|
||||||
Version 18.54.1: Feb 22, 2019 Following and followers shown in photo zoom. (237586 lines)
|
Version 18.54.1: Feb 22, 2019 Following and followers shown in photo zoom. (237586 lines)
|
||||||
Version 18.54: Feb 21, 2019 Selection of users scope in timeline is made with icons. (237534 lines)
|
Version 18.54: Feb 21, 2019 Selection of users scope in timeline is made with icons. (237534 lines)
|
||||||
|
|
|
@ -131,7 +131,7 @@ static void Frm_StartFormInternal (Act_Action_t NextAction,bool PutParameterLoca
|
||||||
fprintf (Gbl.F.Out,"\" id=\"%s\"",Id);
|
fprintf (Gbl.F.Out,"\" id=\"%s\"",Id);
|
||||||
if (OnSubmit)
|
if (OnSubmit)
|
||||||
if (OnSubmit[0])
|
if (OnSubmit[0])
|
||||||
fprintf (Gbl.F.Out," onsubmit=\"%s;\"",OnSubmit);
|
fprintf (Gbl.F.Out," onsubmit=\"%s\"",OnSubmit);
|
||||||
switch (Act_GetBrowserTab (NextAction))
|
switch (Act_GetBrowserTab (NextAction))
|
||||||
{
|
{
|
||||||
case Act_BRW_NEW_TAB:
|
case Act_BRW_NEW_TAB:
|
||||||
|
|
|
@ -405,7 +405,7 @@ void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction,
|
||||||
" style=\"padding-top:12px;\">");
|
" style=\"padding-top:12px;\">");
|
||||||
Frm_LinkFormSubmitAnimated (Txt_Update_users,
|
Frm_LinkFormSubmitAnimated (Txt_Update_users,
|
||||||
The_ClassFormInBoxBold[Gbl.Prefs.Theme],
|
The_ClassFormInBoxBold[Gbl.Prefs.Theme],
|
||||||
"CopyMessageToHiddenFields()");
|
"CopyMessageToHiddenFields();");
|
||||||
Ico_PutCalculateIconWithText (Txt_Update_users);
|
Ico_PutCalculateIconWithText (Txt_Update_users);
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
|
|
|
@ -668,7 +668,7 @@ static void Lay_WriteScriptInit (void)
|
||||||
Gbl.Usrs.Connected.TimeToRefreshInMs);
|
Gbl.Usrs.Connected.TimeToRefreshInMs);
|
||||||
|
|
||||||
if (Gbl.Action.Act == ActLstClk)
|
if (Gbl.Action.Act == ActLstClk)
|
||||||
// Refresh timeline via AJAX
|
// Refresh fav button via AJAX
|
||||||
fprintf (Gbl.F.Out," setTimeout(\"refreshLastClicks()\",%lu);\n",
|
fprintf (Gbl.F.Out," setTimeout(\"refreshLastClicks()\",%lu);\n",
|
||||||
Cfg_TIME_TO_REFRESH_LAST_CLICKS);
|
Cfg_TIME_TO_REFRESH_LAST_CLICKS);
|
||||||
else
|
else
|
||||||
|
@ -1294,9 +1294,25 @@ void Lay_ShowErrorAndExit (const char *Txt)
|
||||||
Lay_WriteEndOfPage ();
|
Lay_WriteEndOfPage ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Gbl.Action.Act == ActFavSocNotGbl ||
|
||||||
|
Gbl.Action.Act == ActUnfSocNotGbl)
|
||||||
|
DB_QueryINSERT ("can not debug",
|
||||||
|
"INSERT INTO debug"
|
||||||
|
" (DebugTime,Txt)"
|
||||||
|
" VALUES"
|
||||||
|
" (NOW(),'antes de Gbl_Cleanup')");
|
||||||
|
|
||||||
/***** Free memory and close all the open files *****/
|
/***** Free memory and close all the open files *****/
|
||||||
Gbl_Cleanup ();
|
Gbl_Cleanup ();
|
||||||
|
|
||||||
|
if (Gbl.Action.Act == ActFavSocNotGbl ||
|
||||||
|
Gbl.Action.Act == ActUnfSocNotGbl)
|
||||||
|
DB_QueryINSERT ("can not debug",
|
||||||
|
"INSERT INTO debug"
|
||||||
|
" (DebugTime,Txt)"
|
||||||
|
" VALUES"
|
||||||
|
" (NOW(),'tras Gbl_Cleanup')");
|
||||||
|
|
||||||
/***** Page is generated (except </body> and </html>).
|
/***** Page is generated (except </body> and </html>).
|
||||||
Compute time to generate page *****/
|
Compute time to generate page *****/
|
||||||
if (!Gbl.Action.IsAJAXAutoRefresh)
|
if (!Gbl.Action.IsAJAXAutoRefresh)
|
||||||
|
@ -1339,6 +1355,14 @@ void Lay_ShowErrorAndExit (const char *Txt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Gbl.Action.Act == ActFavSocNotGbl ||
|
||||||
|
Gbl.Action.Act == ActUnfSocNotGbl)
|
||||||
|
DB_QueryINSERT ("can not debug",
|
||||||
|
"INSERT INTO debug"
|
||||||
|
" (DebugTime,Txt)"
|
||||||
|
" VALUES"
|
||||||
|
" (NOW(),'antes de DB_CloseDBConnection')");
|
||||||
|
|
||||||
/***** Close database connection *****/
|
/***** Close database connection *****/
|
||||||
DB_CloseDBConnection ();
|
DB_CloseDBConnection ();
|
||||||
|
|
||||||
|
|
24
swad_main.c
24
swad_main.c
|
@ -152,15 +152,39 @@ int main (void)
|
||||||
/***** Write HTTP Status 204 No Content *****/
|
/***** Write HTTP Status 204 No Content *****/
|
||||||
Lay_WriteHTTPStatus204NoContent ();
|
Lay_WriteHTTPStatus204NoContent ();
|
||||||
|
|
||||||
|
if (Gbl.Action.Act == ActFavSocNotGbl ||
|
||||||
|
Gbl.Action.Act == ActUnfSocNotGbl)
|
||||||
|
DB_QueryINSERT ("can not debug",
|
||||||
|
"INSERT INTO debug"
|
||||||
|
" (DebugTime,Txt)"
|
||||||
|
" VALUES"
|
||||||
|
" (NOW(),'tras FunctionPriori')");
|
||||||
|
|
||||||
/***** Start writing HTML output *****/
|
/***** Start writing HTML output *****/
|
||||||
Lay_WriteStartOfPage ();
|
Lay_WriteStartOfPage ();
|
||||||
|
|
||||||
|
if (Gbl.Action.Act == ActFavSocNotGbl ||
|
||||||
|
Gbl.Action.Act == ActUnfSocNotGbl)
|
||||||
|
DB_QueryINSERT ("can not debug",
|
||||||
|
"INSERT INTO debug"
|
||||||
|
" (DebugTime,Txt)"
|
||||||
|
" VALUES"
|
||||||
|
" (NOW(),'antes de FunctionPosteriori')");
|
||||||
|
|
||||||
/***** Make a processing or other depending on the action *****/
|
/***** Make a processing or other depending on the action *****/
|
||||||
FunctionPosteriori = Act_GetFunctionPosteriori (Gbl.Action.Act);
|
FunctionPosteriori = Act_GetFunctionPosteriori (Gbl.Action.Act);
|
||||||
if (FunctionPosteriori != NULL)
|
if (FunctionPosteriori != NULL)
|
||||||
FunctionPosteriori ();
|
FunctionPosteriori ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Gbl.Action.Act == ActFavSocNotGbl ||
|
||||||
|
Gbl.Action.Act == ActUnfSocNotGbl)
|
||||||
|
DB_QueryINSERT ("can not debug",
|
||||||
|
"INSERT INTO debug"
|
||||||
|
" (DebugTime,Txt)"
|
||||||
|
" VALUES"
|
||||||
|
" (NOW(),'antes de Lay_ShowErrorAndExit')");
|
||||||
|
|
||||||
/***** Cleanup and exit *****/
|
/***** Cleanup and exit *****/
|
||||||
Lay_ShowErrorAndExit (NULL);
|
Lay_ShowErrorAndExit (NULL);
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
|
||||||
Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs ();
|
Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs ();
|
||||||
|
|
||||||
/***** Check if it's a big list *****/
|
/***** Check if it's a big list *****/
|
||||||
ShowUsrsInCrs = Usr_GetIfShowBigList (NumUsrsInCrs,"CopyMessageToHiddenFields()");
|
ShowUsrsInCrs = Usr_GetIfShowBigList (NumUsrsInCrs,"CopyMessageToHiddenFields();");
|
||||||
|
|
||||||
if (ShowUsrsInCrs)
|
if (ShowUsrsInCrs)
|
||||||
/***** Get lists of selected users *****/
|
/***** Get lists of selected users *****/
|
||||||
|
@ -367,7 +367,7 @@ static void Msg_PutLinkToShowMorePotentialRecipients (void)
|
||||||
Msg_PutParamsShowMorePotentialRecipients,
|
Msg_PutParamsShowMorePotentialRecipients,
|
||||||
"users.svg",
|
"users.svg",
|
||||||
Txt_Show_more_recipients,
|
Txt_Show_more_recipients,
|
||||||
"CopyMessageToHiddenFields()");
|
"CopyMessageToHiddenFields();");
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -733,7 +733,9 @@ void Par_GetMainParameters (void)
|
||||||
Gbl.Action.Act == ActRefLstClk ||
|
Gbl.Action.Act == ActRefLstClk ||
|
||||||
Gbl.Action.Act == ActRefNewSocPubGbl ||
|
Gbl.Action.Act == ActRefNewSocPubGbl ||
|
||||||
Gbl.Action.Act == ActRefOldSocPubGbl ||
|
Gbl.Action.Act == ActRefOldSocPubGbl ||
|
||||||
Gbl.Action.Act == ActRefOldSocPubUsr)
|
Gbl.Action.Act == ActRefOldSocPubUsr ||
|
||||||
|
Gbl.Action.Act == ActFavSocNotGbl ||
|
||||||
|
Gbl.Action.Act == ActUnfSocNotGbl)
|
||||||
{
|
{
|
||||||
Gbl.Action.UsesAJAX = true;
|
Gbl.Action.UsesAJAX = true;
|
||||||
if (Gbl.Action.Act == ActRefCon ||
|
if (Gbl.Action.Act == ActRefCon ||
|
||||||
|
|
257
swad_social.c
257
swad_social.c
|
@ -25,7 +25,9 @@
|
||||||
/*********************************** Headers *********************************/
|
/*********************************** Headers *********************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE // For asprintf
|
||||||
#include <linux/limits.h> // For PATH_MAX
|
#include <linux/limits.h> // For PATH_MAX
|
||||||
|
#include <stdio.h> // For asprintf
|
||||||
#include <stdlib.h> // For malloc and free
|
#include <stdlib.h> // For malloc and free
|
||||||
#include <string.h> // For string functions
|
#include <string.h> // For string functions
|
||||||
#include <sys/types.h> // For time_t
|
#include <sys/types.h> // For time_t
|
||||||
|
@ -198,12 +200,10 @@ static void Soc_PutDisabledIconShare (unsigned NumShared);
|
||||||
static void Soc_PutDisabledIconFav (unsigned NumFavs);
|
static void Soc_PutDisabledIconFav (unsigned NumFavs);
|
||||||
|
|
||||||
static void Soc_PutFormToShareSocialNote (long NotCod);
|
static void Soc_PutFormToShareSocialNote (long NotCod);
|
||||||
static void Soc_PutFormToFavSocialNote_new (long NotCod,const char *FavId,bool Hidden);
|
static void Soc_PutFormToFavSocialNote_new (const struct SocialNote *SocNot);
|
||||||
static void Soc_PutFormToUnfavSocialNote_new (long NotCod,const char *FavId,bool Hidden);
|
static void Soc_PutFormToUnfavSocialNote_new (const struct SocialNote *SocNot);
|
||||||
static void Soc_PutFormToFavSocialNote (long NotCod);
|
|
||||||
|
|
||||||
static void Soc_PutFormToUnshareSocialNote (long NotCod);
|
static void Soc_PutFormToUnshareSocialNote (long NotCod);
|
||||||
static void Soc_PutFormToUnfavSocialNote (long NotCod);
|
|
||||||
static void Soc_PutFormToUnfavSocialComment (long PubCod);
|
static void Soc_PutFormToUnfavSocialComment (long PubCod);
|
||||||
|
|
||||||
static void Soc_PutFormToRemoveSocialPublishing (long NotCod);
|
static void Soc_PutFormToRemoveSocialPublishing (long NotCod);
|
||||||
|
@ -215,14 +215,14 @@ static long Soc_GetParamPubCod (void);
|
||||||
static long Soc_ReceiveComment (void);
|
static long Soc_ReceiveComment (void);
|
||||||
|
|
||||||
static long Soc_ShareSocialNote (void);
|
static long Soc_ShareSocialNote (void);
|
||||||
static long Soc_FavSocialNote_new (void);
|
static void Soc_FavSocialNote_new (struct SocialNote *SocNot);
|
||||||
static long Soc_FavSocialNote (void);
|
static long Soc_FavSocialNote (void);
|
||||||
static long Soc_FavSocialComment (void);
|
static long Soc_FavSocialComment (void);
|
||||||
static void Soc_CreateNotifToAuthor (long AuthorCod,long PubCod,
|
static void Soc_CreateNotifToAuthor (long AuthorCod,long PubCod,
|
||||||
Ntf_NotifyEvent_t NotifyEvent);
|
Ntf_NotifyEvent_t NotifyEvent);
|
||||||
|
|
||||||
static long Soc_UnshareSocialNote (void);
|
static long Soc_UnshareSocialNote (void);
|
||||||
static long Soc_UnfavSocialNote_new (void);
|
static void Soc_UnfavSocialNote_new (struct SocialNote *SocNot);
|
||||||
static long Soc_UnfavSocialNote (void);
|
static long Soc_UnfavSocialNote (void);
|
||||||
static long Soc_UnfavSocialComment (void);
|
static long Soc_UnfavSocialComment (void);
|
||||||
|
|
||||||
|
@ -1298,7 +1298,7 @@ static void Soc_ShowOldPubsInTimeline (char *Query)
|
||||||
|
|
||||||
static void Soc_PutLinkToViewNewPublishings (void)
|
static void Soc_PutLinkToViewNewPublishings (void)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassFormOutBoxBold[The_NUM_THEMES];
|
extern const char *The_ClassFormInBoxBold[The_NUM_THEMES];
|
||||||
extern const char *Txt_See_new_activity;
|
extern const char *Txt_See_new_activity;
|
||||||
|
|
||||||
/***** Link to view (show hidden) new publishings *****/
|
/***** Link to view (show hidden) new publishings *****/
|
||||||
|
@ -1311,7 +1311,7 @@ static void Soc_PutLinkToViewNewPublishings (void)
|
||||||
"%s (<span id=\"view_new_posts_count\">0</span>)"
|
"%s (<span id=\"view_new_posts_count\">0</span>)"
|
||||||
"</a>"
|
"</a>"
|
||||||
"</div>",
|
"</div>",
|
||||||
The_ClassFormOutBoxBold[Gbl.Prefs.Theme],
|
The_ClassFormInBoxBold[Gbl.Prefs.Theme],
|
||||||
Txt_See_new_activity);
|
Txt_See_new_activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1321,7 +1321,7 @@ static void Soc_PutLinkToViewNewPublishings (void)
|
||||||
|
|
||||||
static void Soc_PutLinkToViewOldPublishings (void)
|
static void Soc_PutLinkToViewOldPublishings (void)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassFormOutBoxBold[The_NUM_THEMES];
|
extern const char *The_ClassFormInBoxBold[The_NUM_THEMES];
|
||||||
extern const char *Txt_See_more;
|
extern const char *Txt_See_more;
|
||||||
|
|
||||||
/***** Animated link to view old publishings *****/
|
/***** Animated link to view old publishings *****/
|
||||||
|
@ -1341,7 +1341,7 @@ static void Soc_PutLinkToViewOldPublishings (void)
|
||||||
" %s"
|
" %s"
|
||||||
"</a>"
|
"</a>"
|
||||||
"</div>",
|
"</div>",
|
||||||
The_ClassFormOutBoxBold[Gbl.Prefs.Theme],
|
The_ClassFormInBoxBold[Gbl.Prefs.Theme],
|
||||||
Gbl.Prefs.URLIcons,Txt_See_more,Txt_See_more,
|
Gbl.Prefs.URLIcons,Txt_See_more,Txt_See_more,
|
||||||
Gbl.Prefs.URLIcons,Txt_See_more,Txt_See_more,
|
Gbl.Prefs.URLIcons,Txt_See_more,Txt_See_more,
|
||||||
Txt_See_more);
|
Txt_See_more);
|
||||||
|
@ -1572,39 +1572,34 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
|
||||||
Num++;
|
Num++;
|
||||||
sprintf (FavId,"%s_%u",Gbl.UniqueNameEncrypted,Num);
|
sprintf (FavId,"%s_%u",Gbl.UniqueNameEncrypted,Num);
|
||||||
|
|
||||||
if (IAmTheAuthor) // I am the author
|
if (SocNot->Unavailable) // Unavailable social notes can not be favourited
|
||||||
|
{
|
||||||
|
/* Put disabled icon */
|
||||||
Soc_PutDisabledIconFav (SocNot->NumFavs);
|
Soc_PutDisabledIconFav (SocNot->NumFavs);
|
||||||
|
// Don't show who have marked this social note as favourite
|
||||||
|
}
|
||||||
|
else if (IAmTheAuthor) // I am the author
|
||||||
|
{
|
||||||
|
/* Put disabled icon and list of users
|
||||||
|
who have marked this social note as favourite*/
|
||||||
|
Soc_PutDisabledIconFav (SocNot->NumFavs);
|
||||||
|
Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (SocNot);
|
||||||
|
}
|
||||||
else if (IAmAFaverOfThisSocNot) // I have favourited this social note
|
else if (IAmAFaverOfThisSocNot) // I have favourited this social note
|
||||||
{
|
{
|
||||||
/* Put icon to unfav this publishing */
|
/* Put icon to unfav this publishing and list of users */
|
||||||
fprintf (Gbl.F.Out,"<div id=\"%s\" data-status=\"faved\""
|
fprintf (Gbl.F.Out,"<div id=\"%s\" class=\"SOCIAL_ICO_FAV\">",FavId);
|
||||||
" class=\"SOCIAL_ICO_FAV\">",
|
Soc_PutFormToUnfavSocialNote_new (SocNot);
|
||||||
FavId);
|
|
||||||
Soc_PutFormToFavSocialNote_new (SocNot->NotCod,FavId,true);
|
|
||||||
Soc_PutFormToUnfavSocialNote_new (SocNot->NotCod,FavId,false);
|
|
||||||
// Soc_PutFormToUnfavSocialNote (SocNot->NotCod);
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
else // I am not the author and I am not a sharer
|
else // I am not the author and I am not a faver
|
||||||
{
|
{
|
||||||
if (SocNot->Unavailable) // Unavailable social notes can not be favourited
|
/* Put icon to fav this publishing and list of users */
|
||||||
Soc_PutDisabledIconFav (SocNot->NumFavs);
|
fprintf (Gbl.F.Out,"<div id=\"%s\" class=\"SOCIAL_ICO_FAV\">",FavId);
|
||||||
else
|
Soc_PutFormToFavSocialNote_new (SocNot);
|
||||||
{
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
/* Put icon to fav this publishing */
|
|
||||||
fprintf (Gbl.F.Out,"<div id=\"%s\" data-status=\"unfaved\""
|
|
||||||
" class=\"SOCIAL_ICO_FAV\">",
|
|
||||||
FavId);
|
|
||||||
Soc_PutFormToFavSocialNote_new (SocNot->NotCod,FavId,false);
|
|
||||||
Soc_PutFormToUnfavSocialNote_new (SocNot->NotCod,FavId,true);
|
|
||||||
// Soc_PutFormToFavSocialNote (SocNot->NotCod);
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show who have marked this social note as favourite */
|
|
||||||
Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (SocNot);
|
|
||||||
|
|
||||||
/* Put icons to share/unshare */
|
/* Put icons to share/unshare */
|
||||||
if (IAmTheAuthor) // I am the author
|
if (IAmTheAuthor) // I am the author
|
||||||
Soc_PutDisabledIconShare (SocNot->NumShared);
|
Soc_PutDisabledIconShare (SocNot->NumShared);
|
||||||
|
@ -2863,90 +2858,69 @@ static void Soc_PutFormToShareSocialNote (long NotCod)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Form to mark a social note as favourite *****************/
|
/*************** Form to fav (mark as favourite) social note *****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
// All forms in this function and nested functions must have unique identifiers
|
// All forms in this function and nested functions must have unique identifiers
|
||||||
|
|
||||||
static void Soc_PutFormToFavSocialNote_new (long NotCod,const char *FavId,bool Hidden)
|
static void Soc_PutFormToFavSocialNote_new (const struct SocialNote *SocNot)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Mark_as_favourite;
|
extern const char *Txt_Mark_as_favourite;
|
||||||
char JavaScriptFunc[256 + Brw_MAX_ROW_ID];
|
char *OnSubmit;
|
||||||
|
|
||||||
/***** Start container *****/
|
|
||||||
fprintf (Gbl.F.Out,"<div id=\"fav_%s\"",FavId);
|
|
||||||
if (Hidden)
|
|
||||||
fprintf (Gbl.F.Out," style=\"display:none;\"");
|
|
||||||
fprintf (Gbl.F.Out,">");
|
|
||||||
|
|
||||||
/***** Form and icon to mark social note as favourite *****/
|
/***** Form and icon to mark social note as favourite *****/
|
||||||
snprintf (JavaScriptFunc,sizeof (JavaScriptFunc),
|
/* Create JavaScript funtion and parameters to send the request via AJAX */
|
||||||
"FavSocial('%s')",
|
if (asprintf (&OnSubmit,"refreshFavSocNot(this,%ld,%ld);"
|
||||||
FavId);
|
" return false;", // return false is necessary to not submit form
|
||||||
|
Act_GetActCod (ActFavSocNotGbl),
|
||||||
|
SocNot->NotCod) < 0)
|
||||||
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/* Form with icon */
|
||||||
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
||||||
{
|
Frm_StartFormUniqueAnchorOnSubmit (ActFavSocNotUsr,"timeline",OnSubmit);
|
||||||
Frm_StartFormUniqueAnchorOnSubmit (ActFavSocNotUsr,"timeline",
|
|
||||||
JavaScriptFunc); // JavaScript function to fav social note
|
|
||||||
Usr_PutParamOtherUsrCodEncrypted ();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
Frm_StartFormUniqueAnchorOnSubmit (ActFavSocNotGbl,NULL,OnSubmit);
|
||||||
Frm_StartFormUniqueAnchorOnSubmit (ActFavSocNotGbl,NULL,
|
|
||||||
JavaScriptFunc); // JavaScript function to fav social note
|
|
||||||
Soc_PutParamWhichUsrs ();
|
|
||||||
}
|
|
||||||
Soc_PutHiddenParamNotCod (NotCod);
|
|
||||||
Ico_PutIconLink ("heart.svg",Txt_Mark_as_favourite);
|
Ico_PutIconLink ("heart.svg",Txt_Mark_as_favourite);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
|
||||||
/***** End container *****/
|
/* Free allocated memory for subquery */
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
free ((void *) OnSubmit);
|
||||||
|
|
||||||
|
/***** Who have marked this social note as favourite *****/
|
||||||
|
Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (SocNot);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Soc_PutFormToUnfavSocialNote_new (long NotCod,const char *FavId,bool Hidden)
|
/*****************************************************************************/
|
||||||
|
/*********** Form to unfav (remove mark as favourite) social note ************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
// All forms in this function and nested functions must have unique identifiers
|
||||||
|
|
||||||
|
static void Soc_PutFormToUnfavSocialNote_new (const struct SocialNote *SocNot)
|
||||||
{
|
{
|
||||||
extern const char *Txt_SOCIAL_NOTE_Favourite;
|
extern const char *Txt_SOCIAL_NOTE_Favourite;
|
||||||
char JavaScriptFunc[256 + Brw_MAX_ROW_ID];
|
char *OnSubmit;
|
||||||
|
|
||||||
/***** Start container *****/
|
|
||||||
fprintf (Gbl.F.Out,"<div id=\"unfav_%s\"",FavId);
|
|
||||||
if (Hidden)
|
|
||||||
fprintf (Gbl.F.Out," style=\"display:none;\"");
|
|
||||||
fprintf (Gbl.F.Out,">");
|
|
||||||
|
|
||||||
/***** Form and icon to mark social note as favourite *****/
|
/***** Form and icon to mark social note as favourite *****/
|
||||||
snprintf (JavaScriptFunc,sizeof (JavaScriptFunc),
|
/* Create JavaScript funtion and parameters to send the request via AJAX */
|
||||||
"UnfavSocial('%s')",
|
if (asprintf (&OnSubmit,"refreshFavSocNot(this,%ld,%ld);"
|
||||||
FavId);
|
" return false;", // return false is necessary to not submit form
|
||||||
|
Act_GetActCod (ActUnfSocNotGbl),
|
||||||
|
SocNot->NotCod) < 0)
|
||||||
|
Lay_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/* Form with icon */
|
||||||
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
||||||
{
|
Frm_StartFormUniqueAnchorOnSubmit (ActUnfSocNotUsr,"timeline",OnSubmit);
|
||||||
Frm_StartFormUniqueAnchorOnSubmit (ActUnfSocNotUsr,"timeline",
|
|
||||||
JavaScriptFunc); // JavaScript function to unfav social note
|
|
||||||
Usr_PutParamOtherUsrCodEncrypted ();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
Frm_StartFormUniqueAnchorOnSubmit (ActUnfSocNotGbl,NULL,OnSubmit);
|
||||||
Frm_StartFormUniqueAnchorOnSubmit (ActUnfSocNotGbl,NULL,
|
|
||||||
JavaScriptFunc); // JavaScript function to unfav social note
|
|
||||||
Soc_PutParamWhichUsrs ();
|
|
||||||
}
|
|
||||||
Soc_PutHiddenParamNotCod (NotCod);
|
|
||||||
Ico_PutIconLink ("heart-red.svg",Txt_SOCIAL_NOTE_Favourite);
|
Ico_PutIconLink ("heart-red.svg",Txt_SOCIAL_NOTE_Favourite);
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
|
|
||||||
/***** End container *****/
|
/* Free allocated memory for subquery */
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
free ((void *) OnSubmit);
|
||||||
}
|
|
||||||
|
|
||||||
static void Soc_PutFormToFavSocialNote (long NotCod)
|
/***** Who have marked this social note as favourite *****/
|
||||||
{
|
Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (SocNot);
|
||||||
extern const char *Txt_Mark_as_favourite;
|
|
||||||
|
|
||||||
/***** Form to mark social note as favourite *****/
|
|
||||||
Soc_FormStart (ActFavSocNotGbl,ActFavSocNotUsr);
|
|
||||||
Soc_PutHiddenParamNotCod (NotCod);
|
|
||||||
Ico_PutDivIconLink ("SOCIAL_ICO_FAV",
|
|
||||||
"heart.svg",Txt_Mark_as_favourite);
|
|
||||||
Frm_EndForm ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2966,23 +2940,6 @@ static void Soc_PutFormToUnshareSocialNote (long NotCod)
|
||||||
Frm_EndForm ();
|
Frm_EndForm ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********** Form to unfav (remove mark as favourite) social note ************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
// All forms in this function and nested functions must have unique identifiers
|
|
||||||
|
|
||||||
static void Soc_PutFormToUnfavSocialNote (long NotCod)
|
|
||||||
{
|
|
||||||
extern const char *Txt_SOCIAL_NOTE_Favourite;
|
|
||||||
|
|
||||||
/***** Form to unfav social note *****/
|
|
||||||
Soc_FormStart (ActUnfSocNotGbl,ActUnfSocNotUsr);
|
|
||||||
Soc_PutHiddenParamNotCod (NotCod);
|
|
||||||
Ico_PutDivIconLink ("SOCIAL_ICO_FAV",
|
|
||||||
"heart-red.svg",Txt_SOCIAL_NOTE_Favourite);
|
|
||||||
Frm_EndForm ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********* Form to unfav (remove mark as favourite) social comment ***********/
|
/********* Form to unfav (remove mark as favourite) social comment ***********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3256,10 +3213,19 @@ static long Soc_ShareSocialNote (void)
|
||||||
|
|
||||||
void Soc_FavSocialNoteGbl_new (void)
|
void Soc_FavSocialNoteGbl_new (void)
|
||||||
{
|
{
|
||||||
long NotCod;
|
struct SocialNote SocNot;
|
||||||
|
|
||||||
|
/***** Get which users *****/
|
||||||
|
Soc_GetParamsWhichUsrs ();
|
||||||
|
|
||||||
/***** Mark social note as favourite *****/
|
/***** Mark social note as favourite *****/
|
||||||
NotCod = Soc_FavSocialNote_new ();
|
Soc_FavSocialNote_new (&SocNot);
|
||||||
|
|
||||||
|
/***** Write HTML inside DIV with form to unfav *****/
|
||||||
|
Soc_PutFormToUnfavSocialNote_new (&SocNot);
|
||||||
|
|
||||||
|
/***** All the output is made, so don't write anymore *****/
|
||||||
|
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Soc_FavSocialNoteGbl (void)
|
void Soc_FavSocialNoteGbl (void)
|
||||||
|
@ -3296,22 +3262,21 @@ void Soc_FavSocialNoteUsr (void)
|
||||||
Lay_EndSection ();
|
Lay_EndSection ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static long Soc_FavSocialNote_new (void)
|
static void Soc_FavSocialNote_new (struct SocialNote *SocNot)
|
||||||
{
|
{
|
||||||
extern const char *Txt_The_original_post_no_longer_exists;
|
extern const char *Txt_The_original_post_no_longer_exists;
|
||||||
struct SocialNote SocNot;
|
|
||||||
bool ItsMe;
|
bool ItsMe;
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
|
|
||||||
/***** Get data of social note *****/
|
/***** Get data of social note *****/
|
||||||
SocNot.NotCod = Soc_GetParamNotCod ();
|
SocNot->NotCod = Soc_GetParamNotCod ();
|
||||||
Soc_GetDataOfSocialNotByCod (&SocNot);
|
Soc_GetDataOfSocialNotByCod (SocNot);
|
||||||
|
|
||||||
if (SocNot.NotCod > 0)
|
if (SocNot->NotCod > 0)
|
||||||
{
|
{
|
||||||
ItsMe = Usr_ItsMe (SocNot.UsrCod);
|
ItsMe = Usr_ItsMe (SocNot->UsrCod);
|
||||||
if (Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
if (Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
||||||
if (!Soc_CheckIfNoteIsFavedByUsr (SocNot.NotCod,
|
if (!Soc_CheckIfNoteIsFavedByUsr (SocNot->NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the note
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the note
|
||||||
{
|
{
|
||||||
/***** Mark as favourite in database *****/
|
/***** Mark as favourite in database *****/
|
||||||
|
@ -3320,21 +3285,19 @@ static long Soc_FavSocialNote_new (void)
|
||||||
" (NotCod,UsrCod,TimeFav)"
|
" (NotCod,UsrCod,TimeFav)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld,NOW())",
|
" (%ld,%ld,NOW())",
|
||||||
SocNot.NotCod,
|
SocNot->NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
|
||||||
/* Update number of times this social note is favourited */
|
/* Update number of times this social note is favourited */
|
||||||
SocNot.NumFavs = Soc_GetNumTimesANoteHasBeenFav (&SocNot);
|
SocNot->NumFavs = Soc_GetNumTimesANoteHasBeenFav (SocNot);
|
||||||
|
|
||||||
/**** Create notification about favourite post
|
/**** Create notification about favourite post
|
||||||
for the author of the post ***/
|
for the author of the post ***/
|
||||||
OriginalPubCod = Soc_GetPubCodOfOriginalSocialNote (SocNot.NotCod);
|
OriginalPubCod = Soc_GetPubCodOfOriginalSocialNote (SocNot->NotCod);
|
||||||
if (OriginalPubCod > 0)
|
if (OriginalPubCod > 0)
|
||||||
Soc_CreateNotifToAuthor (SocNot.UsrCod,OriginalPubCod,Ntf_EVENT_TIMELINE_FAV);
|
Soc_CreateNotifToAuthor (SocNot->UsrCod,OriginalPubCod,Ntf_EVENT_TIMELINE_FAV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SocNot.NotCod;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static long Soc_FavSocialNote (void)
|
static long Soc_FavSocialNote (void)
|
||||||
|
@ -3603,10 +3566,19 @@ static long Soc_UnshareSocialNote (void)
|
||||||
|
|
||||||
void Soc_UnfavSocialNoteGbl_new (void)
|
void Soc_UnfavSocialNoteGbl_new (void)
|
||||||
{
|
{
|
||||||
long NotCod;
|
struct SocialNote SocNot;
|
||||||
|
|
||||||
|
/***** Get which users *****/
|
||||||
|
Soc_GetParamsWhichUsrs ();
|
||||||
|
|
||||||
/***** Stop marking as favourite a previously favourited social note *****/
|
/***** Stop marking as favourite a previously favourited social note *****/
|
||||||
NotCod = Soc_UnfavSocialNote_new ();
|
Soc_UnfavSocialNote_new (&SocNot);
|
||||||
|
|
||||||
|
/***** Write HTML inside DIV with form to fav *****/
|
||||||
|
Soc_PutFormToFavSocialNote_new (&SocNot);
|
||||||
|
|
||||||
|
/***** All the output is made, so don't write anymore *****/
|
||||||
|
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Soc_UnfavSocialNoteGbl (void)
|
void Soc_UnfavSocialNoteGbl (void)
|
||||||
|
@ -3643,42 +3615,39 @@ void Soc_UnfavSocialNoteUsr (void)
|
||||||
Lay_EndSection ();
|
Lay_EndSection ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static long Soc_UnfavSocialNote_new (void)
|
static void Soc_UnfavSocialNote_new (struct SocialNote *SocNot)
|
||||||
{
|
{
|
||||||
struct SocialNote SocNot;
|
|
||||||
long OriginalPubCod;
|
long OriginalPubCod;
|
||||||
bool ItsMe;
|
bool ItsMe;
|
||||||
|
|
||||||
/***** Get data of social note *****/
|
/***** Get data of social note *****/
|
||||||
SocNot.NotCod = Soc_GetParamNotCod ();
|
SocNot->NotCod = Soc_GetParamNotCod ();
|
||||||
Soc_GetDataOfSocialNotByCod (&SocNot);
|
Soc_GetDataOfSocialNotByCod (SocNot);
|
||||||
|
|
||||||
if (SocNot.NotCod > 0)
|
if (SocNot->NotCod > 0)
|
||||||
{
|
{
|
||||||
ItsMe = Usr_ItsMe (SocNot.UsrCod);
|
ItsMe = Usr_ItsMe (SocNot->UsrCod);
|
||||||
if (SocNot.NumFavs &&
|
if (SocNot->NumFavs &&
|
||||||
Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
Gbl.Usrs.Me.Logged && !ItsMe) // I am not the author
|
||||||
if (Soc_CheckIfNoteIsFavedByUsr (SocNot.NotCod,
|
if (Soc_CheckIfNoteIsFavedByUsr (SocNot->NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the note
|
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have favourited the note
|
||||||
{
|
{
|
||||||
/***** Delete the mark as favourite from database *****/
|
/***** Delete the mark as favourite from database *****/
|
||||||
DB_QueryDELETE ("can not unfavourite social note",
|
DB_QueryDELETE ("can not unfavourite social note",
|
||||||
"DELETE FROM social_notes_fav"
|
"DELETE FROM social_notes_fav"
|
||||||
" WHERE NotCod=%ld AND UsrCod=%ld",
|
" WHERE NotCod=%ld AND UsrCod=%ld",
|
||||||
SocNot.NotCod,
|
SocNot->NotCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
|
||||||
/***** Update number of times this social note is favourited *****/
|
/***** Update number of times this social note is favourited *****/
|
||||||
SocNot.NumFavs = Soc_GetNumTimesANoteHasBeenFav (&SocNot);
|
SocNot->NumFavs = Soc_GetNumTimesANoteHasBeenFav (SocNot);
|
||||||
|
|
||||||
/***** Mark possible notifications on this social note as removed *****/
|
/***** Mark possible notifications on this social note as removed *****/
|
||||||
OriginalPubCod = Soc_GetPubCodOfOriginalSocialNote (SocNot.NotCod);
|
OriginalPubCod = Soc_GetPubCodOfOriginalSocialNote (SocNot->NotCod);
|
||||||
if (OriginalPubCod > 0)
|
if (OriginalPubCod > 0)
|
||||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_FAV,OriginalPubCod);
|
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TIMELINE_FAV,OriginalPubCod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SocNot.NotCod;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static long Soc_UnfavSocialNote (void)
|
static long Soc_UnfavSocialNote (void)
|
||||||
|
@ -4609,6 +4578,7 @@ static void Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (const struct SocialNote *S
|
||||||
|
|
||||||
/***** Get users who have marked this note as favourite *****/
|
/***** Get users who have marked this note as favourite *****/
|
||||||
if (SocNot->NumFavs)
|
if (SocNot->NumFavs)
|
||||||
|
{
|
||||||
/***** Get list of users from database *****/
|
/***** Get list of users from database *****/
|
||||||
NumFirstUsrs =
|
NumFirstUsrs =
|
||||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get users",
|
(unsigned) DB_QuerySELECT (&mysql_res,"can not get users",
|
||||||
|
@ -4619,6 +4589,7 @@ static void Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (const struct SocialNote *S
|
||||||
SocNot->NotCod,
|
SocNot->NotCod,
|
||||||
SocNot->UsrCod,
|
SocNot->UsrCod,
|
||||||
Soc_MAX_SHARERS_FAVERS_SHOWN);
|
Soc_MAX_SHARERS_FAVERS_SHOWN);
|
||||||
|
}
|
||||||
|
|
||||||
/***** Show users *****/
|
/***** Show users *****/
|
||||||
Soc_ShowSharersOrFavers (&mysql_res,SocNot->NumFavs,NumFirstUsrs);
|
Soc_ShowSharersOrFavers (&mysql_res,SocNot->NumFavs,NumFirstUsrs);
|
||||||
|
@ -4703,7 +4674,7 @@ static void Soc_ShowSharersOrFavers (MYSQL_RES **mysql_res,
|
||||||
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
|
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
|
||||||
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
|
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
|
||||||
NULL,
|
NULL,
|
||||||
"PHOTO15x20",Pho_ZOOM,true); // Use unique id
|
"PHOTO12x16",Pho_ZOOM,true); // Use unique id
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
NumUsrsShown++;
|
NumUsrsShown++;
|
||||||
|
|
|
@ -158,7 +158,6 @@ void Soc_ReceiveCommentUsr (void);
|
||||||
void Soc_ShareSocialNoteGbl (void);
|
void Soc_ShareSocialNoteGbl (void);
|
||||||
void Soc_ShareSocialNoteUsr (void);
|
void Soc_ShareSocialNoteUsr (void);
|
||||||
void Soc_FavSocialNoteGbl_new (void);
|
void Soc_FavSocialNoteGbl_new (void);
|
||||||
void Soc_FavSocialNoteGbl (void);
|
|
||||||
void Soc_FavSocialNoteUsr (void);
|
void Soc_FavSocialNoteUsr (void);
|
||||||
void Soc_FavSocialCommentGbl (void);
|
void Soc_FavSocialCommentGbl (void);
|
||||||
void Soc_FavSocialCommentUsr (void);
|
void Soc_FavSocialCommentUsr (void);
|
||||||
|
|
|
@ -5914,7 +5914,7 @@ static void Usr_FormToSelectUsrListType (Act_Action_t NextAction,Usr_ShowUsrsTyp
|
||||||
/***** Link and image *****/
|
/***** Link and image *****/
|
||||||
Frm_LinkFormSubmit (Txt_USR_LIST_TYPES[ListType],
|
Frm_LinkFormSubmit (Txt_USR_LIST_TYPES[ListType],
|
||||||
The_ClassFormInBoxNoWrap[Gbl.Prefs.Theme],
|
The_ClassFormInBoxNoWrap[Gbl.Prefs.Theme],
|
||||||
NextAction == ActReqMsgUsr ? "CopyMessageToHiddenFields()" :
|
NextAction == ActReqMsgUsr ? "CopyMessageToHiddenFields();" :
|
||||||
NULL);
|
NULL);
|
||||||
fprintf (Gbl.F.Out,"<img src=\"%s/%s\""
|
fprintf (Gbl.F.Out,"<img src=\"%s/%s\""
|
||||||
" alt=\"%s\" title=\"%s\""
|
" alt=\"%s\" title=\"%s\""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user