Version 15.34.2

This commit is contained in:
Antonio Cañas Vargas 2015-11-02 18:55:24 +01:00
parent 7609708949
commit 71b8071524
6 changed files with 180 additions and 241 deletions

View File

@ -37,9 +37,9 @@ var countClockConnected = 0;
// Write a date in client local time
function writeLocalDateFromUTC(id,TimeUTC) {
var d = new Date;
var Yea;
var Mon;
var Day;
var Yea;
var Mon;
var Day;
var StrMon;
var StrDay;
@ -59,12 +59,12 @@ function writeLocalDateFromUTC(id,TimeUTC) {
function writeLocalDateTimeFromUTC(id,TimeUTC,separator) {
var d = new Date;
var Yea;
var Mon;
var Day;
var Hou;
var Min;
var Sec;
var Yea;
var Mon;
var Day;
var Hou;
var Min;
var Sec;
var StrMon;
var StrDay;
var StrHou;
@ -90,10 +90,10 @@ function writeLocalDateTimeFromUTC(id,TimeUTC,separator) {
// Set local date-time form fields from UTC time
function setLocalDateTimeFormFromUTC(id,TimeUTC) {
var FormYea = document.getElementById(id+'Year');
var FormMon = document.getElementById(id+'Month');
var FormDay = document.getElementById(id+'Day');
var FormHou = document.getElementById(id+'Hour');
var FormYea = document.getElementById(id+'Year' );
var FormMon = document.getElementById(id+'Month' );
var FormDay = document.getElementById(id+'Day' );
var FormHou = document.getElementById(id+'Hour' );
var FormMin = document.getElementById(id+'Minute');
var FormSec = document.getElementById(id+'Second');
var d;
@ -109,16 +109,13 @@ function setLocalDateTimeFormFromUTC(id,TimeUTC) {
FormYea.options[i].selected = true;
YearIsValid = true;
}
FormMon.disabled = false;
FormDay.disabled = false;
FormHou.disabled = false;
FormMin.disabled = false;
FormSec.disabled = false;
FormMon.options[d.getMonth()+1].selected = true;
FormDay.options[d.getDate() ].selected = true;
FormHou.options[d.getHours() ].selected = true;
FormMin.options[d.getMinutes()].selected = true;
FormSec.options[d.getSeconds()].selected = true;
if (YearIsValid) {
FormMon.options[d.getMonth() ].selected = true;
FormDay.options[d.getDate()-1 ].selected = true;
FormHou.options[d.getHours() ].selected = true;
FormMin.options[d.getMinutes()].selected = true;
FormSec.options[d.getSeconds()].selected = true;
}
}
if (!YearIsValid) {
@ -128,71 +125,23 @@ function setLocalDateTimeFormFromUTC(id,TimeUTC) {
FormHou.options[0].selected = true;
FormMin.options[0].selected = true;
FormSec.options[0].selected = true;
FormMon.disabled = true;
FormDay.disabled = true;
FormHou.disabled = true;
FormMin.disabled = true;
FormSec.disabled = true;
}
}
// Set UTC time from local date-time form fields
function setUTCFromLocalDateTimeForm(id) {
var FormYea = document.getElementById(id+'Year');
var FormMon = document.getElementById(id+'Month');
var FormDay = document.getElementById(id+'Day');
var FormHou = document.getElementById(id+'Hour');
var FormMin = document.getElementById(id+'Minute');
var FormSec = document.getElementById(id+'Second');
var FormTimeUTC = document.getElementById(id+'TimeUTC');
var d;
var Yea = FormYea.value;
var Mon;
var Day;
if (Yea == 0) {
FormYea.options[0].selected = true;
FormMon.options[0].selected = true;
FormDay.options[0].selected = true;
FormHou.options[0].selected = true;
FormMin.options[0].selected = true;
FormSec.options[0].selected = true;
var d = new (Date);
FormMon.disabled = true;
FormDay.disabled = true;
FormHou.disabled = true;
FormMin.disabled = true;
FormSec.disabled = true;
// Important: set year first in order to work properly with leap years
d.setFullYear(document.getElementById(id+'Year' ).value);
d.setMonth (document.getElementById(id+'Month' ).value-1);
d.setDate (document.getElementById(id+'Day' ).value);
d.setHours (document.getElementById(id+'Hour' ).value);
d.setMinutes (document.getElementById(id+'Minute').value);
d.setSeconds (document.getElementById(id+'Second').value);
d.setMilliseconds(0);
FormTimeUTC.value = 0;
}
else {
FormMon.disabled = false;
FormDay.disabled = false;
FormHou.disabled = false;
FormMin.disabled = false;
FormSec.disabled = false;
Mon = FormMon.value;
if (Mon == 0)
Mon = 1;
Day = FormDay.value;
if (Day == 0)
Day = 1;
// Important: set year first in order to work properly with leap years
d = new (Date);
d.setFullYear(Yea);
d.setMonth (Mon-1);
d.setDate (Day);
d.setHours (FormHou.value);
d.setMinutes (FormMin.value);
d.setSeconds (FormSec.value);
d.setMilliseconds(0);
FormTimeUTC.value = d.getTime() / 1000;
}
document.getElementById(id+'TimeUTC').value = d.getTime() / 1000;
}
// Set form param with time difference between UTC time and client local time, in minutes
@ -220,33 +169,24 @@ function adjustDateForm (id) {
var Yea = FormYea.options[FormYea.selectedIndex].value;
var Days;
if (FormYea.selectedIndex > 0) {
if (FormMon.options[0].selected) { // No month selected, set to january
FormMon.options[1].selected = true;
Days = 31;
}
else if (FormMon.options[2].selected) // Adjust days of february
Days = ((((Yea % 4) == 0) && ((Yea % 100) != 0)) || ((Yea % 400) == 0)) ? 29 : 28;
else if (FormMon.options[ 4].selected ||
FormMon.options[ 6].selected ||
FormMon.options[ 9].selected ||
FormMon.options[11].selected)
Days = 30;
else
Days = 31;
if (FormDay.options[0].selected) // No day selected, set to 1
FormDay.options[1].selected = true;
else if (FormDay.selectedIndex > Days)
FormDay.options[Days].selected = true;
for (var i=FormDay.options.length; i<=Days ; i++) { // Create new days
var x = String (i);
FormDay.options[i] = new Option(x,x);
}
for (var i=FormDay.options.length-1; i>Days; i--) // Remove days
FormDay.options[i] = null;
if (FormMon.options[1].selected) // February
Days = ((((Yea % 4) == 0) && ((Yea % 100) != 0)) || ((Yea % 400) == 0)) ? 29 : 28;
else if (FormMon.options[ 3].selected || // April
FormMon.options[ 5].selected || // June
FormMon.options[ 8].selected || // September
FormMon.options[10].selected) // November
Days = 30;
else
Days = 31;
if (FormDay.selectedIndex >= Days)
FormDay.options[Days-1].selected = true; // Select last day in month
for (var i=FormDay.options.length; i<Days; i++) { // Create new days at the end
FormDay.options[i] = new Option(String(i+1),i+1);
}
for (var i=FormDay.options.length-1; i>=Days; i--) // Remove days from the end
FormDay.options[i] = null;
}
// Set a date range form to yesterday
@ -277,11 +217,11 @@ function setDateRange(d) {
FormYea.options[i].selected = true;
break;
}
document.getElementById('StartMonth' ).options[Mon].selected = true;
document.getElementById('StartDay' ).options[Day].selected = true;
document.getElementById('StartHour' ).options[0 ].selected = true;
document.getElementById('StartMinute').options[0 ].selected = true;
document.getElementById('StartSecond').options[0 ].selected = true;
document.getElementById('StartMonth' ).options[Mon-1].selected = true;
document.getElementById('StartDay' ).options[Day-1].selected = true;
document.getElementById('StartHour' ).options[0 ].selected = true;
document.getElementById('StartMinute').options[0 ].selected = true;
document.getElementById('StartSecond').options[0 ].selected = true;
setUTCFromLocalDateTimeForm('Start');
FormYea = document.getElementById('EndYear');
@ -290,11 +230,11 @@ function setDateRange(d) {
FormYea.options[i].selected = true;
break;
}
document.getElementById('EndMonth' ).options[Mon].selected = true;
document.getElementById('EndDay' ).options[Day].selected = true;
document.getElementById('EndHour' ).options[23 ].selected = true;
document.getElementById('EndMinute').options[59 ].selected = true;
document.getElementById('EndSecond').options[59 ].selected = true;
document.getElementById('EndMonth' ).options[Mon-1].selected = true;
document.getElementById('EndDay' ).options[Day-1].selected = true;
document.getElementById('EndHour' ).options[23 ].selected = true;
document.getElementById('EndMinute').options[59 ].selected = true;
document.getElementById('EndSecond').options[59 ].selected = true;
setUTCFromLocalDateTimeForm('End');
}

View File

@ -60,7 +60,8 @@ extern struct Globals Gbl;
static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status,
const char *Subject,const char *Content,
unsigned Roles,bool ShowAllAnnouncements,
unsigned Roles,
bool ShowAllAnnouncements,
bool ICanEditAnnouncements);
static void Ann_PutHiddenParamAnnCod (long AnnCod);
static long Ann_GetParamAnnCod (void);
@ -158,8 +159,7 @@ void Ann_ShowAllAnnouncements (void)
/* Show the announcement */
Ann_DrawAnAnnouncement (AnnCod,Status,Subject,Content,
Roles,true,
ICanEditAnnouncements);
Roles,true,ICanEditAnnouncements);
}
/***** End frame *****/
@ -236,7 +236,8 @@ void Ann_ShowMyAnnouncementsNotMarkedAsSeen (void)
static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status,
const char *Subject,const char *Content,
unsigned Roles,bool ShowAllAnnouncements,
unsigned Roles,
bool ShowAllAnnouncements,
bool ICanEditAnnouncements)
{
extern const char *The_ClassForm[The_NUM_THEMES];

View File

@ -103,18 +103,18 @@
// TODO: Put headers Content-type and Content-disposition when redirecting with Location:
// TODO: System admin should be able to remove/edit user's mail (when he/she detects a recipient does not exists, for example)
// TODO: When a new assignment/attendance/survey is incorrect, the second time the form is shown, it should be filled with partial data, now is always empty
// TODO: Global announcements should be available for all users?
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.34.1 (2015/11/01)"
#define Log_PLATFORM_VERSION "SWAD 15.34.2 (2015/11/02)"
// 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.34.1: Nov 01, 2015 Global announcements can be seen by all. (186939 lines)
Version 15.34.2: Nov 02, 2015 Fixed bugs in date forms. (186878 lines)
Version 15.34.1: Nov 01, 2015 Global announcements can be seen by all. (186938 lines)
Version 15.34: Nov 01, 2015 Global announcements can be hidden. (186896 lines)
3 changes necessary in database:
ALTER TABLE announcements ADD COLUMN Status TINYINT NOT NULL DEFAULT 0 AFTER AnnCod,ADD INDEX (Status);

View File

@ -335,8 +335,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id,
if (SubmitFormOnChange)
fprintf (Gbl.F.Out,"document.getElementById('%s').submit();",
Gbl.FormId);
fprintf (Gbl.F.Out,"\">"
"<option value=\"0\">-</option>");
fprintf (Gbl.F.Out,"\">");
for (Year = FirstYear;
Year <= LastYear;
Year++)
@ -355,8 +354,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id,
if (SubmitFormOnChange)
fprintf (Gbl.F.Out,"document.getElementById('%s').submit();",
Gbl.FormId);
fprintf (Gbl.F.Out,"\">"
"<option value=\"0\" disabled=\"disabled\">-</option>");
fprintf (Gbl.F.Out,"\">");
for (Month = 1;
Month <= 12;
Month++)
@ -373,8 +371,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id,
if (SubmitFormOnChange)
fprintf (Gbl.F.Out,"document.getElementById('%s').submit();",
Gbl.FormId);
fprintf (Gbl.F.Out,"\">"
"<option value=\"0\" disabled=\"disabled\">-</option>");
fprintf (Gbl.F.Out,"\">");
for (Day = 1;
Day <= 31;
Day++)

View File

@ -540,7 +540,7 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword,
const char *EncryptedPassword,
long UsrCod)
{
extern const char *Txt_The_new_password_is_too_trivial_;
extern const char *Txt_The_password_is_too_trivial_;
/***** Check if password seems good by making fast checks *****/
if (!Pwd_FastCheckIfPasswordSeemsGood (PlainPassword))
@ -549,7 +549,7 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword,
/***** Check if password is found in user's ID, first name or surnames of anybody *****/
if (Pwd_CheckIfPasswdIsUsrIDorName (PlainPassword)) // PlainPassword is a user's ID, name or surname
{
strcpy (Gbl.Message,Txt_The_new_password_is_too_trivial_);
strcpy (Gbl.Message,Txt_The_password_is_too_trivial_);
return false;
}
@ -557,7 +557,7 @@ bool Pwd_SlowCheckIfPasswordIsGood (const char *PlainPassword,
if (Pwd_GetNumOtherUsrsWhoUseThisPassword (EncryptedPassword,UsrCod) >
Pwd_MAX_OTHER_USERS_USING_THE_SAME_PASSWORD)
{
strcpy (Gbl.Message,Txt_The_new_password_is_too_trivial_);
strcpy (Gbl.Message,Txt_The_password_is_too_trivial_);
return false;
}
@ -617,16 +617,16 @@ static unsigned Pwd_GetNumOtherUsrsWhoUseThisPassword (const char *EncryptedPass
bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
{
extern const char *Txt_The_new_password_must_be_at_least_X_characters;
extern const char *Txt_The_new_password_can_not_contain_spaces;
extern const char *Txt_The_new_password_can_not_consist_only_of_digits;
extern const char *Txt_The_password_must_be_at_least_X_characters;
extern const char *Txt_The_password_can_not_contain_spaces;
extern const char *Txt_The_password_can_not_consist_only_of_digits;
unsigned LengthPassword = strlen (PlainPassword),i;
bool ItsANumber;
/***** Check length of password *****/
if (LengthPassword < Pwd_MIN_LENGTH_PLAIN_PASSWORD) // PlainPassword too short
{
sprintf (Gbl.Message,Txt_The_new_password_must_be_at_least_X_characters,
sprintf (Gbl.Message,Txt_The_password_must_be_at_least_X_characters,
Pwd_MIN_LENGTH_PLAIN_PASSWORD);
return false;
}
@ -634,7 +634,7 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
/***** Check spaces in password *****/
if (strchr (PlainPassword,(int) ' ') != NULL) // PlainPassword with spaces
{
strcpy (Gbl.Message,Txt_The_new_password_can_not_contain_spaces);
strcpy (Gbl.Message,Txt_The_password_can_not_contain_spaces);
return false;
}
@ -646,7 +646,7 @@ bool Pwd_FastCheckIfPasswordSeemsGood (const char *PlainPassword)
ItsANumber = false;
if (ItsANumber)
{
strcpy (Gbl.Message,Txt_The_new_password_can_not_consist_only_of_digits);
strcpy (Gbl.Message,Txt_The_password_can_not_consist_only_of_digits);
return false;
}

View File

@ -41439,108 +41439,6 @@ const char *Txt_The_new_image_is_X = // Warning: it is very important to include
"The new image is <strong>%s</strong>."; // Necessita de tradução
#endif
const char *Txt_The_new_password_can_not_consist_only_of_digits =
#if L==0
"La contrase&ntilde;a nueva no puede estar formada"
" solo por d&iacute;gitos."; // Necessita traduccio
#elif L==1
"The new password can not consist"
" only of digits."; // Need Übersetzung
#elif L==2
"The new password can not consist"
" only of digits.";
#elif L==3
"La contrase&ntilde;a nueva no puede estar formada"
" solo por d&iacute;gitos.";
#elif L==4
"The new password can not consist"
" only of digits."; // Besoin de traduction
#elif L==5
"La contrase&ntilde;a nueva no puede estar formada"
" solo por d&iacute;gitos."; // Okoteve traducción
#elif L==6
"La nuova password non pu&ograve; consistere"
" solo di numeri.";
#elif L==7
"The new password can not consist"
" only of digits."; // Potrzebujesz tlumaczenie
#elif L==8
"The new password can not consist"
" only of digits."; // Necessita de tradução
#endif
const char *Txt_The_new_password_can_not_contain_spaces =
#if L==0
"La contrase&ntilde;a nueva no puede tener espacios."; // Necessita traduccio
#elif L==1
"The new password can not contain spaces."; // Need Übersetzung
#elif L==2
"The new password can not contain spaces.";
#elif L==3
"La contrase&ntilde;a nueva no puede tener espacios.";
#elif L==4
"The new password can not contain spaces."; // Besoin de traduction
#elif L==5
"La contrase&ntilde;a nueva no puede tener espacios."; // Okoteve traducción
#elif L==6
"La nuova password non pu&ograve; contenere spazi.";
#elif L==7
"The new password can not contain spaces."; // Potrzebujesz tlumaczenie
#elif L==8
"The new password can not contain spaces."; // Necessita de tradução
#endif
const char *Txt_The_new_password_is_too_trivial_ =
#if L==0
"La contrase&ntilde;a nueva es demasiado f&aacute;cil."
" Use otra m&aacute;s dif&iacute;cil de averiguar."; // Necessita traduccio
#elif L==1
"The new password is too trivial."
" Use other harder to guess."; // Need Übersetzung
#elif L==2
"The new password is too trivial."
" Use other harder to guess.";
#elif L==3
"La contrase&ntilde;a nueva es demasiado f&aacute;cil."
" Use otra m&aacute;s dif&iacute;cil de averiguar.";
#elif L==4
"The new password is too trivial."
" Use other harder to guess."; // Besoin de traduction
#elif L==5
"La contrase&ntilde;a nueva es demasiado f&aacute;cil."
" Use otra m&aacute;s dif&iacute;cil de averiguar."; // Okoteve traducción
#elif L==6
"La nuova password &egrave; troppo semplice."
" Utilizza un'altra pi&ugrave; difficile da individuare.";
#elif L==7
"The new password is too trivial."
" Use other harder to guess."; // Potrzebujesz tlumaczenie
#elif L==8
"The new password is too trivial."
" Use other harder to guess."; // Necessita de tradução
#endif
const char *Txt_The_new_password_must_be_at_least_X_characters = // Warning: it is very important to include %u in the following sentences
#if L==0
"La contrase&ntilde;a nueva ha de tener al menos %u caracteres."; // Necessita traduccio
#elif L==1
"The new password must be at least %u characters."; // Need Übersetzung
#elif L==2
"The new password must be at least %u characters.";
#elif L==3
"La contrase&ntilde;a nueva ha de tener al menos %u caracteres.";
#elif L==4
"The new password must be at least %u characters."; // Besoin de traduction
#elif L==5
"La contrase&ntilde;a nueva ha de tener al menos %u caracteres."; // Okoteve traducción
#elif L==6
"La nuova password dovrebbe essere di almeno %u caratteri.";
#elif L==7
"The new password must be at least %u characters."; // Potrzebujesz tlumaczenie
#elif L==8
"The new password must be at least %u characters."; // Necessita de tradução
#endif
const char *Txt_The_new_URL_is_X = // Warning: it is very important to include %s in the following sentences
#if L==0
"El nuevo URL es <strong>%s</strong>."; // Necessita traduccio
@ -41706,6 +41604,109 @@ const char *Txt_The_numerical_code_X_already_exists = // Warning: it is very imp
"The ISO 3166-1 numerical code %03ld already exists."; // Necessita de tradução
#endif
const char *Txt_The_password_can_not_consist_only_of_digits =
#if L==0
"La contrase&ntilde;a no puede estar formada"
" solo por d&iacute;gitos."; // Necessita traduccio
#elif L==1
"The password can not consist"
" only of digits."; // Need Übersetzung
#elif L==2
"The password can not consist"
" only of digits.";
#elif L==3
"La contrase&ntilde;a no puede estar formada"
" solo por d&iacute;gitos.";
#elif L==4
"The password can not consist"
" only of digits."; // Besoin de traduction
#elif L==5
"La contrase&ntilde;a no puede estar formada"
" solo por d&iacute;gitos."; // Okoteve traducción
#elif L==6
"La password non pu&ograve; consistere"
" solo di numeri.";
#elif L==7
"The password can not consist"
" only of digits."; // Potrzebujesz tlumaczenie
#elif L==8
"The password can not consist"
" only of digits."; // Necessita de tradução
#endif
const char *Txt_The_password_can_not_contain_spaces =
#if L==0
"La contrase&ntilde;a no puede tener espacios."; // Necessita traduccio
#elif L==1
"The password can not contain spaces."; // Need Übersetzung
#elif L==2
"The password can not contain spaces.";
#elif L==3
"La contrase&ntilde;a no puede tener espacios.";
#elif L==4
"The password can not contain spaces."; // Besoin de traduction
#elif L==5
"La contrase&ntilde;a no puede tener espacios."; // Okoteve traducción
#elif L==6
"La password non pu&ograve; contenere spazi.";
#elif L==7
"The password can not contain spaces."; // Potrzebujesz tlumaczenie
#elif L==8
"The password can not contain spaces."; // Necessita de tradução
#endif
const char *Txt_The_password_is_too_trivial_ =
#if L==0
"La contrase&ntilde;a es demasiado f&aacute;cil."
" Use otra m&aacute;s dif&iacute;cil de averiguar."; // Necessita traduccio
#elif L==1
"The password is too trivial."
" Use other harder to guess."; // Need Übersetzung
#elif L==2
"The password is too trivial."
" Use other harder to guess.";
#elif L==3
"La contrase&ntilde;a es demasiado f&aacute;cil."
" Use otra m&aacute;s dif&iacute;cil de averiguar.";
#elif L==4
"The password is too trivial."
" Use other harder to guess."; // Besoin de traduction
#elif L==5
"La contrase&ntilde;a es demasiado f&aacute;cil."
" Use otra m&aacute;s dif&iacute;cil de averiguar."; // Okoteve traducción
#elif L==6
"La password &egrave; troppo semplice."
" Utilizza un'altra pi&ugrave; difficile da individuare.";
#elif L==7
"The password is too trivial."
" Use other harder to guess."; // Potrzebujesz tlumaczenie
#elif L==8
"The password is too trivial."
" Use other harder to guess."; // Necessita de tradução
#endif
const char *Txt_The_password_must_be_at_least_X_characters = // Warning: it is very important to include %u in the following sentences
#if L==0
"La contrase&ntilde;a ha de tener al menos %u caracteres."; // Necessita traduccio
#elif L==1
"The password must be at least %u characters."; // Need Übersetzung
#elif L==2
"The password must be at least %u characters.";
#elif L==3
"La contrase&ntilde;a ha de tener al menos %u caracteres.";
#elif L==4
"The password must be at least %u characters."; // Besoin de traduction
#elif L==5
"La contrase&ntilde;a ha de tener al menos %u caracteres."; // Okoteve traducción
#elif L==6
"La password dovrebbe essere di almeno %u caratteri.";
#elif L==7
"The password must be at least %u characters."; // Potrzebujesz tlumaczenie
#elif L==8
"The password must be at least %u characters."; // Necessita de tradução
#endif
const char *Txt_The_X_password_has_been_changed_successfully = // Warning: it is very important to include %s in the following sentences
#if L==0
"La contrase&ntilde;a de %s se ha modificado con &eacute;xito."; // Necessita traduccio