From 5fa5e515ed73d22033190cfc7a57015b218074ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 13 Dec 2015 20:46:46 +0100 Subject: [PATCH] Version 15.64.14 --- swad_QR.c | 28 ++++++++++++++++++---------- swad_QR.h | 2 +- swad_attendance.c | 2 +- swad_changelog.h | 3 ++- swad_global.h | 1 + swad_nickname.c | 2 +- swad_record.c | 2 +- 7 files changed, 25 insertions(+), 15 deletions(-) diff --git a/swad_QR.c b/swad_QR.c index bff56d8c..684bc36e 100644 --- a/swad_QR.c +++ b/swad_QR.c @@ -63,27 +63,35 @@ extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS]; /***************************** Internal prototypes ***************************/ /*****************************************************************************/ +static void QR_PutParamQRString (void); + static void QR_ImageQRCode (const char *QRString); /*****************************************************************************/ /***************** Put a link to a print view of a QR code *******************/ /*****************************************************************************/ -void QR_PutLinkToPrintQRCode (struct UsrData *UsrDat,bool PrintText) +void QR_PutLinkToPrintQRCode (const char *Nickname,bool PrintText) { - extern const char *The_ClassFormBold[The_NUM_THEMES]; extern const char *Txt_QR_code; + + /***** Link to print QR *****/ + Gbl.Usrs.NicknameForQR = Nickname; + Lay_PutContextualLink (ActPrnUsrQR,QR_PutParamQRString,"qr64x64.gif", + Txt_QR_code,PrintText ? Txt_QR_code : + NULL); + } + +/*****************************************************************************/ +/************************* Put parameter QR string ***************************/ +/*****************************************************************************/ + +static void QR_PutParamQRString (void) + { char NicknameWithArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1]; - /***** Link to print view *****/ - Act_FormStart (ActPrnUsrQR); - sprintf (NicknameWithArroba,"@%s",UsrDat->Nickname); + sprintf (NicknameWithArroba,"@%s",Gbl.Usrs.NicknameForQR); Par_PutHiddenParamString ("QRString",NicknameWithArroba); - Act_LinkFormSubmit (Txt_QR_code,The_ClassFormBold[Gbl.Prefs.Theme]); - Lay_PutIconWithText ("qr64x64.gif",Txt_QR_code,PrintText ? Txt_QR_code : - NULL); - fprintf (Gbl.F.Out,""); - Act_FormEnd (); } /*****************************************************************************/ diff --git a/swad_QR.h b/swad_QR.h index 2415496a..864a82ec 100644 --- a/swad_QR.h +++ b/swad_QR.h @@ -39,7 +39,7 @@ /***************************** Public prototypes *****************************/ /*****************************************************************************/ -void QR_PutLinkToPrintQRCode (struct UsrData *UsrDat,bool PrintText); +void QR_PutLinkToPrintQRCode (const char *Nickname,bool PrintText); void QR_PrintQRCode (void); void QR_LinkTo (unsigned Size,const char *ParamStr,long Cod); diff --git a/swad_attendance.c b/swad_attendance.c index 06e9a315..254ed803 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -163,7 +163,7 @@ void Att_SeeAttEvents (void) /* Put link to my QR code */ if (Gbl.Usrs.Me.UsrDat.Nickname[0]) - QR_PutLinkToPrintQRCode (&Gbl.Usrs.Me.UsrDat,true); + QR_PutLinkToPrintQRCode (Gbl.Usrs.Me.UsrDat.Nickname,true); fprintf (Gbl.F.Out,""); diff --git a/swad_changelog.h b/swad_changelog.h index 6a6c1d23..741de42b 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -117,12 +117,13 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.64.13 (2015/12/13)" +#define Log_PLATFORM_VERSION "SWAD 15.64.14 (2015/12/13)" #define CSS_FILE "swad15.64.5.css" // 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.64.14: Dec 13, 2015 Code refactoring in contextual links. (187037 lines) Version 15.64.13: Dec 13, 2015 Code refactoring in contextual links. (187031 lines) Version 15.64.12: Dec 13, 2015 Code refactoring in contextual links. (187061 lines) Version 15.64.11: Dec 13, 2015 Code refactoring in contextual links. (187056 lines) diff --git a/swad_global.h b/swad_global.h index c5da6b8d..63bb559d 100644 --- a/swad_global.h +++ b/swad_global.h @@ -381,6 +381,7 @@ struct Globals } Connected; char FileNamePhoto[NAME_MAX+1]; // File name (with no path and no .jpg) of the temporary file with the selected face bool Error; // To signal that an error has happened + const char *NicknameForQR; // Used as parameter in contextual links } Usrs; struct { diff --git a/swad_nickname.c b/swad_nickname.c index a583cb2f..d7cd31a7 100644 --- a/swad_nickname.c +++ b/swad_nickname.c @@ -250,7 +250,7 @@ void Nck_ShowFormChangeUsrNickname (void) /* Link to QR code */ if (NumNick == 1 && Gbl.Usrs.Me.UsrDat.Nickname[0]) - QR_PutLinkToPrintQRCode (&Gbl.Usrs.Me.UsrDat,false); + QR_PutLinkToPrintQRCode (Gbl.Usrs.Me.UsrDat.Nickname,false); fprintf (Gbl.F.Out,""); diff --git a/swad_record.c b/swad_record.c index 98f98bb6..0098445b 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2406,7 +2406,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView, Act_FormEnd (); /* Link to QR code */ - QR_PutLinkToPrintQRCode (UsrDat,false); + QR_PutLinkToPrintQRCode (UsrDat->Nickname,false); } } fprintf (Gbl.F.Out,""