mirror of https://github.com/acanas/swad-core.git
Version 15.104
This commit is contained in:
parent
575ee9cc0f
commit
8bc168dabb
|
@ -23,7 +23,7 @@
|
|||
// Global variable (string) used to write HTML
|
||||
var Gbl_HTMLContent;
|
||||
|
||||
// Global variable used in refreshConnected()
|
||||
// Global variable used to call SWAD via AJAX
|
||||
var ActionAJAX;
|
||||
|
||||
// Global variables used in writeLocalClock()
|
||||
|
@ -322,7 +322,7 @@ 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 +335,7 @@ 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');
|
||||
|
@ -343,6 +343,19 @@ function refreshLastClicks() {
|
|||
}
|
||||
}
|
||||
|
||||
//Automatic refresh of social timeline using AJAX. This function must be called from time to time
|
||||
var objXMLHttpReqSoc = false;
|
||||
function refreshSocialTimeline() {
|
||||
objXMLHttpReqSoc = AJAXCreateObject();
|
||||
if (objXMLHttpReqSoc) {
|
||||
var RefreshParams = RefreshParamNxtActSoc + '&' + RefreshParamIdSes + '&' + RefreshParamCrsCod;
|
||||
objXMLHttpReqSoc.onreadystatechange = readSocialTimelineData; // onreadystatechange must be lowercase
|
||||
objXMLHttpReqSoc.open('POST',ActionAJAX,true);
|
||||
objXMLHttpReqSoc.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
objXMLHttpReqSoc.send(RefreshParams);
|
||||
}
|
||||
}
|
||||
|
||||
// Create AJAX object (try is unknown in earlier versions of Netscape, but works in IE5)
|
||||
function AJAXCreateObject() {
|
||||
var obj = false;
|
||||
|
@ -364,14 +377,14 @@ function AJAXCreateObject() {
|
|||
function readConnUsrsData() {
|
||||
if (objXMLHttpReqCon.readyState == 4) { // Check if data have been received
|
||||
if (objXMLHttpReqCon.status == 200) {
|
||||
var endOfDelay = objXMLHttpReqCon.responseText.indexOf('|',0); // Get separator position
|
||||
var endOfNotif = objXMLHttpReqCon.responseText.indexOf('|',endOfDelay+1); // Get separator position
|
||||
var endOfGblCon = objXMLHttpReqCon.responseText.indexOf('|',endOfNotif+1); // Get separator position
|
||||
var endOfDelay = objXMLHttpReqCon.responseText.indexOf('|',0); // Get separator position
|
||||
var endOfNotif = objXMLHttpReqCon.responseText.indexOf('|',endOfDelay+1); // Get separator position
|
||||
var endOfGblCon = objXMLHttpReqCon.responseText.indexOf('|',endOfNotif+1); // Get separator position
|
||||
var endOfCrsCon = objXMLHttpReqCon.responseText.indexOf('|',endOfGblCon+1); // Get separator position
|
||||
var endOfNumUsrs = objXMLHttpReqCon.responseText.indexOf('|',endOfCrsCon+1); // Get separator position
|
||||
|
||||
var delay = parseInt(objXMLHttpReqCon.responseText.substring(0,endOfDelay)); // Get refresh delay
|
||||
var htmlNotif = objXMLHttpReqCon.responseText.substring(endOfDelay +1,endOfNotif); // Get HTML code for new notifications
|
||||
var delay = parseInt(objXMLHttpReqCon.responseText.substring(0,endOfDelay)); // Get refresh delay
|
||||
var htmlNotif = objXMLHttpReqCon.responseText.substring(endOfDelay +1,endOfNotif); // Get HTML code for new notifications
|
||||
var htmlGblCon = objXMLHttpReqCon.responseText.substring(endOfNotif +1,endOfGblCon); // Get HTML code for connected
|
||||
var htmlCrsCon = objXMLHttpReqCon.responseText.substring(endOfGblCon+1,endOfCrsCon); // Get HTML code for course connected
|
||||
var NumUsrsStr = objXMLHttpReqCon.responseText.substring(endOfCrsCon+1,endOfNumUsrs); // Get number of users
|
||||
|
@ -411,11 +424,10 @@ function readConnUsrsData() {
|
|||
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 endOfLastClicks = objXMLHttpReqLog.responseText.indexOf('|',endOfDelay+1); // Get separator position
|
||||
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 htmlLastClicks = objXMLHttpReqLog.responseText.substring(endOfDelay+1); // Get HTML code for last clicks
|
||||
|
||||
var divLastClicks = document.getElementById('lastclicks'); // Access to last click DIV
|
||||
if (divLastClicks)
|
||||
|
@ -426,6 +438,24 @@ function readLastClicksData() {
|
|||
}
|
||||
}
|
||||
|
||||
//Receives and show social timeline data
|
||||
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 delay = parseInt(objXMLHttpReqSoc.responseText.substring(0,endOfDelay)); // Get refresh delay
|
||||
var htmlSocialTimeline = objXMLHttpReqSoc.responseText.substring(endOfDelay+1); // Get HTML code for social timeline
|
||||
|
||||
var divSocialTimeline = document.getElementById('recent_timeline'); // Access to social timeline DIV
|
||||
if (divSocialTimeline)
|
||||
divSocialTimeline.innerHTML = htmlSocialTimeline; // Update global connected DIV
|
||||
if (delay >= 5000) // If refresh slower than 1 time each 5 seconds, do refresh; else abort
|
||||
setTimeout('refreshSocialTimeline()',delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Zoom a user's photograph
|
||||
function zoom(img,urlPhoto,shortName) {
|
||||
var zoomImgWidth = 186; // big photo
|
|
@ -83,6 +83,7 @@ extern struct Globals Gbl;
|
|||
3. ActMnu Show menu of a tab
|
||||
4. ActRefCon Refresh number of notifications and connected users via AJAX
|
||||
5. ActRefLstClk Refresh last clicks in log via AJAX
|
||||
New!!!!!!!!. ActRefSocTim Refresh recent social timeline via AJAX
|
||||
6. ActWebSvc Call plugin function
|
||||
System:
|
||||
7. ActSysReqSch Request search in system tab
|
||||
|
@ -1338,6 +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},
|
||||
/* ActWebSvc */{ 892,-1,TabUnk,ActWebSvc ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Plg_WebService ,NULL},
|
||||
|
||||
// TabSys ******************************************************************
|
||||
|
@ -4200,6 +4202,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
|
|||
ActReqRemSocComUsr, // #1506
|
||||
ActRemSocComGbl, // #1507
|
||||
ActRemSocComUsr, // #1508
|
||||
ActRefSocTim, // #1509
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4498,8 +4501,9 @@ void Act_AdjustCurrentAction (void)
|
|||
return;
|
||||
|
||||
/***** Don't adjust anything when refreshing users or on a web service *****/
|
||||
if (Gbl.CurrentAct == ActRefCon ||
|
||||
if (Gbl.CurrentAct == ActRefCon ||
|
||||
Gbl.CurrentAct == ActRefLstClk ||
|
||||
Gbl.CurrentAct == ActRefSocTim ||
|
||||
Gbl.WebService.IsWebService)
|
||||
return;
|
||||
|
||||
|
|
|
@ -71,9 +71,9 @@ typedef enum
|
|||
|
||||
typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
||||
|
||||
#define Act_NUM_ACTIONS (7+52+15+90+72+67+205+183+143+163+36+27+82)
|
||||
#define Act_NUM_ACTIONS (8+52+15+90+72+67+205+183+143+163+36+27+82)
|
||||
|
||||
#define Act_MAX_ACTION_COD 1508
|
||||
#define Act_MAX_ACTION_COD 1509
|
||||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
|
||||
|
||||
|
@ -86,7 +86,8 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
|
|||
#define ActMnu 3
|
||||
#define ActRefCon 4
|
||||
#define ActRefLstClk 5
|
||||
#define ActWebSvc 6
|
||||
#define ActRefSocTim 6
|
||||
#define ActWebSvc 7
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************** System tab *********************************/
|
||||
|
|
|
@ -118,13 +118,16 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.103 (2016-01-08)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.104 (2016-01-09)"
|
||||
#define CSS_FILE "swad15.102.css"
|
||||
#define JS_FILE "swad15.100.2.js"
|
||||
#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: Jan 09, 2016 Refresh recent social timeline via AJAX. Not finished. (191720 lines)
|
||||
Version 15.103.2: Jan 09, 2016 Check that social post or comments are not empty. (191652 lines)
|
||||
Version 15.103.1: Jan 08, 2016 Changes in timeline. (191646 lines)
|
||||
Version 15.103: Jan 08, 2016 Changes in the form to enter a new publishing. (191625 lines)
|
||||
1 change necessary in database:
|
||||
UPDATE actions SET Obsolete='Y' WHERE ActCod IN ('1491','1497');
|
||||
|
|
|
@ -493,6 +493,8 @@
|
|||
|
||||
#define Cfg_TIME_TO_REFRESH_LAST_CLICKS ((time_t)( 500UL)) // Refresh period of last clicks in miliseconds
|
||||
|
||||
#define Cfg_TIME_TO_REFRESH_SOCIAL_TIMELINE ((time_t)( 5UL*1000UL)) // Refresh period of social timeline in miliseconds
|
||||
|
||||
#define Cfg_TIME_TO_CHANGE_BANNER ((time_t)( 5UL*60UL)) // After these seconds, change banner
|
||||
#define Cfg_NUMBER_OF_BANNERS 1 // Number of banners to show simultaneously
|
||||
|
||||
|
|
|
@ -439,8 +439,9 @@ void Gbl_InitializeGlobals (void)
|
|||
|
||||
void Gbl_Cleanup (void)
|
||||
{
|
||||
if (Gbl.CurrentAct != ActRefCon &&
|
||||
if (Gbl.CurrentAct != ActRefCon &&
|
||||
Gbl.CurrentAct != ActRefLstClk &&
|
||||
Gbl.CurrentAct != ActRefSocTim &&
|
||||
!Gbl.WebService.IsWebService &&
|
||||
Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW &&
|
||||
!Gbl.HiddenParamsInsertedIntoDB)
|
||||
|
|
|
@ -94,8 +94,8 @@ struct Globals
|
|||
bool GetMethod; // Am I accessed using GET method?
|
||||
struct soap *soap; // gSOAP runtime environment
|
||||
Act_Content_t ContentReceivedByCGI; /* Content send by the form and received by the CGI:
|
||||
Act_CONTENT_NORM (if CONTENT_TYPE==text/plain) or
|
||||
Act_CONTENT_DATA (if CONTENT_TYPE==multipart/form-data) */
|
||||
Act_CONTENT_NORM (if CONTENT_TYPE==text/plain) or
|
||||
Act_CONTENT_DATA (if CONTENT_TYPE==multipart/form-data) */
|
||||
char DelimiterString[1000];
|
||||
char DelimiterStringIncludingInitialRet[2+1000];
|
||||
struct
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "swad_notification.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_preference.h"
|
||||
#include "swad_social.h"
|
||||
#include "swad_tab.h"
|
||||
#include "swad_theme.h"
|
||||
#include "swad_web_service.h"
|
||||
|
@ -80,7 +81,7 @@ static void Lay_WritePageTitle (void);
|
|||
static void Lay_WriteRedirectionToMyLanguage (void);
|
||||
static void Lay_WriteScripts (void);
|
||||
static void Lay_WriteScriptInit (void);
|
||||
static void Lay_WriteScriptConnectedUsrs (void);
|
||||
static void Lay_WriteScriptParamsAJAX (void);
|
||||
static void Lay_WriteScriptCustomDropzone (void);
|
||||
|
||||
static void Lay_WritePageTopHeading (void);
|
||||
|
@ -122,9 +123,10 @@ void Lay_WriteStartOfPage (void)
|
|||
Con_ComputeConnectedUsrsBelongingToCurrentCrs ();
|
||||
|
||||
/***** Send head width the file type for the HTTP protocol *****/
|
||||
if (Gbl.CurrentAct == ActRefCon ||
|
||||
Gbl.CurrentAct == ActRefLstClk)
|
||||
// Don't generate a full HTML page, only refresh connected users
|
||||
if (Gbl.CurrentAct == ActRefCon ||
|
||||
Gbl.CurrentAct == ActRefLstClk ||
|
||||
Gbl.CurrentAct == ActRefSocTim)
|
||||
// Don't generate a full HTML page, only the content of a DIV or similar
|
||||
{
|
||||
fprintf (Gbl.F.Out,"Content-Type: text/html; charset=windows-1252\r\n\r\n");
|
||||
Gbl.Layout.WritingHTMLStart = false;
|
||||
|
@ -450,7 +452,7 @@ static void Lay_WriteScripts (void)
|
|||
if (Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW)
|
||||
{
|
||||
Lay_WriteScriptInit ();
|
||||
Lay_WriteScriptConnectedUsrs ();
|
||||
Lay_WriteScriptParamsAJAX ();
|
||||
}
|
||||
|
||||
/***** Prepare script to draw months *****/
|
||||
|
@ -608,24 +610,29 @@ static void Lay_WriteScriptInit (void)
|
|||
if (Gbl.CurrentAct == ActLstClk)
|
||||
fprintf (Gbl.F.Out," setTimeout(\"refreshLastClicks()\",%lu);\n",
|
||||
Cfg_TIME_TO_REFRESH_LAST_CLICKS);
|
||||
else if (Gbl.CurrentAct == ActSeeSocTmlGbl)
|
||||
fprintf (Gbl.F.Out," setTimeout(\"refreshSocialTimeline()\",%lu);\n",
|
||||
Cfg_TIME_TO_REFRESH_SOCIAL_TIMELINE);
|
||||
fprintf (Gbl.F.Out,"}\n"
|
||||
"</script>\n");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Write script to show connected users using AJAX **************/
|
||||
/************** Write script to set parameters needed by AJAX ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Lay_WriteScriptConnectedUsrs (void)
|
||||
static void Lay_WriteScriptParamsAJAX (void)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">\n"
|
||||
"var RefreshParamNxtActCon = \"act=%ld\";\n"
|
||||
"var RefreshParamNxtActLog = \"act=%ld\";\n"
|
||||
"var RefreshParamNxtActSoc = \"act=%ld\";\n"
|
||||
"var RefreshParamIdSes = \"ses=%s\";\n"
|
||||
"var RefreshParamCrsCod = \"crs=%ld\";\n"
|
||||
"</script>\n",
|
||||
Act_Actions[ActRefCon].ActCod,
|
||||
Act_Actions[ActRefCon ].ActCod,
|
||||
Act_Actions[ActRefLstClk].ActCod,
|
||||
Act_Actions[ActRefSocTim].ActCod,
|
||||
Gbl.Session.Id,
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
}
|
||||
|
@ -1288,8 +1295,9 @@ void Lay_ShowErrorAndExit (const char *Message)
|
|||
|
||||
/***** Page is generated (except </body> and </html>).
|
||||
Compute time to generate page *****/
|
||||
if (Gbl.CurrentAct != ActRefCon && // Refreshing connected users
|
||||
Gbl.CurrentAct != ActRefLstClk) // Refreshing last clics
|
||||
if (Gbl.CurrentAct != ActRefCon && // Refreshing connected users
|
||||
Gbl.CurrentAct != ActRefLstClk && // Refreshing last clics
|
||||
Gbl.CurrentAct != ActRefSocTim) // Refreshing social timeline
|
||||
Sta_ComputeTimeToGeneratePage ();
|
||||
|
||||
if (Gbl.WebService.IsWebService) // Serving a plugin request
|
||||
|
@ -1307,8 +1315,9 @@ void Lay_ShowErrorAndExit (const char *Message)
|
|||
Fil_FastCopyOfOpenFiles (Gbl.F.Out,stdout);
|
||||
Fil_CloseAndRemoveFileForHTMLOutput ();
|
||||
|
||||
if (Gbl.CurrentAct != ActRefCon && // Refreshing connected users
|
||||
Gbl.CurrentAct != ActRefLstClk) // Refreshing last clicks
|
||||
if (Gbl.CurrentAct != ActRefCon && // Refreshing connected users
|
||||
Gbl.CurrentAct != ActRefLstClk && // Refreshing last clicks
|
||||
Gbl.CurrentAct != ActRefSocTim) // Refreshing last clicks
|
||||
{
|
||||
/***** Compute time to send page *****/
|
||||
Sta_ComputeTimeToSendPage ();
|
||||
|
@ -1469,7 +1478,7 @@ void Lay_RefreshNotifsAndConnected (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Refresh connected users via AJAX ***********************/
|
||||
/**************** Refresh last clicks in realtime via AJAX *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Lay_RefreshLastClicks (void)
|
||||
|
@ -1482,6 +1491,20 @@ void Lay_RefreshLastClicks (void)
|
|||
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Refresh social timeline via AJAX **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Lay_RefreshSocialTimeline (void)
|
||||
{
|
||||
// Send, before the HTML, the refresh time
|
||||
fprintf (Gbl.F.Out,"%lu|",Cfg_TIME_TO_REFRESH_SOCIAL_TIMELINE);
|
||||
Soc_GetAndShowRecentTimelineGbl ();
|
||||
|
||||
/***** All the output is made, so don't write anymore *****/
|
||||
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Write the end of the page **************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -108,8 +108,10 @@ void Lay_EndRoundFrameWithButton (Lay_Button_t Button,const char *TxtButton);
|
|||
|
||||
void Lay_ShowErrorAndExit (const char *Message);
|
||||
void Lay_ShowAlert (Lay_AlertType_t MsgType,const char *Message);
|
||||
|
||||
void Lay_RefreshNotifsAndConnected (void);
|
||||
void Lay_RefreshLastClicks (void);
|
||||
void Lay_RefreshSocialTimeline (void);
|
||||
|
||||
void Lay_WriteHeaderClassPhoto (unsigned NumColumns,bool PrintView,bool DrawingClassPhoto,
|
||||
long InsCod,long DegCod,long CrsCod);
|
||||
|
|
|
@ -315,6 +315,16 @@ void Soc_ShowTimelineGbl (void)
|
|||
DB_ExitOnMySQLError ("can not remove temporary tables");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Get and show recent timeline including all the users I follow *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Soc_GetAndShowRecentTimelineGbl (void)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<li>PID = %lu; Time = %s</li>",
|
||||
(unsigned long) Gbl.PID,Gbl.Now.YYYYMMDDHHMMSS);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Show social activity (timeline) *********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -355,15 +365,19 @@ static void Soc_ShowTimeline (const char *Query,Act_Action_t UpdateAction,
|
|||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/***** Start list *****/
|
||||
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
|
||||
|
||||
/***** Form to write a new post *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod <= 0 || // Global timeline
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // It's me
|
||||
Soc_PutHiddenFormToWriteNewPost ();
|
||||
|
||||
/***** Place to insert new publishings *****/
|
||||
fprintf (Gbl.F.Out,"<ul id=\"recent_timeline\" class=\"LIST_LEFT\""
|
||||
" style=\"background:yellow;\">");
|
||||
|
||||
fprintf (Gbl.F.Out,"</ul>");
|
||||
|
||||
/***** List publishings in timeline one by one *****/
|
||||
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
|
||||
for (NumPub = 0;
|
||||
NumPub < NumPublishings;
|
||||
NumPub++)
|
||||
|
@ -379,8 +393,6 @@ static void Soc_ShowTimeline (const char *Query,Act_Action_t UpdateAction,
|
|||
/* Write social note */
|
||||
Soc_WriteSocialNote (&SocPub,&SocNot,false,NumPub == NumPublishings - 1);
|
||||
}
|
||||
|
||||
/***** End list *****/
|
||||
fprintf (Gbl.F.Out,"</ul>");
|
||||
|
||||
/***** End frame *****/
|
||||
|
@ -1067,13 +1079,14 @@ static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub)
|
|||
|
||||
static void Soc_PutHiddenFormToWriteNewPost (void)
|
||||
{
|
||||
extern const char *Txt_Send_comment;
|
||||
extern const char *Txt_Post;
|
||||
bool ShowPhoto;
|
||||
char PhotoURL[PATH_MAX+1];
|
||||
char FullName[(Usr_MAX_BYTES_NAME+1)*3];
|
||||
|
||||
/***** Start list item *****/
|
||||
fprintf (Gbl.F.Out,"<li class=\"SOCIAL_PUB\">");
|
||||
/***** Start list *****/
|
||||
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">"
|
||||
"<li class=\"SOCIAL_PUB\">");
|
||||
|
||||
/***** Left: write author's photo *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_LEFT_PHOTO\">");
|
||||
|
@ -1095,7 +1108,6 @@ static void Soc_PutHiddenFormToWriteNewPost (void)
|
|||
"</div>",
|
||||
FullName,Gbl.Usrs.Me.UsrDat.Nickname);
|
||||
|
||||
|
||||
/***** Start container *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_FORM_COMMENT\">");
|
||||
|
||||
|
@ -1111,13 +1123,12 @@ static void Soc_PutHiddenFormToWriteNewPost (void)
|
|||
/* Content of new post */
|
||||
fprintf (Gbl.F.Out,"<textarea name=\"Content\" cols=\"45\" rows=\"3\">"
|
||||
"</textarea>");
|
||||
Lay_HelpPlainEditor ();
|
||||
|
||||
/***** Send button *****/
|
||||
fprintf (Gbl.F.Out,"<button type=\"submit\" class=\"BT_SUBMIT_INLINE BT_CREATE\">"
|
||||
"%s"
|
||||
"</button>",
|
||||
Txt_Send_comment);
|
||||
Txt_Post);
|
||||
|
||||
/***** End form *****/
|
||||
Act_FormEnd ();
|
||||
|
@ -1125,8 +1136,9 @@ static void Soc_PutHiddenFormToWriteNewPost (void)
|
|||
/***** End container *****/
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/***** End list item *****/
|
||||
fprintf (Gbl.F.Out,"</li>");
|
||||
/***** End list *****/
|
||||
fprintf (Gbl.F.Out,"</li>"
|
||||
"</ul>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1174,13 +1186,16 @@ static void Soc_ReceiveSocialPost (void)
|
|||
Par_GetParAndChangeFormat ("Content",Content,Cns_MAX_BYTES_LONG_TEXT,
|
||||
Str_TO_RIGOROUS_HTML,true);
|
||||
|
||||
/* Insert post content in the database */
|
||||
sprintf (Query,"INSERT INTO social_posts (Content) VALUES ('%s')",
|
||||
Content);
|
||||
PstCod = DB_QueryINSERTandReturnCode (Query,"can not create post");
|
||||
if (Content[0])
|
||||
{
|
||||
/* Insert post content in the database */
|
||||
sprintf (Query,"INSERT INTO social_posts (Content) VALUES ('%s')",
|
||||
Content);
|
||||
PstCod = DB_QueryINSERTandReturnCode (Query,"can not create post");
|
||||
|
||||
/* Insert post in social notes */
|
||||
Soc_StoreAndPublishSocialNote (Soc_NOTE_SOCIAL_POST,PstCod);
|
||||
/* Insert post in social notes */
|
||||
Soc_StoreAndPublishSocialNote (Soc_NOTE_SOCIAL_POST,PstCod);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1681,17 +1696,20 @@ static void Soc_ReceiveComment (void)
|
|||
Par_GetParAndChangeFormat (ParamName,Content,Cns_MAX_BYTES_LONG_TEXT,
|
||||
Str_TO_RIGOROUS_HTML,true);
|
||||
|
||||
/* Insert comment in the database */
|
||||
sprintf (Query,"INSERT INTO social_comments (NotCod,UsrCod,TimeComment)"
|
||||
" VALUES ('%ld','%ld',NOW())",
|
||||
SocNot.NotCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
ComCod = DB_QueryINSERTandReturnCode (Query,"can not create comment");
|
||||
if (Content[0])
|
||||
{
|
||||
/* Insert comment in the database */
|
||||
sprintf (Query,"INSERT INTO social_comments (NotCod,UsrCod,TimeComment)"
|
||||
" VALUES ('%ld','%ld',NOW())",
|
||||
SocNot.NotCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
ComCod = DB_QueryINSERTandReturnCode (Query,"can not create comment");
|
||||
|
||||
/* Insert comment content in the database */
|
||||
sprintf (Query,"INSERT INTO social_comments_content (ComCod,Content)"
|
||||
" VALUES ('%ld','%s')",
|
||||
ComCod,Content);
|
||||
DB_QueryINSERT (Query,"can not store comment content");
|
||||
/* Insert comment content in the database */
|
||||
sprintf (Query,"INSERT INTO social_comments_content (ComCod,Content)"
|
||||
" VALUES ('%ld','%s')",
|
||||
ComCod,Content);
|
||||
DB_QueryINSERT (Query,"can not store comment content");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -83,6 +83,7 @@ typedef enum
|
|||
|
||||
void Soc_ShowTimelineUsr (void);
|
||||
void Soc_ShowTimelineGbl (void);
|
||||
void Soc_GetAndShowRecentTimelineGbl (void);
|
||||
|
||||
void Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod);
|
||||
void Soc_MarkSocialNoteAsUnavailableUsingNotCod (long NotCod);
|
||||
|
|
21
swad_text.c
21
swad_text.c
|
@ -27721,6 +27721,27 @@ const char *Txt_Private_available_to_certain_users_identified =
|
|||
"Privado, disponível para alguns usuários identificados";
|
||||
#endif
|
||||
|
||||
const char *Txt_Post = // Publish (verb)
|
||||
#if L==1
|
||||
"Publicar";
|
||||
#elif L==2
|
||||
"Veröffentlichen";
|
||||
#elif L==3
|
||||
"Post";
|
||||
#elif L==4
|
||||
"Publicar";
|
||||
#elif L==5
|
||||
"Publier";
|
||||
#elif L==6
|
||||
"Publicar"; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Pubblicare";
|
||||
#elif L==8
|
||||
"Publikować";
|
||||
#elif L==9
|
||||
"Publicar";
|
||||
#endif
|
||||
|
||||
const char *Txt_post =
|
||||
#if L==1
|
||||
"missatge";
|
||||
|
|
Loading…
Reference in New Issue