mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-10 10:45:23 +02:00
Version 20.51.19: Mar 19, 2021 Media database table renamed.
This commit is contained in:
parent
d67a3c1e06
commit
36ad9e55e1
|
@ -1004,9 +1004,9 @@ CREATE TABLE IF NOT EXISTS marks_properties (
|
|||
Footer INT NOT NULL,
|
||||
UNIQUE INDEX(FilCod));
|
||||
--
|
||||
-- Table media: stores information about media (images, videos, YouTube)
|
||||
-- Table med_media: stores information about media (images, videos, YouTube)
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS media (
|
||||
CREATE TABLE IF NOT EXISTS med_media (
|
||||
MedCod INT NOT NULL AUTO_INCREMENT,
|
||||
Type ENUM('none','jpg','gif','mp4','webm','ogg','youtube','embed') NOT NULL DEFAULT 'none',
|
||||
Name VARCHAR(43) NOT NULL DEFAULT '',
|
||||
|
|
|
@ -600,14 +600,18 @@ TODO: Salvador Romero Cort
|
|||
|
||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.51.18 (2021-03-19)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.51.19 (2021-03-19)"
|
||||
#define CSS_FILE "swad20.45.css"
|
||||
#define JS_FILE "swad20.6.2.js"
|
||||
/*
|
||||
TODO: Rename CENTRE to CENTER in help wiki.
|
||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||
|
||||
Version 20.51.18: Mar 19, 2021 Projects database table renamed. (307992 lines)
|
||||
Version 20.51.19: Mar 19, 2021 Media database table renamed. (308033 lines)
|
||||
1 change necessary in database:
|
||||
RENAME TABLE media TO med_media;
|
||||
|
||||
Version 20.51.18: Mar 19, 2021 Projects database table renamed. (308022 lines)
|
||||
1 change necessary in database:
|
||||
RENAME TABLE projects TO prj_projects;
|
||||
|
||||
|
|
|
@ -2102,9 +2102,9 @@ mysql> DESCRIBE marks_properties;
|
|||
"Footer INT NOT NULL,"
|
||||
"UNIQUE INDEX(FilCod))");
|
||||
|
||||
/***** Table media *****/
|
||||
/***** Table med_media *****/
|
||||
/*
|
||||
mysql> DESCRIBE media;
|
||||
mysql> DESCRIBE med_media;
|
||||
+--------+---------------------------------------------------------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+--------+---------------------------------------------------------------+------+-----+---------+----------------+
|
||||
|
@ -2116,7 +2116,7 @@ mysql> DESCRIBE media;
|
|||
+--------+---------------------------------------------------------------+------+-----+---------+----------------+
|
||||
5 rows in set (0.01 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS media ("
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS med_media ("
|
||||
"MedCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"Type ENUM('none','jpg','gif','mp4','webm','ogg','youtube','embed') NOT NULL DEFAULT 'none',"
|
||||
"Name VARCHAR(43) NOT NULL DEFAULT ''," // Med_BYTES_NAME
|
||||
|
|
29
swad_exam.c
29
swad_exam.c
|
@ -1263,10 +1263,12 @@ static void Exa_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod)
|
|||
NumMedia =
|
||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get media",
|
||||
"SELECT exa_set_questions.MedCod" // row[0]
|
||||
" FROM exa_exams,exa_sets,exa_set_questions"
|
||||
" FROM exa_exams,"
|
||||
"exa_sets,"
|
||||
"exa_set_questions"
|
||||
" WHERE exa_exams.CrsCod=%ld"
|
||||
" AND exa_exams.ExaCod=exa_sets.ExaCod"
|
||||
" AND exa_sets.SetCod=exa_set_questions.SetCod",
|
||||
" AND exa_exams.ExaCod=exa_sets.ExaCod"
|
||||
" AND exa_sets.SetCod=exa_set_questions.SetCod",
|
||||
CrsCod);
|
||||
|
||||
/***** Go over result removing media files *****/
|
||||
|
@ -1286,15 +1288,18 @@ static void Exa_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod)
|
|||
unsigned NumMedia;
|
||||
|
||||
/***** Get names of media files associated to answers of exam questions from database *****/
|
||||
NumMedia =
|
||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get media",
|
||||
"SELECT exa_set_answers.MedCod" // row[0]
|
||||
" FROM exa_exams,exa_sets,exa_set_questions,exa_set_answers"
|
||||
" WHERE exa_exams.CrsCod=%ld"
|
||||
" AND exa_exams.ExaCod=exa_sets.ExaCod"
|
||||
" AND exa_sets.SetCod=exa_set_questions.SetCod"
|
||||
" AND exa_set_questions.QstCod=exa_set_answers.QstCod",
|
||||
CrsCod);
|
||||
NumMedia = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get media",
|
||||
"SELECT exa_set_answers.MedCod" // row[0]
|
||||
" FROM exa_exams,"
|
||||
"exa_sets,"
|
||||
"exa_set_questions,"
|
||||
"exa_set_answers"
|
||||
" WHERE exa_exams.CrsCod=%ld"
|
||||
" AND exa_exams.ExaCod=exa_sets.ExaCod"
|
||||
" AND exa_sets.SetCod=exa_set_questions.SetCod"
|
||||
" AND exa_set_questions.QstCod=exa_set_answers.QstCod",
|
||||
CrsCod);
|
||||
|
||||
/***** Go over result removing media files *****/
|
||||
Med_RemoveMediaFromAllRows (NumMedia,mysql_res);
|
||||
|
|
|
@ -2067,13 +2067,14 @@ static void ExaSet_RemoveMediaFromStemOfQst (long SetCod,long QstCod)
|
|||
unsigned NumMedia;
|
||||
|
||||
/***** Get media code associated to stem of test question from database *****/
|
||||
NumMedia =
|
||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get media",
|
||||
"SELECT MedCod" // row[0]
|
||||
" FROM exa_set_questions"
|
||||
" WHERE QstCod=%ld"
|
||||
" AND SetCod=%ld", // Extra check
|
||||
QstCod,SetCod);
|
||||
NumMedia = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get media",
|
||||
"SELECT MedCod" // row[0]
|
||||
" FROM exa_set_questions"
|
||||
" WHERE QstCod=%ld"
|
||||
" AND SetCod=%ld", // Extra check
|
||||
QstCod,
|
||||
SetCod);
|
||||
|
||||
/***** Go over result removing media *****/
|
||||
Med_RemoveMediaFromAllRows (NumMedia,mysql_res);
|
||||
|
@ -2089,15 +2090,18 @@ static void ExaSet_RemoveMediaFromAllAnsOfQst (long SetCod,long QstCod)
|
|||
unsigned NumMedia;
|
||||
|
||||
/***** Get media codes associated to answers of test question from database *****/
|
||||
NumMedia =
|
||||
(unsigned) DB_QuerySELECT (&mysql_res,"can not get media",
|
||||
"SELECT exa_set_answers.MedCod" // row[0]
|
||||
" FROM exa_set_answers,exa_set_questions"
|
||||
" WHERE exa_set_answers.QstCod=%ld"
|
||||
" AND exa_set_answers.QstCod=exa_set_questions.QstCod"
|
||||
" AND exa_set_questions.SetCod=%ld" // Extra check
|
||||
" AND exa_set_questions.QstCod=%ld", // Extra check
|
||||
QstCod,SetCod,QstCod);
|
||||
NumMedia = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get media",
|
||||
"SELECT exa_set_answers.MedCod" // row[0]
|
||||
" FROM exa_set_answers,"
|
||||
"exa_set_questions"
|
||||
" WHERE exa_set_answers.QstCod=%ld"
|
||||
" AND exa_set_answers.QstCod=exa_set_questions.QstCod"
|
||||
" AND exa_set_questions.SetCod=%ld" // Extra check
|
||||
" AND exa_set_questions.QstCod=%ld", // Extra check
|
||||
QstCod,
|
||||
SetCod,
|
||||
QstCod);
|
||||
|
||||
/***** Go over result removing media *****/
|
||||
Med_RemoveMediaFromAllRows (NumMedia,mysql_res);
|
||||
|
|
|
@ -272,7 +272,8 @@ void Med_GetMediaDataByCod (struct Med_Media *Media)
|
|||
"Name," // row[1]
|
||||
"URL," // row[2]
|
||||
"Title" // row[3]
|
||||
" FROM media WHERE MedCod=%ld",
|
||||
" FROM med_media"
|
||||
" WHERE MedCod=%ld",
|
||||
Media->MedCod);
|
||||
|
||||
/***** Result should have a unique row *****/
|
||||
|
@ -1379,7 +1380,7 @@ void Med_StoreMediaInDB (struct Med_Media *Media)
|
|||
{
|
||||
/***** Insert media into database *****/
|
||||
Media->MedCod = DB_QueryINSERTandReturnCode ("can not create media",
|
||||
"INSERT INTO media"
|
||||
"INSERT INTO med_media"
|
||||
" (Type,Name,URL,Title)"
|
||||
" VALUES"
|
||||
" ('%s','%s','%s','%s')",
|
||||
|
@ -2033,7 +2034,8 @@ void Med_RemoveMedia (long MedCod)
|
|||
|
||||
/***** Step 2. Remove entry for this media from database *****/
|
||||
DB_QueryDELETE ("can not remove media",
|
||||
"DELETE FROM media WHERE MedCod=%ld",
|
||||
"DELETE FROM med_media"
|
||||
" WHERE MedCod=%ld",
|
||||
MedCod);
|
||||
|
||||
/***** Free media *****/
|
||||
|
|
|
@ -696,7 +696,7 @@ static long Tml_DB_GetMedCod (const char *Table,const char *Field,long Cod)
|
|||
/***** Get code of media associated to comment *****/
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get media code",
|
||||
"SELECT MedCod" // row[0]
|
||||
" FROM %s"
|
||||
" FROM %s"
|
||||
" WHERE %s=%ld",
|
||||
Table,Field,Cod) == 1) // Result should have a unique row
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user