mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-14 12:44:09 +02:00
Version 15.193
This commit is contained in:
parent
84d16bf97d
commit
3785f540b5
|
@ -1831,6 +1831,33 @@ a:hover img.CENTRE_PHOTO_SHOW
|
|||
.LOG {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:#606060; font-size:11pt;}
|
||||
.LOG_R {font-family:"Arial Narrow","Nimbus Sans L","DejaVu LGC Sans Condensed",sans-serif; color:red; font-size:11pt;}
|
||||
|
||||
/******************************** Image uploading ****************************/
|
||||
.IMG_UPLOAD_CONTAINER
|
||||
{
|
||||
vertical-align:top;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.IMG_UPLOAD_BUTTON
|
||||
{
|
||||
cursor:pointer;
|
||||
}
|
||||
.IMG_UPLOAD_ICON
|
||||
{
|
||||
width:20px;
|
||||
height:20px;
|
||||
margin:0 5px;
|
||||
vertical-align:middle;
|
||||
}
|
||||
.IMG_UPLOAD_FILE
|
||||
{
|
||||
display:none;
|
||||
}
|
||||
.IMG_UPLOAD_FILENAME
|
||||
{
|
||||
color:#808080;
|
||||
font-size:12pt;
|
||||
}
|
||||
|
||||
/******************************** Social activity ****************************/
|
||||
#view_new_posts_container,#view_old_posts_container
|
||||
{
|
||||
|
@ -1947,7 +1974,6 @@ a:hover img.CENTRE_PHOTO_SHOW
|
|||
{
|
||||
box-sizing:border-box;
|
||||
width:440px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.SOCIAL_TXT
|
||||
{
|
||||
|
@ -2069,7 +2095,6 @@ a:hover img.CENTRE_PHOTO_SHOW
|
|||
{
|
||||
box-sizing:border-box;
|
||||
width:440px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
/************************************ Forum **********************************/
|
|
@ -887,6 +887,15 @@ function disableDetailedClicks () {
|
|||
document.getElementById('RowsPage').disabled = true;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Upload images in a form **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
function imageUploadOnSelectFile (inputFile,id) {
|
||||
document.getElementById(id + '_fil').innerHTML = inputFile.value; // Display filename
|
||||
document.getElementById(id + '_tit').style.display = ''; // Show hidden field to enter title/attribution
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Draw an academic calendar **************************/
|
||||
/*****************************************************************************/
|
|
@ -4529,6 +4529,24 @@ void Act_LinkFormSubmitAnimated (const char *Title,const char *LinkStyle)
|
|||
Gbl.Form.Id);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Get unique Id *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_LENGTH_ID])
|
||||
{
|
||||
static unsigned CountForThisExecution = 0;
|
||||
|
||||
/***** Create Id. The id must be unique in timeline,
|
||||
but the timeline is updated via AJAX.
|
||||
So, Id uses:
|
||||
- a name for this execution (Gbl.UniqueNameEncrypted)
|
||||
- a number for each element in this execution (CountForThisExecution) *****/
|
||||
sprintf (UniqueId,"id_%s_%u",
|
||||
Gbl.UniqueNameEncrypted,
|
||||
++CountForThisExecution);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Adjust current action when no user's logged ***************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <stdbool.h> // For boolean type
|
||||
|
||||
#include "swad_cryptography.h"
|
||||
#include "swad_text.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -77,6 +78,8 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
|
|||
|
||||
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
|
||||
|
||||
#define Act_MAX_LENGTH_ID (32+Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+10+1)
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Not asociates with tabs ***************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1451,6 +1454,8 @@ void Act_LinkFormSubmitUnique (const char *Title,const char *LinkStyle);
|
|||
void Act_LinkFormSubmitId (const char *Title,const char *LinkStyle,const char *Id);
|
||||
void Act_LinkFormSubmitAnimated (const char *Title,const char *LinkStyle);
|
||||
|
||||
void Act_SetUniqueId (char UniqueId[Act_MAX_LENGTH_ID]);
|
||||
|
||||
void Act_AdjustActionWhenNoUsrLogged (void);
|
||||
void Act_AdjustCurrentAction (void);
|
||||
|
||||
|
|
|
@ -131,18 +131,20 @@
|
|||
// TODO: Messages in msg_content_deleted older than a certain time should be deleted to ensure the protection of personal data
|
||||
// TODO: Request confirmation to remove user's photo
|
||||
// TODO: Optional link in images to original file
|
||||
// TODO: FIX BUG: In Statistics > Indicators, if we select only 5 indicators, the message "The list is too big..." is shown.
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.192.13 (2016-04-13)"
|
||||
#define CSS_FILE "swad15.192.9.css"
|
||||
#define JS_FILE "swad15.190.1.js"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.193 (2016-04-14)"
|
||||
#define CSS_FILE "swad15.193.css"
|
||||
#define JS_FILE "swad15.193.js"
|
||||
|
||||
// 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
|
||||
/*
|
||||
Version 15.193: Apr 14, 2016 New layout of button used to upload images. (199357 lines)
|
||||
Version 15.192.13:Apr 13, 2016 Fixed bug in file upload, reported by Christian Morillas Gutiérrez. (199341 lines)
|
||||
Version 15.192.12:Apr 12, 2016 Fixed bug in groups reported by user raistmaj in GitHub. (199339 lines)
|
||||
Version 15.192.11:Apr 12, 2016 Image quality in social posts reduced to 50 in order to speed up page loading.
|
||||
|
|
24
swad_forum.c
24
swad_forum.c
|
@ -3778,9 +3778,6 @@ static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject)
|
|||
extern const char *Txt_New_thread;
|
||||
extern const char *Txt_MSG_Subject;
|
||||
extern const char *Txt_MSG_Message;
|
||||
extern const char *Txt_Image;
|
||||
extern const char *Txt_optional;
|
||||
extern const char *Txt_Image_title_attribution;
|
||||
extern const char *Txt_Send_message;
|
||||
|
||||
/***** Start frame *****/
|
||||
|
@ -3838,26 +3835,7 @@ static void For_WriteFormForumPst (bool IsReply,long ThrCod,const char *Subject)
|
|||
Lay_HelpPlainEditor ();
|
||||
|
||||
/***** Attached image (optional) *****/
|
||||
/* Action to perform on image */
|
||||
Par_PutHiddenParamUnsigned ("ImgAct",(unsigned) Img_ACTION_NEW_IMAGE);
|
||||
|
||||
/* Image file */
|
||||
fprintf (Gbl.F.Out,"<label>"
|
||||
"<img src=\"%s/photo64x64.gif\""
|
||||
" alt=\"%s\" title=\"%s (%s)\""
|
||||
" class=\"ICON20x20\" />"
|
||||
"</label>"
|
||||
"<input type=\"file\" name=\"ImgFil\" accept=\"image/*\" />"
|
||||
"<br />",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Txt_Image,Txt_Image,Txt_optional);
|
||||
|
||||
/* Image title/attribution */
|
||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"ImgTit\""
|
||||
" placeholder=\"%s (%s)…\""
|
||||
" class=\"FOR_IMG_TIT\" maxlength=\"%u\" value=\"\">",
|
||||
Txt_Image_title_attribution,Txt_optional,
|
||||
Img_MAX_BYTES_TITLE);
|
||||
Img_PutImageUploader ("FOR_IMG_TIT");
|
||||
|
||||
/***** Send button *****/
|
||||
Lay_PutCreateButton (Txt_Send_message);
|
||||
|
|
49
swad_image.c
49
swad_image.c
|
@ -151,6 +151,55 @@ void Img_GetImageNameAndTitleFromRow (const char *Name,const char *Title,
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Draw input fields to upload an image inside a form *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Img_PutImageUploader (const char *ClassImgTit)
|
||||
{
|
||||
extern const char *Txt_Image;
|
||||
extern const char *Txt_optional;
|
||||
extern const char *Txt_Image_title_attribution;
|
||||
char Id[Act_MAX_LENGTH_ID];
|
||||
|
||||
/***** Create unique id for this image uploader *****/
|
||||
Act_SetUniqueId (Id);
|
||||
|
||||
/***** Start container *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"IMG_UPLOAD_CONTAINER\">");
|
||||
|
||||
/***** Action to perform on image *****/
|
||||
Par_PutHiddenParamUnsigned ("ImgAct",(unsigned) Img_ACTION_NEW_IMAGE);
|
||||
|
||||
/***** Image file *****/
|
||||
fprintf (Gbl.F.Out,"<label class=\"IMG_UPLOAD_BUTTON\">"
|
||||
"<img src=\"%s/photo64x64.gif\""
|
||||
" alt=\"%s\" title=\"%s (%s)\""
|
||||
" class=\"IMG_UPLOAD_ICON\" />"
|
||||
"<input type=\"file\" name=\"ImgFil\" accept=\"image/*\""
|
||||
" class=\"IMG_UPLOAD_FILE\""
|
||||
" onchange=\"imageUploadOnSelectFile (this,'%s');\" />"
|
||||
"<span id=\"%s_fil\" class=\"IMG_UPLOAD_FILENAME\" />"
|
||||
"</span>"
|
||||
"</label>"
|
||||
"<br />",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Txt_Image,Txt_Image,Txt_optional,
|
||||
Id,Id);
|
||||
|
||||
/***** Image title/attribution *****/
|
||||
fprintf (Gbl.F.Out,"<input type=\"text\" id=\"%s_tit\" name=\"ImgTit\""
|
||||
" placeholder=\"%s (%s)…\""
|
||||
" class=\"%s\" maxlength=\"%u\" value=\"\""
|
||||
" style=\"display:none;\" />",
|
||||
Id,
|
||||
Txt_Image_title_attribution,Txt_optional,
|
||||
ClassImgTit,Img_MAX_BYTES_TITLE);
|
||||
|
||||
/***** End container *****/
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Get image from form ***************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -103,6 +103,7 @@ void Img_FreeImageTitle (struct Image *Image);
|
|||
void Img_GetImageNameAndTitleFromRow (const char *Name,const char *Title,
|
||||
struct Image *Image);
|
||||
|
||||
void Img_PutImageUploader (const char *ClassImgTit);
|
||||
void Img_GetImageFromForm (unsigned NumOpt,struct Image *Image,
|
||||
void (*GetImageFromDB) (unsigned NumOpt,struct Image *Image),
|
||||
const char *ParamAction,const char *ParamFile,const char *ParamTitle,
|
||||
|
|
|
@ -284,9 +284,6 @@ static void Msg_PutFormMsgUsrs (const char *Content)
|
|||
extern const char *Txt_Reply_message;
|
||||
extern const char *Txt_New_message;
|
||||
extern const char *Txt_MSG_To;
|
||||
extern const char *Txt_Image;
|
||||
extern const char *Txt_optional;
|
||||
extern const char *Txt_Image_title_attribution;
|
||||
extern const char *Txt_Send_message;
|
||||
char YN[1+1];
|
||||
|
||||
|
@ -421,26 +418,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
|
|||
Lay_HelpPlainEditor ();
|
||||
|
||||
/***** Attached image (optional) *****/
|
||||
/* Action to perform on image */
|
||||
Par_PutHiddenParamUnsigned ("ImgAct",(unsigned) Img_ACTION_NEW_IMAGE);
|
||||
|
||||
/* Image file */
|
||||
fprintf (Gbl.F.Out,"<label>"
|
||||
"<img src=\"%s/photo64x64.gif\""
|
||||
" alt=\"%s\" title=\"%s (%s)\""
|
||||
" class=\"ICON20x20\" />"
|
||||
"</label>"
|
||||
"<input type=\"file\" name=\"ImgFil\" accept=\"image/*\" />"
|
||||
"<br />",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Txt_Image,Txt_Image,Txt_optional);
|
||||
|
||||
/* Image title/attribution */
|
||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"ImgTit\""
|
||||
" placeholder=\"%s (%s)…\""
|
||||
" class=\"MSG_IMG_TIT\" maxlength=\"%u\" value=\"\">",
|
||||
Txt_Image_title_attribution,Txt_optional,
|
||||
Img_MAX_BYTES_TITLE);
|
||||
Img_PutImageUploader ("MSG_IMG_TIT");
|
||||
|
||||
/***** Send button *****/
|
||||
Lay_PutCreateButton (Txt_Send_message);
|
||||
|
|
|
@ -64,8 +64,6 @@
|
|||
// set also this constant to the new value
|
||||
// in JavaScript function readOldTimelineData
|
||||
|
||||
#define Soc_MAX_LENGTH_ID (32+Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+10+1)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Soc_TIMELINE_USR, // Show the timeline of a user
|
||||
|
@ -176,10 +174,10 @@ static void Soc_PutTextarea (const char *Placeholder,
|
|||
|
||||
static long Soc_ReceiveSocialPost (void);
|
||||
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Soc_MAX_LENGTH_ID]);
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_LENGTH_ID]);
|
||||
static void Soc_PutIconCommentDisabled (void);
|
||||
static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod,
|
||||
const char IdNewComment[Soc_MAX_LENGTH_ID]);
|
||||
const char IdNewComment[Act_MAX_LENGTH_ID]);
|
||||
static unsigned long Soc_GetNumCommentsInSocialNote (long NotCod);
|
||||
static void Soc_WriteCommentsInSocialNote (const struct SocialNote *SocNot);
|
||||
static void Soc_WriteSocialComment (struct SocialComment *SocCom,
|
||||
|
@ -256,8 +254,6 @@ static void Soc_GetDataOfSocialCommentFromRow (MYSQL_ROW row,struct SocialCommen
|
|||
static void Soc_ResetSocialNote (struct SocialNote *SocNot);
|
||||
static void Soc_ResetSocialComment (struct SocialComment *SocCom);
|
||||
|
||||
static void Soc_SetUniqueId (char UniqueId[Soc_MAX_LENGTH_ID]);
|
||||
|
||||
static void Soc_ClearTimelineThisSession (void);
|
||||
static void Soc_AddNotesJustRetrievedToTimelineThisSession (void);
|
||||
|
||||
|
@ -1082,7 +1078,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
|
|||
char ForumName[512];
|
||||
char SummaryStr[Cns_MAX_BYTES_TEXT+1];
|
||||
unsigned NumComments;
|
||||
char IdNewComment[Soc_MAX_LENGTH_ID];
|
||||
char IdNewComment[Act_MAX_LENGTH_ID];
|
||||
|
||||
/***** Start frame ****/
|
||||
if (ShowNoteAlone)
|
||||
|
@ -1261,7 +1257,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
|
|||
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_BOTTOM_LEFT\">");
|
||||
|
||||
/* Create unique id for new comment */
|
||||
Soc_SetUniqueId (IdNewComment);
|
||||
Act_SetUniqueId (IdNewComment);
|
||||
|
||||
/* Get number of comments in this social note */
|
||||
NumComments = Soc_GetNumCommentsInSocialNote (SocNot->NotCod);
|
||||
|
@ -1424,10 +1420,10 @@ static void Soc_WriteAuthorNote (struct UsrData *UsrDat)
|
|||
static void Soc_WriteDateTime (time_t TimeUTC)
|
||||
{
|
||||
extern const char *Txt_Today;
|
||||
char IdDateTime[Soc_MAX_LENGTH_ID];
|
||||
char IdDateTime[Act_MAX_LENGTH_ID];
|
||||
|
||||
/***** Create unique Id *****/
|
||||
Soc_SetUniqueId (IdDateTime);
|
||||
Act_SetUniqueId (IdDateTime);
|
||||
|
||||
/***** Container where the date-time is written *****/
|
||||
fprintf (Gbl.F.Out,"<div id=\"%s\" class=\"SOCIAL_RIGHT_TIME DAT_LIGHT\">"
|
||||
|
@ -2000,14 +1996,11 @@ static void Soc_PutFormToWriteNewPost (void)
|
|||
static void Soc_PutTextarea (const char *Placeholder,
|
||||
const char *ClassTextArea,const char *ClassImgTit)
|
||||
{
|
||||
extern const char *Txt_Image;
|
||||
extern const char *Txt_optional;
|
||||
extern const char *Txt_Image_title_attribution;
|
||||
extern const char *Txt_Post;
|
||||
char IdDivImgButton[Soc_MAX_LENGTH_ID];
|
||||
char IdDivImgButton[Act_MAX_LENGTH_ID];
|
||||
|
||||
/***** Set unique id for the hidden div *****/
|
||||
Soc_SetUniqueId (IdDivImgButton);
|
||||
Act_SetUniqueId (IdDivImgButton);
|
||||
|
||||
/***** Textarea to write the content *****/
|
||||
fprintf (Gbl.F.Out,"<textarea name=\"Content\" rows=\"1\" maxlength=\"%u\""
|
||||
|
@ -2027,26 +2020,7 @@ static void Soc_PutTextarea (const char *Placeholder,
|
|||
Lay_HelpPlainEditor ();
|
||||
|
||||
/***** Attached image (optional) *****/
|
||||
/* Action to perform on image */
|
||||
Par_PutHiddenParamUnsigned ("ImgAct",(unsigned) Img_ACTION_NEW_IMAGE);
|
||||
|
||||
/* Image file */
|
||||
fprintf (Gbl.F.Out,"<label>"
|
||||
"<img src=\"%s/photo64x64.gif\""
|
||||
" alt=\"%s\" title=\"%s (%s)\""
|
||||
" class=\"ICON20x20\" />"
|
||||
"</label>"
|
||||
"<input type=\"file\" name=\"ImgFil\" accept=\"image/*\" />"
|
||||
"<br />",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Txt_Image,Txt_Image,Txt_optional);
|
||||
|
||||
/* Image title/attribution */
|
||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"ImgTit\""
|
||||
" placeholder=\"%s (%s)…\""
|
||||
" class=\"%s\" maxlength=\"%u\" value=\"\">",
|
||||
Txt_Image_title_attribution,Txt_optional,
|
||||
ClassImgTit,Img_MAX_BYTES_TITLE);
|
||||
Img_PutImageUploader (ClassImgTit);
|
||||
|
||||
/***** Submit button *****/
|
||||
fprintf (Gbl.F.Out,"<button type=\"submit\""
|
||||
|
@ -2168,7 +2142,7 @@ static long Soc_ReceiveSocialPost (void)
|
|||
/****** Put an icon to toggle on/off the form to comment a social note *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Soc_MAX_LENGTH_ID])
|
||||
static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Act_MAX_LENGTH_ID])
|
||||
{
|
||||
extern const char *Txt_Comment;
|
||||
|
||||
|
@ -2210,7 +2184,7 @@ static void Soc_PutIconCommentDisabled (void)
|
|||
// All forms in this function and nested functions must have unique identifiers
|
||||
|
||||
static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod,
|
||||
const char IdNewComment[Soc_MAX_LENGTH_ID])
|
||||
const char IdNewComment[Act_MAX_LENGTH_ID])
|
||||
{
|
||||
extern const char *Txt_New_SOCIAL_comment;
|
||||
bool ShowPhoto = false;
|
||||
|
@ -4589,24 +4563,6 @@ static void Soc_ResetSocialComment (struct SocialComment *SocCom)
|
|||
SocCom->Content[0] = '\0';
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Get unique Id *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Soc_SetUniqueId (char UniqueId[Soc_MAX_LENGTH_ID])
|
||||
{
|
||||
static unsigned CountForThisExecution = 0;
|
||||
|
||||
/***** Create Id. The id must be unique in timeline,
|
||||
but the timeline is updated via AJAX.
|
||||
So, Id uses:
|
||||
- a name for this execution (Gbl.UniqueNameEncrypted)
|
||||
- a number for each element in this execution (CountForThisExecution) *****/
|
||||
sprintf (UniqueId,"id_%s_%u",
|
||||
Gbl.UniqueNameEncrypted,
|
||||
++CountForThisExecution);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Clear unused old social timelines in database **************/
|
||||
/*****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue
Block a user