mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-18 06:25:42 +02:00
Version 15.104.4
This commit is contained in:
parent
d3b0118f84
commit
f7a717e0df
|
@ -26,6 +26,9 @@ var Gbl_HTMLContent;
|
|||
// Global variable used to call SWAD via AJAX
|
||||
var ActionAJAX;
|
||||
|
||||
// Global variable that stores last publishing code got from database in timeline
|
||||
var LastPubCod = 0;
|
||||
|
||||
// Global variables used in writeLocalClock()
|
||||
var secondsSince1970UTC;
|
||||
|
||||
|
@ -322,7 +325,10 @@ var objXMLHttpReqCon = false;
|
|||
function refreshConnected() {
|
||||
objXMLHttpReqCon = AJAXCreateObject();
|
||||
if (objXMLHttpReqCon) {
|
||||
var RefreshParams = RefreshParamNxtActCon + '&' + RefreshParamIdSes + '&' + RefreshParamCrsCod;
|
||||
var RefreshParams = RefreshParamNxtActCon + '&' +
|
||||
RefreshParamIdSes + '&' +
|
||||
RefreshParamCrsCod;
|
||||
|
||||
objXMLHttpReqCon.onreadystatechange = readConnUsrsData; // onreadystatechange must be lowercase
|
||||
objXMLHttpReqCon.open('POST',ActionAJAX,true);
|
||||
objXMLHttpReqCon.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
|
@ -335,7 +341,10 @@ var objXMLHttpReqLog = false;
|
|||
function refreshLastClicks() {
|
||||
objXMLHttpReqLog = AJAXCreateObject();
|
||||
if (objXMLHttpReqLog) {
|
||||
var RefreshParams = RefreshParamNxtActLog + '&' + RefreshParamIdSes + '&' + RefreshParamCrsCod;
|
||||
var RefreshParams = RefreshParamNxtActLog + '&' +
|
||||
RefreshParamIdSes + '&' +
|
||||
RefreshParamCrsCod;
|
||||
|
||||
objXMLHttpReqLog.onreadystatechange = readLastClicksData; // onreadystatechange must be lowercase
|
||||
objXMLHttpReqLog.open('POST',ActionAJAX,true);
|
||||
objXMLHttpReqLog.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
|
@ -348,7 +357,10 @@ var objXMLHttpReqSoc = false;
|
|||
function refreshSocialTimeline() {
|
||||
objXMLHttpReqSoc = AJAXCreateObject();
|
||||
if (objXMLHttpReqSoc) {
|
||||
var RefreshParams = RefreshParamNxtActSoc + '&' + RefreshParamIdSes + '&' + RefreshParamCrsCod;
|
||||
var RefreshParams = RefreshParamNxtActSoc + '&' +
|
||||
RefreshParamIdSes + '&' +
|
||||
'LastPubCod=' + LastPubCod;
|
||||
|
||||
objXMLHttpReqSoc.onreadystatechange = readSocialTimelineData; // onreadystatechange must be lowercase
|
||||
objXMLHttpReqSoc.open('POST',ActionAJAX,true);
|
||||
objXMLHttpReqSoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
|
@ -442,10 +454,12 @@ function readLastClicksData() {
|
|||
function readSocialTimelineData() {
|
||||
if (objXMLHttpReqSoc.readyState == 4) { // Check if data have been received
|
||||
if (objXMLHttpReqSoc.status == 200) {
|
||||
var endOfDelay = objXMLHttpReqSoc.responseText.indexOf('|',0); // Get separator position
|
||||
var endOfDelay = objXMLHttpReqSoc.responseText.indexOf('|',0); // Get separator position
|
||||
var endOfLastPubCod = objXMLHttpReqSoc.responseText.indexOf('|',endOfDelay+1); // Get separator position
|
||||
|
||||
var delay = parseInt(objXMLHttpReqSoc.responseText.substring(0,endOfDelay)); // Get refresh delay
|
||||
var htmlRecentTimeline = objXMLHttpReqSoc.responseText.substring(endOfDelay+1); // Get HTML code for social timeline
|
||||
var delay = parseInt(objXMLHttpReqSoc.responseText.substring(0,endOfDelay)); // Get refresh delay
|
||||
LastPubCod = parseInt(objXMLHttpReqSoc.responseText.substring(endOfDelay+1,endOfLastPubCod)); // Get last publishing code
|
||||
var htmlRecentTimeline = objXMLHttpReqSoc.responseText.substring(endOfLastPubCod+1); // Get HTML code for social timeline
|
||||
|
||||
var recentTimeline = document.getElementById('recent_timeline'); // Access to UL with the recent timeline
|
||||
if (recentTimeline) {
|
||||
|
|
|
@ -1339,7 +1339,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActMnu */{ 2,-1,TabUnk,ActMnu ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,NULL ,NULL},
|
||||
/* ActRefCon */{ 845,-1,TabUnk,ActRefCon ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Lay_RefreshNotifsAndConnected ,NULL},
|
||||
/* ActRefLstClk */{ 994,-1,TabUnk,ActRefLstClk ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Lay_RefreshLastClicks ,NULL},
|
||||
/* ActRefSocTim */{1509,-1,TabUnk,ActRefSocTim ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Lay_RefreshSocialTimeline ,NULL},
|
||||
/* ActRefSocTim */{1509,-1,TabUnk,ActRefSocTim ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Soc_GetParamLastPubCod ,Lay_RefreshSocialTimeline ,NULL},
|
||||
/* ActWebSvc */{ 892,-1,TabUnk,ActWebSvc ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Plg_WebService ,NULL},
|
||||
|
||||
// TabSys ******************************************************************
|
||||
|
|
|
@ -118,13 +118,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.104.3 (2016-01-09)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.104.4 (2016-01-09)"
|
||||
#define CSS_FILE "swad15.102.css"
|
||||
#define JS_FILE "swad15.104.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 15.104.4: Jan 09, 2016 Last social publishing code is sent and got via AJAX. (191831 lines)
|
||||
Version 15.104.3: Jan 09, 2016 Changes in layout of social timeline. (191784 lines)
|
||||
Version 15.104.2: Jan 09, 2016 Refresh recent social timeline via AJAX. (191769 lines)
|
||||
Version 15.104.1: Jan 09, 2016 Refresh recent social timeline via AJAX. (191727 lines)
|
||||
|
|
|
@ -214,7 +214,6 @@ void Gbl_InitializeGlobals (void)
|
|||
Gbl.CurrentIns.Ins.ShortName[0] = '\0';
|
||||
Gbl.CurrentIns.Ins.FullName[0] = '\0';
|
||||
Gbl.CurrentIns.Ins.WWW[0] = '\0';
|
||||
// Gbl.CurrentIns.Ins.NumStds = Gbl.CurrentIns.Ins.NumTchs = Gbl.CurrentIns.Ins.NumUsrs =
|
||||
Gbl.CurrentIns.Ins.NumCtrs = Gbl.CurrentIns.Ins.NumDpts = Gbl.CurrentIns.Ins.NumDegs = 0;
|
||||
Gbl.CurrentIns.Ins.NumUsrs = 0;
|
||||
|
||||
|
|
|
@ -382,6 +382,10 @@ struct Globals
|
|||
bool Error; // To signal that an error has happened
|
||||
const char *NicknameForQR; // Used as parameter in contextual links
|
||||
} Usrs;
|
||||
struct
|
||||
{
|
||||
long LastPubCod; // Last code of publishing got from database when refreshing timeline via AJAX
|
||||
} Social;
|
||||
struct
|
||||
{
|
||||
Sco_Scope_t Current;
|
||||
|
|
|
@ -1497,8 +1497,10 @@ void Lay_RefreshLastClicks (void)
|
|||
|
||||
void Lay_RefreshSocialTimeline (void)
|
||||
{
|
||||
// Send, before the HTML, the refresh time
|
||||
fprintf (Gbl.F.Out,"%lu|",Cfg_TIME_TO_REFRESH_SOCIAL_TIMELINE);
|
||||
// Send, before the HTML, the refresh time and the last publishing got from database
|
||||
fprintf (Gbl.F.Out,"%lu|%ld|",
|
||||
Cfg_TIME_TO_REFRESH_SOCIAL_TIMELINE,
|
||||
Gbl.Social.LastPubCod);
|
||||
Soc_GetAndShowRecentTimelineGbl ();
|
||||
|
||||
/***** All the output is made, so don't write anymore *****/
|
||||
|
|
|
@ -315,14 +315,39 @@ void Soc_ShowTimelineGbl (void)
|
|||
DB_ExitOnMySQLError ("can not remove temporary tables");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Get parameter with the more recent publishing code got from database ***/
|
||||
/*****************************************************************************/
|
||||
// This parameter is sent and receiveda again via AJAX
|
||||
// As an alternative, it could be stored in database with the code of session
|
||||
|
||||
void Soc_GetParamLastPubCod (void)
|
||||
{
|
||||
char LongStr[1+10+1];
|
||||
long LongNum;
|
||||
|
||||
/***** Get the more recent publishing code *****/
|
||||
Gbl.Social.LastPubCod = 0;
|
||||
Par_GetParToText ("LastPubCod",LongStr,1+10);
|
||||
if (LongStr[0]) // Parameter "LastPubCod" available
|
||||
if (sscanf (LongStr,"%ld",&LongNum) == 1)
|
||||
Gbl.Social.LastPubCod = LongNum;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Get and show recent timeline including all the users I follow *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Soc_GetAndShowRecentTimelineGbl (void)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<li class=\"SOCIAL_PUB\">PID = %lu; Time = %s</li>",
|
||||
(unsigned long) Gbl.PID,Gbl.Now.YYYYMMDDHHMMSS);
|
||||
fprintf (Gbl.F.Out,"<li class=\"SOCIAL_PUB\">"
|
||||
"PID = %lu; "
|
||||
"Time = %s; "
|
||||
"Gbl.Social.LastPubCod = %ld"
|
||||
"</li>",
|
||||
(unsigned long) Gbl.PID,
|
||||
Gbl.Now.YYYYMMDDHHMMSS,
|
||||
Gbl.Social.LastPubCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -367,6 +392,9 @@ static void Soc_ShowTimeline (const char *Query,const char *Title)
|
|||
row = mysql_fetch_row (mysql_res);
|
||||
Soc_GetDataOfSocialPublishingFromRow (row,&SocPub);
|
||||
|
||||
if (NumPub == 0) // The more recent publishing
|
||||
Gbl.Social.LastPubCod = SocPub.PubCod; // Last publishing code got from database
|
||||
|
||||
/* Get data of social note */
|
||||
SocNot.NotCod = SocPub.NotCod;
|
||||
Soc_GetDataOfSocialNoteByCod (&SocNot);
|
||||
|
@ -384,6 +412,12 @@ static void Soc_ShowTimeline (const char *Query,const char *Title)
|
|||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Initialize javascript global variable with the code of the last punlishing *****/
|
||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n"
|
||||
" LastPubCod = \"%ld\";\n"
|
||||
"</script>\n",
|
||||
Gbl.Social.LastPubCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -83,6 +83,7 @@ typedef enum
|
|||
|
||||
void Soc_ShowTimelineUsr (void);
|
||||
void Soc_ShowTimelineGbl (void);
|
||||
void Soc_GetParamLastPubCod (void);
|
||||
void Soc_GetAndShowRecentTimelineGbl (void);
|
||||
|
||||
void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod);
|
||||
|
|
Loading…
Reference in New Issue
Block a user