From 79a6ae8d4a3e1c9cb0a2042efbc143b98239fac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 31 Oct 2019 01:33:26 +0100 Subject: [PATCH] Version19.46.10 --- swad_HTML.c | 6 +++- swad_QR.c | 59 +++++++++++++++++------------- swad_changelog.h | 12 +++---- swad_forum.c | 25 ++++--------- swad_photo.c | 93 ++++++++++++++++++++++++------------------------ swad_text.c | 60 +++++-------------------------- 6 files changed, 106 insertions(+), 149 deletions(-) diff --git a/swad_HTML.c b/swad_HTML.c index 7cc2a046..d455d748 100644 --- a/swad_HTML.c +++ b/swad_HTML.c @@ -715,7 +715,11 @@ void HTM_IMG (const char *URL,const char *Icon,const char *Title, int NumBytesPrinted; char *Attr; - fprintf (Gbl.F.Out," // For asprintf + #include "swad_action.h" #include "swad_global.h" #include "swad_HTML.h" @@ -105,17 +108,19 @@ void QR_PrintQRCode (void) void QR_ImageQRCode (const char *QRString) { + char *URL; + HTM_DIV_Begin ("class=\"CM\" style=\"margin:0 auto; width:%upx;\"", QR_CODE_SIZE); - fprintf (Gbl.F.Out,"\"%s\"", - QR_CODE_SIZE,QR_CODE_SIZE, - QRString, - QRString, - QRString, - QR_CODE_SIZE,QR_CODE_SIZE); + + if (asprintf (&URL,"https://chart.googleapis.com/chart?cht=qr&chs=%ux%u&chl=%s", + QR_CODE_SIZE,QR_CODE_SIZE,QRString) < 0) + Lay_NotEnoughMemoryExit (); + HTM_IMG (URL,NULL,QRString, + "style=\"width:%upx;height:%upx;border:1px dashed silver;\"", + QR_CODE_SIZE,QR_CODE_SIZE); + free ((void *) URL); + HTM_DIV_End (); } @@ -127,17 +132,17 @@ void QR_LinkTo (unsigned Size,const char *ParamStr,long Cod) { extern const char *Txt_Shortcut; extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; + char *URL; /***** Show QR code with direct link to the current centre *****/ - fprintf (Gbl.F.Out,"\"%s\"", - Size,Size, - Cfg_URL_SWAD_CGI, - Lan_STR_LANG_ID[Gbl.Prefs.Language],ParamStr,Cod, - Txt_Shortcut, - Txt_Shortcut, - Size,Size); + if (asprintf (&URL,"https://chart.googleapis.com/chart?cht=qr&chs=%ux%u&chl=%s/%s?%s=%ld", + Size,Size, + Cfg_URL_SWAD_CGI, + Lan_STR_LANG_ID[Gbl.Prefs.Language],ParamStr,Cod) < 0) + Lay_NotEnoughMemoryExit (); + HTM_IMG (URL,NULL,Txt_Shortcut, + "style=\"width:%upx;height:%upx;\"",Size,Size); + free ((void *) URL); } /*****************************************************************************/ @@ -147,15 +152,19 @@ void QR_LinkTo (unsigned Size,const char *ParamStr,long Cod) void QR_ExamAnnnouncement (void) { extern const char *Txt_Link_to_announcement_of_exam; + char *URL; /***** Show QR code with direct link to the exam announcement *****/ HTM_DIV_Begin ("class=\"CM\""); - fprintf (Gbl.F.Out,"\"%s\"", - 300,300, - Cfg_URL_SWAD_CGI,Gbl.Hierarchy.Crs.CrsCod,Act_GetActCod (ActSeeAllExaAnn), - Txt_Link_to_announcement_of_exam, - Txt_Link_to_announcement_of_exam); + + if (asprintf (&URL,"https://chart.googleapis.com/chart?cht=qr&chs=%ux%u&chl=%s/?crs=%ld%%26act=%ld", + 300,300, + Cfg_URL_SWAD_CGI,Gbl.Hierarchy.Crs.CrsCod, + Act_GetActCod (ActSeeAllExaAnn)) < 0) + Lay_NotEnoughMemoryExit (); + HTM_IMG (URL,NULL,Txt_Link_to_announcement_of_exam, + "style=\"width:250px;height:250px;\""); + free ((void *) URL); + HTM_DIV_End (); } diff --git a/swad_changelog.h b/swad_changelog.h index 5847ea1c..0f190703 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -487,18 +487,18 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.46.9 (2019-10-29)" +#define Log_PLATFORM_VERSION "SWAD 19.46.10 (2019-10-31)" #define CSS_FILE "swad19.45.css" #define JS_FILE "swad19.39.js" /* // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Impedir la creación y edición de proyectos si no son editables. -// TODO: Continuar convirtiendo \"%s\""); - } + HTM_IMG (Gbl.Usrs.Me.PhotoURL[0] ? Gbl.Usrs.Me.PhotoURL : + Cfg_URL_ICON_PUBLIC, + Gbl.Usrs.Me.PhotoURL[0] ? NULL : + "usr_bl.jpg", + Txt_Thread_with_posts_from_you, + "class=\"PHOTO15x20\""); HTM_TD_End (); /***** Put an icon with thread status *****/ diff --git a/swad_photo.c b/swad_photo.c index a003f5cd..82e1d1c3 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -25,9 +25,11 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ +#define _GNU_SOURCE // For asprintf #include // For PATH_MAX #include // For NULL #include // For log10, floor, ceil, modf, sqrt... +#include // For asprintf #include // For system, getenv, etc. #include // For string functions #include // For the macro WEXITSTATUS @@ -580,6 +582,7 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr char FileNamePhotoMap[PATH_MAX + 1]; // Full name (including path) of the temporary file with the original image with faces char FileNameTxtMap[PATH_MAX + 1]; // Full name (including path) of the temporary file with the text neccesary to make the image map char PathRelPhoto[PATH_MAX + 1]; + char *Img; FILE *FileTxtMap = NULL; // Temporary file with the text neccesary to make the image map. Initialized to avoid warning char MIMEType[Brw_MAX_BYTES_MIME_TYPE + 1]; bool WrongType = false; @@ -785,12 +788,11 @@ static bool Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *Usr Cfg_PATH_PHOTO_TMP_PUBLIC, Gbl.UniqueNameEncrypted); HTM_DIV_Begin ("class=\"TIT CM\""); - fprintf (Gbl.F.Out,"\"%s\"", - Cfg_URL_PHOTO_TMP_PUBLIC, - Gbl.UniqueNameEncrypted, - Txt_Faces_detected,Txt_Faces_detected); + if (asprintf (&Img,"%s_map.jpg",Gbl.UniqueNameEncrypted) < 0) + Lay_NotEnoughMemoryExit (); + HTM_IMG (Cfg_URL_PHOTO_TMP_PUBLIC,Img,Txt_Faces_detected, + "usemap=\"#faces_map\""); + free ((void *) Img); HTM_DIV_End (); /***** End alert *****/ @@ -886,6 +888,7 @@ static void Pho_UpdatePhoto2 (void) { extern const char *Txt_PHOTO_PROCESSING_CAPTIONS[3]; unsigned NumPhoto; + char *Img; /***** Start alert *****/ Ale_ShowLastAlertAndButton1 (); @@ -898,14 +901,12 @@ static void Pho_UpdatePhoto2 (void) NumPhoto++) { HTM_TD_Begin ("class=\"DAT CT\" style=\"width:33%%;\""); - fprintf (Gbl.F.Out,"\"%s\"", - Cfg_URL_PHOTO_TMP_PUBLIC, - Gbl.Usrs.FileNamePhoto,NumPhoto + 1, - Txt_PHOTO_PROCESSING_CAPTIONS[NumPhoto], - Txt_PHOTO_PROCESSING_CAPTIONS[NumPhoto], - Pho_PHOTO_REAL_WIDTH,Pho_PHOTO_REAL_HEIGHT); + if (asprintf (&Img,"%s_paso%u.jpg",Gbl.Usrs.FileNamePhoto,NumPhoto + 1) < 0) + Lay_NotEnoughMemoryExit (); + HTM_IMG (Cfg_URL_PHOTO_TMP_PUBLIC,Img,Txt_PHOTO_PROCESSING_CAPTIONS[NumPhoto], + "style=\"width:%upx;height:%upx;\"", + Pho_PHOTO_REAL_WIDTH,Pho_PHOTO_REAL_HEIGHT); + free ((void *) Img); fprintf (Gbl.F.Out,"
%s",Txt_PHOTO_PROCESSING_CAPTIONS[NumPhoto]); HTM_TD_End (); } @@ -1267,35 +1268,35 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, HTM_DIV_End (); } - /***** Start image *****/ - fprintf (Gbl.F.Out,"\"%s\"FullName,UsrDat->FullName, - ClassPhoto); - - /***** Image zoom *****/ if (PutZoomCode) { - fprintf (Gbl.F.Out," onmouseover=\"zoom(this,'"); if (PhotoExists) - fprintf (Gbl.F.Out,"%s",PhotoURL); + HTM_IMG (PhotoURL,NULL,UsrDat->FullName, + "class=\"%s\"" + " onmouseover=\"zoom(this,'%s','%s');\"" + " onmouseout=\"noZoom();\"", + ClassPhoto,PhotoURL,IdCaption); else - fprintf (Gbl.F.Out,"%s/usr_bl.jpg",Cfg_URL_ICON_PUBLIC); - fprintf (Gbl.F.Out,"','%s');\" onmouseout=\"noZoom();\"", - IdCaption); + HTM_IMG (Cfg_URL_ICON_PUBLIC,"usr_bl.jpg",UsrDat->FullName, + "class=\"%s\"" + " onmouseover=\"zoom(this,'%s/usr_bl.jpg','%s');\"" + " onmouseout=\"noZoom();\"", + ClassPhoto,Cfg_URL_ICON_PUBLIC,IdCaption); + } + else + { + if (PhotoExists) + HTM_IMG (PhotoURL,NULL,UsrDat->FullName, + "class=\"%s\"",ClassPhoto); + else + HTM_IMG (Cfg_URL_ICON_PUBLIC,"usr_bl.jpg",UsrDat->FullName, + "class=\"%s\"",ClassPhoto); } - - /***** End image *****/ - fprintf (Gbl.F.Out," />"); /***** End form to go to public profile *****/ if (PutLinkToPublicProfile) @@ -2500,24 +2501,22 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg, /***** Show photo *****/ if (PhotoURL[0]) { - fprintf (Gbl.F.Out,"ShrtName, + " style=\"width:%upx;height:%upx;\"" + " onmouseover=\"zoom(this,'%s','%s');\"" + " onmouseout=\"noZoom();\"", + PhotoWidth,PhotoHeight, PhotoURL,IdCaption); - fprintf (Gbl.F.Out," alt=\"%s\"" - " style=\"width:%upx; height:%upx;\" />", - Deg->ShrtName, - PhotoWidth,PhotoHeight); + else + HTM_IMG (PhotoURL,NULL,Deg->ShrtName, + " style=\"width:%upx;height:%upx;\" />", + PhotoWidth,PhotoHeight); } else - { - fprintf (Gbl.F.Out,"\"%s\""", - Cfg_URL_ICON_PUBLIC, - Deg->ShrtName, + HTM_IMG (Cfg_URL_ICON_PUBLIC,"usr_bl.jpg",Deg->ShrtName, + "style=\"width:%upx;height:%upx;\"", PhotoWidth,PhotoHeight); - } /***** Caption *****/ HTM_DIV_Begin ("class=\"CLASSPHOTO_CAPTION\""); diff --git a/swad_text.c b/swad_text.c index 83770a20..cbbe0aa6 100644 --- a/swad_text.c +++ b/swad_text.c @@ -49160,23 +49160,23 @@ const char *Txt_Thread_X_removed = // Warning: it is very important to include % const char *Txt_Thread_with_posts_from_you = #if L==1 // ca - "Discusión con comentarios de usted."; // Necessita traduccio + "Discusión con comentarios de usted"; // Necessita traduccio #elif L==2 // de - "Thread with posts from you."; // Need Übersetzung + "Thread with posts from you"; // Need Übersetzung #elif L==3 // en - "Thread with posts from you."; + "Thread with posts from you"; #elif L==4 // es - "Discusión con comentarios de usted."; + "Discusión con comentarios de usted"; #elif L==5 // fr - "Thread with posts from you."; // Besoin de traduction + "Thread with posts from you"; // Besoin de traduction #elif L==6 // gn - "Discusión con comentarios de usted."; // Okoteve traducción + "Discusión con comentarios de usted"; // Okoteve traducción #elif L==7 // it - "Discussione con post per te."; + "Discussione con post per te"; #elif L==8 // pl - "Thread with posts from you."; // Potrzebujesz tlumaczenie + "Thread with posts from you"; // Potrzebujesz tlumaczenie #elif L==9 // pt - "Discussão com mensagens de você."; + "Discussão com mensagens de você"; #endif const char *Txt_threads = @@ -55880,48 +55880,6 @@ const char *Txt_You_have_to_register_compulsorily_in_one_group_of_type_X = // Wa "Você tem que se registrar obrigatoriamente em um grupo do tipo %s."; #endif -const char *Txt_You_have_written_1_post_in_this_thread = -#if L==1 // ca - "Usted ha escrito 1 comentario en esta discusión"; // Necessita traduccio -#elif L==2 // de - "Sie haben 1 Nachricht in diesem Thread"; -#elif L==3 // en - "You have written 1 post in this thread"; -#elif L==4 // es - "Usted ha escrito 1 comentario en esta discusión"; -#elif L==5 // fr - "Vous avez écrit 1 post dans ce fil"; -#elif L==6 // gn - "Usted ha escrito 1 comentario en esta discusión"; // Okoteve traducción -#elif L==7 // it - "Hai scritto 1 post in questa discussione"; -#elif L==8 // pl - "You have written 1 post in this thread"; // Potrzebujesz tlumaczenie -#elif L==9 // pt - "Você escreveu 1 post nesta discussão"; -#endif - -const char *Txt_You_have_written_X_posts_in_this_thread = // Warning: it is very important to include %u in the following sentences -#if L==1 // ca - "Usted ha escrito %u comentarios en esta discusión"; // Necessita traduccio -#elif L==2 // de - "Sie haben %u Nachrichten in diesem Thread"; -#elif L==3 // en - "You have written %u posts in this thread"; -#elif L==4 // es - "Usted ha escrito %u comentarios en esta discusión"; -#elif L==5 // fr - "Vous avez écrit %u posts dans ce fil"; -#elif L==6 // gn - "Usted ha escrito %u comentarios en esta discusión"; // Okoteve traducción -#elif L==7 // it - "Hai scritto %u post in questa discussione"; -#elif L==8 // pl - "You have written %u posts in this thread"; // Potrzebujesz tlumaczenie -#elif L==9 // pt - "Você escreveu %u posts nesta discussão"; -#endif - const char *Txt_You_must_enter_an_integer_value_as_the_correct_answer = #if L==1 // ca "Debe escribir un valor entero como respuesta correcta."; // Necessita traduccio