Version18.77.5

This commit is contained in:
Antonio Cañas Vargas 2019-03-17 01:38:10 +01:00
parent 372543a63d
commit 774ff78ca6
6 changed files with 161 additions and 144 deletions

View File

@ -2409,12 +2409,30 @@ a:hover img.CENTRE_PHOTO_SHOW
/********************************** Tests ************************************/
.TAG_SEL {box-sizing:border-box; width:346px;}
.TAG_TXT {box-sizing:border-box; width:346px;}
.STEM {box-sizing:border-box; width:700px;}
.STEM
{
box-sizing:border-box;
margin:0 auto;
width:700px;
}
.STEM_TEXTAREA
{
width:696px;
}
.ANSWER
{
box-sizing:border-box;
margin:0 auto;
width:600px;
}
.ANSWER_TEXTAREA
{
width:596px;
}
.ANS_TXT {color:#202020; font-size:12pt;}
.ANS_0 {color:#202020; font-size:12pt; font-weight:bold;}
.ANS_OK {color:#008000; font-size:12pt; font-weight:bold;}
.ANS_BAD {color:red; font-size:12pt; font-weight:bold;}
.ANS_STR {box-sizing:border-box; width:600px;}
.TEST_SUBTITLE
{
margin:10px;
@ -2483,7 +2501,7 @@ a:hover img.CENTRE_PHOTO_SHOW
border-radius:2px;
}
.TEST_FORM_EDIT_IMG
.TEST_FORM_EDIT_MED
{
box-sizing:border-box;
margin:15px 0;
@ -2517,21 +2535,21 @@ a:hover img.CENTRE_PHOTO_SHOW
.TEST_EDI_ANS_LEFT_COL
{
box-sizing:border-box;
width:50px;
width:48px;
text-align:left;
vertical-align:top;
}
.TEST_EDI_ANS_CENTER_COL
{
box-sizing:border-box;
width:50px;
width:48px;
text-align:right;
vertical-align:top;
}
.TEST_EDI_ANS_RIGHT_COL
{
box-sizing:border-box;
width:604px;
width:600px;
text-align:left;
vertical-align:top;
}
@ -2675,7 +2693,7 @@ a:hover img.CENTRE_PHOTO_SHOW
{
display:table-cell;
box-sizing:border-box;
padding:6px;
padding:6px;
text-align:center;
vertical-align:middle;
border:solid 1px;
@ -2717,8 +2735,7 @@ a:hover img.CENTRE_PHOTO_SHOW
.MED_UPL_CON /* Upload container */
{
text-align:center;
vertical-align:top;
margin-bottom:10px;
margin-bottom:6px;
}
.MED_PLAY
@ -2964,6 +2981,7 @@ a:hover img.CENTRE_PHOTO_SHOW
.TL_POST_MED_INPUT
{
box-sizing:border-box;
margin:0 auto;
}
.TL_POST_IMG_CONTAINER
{
@ -3132,6 +3150,7 @@ a:hover img.CENTRE_PHOTO_SHOW
.FOR_MED_INPUT
{
box-sizing:border-box;
margin:0 auto;
width:480px;
}
@ -3158,6 +3177,7 @@ a:hover img.CENTRE_PHOTO_SHOW
.MSG_MED_INPUT
{
box-sizing:border-box;
margin:0 auto;
width:480px;
}
.MSG_TXT

View File

@ -413,6 +413,11 @@ Lo de mutear anuncios, en principio prefiero hacer una opci
// TODO: Chequear todos los iconos .gif y .png que restan, concretamente los de file_browser
// TODO: Víctor González Argudo: Como sugerencia, estaría bien que cuando te dieran like
// mas de 5 personas se pudiera saber quienes son
// por ejemplo dejando encima el cursor de los 3 puntos
// y que saliera una lista con los nombres
// TODO: Pedro Villar Castro:
// Al asignar un TFG a alumnos, no escribir el DNI del alumno, sino escogerlo de una lista de entre los alumnos inscritos en la asignatura.
@ -452,7 +457,7 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.77.1 (2019-03-15)"
#define Log_PLATFORM_VERSION "SWAD 18.77.5 (2019-03-17)"
#define CSS_FILE "swad18.77.css"
#define JS_FILE "swad18.77.js"
/*
@ -468,8 +473,7 @@ Si el usuario acepta, a partir de ese momento se le mostrar
Ese bloqueo o aceptación sería una opción en Perfil > Ajustes
que el usuario podría cambiar en cualquier momento.
TODO: Fix edition of media in test edition
Version 18.77.5: Mar 16, 2019 Fixed bugs in forms to upload media. (240272 lines)
Version 18.77.4: Mar 16, 2019 Changes in form to upload media. (240256 lines)
Version 18.77.3: Mar 16, 2019 Embedded YouTube videos. Not finished. (240252 lines)
Version 18.77.2: Mar 14, 2019 Embedded YouTube videos. Not finished. (240267 lines)

View File

@ -104,7 +104,7 @@ extern struct Globals Gbl;
/*****************************************************************************/
static Med_Action_t Med_GetMediaActionFromForm (const char *ParamAction);
static Med_FormType_t Usr_GetFormTypeFromForm (void);
static Med_FormType_t Usr_GetFormTypeFromForm (struct ParamUploadMedia *ParamUploadMedia);
static void Usr_GetURLFromForm (const char *ParamName,struct Media *Media);
static void Usr_GetTitleFromForm (const char *ParamName,struct Media *Media);
static void Med_GetAndProcessFileFromForm (const char *ParamFile,
@ -307,7 +307,7 @@ void Med_PutMediaUploader (int NumMediaInForm,const char *ClassInput)
" class=\"PREF_OFF\">"
"<img src=\"%s/file-image.svg\""
" alt=\"%s\" title=\"%s\""
" class=\"ICO_HIGHLIGHT ICOx20\""
" class=\"ICO_HIGHLIGHT ICOx16\""
" onclick=\"mediaClickOnActivateUpload('%s');\" />"
"</div>", // <id>_ico_upl
Id,
@ -318,9 +318,9 @@ void Med_PutMediaUploader (int NumMediaInForm,const char *ClassInput)
/***** Form type *****/
fprintf (Gbl.F.Out,"<input type=\"hidden\""
" id=\"%s_par_upl\"" // <id>_par_upl
" name=\"FormType\" value=\"%u\""
" name=\"%s\" value=\"%u\""
" disabled=\"disabled\" />",
Id,
Id,ParamUploadMedia.FormType,
(unsigned) Med_FORM_FILE);
/***** Embed icon *****/
@ -328,7 +328,7 @@ void Med_PutMediaUploader (int NumMediaInForm,const char *ClassInput)
" class=\"PREF_OFF\">"
"<img src=\"%s/youtube-brands.svg\""
" alt=\"%s\" title=\"%s\""
" class=\"ICO_HIGHLIGHT ICOx20\""
" class=\"ICO_HIGHLIGHT ICOx16\""
" onclick=\"mediaClickOnActivateEmbed('%s');\" />"
"</div>", // <id>_ico_emb
Id,
@ -347,9 +347,9 @@ void Med_PutMediaUploader (int NumMediaInForm,const char *ClassInput)
/***** Form type *****/
fprintf (Gbl.F.Out,"<input type=\"hidden\""
" id=\"%s_par_emb\"" // <id>_par_emb
" name=\"FormType\" value=\"%u\""
" name=\"%s\" value=\"%u\""
" disabled=\"disabled\" />",
Id,
Id,ParamUploadMedia.FormType,
(unsigned) Med_FORM_EMBED);
/***** Media file *****/
@ -400,28 +400,34 @@ void Med_GetMediaFromForm (int NumMediaInForm,struct Media *Media,
struct ParamUploadMedia ParamUploadMedia;
Med_FormType_t FormType;
/***** Initialize media *****/
Media->Action = Med_ACTION_NO_MEDIA;
Media->Status = Med_STATUS_NONE;
Media->Name[0] = '\0';
Media->Type = Med_TYPE_NONE;
Media->Title = NULL;
Media->URL = NULL;
/***** Set names of parameters depending on number of media in form *****/
Med_SetParamNames (&ParamUploadMedia,NumMediaInForm);
/***** Get action and initialize media (image/video)
(except title, that will be get after the media file) *****/
Media->Action = Med_GetMediaActionFromForm (ParamUploadMedia.Action);
Media->Status = Med_STATUS_NONE;
Media->Name[0] = '\0';
Media->Type = Med_TYPE_NONE;
/***** Get form type *****/
FormType = Usr_GetFormTypeFromForm ();
/***** Get the media (image/video) name and the file *****/
switch (Media->Action)
{
case Med_ACTION_NEW_MEDIA: // Upload new image/video
/***** Get form type *****/
FormType = Usr_GetFormTypeFromForm (&ParamUploadMedia);
/***** Get new media *****/
switch (FormType)
{
case Med_FORM_FILE:
/***** Get image/video (if present ==> process and create temporary file) *****/
/* Get image/video (if present ==>
process and create temporary file) */
Med_GetAndProcessFileFromForm (ParamUploadMedia.File,Media);
switch (Media->Status)
{
@ -444,7 +450,7 @@ void Med_GetMediaFromForm (int NumMediaInForm,struct Media *Media,
}
break;
case Med_FORM_EMBED:
/***** Get and process embed URL from form *****/
/* Get and process embed URL from form */
Med_GetAndProcessEmbedFromForm (ParamUploadMedia.URL,Media);
break;
default:
@ -457,10 +463,15 @@ void Med_GetMediaFromForm (int NumMediaInForm,struct Media *Media,
GetMediaFromDB (NumMediaInForm,Media);
break;
case Med_ACTION_CHANGE_MEDIA: // Replace old image/video by new one
/***** Get form type *****/
FormType = Usr_GetFormTypeFromForm (&ParamUploadMedia);
/***** Get new media *****/
switch (FormType)
{
case Med_FORM_FILE:
/***** Get image/video (if present ==> process and create temporary file) *****/
/* Get image/video (if present ==>
process and create temporary file) */
Med_GetAndProcessFileFromForm (ParamUploadMedia.File,Media);
switch (Media->Status)
{
@ -473,7 +484,7 @@ void Med_GetMediaFromForm (int NumMediaInForm,struct Media *Media,
}
break;
case Med_FORM_EMBED:
/***** Get and process embed URL from form *****/
/* Get and process embed URL from form */
Med_GetAndProcessEmbedFromForm (ParamUploadMedia.URL,Media);
break;
default:
@ -484,7 +495,7 @@ void Med_GetMediaFromForm (int NumMediaInForm,struct Media *Media,
/* Get media (image/video) name */
GetMediaFromDB (NumMediaInForm,Media);
break;
case Med_ACTION_NO_MEDIA: // Do not use image/video (remove current image/video if exists)
default:
break;
}
}
@ -499,27 +510,32 @@ void Med_SetParamNames (struct ParamUploadMedia *ParamUploadMedia,int NumMediaIn
{
if (NumMediaInForm < 0) // One unique media in form ==> no suffix needed
{
Str_Copy (ParamUploadMedia->Action,"MedAct",
Str_Copy (ParamUploadMedia->Action ,"MedAct",
Med_MAX_BYTES_PARAM_UPLOAD_MEDIA);
Str_Copy (ParamUploadMedia->File ,"MedFil",
Str_Copy (ParamUploadMedia->FormType,"MedFrm",
Med_MAX_BYTES_PARAM_UPLOAD_MEDIA);
Str_Copy (ParamUploadMedia->Title ,"MedTit",
Str_Copy (ParamUploadMedia->File ,"MedFil",
Med_MAX_BYTES_PARAM_UPLOAD_MEDIA);
Str_Copy (ParamUploadMedia->URL ,"MedURL",
Str_Copy (ParamUploadMedia->Title ,"MedTit",
Med_MAX_BYTES_PARAM_UPLOAD_MEDIA);
Str_Copy (ParamUploadMedia->URL ,"MedURL",
Med_MAX_BYTES_PARAM_UPLOAD_MEDIA);
}
else // Several video/images in form ==> add suffix
{
snprintf (ParamUploadMedia->Action,sizeof (ParamUploadMedia->Action),
snprintf (ParamUploadMedia->Action ,sizeof (ParamUploadMedia->Action),
"MedAct%u",
NumMediaInForm);
snprintf (ParamUploadMedia->File ,sizeof (ParamUploadMedia->File),
snprintf (ParamUploadMedia->FormType,sizeof (ParamUploadMedia->Action),
"MedFrm%u",
NumMediaInForm);
snprintf (ParamUploadMedia->File ,sizeof (ParamUploadMedia->File),
"MedFil%u",
NumMediaInForm);
snprintf (ParamUploadMedia->Title ,sizeof (ParamUploadMedia->Title),
snprintf (ParamUploadMedia->Title ,sizeof (ParamUploadMedia->Title),
"MedTit%u",
NumMediaInForm);
snprintf (ParamUploadMedia->URL ,sizeof (ParamUploadMedia->URL),
snprintf (ParamUploadMedia->URL ,sizeof (ParamUploadMedia->URL),
"MedURL%u",
NumMediaInForm);
}
@ -543,9 +559,9 @@ static Med_Action_t Med_GetMediaActionFromForm (const char *ParamAction)
/********************* Get from form the type of form ************************/
/*****************************************************************************/
static Med_FormType_t Usr_GetFormTypeFromForm (void)
static Med_FormType_t Usr_GetFormTypeFromForm (struct ParamUploadMedia *ParamUploadMedia)
{
return (Med_FormType_t) Par_GetParToUnsignedLong ("FormType",
return (Med_FormType_t) Par_GetParToUnsignedLong (ParamUploadMedia->FormType,
0,
Med_NUM_FORM_TYPES - 1,
(unsigned long) Med_FORM_UNKNOWN);
@ -1118,7 +1134,7 @@ void Med_MoveMediaToDefinitiveDir (struct Media *Media)
/***** Check trivial cases *****/
if (Media->Type == Med_TYPE_NONE)
Lay_ShowErrorAndExit ("Wrong media type.");
Lay_ShowErrorAndExit ("Med_MoveMediaToDefinitiveDir: Wrong media type.");
if (Media->Type == Med_YOUTUBE)
return; // Nothing to do with files
@ -1546,8 +1562,10 @@ void Med_RemoveMediaFiles (const char *Name,Med_Type_t Type)
char FullPathMediaPriv[PATH_MAX + 1];
/***** Trivial cases *****/
if (Type == Med_TYPE_NONE)
Lay_ShowErrorAndExit ("Wrong media type.");
if (Name == NULL)
return;
if (!Name[0])
return;
if (Type == Med_YOUTUBE)
return;
@ -1558,48 +1576,46 @@ void Med_RemoveMediaFiles (const char *Name,Med_Type_t Type)
Name[0],
Name[1]);
if (Name[0])
/***** Remove files *****/
switch (Type)
{
switch (Type)
{
case Med_JPG:
/***** Remove private JPG file *****/
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
"%s/%s.%s",
PathMedPriv,Name,Med_Extensions[Med_JPG]);
unlink (FullPathMediaPriv);
case Med_JPG:
/***** Remove private JPG file *****/
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
"%s/%s.%s",
PathMedPriv,Name,Med_Extensions[Med_JPG]);
unlink (FullPathMediaPriv);
break;
case Med_GIF:
/***** Remove private GIF file *****/
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
"%s/%s.%s",
PathMedPriv,Name,Med_Extensions[Med_GIF]);
unlink (FullPathMediaPriv);
break;
case Med_GIF:
/***** Remove private GIF file *****/
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
"%s/%s.%s",
PathMedPriv,Name,Med_Extensions[Med_GIF]);
unlink (FullPathMediaPriv);
/***** Remove private PNG file *****/
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
"%s/%s.png",
PathMedPriv,Name);
unlink (FullPathMediaPriv);
/***** Remove private PNG file *****/
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
"%s/%s.png",
PathMedPriv,Name);
unlink (FullPathMediaPriv);
break;
case Med_MP4:
case Med_WEBM:
case Med_OGG:
/***** Remove private video file *****/
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
"%s/%s.%s",
PathMedPriv,Name,Med_Extensions[Type]);
unlink (FullPathMediaPriv);
break;
case Med_MP4:
case Med_WEBM:
case Med_OGG:
/***** Remove private video file *****/
snprintf (FullPathMediaPriv,sizeof (FullPathMediaPriv),
"%s/%s.%s",
PathMedPriv,Name,Med_Extensions[Type]);
unlink (FullPathMediaPriv);
break;
default:
break;
}
// Public links are removed automatically after a period
break;
default:
break;
}
// Public links are removed automatically after a period
}
/*****************************************************************************/

View File

@ -122,6 +122,7 @@ struct Media
struct ParamUploadMedia
{
char Action [Med_MAX_BYTES_PARAM_UPLOAD_MEDIA + 1];
char FormType[Med_MAX_BYTES_PARAM_UPLOAD_MEDIA + 1];
char File [Med_MAX_BYTES_PARAM_UPLOAD_MEDIA + 1];
char Title [Med_MAX_BYTES_PARAM_UPLOAD_MEDIA + 1];
char URL [Med_MAX_BYTES_PARAM_UPLOAD_MEDIA + 1];

View File

@ -276,11 +276,11 @@ static void Tst_RemAnsFromQst (void);
static void Tst_RemTagsFromQst (void);
static void Tst_RemoveUnusedTagsFromCurrentCrs (void);
static void Tst_RemoveImgFileFromStemOfQst (long CrsCod,long QstCod);
static void Tst_RemoveAllImgFilesFromStemOfAllQstsInCrs (long CrsCod);
static void Tst_RemoveImgFileFromAnsOfQst (long CrsCod,long QstCod,unsigned AnsInd);
static void Tst_RemoveAllImgFilesFromAnsOfQst (long CrsCod,long QstCod);
static void Tst_RemoveAllImgFilesFromAnsOfAllQstsInCrs (long CrsCod);
static void Tst_RemoveMedFileFromStemOfQst (long CrsCod,long QstCod);
static void Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod);
static void Tst_RemoveMedFileFromAnsOfQst (long CrsCod,long QstCod,unsigned AnsInd);
static void Tst_RemoveAllMedFilesFromAnsOfQst (long CrsCod,long QstCod);
static void Tst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod);
static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsType,struct Tst_Stats *Stats);
static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsType);
@ -1115,12 +1115,9 @@ static void Tst_PutFormToEditQstMedia (struct Media *Media,int NumMediaInForm,
bool OptionsDisabled)
{
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_No_image;
extern const char *Txt_Current_image;
extern const char *Txt_Change_image;
extern const char *Txt_Title_attribution;
extern const char *Txt_Link;
extern const char *Txt_optional;
extern const char *Txt_No_image_video;
extern const char *Txt_Current_image_video;
extern const char *Txt_Change_image_video;
static unsigned UniqueId = 0;
struct ParamUploadMedia ParamUploadMedia;
@ -1130,9 +1127,9 @@ static void Tst_PutFormToEditQstMedia (struct Media *Media,int NumMediaInForm,
Med_SetParamNames (&ParamUploadMedia,NumMediaInForm);
/***** Start container *****/
fprintf (Gbl.F.Out,"<div class=\"TEST_FORM_EDIT_IMG\">");
fprintf (Gbl.F.Out,"<div class=\"TEST_FORM_EDIT_MED\">");
/***** Choice 1: No image *****/
/***** Choice 1: No media *****/
fprintf (Gbl.F.Out,"<label class=\"%s\">"
"<input type=\"radio\" name=\"%s\" value=\"%u\"",
The_ClassFormInBox[Gbl.Prefs.Theme],
@ -1142,9 +1139,9 @@ static void Tst_PutFormToEditQstMedia (struct Media *Media,int NumMediaInForm,
fprintf (Gbl.F.Out," />"
"%s"
"</label><br />",
Txt_No_image);
Txt_No_image_video);
/***** Choice 2: Current image *****/
/***** Choice 2: Current media *****/
fprintf (Gbl.F.Out,"<label class=\"%s\">"
"<input type=\"radio\" name=\"%s\" value=\"%u\""
" checked=\"checked\"",
@ -1155,10 +1152,10 @@ static void Tst_PutFormToEditQstMedia (struct Media *Media,int NumMediaInForm,
fprintf (Gbl.F.Out," />"
"%s"
"</label>",
Txt_Current_image);
Txt_Current_image_video);
Med_ShowMedia (Media,ClassContainer,ClassMedia);
/***** Choice 3: Change/new image *****/
/***** Choice 3: Change media *****/
UniqueId++;
fprintf (Gbl.F.Out,"<label class=\"%s\">"
"<input type=\"radio\" id=\"chg_img_%u\" name=\"%s\""
@ -1170,40 +1167,15 @@ static void Tst_PutFormToEditQstMedia (struct Media *Media,int NumMediaInForm,
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," />"
"%s: "
"</label>"
"<input type=\"file\" name=\"%s\" accept=\"image/*\"",
Txt_Change_image,
ParamUploadMedia.File);
if (OptionsDisabled)
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," onchange=\"document.getElementById('chg_img_%u').checked = true;\" />",
UniqueId);
/***** Media title/attribution *****/
fprintf (Gbl.F.Out,"<br />"
"<input type=\"text\" name=\"%s\""
" placeholder=\"%s (%s)\""
" class=\"%s\" maxlength=\"%u\" value=\"%s\">",
ParamUploadMedia.Title,Txt_Title_attribution,Txt_optional,
ClassMediaInput,Med_MAX_CHARS_TITLE,
Media->Title ? Media->Title :
"");
/***** Media URL *****/
fprintf (Gbl.F.Out,"<br />"
"<input type=\"text\" name=\"%s\""
" placeholder=\"%s (%s)\""
" class=\"%s\" maxlength=\"%u\" value=\"%s\">",
ParamUploadMedia.URL,Txt_Link,Txt_optional,
ClassMediaInput,Cns_MAX_CHARS_WWW,
Media->URL ? Media->URL :
"");
"</label>",
Txt_Change_image_video);
Med_PutMediaUploader (NumMediaInForm,ClassMediaInput);
/***** End container *****/
fprintf (Gbl.F.Out,"</div>");
}
else // No current image
/***** Attached image (optional) *****/
/***** Attached media *****/
Med_PutMediaUploader (NumMediaInForm,ClassMediaInput);
}
@ -5081,7 +5053,7 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
"</td>"
"<td class=\"LEFT_TOP\">"
"<textarea id=\"Stem\" name=\"Stem\""
" class=\"STEM\" rows=\"5\" required=\"required\">"
" class=\"STEM_TEXTAREA\" rows=\"5\" required=\"required\">"
"%s"
"</textarea><br />",
The_ClassFormInBox[Gbl.Prefs.Theme],
@ -5096,7 +5068,8 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
/***** Feedback *****/
fprintf (Gbl.F.Out,"<label class=\"%s\">"
"%s (%s):<br />"
"<textarea name=\"Feedback\" class=\"STEM\" rows=\"2\">",
"<textarea name=\"Feedback\""
" class=\"STEM_TEXTAREA\" rows=\"2\">",
The_ClassFormInBox[Gbl.Prefs.Theme],
Txt_Feedback,Txt_optional);
if (Feedback)
@ -5289,7 +5262,8 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
/* Answer text */
fprintf (Gbl.F.Out,"<textarea name=\"AnsStr%u\""
" class=\"ANS_STR\" rows=\"5\"",NumOpt);
" class=\"ANSWER_TEXTAREA\" rows=\"5\"",
NumOpt);
if (OptionsDisabled)
fprintf (Gbl.F.Out," disabled=\"disabled\"");
if (NumOpt == 0) // First textarea required
@ -5304,12 +5278,13 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
(int) NumOpt,
"TEST_IMG_EDIT_ONE_ANS_CONTAINER",
"TEST_IMG_EDIT_ONE_ANS",
"ANS_STR", // Title / attribution
"ANSWER", // Form inputs
OptionsDisabled);
/* Feedback */
fprintf (Gbl.F.Out,"<label class=\"%s\">%s (%s):<br />"
"<textarea name=\"FbStr%u\" class=\"ANS_STR\" rows=\"2\"",
"<textarea name=\"FbStr%u\""
" class=\"ANSWER_TEXTAREA\" rows=\"2\"",
The_ClassFormInBox[Gbl.Prefs.Theme],Txt_Feedback,Txt_optional,
NumOpt);
if (OptionsDisabled)
@ -5920,6 +5895,7 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
Tst_MAX_BYTES_ANSWER_OR_FEEDBACK);
/* Get image associated to the answer (action, file and title) */
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE ||
Gbl.Test.AnswerType == Tst_ANS_MULTIPLE_CHOICE)
{
@ -6183,7 +6159,7 @@ static void Tst_MoveMediaToDefinitiveDirectories (void)
/* Remove possible file with the old image
(the new image file is already processed
and moved to the definitive directory) */
Tst_RemoveImgFileFromStemOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
Tst_RemoveMedFileFromStemOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
if ((Gbl.Test.Media.Action == Med_ACTION_NEW_MEDIA || // Upload new image
Gbl.Test.Media.Action == Med_ACTION_CHANGE_MEDIA) && // Replace existing image by new image
@ -6203,7 +6179,7 @@ static void Tst_MoveMediaToDefinitiveDirectories (void)
/* Remove possible file with the old image
(the new image file is already processed
and moved to the definitive directory) */
Tst_RemoveImgFileFromAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod,NumOpt);
Tst_RemoveMedFileFromAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod,NumOpt);
if ((Gbl.Test.Answer.Options[NumOpt].Media.Action == Med_ACTION_NEW_MEDIA || // Upload new image
Gbl.Test.Answer.Options[NumOpt].Media.Action == Med_ACTION_CHANGE_MEDIA) && // Replace existing image by new image
@ -6421,8 +6397,8 @@ void Tst_RemoveQst (void)
EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
/***** Remove images associated to question *****/
Tst_RemoveAllImgFilesFromAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
Tst_RemoveImgFileFromStemOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
Tst_RemoveAllMedFilesFromAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
Tst_RemoveMedFileFromStemOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
/***** Remove the question from all the tables *****/
/* Remove answers and tags from this test question */
@ -6774,7 +6750,7 @@ static void Tst_RemoveUnusedTagsFromCurrentCrs (void)
/******** Remove one file associated to one stem of one test question ********/
/*****************************************************************************/
static void Tst_RemoveImgFileFromStemOfQst (long CrsCod,long QstCod)
static void Tst_RemoveMedFileFromStemOfQst (long CrsCod,long QstCod)
{
MYSQL_RES *mysql_res;
@ -6797,7 +6773,7 @@ static void Tst_RemoveImgFileFromStemOfQst (long CrsCod,long QstCod)
/****** in a course *****/
/*****************************************************************************/
static void Tst_RemoveAllImgFilesFromStemOfAllQstsInCrs (long CrsCod)
static void Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod)
{
MYSQL_RES *mysql_res;
unsigned NumMedia;
@ -6822,7 +6798,7 @@ static void Tst_RemoveAllImgFilesFromStemOfAllQstsInCrs (long CrsCod)
/**** Remove one image file associated to one answer of one test question ****/
/*****************************************************************************/
static void Tst_RemoveImgFileFromAnsOfQst (long CrsCod,long QstCod,unsigned AnsInd)
static void Tst_RemoveMedFileFromAnsOfQst (long CrsCod,long QstCod,unsigned AnsInd)
{
MYSQL_RES *mysql_res;
@ -6848,7 +6824,7 @@ static void Tst_RemoveImgFileFromAnsOfQst (long CrsCod,long QstCod,unsigned AnsI
/*** Remove all image files associated to all answers of one test question ***/
/*****************************************************************************/
static void Tst_RemoveAllImgFilesFromAnsOfQst (long CrsCod,long QstCod)
static void Tst_RemoveAllMedFilesFromAnsOfQst (long CrsCod,long QstCod)
{
MYSQL_RES *mysql_res;
unsigned NumMedia;
@ -6877,7 +6853,7 @@ static void Tst_RemoveAllImgFilesFromAnsOfQst (long CrsCod,long QstCod)
/** in a course ***/
/*****************************************************************************/
static void Tst_RemoveAllImgFilesFromAnsOfAllQstsInCrs (long CrsCod)
static void Tst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod)
{
MYSQL_RES *mysql_res;
unsigned NumMedia;
@ -8632,8 +8608,8 @@ void Tst_RemoveCrsTests (long CrsCod)
/***** Remove files with images associated
to test questions in the course *****/
Tst_RemoveAllImgFilesFromAnsOfAllQstsInCrs (CrsCod);
Tst_RemoveAllImgFilesFromStemOfAllQstsInCrs (CrsCod);
Tst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (CrsCod);
Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (CrsCod);
/***** Remove test questions in the course *****/
DB_QueryDELETE ("can not remove test questions of a course",

View File

@ -3567,7 +3567,7 @@ const char *Txt_Change_IDs =
"Alterar n&ordm;s. identif.";
#endif
const char *Txt_Change_image =
const char *Txt_Change_image_video =
#if L==1 // ca
"Canviar imatge / v&iacute;deo";
#elif L==2 // de
@ -6614,7 +6614,7 @@ const char *Txt_Current_email =
"Email atual";
#endif
const char *Txt_Current_image =
const char *Txt_Current_image_video =
#if L==1 // ca
"Imatge / v&iacute;deo actual";
#elif L==2 // de
@ -24648,7 +24648,7 @@ const char *Txt_No_holidays =
"N&atilde;o h&aacute; feriados.";
#endif
const char *Txt_No_image = // Without any image
const char *Txt_No_image_video = // Without any image
#if L==1 // ca
"Sense imatge / v&iacute;deo";
#elif L==2 // de