diff --git a/swad_changelog.h b/swad_changelog.h index fcb20807..dd8ddaca 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -598,10 +598,11 @@ TODO: DNI de un estudiante sale err TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede. TODO: Salvador Romero Cortés: @acanas opción para editar posts */ -#define Log_PLATFORM_VERSION "SWAD 20.38 (2021-03-02)" +#define Log_PLATFORM_VERSION "SWAD 20.38.1 (2021-03-02)" #define CSS_FILE "swad20.33.9.css" #define JS_FILE "swad20.6.2.js" /* + Version 20.38.1: Mar 02, 2021 Code refactoring in timeline comments. (305768 lines) Version 20.38: Mar 02, 2021 Code refactoring in timeline. (305756 lines) Version 20.37: Mar 01, 2021 Code refactoring and more error messages in timeline. (305681 lines) Version 20.36.49: Mar 01, 2021 Cleaning unused header files in timeline modules. (305544 lines) diff --git a/swad_icon.c b/swad_icon.c index d694de11..aeeeae82 100644 --- a/swad_icon.c +++ b/swad_icon.c @@ -464,16 +464,19 @@ void Ico_PutIcon (const char *Icon,const char *Title,const char *Class) void Ico_PutCalculateIcon (const char *Title) { + /***** Begin container *****/ HTM_DIV_Begin ("class=\"CONTEXT_OPT ICO_HIGHLIGHT\""); - HTM_IMG (Cfg_URL_ICON_PUBLIC,"recycle16x16.gif",Title, // TODO: change name and resolution to refresh64x64.png - "class=\"CONTEXT_ICO_16x16\"" - " id=\"update_%d\"",Gbl.Form.Num); + /***** Static icon *****/ + HTM_IMG (Cfg_URL_ICON_PUBLIC,"recycle16x16.gif",Title, // TODO: change name and resolution to refresh64x64.png + "class=\"CONTEXT_ICO_16x16\" id=\"update_%d\"",Gbl.Form.Num); - HTM_IMG (Cfg_URL_ICON_PUBLIC,"working16x16.gif",Title, // TODO: change name and resolution to refreshing64x64.gif - "class=\"CONTEXT_ICO_16x16\" style=\"display:none;\"" // Animated icon hidden - " id=\"updating_%d\"",Gbl.Form.Num); + /***** Animated icon *****/ + HTM_IMG (Cfg_URL_ICON_PUBLIC,"working16x16.gif",Title, // TODO: change name and resolution to refreshing64x64.gif + "class=\"CONTEXT_ICO_16x16\" style=\"display:none;\"" // Animated icon hidden + " id=\"updating_%d\"",Gbl.Form.Num); + /***** End container *****/ HTM_DIV_End (); } @@ -484,18 +487,22 @@ void Ico_PutCalculateIcon (const char *Title) void Ico_PutCalculateIconWithText (const char *Text) { + /***** Begin container *****/ HTM_DIV_Begin ("class=\"ICO_HIGHLIGHT\" style=\"margin:0 6px 0 0; display:inline;\""); - HTM_IMG (Cfg_URL_ICON_PUBLIC,"recycle16x16.gif",Text, - "class=\"ICO20x20\"" - " id=\"update_%d\"",Gbl.Form.Num); + /***** Static icon *****/ + HTM_IMG (Cfg_URL_ICON_PUBLIC,"recycle16x16.gif",Text, + "class=\"ICO20x20\" id=\"update_%d\"",Gbl.Form.Num); - HTM_IMG (Cfg_URL_ICON_PUBLIC,"working16x16.gif",Text, - "class=\"ICO20x20\" style=\"display:none;\"" // Animated icon hidden - " id=\"updating_%d\"",Gbl.Form.Num); + /***** Animated icon *****/ + HTM_IMG (Cfg_URL_ICON_PUBLIC,"working16x16.gif",Text, // Animated icon + "class=\"ICO20x20\" style=\"display:none;\"" // hidden + " id=\"updating_%d\"",Gbl.Form.Num); - HTM_TxtF (" %s",Text); + /***** Text *****/ + HTM_TxtF (" %s",Text); + /***** End container *****/ HTM_DIV_End (); } diff --git a/swad_timeline_comment.c b/swad_timeline_comment.c index bce4f435..219cc41c 100644 --- a/swad_timeline_comment.c +++ b/swad_timeline_comment.c @@ -65,6 +65,10 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ +static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat); +static void TL_Com_PutFormToWriteNewComm (const struct TL_Timeline *Timeline, + long NotCod); + static unsigned TL_Com_WriteHiddenComms (struct TL_Timeline *Timeline, long NotCod, char IdComms[Frm_MAX_BYTES_ID + 1], @@ -80,7 +84,6 @@ static void TL_Com_CheckAndWriteComm (const struct TL_Timeline *Timeline, struct TL_Com_Comment *Com); static void TL_Com_WriteComm (const struct TL_Timeline *Timeline, struct TL_Com_Comment *Com); -static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat); static void TL_Com_WriteAuthorTimeAndContent (struct TL_Com_Comment *Com, const struct UsrData *UsrDat); static void TL_Com_WriteAuthorName (const struct UsrData *UsrDat); @@ -153,49 +156,76 @@ void TL_Com_PutIconCommDisabled (void) /************************* Form to comment a note ****************************/ /*****************************************************************************/ -void TL_Com_PutHiddenFormToWriteNewComm (const struct TL_Timeline *Timeline, - long NotCod, - const char IdNewComm[Frm_MAX_BYTES_ID + 1]) +void TL_Com_PutPhotoAndFormToWriteNewComm (const struct TL_Timeline *Timeline, + long NotCod, + const char IdNewComm[Frm_MAX_BYTES_ID + 1]) { - extern const char *Txt_New_TIMELINE_comment; - bool ShowPhoto = false; - char PhotoURL[PATH_MAX + 1]; - /***** Begin container *****/ HTM_DIV_Begin ("id=\"%s\" class=\"TL_FORM_NEW_COM TL_RIGHT_WIDTH\"" " style=\"display:none;\"", IdNewComm); /***** Left: write author's photo (my photo) *****/ - HTM_DIV_Begin ("class=\"TL_COM_PHOTO\""); - ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL); - Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,ShowPhoto ? PhotoURL : - NULL, - "PHOTO30x40",Pho_ZOOM,true); // Use unique id - HTM_DIV_End (); + TL_Com_ShowAuthorPhoto (&Gbl.Usrs.Me.UsrDat); /***** Right: form to write the comment *****/ - /* Begin right container */ - HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\""); - - /* Begin form to write the post */ - TL_Frm_BeginForm (Timeline,TL_Frm_RECEIVE_COMM); - TL_Not_PutHiddenParamNotCod (NotCod); - - /* Textarea and button */ - TL_Pst_PutTextarea (Txt_New_TIMELINE_comment, - "TL_COM_TEXTAREA TL_COMM_WIDTH"); - - /* End form */ - TL_Frm_EndForm (); - - /* End right container */ - HTM_DIV_End (); + TL_Com_PutFormToWriteNewComm (Timeline,NotCod); /***** End container *****/ HTM_DIV_End (); } +/*****************************************************************************/ +/********************* Show photo of author of a comment *********************/ +/*****************************************************************************/ + +static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat) + { + bool ShowPhoto = false; + char PhotoURL[PATH_MAX + 1]; + + /***** Show author's photo *****/ + /* Begin container */ + HTM_DIV_Begin ("class=\"TL_COM_PHOTO\""); + + /* Author's photo */ + ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); + Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : + NULL, + "PHOTO30x40",Pho_ZOOM,true); // Use unique id + + /* End container */ + HTM_DIV_End (); + } + +/*****************************************************************************/ +/************************* Form to comment a note ****************************/ +/*****************************************************************************/ + +static void TL_Com_PutFormToWriteNewComm (const struct TL_Timeline *Timeline, + long NotCod) + { + extern const char *Txt_New_TIMELINE_comment; + + /***** Form to write the comment *****/ + /* Begin container */ + HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\""); + + /* Begin form to write the post */ + TL_Frm_BeginForm (Timeline,TL_Frm_RECEIVE_COMM); + TL_Not_PutHiddenParamNotCod (NotCod); + + /* Textarea and button */ + TL_Pst_PutTextarea (Txt_New_TIMELINE_comment, + "TL_COM_TEXTAREA TL_COMM_WIDTH"); + + /* End form */ + TL_Frm_EndForm (); + + /* End container */ + HTM_DIV_End (); + } + /*****************************************************************************/ /*********************** Write comments in a note ****************************/ /*****************************************************************************/ @@ -537,29 +567,6 @@ static void TL_Com_WriteComm (const struct TL_Timeline *Timeline, Usr_UsrDataDestructor (&UsrDat); } -/*****************************************************************************/ -/********************* Show photo of author of a comment *********************/ -/*****************************************************************************/ - -static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat) - { - bool ShowPhoto = false; - char PhotoURL[PATH_MAX + 1]; - - /***** Show author's photo *****/ - /* Begin container */ - HTM_DIV_Begin ("class=\"TL_COM_PHOTO\""); - - /* Author's photo */ - ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); - Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : - NULL, - "PHOTO30x40",Pho_ZOOM,true); // Use unique id - - /* End container */ - HTM_DIV_End (); - } - /*****************************************************************************/ /**** Write top right part of a note: author's name, time and note content ***/ /*****************************************************************************/ diff --git a/swad_timeline_comment.h b/swad_timeline_comment.h index 1d0419ae..3747fdbb 100644 --- a/swad_timeline_comment.h +++ b/swad_timeline_comment.h @@ -55,9 +55,9 @@ struct TL_Com_Comment void TL_Com_PutIconToToggleComm (const char UniqueId[Frm_MAX_BYTES_ID + 1]); void TL_Com_PutIconCommDisabled (void); -void TL_Com_PutHiddenFormToWriteNewComm (const struct TL_Timeline *Timeline, - long NotCod, - const char IdNewComm[Frm_MAX_BYTES_ID + 1]); +void TL_Com_PutPhotoAndFormToWriteNewComm (const struct TL_Timeline *Timeline, + long NotCod, + const char IdNewComm[Frm_MAX_BYTES_ID + 1]); void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline, const struct TL_Not_Note *Not); diff --git a/swad_timeline_note.c b/swad_timeline_note.c index 117071a8..205505e2 100644 --- a/swad_timeline_note.c +++ b/swad_timeline_note.c @@ -764,7 +764,7 @@ static void TL_Not_WriteButtonsAndComms (const struct TL_Timeline *Timeline, TL_Not_WriteFavShaRemAndComms (Timeline,Not,UsrDat); /***** Put hidden form to write a new comment *****/ - TL_Com_PutHiddenFormToWriteNewComm (Timeline,Not->NotCod,IdNewComm); + TL_Com_PutPhotoAndFormToWriteNewComm (Timeline,Not->NotCod,IdNewComm); } /*****************************************************************************/