From fee40c4ef64cd9a6ffbece389b6feb3e4a0acdde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 11 Dec 2016 20:28:58 +0100 Subject: [PATCH] Version 16.95.2 --- swad_announcement.c | 2 +- swad_changelog.h | 3 +- swad_global.h | 1 + swad_notice.c | 83 +++++++++++++++++---------------------------- 4 files changed, 36 insertions(+), 53 deletions(-) diff --git a/swad_announcement.c b/swad_announcement.c index 2d652ea34..f46a4e1a8 100644 --- a/swad_announcement.c +++ b/swad_announcement.c @@ -309,7 +309,7 @@ static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status, Txt_Remove,NULL, NULL); - /***** Put form to change the status of the notice *****/ + /***** Put form to change the status of the announcement *****/ switch (Status) { case Ann_ACTIVE_ANNOUNCEMENT: diff --git a/swad_changelog.h b/swad_changelog.h index 782153062..925b0d8b8 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -185,7 +185,7 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.95.1 (2016-12-11)" +#define Log_PLATFORM_VERSION "SWAD 16.95.2 (2016-12-11)" #define CSS_FILE "swad16.94.1.css" #define JS_FILE "swad16.90.2.js" @@ -196,6 +196,7 @@ 1 change necessary in database: INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1619','es','N',''); + Version 16.95.2: Dec 11, 2016 Code refactoring related with notices. (210514 lines) Version 16.95.1: Dec 11, 2016 Code refactoring related with global announcements. (210534 lines) Version 16.95: Dec 11, 2016 Code refactoring related with dates. (210559 lines) Version 16.94.2: Dec 11, 2016 Contextual help on calendar. diff --git a/swad_global.h b/swad_global.h index e752f653f..403627f7c 100644 --- a/swad_global.h +++ b/swad_global.h @@ -471,6 +471,7 @@ struct Globals } Records; struct { + long NotCod; long HighlightNotCod; // Notice code of a notice to be highlighted } Notices; } CurrentCrs; diff --git a/swad_notice.c b/swad_notice.c index 7eb8f955f..7161e0cda 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -79,6 +79,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, Not_Status_t Status); static long Not_InsertNoticeInDB (const char *Content); static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail); +static void Not_PutParams (void); static long Not_GetParamNotCod (void); /*****************************************************************************/ @@ -595,7 +596,6 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, long UsrCod, Not_Status_t Status) { - extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *Txt_NOTICE_Active_SINGULAR; extern const char *Txt_NOTICE_Active_Mark_as_obsolete; extern const char *Txt_NOTICE_Obsolete_SINGULAR; @@ -626,6 +626,8 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, static unsigned UniqueId = 0; struct UsrData UsrDat; + Gbl.CurrentCrs.Notices.NotCod = NotCod; // Parameter for forms + /***** Start yellow note *****/ fprintf (Gbl.F.Out,"
", ContainerClass[Status], @@ -637,48 +639,26 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, { if (Not_CheckIfICanEditNotices ()) { - /* Form to remove notice */ - Act_FormStart (ActReqRemNot); - Not_PutHiddenParamNotCod (NotCod); - fprintf (Gbl.F.Out,"
" - "" - "
", - Gbl.Prefs.IconsURL, - Txt_Remove, - Txt_Remove); - Act_FormEnd (); + /***** Put form to remove announcement *****/ + Lay_PutContextualLink (ActReqRemNot,Not_PutParams, + "remove-on64x64.png", + Txt_Remove,NULL, + NULL); - /* Put form to change the status of the notice */ + /***** Put form to change the status of the notice *****/ switch (Status) { case Not_ACTIVE_NOTICE: - Act_FormStart (ActHidNot); - Not_PutHiddenParamNotCod (NotCod); - fprintf (Gbl.F.Out,"
" - "" - "
", - Gbl.Prefs.IconsURL, - Txt_NOTICE_Active_Mark_as_obsolete, - Txt_NOTICE_Active_Mark_as_obsolete); + Lay_PutContextualLink (ActHidNot,Not_PutParams, + "eye-on64x64.png", + Txt_NOTICE_Active_Mark_as_obsolete,NULL, + NULL); break; case Not_OBSOLETE_NOTICE: - Act_FormStart (ActRevNot); - Not_PutHiddenParamNotCod (NotCod); - fprintf (Gbl.F.Out,"
" - "" - "
", - Gbl.Prefs.IconsURL, - Txt_NOTICE_Obsolete_Mark_as_active, - Txt_NOTICE_Obsolete_Mark_as_active); + Lay_PutContextualLink (ActRevNot,Not_PutParams, + "eye-slash-on64x64.png", + Txt_NOTICE_Obsolete_Mark_as_active,NULL, + NULL); break; } Act_FormEnd (); @@ -739,22 +719,14 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, /***** Write the content of the notice *****/ if (TypeNoticesListing == Not_LIST_BRIEF_NOTICES) { - fprintf (Gbl.F.Out,"
%s
", - Content); + fprintf (Gbl.F.Out,"
%s
",Content); - /* Form to view full notice */ + /* Put form to view full notice */ fprintf (Gbl.F.Out,"
"); - Act_FormStart (ActSeeOneNot); - Not_PutHiddenParamNotCod (NotCod); - Act_LinkFormSubmit (Txt_See_full_notice,The_ClassForm[Gbl.Prefs.Theme],NULL); - fprintf (Gbl.F.Out,"\"%s\"" - "", - Gbl.Prefs.IconsURL, - Txt_See_full_notice, - Txt_See_full_notice); - Act_FormEnd (); + Lay_PutContextualLink (ActSeeOneNot,Not_PutParams, + "ellipsis32x32.gif", + Txt_See_full_notice,NULL, + NULL); fprintf (Gbl.F.Out,"
"); } else @@ -1006,6 +978,15 @@ unsigned Not_GetNumNoticesDeleted (Sco_Scope_t Scope,unsigned *NumNotif) /*************** Put parameter with the code of a notice *********************/ /*****************************************************************************/ +static void Not_PutParams (void) + { + Not_PutHiddenParamNotCod (Gbl.CurrentCrs.Notices.NotCod); + } + +/*****************************************************************************/ +/*************** Put parameter with the code of a notice *********************/ +/*****************************************************************************/ + void Not_PutHiddenParamNotCod (long NotCod) { Par_PutHiddenParamLong ("NotCod",NotCod);