diff --git a/swad_action.c b/swad_action.c index 6f8dd4cd0..07637f69e 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1182,6 +1182,8 @@ Profile: 953. ActRemMyPho Remove my photo 954. ActChgPubPho Change photo privacy + ---. ActEdiPri Edit my privacy + 955. ActReqEdiMyIns Request the edition of my institution, centre and department 956. ActChgCtyMyIns Change the country of my institution 957. ActChgMyIns Change my institution @@ -2591,7 +2593,9 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActDetMyPho */{ 693,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_DATA,Act_MAIN_WINDOW,NULL ,Pho_RecMyPhotoDetFaces ,NULL}, /* ActUpdMyPho */{ 694,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Pho_UpdateMyPhoto1 ,Pho_UpdateMyPhoto2 ,NULL}, /* ActRemMyPho */{ 428,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Pho_RemoveMyPhoto1 ,Pho_RemoveMyPhoto2 ,NULL}, - /* ActChgPubPho */{ 774,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Pho_ChangePhotoVisibility ,Rec_ShowMyCommonRecordUpd ,NULL}, + /* ActChgPubPho */{ 774,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_ChangePhotoVisibility ,NULL}, + + /* ActEdiPri */{1403,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_EditMyPrivacy ,NULL}, /* ActReqEdiMyIns */{1165,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ShowFormMyInsCtrDpt ,NULL}, /* ActChgCtyMyIns */{1166,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ChgCountryOfMyInstitution ,NULL}, @@ -4051,6 +4055,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActDowComIns, // #1400 ActReqPubPrf, // #1401 ActSeePubPrf, // #1402 + ActEdiPri, // #1403 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 255093dc6..36d8c3369 100644 --- a/swad_action.h +++ b/swad_action.h @@ -69,9 +69,9 @@ typedef enum typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (7+52+15+90+73+68+204+184+100+168+28+75) +#define Act_NUM_ACTIONS (7+52+15+90+73+68+204+184+100+168+28+76) -#define Act_MAX_ACTION_COD 1402 +#define Act_MAX_ACTION_COD 1403 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20 @@ -1230,53 +1230,55 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica #define ActRemMyPho (ActSeeAllStaCrs+31) #define ActChgPubPho (ActSeeAllStaCrs+32) -#define ActReqEdiMyIns (ActSeeAllStaCrs+33) -#define ActChgCtyMyIns (ActSeeAllStaCrs+34) -#define ActChgMyIns (ActSeeAllStaCrs+35) -#define ActChgMyCtr (ActSeeAllStaCrs+36) -#define ActChgMyDpt (ActSeeAllStaCrs+37) -#define ActChgMyOff (ActSeeAllStaCrs+38) -#define ActChgMyOffPho (ActSeeAllStaCrs+39) +#define ActEdiPri (ActSeeAllStaCrs+33) -#define ActReqEdiMyNet (ActSeeAllStaCrs+40) -#define ActChgMyNet (ActSeeAllStaCrs+41) +#define ActReqEdiMyIns (ActSeeAllStaCrs+34) +#define ActChgCtyMyIns (ActSeeAllStaCrs+35) +#define ActChgMyIns (ActSeeAllStaCrs+36) +#define ActChgMyCtr (ActSeeAllStaCrs+37) +#define ActChgMyDpt (ActSeeAllStaCrs+38) +#define ActChgMyOff (ActSeeAllStaCrs+39) +#define ActChgMyOffPho (ActSeeAllStaCrs+40) -#define ActChgLay (ActSeeAllStaCrs+42) -#define ActChgThe (ActSeeAllStaCrs+43) -#define ActReqChgLan (ActSeeAllStaCrs+44) -#define ActChgLan (ActSeeAllStaCrs+45) -#define ActChgCol (ActSeeAllStaCrs+46) -#define ActHidLftCol (ActSeeAllStaCrs+47) -#define ActHidRgtCol (ActSeeAllStaCrs+48) -#define ActShoLftCol (ActSeeAllStaCrs+49) -#define ActShoRgtCol (ActSeeAllStaCrs+50) -#define ActChgIco (ActSeeAllStaCrs+51) -#define ActChgMnu (ActSeeAllStaCrs+52) -#define ActChgNtfPrf (ActSeeAllStaCrs+53) +#define ActReqEdiMyNet (ActSeeAllStaCrs+41) +#define ActChgMyNet (ActSeeAllStaCrs+42) -#define ActPrnUsrQR (ActSeeAllStaCrs+54) +#define ActChgLay (ActSeeAllStaCrs+43) +#define ActChgThe (ActSeeAllStaCrs+44) +#define ActReqChgLan (ActSeeAllStaCrs+45) +#define ActChgLan (ActSeeAllStaCrs+46) +#define ActChgCol (ActSeeAllStaCrs+47) +#define ActHidLftCol (ActSeeAllStaCrs+48) +#define ActHidRgtCol (ActSeeAllStaCrs+49) +#define ActShoLftCol (ActSeeAllStaCrs+50) +#define ActShoRgtCol (ActSeeAllStaCrs+51) +#define ActChgIco (ActSeeAllStaCrs+52) +#define ActChgMnu (ActSeeAllStaCrs+53) +#define ActChgNtfPrf (ActSeeAllStaCrs+54) -#define ActPrnMyTimTbl (ActSeeAllStaCrs+55) -#define ActEdiTut (ActSeeAllStaCrs+56) -#define ActChgTut (ActSeeAllStaCrs+57) -#define ActReqRemFilBrf (ActSeeAllStaCrs+58) -#define ActRemFilBrf (ActSeeAllStaCrs+59) -#define ActRemFolBrf (ActSeeAllStaCrs+60) -#define ActCopBrf (ActSeeAllStaCrs+61) -#define ActPasBrf (ActSeeAllStaCrs+62) -#define ActRemTreBrf (ActSeeAllStaCrs+63) -#define ActFrmCreBrf (ActSeeAllStaCrs+64) -#define ActCreFolBrf (ActSeeAllStaCrs+65) -#define ActCreLnkBrf (ActSeeAllStaCrs+66) -#define ActRenFolBrf (ActSeeAllStaCrs+67) -#define ActRcvFilBrfDZ (ActSeeAllStaCrs+68) -#define ActRcvFilBrfCla (ActSeeAllStaCrs+69) -#define ActExpBrf (ActSeeAllStaCrs+70) -#define ActConBrf (ActSeeAllStaCrs+71) -#define ActZIPBrf (ActSeeAllStaCrs+72) -#define ActReqDatBrf (ActSeeAllStaCrs+73) -#define ActChgDatBrf (ActSeeAllStaCrs+74) -#define ActDowBrf (ActSeeAllStaCrs+75) +#define ActPrnUsrQR (ActSeeAllStaCrs+55) + +#define ActPrnMyTimTbl (ActSeeAllStaCrs+56) +#define ActEdiTut (ActSeeAllStaCrs+57) +#define ActChgTut (ActSeeAllStaCrs+58) +#define ActReqRemFilBrf (ActSeeAllStaCrs+59) +#define ActRemFilBrf (ActSeeAllStaCrs+60) +#define ActRemFolBrf (ActSeeAllStaCrs+61) +#define ActCopBrf (ActSeeAllStaCrs+62) +#define ActPasBrf (ActSeeAllStaCrs+63) +#define ActRemTreBrf (ActSeeAllStaCrs+64) +#define ActFrmCreBrf (ActSeeAllStaCrs+65) +#define ActCreFolBrf (ActSeeAllStaCrs+66) +#define ActCreLnkBrf (ActSeeAllStaCrs+67) +#define ActRenFolBrf (ActSeeAllStaCrs+68) +#define ActRcvFilBrfDZ (ActSeeAllStaCrs+69) +#define ActRcvFilBrfCla (ActSeeAllStaCrs+70) +#define ActExpBrf (ActSeeAllStaCrs+71) +#define ActConBrf (ActSeeAllStaCrs+72) +#define ActZIPBrf (ActSeeAllStaCrs+73) +#define ActReqDatBrf (ActSeeAllStaCrs+74) +#define ActChgDatBrf (ActSeeAllStaCrs+75) +#define ActDowBrf (ActSeeAllStaCrs+76) /*****************************************************************************/ /******************************** Public types *******************************/ diff --git a/swad_changelog.h b/swad_changelog.h index b0da72fc8..51b61e034 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,11 +103,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.78.1 (2015/03/06)" +#define Log_PLATFORM_VERSION "SWAD 14.78.2 (2015/03/06)" // 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 | tail -1 /* + Version 14.78.2: Mar 06, 2015 New action to edit privacy options. (178630 lines) Version 14.78.1: Mar 06, 2015 New link to privacy options (unfinished). (178595 lines) Version 14.78: Mar 06, 2015 Four degrees of visibility in photos. Field PublicPhoto is replaced by field PhotoVisibility in usr_data table. (178577 lines) diff --git a/swad_photo.c b/swad_photo.c index f6df4aca4..27b7927f5 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -98,8 +98,6 @@ static void Pho_UpdatePhoto1 (struct UsrData *UsrDat); static void Pho_UpdatePhoto2 (void); static void Pho_ClearPhotoName (long UsrCod); -static void Pho_PutFormPhotoVisibility (void); - static long Pho_GetDegWithAvgPhotoLeastRecentlyUpdated (void); static long Pho_GetTimeAvgPhotoWasComputed (long DegCod); static long Pho_GetTimeToComputeAvgPhoto (long DegCod); @@ -250,8 +248,6 @@ void Pho_ReqPhoto (const struct UsrData *UsrDat,bool PhotoExists,const char *Pho /***** Forms to remove photo and make it public *****/ fprintf (Gbl.F.Out,"
"); Pho_PutLinkToRemoveUsrPhoto (UsrDat); - fprintf (Gbl.F.Out," "); - Pho_PutFormPhotoVisibility (); Rec_PutLinkToChangeMyPrivacy (); // Put link (form) to change my privacy fprintf (Gbl.F.Out,"
"); @@ -1026,45 +1022,46 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, /************************** Select photo visibility **************************/ /*****************************************************************************/ -static void Pho_PutFormPhotoVisibility (void) - { - /***** Start form *****/ - Act_FormStart (ActChgPubPho); - - /***** Select photo visibility *****/ - Pho_PutSelectorPhotoVisibility (true); - - /***** End form *****/ - fprintf (Gbl.F.Out,""); - } - -/*****************************************************************************/ -/************************** Select photo visibility **************************/ -/*****************************************************************************/ - -void Pho_PutSelectorPhotoVisibility (bool SendOnChange) +void Pho_PutFormPhotoVisibility (void) { + extern const char *The_ClassFormul[The_NUM_THEMES]; + extern const char *Txt_Photo; extern const char *Txt_PHOTO_VISIBILITY[Pho_NUM_VISIBILITIES]; Pho_Visibility_t PhotoVisibility; /***** Select photo visibility *****/ - fprintf (Gbl.F.Out,"%s",Txt_PHOTO_VISIBILITY[PhotoVisibility]); + fprintf (Gbl.F.Out," checked=\"checked\""); + fprintf (Gbl.F.Out," onclick=\"javascript:document.getElementById('%s').submit();\" />" + "%s" + "", + Gbl.FormId,Txt_PHOTO_VISIBILITY[PhotoVisibility]); } - fprintf (Gbl.F.Out,""); + /***** End of list and form *****/ + fprintf (Gbl.F.Out,"" + "" + "" + ""); } /*****************************************************************************/ @@ -1111,6 +1108,7 @@ bool Pho_GetParamPhotoVisibility (void) void Pho_ChangePhotoVisibility (void) { + extern const char *Txt_The_visibility_of_your_photo_has_changed; char Query[128]; /***** Get param with public/private photo *****/ @@ -1122,6 +1120,12 @@ void Pho_ChangePhotoVisibility (void) Pho_VisibilityDB[Gbl.Usrs.Me.UsrDat.PhotoVisibility], Gbl.Usrs.Me.UsrDat.UsrCod); DB_QueryUPDATE (Query,"can not update your preference about photo visibility"); + + /***** Show alert *****/ + Lay_ShowAlert (Lay_SUCCESS,Txt_The_visibility_of_your_photo_has_changed); + + /***** Show form again *****/ + Rec_EditMyPrivacy (); } /*****************************************************************************/ diff --git a/swad_photo.h b/swad_photo.h index 367a0af50..f12cf5ffd 100644 --- a/swad_photo.h +++ b/swad_photo.h @@ -101,7 +101,7 @@ void Pho_UpdatePhotoName (struct UsrData *UsrDat); void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, const char *ClassPhoto,bool Zoom); -void Pho_PutSelectorPhotoVisibility (bool SendOnChange); +void Pho_PutFormPhotoVisibility (void); Pho_Visibility_t Pho_GetPhotoVisibilityFromStr (const char *Str); bool Pho_GetParamPhotoVisibility (void); void Pho_ChangePhotoVisibility (void); diff --git a/swad_record.c b/swad_record.c index f11ad8bf3..2e020baae 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2025,7 +2025,6 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView, extern const char *Txt_Surname_1; extern const char *Txt_Surname_2; extern const char *Txt_First_name; - extern const char *Txt_PHOTO_VISIBILITY[Pho_NUM_VISIBILITIES]; extern const char *Txt_Country; extern const char *Txt_Another_country; extern const char *Txt_Place_of_origin; @@ -2343,16 +2342,6 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView, NULL, "PHOTO150x200", Act_Actions[Gbl.CurrentAct].BrowserWindow == Act_MAIN_WINDOW); - /* Public / private photo */ - if (ShowData) - { - fprintf (Gbl.F.Out,"
"); - if (TypeOfView == Rec_FORM_MY_COMMON_RECORD) - /***** Select photo visibility *****/ - Pho_PutSelectorPhotoVisibility (false); - else if (TypeOfView == Rec_MY_COMMON_RECORD_CHECK) - fprintf (Gbl.F.Out,"%s",Txt_PHOTO_VISIBILITY[UsrDat->PhotoVisibility]); - } fprintf (Gbl.F.Out,"" ""); @@ -3155,12 +3144,30 @@ void Rec_PutLinkToChangeMyPrivacy (void) extern const char *Txt_Privacy; /***** Link to edit my social networks *****/ - Act_FormStart (ActReqEdiMyNet); + Act_FormStart (ActEdiPri); Act_LinkFormSubmit (Txt_Privacy,The_ClassFormul[Gbl.Prefs.Theme]); Lay_PutSendIcon ("padlock",Txt_Privacy,Txt_Privacy); fprintf (Gbl.F.Out,""); } +/*****************************************************************************/ +/******************************* Edit my privacy *****************************/ +/*****************************************************************************/ + +void Rec_EditMyPrivacy (void) + { + extern const char *Txt_Privacy; + + /***** Start table *****/ + Lay_StartRoundFrameTable10 (NULL,2,Txt_Privacy); + + /***** Select photo visibility *****/ + Pho_PutFormPhotoVisibility (); + + /***** End table *****/ + Lay_EndRoundFrameTable10 (); + } + /*****************************************************************************/ /********* Show form to edit my institution, centre and department ***********/ /*****************************************************************************/ diff --git a/swad_record.h b/swad_record.h index 127ea8600..b17de2495 100644 --- a/swad_record.h +++ b/swad_record.h @@ -158,6 +158,7 @@ void Rec_GetUsrNameFromRecordForm (struct UsrData *UsrDat); void Rec_GetUsrExtraDataFromRecordForm (struct UsrData *UsrDat); void Rec_PutLinkToChangeMyPrivacy (void); +void Rec_EditMyPrivacy (void); void Rec_ShowFormMyInsCtrDpt (void); void Rec_ChgCountryOfMyInstitution (void); diff --git a/swad_text.c b/swad_text.c index 97b743522..85b7d190d 100644 --- a/swad_text.c +++ b/swad_text.c @@ -42704,6 +42704,27 @@ const char *Txt_The_visibility_of_the_record_field_X_has_not_changed = // Warnin "The visibility of the record field %s has not changed."; // Necessita de tradução #endif +const char *Txt_The_visibility_of_your_photo_has_changed = +#if L==0 + "La visibilidad de su foto ha cambiado."; // Necessita traduccio +#elif L==1 + "The visibility of your photo has changed."; // Need Übersetzung +#elif L==2 + "The visibility of your photo has changed."; +#elif L==3 + "La visibilidad de su foto ha cambiado."; +#elif L==4 + "The visibility of your photo has changed."; // Besoin de traduction +#elif L==5 + "La visibilidad de su foto ha cambiado."; // Okoteve traducción +#elif L==6 + "The visibility of your photo has changed."; // Bisogno di traduzione +#elif L==7 + "The visibility of your photo has changed."; // Potrzebujesz tlumaczenie +#elif L==8 + "The visibility of your photo has changed."; // Necessita de tradução +#endif + const char *Txt_The_whole_course = #if L==0 "Toda la asignatura"; // Necessita traduccio