diff --git a/swad_changelog.h b/swad_changelog.h index 280bf0e75..9931ce732 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -172,13 +172,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.68 (2016-11-22)" +#define Log_PLATFORM_VERSION "SWAD 16.68.1 (2016-11-22)" #define CSS_FILE "swad16.68.css" #define JS_FILE "swad16.46.1.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 16.68.1: Nov 22, 2016 Code refactoringrelated to notifications and contextual checkbox. (207438 lines) Version 16.68: Nov 22, 2016 Change in text related to notifications. Changes in contextual links in notifications. (207406 lines) Version 16.67.3: Nov 22, 2016 Contextual help on notifications. (207355 lines) diff --git a/swad_layout.c b/swad_layout.c index ea4a06b72..e18a0d96a 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1002,7 +1002,7 @@ static void Lay_ShowRightColumn (void) } /*****************************************************************************/ -/***************** Show an icon with a link in contextual menu ***************/ +/**************** Show an icon with a link in contextual menu ****************/ /*****************************************************************************/ void Lay_PutContextualLink (Act_Action_t NextAction, @@ -1013,19 +1013,75 @@ void Lay_PutContextualLink (Act_Action_t NextAction, { extern const char *The_ClassFormBold[The_NUM_THEMES]; + /***** Separator *****/ if (Text) fprintf (Gbl.F.Out," "); // This space is necessary to enable // jumping to the next line on narrow screens + /***** Start form *****/ Act_FormStart (NextAction); if (FuncParams) FuncParams (); + + /***** Put icon with link *****/ Lay_PutIconLink (Icon,Title,Text, Text ? The_ClassFormBold[Gbl.Prefs.Theme] : NULL, OnSubmit); + + /***** End form *****/ Act_FormEnd (); + /***** Separator *****/ + if (Text) + fprintf (Gbl.F.Out," "); // This space is necessary to enable + // jumping to the next line on narrow screens + } + +/*****************************************************************************/ +/******************** Show a checkbox in contextual menu *********************/ +/*****************************************************************************/ + +void Lay_PutContextualCheckbox (Act_Action_t NextAction, + const char *CheckboxName,bool Checked, + const char *Title,const char *Text) + { + extern const char *The_ClassFormBold[The_NUM_THEMES]; + + /***** Separator *****/ + if (Text) + fprintf (Gbl.F.Out," "); // This space is necessary to enable + // jumping to the next line on narrow screens + + /***** Start form *****/ + Act_FormStart (NextAction); + + /***** Start container *****/ + fprintf (Gbl.F.Out,"
", + Checked ? "CHECKBOX_CHECKED" : + "CHECKBOX_UNCHECKED", + The_ClassFormBold[Gbl.Prefs.Theme], + Title); + + /****** Checkbox and text *****/ + fprintf (Gbl.F.Out,"", + Gbl.Form.Id); + if (Text) + if (Text[0]) + fprintf (Gbl.F.Out," %s", + Text); + + /***** End container *****/ + fprintf (Gbl.F.Out,"
"); + + /***** End form *****/ + Act_FormEnd (); + + /***** Separator *****/ if (Text) fprintf (Gbl.F.Out," "); // This space is necessary to enable // jumping to the next line on narrow screens diff --git a/swad_layout.h b/swad_layout.h index b31d8bd5c..26049cc6c 100644 --- a/swad_layout.h +++ b/swad_layout.h @@ -76,6 +76,9 @@ void Lay_PutContextualLink (Act_Action_t NextAction, const char *Icon, const char *Title,const char *Text, const char *OnSubmit); +void Lay_PutContextualCheckbox (Act_Action_t NextAction, + const char *CheckboxName,bool Checked, + const char *Title,const char *Text); void Lay_PutIconLink (const char *Icon,const char *Title,const char *Text, const char *LinkStyle,const char *OnSubmit); void Lay_PutIconWithText (const char *Icon,const char *Alt,const char *Text); diff --git a/swad_notification.c b/swad_notification.c index 8708e3798..408be1aca 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -656,33 +656,12 @@ static void Ntf_PutIconsNotif (void) static void Ntf_WriteFormAllNotifications (bool AllNotifications) { - extern const char *The_ClassFormBold[The_NUM_THEMES]; extern const char *Txt_Show_all_notifications; extern const char *Txt_Show_all_NOTIFICATIONS; - /***** Start form *****/ - Act_FormStart (ActSeeNtf); - - /***** Start container *****/ - fprintf (Gbl.F.Out,"
", - AllNotifications ? "CHECKBOX_CHECKED" : - "CHECKBOX_UNCHECKED", - The_ClassFormBold[Gbl.Prefs.Theme], - Txt_Show_all_notifications); - - /****** Checkbox and text *****/ - fprintf (Gbl.F.Out,"" - " %s", - Gbl.Form.Id,Txt_Show_all_NOTIFICATIONS); - - /***** End container *****/ - fprintf (Gbl.F.Out,"
"); - - /***** End form *****/ - Act_FormEnd (); + Lay_PutContextualCheckbox (ActSeeNtf,"All",AllNotifications, + Txt_Show_all_notifications, + Txt_Show_all_NOTIFICATIONS); } /*****************************************************************************/