diff --git a/css/swad15.225.11.css b/css/swad15.226.css
similarity index 100%
rename from css/swad15.225.11.css
rename to css/swad15.226.css
diff --git a/js/swad15.216.js b/js/swad15.226.js
similarity index 99%
rename from js/swad15.216.js
rename to js/swad15.226.js
index ffa23831..a09a5938 100644
--- a/js/swad15.216.js
+++ b/js/swad15.226.js
@@ -645,7 +645,9 @@ function toggleDisplay (elementID) {
}
// Zoom a user's photograph
-function zoom (img,urlPhoto,shortName) {
+// idCaption must be the id of a hidden div with the caption in innerHTML
+// (this allows showing ' and ")
+function zoom (img,urlPhoto,idCaption) {
var zoomImgWidth = 186; // big photo
var zoomImgHeight = 248; // big photo
var padding = 7; // padding around big photo including border
@@ -668,7 +670,9 @@ function zoom (img,urlPhoto,shortName) {
document.getElementById('zoomLyr').style.left = xPos + 'px';
document.getElementById('zoomLyr').style.top = yPos + 'px';
document.getElementById('zoomImg').src = urlPhoto;
- document.getElementById('zoomTxt').innerHTML = '' + shortName + '';
+ document.getElementById('zoomTxt').innerHTML = '' +
+ document.getElementById(idCaption).innerHTML +
+ '';
}
// Exit from zooming a user's photograph
diff --git a/swad_changelog.h b/swad_changelog.h
index f24fe476..6fa0404d 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -128,13 +128,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.225.21 (2016-06-17)"
-#define CSS_FILE "swad15.225.11.css"
-#define JS_FILE "swad15.216.js"
+#define Log_PLATFORM_VERSION "SWAD 15.226 (2016-06-17)"
+#define CSS_FILE "swad15.226.css"
+#define JS_FILE "swad15.226.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.226: Jun 17, 2016 Fixed bug in photo zoom. (202870 lines)
Version 15.225.21:Jun 17, 2016 Fixed bug in photo zoom, reported by Javier Fernández Baldomero. (202894 lines)
Version 15.225.20:Jun 17, 2016 Show details of user's profile in similar users. (202893 lines)
Version 15.225.19:Jun 17, 2016 Changed layout of listing of similar users. (202927 lines)
diff --git a/swad_connected.c b/swad_connected.c
index cd3dfea9..7ddb2467 100644
--- a/swad_connected.c
+++ b/swad_connected.c
@@ -549,9 +549,9 @@ void Con_ShowConnectedUsrsBelongingToCurrentCrs (void)
/* Write total number of connected users belonging to the current course */
strcpy (CourseName,Gbl.CurrentCrs.Crs.ShortName);
Str_LimitLengthHTMLStr (CourseName,12);
- Str_ReplaceSpecialCharByCodes (CourseName,Crs_MAX_LENGTH_COURSE_SHORT_NAME);
Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_UNKNOWN,&Usrs);
- fprintf (Gbl.F.Out,"%u %s %s",Usrs.NumUsrs,Txt_from,CourseName);
+ fprintf (Gbl.F.Out,"%u %s %s",
+ Usrs.NumUsrs,Txt_from,CourseName);
/* End of link to view more details about connected users */
fprintf (Gbl.F.Out,"");
diff --git a/swad_photo.c b/swad_photo.c
index 3db7e245..e48b0295 100644
--- a/swad_photo.c
+++ b/swad_photo.c
@@ -1123,21 +1123,17 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
bool FormUnique)
{
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
- char SpecialFullName [3*(Usr_MAX_BYTES_NAME_SPEC_CHAR+1)+1];
- char SpecialShortName[3*(Usr_MAX_BYTES_NAME_SPEC_CHAR+1)+6];
- char SpecialSurnames [2*(Usr_MAX_BYTES_NAME_SPEC_CHAR+1)+1];
+ char FullName [3*(Usr_MAX_BYTES_NAME_SPEC_CHAR+1)+1];
+ char ShortName[3*(Usr_MAX_BYTES_NAME_SPEC_CHAR+1)+6];
+ char Surnames [2*(Usr_MAX_BYTES_NAME_SPEC_CHAR+1)+1];
bool PhotoExists;
bool PutLinkToPublicProfile = !Gbl.Form.Inside && // Only if not inside another form
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW; // Only in main window
bool PutZoomCode = PhotoURL && // Photo exists
Zoom == Pho_ZOOM && // Make zoom
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW; // Only in main window
+ char IdCaption[Act_MAX_LENGTH_ID];
- /***** Replace tildes, ñ, etc. in full name by codes,
- because some browsers (i.e., IE5)
- don't show correctly tildes with AJAX *****/
- strcpy (SpecialFullName,UsrDat->FullName);
- Str_ReplaceSpecialCharByCodes (SpecialFullName,sizeof (SpecialFullName)-1);
/***** Start form to go to public profile *****/
if (PutLinkToPublicProfile)
@@ -1153,6 +1149,31 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
Act_LinkFormSubmit (NULL,NULL);
}
+ /***** Hidden div to pass user's name to Javascript *****/
+ strcpy (FullName,UsrDat->FullName);
+ if (PutZoomCode)
+ {
+ strcpy (ShortName,UsrDat->FirstName);
+ Str_LimitLengthHTMLStr (ShortName,23);
+ Surnames[0] = '\0';
+ if (UsrDat->Surname1[0])
+ strcpy (Surnames,UsrDat->Surname1);
+ if (UsrDat->Surname2[0])
+ {
+ strcat (Surnames," ");
+ strcat (Surnames,UsrDat->Surname2);
+ }
+ Str_LimitLengthHTMLStr (Surnames,23);
+ strcat (ShortName,"
");
+ strcat (ShortName,Surnames);
+
+ Act_SetUniqueId (IdCaption);
+ fprintf (Gbl.F.Out,"
"
+ "%s"
+ "
",
+ IdCaption,ShortName);
+ }
+
/***** Start image *****/
fprintf (Gbl.F.Out,"FirstName);
- Str_LimitLengthHTMLStr (SpecialShortName,23);
- Str_ReplaceSpecialCharByCodes (SpecialShortName,Usr_MAX_BYTES_NAME_SPEC_CHAR);
- SpecialSurnames[0] = '\0';
- if (UsrDat->Surname1[0])
- strcpy (SpecialSurnames,UsrDat->Surname1);
- if (UsrDat->Surname2[0])
- {
- strcat (SpecialSurnames," ");
- strcat (SpecialSurnames,UsrDat->Surname2);
- }
- Str_LimitLengthHTMLStr (SpecialSurnames,23);
- Str_ReplaceSpecialCharByCodes (SpecialSurnames,2*Usr_MAX_BYTES_NAME_SPEC_CHAR+1);
- strcat (SpecialShortName,"
");
- strcat (SpecialShortName,SpecialSurnames);
- fprintf (Gbl.F.Out," onmouseover=\"zoom(this,'%s',"%s");\" onmouseout=\"noZoom();\"",
- PhotoURL,SpecialShortName);
- }
+ fprintf (Gbl.F.Out," onmouseover=\"zoom(this,'%s','%s');\" onmouseout=\"noZoom();\"",
+ PhotoURL,IdCaption);
/***** End image *****/
fprintf (Gbl.F.Out," />");
@@ -2337,9 +2341,14 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,
unsigned PhotoHeight;
char PathRelAvgPhoto[PATH_MAX+1];
char PhotoURL[PATH_MAX+1];
- char CopyOfDegShortName[Deg_MAX_LENGTH_DEGREE_SHORT_NAME+1]; // Short name of degree
char PhotoCaption[512];
+ char CopyOfDegShortName[Deg_MAX_LENGTH_DEGREE_SHORT_NAME+1]; // Short name of degree
bool ShowDegPhoto;
+ char IdCaption[Act_MAX_LENGTH_ID];
+
+ /***** Initializations *****/
+ PhotoURL[0] = '\0';
+ PhotoCaption[0] = '\0';
/***** Compute photo width and height to be proportional to number of students *****/
Pho_ComputePhotoSize (NumStds,NumStdsWithPhoto,&PhotoWidth,&PhotoHeight);
@@ -2367,48 +2376,54 @@ static void Pho_ShowDegreeAvgPhotoAndStat (struct Degree *Deg,
ShowDegPhoto = (NumStds > 0 &&
NumStdsWithPhoto >= Cfg_MIN_PHOTOS_TO_SHOW_AVERAGE);
- /***** Show photo *****/
- fprintf (Gbl.F.Out,"DegCod,Usr_StringsSexDB[Sex]);
-
+ Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
+ Pho_StrAvgPhotoDirs[Gbl.Stat.DegPhotos.TypeOfAverage],
+ Deg->DegCod,Usr_StringsSexDB[Sex]);
if (Fil_CheckIfPathExists (PathRelAvgPhoto))
- {
- sprintf (PhotoURL,"%s/%s/%s/%ld_%s.jpg",
- Cfg_HTTPS_URL_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
- Pho_StrAvgPhotoDirs[Gbl.Stat.DegPhotos.TypeOfAverage],
- Deg->DegCod,Usr_StringsSexDB[Sex]);
- fprintf (Gbl.F.Out,"%s\" style=\"width:%upx; height:%upx;\"",
- PhotoURL,PhotoWidth,PhotoHeight);
+ {
+ sprintf (PhotoURL,"%s/%s/%s/%ld_%s.jpg",
+ Cfg_HTTPS_URL_SWAD_PUBLIC,Cfg_FOLDER_PHOTO,
+ Pho_StrAvgPhotoDirs[Gbl.Stat.DegPhotos.TypeOfAverage],
+ Deg->DegCod,Usr_StringsSexDB[Sex]);
+ if (SeeOrPrint == Pho_DEGREES_SEE)
if (SeeOrPrint == Pho_DEGREES_SEE)
{
- sprintf (PhotoCaption,"%s
"
- "%d %s (%s)
"
- "%d %s (%d%%)",
- Deg->ShortName,
- NumStds,Txt_students_ABBREVIATION,Txt_SEX_PLURAL_abc[Sex],
- NumStdsWithPhoto,Txt_photos,
- NumStds > 0 ? (int) (((NumStdsWithPhoto * 100.0) / NumStds) + 0.5) :
- 0);
- fprintf (Gbl.F.Out," onmouseover=\"zoom(this,'%s',"%s");\" onmouseout=\"noZoom();\"",
- PhotoURL,PhotoCaption);
- }
- }
- else
- fprintf (Gbl.F.Out,"%s/usr_bl.jpg\""
- " style=\"width:%upx; height:%upx;\"",
- Gbl.Prefs.IconsURL,PhotoWidth,PhotoHeight);
+ /***** Hidden div to pass user's name to Javascript *****/
+ sprintf (PhotoCaption,"%s
"
+ "%d %s (%s)
"
+ "%d %s (%d%%)",
+ Deg->ShortName,
+ NumStds,Txt_students_ABBREVIATION,Txt_SEX_PLURAL_abc[Sex],
+ NumStdsWithPhoto,Txt_photos,
+ NumStds > 0 ? (int) (((NumStdsWithPhoto * 100.0) / NumStds) + 0.5) :
+ 0);
+ Act_SetUniqueId (IdCaption);
+ fprintf (Gbl.F.Out,""
+ "%s"
+ "
",
+ IdCaption,PhotoCaption);
+ }
+ }
+ }
+
+ /***** Show photo *****/
+ fprintf (Gbl.F.Out,"",
- Deg->ShortName);
+ fprintf (Gbl.F.Out,"%s/usr_bl.jpg\"",Gbl.Prefs.IconsURL);
+ fprintf (Gbl.F.Out," alt=\"%s\""
+ " style=\"width:%upx; height:%upx;\" />",
+ Deg->ShortName,
+ PhotoWidth,PhotoHeight);
/***** Caption *****/
if (SeeOrPrint == Pho_DEGREES_PRINT)
diff --git a/swad_string.c b/swad_string.c
index db0f6ab1..1cccfead 100644
--- a/swad_string.c
+++ b/swad_string.c
@@ -2230,46 +2230,6 @@ void Str_GetNextStringUntilComma (const char **StrSrc,char *StrDst,size_t MaxLen
*(Ptr+1) = '\0';
}
-/*****************************************************************************/
-/********** Replace special characters in a string for HTML codes ************/
-/*****************************************************************************/
-
-void Str_ReplaceSpecialCharByCodes (char *Str,unsigned long MaxLengthStr)
- {
- char *Ptr, *PtrSrc, *PtrDst, *PtrEndStr;
- int LengthSpecStrDst;
- unsigned long LengthStrDst = 0;
- char StrSpecialChar[256];
-
- /***** Make the conversion *****/
- for (Ptr = Str;
- *Ptr;)
- {
- if (*Ptr >= 32 && *Ptr <= 126) // If character is printable in english ==> is OK; else ==> convert to code
- {
- LengthStrDst++;
- Ptr++;
- }
- else
- {
- sprintf (StrSpecialChar,"%u;",(unsigned char) *Ptr);
- PtrEndStr = Str + strlen (Str);
- LengthSpecStrDst = strlen (StrSpecialChar);
- LengthStrDst += LengthSpecStrDst;
- if (LengthStrDst > MaxLengthStr)
- Lay_ShowErrorAndExit ("Not enough memory to convert the format of a string.");
- for (PtrSrc = PtrEndStr,
- PtrDst = PtrSrc + LengthSpecStrDst - 1;
- PtrSrc >= Ptr + 1;
- *PtrDst-- = *PtrSrc--); /* Copy backward from '\0' (included) */
- /* Copy to appropiate place the special character string */
- strncpy (Ptr,StrSpecialChar,LengthSpecStrDst);
- /* Increment pointer to character after ';' */
- Ptr += LengthSpecStrDst;
- }
- }
- }
-
/*****************************************************************************/
/***************** Replace several spaces of a string for one ****************/
/*****************************************************************************/
diff --git a/swad_string.h b/swad_string.h
index 3de6e1e7..0398f677 100644
--- a/swad_string.h
+++ b/swad_string.h
@@ -98,7 +98,6 @@ void Str_GetNextStringUntilSpace (const char **StrSrc,char *StrDst,size_t MaxLen
void Str_GetNextStringUntilSeparator (const char **StrSrc,char *StrDst,size_t MaxLength);
void Str_GetNextStringFromFileUntilSeparator (FILE *FileSrc,char *StrDst);
void Str_GetNextStringUntilComma (const char **StrSrc,char *StrDst,size_t MaxLength);
-void Str_ReplaceSpecialCharByCodes (char *Str,unsigned long MaxLengthStr);
void Str_ReplaceSeveralSpacesForOne (char *Str);
void Str_CopyStrChangingSpaces (const char *StringWithSpaces,char *StringWithoutSpaces,unsigned MaxLength);
long Str_ConvertStrCodToLongCod (const char *Str);
diff --git a/swad_user.c b/swad_user.c
index 994b2aa4..8af3e5bd 100644
--- a/swad_user.c
+++ b/swad_user.c
@@ -744,10 +744,6 @@ void Usr_RestrictLengthAndWriteName (const struct UsrData *UsrDat,unsigned MaxCh
Str_LimitLengthHTMLStr (FirstName,MaxChars);
Str_LimitLengthHTMLStr (Surnames,MaxChars);
- /***** Replace tildes, ñ, etc. by codes, because some browsers (i.e., IE5) don't show correctly tildes with AJAX *****/
- Str_ReplaceSpecialCharByCodes (FirstName,Usr_MAX_BYTES_NAME_SPEC_CHAR);
- Str_ReplaceSpecialCharByCodes (Surnames,2*Usr_MAX_BYTES_NAME_SPEC_CHAR+1);
-
/***** Write shorted firstname, then return, then shorted surnames *****/
fprintf (Gbl.F.Out,"%s
%s",FirstName,Surnames);
}