Version19.46.10

This commit is contained in:
Antonio Cañas Vargas 2019-10-31 01:33:26 +01:00
parent 245cdd8fbd
commit 79a6ae8d4a
6 changed files with 106 additions and 149 deletions

View File

@ -715,7 +715,11 @@ void HTM_IMG (const char *URL,const char *Icon,const char *Title,
int NumBytesPrinted;
char *Attr;
fprintf (Gbl.F.Out,"<img src=\"%s/%s\"",URL,Icon);
fprintf (Gbl.F.Out,"<img src=\"%s",URL);
if (Icon)
if (Icon[0])
fprintf (Gbl.F.Out,"/%s",Icon);
fprintf (Gbl.F.Out,"\"");
if (Title)
{

View File

@ -25,6 +25,9 @@
/*********************************** Headers *********************************/
/*****************************************************************************/
#define _GNU_SOURCE // For asprintf
#include <stdio.h> // 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,"<img src=\"https://chart.googleapis.com/chart?cht=qr&amp;chs=%ux%u&amp;chl=%s\""
" alt=\"%s\" title=\"%s\""
" style=\"width:%upx; height:%upx;"
" border:1px dashed silver;\" />",
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&amp;chs=%ux%u&amp;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,"<img src=\"https://chart.googleapis.com/chart?cht=qr&amp;chs=%ux%u&amp;chl=%s/%s?%s=%ld\""
" alt=\"%s\" title=\"%s\""
" style=\"width:%upx; height:%upx;\" />",
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&amp;chs=%ux%u&amp;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,"<img src=\"https://chart.googleapis.com/chart?cht=qr&amp;chs=%ux%u&amp;chl=%s/?crs=%ld%%26act=%ld\""
" alt=\"%s\" title=\"%s\""
" style=\"width:250px; height:250px;\" />",
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&amp;chs=%ux%u&amp;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 ();
}

View File

@ -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 <img a HTM_IMG ()
Version 19.46.9: Oct 29, 2019 Code refactoring in HTML images. (246241 lines)
Version 19.46.8: Oct 29, 2019 Code refactoring in HTML images. (246244 lines)
Version 19.46.7: Oct 29, 2019 Code refactoring in HTML images. (246217 lines)
Version 19.46.6: Oct 29, 2019 Code refactoring in HTML images. (246226 lines)
Version 19.46.10: Oct 31, 2019 Code refactoring in HTML images. (246196 lines)
Version 19.46.9: Oct 30, 2019 Code refactoring in HTML images. (246241 lines)
Version 19.46.8: Oct 30, 2019 Code refactoring in HTML images. (246244 lines)
Version 19.46.7: Oct 30, 2019 Code refactoring in HTML images. (246217 lines)
Version 19.46.6: Oct 30, 2019 Code refactoring in HTML images. (246226 lines)
Version 19.46.5: Oct 29, 2019 Code refactoring in HTML images. (246223 lines)
Version 19.46.4: Oct 28, 2019 Code refactoring in HTML images. (246247 lines)
Version 19.46.3: Oct 28, 2019 Code refactoring in HTML images. (246390 lines)

View File

@ -3328,8 +3328,6 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],
{
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *The_ClassFormInBoxBold[The_NUM_THEMES];
extern const char *Txt_You_have_written_1_post_in_this_thread;
extern const char *Txt_You_have_written_X_posts_in_this_thread;
extern const char *Txt_Thread_with_posts_from_you;
extern const char *Txt_There_are_new_posts;
extern const char *Txt_No_new_posts;
@ -3373,23 +3371,12 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],
HTM_TD_Begin ("class=\"BT %s\"",BgColor);
if (Thr.NumMyPosts)
{
fprintf (Gbl.F.Out,"<img src=\"");
if (Gbl.Usrs.Me.PhotoURL[0]) // If I have photo
fprintf (Gbl.F.Out,"%s",
Gbl.Usrs.Me.PhotoURL);
else
fprintf (Gbl.F.Out,"%s/usr_bl.jpg",
Cfg_URL_ICON_PUBLIC);
fprintf (Gbl.F.Out,"\" alt=\"%s\" title=\"",
Txt_Thread_with_posts_from_you);
if (Thr.NumMyPosts == 1)
fprintf (Gbl.F.Out,"%s",Txt_You_have_written_1_post_in_this_thread);
else
fprintf (Gbl.F.Out,Txt_You_have_written_X_posts_in_this_thread,
Thr.NumMyPosts);
fprintf (Gbl.F.Out,"\" class=\"PHOTO15x20\" />");
}
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 *****/

View File

@ -25,9 +25,11 @@
/********************************* Headers ***********************************/
/*****************************************************************************/
#define _GNU_SOURCE // For asprintf
#include <linux/limits.h> // For PATH_MAX
#include <linux/stddef.h> // For NULL
#include <math.h> // For log10, floor, ceil, modf, sqrt...
#include <stdio.h> // For asprintf
#include <stdlib.h> // For system, getenv, etc.
#include <string.h> // For string functions
#include <sys/wait.h> // 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,"<img src=\"%s/%s_map.jpg\""
" usemap=\"#faces_map\""
" alt=\"%s\" title=\"%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,"<img src=\"%s/%s_paso%u.jpg\""
" alt=\"%s\" title=\"%s\""
" style=\"width:%upx; height:%upx;\" />",
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,"<br />%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,"<img src=\"");
/***** Image zoom *****/
PhotoExists = false;
if (PhotoURL)
if (PhotoURL[0])
PhotoExists = true;
if (PhotoExists)
fprintf (Gbl.F.Out,"%s",PhotoURL);
else
fprintf (Gbl.F.Out,"%s/usr_bl.jpg",Cfg_URL_ICON_PUBLIC);
fprintf (Gbl.F.Out,"\" alt=\"%s\" title=\"%s\""
" class=\"%s\"",
UsrDat->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,"<img src=\"%s\"",PhotoURL);
if (PhotoCaption[0])
fprintf (Gbl.F.Out," onmouseover=\"zoom(this,'%s','%s');\""
" onmouseout=\"noZoom();\"",
HTM_IMG (PhotoURL,NULL,Deg->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,"<img src=\"%s/usr_bl.jpg\" alt=\"%s\""
" style=\"width:%upx; height:%upx;\" />",
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\"");

View File

@ -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&oacute;n con comentarios de usted."; // Necessita traduccio
"Discusi&oacute;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&oacute;n con comentarios de usted.";
"Discusi&oacute;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&oacute;n con comentarios de usted."; // Okoteve traducción
"Discusi&oacute;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&atilde;o com mensagens de voc&ecirc;.";
"Discuss&atilde;o com mensagens de voc&ecirc;";
#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&ecirc; 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&oacute;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&oacute;n";
#elif L==5 // fr
"Vous avez &eacute;crit 1 post dans ce fil";
#elif L==6 // gn
"Usted ha escrito 1 comentario en esta discusi&oacute;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&ecirc; escreveu 1 post nesta discuss&atilde;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&oacute;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&oacute;n";
#elif L==5 // fr
"Vous avez &eacute;crit %u posts dans ce fil";
#elif L==6 // gn
"Usted ha escrito %u comentarios en esta discusi&oacute;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&ecirc; escreveu %u posts nesta discuss&atilde;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