Version 15.107.1

This commit is contained in:
Antonio Cañas Vargas 2016-01-10 23:00:15 +01:00
parent 47ba744e9c
commit 942cdc551c
4 changed files with 44 additions and 19 deletions

View File

@ -473,15 +473,17 @@ function readNewTimelineData() {
if (newTimeline) {
newTimeline.innerHTML = htmlNewTimeline + newTimeline.innerHTML; // Update list of publishings in new timeline
var countNewTimeline = newTimeline.childNodes.length;
if (countNewTimeline) {
var viewNewPostsContainer = document.getElementById('view_new_posts_container');
var viewNewPostsCount = document.getElementById('view_new_posts_count');
// Scripts in timeline got via AJAX are not executed ==> execute them
evalScriptsInElem (newTimeline);
// Update number of new posts
var viewNewPostsCount = document.getElementById('view_new_posts_count');
viewNewPostsCount.innerHTML = countNewTimeline;
// Display message with new posts if hidden
var viewNewPostsContainer = document.getElementById('view_new_posts_container');
viewNewPostsContainer.style.display = '';
}
}
@ -506,12 +508,14 @@ function readOldTimelineData() {
var countOldTimeline = oldTimeline.childNodes.length;
if (countOldTimeline) {
var timeline = document.getElementById("timeline_list");
// Scripts in timeline got via AJAX are not executed ==> execute them
evalScriptsInElem (oldTimeline);
// Move all the LI elements in UL 'old_timeline_list' to the bottom of UL 'timeline_list'
var timeline = document.getElementById("timeline_list");
for (var i=0; i<countOldTimeline; i++)
timeline.appendChild(oldTimeline.firstChild);
// Process mathematics; see http://docs.mathjax.org/en/latest/advanced/typeset.html
MathJax.Hub.Queue(["Typeset",MathJax.Hub,timeline]);
}
@ -529,6 +533,7 @@ function moveNewTimelineToTimeline() {
if (countNewTimeline) {
var timeline = document.getElementById("timeline_list");
// Move all the LI elements in UL 'new_timeline_list' to the top of UL 'timeline_list'
for (var i=0; i<countNewTimeline; i++)
timeline.insertBefore(newTimeline.lastChild, timeline.childNodes[0]);
@ -542,6 +547,16 @@ function moveNewTimelineToTimeline() {
viewNewPostsContainer.style.display = 'none';
}
// Scripts got via AJAX are not executed ==> execute them
function evalScriptsInElem(elem) {
var scrs = elem.getElementsByTagName("script");
var s;
for (var i=0; i<scrs.length; i++) {
s = scrs[i].childNodes[0].nodeValue;
if (s != null) eval(s);
}
}
// Zoom a user's photograph
function zoom(img,urlPhoto,shortName) {
var zoomImgWidth = 186; // big photo
@ -574,7 +589,7 @@ function noZoom() {
var xPos = -(187+15);
var yPos = -(250+15+110);
document.getElementById('zoomTxt').innerHTML = '';
document.getElementById('zoomImg').src='/icon/_.gif';
document.getElementById('zoomImg').src='/swad/icon/usr_bl.jpg';
document.getElementById('zoomLyr').style.left = xPos + 'px';
document.getElementById('zoomLyr').style.top = yPos + 'px';
}

View File

@ -113,6 +113,7 @@
// TODO: Forum SWAD should be always named "SWAD"?
// TODO: Enable chat for guests?
// TODO: Go to forum post (or at least to forum thread) from social timeline?
// TODO: Include time of last comment in table social_timeline to display social publishings with new comments when refreshing
// TODO: Change refreshing time from 5 seconds to 1 minute or so. Increment one second after each refresh?
// TODO: Show error message when commenting a removed social note
@ -122,13 +123,15 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.107 (2016-01-10)"
#define Log_PLATFORM_VERSION "SWAD 15.107.1 (2016-01-10)"
#define CSS_FILE "swad15.105.css"
#define JS_FILE "swad15.107.js"
#define JS_FILE "swad15.107.1.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.107.1: Jan 10, 2016 Id of dates in timeline must be unique.
Changes in JavaScript to render dates and mathenatics. (192137 lines)
Version 15.107: Jan 10, 2016 Get older publishings from social timeline. (192112 lines)
1 change necessary in database:
ALTER TABLE sessions ADD COLUMN FirstPubCod BIGINT NOT NULL DEFAULT 0 AFTER LastRefresh;

View File

@ -234,7 +234,7 @@ void Lay_WriteStartOfPage (void)
if (Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW)
fprintf (Gbl.F.Out,"<body onload=\"init()\">\n"
"<div id=\"zoomLyr\" class=\"ZOOM\">"
"<img id=\"zoomImg\" src=\"%s/_.gif\""
"<img id=\"zoomImg\" src=\"%s/usr_bl.jpg\""
" alt=\"\" title=\"\""
" class=\"IMG_USR\" />"
"<div id=\"zoomTxt\" class=\"CENTER_MIDDLE\">"

View File

@ -946,22 +946,29 @@ static void Soc_WriteDateTime (time_t TimeUTC)
{
extern const char *Txt_Today;
static unsigned UniqueId = 0;
char Id[32+Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+10+1];
UniqueId++;
/***** Start cell *****/
fprintf (Gbl.F.Out,"<div id=\"date_%u\" class=\"SOCIAL_RIGHT_TIME DAT_LIGHT\""
" style=\"display:inline-block;\">",
UniqueId);
/***** Create Id. The id must be unique in timeline,
but the timeline is updated via AJAX.
So, Id uses:
- a name for this execution (Gbl.UniqueNameEncrypted)
- an extension for the current element (UniqueId) *****/
sprintf (Id,"date_%s_%u",Gbl.UniqueNameEncrypted,UniqueId);
/***** Write date and time *****/
/***** Container where the date-time is written *****/
fprintf (Gbl.F.Out,"<div id=\"%s\" class=\"SOCIAL_RIGHT_TIME DAT_LIGHT\""
" style=\"display:inline-block;\"></div>",
Id);
/***** Script to write date and time in browser local time *****/
// This must be out of the div where the output is written
// because it will be evaluated in a loop in JavaScript
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('date_%u',%ld,'&nbsp;','%s');"
"writeLocalDateTimeFromUTC('%s',%ld,'&nbsp;','%s');"
"</script>",
UniqueId,(long) TimeUTC,Txt_Today);
/***** End cell *****/
fprintf (Gbl.F.Out,"</div>");
Id,(long) TimeUTC,Txt_Today);
}
/*****************************************************************************/