Version19.254

This commit is contained in:
acanas 2020-06-22 22:47:54 +02:00
parent 5d67fe415b
commit e6c064c90f
6 changed files with 924 additions and 933 deletions

View File

@ -77,9 +77,21 @@ function submitForm(FormId) {
// WriteDateOnSameDay = false ==> don't write date if it's the same day than the last call
// WriteWeekDay = true ==> write day of the week ('monday', 'tuesday'...)
// WriteHMS = 3 least significant bits for hour, minute and second
var txtToday = [
"", // Unknown
"Avui", // CA
"Heute", // DE
"Today", // EN
"Hoy", // ES
"Aujourd'hui", // FR
"Ko ára", // GN
"Oggi", // IT
"Dzisiaj", // PL
"Hoje", // PT
];
function writeLocalDateHMSFromUTC (id,TimeUTC,DateFormat,Separator,StrToday,
WriteDateOnSameDay,WriteWeekDay,WriteHMS) {
function writeLocalDateHMSFromUTC (id,TimeUTC,DateFormat,Separator,Language,
WriteToday,WriteDateOnSameDay,WriteWeekDay,WriteHMS) {
// HMS: Hour, Minutes, Seconds
var today = new Date();
var todayYea = today.getFullYear();
@ -87,7 +99,6 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,DateFormat,Separator,StrToday,
var todayDay = today.getDate();
var d = new Date();
var WriteDate;
var WriteTodayStr;
var Yea;
var Mon;
var Day;
@ -123,16 +134,11 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,DateFormat,Separator,StrToday,
/* Set date */
StrDate = '';
if (WriteDate) {
WriteTodayStr = false;
if (StrToday != null)
if (StrToday.length &&
Yea == todayYea &&
Mon == todayMon &&
Day == todayDay) // Today
WriteTodayStr = true;
if (WriteTodayStr)
StrDate = StrToday;
WriteToday = WriteToday && (Yea == todayYea &&
Mon == todayMon &&
Day == todayDay); // Date is today
if (WriteToday)
StrDate = txtToday[Language];
else
switch (DateFormat) {
case 0: // Dat_FORMAT_YYYY_MM_DD
@ -549,8 +555,36 @@ function readConnUsrsData () {
/***************** Update exam print main area using AJAX ********************/
/*****************************************************************************/
var txtConnectionIssues = [
"", // Unknown
"Problemes de connexió. Els canvis no s'han desat.", // CA
"Verbindungsprobleme. Die Änderungen wurden nicht gespeichert.", // DE
"Connection issues. The changes have not been saved.", // EN
"Problema de conexión. Los cambios no se han guardado.", // ES
"Problèmes de connexion. Les modifications n'ont pas été enregistrées.",// FR
"Problema de conexión. Los cambios no se han guardado.", // GN Okoteve traducción
"Problemi di connessione. Le modifiche non sono state salvate.", // IT
"Problemy z połączeniem. Zmiany nie zostały zapisane.", // PL
"Problemas de conexão. As alterações não foram salvas." // PT
];
var txtSaving = [
"", // Unknown
"Desant…", // CA
"Speichern…", // DE
"Saving…", // EN
"Guardando…", // ES
"Enregistrement…", // FR
"Guardando…", // GN Okoteve traducción
"Salvataggio…", // IT
"Zapisywanie…", // PL
"Salvando…", // PT
];
var IHaveFinishedTxt;
// This function is called when user changes an answer in an exam print
function updateExamPrint (idDiv,idInput,nameInput,Params,timeoutMsg,IHaveFinishedTxt,savingTxt) {
function updateExamPrint (idDiv,idInput,nameInput,Params,Language) {
var objXMLHttp = false;
objXMLHttp = AJAXCreateObject ();
@ -614,7 +648,7 @@ function updateExamPrint (idDiv,idInput,nameInput,Params,timeoutMsg,IHaveFinishe
}
}
disableFinished (savingTxt); // Disable finished button on sending. When answer is saved and response received ==> the button will be reloaded
IHaveFinishedTxt = disableFinished (txtSaving[Language]); // Disable finished button on sending. When answer is saved and response received ==> the button will be reloaded
objXMLHttp.open('POST',ActionAJAX,true);
objXMLHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
@ -627,7 +661,7 @@ function updateExamPrint (idDiv,idInput,nameInput,Params,timeoutMsg,IHaveFinishe
var xmlHttpTimeout = setTimeout (ajaxTimeout,5000); // 5 s
function ajaxTimeout () {
objXMLHttp.abort ();
alert (timeoutMsg);
alert (txtConnectionIssues[Language]);
disableFinished (IHaveFinishedTxt); // Sending aborted ==> change "Saving..." to original "I have finished"
};
}
@ -695,8 +729,9 @@ console.table(arr);
/********* Disable button to finish exam when focus on a input text **********/
/*****************************************************************************/
function disableFinished (Txt) {
function disableFinished (buttonNewTxt) {
var f = document.getElementById('finished'); // Access to form
var buttonOldTxt = '';
if (f)
for (var i = 0; i < f.elements.length; i++) {
@ -704,9 +739,12 @@ function disableFinished (Txt) {
if (b.type == 'submit') {
b.disabled = true;
b.style.opacity = 0.5;
b.innerHTML = Txt;
buttonOldTxt = b.innerHTML;
b.innerHTML = buttonNewTxt;
}
}
return buttonOldTxt;
}
/*****************************************************************************/

View File

@ -556,9 +556,9 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.253.1 (2020-06-22)"
#define Log_PLATFORM_VERSION "SWAD 19.254 (2020-06-22)"
#define CSS_FILE "swad19.253.css"
#define JS_FILE "swad19.246.1.js"
#define JS_FILE "swad19.254.js"
/*
TODO: Encarnación Hidalgo Tenorio: Antonio, ¿podría @swad_ugr mandar una notificación cuando el alumnado ha mandado su tarea?
Se trataría de añadir un par de líneas "Nuevos archivos en actividades", "Nuevos archivos en otros trabajos".
@ -569,8 +569,7 @@ TODO: Que al generar un examen s
TODO: Refactorizar MchRes_CheckIfICanSeeMatchResult y MchRes_CheckIfICanViewScore uniéndolas en una función como ExaRes_CheckIfICanSeePrintResult
Y dentro de las funciones TstPrn_ShowUsrPrints y TstPrn_ShowOnePrint crear y llamar a una función común similar a ExaRes_CheckIfICanSeePrintResult
Version 19.253.1: Jun 22, 2020 Fixed bug in dates reported by Laura García Rejón.
Use &apos; in HTML translations. (303662 lines)
Version 19.254: Jun 22, 2020 Fixed bug in Javascript related to quotes. Reported by Laura García Rejón. (303653 lines)
Version 19.253: Jun 22, 2020 More details in listing of exams. (303643 lines)
Version 19.252.1: Jun 19, 2020 Changes in listing of exams and matches results. (303245 lines)
Version 19.252: Jun 19, 2020 Fixed bug in exam results, reported by Francisco Ligero Ligero. (303243 lines)

View File

@ -1654,7 +1654,6 @@ void Dat_WriteLocalDateHMSFromUTC (const char *Id,time_t TimeUTC,
bool WriteToday,bool WriteDateOnSameDay,
bool WriteWeekDay,unsigned WriteHMS)
{
extern const char *Txt_Today;
static const char *SeparatorStr[] =
{
[Dat_SEPARATOR_NONE ] = "",
@ -1663,14 +1662,15 @@ void Dat_WriteLocalDateHMSFromUTC (const char *Id,time_t TimeUTC,
};
HTM_SCRIPT_Begin (NULL,NULL);
HTM_TxtF ("writeLocalDateHMSFromUTC('%s',%ld,%u,'%s','%s',%s,%s,0x%x);",
HTM_TxtF ("writeLocalDateHMSFromUTC('%s',%ld,%u,'%s',%u,%s,%s,%s,0x%x);",
Id,(long) TimeUTC,(unsigned) DateFormat,SeparatorStr[Separator],
WriteToday ? Txt_Today :
"",
(unsigned) Gbl.Prefs.Language,
WriteToday ? "true" :
"false",
WriteDateOnSameDay ? "true" :
"false",
WriteWeekDay ? "true" :
"false",
WriteWeekDay ? "true" :
"false",
WriteHMS);
HTM_SCRIPT_End ();
}

View File

@ -962,22 +962,18 @@ static void ExaPrn_WriteJSToUpdateExamPrint (const struct ExaPrn_Print *Print,
unsigned NumQst,
const char *Id,int NumOpt)
{
extern const char *Txt_Connection_issues_;
extern const char *Txt_I_have_finished;
extern const char *Txt_Saving_;
if (NumOpt < 0)
HTM_TxtF (" onchange=\"updateExamPrint('examprint','%s','Ans',"
"'act=%ld&ses=%s&SesCod=%ld&NumQst=%u','%s','%s','%s');",
"'act=%ld&ses=%s&SesCod=%ld&NumQst=%u',%u);",
Id,
Act_GetActCod (ActAnsExaPrn),Gbl.Session.Id,Print->SesCod,NumQst,
Txt_Connection_issues_,Txt_I_have_finished,Txt_Saving_);
(unsigned) Gbl.Prefs.Language);
else // NumOpt >= 0
HTM_TxtF (" onclick=\"updateExamPrint('examprint','%s_%d','Ans',"
"'act=%ld&ses=%s&SesCod=%ld&NumQst=%u','%s','%s','%s');",
"'act=%ld&ses=%s&SesCod=%ld&NumQst=%u',%u);",
Id,NumOpt,
Act_GetActCod (ActAnsExaPrn),Gbl.Session.Id,Print->SesCod,NumQst,
Txt_Connection_issues_,Txt_I_have_finished,Txt_Saving_);
(unsigned) Gbl.Prefs.Language);
HTM_Txt (" return false;\""); // return false is necessary to not submit form
}

View File

@ -592,7 +592,6 @@ static bool Tst_CheckIfNextTstAllowed (void)
{
extern const char *Hlp_ASSESSMENT_Tests;
extern const char *Txt_You_can_not_take_a_new_test_until;
extern const char *Txt_Today;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
long NumSecondsFromNowToNextAccTst = -1L; // Access allowed when this number <= 0
@ -634,11 +633,12 @@ static bool Tst_CheckIfNextTstAllowed (void)
Ale_ShowAlert (Ale_WARNING,"%s:<br /><span id=\"date_next_test\"></span>."
"<script type=\"text/javascript\">"
"writeLocalDateHMSFromUTC('date_next_test',%ld,"
"%u,',&nbsp;','%s',true,true,0x7);"
"%u,',&nbsp;',%u,true,true,true,0x7);"
"</script>",
Txt_You_can_not_take_a_new_test_until,
(long) TimeNextTestUTC,
(unsigned) Gbl.Prefs.DateFormat,Txt_Today);
(unsigned) Gbl.Prefs.DateFormat,
(unsigned) Gbl.Prefs.Language);
return false;
}

File diff suppressed because it is too large Load Diff