Version 15.110.13

This commit is contained in:
Antonio Cañas Vargas 2016-01-13 02:03:56 +01:00
parent be6449b070
commit 4b85d57de7
16 changed files with 147 additions and 49 deletions

View File

@ -1720,7 +1720,7 @@ a:hover img.CENTRE_PHOTO_SHOW
{
display:inline-block;
box-sizing:border-box;
width:310px;
width:320px;
text-align:left;
vertical-align:top;
}
@ -1728,7 +1728,7 @@ a:hover img.CENTRE_PHOTO_SHOW
{
display:inline-block;
box-sizing:border-box;
width:170px;
width:160px;
text-align:right;
vertical-align:top;
}
@ -1800,7 +1800,7 @@ a:hover img.CENTRE_PHOTO_SHOW
{
display:inline-block;
box-sizing:border-box;
width:270px;
width:280px;
text-align:left;
vertical-align:top;
}

View File

@ -60,7 +60,8 @@ function writeLocalDateFromUTC(id,TimeUTC) {
// TimeUTC is the date-time to write in UTC UNIX time format
// separator is HTML code to write between date and time
function writeLocalDateTimeFromUTC(id,TimeUTC,separator,StrToday) {
function writeLocalDateHMSFromUTC(id,TimeUTC,separator,StrToday) {
// HMS: Hour, Minutes, Seconds
var today = new (Date);
var todayYea = today.getFullYear();
var todayMon = today.getMonth()+1;
@ -101,6 +102,44 @@ function writeLocalDateTimeFromUTC(id,TimeUTC,separator,StrToday) {
StrHou + ':' + StrMin + ':' + StrSec;
}
function writeLocalDateHMFromUTC(id,TimeUTC,separator,StrToday) {
// HM: Hour, Minutes
var today = new (Date);
var todayYea = today.getFullYear();
var todayMon = today.getMonth()+1;
var todayDay = today.getDate();
var d = new Date;
var Yea;
var Mon;
var Day;
var Hou;
var Min;
var StrMon;
var StrDay;
var StrHou;
var StrMin;
d.setTime(TimeUTC * 1000);
Yea = d.getFullYear();
Mon = d.getMonth() + 1;
Day = d.getDate();
Hou = d.getHours();
Min = d.getMinutes();
StrMon = ((Mon < 10) ? '0' : '') + Mon;
StrDay = ((Day < 10) ? '0' : '') + Day;
StrHou = ((Hou < 10) ? '0' : '') + Hou;
StrMin = ((Min < 10) ? '0' : '') + Min;
if (Yea == todayYea && Mon == todayMon && Day == todayDay && // Today
StrToday.length)
document.getElementById(id).innerHTML = StrToday +
separator +
StrHou + ':' + StrMin;
else
document.getElementById(id).innerHTML = Yea + '-' + StrMon + '-' + StrDay +
separator +
StrHou + ':' + StrMin;
}
// Set local date-time form fields from UTC time
function setLocalDateTimeFormFromUTC(id,TimeUTC) {
var FormYea = document.getElementById(id+'Year' );

View File

@ -245,7 +245,7 @@ static void Asg_ShowOneAssignment (long AsgCod)
fprintf (Gbl.F.Out,"<tr>"
"<td id=\"asg_date_start_%u\" class=\"%s LEFT_TOP COLOR%u\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('asg_date_start_%u',%ld,'<br />','%s');"
"writeLocalDateHMSFromUTC('asg_date_start_%u',%ld,'<br />','%s');"
"</script>"
"</td>",
UniqueId,
@ -260,7 +260,7 @@ static void Asg_ShowOneAssignment (long AsgCod)
UniqueId++;
fprintf (Gbl.F.Out,"<td id=\"asg_date_end_%u\" class=\"%s LEFT_TOP COLOR%u\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('asg_date_end_%u',%ld,'<br />','%s');"
"writeLocalDateHMSFromUTC('asg_date_end_%u',%ld,'<br />','%s');"
"</script>"
"</td>",
UniqueId,

View File

@ -302,7 +302,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
fprintf (Gbl.F.Out,"\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('att_date_start_%u',%ld,'<br />','%s');"
"writeLocalDateHMSFromUTC('att_date_start_%u',%ld,'<br />','%s');"
"</script>"
"</td>",
UniqueId,Att->TimeUTC[Att_START_TIME],Txt_Today);
@ -318,7 +318,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
fprintf (Gbl.F.Out,"\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('att_date_end_%u',%ld,'<br />','%s');"
"writeLocalDateHMSFromUTC('att_date_end_%u',%ld,'<br />','%s');"
"</script>"
"</td>",
UniqueId,Att->TimeUTC[Att_END_TIME],Txt_Today);
@ -2993,7 +2993,7 @@ static void Att_ListEventsToSelect (Att_TypeOfView_t TypeOfView)
"<td class=\"DAT LEFT_MIDDLE COLOR%u\">"
"<span id=\"att_date_start_%u\"></span> %s"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('att_date_start_%u',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('att_date_start_%u',%ld,'&nbsp;','%s');"
"</script>"
"</td>"
"<td class=\"DAT RIGHT_MIDDLE COLOR%u\">"
@ -3382,7 +3382,7 @@ static void Att_ListAttEventsForAStd (unsigned NumStd,struct UsrData *UsrDat)
" alt=\"%s\" title=\"%s\" class=\"ICON20x20\" />"
"<span id=\"att_date_start_%u\"></span> %s"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('att_date_start_%u',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('att_date_start_%u',%ld,'&nbsp;','%s');"
"</script>"
"</td>"
"</tr>",

View File

@ -116,19 +116,23 @@
// TODO: Increment one second after each refresh in social timeline?
// TODO: Add a new type of visibility of profile "unknown". Keep the same for photos?
// TODO: Limit text of post/comment in social timeline to 1000 characters?
// TODO: Sinchronize timeline in other actions
// TODO: Optimize Javascript not concatenating big strings in new timeline
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.110.11 (2016-01-13)"
#define CSS_FILE "swad15.110.2.css"
#define JS_FILE "swad15.107.2.js"
#define Log_PLATFORM_VERSION "SWAD 15.110.13 (2016-01-13)"
#define CSS_FILE "swad15.110.13.css"
#define JS_FILE "swad15.110.13.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.110.13:Jan 13, 2016 Time in social timeline without seconds. (192495 lines)
Version 15.110.12:Jan 13, 2016 Display name of sharer/commenter in timeline. (192456 lines)
Version 15.110.11:Jan 13, 2016 Fixed bug in social timeline. (192403 lines)
Version 15.110.10:Jan 13, 2016 New temporary tables used to optimize querying timeline. (192398 lines)
Version 15.110.9: Jan 12, 2016 Do not get social notes already present in timeline. (192388 lines)

View File

@ -5861,7 +5861,7 @@ static void Brw_WriteDatesAssignment (void)
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
"ASG_LST_DATE_RED");
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('asg_start_date_%u',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('asg_start_date_%u',%ld,'&nbsp;','%s');"
"</script>",
UniqueId,
(long) Gbl.FileBrowser.Asg.TimeUTC[Asg_START_TIME],Txt_Today);
@ -5883,7 +5883,7 @@ static void Brw_WriteDatesAssignment (void)
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
"ASG_LST_DATE_RED");
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('asg_end_date_%u',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('asg_end_date_%u',%ld,'&nbsp;','%s');"
"</script>",
UniqueId,
(long) Gbl.FileBrowser.Asg.TimeUTC[Asg_END_TIME],Txt_Today);
@ -5923,7 +5923,7 @@ static void Brw_WriteFileSizeAndDate (Brw_FileType_t FileType,struct FileMetadat
UniqueId++;
fprintf (Gbl.F.Out,"<span id=\"filedate%u\"></span>"
"<script type=\"text/javascript\">"
"writeLocalDateFromUTC('filedate%u',%ld);"
"writeLocalDateHMSFromUTC('filedate%u',%ld);"
"</script>",
UniqueId,
UniqueId,(long) FileMetadata->Time);
@ -9089,7 +9089,7 @@ void Brw_ShowFileMetadata (void)
The_ClassForm[Gbl.Prefs.Theme],Txt_Date_of_creation);
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('filedate',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('filedate',%ld,'&nbsp;','%s');"
"</script>",
(long) FileMetadata.Time,Txt_Today);

View File

@ -3361,7 +3361,7 @@ void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],struct Pagination *Pagi
UniqueId++;
fprintf (Gbl.F.Out,"<td id=\"date_%u\" class=\"%s LEFT_TOP %s\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('date_%u',%ld,'<br />','%s');"
"writeLocalDateHMSFromUTC('date_%u',%ld,'<br />','%s');"
"</script>"
"</td>",
UniqueId,Style,BgColor,

View File

@ -1928,7 +1928,7 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp)
fprintf (Gbl.F.Out,"<br />%s: "
"<span id=\"open_time_%u\"></span>"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('open_time_%u',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('open_time_%u',%ld,'&nbsp;','%s');"
"</script>",
Txt_Opening_of_groups,
UniqueId,

View File

@ -3361,7 +3361,7 @@ void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassBackground)
/***** Write date and time *****/
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('date_%u',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('date_%u',%ld,'&nbsp;','%s');"
"</script>",
UniqueId,(long) TimeUTC,Txt_Today);

View File

@ -682,7 +682,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
Act_FormEnd ();
}
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('notice_date_%u',%ld,'<br />','%s');"
"writeLocalDateHMSFromUTC('notice_date_%u',%ld,'<br />','%s');"
"</script>"
"</div>",
UniqueId,(long) TimeUTC,Txt_Today);

View File

@ -420,7 +420,7 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
(UsrFigures.NumDays == 1) ? Txt_day :
Txt_days);
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateFromUTC('first_click_date',%ld,'&nbsp;');"
"writeLocalDateHMSFromUTC('first_click_date',%ld,'&nbsp;');"
"</script>",
(long) UsrFigures.FirstClickTimeUTC);
}

View File

@ -610,8 +610,10 @@ static void Soc_ShowTimeline (const char *Query,const char *Title)
/* Write social note */
if (!AlreadyWasInTimeline)
{
// fprintf (Gbl.F.Out,"<li>PubCod %ld:</li>",SocPub.PubCod);
Soc_WriteSocialNote (&SocNot,&SocPub,false,true);
}
}
fprintf (Gbl.F.Out,"</ul>");
@ -716,8 +718,10 @@ static void Soc_ShowOldPubsInTimeline (const char *Query)
/* Write social note */
if (!AlreadyWasInTimeline)
{
// fprintf (Gbl.F.Out,"<li>PubCod %ld:</li>",SocPub.PubCod);
Soc_WriteSocialNote (&SocNot,&SocPub,false,true);
}
}
/***** Store first publishing code into session *****/
@ -781,6 +785,8 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
bool ShowNoteAlone, // Social note is shown alone, not in a list
bool ViewTopLine) // Separate with a top line from previous social note
{
extern const char *Txt_SOCIAL_USER_has_shared;
extern const char *Txt_SOCIAL_USER_has_commented;
extern const char *Txt_Forum;
extern const char *Txt_Course;
extern const char *Txt_Degree;
@ -825,8 +831,30 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
Deg.DegCod = -1L;
Crs.CrsCod = -1L;
/***** Get author data *****/
/***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat);
/***** Write sharer/commenter if distinct to author *****/
if (!ShowNoteAlone && // Listing, not note alone
SocPub) // SocPub may be NULL
if (SocPub->PubType == Soc_PUB_SHARED_NOTE ||
SocPub->PubType == Soc_PUB_COMMENT_TO_NOTE)
{
UsrDat.UsrCod = SocPub->PublisherCod;
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // TODO: Optimize with a specialized function, we only need FullName
{
Str_LimitLengthHTMLStr (UsrDat.FullName,40);
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_TOP_SHARER\">");
fprintf (Gbl.F.Out,
SocPub->PubType == Soc_PUB_SHARED_NOTE ? Txt_SOCIAL_USER_has_shared :
Txt_SOCIAL_USER_has_commented,
UsrDat.FullName);
fprintf (Gbl.F.Out,"</div>");
}
}
/***** Get author data *****/
UsrDat.UsrCod = SocNot->UsrCod;
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
if (Gbl.Usrs.Me.Logged)
@ -836,21 +864,6 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
/***** Write sharer if distinct to author *****/
if (!ShowNoteAlone && SocPub)
{
if (SocPub->PubType == Soc_PUB_SHARED_NOTE ||
SocPub->PubType == Soc_PUB_COMMENT_TO_NOTE)
{
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_TOP_SHARER\">");
if (SocPub->PubType == Soc_PUB_SHARED_NOTE)
fprintf (Gbl.F.Out,"Fulanito ha compartido:"); // TODO: Need translation!!!
else
fprintf (Gbl.F.Out,"Fulanito ha comentado:"); // TODO: Need translation!!!
fprintf (Gbl.F.Out,"</div>");
}
}
/***** Left: write author's photo *****/
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_LEFT_PHOTO\">");
ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL);
@ -863,7 +876,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_RIGHT_CONTAINER\">");
/* Write author's full name and nickname */
Str_LimitLengthHTMLStr (UsrDat.FullName,16);
Str_LimitLengthHTMLStr (UsrDat.FullName,17);
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_RIGHT_AUTHOR\">"
"<span class=\"DAT_N_BOLD\">%s</span>"
"<span class=\"DAT_LIGHT\"> @%s</span>"
@ -1060,7 +1073,7 @@ static void Soc_WriteDateTime (time_t TimeUTC)
// 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('%s',%ld,'&nbsp;','%s');"
"writeLocalDateHMFromUTC('%s',%ld,'&nbsp;','%s');"
"</script>",
IdDateTime,(long) TimeUTC,Txt_Today);
}
@ -1488,7 +1501,7 @@ static void Soc_PutHiddenFormToWriteNewPost (void)
/* Write author's full name and nickname */
strcpy (FullName,Gbl.Usrs.Me.UsrDat.FullName);
Str_LimitLengthHTMLStr (FullName,16);
Str_LimitLengthHTMLStr (FullName,17);
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_RIGHT_AUTHOR\">"
"<span class=\"DAT_N_BOLD\">%s</span>"
"<span class=\"DAT_LIGHT\"> @%s</span>"
@ -1790,7 +1803,7 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom,
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_COMMENT_RIGHT_CONTAINER\">");
/* Write author's full name and nickname */
Str_LimitLengthHTMLStr (UsrDat.FullName,12);
Str_LimitLengthHTMLStr (UsrDat.FullName,14);
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_COMMENT_RIGHT_AUTHOR\">"
"<span class=\"DAT_BOLD\">%s</span>"
"<span class=\"DAT_LIGHT\"> @%s</span>"

View File

@ -1675,7 +1675,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql
/* Write the date-time (row[3]) */
fprintf (Gbl.F.Out,"<td id=\"date_%u\" class=\"LOG CENTER_TOP COLOR%u\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('date_%u',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('date_%u',%ld,'&nbsp;','%s');"
"</script>"
"</td>",
UniqueId,Gbl.RowEvenOdd,

View File

@ -359,7 +359,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,bool Sh
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
fprintf (Gbl.F.Out,"\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('svy_date_start_%u',%ld,'<br />','%s');"
"writeLocalDateHMSFromUTC('svy_date_start_%u',%ld,'<br />','%s');"
"</script>"
"</td>",
UniqueId,Svy.TimeUTC[Svy_START_TIME],Txt_Today);
@ -375,7 +375,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,bool Sh
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
fprintf (Gbl.F.Out,"\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('svy_date_end_%u',%ld,'<br />','%s');"
"writeLocalDateHMSFromUTC('svy_date_end_%u',%ld,'<br />','%s');"
"</script>"
"</td>",
UniqueId,Svy.TimeUTC[Svy_END_TIME],Txt_Today);

View File

@ -619,7 +619,7 @@ static bool Tst_CheckIfNextTstAllowed (void)
"<span id=\"date_next_test\">"
"</span>"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('date_next_test',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('date_next_test',%ld,'&nbsp;','%s');"
"</script>"
"</td>"
"</tr>",
@ -2550,7 +2550,7 @@ static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *m
fprintf (Gbl.F.Out,"<td id=\"tst_date_%u\""
" class=\"DAT_SMALL CENTER_TOP COLOR%u\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('tst_date_%u',%ld,'<br />','%s');"
"writeLocalDateHMSFromUTC('tst_date_%u',%ld,'<br />','%s');"
"</script>"
"</td>",
UniqueId,Gbl.RowEvenOdd,
@ -6268,7 +6268,7 @@ static void Tst_ShowResultsOfTestExams (struct UsrData *UsrDat)
UniqueId++;
fprintf (Gbl.F.Out,"<td id =\"tst_date_%u\" class=\"%s RIGHT_TOP COLOR%u\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('tst_date_%u',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('tst_date_%u',%ld,'&nbsp;','%s');"
"</script>"
"</td>",
UniqueId,ClassDat,Gbl.RowEvenOdd,
@ -6609,7 +6609,7 @@ void Tst_ShowOneTestExam (void)
"</td>"
"<td id=\"exam\" class=\"DAT LEFT_TOP\">"
"<script type=\"text/javascript\">"
"writeLocalDateTimeFromUTC('exam',%ld,'&nbsp;','%s');"
"writeLocalDateHMSFromUTC('exam',%ld,'&nbsp;','%s');"
"</script>"
"</td>"
"</tr>",

View File

@ -35783,6 +35783,48 @@ const char *Txt_SOCIAL_PUBLISHING_Not_shared_by_anyone = // No longer shared
"N&atilde;o compartilhado por qualquer pessoa";
#endif
const char *Txt_SOCIAL_USER_has_commented = // Warning: it is very important to include %s in the following sentences
#if L==1
"%s ha comentat:";
#elif L==2
"%s hat kommentiert:";
#elif L==3
"%s has commented:";
#elif L==4
"%s ha comentado:";
#elif L==5
"%s a comment&eacute;:";
#elif L==6
"%s ha comentado:"; // Okoteve traducción
#elif L==7
"%s ha commentato:";
#elif L==8
"%s skomentowa&lstroke:";
#elif L==9
"%s comentou:";
#endif
const char *Txt_SOCIAL_USER_has_shared = // Warning: it is very important to include %s in the following sentences
#if L==1
"%s ha compartit:";
#elif L==2
"%s hat sich geteilt:";
#elif L==3
"%s has shared:";
#elif L==4
"%s ha compartido:";
#elif L==5
"%s a partag&eacute;:";
#elif L==6
"%s ha compartido:"; // Okoteve traducción
#elif L==7
"%s ha condiviso:";
#elif L==8
"%s podzieli&lstroke:";
#elif L==9
"%s compartilhou:";
#endif
const char *Txt_Sort_degrees_by =
#if L==1
"Ordenar titulacions per";