mirror of https://github.com/acanas/swad-core.git
Version 20.36.18: Feb 27, 2021 Function moved to module swad_timeline_database.
This commit is contained in:
parent
c28559868d
commit
e4933ff892
|
@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
|||
En OpenSWAD:
|
||||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.36.17 (2021-02-27)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.36.18 (2021-02-27)"
|
||||
#define CSS_FILE "swad20.33.9.css"
|
||||
#define JS_FILE "swad20.6.2.js"
|
||||
/*
|
||||
|
@ -601,6 +601,7 @@ TODO: DNI de un estudiante sale err
|
|||
TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede.
|
||||
TODO: Salvador Romero Cortés: @acanas opción para editar posts
|
||||
|
||||
Version 20.36.18: Feb 27, 2021 Function moved to module swad_timeline_database. (305334 lines)
|
||||
Version 20.36.17: Feb 27, 2021 Query moved to module swad_timeline_database. (305328 lines)
|
||||
Version 20.36.16: Feb 27, 2021 Query moved to module swad_timeline_database. (305317 lines)
|
||||
Version 20.36.15: Feb 27, 2021 Functions moved to module swad_timeline_database. (305305 lines)
|
||||
|
|
|
@ -589,3 +589,37 @@ static long TL_DB_GetMedCodFromPub (long PubCod,const char *DBTable)
|
|||
|
||||
return MedCod;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Get last/first publication code stored in session *************/
|
||||
/*****************************************************************************/
|
||||
// FieldName can be:
|
||||
// "LastPubCod"
|
||||
// "FirstPubCod"
|
||||
|
||||
long TL_DB_GetPubCodFromSession (const char *FieldName,
|
||||
const char SessionId[Cns_BYTES_SESSION_ID + 1])
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
long PubCod;
|
||||
|
||||
/***** Get last publication code from database *****/
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get publication code from session",
|
||||
"SELECT %s FROM sessions"
|
||||
" WHERE SessionId='%s'",
|
||||
FieldName,SessionId) == 1)
|
||||
{
|
||||
/***** Get last publication code *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
if (sscanf (row[0],"%ld",&PubCod) != 1)
|
||||
PubCod = 0;
|
||||
}
|
||||
else
|
||||
PubCod = 0;
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return PubCod;
|
||||
}
|
||||
|
|
|
@ -90,4 +90,8 @@ void TL_DB_RemoveCommentFavs (long PubCod);
|
|||
void TL_DB_RemoveCommentContent (long PubCod);
|
||||
void TL_DB_RemoveCommentPub (long PubCod,long PublisherCod);
|
||||
|
||||
/* Publications */
|
||||
long TL_DB_GetPubCodFromSession (const char *FieldName,
|
||||
const char SessionId[Cns_BYTES_SESSION_ID + 1]);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -88,7 +88,6 @@ static void TL_Pub_CreateSubQueryRangeBottom (const struct TL_Pub_RangePubsToGet
|
|||
static void TL_Pub_CreateSubQueryRangeTop (const struct TL_Pub_RangePubsToGet *RangePubsToGet,
|
||||
struct TL_Pub_SubQueries *SubQueries);
|
||||
|
||||
static long TL_Pub_GetPubCodFromSession (const char *FieldName);
|
||||
static void TL_Pub_UpdateFirstLastPubCodesIntoSession (const struct TL_Timeline *Timeline);
|
||||
|
||||
static struct TL_Pub_Publication *TL_Pub_SelectTheMostRecentPub (const struct TL_Pub_SubQueries *SubQueries);
|
||||
|
@ -150,13 +149,13 @@ void TL_Pub_GetListPubsToShowInTimeline (struct TL_Timeline *Timeline)
|
|||
// newer than LastPubCod
|
||||
/* This query is made via AJAX automatically from time to time */
|
||||
RangePubsToGet.Top = 0; // +Infinite
|
||||
RangePubsToGet.Bottom = TL_Pub_GetPubCodFromSession ("LastPubCod");
|
||||
RangePubsToGet.Bottom = TL_DB_GetPubCodFromSession ("LastPubCod",Gbl.Session.Id);
|
||||
break;
|
||||
case TL_GET_ONLY_OLD_PUBS: // Get some limited publications
|
||||
// older than FirstPubCod
|
||||
/* This query is made via AJAX
|
||||
when I click in link to get old publications */
|
||||
RangePubsToGet.Top = TL_Pub_GetPubCodFromSession ("FirstPubCod");
|
||||
RangePubsToGet.Top = TL_DB_GetPubCodFromSession ("FirstPubCod",Gbl.Session.Id);
|
||||
RangePubsToGet.Bottom = 0; // -Infinite
|
||||
break;
|
||||
case TL_GET_RECENT_TIMELINE: // Get some limited recent publications
|
||||
|
@ -363,38 +362,6 @@ static void TL_Pub_CreateSubQueryRangeTop (const struct TL_Pub_RangePubsToGet *R
|
|||
SubQueries->RangeTop[0] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Get last/first publication code stored in session *************/
|
||||
/*****************************************************************************/
|
||||
// FieldName can be:
|
||||
// "LastPubCod"
|
||||
// "FirstPubCod"
|
||||
|
||||
static long TL_Pub_GetPubCodFromSession (const char *FieldName)
|
||||
{
|
||||
extern const char *Txt_The_session_has_expired;
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
long PubCod;
|
||||
|
||||
/***** Get last publication code from database *****/
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get publication code from session",
|
||||
"SELECT %s FROM sessions"
|
||||
" WHERE SessionId='%s'",
|
||||
FieldName,Gbl.Session.Id) != 1)
|
||||
Lay_ShowErrorAndExit (Txt_The_session_has_expired);
|
||||
|
||||
/***** Get last publication code *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
if (sscanf (row[0],"%ld",&PubCod) != 1)
|
||||
PubCod = 0;
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return PubCod;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Update first (oldest) and last (more recent) ***************/
|
||||
/************* publication codes into session for next refresh ***************/
|
||||
|
|
Loading…
Reference in New Issue