mirror of https://github.com/acanas/swad-core.git
Version18.89.5
This commit is contained in:
parent
edc0333dfb
commit
a24ae9cd90
|
@ -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
|
||||
{
|
|
@ -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) {
|
|
@ -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.
|
||||
|
|
92
swad_media.c
92
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,"<div id=\"%s_med_ico\"" // <id>_med_ico
|
||||
" class=\"MED_ICO\">"
|
||||
/***** Start media uploader container *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"MED_UPLOADER\">"); // container
|
||||
|
||||
/***** Icon 'clip' *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"%s_med_ico\">" // <id>_med_ico
|
||||
"<a href=\"\""
|
||||
" onclick=\"mediaActivateMediaUploader('%s');return false;\">"
|
||||
"<img src=\"%s/paperclip.svg\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICO_HIGHLIGHT ICOx16\""
|
||||
" onclick=\"mediaActivateMediaUploader('%s');\" />"
|
||||
" class=\"ICO_HIGHLIGHT ICOx16\" />"
|
||||
"</a>"
|
||||
"</div>", // <id>_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,"<div id=\"%s_med_upl\"" // container <id>_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,"<input type=\"hidden\""
|
||||
" id=\"%s_par_upl\"" // <id>_par_upl
|
||||
" name=\"%s\" value=\"%u\""
|
||||
" disabled=\"disabled\" />",
|
||||
Id,ParamUploadMedia.FormType,
|
||||
(unsigned) Med_FORM_FILE);
|
||||
Med_PutHiddenFormTypeMediaUploader (Id,"par_upl", // <id>_par_upl
|
||||
&ParamUploadMedia,Med_FORM_FILE);
|
||||
|
||||
/* YouTube embedded video */
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\""
|
||||
" id=\"%s_par_you\"" // <id>_par_you
|
||||
" name=\"%s\" value=\"%u\""
|
||||
" disabled=\"disabled\" />",
|
||||
Id,ParamUploadMedia.FormType,
|
||||
(unsigned) Med_FORM_YOUTUBE);
|
||||
Med_PutHiddenFormTypeMediaUploader (Id,"par_you", // <id>_par_you
|
||||
&ParamUploadMedia,Med_FORM_YOUTUBE);
|
||||
|
||||
/* Other embedded media */
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\""
|
||||
" id=\"%s_par_emb\"" // <id>_par_emb
|
||||
" name=\"%s\" value=\"%u\""
|
||||
" disabled=\"disabled\" />",
|
||||
Id,ParamUploadMedia.FormType,
|
||||
(unsigned) Med_FORM_EMBED);
|
||||
Med_PutHiddenFormTypeMediaUploader (Id,"par_emb", // <id>_par_emb
|
||||
&ParamUploadMedia,Med_FORM_EMBED);
|
||||
|
||||
/***** Start input fields *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"%s\">", // input fields
|
||||
ClassInput);
|
||||
|
||||
/***** Media file *****/
|
||||
fprintf (Gbl.F.Out,"<input id=\"%s_fil\" type=\"file\"" // <id>_fil
|
||||
fprintf (Gbl.F.Out,"<div>"
|
||||
"<input id=\"%s_fil\" type=\"file\"" // <id>_fil
|
||||
" name=\"%s\" accept=\"image/,video/\""
|
||||
" class=\"%s\" disabled=\"disabled\""
|
||||
" style=\"display:none;\" />", // <id>_fil
|
||||
" style=\"display:none;\" />"
|
||||
"</div>", // <id>_fil
|
||||
Id,
|
||||
ParamUploadMedia.File,
|
||||
ClassInput);
|
||||
|
||||
/***** Media URL *****/
|
||||
fprintf (Gbl.F.Out,"<input id=\"%s_url\" type=\"url\"" // <id>_url
|
||||
fprintf (Gbl.F.Out,"<div>"
|
||||
"<input id=\"%s_url\" type=\"url\"" // <id>_url
|
||||
" name=\"%s\" placeholder=\"%s\""
|
||||
" class=\"%s\" maxlength=\"%u\" value=\"\""
|
||||
" disabled=\"disabled\""
|
||||
" style=\"display:none;\" />", // <id>_url
|
||||
" style=\"display:none;\" />"
|
||||
"</div>", // <id>_url
|
||||
Id,
|
||||
ParamUploadMedia.URL,Txt_Link,
|
||||
ClassInput,Cns_MAX_CHARS_WWW);
|
||||
|
||||
/***** Media title *****/
|
||||
fprintf (Gbl.F.Out,"<input id=\"%s_tit\" type=\"text\"" // <id>_tit
|
||||
fprintf (Gbl.F.Out,"<div>"
|
||||
"<input id=\"%s_tit\" type=\"text\"" // <id>_tit
|
||||
" name=\"%s\" placeholder=\"%s\""
|
||||
" class=\"%s\" maxlength=\"%u\" value=\"\""
|
||||
" disabled=\"disabled\""
|
||||
" style=\"display:none;\" />", // <id>_tit
|
||||
" style=\"display:none;\" />"
|
||||
"</div>", // <id>_tit
|
||||
Id,
|
||||
ParamUploadMedia.Title,Txt_Title_attribution,
|
||||
ClassInput,Med_MAX_CHARS_TITLE);
|
||||
|
||||
/***** End input fields *****/
|
||||
fprintf (Gbl.F.Out,"</div>"); // input fields
|
||||
|
||||
/***** End box *****/
|
||||
Box_EndBox ();
|
||||
|
||||
/***** End media uploader *****/
|
||||
fprintf (Gbl.F.Out,"</div>"); // container <id>_med_upl
|
||||
|
||||
/***** End media uploader container *****/
|
||||
fprintf (Gbl.F.Out,"</div>"); // 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,"<input type=\"hidden\" id=\"%s_%s\"" // <id>_IdSuffix
|
||||
" name=\"%s\" value=\"%u\" disabled=\"disabled\" />",
|
||||
UniqueId,IdSuffix,
|
||||
ParamUploadMedia->FormType,(unsigned) FormType);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Get media (image/video) from form **********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -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,"<button type=\"submit\""
|
||||
|
|
Loading…
Reference in New Issue