mirror of
https://github.com/acanas/swad-core.git
synced 2024-05-28 20:43:27 +02:00
Version 15.213
This commit is contained in:
parent
dde24c8652
commit
5dad067f19
|
@ -194,17 +194,14 @@ function setLocalDateTimeFormFromUTC (id,TimeUTC) {
|
||||||
|
|
||||||
// Set UTC time from local date-time form fields
|
// Set UTC time from local date-time form fields
|
||||||
function setUTCFromLocalDateTimeForm (id) {
|
function setUTCFromLocalDateTimeForm (id) {
|
||||||
var d = new Date();
|
// Important: set date all at once to avoid problems with different length of months
|
||||||
|
var d = new Date(document.getElementById(id+'Year' ).value,
|
||||||
// Important: set year first in order to work properly with leap years
|
document.getElementById(id+'Month' ).value-1,
|
||||||
d.setFullYear(document.getElementById(id+'Year' ).value);
|
document.getElementById(id+'Day' ).value,
|
||||||
d.setMonth (document.getElementById(id+'Month' ).value-1);
|
document.getElementById(id+'Hour' ).value,
|
||||||
d.setDate (document.getElementById(id+'Day' ).value);
|
document.getElementById(id+'Minute').value,
|
||||||
d.setHours (document.getElementById(id+'Hour' ).value);
|
document.getElementById(id+'Second').value,
|
||||||
d.setMinutes (document.getElementById(id+'Minute').value);
|
0);
|
||||||
d.setSeconds (document.getElementById(id+'Second').value);
|
|
||||||
d.setMilliseconds(0);
|
|
||||||
|
|
||||||
document.getElementById(id+'TimeUTC').value = d.getTime() / 1000;
|
document.getElementById(id+'TimeUTC').value = d.getTime() / 1000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,13 +140,15 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.212.9 (2016-05-30)"
|
#define Log_PLATFORM_VERSION "SWAD 15.213 (2016-05-31)"
|
||||||
#define CSS_FILE "swad15.210.css"
|
#define CSS_FILE "swad15.210.css"
|
||||||
#define JS_FILE "swad15.197.js"
|
#define JS_FILE "swad15.213.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 15.213: May 31, 2016 Code refactoring related to renaming test tags.
|
||||||
|
Fixed bug in dates reported by Christian A. Morillas Gutiérrez. (201581 lines)
|
||||||
Version 15.212.9: May 30, 2016 Link to list institutions of country in country configuration. (201567 lines)
|
Version 15.212.9: May 30, 2016 Link to list institutions of country in country configuration. (201567 lines)
|
||||||
Version 15.212.8: May 30, 2016 Link to list centres of institution in institution configuration. (201555 lines)
|
Version 15.212.8: May 30, 2016 Link to list centres of institution in institution configuration. (201555 lines)
|
||||||
Version 15.212.7: May 30, 2016 Link to list degrees of centre in centre configuration. (201547 lines)
|
Version 15.212.7: May 30, 2016 Link to list degrees of centre in centre configuration. (201547 lines)
|
||||||
|
|
48
swad_test.c
48
swad_test.c
|
@ -1413,13 +1413,7 @@ void Tst_RenameTag (void)
|
||||||
Par_GetParToText ("NewTagTxt",NewTagTxt,Tst_MAX_BYTES_TAG);
|
Par_GetParToText ("NewTagTxt",NewTagTxt,Tst_MAX_BYTES_TAG);
|
||||||
|
|
||||||
/***** Check that the new tag is not empty *****/
|
/***** Check that the new tag is not empty *****/
|
||||||
if (!NewTagTxt[0])
|
if (NewTagTxt[0]) // New tag not empty
|
||||||
{
|
|
||||||
sprintf (Gbl.Message,Txt_You_can_not_leave_the_name_of_the_tag_X_empty,
|
|
||||||
OldTagTxt);
|
|
||||||
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/***** Check if the old tag is equal to the new one
|
/***** Check if the old tag is equal to the new one
|
||||||
(this happens when user press INTRO
|
(this happens when user press INTRO
|
||||||
|
@ -1431,23 +1425,28 @@ void Tst_RenameTag (void)
|
||||||
if ((ExistingNewTagCod = Tst_GetTagCodFromTagTxt (NewTagTxt)) > 0) // The new tag was already in database
|
if ((ExistingNewTagCod = Tst_GetTagCodFromTagTxt (NewTagTxt)) > 0) // The new tag was already in database
|
||||||
{
|
{
|
||||||
// TODO: Fix Bug: when renaming unique tag "examen" to "Examen", tag is removed!
|
// TODO: Fix Bug: when renaming unique tag "examen" to "Examen", tag is removed!
|
||||||
/***** Complex update made to not repeat tags *****/
|
/***** Get tag code of the old tag *****/
|
||||||
/* Step 1. Get tag code of the old tag */
|
|
||||||
if ((OldTagCod = Tst_GetTagCodFromTagTxt (OldTagTxt)) < 0)
|
if ((OldTagCod = Tst_GetTagCodFromTagTxt (OldTagTxt)) < 0)
|
||||||
Lay_ShowErrorAndExit ("Tag does not exists.");
|
Lay_ShowErrorAndExit ("Tag does not exists.");
|
||||||
|
|
||||||
/* Step 2: If the new tag existed for a question ==> delete old tag from tst_question_tags; the new tag will remain
|
/***** Complex update made to not repeat tags:
|
||||||
If the new tag did not exist for a question ==> change old tag to new tag in tst_question_tags */
|
- If the new tag existed for a question ==>
|
||||||
|
delete old tag from tst_question_tags;
|
||||||
|
the new tag will remain
|
||||||
|
- If the new tag did not exist for a question ==>
|
||||||
|
change old tag to new tag in tst_question_tags *****/
|
||||||
|
/* Create a temporary table with all the question codes
|
||||||
|
that had the new tag as one of their tags */
|
||||||
sprintf (Query,"DROP TEMPORARY TABLE IF EXISTS tst_question_tags_tmp");
|
sprintf (Query,"DROP TEMPORARY TABLE IF EXISTS tst_question_tags_tmp");
|
||||||
if (mysql_query (&Gbl.mysql,Query))
|
if (mysql_query (&Gbl.mysql,Query))
|
||||||
DB_ExitOnMySQLError ("can not remove temporary table");
|
DB_ExitOnMySQLError ("can not remove temporary table");
|
||||||
|
|
||||||
sprintf (Query,"CREATE TEMPORARY TABLE tst_question_tags_tmp ENGINE=MEMORY"
|
sprintf (Query,"CREATE TEMPORARY TABLE tst_question_tags_tmp ENGINE=MEMORY"
|
||||||
" SELECT QstCod FROM tst_question_tags WHERE TagCod='%ld'",
|
" SELECT QstCod FROM tst_question_tags WHERE TagCod='%ld'",
|
||||||
ExistingNewTagCod);
|
ExistingNewTagCod);
|
||||||
if (mysql_query (&Gbl.mysql,Query))
|
if (mysql_query (&Gbl.mysql,Query))
|
||||||
DB_ExitOnMySQLError ("can not create temporary table");
|
DB_ExitOnMySQLError ("can not create temporary table");
|
||||||
|
|
||||||
|
/* Remove old tag in questions where it would be repeated */
|
||||||
sprintf (Query,"DELETE FROM tst_question_tags"
|
sprintf (Query,"DELETE FROM tst_question_tags"
|
||||||
" WHERE TagCod='%ld'"
|
" WHERE TagCod='%ld'"
|
||||||
" AND QstCod IN"
|
" AND QstCod IN"
|
||||||
|
@ -1455,6 +1454,7 @@ void Tst_RenameTag (void)
|
||||||
OldTagCod);
|
OldTagCod);
|
||||||
DB_QueryDELETE (Query,"can not remove a tag from some questions");
|
DB_QueryDELETE (Query,"can not remove a tag from some questions");
|
||||||
|
|
||||||
|
/* Change old tag to new tag in questions where it would not be repeated */
|
||||||
sprintf (Query,"UPDATE tst_question_tags"
|
sprintf (Query,"UPDATE tst_question_tags"
|
||||||
" SET TagCod='%ld'"
|
" SET TagCod='%ld'"
|
||||||
" WHERE TagCod='%ld'"
|
" WHERE TagCod='%ld'"
|
||||||
|
@ -1464,11 +1464,13 @@ void Tst_RenameTag (void)
|
||||||
OldTagCod);
|
OldTagCod);
|
||||||
DB_QueryUPDATE (Query,"can not update a tag in some questions");
|
DB_QueryUPDATE (Query,"can not update a tag in some questions");
|
||||||
|
|
||||||
|
/* Drop temporary table, no longer necessary */
|
||||||
sprintf (Query,"DROP TEMPORARY TABLE IF EXISTS tst_question_tags_tmp");
|
sprintf (Query,"DROP TEMPORARY TABLE IF EXISTS tst_question_tags_tmp");
|
||||||
if (mysql_query (&Gbl.mysql,Query))
|
if (mysql_query (&Gbl.mysql,Query))
|
||||||
DB_ExitOnMySQLError ("can not remove temporary table");
|
DB_ExitOnMySQLError ("can not remove temporary table");
|
||||||
|
|
||||||
/* Delete old tag from tst_tags because it is not longer used */
|
/***** Delete old tag from tst_tags
|
||||||
|
because it is not longer used *****/
|
||||||
sprintf (Query,"DELETE FROM tst_tags WHERE TagCod='%ld'",
|
sprintf (Query,"DELETE FROM tst_tags WHERE TagCod='%ld'",
|
||||||
OldTagCod);
|
OldTagCod);
|
||||||
DB_QueryDELETE (Query,"can not remove old tag");
|
DB_QueryDELETE (Query,"can not remove old tag");
|
||||||
|
@ -1496,6 +1498,12 @@ void Tst_RenameTag (void)
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // New tag empty
|
||||||
|
{
|
||||||
|
sprintf (Gbl.Message,Txt_You_can_not_leave_the_name_of_the_tag_X_empty,
|
||||||
|
OldTagTxt);
|
||||||
|
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
||||||
|
}
|
||||||
|
|
||||||
/***** Show again the form to configure test *****/
|
/***** Show again the form to configure test *****/
|
||||||
Tst_ShowFormConfig ();
|
Tst_ShowFormConfig ();
|
||||||
|
@ -5631,7 +5639,7 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt)
|
||||||
|
|
||||||
/***** Get tag code from database *****/
|
/***** Get tag code from database *****/
|
||||||
sprintf (Query,"SELECT TagCod FROM tst_tags"
|
sprintf (Query,"SELECT TagCod FROM tst_tags"
|
||||||
" WHERE tst_tags.CrsCod='%ld' AND tst_tags.TagTxt='%s'",
|
" WHERE CrsCod='%ld' AND TagTxt='%s'",
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,TagTxt);
|
Gbl.CurrentCrs.Crs.CrsCod,TagTxt);
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get tag");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get tag");
|
||||||
|
|
||||||
|
@ -6126,10 +6134,14 @@ static void Tst_RemoveUnusedTagsFromCurrentCrs (void)
|
||||||
char Query[1024];
|
char Query[1024];
|
||||||
|
|
||||||
/***** Remove unused tags from tst_tags *****/
|
/***** Remove unused tags from tst_tags *****/
|
||||||
sprintf (Query,"DELETE FROM tst_tags WHERE CrsCod='%ld' AND TagCod NOT IN"
|
sprintf (Query,"DELETE FROM tst_tags"
|
||||||
" (SELECT DISTINCT tst_question_tags.TagCod FROM tst_questions,tst_question_tags"
|
" WHERE CrsCod='%ld' AND TagCod NOT IN"
|
||||||
" WHERE tst_questions.CrsCod='%ld' AND tst_questions.QstCod=tst_question_tags.QstCod)",
|
" (SELECT DISTINCT tst_question_tags.TagCod"
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Crs.CrsCod);
|
" FROM tst_questions,tst_question_tags"
|
||||||
|
" WHERE tst_questions.CrsCod='%ld'"
|
||||||
|
" AND tst_questions.QstCod=tst_question_tags.QstCod)",
|
||||||
|
Gbl.CurrentCrs.Crs.CrsCod,
|
||||||
|
Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
DB_QueryDELETE (Query,"can not remove unused tags");
|
DB_QueryDELETE (Query,"can not remove unused tags");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user