diff --git a/css/swad18.89.3.css b/css/swad18.89.5.css
similarity index 99%
rename from css/swad18.89.3.css
rename to css/swad18.89.5.css
index 9053fa63..6f11816c 100644
--- a/css/swad18.89.3.css
+++ b/css/swad18.89.5.css
@@ -2503,7 +2503,7 @@ a:hover img.CENTRE_PHOTO_SHOW
{
box-sizing:border-box;
margin:0 auto;
- width:480px;
+ width:400px;
}
.TEST_MED_EDIT_ONE_CONTAINER
@@ -2718,7 +2718,7 @@ a:hover img.CENTRE_PHOTO_SHOW
}
/*********************** Media (image/video) uploading ***********************/
-.MED_ICO
+.MED_UPLOADER
{
text-align:center;
margin-bottom:10px;
@@ -2903,6 +2903,7 @@ a:hover img.CENTRE_PHOTO_SHOW
.TL_POST_MED_WIDTH {width:220px;} /* 460-240 */
.TL_COMMENT_WIDTH {width:220px;} /* 460-240 */
.TL_COMMENT_AUTHOR_WIDTH {width: 60px;} /* 300-240 */
+ .TL_MED_INPUT_WIDTH {width:160px;} /* 400-240 */
}
@media only screen and (min-width: 590px)
{ /* For tablets and desktop (maximum width visible on Moto G4 horizontal) */
@@ -2910,8 +2911,10 @@ a:hover img.CENTRE_PHOTO_SHOW
.TL_RIGHT_WIDTH {width:500px;}
.TL_RIGHT_AUTHOR_WIDTH {width:340px;}
.TL_POST_MED_WIDTH {width:460px;}
+ .TL_POST_MED_INPUT_WIDTH {width:440px;}
.TL_COMMENT_WIDTH {width:460px;}
.TL_COMMENT_AUTHOR_WIDTH {width:300px;}
+ .TL_MED_INPUT_WIDTH {width:400px;}
}
.TL_NEW_PUB
@@ -3176,7 +3179,7 @@ a:hover img.CENTRE_PHOTO_SHOW
{
box-sizing:border-box;
margin:0 auto;
- width:480px;
+ width:400px;
}
/*********************************** Messages ********************************/
@@ -3203,7 +3206,7 @@ a:hover img.CENTRE_PHOTO_SHOW
{
box-sizing:border-box;
margin:0 auto;
- width:480px;
+ width:400px;
}
.MSG_TXT
{
diff --git a/js/swad18.89.3.js b/js/swad18.89.5.js
similarity index 99%
rename from js/swad18.89.3.js
rename to js/swad18.89.5.js
index 3dfda83d..0d7cf9ec 100644
--- a/js/swad18.89.3.js
+++ b/js/swad18.89.5.js
@@ -772,11 +772,8 @@ function AJAXCreateObject () {
/*****************************************************************************/
function mediaActivateMediaUploader (id) {
- var icon = document.getElementById (id + '_med_ico');
- var uploader = document.getElementById (id + '_med_upl');
-
- icon.style.display = 'none'; // Hide icon
- uploader.style.display = ''; // Show uploader
+ document.getElementById (id + '_med_ico').style.display = 'none';
+ document.getElementById (id + '_med_upl').style.display = '';
}
function mediaClickOnActivateUpload (id) {
diff --git a/swad_box.c b/swad_box.c
index 1c2db4d6..e4188052 100644
--- a/swad_box.c
+++ b/swad_box.c
@@ -177,7 +177,7 @@ static void Box_StartBoxInternal (const char *Width,const char *Title,
"%s"
"",
Gbl.Layout.NestedBox ? "FRAME_TITLE_SMALL" :
- "FRAME_TITLE_BIG",
+ "FRAME_TITLE_BIG",
Title);
Gbl.Layout.NestedBox++;
diff --git a/swad_changelog.h b/swad_changelog.h
index 1912f4dd..2dad74ef 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -464,10 +464,12 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 18.89.4 (2019-03-27)"
-#define CSS_FILE "swad18.89.3.css"
-#define JS_FILE "swad18.89.3.js"
+#define Log_PLATFORM_VERSION "SWAD 18.89.5 (2019-03-28)"
+#define CSS_FILE "swad18.89.5.css"
+#define JS_FILE "swad18.89.5.js"
/*
+ Version 18.89.5: Mar 28, 2019 Code refactoring in media uploader.
+ Changes in design of media uploader. (241160 lines)
Version 18.89.4: Mar 27, 2019 Code refactoring in media uploader. (241144 lines)
Version 18.89.3: Mar 27, 2019 Changes in media attachment form. (241139 lines)
Version 18.89.2: Mar 27, 2019 Help link when writing a test question.
diff --git a/swad_media.c b/swad_media.c
index 22cce247..bae4cab8 100644
--- a/swad_media.c
+++ b/swad_media.c
@@ -118,6 +118,10 @@ static void Med_PutIconMediaUploader (const char UniqueId[Frm_MAX_BYTES_ID + 1],
const char *FunctionName,
const char *Icon,
const char *Title);
+static void Med_PutHiddenFormTypeMediaUploader (const char UniqueId[Frm_MAX_BYTES_ID + 1],
+ const char *IdSuffix,
+ struct ParamUploadMedia *ParamUploadMedia,
+ Med_FormType_t FormType);
static Med_Action_t Med_GetMediaActionFromForm (const char *ParamAction);
static Med_FormType_t Usr_GetFormTypeFromForm (struct ParamUploadMedia *ParamUploadMedia);
@@ -345,17 +349,21 @@ void Med_PutMediaUploader (int NumMediaInForm,const char *ClassInput)
/***** Create unique id for this media uploader *****/
Frm_SetUniqueId (Id);
- fprintf (Gbl.F.Out,"
_med_ico
- " class=\"MED_ICO\">"
+ /***** Start media uploader container *****/
+ fprintf (Gbl.F.Out,"
"); // container
+
+ /***** Icon 'clip' *****/
+ fprintf (Gbl.F.Out,"
", //
_med_ico
- Id,
+ Id,Id,
Cfg_URL_ICON_PUBLIC,
- Txt_Multimedia,Txt_Multimedia,
- Id);
+ Txt_Multimedia,Txt_Multimedia);
/***** Start media uploader *****/
fprintf (Gbl.F.Out,"_med_upl
@@ -398,74 +406,65 @@ void Med_PutMediaUploader (int NumMediaInForm,const char *ClassInput)
/***** Hidden field with form type *****/
/* Upload file */
- fprintf (Gbl.F.Out,"
_par_upl
- " name=\"%s\" value=\"%u\""
- " disabled=\"disabled\" />",
- Id,ParamUploadMedia.FormType,
- (unsigned) Med_FORM_FILE);
+ Med_PutHiddenFormTypeMediaUploader (Id,"par_upl", //
_par_upl
+ &ParamUploadMedia,Med_FORM_FILE);
/* YouTube embedded video */
- fprintf (Gbl.F.Out,"_par_you
- " name=\"%s\" value=\"%u\""
- " disabled=\"disabled\" />",
- Id,ParamUploadMedia.FormType,
- (unsigned) Med_FORM_YOUTUBE);
+ Med_PutHiddenFormTypeMediaUploader (Id,"par_you", // _par_you
+ &ParamUploadMedia,Med_FORM_YOUTUBE);
/* Other embedded media */
- fprintf (Gbl.F.Out,"_par_emb
- " name=\"%s\" value=\"%u\""
- " disabled=\"disabled\" />",
- Id,ParamUploadMedia.FormType,
- (unsigned) Med_FORM_EMBED);
+ Med_PutHiddenFormTypeMediaUploader (Id,"par_emb", // _par_emb
+ &ParamUploadMedia,Med_FORM_EMBED);
- /***** Start input fields *****/
- fprintf (Gbl.F.Out,"", // input fields
- ClassInput);
/***** Media file *****/
- fprintf (Gbl.F.Out,"
_fil
+ fprintf (Gbl.F.Out,"
"
+ "_fil
" name=\"%s\" accept=\"image/,video/\""
" class=\"%s\" disabled=\"disabled\""
- " style=\"display:none;\" />", // _fil
+ " style=\"display:none;\" />"
+ "
", //
_fil
Id,
ParamUploadMedia.File,
ClassInput);
/***** Media URL *****/
- fprintf (Gbl.F.Out,"_url
+ fprintf (Gbl.F.Out,""
+ "_url
" name=\"%s\" placeholder=\"%s\""
" class=\"%s\" maxlength=\"%u\" value=\"\""
" disabled=\"disabled\""
- " style=\"display:none;\" />", // _url
+ " style=\"display:none;\" />"
+ "
", // _url
Id,
ParamUploadMedia.URL,Txt_Link,
ClassInput,Cns_MAX_CHARS_WWW);
/***** Media title *****/
- fprintf (Gbl.F.Out,"_tit
+ fprintf (Gbl.F.Out,""
+ "_tit
" name=\"%s\" placeholder=\"%s\""
" class=\"%s\" maxlength=\"%u\" value=\"\""
" disabled=\"disabled\""
- " style=\"display:none;\" />", // _tit
+ " style=\"display:none;\" />"
+ "
", // _tit
Id,
ParamUploadMedia.Title,Txt_Title_attribution,
ClassInput,Med_MAX_CHARS_TITLE);
- /***** End input fields *****/
- fprintf (Gbl.F.Out," "); // input fields
-
/***** End box *****/
Box_EndBox ();
/***** End media uploader *****/
fprintf (Gbl.F.Out," "); // container _med_upl
+
+ /***** End media uploader container *****/
+ fprintf (Gbl.F.Out,""); // container
}
/*****************************************************************************/
-/********* Put an icon to toggle on/off the form to comment a note ***********/
+/*********************** Put an icon in media uploader ***********************/
/*****************************************************************************/
static void Med_PutIconMediaUploader (const char UniqueId[Frm_MAX_BYTES_ID + 1],
@@ -486,6 +485,23 @@ static void Med_PutIconMediaUploader (const char UniqueId[Frm_MAX_BYTES_ID + 1],
Cfg_URL_ICON_PUBLIC,Icon,Title,Title);
}
+/*****************************************************************************/
+/******** Put a hidden input field with form type in media uploader **********/
+/*****************************************************************************/
+
+static void Med_PutHiddenFormTypeMediaUploader (const char UniqueId[Frm_MAX_BYTES_ID + 1],
+ const char *IdSuffix,
+ struct ParamUploadMedia *ParamUploadMedia,
+ Med_FormType_t FormType)
+ {
+ /***** Hidden field with form type *****/
+ /* Upload file */
+ fprintf (Gbl.F.Out,"
_IdSuffix
+ " name=\"%s\" value=\"%u\" disabled=\"disabled\" />",
+ UniqueId,IdSuffix,
+ ParamUploadMedia->FormType,(unsigned) FormType);
+ }
+
/*****************************************************************************/
/******************** Get media (image/video) from form **********************/
/*****************************************************************************/
diff --git a/swad_timeline.c b/swad_timeline.c
index 8c081825..e1212ad8 100644
--- a/swad_timeline.c
+++ b/swad_timeline.c
@@ -2404,7 +2404,7 @@ static void TL_PutTextarea (const char *Placeholder,
Lay_HelpPlainEditor ();
/***** Attached image (optional) *****/
- Med_PutMediaUploader (-1,ClassMediaInput);
+ Med_PutMediaUploader (-1,"TL_MED_INPUT_WIDTH");
/***** Submit button *****/
fprintf (Gbl.F.Out,"