diff --git a/js/swad15.111.js b/js/swad15.111.js index 2ae166346..13aa5537c 100644 --- a/js/swad15.111.js +++ b/js/swad15.111.js @@ -20,6 +20,8 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ +"use strict"; + // Global variable (string) used to write HTML var Gbl_HTMLContent; diff --git a/swad_action.c b/swad_action.c index 6789096be..0384674d7 100644 --- a/swad_action.c +++ b/swad_action.c @@ -4311,36 +4311,52 @@ char *Act_GetActionTextFromDB (long ActCod,char *Txt) /******************************** Start a form *******************************/ /*****************************************************************************/ -void Act_FormStart (Act_Action_t NextAction) - { - Gbl.NumForm++; // Initialized to -1. The first time it is incremented, it will be equal to 0 - sprintf (Gbl.FormId,"form_%d",Gbl.NumForm); - Act_FormStartInternal (NextAction,true,Gbl.FormId,NULL); // Do put now parameter location (if no open session) - } - void Act_FormGoToStart (Act_Action_t NextAction) { - Gbl.NumForm++; // Initialized to -1. The first time it is incremented, it will be equal to 0 - sprintf (Gbl.FormId,"form_%d",Gbl.NumForm); - Act_FormStartInternal (NextAction,false,Gbl.FormId,NULL); // Do not put now parameter location + Gbl.Form.Num++; // Initialized to -1. The first time it is incremented, it will be equal to 0 + sprintf (Gbl.Form.Id,"form_%d",Gbl.Form.Num); + Act_FormStartInternal (NextAction,false,Gbl.Form.Id,NULL); // Do not put now parameter location + } + +void Act_FormStart (Act_Action_t NextAction) + { + Gbl.Form.Num++; // Initialized to -1. The first time it is incremented, it will be equal to 0 + sprintf (Gbl.Form.Id,"form_%d",Gbl.Form.Num); + Act_FormStartInternal (NextAction,true,Gbl.Form.Id,NULL); // Do put now parameter location (if no open session) + } + +void Act_FormStartUnique (Act_Action_t NextAction) + { + Gbl.Form.Num++; // Initialized to -1. The first time it is incremented, it will be equal to 0 + sprintf (Gbl.Form.UniqueId,"form_%s_%d", + Gbl.UniqueNameEncrypted,Gbl.Form.Num); + Act_FormStartInternal (NextAction,true,Gbl.Form.UniqueId,NULL); // Do put now parameter location (if no open session) } void Act_FormStartAnchor (Act_Action_t NextAction,const char *Anchor) { - Gbl.NumForm++; // Initialized to -1. The first time it is incremented, it will be equal to 0 - sprintf (Gbl.FormId,"form_%d",Gbl.NumForm); - Act_FormStartInternal (NextAction,true,Gbl.FormId,Anchor); // Do put now parameter location (if no open session) + Gbl.Form.Num++; // Initialized to -1. The first time it is incremented, it will be equal to 0 + sprintf (Gbl.Form.Id,"form_%d",Gbl.Form.Num); + Act_FormStartInternal (NextAction,true,Gbl.Form.Id,Anchor); // Do put now parameter location (if no open session) + } + +void Act_FormStartUniqueAnchor (Act_Action_t NextAction,const char *Anchor) + { + Gbl.Form.Num++; // Initialized to -1. The first time it is incremented, it will be equal to 0 + sprintf (Gbl.Form.UniqueId,"form_%s_%d", + Gbl.UniqueNameEncrypted,Gbl.Form.Num); + Act_FormStartInternal (NextAction,true,Gbl.Form.UniqueId,Anchor); // Do put now parameter location (if no open session) } void Act_FormStartId (Act_Action_t NextAction,const char *Id) { - Gbl.NumForm++; // Initialized to -1. The first time it is incremented, it will be equal to 0 + Gbl.Form.Num++; // Initialized to -1. The first time it is incremented, it will be equal to 0 Act_FormStartInternal (NextAction,true,Id,NULL); // Do put now parameter location (if no open session) } void Act_FormStartIdAnchor (Act_Action_t NextAction,const char *Id,const char *Anchor) { - Gbl.NumForm++; // Initialized to -1. The first time it is incremented, it will be equal to 0 + Gbl.Form.Num++; // Initialized to -1. The first time it is incremented, it will be equal to 0 Act_FormStartInternal (NextAction,true,Id,Anchor); // Do put now parameter location (if no open session) } @@ -4350,7 +4366,7 @@ static void Act_FormStartInternal (Act_Action_t NextAction,bool PutParameterLoca extern const char *Txt_STR_LANG_ID[1+Txt_NUM_LANGUAGES]; char Params[256+256+Ses_LENGTH_SESSION_ID+256]; - if (!Gbl.InsideForm) + if (!Gbl.Form.Inside) { /* Start form */ fprintf (Gbl.F.Out,"
"); - Gbl.InsideForm = false; + Gbl.Form.Inside = false; } } @@ -4439,7 +4455,12 @@ void Act_FormEnd (void) void Act_LinkFormSubmit (const char *Title,const char *LinkStyle) { - Act_LinkFormSubmitId (Title,LinkStyle,Gbl.FormId); + Act_LinkFormSubmitId (Title,LinkStyle,Gbl.Form.Id); + } + +void Act_LinkFormSubmitUnique (const char *Title,const char *LinkStyle) + { + Act_LinkFormSubmitId (Title,LinkStyle,Gbl.Form.UniqueId); } // Title can be NULL @@ -4474,9 +4495,9 @@ void Act_LinkFormSubmitAnimated (const char *Title,const char *LinkStyle) "document.getElementById('updating_%d').style.display='';" // Icon to be shown on click "document.getElementById('%s').submit();" "return false;\">", - Gbl.NumForm, - Gbl.NumForm, - Gbl.FormId); + Gbl.Form.Num, + Gbl.Form.Num, + Gbl.Form.Id); } /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 025d88201..e2d46e086 100644 --- a/swad_action.h +++ b/swad_action.h @@ -1425,14 +1425,17 @@ const char *Act_GetSubtitleAction (Act_Action_t Action); void Act_GetBreadcrumbStrForAction (Act_Action_t Action,bool HTML,char *BreadcrumbStr); char *Act_GetActionTextFromDB (long ActCod,char *Txt); -void Act_FormStart (Act_Action_t NextAction); void Act_FormGoToStart (Act_Action_t NextAction); +void Act_FormStart (Act_Action_t NextAction); +void Act_FormStartUnique (Act_Action_t NextAction); void Act_FormStartAnchor (Act_Action_t NextAction,const char *Anchor); +void Act_FormStartUniqueAnchor (Act_Action_t NextAction,const char *Anchor); void Act_FormStartId (Act_Action_t NextAction,const char *Id); void Act_FormStartIdAnchor (Act_Action_t NextAction,const char *Id,const char *Anchor); void Act_SetParamsForm (char *Params,Act_Action_t NextAction,bool PutParameterLocationIfNoSesion); void Act_FormEnd (void); void Act_LinkFormSubmit (const char *Title,const char *LinkStyle); +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); diff --git a/swad_assignment.c b/swad_assignment.c index 25866f9f9..9205dab77 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -375,7 +375,7 @@ static void Asg_WriteAsgAuthor (struct Assignment *Asg) /***** Show photo *****/ Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO15x20",Pho_ZOOM,NULL); + "PHOTO15x20",Pho_ZOOM,false); /***** Write name *****/ strcpy (FirstName,UsrDat.FirstName); diff --git a/swad_attendance.c b/swad_attendance.c index 605e15835..b72cda7b4 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -414,7 +414,7 @@ static void Att_WriteAttEventAuthor (struct AttendanceEvent *Att) /***** Show photo *****/ Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO15x20",Pho_ZOOM,NULL); + "PHOTO15x20",Pho_ZOOM,false); /***** Write name *****/ strcpy (FirstName,UsrDat.FirstName); @@ -1973,7 +1973,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO45x60",Pho_ZOOM,NULL); + "PHOTO45x60",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); } @@ -3188,7 +3188,7 @@ static void Att_WriteRowStdSeveralAttEvents (unsigned NumStd,struct UsrData *Usr ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); } @@ -3326,7 +3326,7 @@ static void Att_ListAttEventsForAStd (unsigned NumStd,struct UsrData *UsrDat) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); /***** Write user's ID ******/ diff --git a/swad_banner.c b/swad_banner.c index ac9543ce5..d643a0425 100644 --- a/swad_banner.c +++ b/swad_banner.c @@ -359,7 +359,7 @@ static void Ban_ListBannersForEdition (void) " maxlength=\"%u\" value=\"%s\"" " class=\"INPUT_SHORT_NAME\"" " onchange=\"document.getElementById('%s').submit();\" />", - Ban_MAX_LENGTH_SHORT_NAME,Ban->ShortName,Gbl.FormId); + Ban_MAX_LENGTH_SHORT_NAME,Ban->ShortName,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -371,7 +371,7 @@ static void Ban_ListBannersForEdition (void) " maxlength=\"%u\" value=\"%s\"" " class=\"INPUT_FULL_NAME\"" " onchange=\"document.getElementById('%s').submit();\" />", - Ban_MAX_LENGTH_FULL_NAME,Ban->FullName,Gbl.FormId); + Ban_MAX_LENGTH_FULL_NAME,Ban->FullName,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -382,7 +382,7 @@ static void Ban_ListBannersForEdition (void) fprintf (Gbl.F.Out,"", - Ban_MAX_LENGTH_IMAGE,Ban->Img,Gbl.FormId); + Ban_MAX_LENGTH_IMAGE,Ban->Img,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -394,7 +394,7 @@ static void Ban_ListBannersForEdition (void) " maxlength=\"%u\" value=\"%s\"" " class=\"INPUT_WWW\"" " onchange=\"document.getElementById('%s').submit();\" />", - Cns_MAX_LENGTH_WWW,Ban->WWW,Gbl.FormId); + Cns_MAX_LENGTH_WWW,Ban->WWW,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_centre.c b/swad_centre.c index d99e93fde..2f917ea76 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -351,7 +351,7 @@ static void Ctr_Configuration (bool PrintView) Act_FormStart (ActChgCtrPhoAtt); fprintf (Gbl.F.Out,""); @@ -1139,7 +1139,7 @@ void Ctr_WriteSelectorOfCentre (void) fprintf (Gbl.F.Out,"", - Gbl.FormId); + Gbl.Form.Id); for (NumIns = 0; NumIns < Gbl.Inss.Num; NumIns++) @@ -1292,7 +1292,7 @@ static void Ctr_ListCentresForEdition (void) Ctr_PutParamOtherCtrCod (Ctr->CtrCod); fprintf (Gbl.F.Out,"", - Gbl.FormId, + Gbl.Form.Id, (unsigned) Ctr_GetStatusBitsFromStatusTxt (Ctr_STATUS_PENDING), Txt_CENTRE_STATUS[Ctr_STATUS_PENDING], (unsigned) Ctr_GetStatusBitsFromStatusTxt (Ctr_STATUS_ACTIVE), diff --git a/swad_changelog.h b/swad_changelog.h index d0a55eb5d..16b30fa8e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -121,18 +121,21 @@ // TODO: Limit text of post/comment in social timeline to 1000 characters? Limit textarea to 20 lines not resizeable. // TODO: Sinchronize timeline in other actions // TODO: Optimize Javascript not concatenating big strings in new timeline +// TODO: Do not put divs to get new publishings in user's timeline /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.112 (2016-01-14)" +#define Log_PLATFORM_VERSION "SWAD 15.113 (2016-01-14)" #define CSS_FILE "swad15.111.css" #define JS_FILE "swad15.111.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.113: Jan 14, 2016 Code refactoring related to forms with unique identifiers. + Use unique identifiers in forms of lists of connected users. (192680 lines) Version 15.112: Jan 14, 2016 Fixed bugs in user's timeline. All forms in social timeline must have unique identifiers. (192676 lines) Version 15.111: Jan 14, 2016 Fixed bug in user's timeline. diff --git a/swad_connected.c b/swad_connected.c index 40874ad65..9ef273b24 100644 --- a/swad_connected.c +++ b/swad_connected.c @@ -672,12 +672,13 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColum /***** Write message with number of users not listed *****/ if (Gbl.Usrs.Connected.NumUsrsToList < Gbl.Usrs.Connected.NumUsrs) { - sprintf (Gbl.FormId,"form_con_%d",++Gbl.NumFormConnectedUsrs); fprintf (Gbl.F.Out,"" ""); - Act_FormStartId (ActLstCon,Gbl.FormId); + Act_FormStartUnique (ActLstCon); // Must be unique because + // the list of connected users + // is dynamically updated via AJAX Sco_PutParamScope (Sco_SCOPE_CRS); - Act_LinkFormSubmitId (Txt_Connected_users,The_ClassConnected[Gbl.Prefs.Theme],Gbl.FormId); + Act_LinkFormSubmitUnique (Txt_Connected_users,The_ClassConnected[Gbl.Prefs.Theme]); fprintf (Gbl.F.Out,"\"%s\"" "", @@ -1072,14 +1073,15 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role) "", Gbl.RowEvenOdd); - sprintf (Gbl.FormId,"form_con_%d",++Gbl.NumFormConnectedUsrs); - Act_FormStartId (ActSeePubPrf,Gbl.FormId); + Act_FormStartUnique (ActSeePubPrf); // Must be unique because + // the list of connected users + // is dynamically updated via AJAX Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); - Act_LinkFormSubmitId (UsrDat.FullName,NULL,Gbl.FormId); + Act_LinkFormSubmitUnique (UsrDat.FullName,NULL); ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -1088,12 +1090,12 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role) fprintf (Gbl.F.Out,"", Font,Gbl.RowEvenOdd); - sprintf (Gbl.FormId,"form_con_%d",++Gbl.NumFormConnectedUsrs); - Act_FormStartId ((Role == Rol_STUDENT) ? ActSeeRecOneStd : - ActSeeRecOneTch, - Gbl.FormId); + Act_FormStartUnique ((Role == Rol_STUDENT) ? ActSeeRecOneStd : + ActSeeRecOneTch); // Must be unique because + // the list of connected users + // is dynamically updated via AJAX Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); - Act_LinkFormSubmitId (Txt_View_record_for_this_course,Font,Gbl.FormId); + Act_LinkFormSubmitUnique (Txt_View_record_for_this_course,Font); Usr_RestrictLengthAndWriteName (&UsrDat,8); fprintf (Gbl.F.Out,""); Act_FormEnd (); @@ -1271,7 +1273,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); /***** Write full name and link *****/ diff --git a/swad_country.c b/swad_country.c index 8a40234cd..6234cb6a9 100644 --- a/swad_country.c +++ b/swad_country.c @@ -275,7 +275,7 @@ static void Cty_Configuration (bool PrintView) Act_FormStart (ActChgCtyMapAtt); fprintf (Gbl.F.Out,""); @@ -1053,7 +1053,7 @@ void Cty_WriteSelectorOfCountry (void) fprintf (Gbl.F.Out," 0) fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\"", - Gbl.FormId); + Gbl.Form.Id); else fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out,">" "" "", - Gbl.FormId, + Gbl.Form.Id, (unsigned) Crs_GetStatusBitsFromStatusTxt (Crs_STATUS_PENDING), Txt_COURSE_STATUS[Crs_STATUS_PENDING], (unsigned) Crs_GetStatusBitsFromStatusTxt (Crs_STATUS_ACTIVE), diff --git a/swad_date.c b/swad_date.c index 25498e986..5129b740a 100644 --- a/swad_date.c +++ b/swad_date.c @@ -334,7 +334,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Id,ParamName,Id,Id); if (SubmitFormOnChange) fprintf (Gbl.F.Out,"document.getElementById('%s').submit();", - Gbl.FormId); + Gbl.Form.Id); fprintf (Gbl.F.Out,"\">"); for (Year = FirstYear; Year <= LastYear; @@ -353,7 +353,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Id,ParamName,Id,Id); if (SubmitFormOnChange) fprintf (Gbl.F.Out,"document.getElementById('%s').submit();", - Gbl.FormId); + Gbl.Form.Id); fprintf (Gbl.F.Out,"\">"); for (Month = 1; Month <= 12; @@ -370,7 +370,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Id,ParamName,Id); if (SubmitFormOnChange) fprintf (Gbl.F.Out,"document.getElementById('%s').submit();", - Gbl.FormId); + Gbl.Form.Id); fprintf (Gbl.F.Out,"\">"); for (Day = 1; Day <= 31; @@ -387,7 +387,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Id,ParamName,Id); if (SubmitFormOnChange) fprintf (Gbl.F.Out,"document.getElementById('%s').submit();", - Gbl.FormId); + Gbl.Form.Id); fprintf (Gbl.F.Out,"\">"); for (Hour = 0; Hour <= 23; @@ -404,7 +404,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Id,ParamName,Id); if (SubmitFormOnChange) fprintf (Gbl.F.Out,"document.getElementById('%s').submit();", - Gbl.FormId); + Gbl.Form.Id); fprintf (Gbl.F.Out,"\">"); for (Minute = 0; Minute <= 59; @@ -421,7 +421,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, Id,ParamName,Id); if (SubmitFormOnChange) fprintf (Gbl.F.Out,"document.getElementById('%s').submit();", - Gbl.FormId); + Gbl.Form.Id); fprintf (Gbl.F.Out,"\">"); for (Second = 0; Second <= 59; @@ -581,7 +581,7 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, Id,Id,Id); if (SubmitFormOnChange) fprintf (Gbl.F.Out,"document.getElementById('%s').submit();", - Gbl.FormId); + Gbl.Form.Id); fprintf (Gbl.F.Out,"\""); if (Disabled) fprintf (Gbl.F.Out," disabled=\"disabled\""); @@ -605,7 +605,7 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, Id,Id,Id); if (SubmitFormOnChange) fprintf (Gbl.F.Out,"document.getElementById('%s').submit();", - Gbl.FormId); + Gbl.Form.Id); fprintf (Gbl.F.Out,"\""); if (Disabled) fprintf (Gbl.F.Out," disabled=\"disabled\""); @@ -628,7 +628,7 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, Id,Id); if (SubmitFormOnChange) fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\"", - Gbl.FormId); + Gbl.Form.Id); if (Disabled) fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out,">"); diff --git a/swad_degree.c b/swad_degree.c index 1d206d7ae..06090e832 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -593,7 +593,7 @@ static void Deg_WriteSelectorOfDegree (void) fprintf (Gbl.F.Out,"", - Gbl.FormId); + Gbl.Form.Id); for (NumCtr = 0; NumCtr < Gbl.Ctrs.Num; NumCtr++) @@ -1526,7 +1526,7 @@ static void Deg_ListDegreesForEdition (void) " maxlength=\"%u\" value=\"%s\"" " class=\"INPUT_SHORT_NAME\"" " onchange=\"document.getElementById('%s').submit();\" />", - Deg_MAX_LENGTH_DEGREE_SHORT_NAME,Deg->ShortName,Gbl.FormId); + Deg_MAX_LENGTH_DEGREE_SHORT_NAME,Deg->ShortName,Gbl.Form.Id); Act_FormEnd (); } else @@ -1543,7 +1543,7 @@ static void Deg_ListDegreesForEdition (void) " maxlength=\"%u\" value=\"%s\"" " class=\"INPUT_FULL_NAME\"" " onchange=\"document.getElementById('%s').submit();\" />", - Deg_MAX_LENGTH_DEGREE_FULL_NAME,Deg->FullName,Gbl.FormId); + Deg_MAX_LENGTH_DEGREE_FULL_NAME,Deg->FullName,Gbl.Form.Id); Act_FormEnd (); } else @@ -1559,7 +1559,7 @@ static void Deg_ListDegreesForEdition (void) fprintf (Gbl.F.Out,"", - Gbl.FormId); + Gbl.Form.Id); for (Year = 0; Year <= Deg_MAX_YEARS_PER_DEGREE; Year++) @@ -1614,7 +1614,7 @@ static void Deg_ListDegreesForEdition (void) Deg_PutParamOtherDegCod (Deg->DegCod); fprintf (Gbl.F.Out,"", - Gbl.FormId, + Gbl.Form.Id, (unsigned) Deg_GetStatusBitsFromStatusTxt (Deg_STATUS_PENDING), Txt_DEGREE_STATUS[Deg_STATUS_PENDING], (unsigned) Deg_GetStatusBitsFromStatusTxt (Deg_STATUS_ACTIVE), diff --git a/swad_department.c b/swad_department.c index 65753a5c2..a06b5475b 100644 --- a/swad_department.c +++ b/swad_department.c @@ -531,7 +531,7 @@ static void Dpt_ListDepartmentsForEdition (void) fprintf (Gbl.F.Out,"", - Gbl.FormId); + Gbl.Form.Id); for (NumTipGrpAux = 0; NumTipGrpAux < Gbl.CurrentCrs.Grps.GrpTypes.Num; NumTipGrpAux++) @@ -1393,7 +1393,7 @@ static void Grp_ListGroupsForEdition (void) fprintf (Gbl.F.Out,"", - MAX_LENGTH_GROUP_NAME,Grp->GrpName,Gbl.FormId); + MAX_LENGTH_GROUP_NAME,Grp->GrpName,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -1405,7 +1405,7 @@ static void Grp_ListGroupsForEdition (void) " size=\"3\" maxlength=\"10\" value=\""); Grp_WriteMaxStdsGrp (Grp->MaxStudents); fprintf (Gbl.F.Out,"\" onchange=\"document.getElementById('%s').submit();\" />", - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -4179,7 +4179,7 @@ void Grp_ShowSelectorWhichGrps (void) fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />" " %s" "", - Gbl.FormId,Txt_Show_WHICH_groups[WhichGrps]); + Gbl.Form.Id,Txt_Show_WHICH_groups[WhichGrps]); } fprintf (Gbl.F.Out,"" ""); diff --git a/swad_holiday.c b/swad_holiday.c index 2bf57b69e..abc05469e 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -508,7 +508,7 @@ static void Hld_ListHolidaysForEdition (void) fprintf (Gbl.F.Out,"", - Gbl.FormId); + Gbl.Form.Id); for (HolidayType = (Hld_HolidayType_t) 0; HolidayType < Hld_NUM_TYPES_HOLIDAY; HolidayType++) @@ -574,7 +574,7 @@ static void Hld_ListHolidaysForEdition (void) fprintf (Gbl.F.Out,"", - Hld_MAX_LENGTH_HOLIDAY_NAME,Hld->Name,Gbl.FormId); + Hld_MAX_LENGTH_HOLIDAY_NAME,Hld->Name,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_info.c b/swad_info.c index bf1ba8625..3e775931b 100644 --- a/swad_info.c +++ b/swad_info.c @@ -440,7 +440,7 @@ static void Inf_PutFormToForceStdsToReadInfo (Inf_InfoType_t InfoType,bool MustB fprintf (Gbl.F.Out," name=\"MustBeRead\" value=\"Y\"" " onchange=\"document.getElementById('%s').submit();\" />" " %s", - Gbl.FormId, + Gbl.Form.Id, Txt_Force_students_to_read_this_information); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -465,7 +465,7 @@ static void Inf_PutFormToConfirmIHaveReadInfo (Inf_InfoType_t InfoType) fprintf (Gbl.F.Out," name=\"IHaveRead\" value=\"Y\"" " onchange=\"document.getElementById('%s').submit();\" />" "%s", - Gbl.FormId, + Gbl.Form.Id, Txt_I_have_read_this_information); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -952,7 +952,7 @@ void Inf_FormsToSelSendInfo (void) if (InfoSrc == InfoSrcSelected) fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />", - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); diff --git a/swad_institution.c b/swad_institution.c index 725953652..ffb2e9d92 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -1055,7 +1055,7 @@ void Ins_WriteSelectorOfInstitution (void) fprintf (Gbl.F.Out,"", - Gbl.FormId, + Gbl.Form.Id, (unsigned) Ins_GetStatusBitsFromStatusTxt (Ins_STATUS_PENDING), Txt_INSTITUTION_STATUS[Ins_STATUS_PENDING], (unsigned) Ins_GetStatusBitsFromStatusTxt (Ins_STATUS_ACTIVE), diff --git a/swad_layout.c b/swad_layout.c index 7424b7c9a..c9054b549 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1073,8 +1073,8 @@ void Lay_PutCalculateIconWithText (const char *Alt,const char *Text) " %s" "" "", - Gbl.NumForm,Gbl.Prefs.IconsURL,Alt,Text, - Gbl.NumForm,Gbl.Prefs.IconsURL,Alt,Text, + Gbl.Form.Num,Gbl.Prefs.IconsURL,Alt,Text, + Gbl.Form.Num,Gbl.Prefs.IconsURL,Alt,Text, Text); } diff --git a/swad_link.c b/swad_link.c index ac287f944..d013e6b55 100644 --- a/swad_link.c +++ b/swad_link.c @@ -356,7 +356,7 @@ static void Lnk_ListLinksForEdition (void) " class=\"INPUT_SHORT_NAME\"" " onchange=\"document.getElementById('%s').submit();\" />", Lnk_MAX_LENGTH_LINK_SHORT_NAME,Lnk->ShortName, - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -369,7 +369,7 @@ static void Lnk_ListLinksForEdition (void) " class=\"INPUT_FULL_NAME\"" " onchange=\"document.getElementById('%s').submit();\" />", Lnk_MAX_LENGTH_LINK_FULL_NAME,Lnk->FullName, - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -382,7 +382,7 @@ static void Lnk_ListLinksForEdition (void) " class=\"INPUT_WWW\"" " onchange=\"document.getElementById('%s').submit();\" />", Cns_MAX_LENGTH_WWW,Lnk->WWW, - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_mail.c b/swad_mail.c index 2f5bc6fc4..f04fd3bbd 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -424,7 +424,7 @@ static void Mai_ListMailDomainsForEdition (void) " size=\"15\" maxlength=\"%u\" value=\"%s\"" " onchange=\"document.getElementById('%s').submit();\" />", Mai_MAX_LENGTH_MAIL_DOMAIN,Mai->Domain, - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -436,7 +436,7 @@ static void Mai_ListMailDomainsForEdition (void) " size=\"40\" maxlength=\"%u\" value=\"%s\"" " onchange=\"document.getElementById('%s').submit();\" />", Mai_MAX_LENGTH_MAIL_INFO,Mai->Info, - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); diff --git a/swad_mark.c b/swad_mark.c index ede13eb95..b6050515d 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -143,7 +143,7 @@ void Mrk_GetAndWriteNumRowsHeaderAndFooter (Brw_FileType_t FileType, Mrk_HeadOrFootStr[Brw_HEADER],Marks.Header, Gbl.FileBrowser.InputStyle, Gbl.RowEvenOdd, - Gbl.FormId); + Gbl.Form.Id); Brw_ParamListFiles (FileType,PathInTree,FileName); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -170,7 +170,7 @@ void Mrk_GetAndWriteNumRowsHeaderAndFooter (Brw_FileType_t FileType, Mrk_HeadOrFootStr[Brw_FOOTER],Marks.Footer, Gbl.FileBrowser.InputStyle, Gbl.RowEvenOdd, - Gbl.FormId); + Gbl.Form.Id); Brw_ParamListFiles (FileType,PathInTree,FileName); Act_FormEnd (); fprintf (Gbl.F.Out,""); diff --git a/swad_message.c b/swad_message.c index 91425e189..e619488cc 100644 --- a/swad_message.c +++ b/swad_message.c @@ -469,7 +469,7 @@ static void Msg_ShowOneUniqueRecipient (void) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL); Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); /****** Write user's IDs ******/ fprintf (Gbl.F.Out,"
", @@ -2973,7 +2973,7 @@ void Msg_WriteMsgAuthor (struct UsrData *UsrDat, ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO30x40",Pho_ZOOM,NULL); + "PHOTO30x40",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); /***** Second column with user name (if author has a web page, put a link to it) *****/ @@ -3136,7 +3136,7 @@ static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted) ShowPhoto = (Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL)); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); /***** Write user's name *****/ fprintf (Gbl.F.Out,"" @@ -3282,7 +3282,7 @@ static void Msg_WriteMsgTo (Msg_TypeOfMessages_t TypeOfMessages,long MsgCod) false); Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); /* Write user's name */ fprintf (Gbl.F.Out,"" @@ -3655,7 +3655,7 @@ void Msg_ListBannedUsrs (void) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); /* Write user's full name */ diff --git a/swad_network.c b/swad_network.c index 711a71852..3ad3987dd 100644 --- a/swad_network.c +++ b/swad_network.c @@ -335,7 +335,7 @@ void Net_ShowFormMyWebsAndSocialNets (void) " style=\"width:500px;\" maxlength=\"%u\" value=\"%s\"" " onchange=\"document.getElementById('%s').submit();\" />", Cns_MAX_LENGTH_URL,URL, - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_notification.c b/swad_notification.c index 6945a90e9..cc051517b 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -616,7 +616,7 @@ static void Ntf_WriteFormAllNotifications (bool AllNotifications) fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />" " %s", - Gbl.FormId, + Gbl.Form.Id, Txt_Show_all_notifications); Act_FormEnd (); fprintf (Gbl.F.Out,"
"); @@ -637,7 +637,7 @@ static bool Ntf_GetAllNotificationsFromForm (void) /*****************************************************************************/ /*********** Put form to go to an action depending on the event **************/ /*****************************************************************************/ -// Return the value of Gbl.InsideForm (true if form is started) +// Return the value of Gbl.Form.Inside (true if form is started) static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent, long CrsCod,long Cod) @@ -712,7 +712,7 @@ static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent, } /***** Parameter to go to another course/degree/centre/institution *****/ - if (Gbl.InsideForm) + if (Gbl.Form.Inside) { if (CrsCod > 0) // Course specified { @@ -736,7 +736,7 @@ static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent, } } - return Gbl.InsideForm; + return Gbl.Form.Inside; } /*****************************************************************************/ diff --git a/swad_photo.c b/swad_photo.c index a28ae926a..9f4e9747d 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -312,7 +312,8 @@ void Pho_ReqPhoto (const struct UsrData *UsrDat,bool PhotoExists,const char *Pho fprintf (Gbl.F.Out,"" ""); // if (PhotoExists) - Pho_ShowUsrPhoto (UsrDat,PhotoURL,"PHOTO186x248",Pho_NO_ZOOM,NULL); + Pho_ShowUsrPhoto (UsrDat,PhotoURL, + "PHOTO186x248",Pho_NO_ZOOM,false); Lay_ShowAlert (Lay_INFO,Txt_You_can_send_a_file_with_an_image_in_jpg_format_); fprintf (Gbl.F.Out,"" ""); @@ -550,7 +551,7 @@ void Pho_ReceivePhotoAndDetectFaces (bool ItsMe,const struct UsrData *UsrDat) Lay_ShowErrorAndExit ("Can not read text file with coordinates of detected faces."); /***** Read file with coordinates for image map and compute the number of faces *****/ - NumLastForm = Gbl.NumForm; + NumLastForm = Gbl.Form.Num; while (!feof (FileTxtMap)) { if (fscanf (FileTxtMap,"%u %u %u %u %s\n",&X,&Y,&Radius,&BackgroundCode,StrFileName) != 5) // Example of StrFileName = "4924a838630e_016" @@ -1028,13 +1029,13 @@ void Pho_UpdatePhotoName (struct UsrData *UsrDat) void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, const char *ClassPhoto,Pho_Zoom_t Zoom, - const char *Id) + bool FormUnique) { 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]; bool PhotoExists; - bool PutLinkToPublicProfile = !Gbl.InsideForm && // Only if not inside another form + bool PutLinkToPublicProfile = !Gbl.Form.Inside && // Only if not inside another form Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW; // Only in main window bool PutZoomCode = PhotoURL && // Photo exists Zoom == Pho_ZOOM && // Make zoom @@ -1049,13 +1050,13 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, /***** Start form to go to public profile *****/ if (PutLinkToPublicProfile) { - if (Id) - Act_FormStartId (ActSeePubPrf,Id); + if (FormUnique) + Act_FormStartUnique (ActSeePubPrf); else Act_FormStart (ActSeePubPrf); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - if (Id) - Act_LinkFormSubmitId (NULL,NULL,Id); + if (FormUnique) + Act_LinkFormSubmitUnique (NULL,NULL); else Act_LinkFormSubmit (NULL,NULL); } @@ -1570,7 +1571,7 @@ static void Pho_PutSelectorForTypeOfAvg (void) Usr_PutParamColsClassPhoto (); fprintf (Gbl.F.Out,"", - Gbl.FormId); + Gbl.Form.Id); for (PhoSi = (Pho_HowComputePhotoSize_t) 0; PhoSi < Pho_NUM_HOW_COMPUTE_PHOTO_SIZES; PhoSi++) @@ -1708,7 +1709,7 @@ static void Pho_PutSelectorForHowOrderDegrees (void) Usr_PutParamColsClassPhoto (); fprintf (Gbl.F.Out,"", - Plg_MAX_LENGTH_PLUGIN_NAME,Plg->Name,Gbl.FormId); + Plg_MAX_LENGTH_PLUGIN_NAME,Plg->Name,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -412,7 +412,7 @@ static void Plg_ListPluginsForEdition (void) fprintf (Gbl.F.Out,"", - Plg_MAX_LENGTH_PLUGIN_DESCRIPTION,Plg->Description,Gbl.FormId); + Plg_MAX_LENGTH_PLUGIN_DESCRIPTION,Plg->Description,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -423,7 +423,7 @@ static void Plg_ListPluginsForEdition (void) fprintf (Gbl.F.Out,"", - Plg_MAX_LENGTH_PLUGIN_LOGO,Plg->Logo,Gbl.FormId); + Plg_MAX_LENGTH_PLUGIN_LOGO,Plg->Logo,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -434,7 +434,7 @@ static void Plg_ListPluginsForEdition (void) fprintf (Gbl.F.Out,"", - Plg_MAX_LENGTH_PLUGIN_APP_KEY,Plg->AppKey,Gbl.FormId); + Plg_MAX_LENGTH_PLUGIN_APP_KEY,Plg->AppKey,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -445,7 +445,7 @@ static void Plg_ListPluginsForEdition (void) fprintf (Gbl.F.Out,"", - Cns_MAX_LENGTH_WWW,Plg->URL,Gbl.FormId); + Cns_MAX_LENGTH_WWW,Plg->URL,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -456,7 +456,7 @@ static void Plg_ListPluginsForEdition (void) fprintf (Gbl.F.Out,"", - Cns_MAX_LENGTH_IP,Plg->IP,Gbl.FormId); + Cns_MAX_LENGTH_IP,Plg->IP,Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_preference.c b/swad_preference.c index 25cceaae2..1a66931d0 100644 --- a/swad_preference.c +++ b/swad_preference.c @@ -244,7 +244,7 @@ void Pre_PutSelectorToSelectLanguage (void) fprintf (Gbl.F.Out,"", - Gbl.FormId); + Gbl.Form.Id); for (Vis = (Rec_VisibilityRecordFields_t) 0; Vis < (Rec_VisibilityRecordFields_t) Rec_NUM_TYPES_VISIBILITY; Vis++) @@ -1382,7 +1382,7 @@ static void Rec_WriteFormShowOfficeHours (bool ShowOfficeHours,const char *ListU " class=\"ICON20x20\" />" " %s" "", - Gbl.FormId, + Gbl.Form.Id, Gbl.Prefs.IconsURL, Txt_Show_office_hours, Txt_Show_office_hours, @@ -2075,7 +2075,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView, break; } - PutFormLinks = !Gbl.InsideForm && // Only if not inside another form + PutFormLinks = !Gbl.Form.Inside && // Only if not inside another form Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW; // Only in main window /***** Start frame *****/ @@ -2136,7 +2136,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView, Rec_C3_TOP); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO186x248",Pho_NO_ZOOM,NULL); + "PHOTO186x248",Pho_NO_ZOOM,false); fprintf (Gbl.F.Out,"" ""); @@ -3376,7 +3376,7 @@ void Rec_ShowFormMyInsCtrDpt (void) fprintf (Gbl.F.Out,"" "" @@ -3461,7 +3461,7 @@ void Rec_ShowFormMyInsCtrDpt (void) fprintf (Gbl.F.Out,"" "" @@ -3545,7 +3545,7 @@ void Rec_ShowFormMyInsCtrDpt (void) " onchange=\"document.getElementById('%s').submit();\" />", Cns_MAX_LENGTH_STRING, Gbl.Usrs.Me.UsrDat.Tch.Office, - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,"" ""); @@ -3565,7 +3565,7 @@ void Rec_ShowFormMyInsCtrDpt (void) " onchange=\"document.getElementById('%s').submit();\" />", Usr_MAX_LENGTH_PHONE, Gbl.Usrs.Me.UsrDat.Tch.OfficePhone, - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_role.c b/swad_role.c index 68dae7033..acb380c92 100644 --- a/swad_role.c +++ b/swad_role.c @@ -293,7 +293,7 @@ void Rol_PutFormToChangeMyRole (bool FormInHead) if (FormInHead) fprintf (Gbl.F.Out," style=\"width:130px;\""); fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\">", - Gbl.FormId); + Gbl.Form.Id); for (Role = Rol__GUEST_; Role < Rol_NUM_ROLES; Role++) diff --git a/swad_scope.c b/swad_scope.c index f3c00c7cc..fa72fc5e9 100644 --- a/swad_scope.c +++ b/swad_scope.c @@ -87,7 +87,7 @@ void Sco_PutSelectorScope (bool SendOnChange) fprintf (Gbl.F.Out,""); @@ -1910,7 +1897,6 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom, bool IAmTheAuthor; bool ShowPhoto = false; char PhotoURL[PATH_MAX+1]; - char IdForm[Soc_MAX_LENGTH_ID]; if (ShowCommentAlone) { @@ -1942,11 +1928,10 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom, /***** Left: write author's photo *****/ fprintf (Gbl.F.Out,"
"); - Soc_SetUniqueId (IdForm); ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO30x40",Pho_ZOOM,IdForm); + "PHOTO30x40",Pho_ZOOM,true); // Use unique id fprintf (Gbl.F.Out,"
"); /***** Right: author's name, time, summary and buttons *****/ @@ -1990,24 +1975,21 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom, static void Soc_WriteAuthorComment (struct UsrData *UsrDat) { extern const char *Txt_View_public_profile; - char IdForm[Soc_MAX_LENGTH_ID]; fprintf (Gbl.F.Out,"
"); /***** Show user's name inside form to go to user's public profile *****/ - Soc_SetUniqueId (IdForm); - Act_FormStartId (ActSeePubPrf,IdForm); + Act_FormStartUnique (ActSeePubPrf); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - Act_LinkFormSubmitId (Txt_View_public_profile,"DAT_BOLD",IdForm); + Act_LinkFormSubmitUnique (Txt_View_public_profile,"DAT_BOLD"); Str_LimitLengthHTMLStr (UsrDat->FullName,12); fprintf (Gbl.F.Out,"%s",UsrDat->FullName); Act_FormEnd (); /***** Show user's nickname inside form to go to user's public profile *****/ - Soc_SetUniqueId (IdForm); - Act_FormStartId (ActSeePubPrf,IdForm); + Act_FormStartUnique (ActSeePubPrf); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - Act_LinkFormSubmitId (Txt_View_public_profile,"DAT_LIGHT",IdForm); + Act_LinkFormSubmitUnique (Txt_View_public_profile,"DAT_LIGHT"); fprintf (Gbl.F.Out," @%s",UsrDat->Nickname); Act_FormEnd (); @@ -2022,17 +2004,15 @@ static void Soc_WriteAuthorComment (struct UsrData *UsrDat) static void Soc_PutFormToRemoveComment (long ComCod) { extern const char *Txt_Remove; - char IdForm[Soc_MAX_LENGTH_ID]; /***** Form to remove social publishing *****/ - Soc_SetUniqueId (IdForm); if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) { - Act_FormStartIdAnchor (ActReqRemSocComUsr,IdForm,"timeline"); + Act_FormStartUniqueAnchor (ActReqRemSocComUsr,"timeline"); Usr_PutParamOtherUsrCodEncrypted (); } else - Act_FormStartId (ActReqRemSocComGbl,IdForm); + Act_FormStartUnique (ActReqRemSocComGbl); Soc_PutHiddenParamComCod (ComCod); fprintf (Gbl.F.Out,"
" " 0) { - Act_FormStartIdAnchor (ActShaSocNotUsr,IdForm,"timeline"); + Act_FormStartUniqueAnchor (ActShaSocNotUsr,"timeline"); Usr_PutParamOtherUsrCodEncrypted (); } else - Act_FormStartId (ActShaSocNotGbl,IdForm); + Act_FormStartUnique (ActShaSocNotGbl); Soc_PutHiddenParamNotCod (NotCod); fprintf (Gbl.F.Out,"
" " 0) { - Act_FormStartIdAnchor (ActUnsSocPubUsr,IdForm,"timeline"); + Act_FormStartUniqueAnchor (ActUnsSocPubUsr,"timeline"); Usr_PutParamOtherUsrCodEncrypted (); } else - Act_FormStartId (ActUnsSocPubGbl,IdForm); + Act_FormStartUnique (ActUnsSocPubGbl); Soc_PutHiddenParamNotCod (NotCod); fprintf (Gbl.F.Out,"
" " 0) { - Act_FormStartIdAnchor (ActReqRemSocPubUsr,IdForm,"timeline"); + Act_FormStartUniqueAnchor (ActReqRemSocPubUsr,"timeline"); Usr_PutParamOtherUsrCodEncrypted (); } else - Act_FormStartId (ActReqRemSocPubGbl,IdForm); + Act_FormStartUnique (ActReqRemSocPubGbl); Soc_PutHiddenParamNotCod (NotCod); fprintf (Gbl.F.Out,"
" " %u", @@ -3004,11 +2978,10 @@ static void Soc_ShowUsrsWhoHaveSharedSocialNote (const struct SocialNote *SocNot if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) { fprintf (Gbl.F.Out,"
"); - Soc_SetUniqueId (IdForm); ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO18x24",Pho_ZOOM,IdForm); + "PHOTO18x24",Pho_ZOOM,true); // Use unique id fprintf (Gbl.F.Out,"
"); NumUsrsShown++; diff --git a/swad_statistic.c b/swad_statistic.c index bc3b685ac..49d5cb089 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -1808,7 +1808,7 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows, ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO15x20",Pho_ZOOM,NULL); + "PHOTO15x20",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); /* Write the user's ID if user is a student in current course */ @@ -2053,7 +2053,7 @@ static void Sta_ShowDistrAccessesPerDaysAndHour (unsigned long NumRows,MYSQL_RES fprintf (Gbl.F.Out,"%s: ",Txt_Color_of_the_graphic); fprintf (Gbl.F.Out,"", - Tst_MAX_TAG_LENGTH,row[1],Gbl.FormId); + Tst_MAX_TAG_LENGTH,row[1],Gbl.Form.Id); Act_FormEnd (); fprintf (Gbl.F.Out,"" ""); @@ -2588,7 +2588,7 @@ static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *m if (Str_ConvertToUpperLetter (row[3][0]) == 'Y') fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />", - Gbl.FormId); + Gbl.Form.Id); Act_FormEnd (); } fprintf (Gbl.F.Out,""); @@ -6461,7 +6461,7 @@ static void Tst_ShowDataUsr (struct UsrData *UsrDat,unsigned NumExams) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO45x60",Pho_ZOOM,NULL); + "PHOTO45x60",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); /***** Start form to go to user's record card *****/ @@ -6597,7 +6597,7 @@ void Tst_ShowOneTestExam (void) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL); Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO45x60",Pho_ZOOM,NULL); + "PHOTO45x60",Pho_ZOOM,false); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_timetable.c b/swad_timetable.c index 572ce6d41..04c18d868 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -1207,7 +1207,7 @@ static void TT_TimeTableDrawCell (TT_TimeTableType_t TimeTableType, /***** Class type *****/ fprintf (Gbl.F.Out,"", - Gbl.FormId); + Gbl.Form.Id); for (H = Hour + TimeTable[Day][Hour].Columns[Column].Duration; H < TT_HOURS_PER_DAY * 2; H++) @@ -1275,7 +1275,7 @@ static void TT_TimeTableDrawCell (TT_TimeTableType_t TimeTableType, "", - Txt_Place,TT_MAX_LENGTH_PLACE,Place,Gbl.FormId); + Txt_Place,TT_MAX_LENGTH_PLACE,Place,Gbl.Form.Id); } } fprintf (Gbl.F.Out,""); diff --git a/swad_user.c b/swad_user.c index a289cee56..b3c716100 100644 --- a/swad_user.c +++ b/swad_user.c @@ -1651,7 +1651,7 @@ void Usr_WriteLoggedUsrHead (void) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL); Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO18x24",Pho_ZOOM,NULL); + "PHOTO18x24",Pho_ZOOM,false); /***** User's name *****/ fprintf (Gbl.F.Out," ", @@ -2705,7 +2705,7 @@ static void Usr_WriteRowGstMainData (unsigned NumUsr,struct UsrData *UsrDat) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); } @@ -2807,7 +2807,7 @@ void Usr_WriteRowStdMainData (unsigned NumUsr,struct UsrData *UsrDat,bool PutChe ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); } @@ -2861,7 +2861,7 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_NO_ZOOM,NULL); + "PHOTO21x28",Pho_NO_ZOOM,false); fprintf (Gbl.F.Out,""); } @@ -2963,7 +2963,7 @@ void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_NO_ZOOM,NULL); + "PHOTO21x28",Pho_NO_ZOOM,false); fprintf (Gbl.F.Out,""); } @@ -3118,7 +3118,7 @@ static void Usr_WriteRowTchMainData (unsigned NumUsr,struct UsrData *UsrDat,bool ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); } @@ -3174,7 +3174,7 @@ void Usr_WriteRowTchAllData (struct UsrData *UsrDat) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_NO_ZOOM,NULL); + "PHOTO21x28",Pho_NO_ZOOM,false); fprintf (Gbl.F.Out,""); } @@ -3252,7 +3252,7 @@ void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat) ShowPhoto = Pho_ShowUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : NULL, - "PHOTO21x28",Pho_ZOOM,NULL); + "PHOTO21x28",Pho_ZOOM,false); fprintf (Gbl.F.Out,""); } @@ -5203,7 +5203,7 @@ static void Usr_PutCheckboxListWithPhotos (void) fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />" "%s", - Gbl.FormId, + Gbl.Form.Id, The_ClassForm[Gbl.Prefs.Theme],Txt_Display_photos); } @@ -7311,7 +7311,7 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType, ShowPhoto = Pho_ShowUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : NULL, - ClassPhoto,Pho_ZOOM,NULL); + ClassPhoto,Pho_ZOOM,false); /***** Photo foot *****/ fprintf (Gbl.F.Out,"
"); @@ -7391,7 +7391,7 @@ void Usr_PutSelectorNumColsClassPhoto (void) /***** Start selector *****/ fprintf (Gbl.F.Out,"