mirror of https://github.com/acanas/swad-core.git
Version 16.208
This commit is contained in:
parent
a3540dcfc3
commit
4a31d9e68d
2
Makefile
2
Makefile
|
@ -39,7 +39,7 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_announcement.o \
|
|||
swad_help.o swad_hierarchy.o swad_holiday.o \
|
||||
swad_icon.o swad_ID.o swad_image.o swad_indicator.o \
|
||||
swad_info.o swad_institution.o \
|
||||
swad_layout.o swad_link.o swad_logo.o \
|
||||
swad_language.o swad_layout.o swad_link.o swad_logo.o \
|
||||
swad_mail.o swad_main.o swad_mark.o swad_menu.o swad_message.o \
|
||||
swad_MFU.o \
|
||||
swad_network.o swad_nickname.o swad_notice.o swad_notification.o \
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
#include "swad_follow.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_ID.h"
|
||||
#include "swad_language.h"
|
||||
#include "swad_notification.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_preference.h"
|
||||
#include "swad_profile.h"
|
||||
#include "swad_report.h"
|
||||
#include "swad_social.h"
|
||||
|
@ -119,7 +119,7 @@ void Acc_ShowFormMyAccount (void)
|
|||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||
Usr_PutLinkToLogin ();
|
||||
Pwd_PutLinkToSendNewPasswd ();
|
||||
Pre_PutLinkToChangeLanguage ();
|
||||
Lan_PutLinkToChangeLanguage ();
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/**** Show form to check if I have an account *****/
|
||||
|
@ -185,7 +185,7 @@ void Acc_CheckIfEmptyAccountExists (void)
|
|||
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
|
||||
Usr_PutLinkToLogin ();
|
||||
Pwd_PutLinkToSendNewPasswd ();
|
||||
Pre_PutLinkToChangeLanguage ();
|
||||
Lan_PutLinkToChangeLanguage ();
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/***** Get new user's ID from form *****/
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "swad_global.h"
|
||||
#include "swad_ID.h"
|
||||
#include "swad_indicator.h"
|
||||
#include "swad_language.h"
|
||||
#include "swad_mail.h"
|
||||
#include "swad_mark.h"
|
||||
#include "swad_MFU.h"
|
||||
|
@ -2945,8 +2946,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActChgMyNet */{1173,-1,TabUnk,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Net_UpdateMyWebsAndSocialNets ,NULL},
|
||||
|
||||
/* ActChgThe */{ 841,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,The_ChangeTheme ,Pre_EditPrefs ,NULL},
|
||||
/* 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},
|
||||
/* ActReqChgLan */{ 992,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Lan_AskChangeLanguage ,NULL},
|
||||
/* ActChgLan */{ 654,-1,TabUnk,ActEdiPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,Lan_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},
|
||||
|
|
|
@ -232,14 +232,15 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.207.2 (2017-05-07)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.208 (2017-05-07)"
|
||||
#define CSS_FILE "swad16.207.css"
|
||||
#define JS_FILE "swad16.206.3.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.207.2: May 05, 2017 Changes un help on preferences. (218621 lines)
|
||||
Version 16.208: May 07, 2017 New module swad_language for preference on language. (218695 lines)
|
||||
Version 16.207.2: May 07, 2017 Changes un help on preferences. (218621 lines)
|
||||
Version 16.207.1: May 05, 2017 Minor changes in layout. (218577 lines)
|
||||
Version 16.207: May 05, 2017 Changes in layout of preferences. (218577 lines)
|
||||
Version 16.206.4: May 05, 2017 Changes in question to change language. (218534 lines)
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "swad_global.h"
|
||||
#include "swad_help.h"
|
||||
#include "swad_institution.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_language.h"
|
||||
#include "swad_preference.h"
|
||||
#include "swad_QR.h"
|
||||
#include "swad_text.h"
|
||||
|
@ -1739,7 +1739,7 @@ void Cty_RenameCountry (void)
|
|||
Cty->CtyCod = Cty_GetAndCheckParamOtherCtyCod ();
|
||||
|
||||
/* Get the lenguage */
|
||||
Language = Pre_GetParamLanguage ();
|
||||
Language = Lan_GetParamLanguage ();
|
||||
|
||||
/* Get the new name for the country */
|
||||
Par_GetParToText ("Name",NewCtyName,Cty_MAX_BYTES_NAME);
|
||||
|
@ -1870,7 +1870,7 @@ void Cty_ChangeCtyWWW (void)
|
|||
Cty->CtyCod = Cty_GetAndCheckParamOtherCtyCod ();
|
||||
|
||||
/* Get the lenguage */
|
||||
Language = Pre_GetParamLanguage ();
|
||||
Language = Lan_GetParamLanguage ();
|
||||
|
||||
/* Get the new WWW for the country */
|
||||
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
|
||||
|
|
|
@ -95,7 +95,7 @@ static unsigned Dat_GetParamDateFormat (void);
|
|||
/************** Put icons to select the first day of the week ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Dat_PutIconsToSelectDateFormat (void)
|
||||
void Dat_PutBoxToSelectDateFormat (void)
|
||||
{
|
||||
extern const char *Hlp_PROFILE_Preferences_dates;
|
||||
extern const char *Txt_Dates;
|
||||
|
|
|
@ -115,7 +115,7 @@ typedef enum
|
|||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Dat_PutIconsToSelectDateFormat (void);
|
||||
void Dat_PutBoxToSelectDateFormat (void);
|
||||
|
||||
void Dat_PutSpanDateFormat (Dat_Format_t Format);
|
||||
void Dat_PutScriptDateFormat (Dat_Format_t Format);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "swad_global.h"
|
||||
#include "swad_help.h"
|
||||
#include "swad_hierarchy.h"
|
||||
#include "swad_language.h"
|
||||
#include "swad_logo.h"
|
||||
#include "swad_MFU.h"
|
||||
#include "swad_notice.h"
|
||||
|
@ -894,7 +895,7 @@ static void Lay_WritePageTopHeading (void)
|
|||
if (Gbl.Usrs.Me.Logged)
|
||||
Usr_WriteLoggedUsrHead ();
|
||||
else
|
||||
Pre_PutSelectorToSelectLanguage ();
|
||||
Lan_PutSelectorToSelectLanguage ();
|
||||
|
||||
fprintf (Gbl.F.Out,"<div id=\"login_box\">");
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "swad_database.h"
|
||||
#include "swad_date.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_language.h"
|
||||
#include "swad_layout.h"
|
||||
#include "swad_notification.h"
|
||||
#include "swad_menu.h"
|
||||
|
@ -57,10 +58,6 @@ extern struct Globals Gbl;
|
|||
/****************************** Private prototypes ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Pre_PutIconsLanguage (void);
|
||||
|
||||
static void Pre_PutParamLanguage (void);
|
||||
|
||||
static void Pre_PutIconsToSelectSideCols (void);
|
||||
static void Pre_PutIconsSideColumns (void);
|
||||
static void Pre_UpdateSideColsOnUsrDataTable (void);
|
||||
|
@ -72,26 +69,21 @@ static void Pre_UpdateSideColsOnUsrDataTable (void);
|
|||
void Pre_EditPrefs (void)
|
||||
{
|
||||
extern const char *Hlp_PROFILE_Preferences_internationalization;
|
||||
extern const char *Hlp_PROFILE_Preferences_language;
|
||||
extern const char *Hlp_PROFILE_Preferences_design;
|
||||
extern const char *Txt_Internationalization;
|
||||
extern const char *Txt_Design;
|
||||
extern const char *Txt_Language;
|
||||
|
||||
/***** Internationalization: language, first day of week, date format *****/
|
||||
Lay_StartRoundFrame (NULL,Txt_Internationalization,NULL,
|
||||
Hlp_PROFILE_Preferences_internationalization);
|
||||
fprintf (Gbl.F.Out,"<div class=\"FRAME_INLINE\">");
|
||||
Lay_StartRoundFrame (NULL,Txt_Language,Pre_PutIconsLanguage,
|
||||
Hlp_PROFILE_Preferences_language);
|
||||
Pre_PutSelectorToSelectLanguage (); // 1. Language
|
||||
Lay_EndRoundFrame ();
|
||||
Lan_PutBoxToSelectLanguage (); // 1. Language
|
||||
fprintf (Gbl.F.Out,"</div>"
|
||||
"<div class=\"FRAME_INLINE\">");
|
||||
Cal_PutIconsToSelectFirstDayOfWeek (); // 2. First day of week
|
||||
fprintf (Gbl.F.Out,"</div>"
|
||||
"<div class=\"FRAME_INLINE\">");
|
||||
Dat_PutIconsToSelectDateFormat (); // 3. Date format
|
||||
Dat_PutBoxToSelectDateFormat (); // 3. Date format
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
Lay_EndRoundFrame ();
|
||||
|
||||
|
@ -121,17 +113,6 @@ void Pre_EditPrefs (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Put contextual icons in language preference *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Pre_PutIconsLanguage (void)
|
||||
{
|
||||
/***** Put icon to show a figure *****/
|
||||
Gbl.Stat.FigureType = Sta_LANGUAGES;
|
||||
Sta_PutIconToShowFigure ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get preferences changed from current IP *****************/
|
||||
/*****************************************************************************/
|
||||
|
@ -243,142 +224,6 @@ void Pre_RemoveOldPrefsFromIP (void)
|
|||
DB_QueryDELETE (Query,"can not remove old preferences");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Put link to change language (edit preferences) ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pre_PutLinkToChangeLanguage (void)
|
||||
{
|
||||
Lay_PutContextualLink (ActEdiPrf,NULL,NULL,
|
||||
"cty64x64.gif",
|
||||
"Change language","Change language",
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Put a selector to select language *********************/
|
||||
/*****************************************************************************/
|
||||
// Width == 0 means don't force width of selector
|
||||
|
||||
void Pre_PutSelectorToSelectLanguage (void)
|
||||
{
|
||||
extern const char *Txt_STR_LANG_NAME[1 + Txt_NUM_LANGUAGES];
|
||||
Txt_Language_t Lan;
|
||||
|
||||
Act_FormStart (ActReqChgLan);
|
||||
fprintf (Gbl.F.Out,"<select name=\"Lan\""
|
||||
" style=\"width:112px; margin:0;\""
|
||||
" onchange=\"document.getElementById('%s').submit();\">",
|
||||
Gbl.Form.Id);
|
||||
for (Lan = (Txt_Language_t) 1;
|
||||
Lan <= Txt_NUM_LANGUAGES;
|
||||
Lan++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Lan);
|
||||
if (Lan == Gbl.Prefs.Language)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",Txt_STR_LANG_NAME[Lan]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>");
|
||||
Act_FormEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Ask user if he/she really wants to change the language ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pre_AskChangeLanguage (void)
|
||||
{
|
||||
extern const char *Txt_Do_you_want_to_change_your_language_to_LANGUAGE[1 + Txt_NUM_LANGUAGES];
|
||||
extern const char *Txt_Do_you_want_to_change_the_language_to_LANGUAGE[1 + Txt_NUM_LANGUAGES];
|
||||
extern const char *Txt_Switch_to_LANGUAGE[1 + Txt_NUM_LANGUAGES];
|
||||
Txt_Language_t CurrentLanguage = Gbl.Prefs.Language;
|
||||
|
||||
/***** Get param language *****/
|
||||
Gbl.Prefs.Language = Pre_GetParamLanguage (); // Change temporarily language to set form action
|
||||
|
||||
/***** Request confirmation *****/
|
||||
Lay_ShowAlertAndButton1 (Lay_QUESTION,
|
||||
Gbl.Usrs.Me.Logged ? Txt_Do_you_want_to_change_your_language_to_LANGUAGE[Gbl.Prefs.Language] :
|
||||
Txt_Do_you_want_to_change_the_language_to_LANGUAGE[Gbl.Prefs.Language]);
|
||||
Lay_ShowAlertAndButton2 (ActChgLan,NULL,Pre_PutParamLanguage,
|
||||
Lay_CONFIRM_BUTTON,
|
||||
Txt_Switch_to_LANGUAGE[Gbl.Prefs.Language]);
|
||||
|
||||
Gbl.Prefs.Language = CurrentLanguage; // Restore current language
|
||||
|
||||
/***** Display preferences *****/
|
||||
Pre_EditPrefs ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Change language *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Pre_PutParamLanguage (void)
|
||||
{
|
||||
Par_PutHiddenParamUnsigned ("Lan",(unsigned) Gbl.Prefs.Language);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Change language *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pre_ChangeLanguage (void)
|
||||
{
|
||||
/***** Get param language *****/
|
||||
Gbl.Prefs.Language = Pre_GetParamLanguage ();
|
||||
|
||||
/***** Store language in database *****/
|
||||
/*
|
||||
sprintf (Gbl.Message,"Txt_STR_LANG_ID[Gbl.Prefs.Language] = %s",Txt_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
sprintf (Gbl.Message,"Txt_STR_LANG_ID[Gbl.Usrs.Me.UsrDat.Prefs.Language] = %s",Txt_STR_LANG_ID[Gbl.Usrs.Me.UsrDat.Prefs.Language]);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
*/
|
||||
|
||||
if (Gbl.Usrs.Me.Logged &&
|
||||
Gbl.Prefs.Language != Gbl.Usrs.Me.UsrDat.Prefs.Language)
|
||||
Pre_UpdateMyLanguageToCurrentLanguage ();
|
||||
|
||||
/***** Set preferences from current IP *****/
|
||||
Pre_SetPrefsFromIP ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Update my language to the current language *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pre_UpdateMyLanguageToCurrentLanguage (void)
|
||||
{
|
||||
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
|
||||
char Query[128];
|
||||
|
||||
/***** Set my language to the current language *****/
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.Language = Gbl.Prefs.Language;
|
||||
|
||||
/***** Update my language in database *****/
|
||||
sprintf (Query,"UPDATE usr_data SET Language='%s' WHERE UsrCod=%ld",
|
||||
Txt_STR_LANG_ID[Gbl.Prefs.Language],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your language");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Get parameter language **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
Txt_Language_t Pre_GetParamLanguage (void)
|
||||
{
|
||||
extern const unsigned Txt_Current_CGI_SWAD_Language;
|
||||
|
||||
return (Txt_Language_t)
|
||||
Par_GetParToUnsignedLong ("Lan",
|
||||
1,
|
||||
Txt_NUM_LANGUAGES,
|
||||
(unsigned long) Txt_Current_CGI_SWAD_Language);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Put icons to select the layout of the side columns *************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -45,13 +45,6 @@ void Pre_GetPrefsFromIP (void);
|
|||
void Pre_SetPrefsFromIP (void);
|
||||
void Pre_RemoveOldPrefsFromIP (void);
|
||||
|
||||
void Pre_PutLinkToChangeLanguage (void);
|
||||
void Pre_PutSelectorToSelectLanguage (void);
|
||||
void Pre_AskChangeLanguage (void);
|
||||
void Pre_ChangeLanguage (void);
|
||||
void Pre_UpdateMyLanguageToCurrentLanguage (void);
|
||||
Txt_Language_t Pre_GetParamLanguage (void);
|
||||
|
||||
void Pre_ChangeSideCols (void);
|
||||
void Pre_HideLeftCol (void);
|
||||
void Pre_HideRightCol (void);
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "swad_help.h"
|
||||
#include "swad_hierarchy.h"
|
||||
#include "swad_ID.h"
|
||||
#include "swad_language.h"
|
||||
#include "swad_MFU.h"
|
||||
#include "swad_nickname.h"
|
||||
#include "swad_notification.h"
|
||||
|
@ -2019,7 +2020,7 @@ void Usr_WriteFormLogin (Act_Action_t NextAction,void (*FuncParams) ())
|
|||
|
||||
Acc_PutLinkToCreateAccount ();
|
||||
Pwd_PutLinkToSendNewPasswd ();
|
||||
Pre_PutLinkToChangeLanguage ();
|
||||
Lan_PutLinkToChangeLanguage ();
|
||||
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
|
@ -2839,7 +2840,7 @@ static void Usr_SetUsrRoleAndPrefs (void)
|
|||
|
||||
/***** Set my language if unknown *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.Prefs.Language == Txt_LANGUAGE_UNKNOWN) // I have not chosen language
|
||||
Pre_UpdateMyLanguageToCurrentLanguage (); // Update my language in database
|
||||
Lan_UpdateMyLanguageToCurrentLanguage (); // Update my language in database
|
||||
|
||||
/***** Set preferences from my preferences *****/
|
||||
Gbl.Prefs.FirstDayOfWeek = Gbl.Usrs.Me.UsrDat.Prefs.FirstDayOfWeek;
|
||||
|
|
Loading…
Reference in New Issue