Version 16.203

This commit is contained in:
Antonio Cañas Vargas 2017-05-04 02:19:23 +02:00
parent 8605aa7073
commit d15af31fd0
12 changed files with 212 additions and 46 deletions

View File

@ -41,6 +41,7 @@
#include "swad_course.h"
#include "swad_chat.h"
#include "swad_database.h"
#include "swad_date.h"
#include "swad_degree_type.h"
#include "swad_duplicate.h"
#include "swad_exam.h"
@ -1442,6 +1443,7 @@ Profile:
1231. ActReqChgLan Ask if change language
1232. ActChgLan Change language
1233. ActChg1stDay Change first day of the week
NEW!. ActChgDatFmt Change date format
1234. ActChgCol Change side columns
1235. ActHidLftCol Hide left side column
1236. ActHidRgtCol Hide right side column
@ -2946,6 +2948,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActReqChgLan */{ 992,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Pre_AskChangeLanguage ,NULL},
/* ActChgLan */{ 654,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Pre_ChangeLanguage ,Pre_EditPrefs ,NULL},
/* ActChg1stDay */{1484,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Cal_ChangeFirstDayOfWeek ,Pre_EditPrefs ,NULL},
/* ActChgDatFmt */{1638,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Dat_ChangeDateFormat ,Pre_EditPrefs ,NULL},
/* ActChgCol */{ 674,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Pre_ChangeSideCols ,Pre_EditPrefs ,NULL},
/* ActHidLftCol */{ 668,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Pre_HideLeftCol ,Pre_EditPrefs ,NULL},
/* ActHidRgtCol */{ 669,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Pre_HideRightCol ,Pre_EditPrefs ,NULL},
@ -4624,6 +4627,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActPrnCalDeg, // #1635
ActChgCalDeg1stDay, // #1636
ActPrnOneAsg, // #1637
ActChgDatFmt, // #1638
};
/*****************************************************************************/

View File

@ -57,9 +57,9 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 32 + 24 + 115 + 72 + 416 + 159 + 172 + 42 + 14 + 96)
#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 32 + 24 + 115 + 72 + 416 + 159 + 172 + 42 + 14 + 97)
#define Act_MAX_ACTION_COD 1637
#define Act_MAX_ACTION_COD 1638
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 12
@ -1475,43 +1475,44 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActReqChgLan (ActSeeMyUsgRep + 61)
#define ActChgLan (ActSeeMyUsgRep + 62)
#define ActChg1stDay (ActSeeMyUsgRep + 63)
#define ActChgCol (ActSeeMyUsgRep + 64)
#define ActHidLftCol (ActSeeMyUsgRep + 65)
#define ActHidRgtCol (ActSeeMyUsgRep + 66)
#define ActShoLftCol (ActSeeMyUsgRep + 67)
#define ActShoRgtCol (ActSeeMyUsgRep + 68)
#define ActChgIco (ActSeeMyUsgRep + 69)
#define ActChgMnu (ActSeeMyUsgRep + 70)
#define ActChgNtfPrf (ActSeeMyUsgRep + 71)
#define ActChgDatFmt (ActSeeMyUsgRep + 64)
#define ActChgCol (ActSeeMyUsgRep + 65)
#define ActHidLftCol (ActSeeMyUsgRep + 66)
#define ActHidRgtCol (ActSeeMyUsgRep + 67)
#define ActShoLftCol (ActSeeMyUsgRep + 68)
#define ActShoRgtCol (ActSeeMyUsgRep + 69)
#define ActChgIco (ActSeeMyUsgRep + 70)
#define ActChgMnu (ActSeeMyUsgRep + 71)
#define ActChgNtfPrf (ActSeeMyUsgRep + 72)
#define ActPrnUsrQR (ActSeeMyUsgRep + 72)
#define ActPrnUsrQR (ActSeeMyUsgRep + 73)
#define ActPrnMyTT (ActSeeMyUsgRep + 73)
#define ActEdiTut (ActSeeMyUsgRep + 74)
#define ActChgTut (ActSeeMyUsgRep + 75)
#define ActChgMyTT1stDay (ActSeeMyUsgRep + 76)
#define ActPrnMyTT (ActSeeMyUsgRep + 74)
#define ActEdiTut (ActSeeMyUsgRep + 75)
#define ActChgTut (ActSeeMyUsgRep + 76)
#define ActChgMyTT1stDay (ActSeeMyUsgRep + 77)
#define ActReqRemFilBrf (ActSeeMyUsgRep + 77)
#define ActRemFilBrf (ActSeeMyUsgRep + 78)
#define ActRemFolBrf (ActSeeMyUsgRep + 79)
#define ActCopBrf (ActSeeMyUsgRep + 80)
#define ActPasBrf (ActSeeMyUsgRep + 81)
#define ActRemTreBrf (ActSeeMyUsgRep + 82)
#define ActFrmCreBrf (ActSeeMyUsgRep + 83)
#define ActCreFolBrf (ActSeeMyUsgRep + 84)
#define ActCreLnkBrf (ActSeeMyUsgRep + 85)
#define ActRenFolBrf (ActSeeMyUsgRep + 86)
#define ActRcvFilBrfDZ (ActSeeMyUsgRep + 87)
#define ActRcvFilBrfCla (ActSeeMyUsgRep + 88)
#define ActExpBrf (ActSeeMyUsgRep + 89)
#define ActConBrf (ActSeeMyUsgRep + 90)
#define ActZIPBrf (ActSeeMyUsgRep + 91)
#define ActReqDatBrf (ActSeeMyUsgRep + 92)
#define ActChgDatBrf (ActSeeMyUsgRep + 93)
#define ActDowBrf (ActSeeMyUsgRep + 94)
#define ActReqRemFilBrf (ActSeeMyUsgRep + 78)
#define ActRemFilBrf (ActSeeMyUsgRep + 79)
#define ActRemFolBrf (ActSeeMyUsgRep + 80)
#define ActCopBrf (ActSeeMyUsgRep + 81)
#define ActPasBrf (ActSeeMyUsgRep + 82)
#define ActRemTreBrf (ActSeeMyUsgRep + 83)
#define ActFrmCreBrf (ActSeeMyUsgRep + 84)
#define ActCreFolBrf (ActSeeMyUsgRep + 85)
#define ActCreLnkBrf (ActSeeMyUsgRep + 86)
#define ActRenFolBrf (ActSeeMyUsgRep + 87)
#define ActRcvFilBrfDZ (ActSeeMyUsgRep + 88)
#define ActRcvFilBrfCla (ActSeeMyUsgRep + 89)
#define ActExpBrf (ActSeeMyUsgRep + 90)
#define ActConBrf (ActSeeMyUsgRep + 91)
#define ActZIPBrf (ActSeeMyUsgRep + 92)
#define ActReqDatBrf (ActSeeMyUsgRep + 93)
#define ActChgDatBrf (ActSeeMyUsgRep + 94)
#define ActDowBrf (ActSeeMyUsgRep + 95)
#define ActReqRemOldBrf (ActSeeMyUsgRep + 95)
#define ActRemOldBrf (ActSeeMyUsgRep + 96)
#define ActReqRemOldBrf (ActSeeMyUsgRep + 96)
#define ActRemOldBrf (ActSeeMyUsgRep + 97)
/*****************************************************************************/
/******************************** Public types *******************************/

View File

@ -149,7 +149,7 @@ void Cal_ChangeFirstDayOfWeek (void)
/***** Get param with icon set *****/
Gbl.Prefs.FirstDayOfWeek = Cal_GetParamFirstDayOfWeek ();
/***** Store icon set in database *****/
/***** Store icon first day of week database *****/
if (Gbl.Usrs.Me.Logged)
{
sprintf (Query,"UPDATE usr_data SET FirstDayOfWeek=%u"

View File

@ -224,17 +224,23 @@
// 5. Informar a otros usuarios de que es el cumpleaños de otros usuarios para que los feliciten (habría que añadir una categoría de privacidad nueva para la visibilidad de la fecha de cumpleaños).
// 6. La información sobre nuevas notificaciones debería aparecer también en pantallas pequeñas (móviles). Tal vez podría aparecer también en el icono de notificaciones de la pestaña MENSAJES.
// TODO: Fix bug: When a centre is associated with a place and it is moved to another institution, what happens with the place?
// TODO: Check what happens with places when a centre is removed
// TODO: Green lock in documents is not shown when name is shortened (see OpenSWAD -> Creative Commons -> Files -> Documents)
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.202.2 (2017-05-03)"
#define Log_PLATFORM_VERSION "SWAD 16.203 (2017-05-04)"
#define CSS_FILE "swad16.202.css"
#define JS_FILE "swad16.181.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.203: May 04, 2017 Form in preferences to change date format. Not finished. (218447 lines)
Version 16.202.2: May 03, 2017 Fixed bug in attendance events, reported by Francisco Ocaña Lara. (218306 lines)
Version 16.202.1: May 02, 2017 Changed help on surveys from STATS to ASSESSMENT. (218296 lines)
Version 16.202: May 02, 2017 Changes in layout of alerts. (218295 lines)

View File

@ -34,6 +34,7 @@
#include "swad_date.h"
#include "swad_global.h"
#include "swad_parameter.h"
#include "swad_preference.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
@ -75,6 +76,14 @@ const char *Dat_TimeStatusClassHidden[Dat_NUM_TIME_STATUS] =
"DATE_BLUE_LIGHT", // Dat_FUTURE
};
/***** Date format *****/
static const char *Dat_Format_Str[Dat_NUM_OPTIONS_FORMAT] =
{
"yyyy-mm-dd", // Dat_FORMAT_YYYY_MM_DD
"dd mmm yyyy", // Dat_FORMAT_DD_MONTH_YYYY
"mmm dd, yyyy", // Dat_FORMAT_MONTH_DD_YYYY
};
/*****************************************************************************/
/****************************** Internal types *******************************/
/*****************************************************************************/
@ -83,6 +92,106 @@ const char *Dat_TimeStatusClassHidden[Dat_NUM_TIME_STATUS] =
/**************************** Private prototypes *****************************/
/*****************************************************************************/
static void Dat_PutIconsDateFormat (void);
static unsigned Dat_GetParamDateFormat (void);
/*****************************************************************************/
/************** Put icons to select the first day of the week ****************/
/*****************************************************************************/
void Dat_PutIconsToSelectDateFormat (void)
{
extern const char *Hlp_PROFILE_Preferences_calendar;
extern const char *Txt_Dates;
Dat_Format_t Format;
/***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_Dates,
Dat_PutIconsDateFormat,
Hlp_PROFILE_Preferences_calendar);
/***** Form with list of options *****/
Act_FormStart (ActChgDatFmt);
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
for (Format = (Dat_Format_t) 0;
Format <= (Dat_Format_t) (Dat_NUM_OPTIONS_FORMAT - 1);
Format++)
{
fprintf (Gbl.F.Out,"<li class=\"%s\">"
"<label>"
"<input type=\"radio\" name=\"DateFormat\" value=\"%u\"",
(Format == Gbl.Usrs.Me.UsrDat.Prefs.DateFormat) ? "DAT_N LIGHT_BLUE" :
"DAT",
(unsigned) Format);
if (Format == Gbl.Usrs.Me.UsrDat.Prefs.DateFormat)
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />"
"%s"
"</label>"
"</li>",
Gbl.Form.Id,
Dat_Format_Str[Format]);
}
/***** End of list and form *****/
fprintf (Gbl.F.Out,"</ul>");
/***** End form *****/
Act_FormEnd ();
/***** End frame *****/
Lay_EndRoundFrame ();
}
/*****************************************************************************/
/************** Put contextual icons in date-format preference ***************/
/*****************************************************************************/
static void Dat_PutIconsDateFormat (void)
{
/***** Put icon to show a figure *****/
Gbl.Stat.FigureType = Sta_FIRST_DAY_OF_WEEK; // TODO: Change!!!!!!!!!!!!!!
Sta_PutIconToShowFigure ();
}
/*****************************************************************************/
/***************************** Change date format ****************************/
/*****************************************************************************/
void Dat_ChangeDateFormat (void)
{
char Query[512];
/***** Get param with date format *****/
Gbl.Prefs.DateFormat = Dat_GetParamDateFormat ();
/***** Store date format in database *****/
if (Gbl.Usrs.Me.Logged)
{
sprintf (Query,"UPDATE usr_data SET DateFormat=%u"
" WHERE UsrCod=%ld",
(unsigned) Gbl.Prefs.DateFormat,
Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE (Query,"can not update your preference about date format");
}
/***** Set preferences from current IP *****/
Pre_SetPrefsFromIP ();
}
/*****************************************************************************/
/********************** Get parameter with date format ***********************/
/*****************************************************************************/
static unsigned Dat_GetParamDateFormat (void)
{
return (unsigned) Par_GetParToUnsignedLong ("DateFormat",
0,
Dat_NUM_OPTIONS_FORMAT - 1,
Dat_FORMAT_DEFAULT);
}
/*****************************************************************************/
/************************** Get current time UTC *****************************/
/*****************************************************************************/

View File

@ -99,10 +99,23 @@ typedef enum
Dat_HMS_TO_235959 = 2,
} Dat_SetHMS;
/***** Date format *****/
#define Dat_NUM_OPTIONS_FORMAT 3
typedef enum
{
Dat_FORMAT_YYYY_MM_DD = 0, // ISO 8601, default
Dat_FORMAT_DD_MONTH_YYYY = 1,
Dat_FORMAT_MONTH_DD_YYYY = 2,
} Dat_Format_t;
#define Dat_FORMAT_DEFAULT Dat_FORMAT_YYYY_MM_DD
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Dat_PutIconsToSelectDateFormat (void);
void Dat_ChangeDateFormat (void);
void Dat_GetStartExecutionTimeUTC (void);
void Dat_GetAndConvertCurrentDateTime (void);

View File

@ -129,6 +129,7 @@ void Gbl_InitializeGlobals (void)
Gbl.Prefs.Language = Txt_Current_CGI_SWAD_Language;
Gbl.Prefs.FirstDayOfWeek = Cal_FIRST_DAY_OF_WEEK_DEFAULT; // Default first day of week
Gbl.Prefs.DateFormat = Dat_FORMAT_DEFAULT; // Default date format
Gbl.Prefs.Menu = Mnu_MENU_DEFAULT; // Default menu
Gbl.Prefs.Theme = The_THEME_DEFAULT; // Default theme
Gbl.Prefs.IconSet = Ico_ICON_SET_DEFAULT; // Default icon set

View File

@ -152,6 +152,7 @@ struct Globals
{
Txt_Language_t Language;
unsigned FirstDayOfWeek;
Dat_Format_t DateFormat;
Mnu_Menu_t Menu;
unsigned SideCols;
The_Theme_t Theme;

View File

@ -33,6 +33,7 @@
#include "swad_calendar.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_date.h"
#include "swad_global.h"
#include "swad_layout.h"
#include "swad_notification.h"
@ -77,26 +78,33 @@ void Pre_EditPrefs (void)
Pre_PutSelectorToSelectLanguage (); // 1. Language
Lay_EndRoundFrame ();
/***** Icon set, theme *****/
/***** First day of week, date format *****/
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
"<div class=\"FRAME_INLINE\">");
Ico_PutIconsToSelectIconSet (); // 2. Icon set
Cal_PutIconsToSelectFirstDayOfWeek (); // 2. First day of week
fprintf (Gbl.F.Out,"</div>"
"<div class=\"FRAME_INLINE\">");
Mnu_PutIconsToSelectMenu (); // 3. Menu
fprintf (Gbl.F.Out,"</div>"
"<div class=\"FRAME_INLINE\">");
Cal_PutIconsToSelectFirstDayOfWeek (); // 4. First day of week
Dat_PutIconsToSelectDateFormat (); // 3. Date format
fprintf (Gbl.F.Out,"</div>"
"</div>");
/***** Menu, side columns *****/
/***** Icon set, menu *****/
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
"<div class=\"FRAME_INLINE\">");
The_PutIconsToSelectTheme (); // 5. Theme
Ico_PutIconsToSelectIconSet (); // 4. Icon set
fprintf (Gbl.F.Out,"</div>"
"<div class=\"FRAME_INLINE\">");
Pre_PutIconsToSelectSideCols (); // 6. Side columns
Mnu_PutIconsToSelectMenu (); // 5. Menu
fprintf (Gbl.F.Out,"</div>"
"</div>");
/***** Theme, side columns *****/
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
"<div class=\"FRAME_INLINE\">");
The_PutIconsToSelectTheme (); // 6. Theme
fprintf (Gbl.F.Out,"</div>"
"<div class=\"FRAME_INLINE\">");
Pre_PutIconsToSelectSideCols (); // 7. Side columns
fprintf (Gbl.F.Out,"</div>"
"</div>");

View File

@ -7394,6 +7394,27 @@ const char *Txt_Date_of_creation =
"Data da cria&ccedil;&atilde;o";
#endif
const char *Txt_Dates =
#if L==1
"Dates";
#elif L==2
"Datum";
#elif L==3
"Dates";
#elif L==4
"Fechas";
#elif L==5
"Dates";
#elif L==6
"Arange";
#elif L==7
"Date";
#elif L==8
"Daty";
#elif L==9
"Datas";
#endif
const char *Txt_Day =
#if L==1
"D&iacute;a"; // Necessita traduccio

View File

@ -303,6 +303,7 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
UsrDat->Prefs.Language = Txt_LANGUAGE_UNKNOWN; // Language unknown
UsrDat->Prefs.FirstDayOfWeek = Cal_FIRST_DAY_OF_WEEK_DEFAULT; // Default first day of week
UsrDat->Prefs.DateFormat = Dat_FORMAT_DEFAULT ; // Default date format
UsrDat->Prefs.Theme = The_THEME_DEFAULT;
UsrDat->Prefs.IconSet = Ico_ICON_SET_DEFAULT;
UsrDat->Prefs.Menu = Mnu_MENU_DEFAULT;

View File

@ -164,6 +164,7 @@ struct UsrData
{
Txt_Language_t Language;
unsigned FirstDayOfWeek;
Dat_Format_t DateFormat;
The_Theme_t Theme;
Ico_IconSet_t IconSet;
Mnu_Menu_t Menu;