Version 14.90

This commit is contained in:
Antonio Cañas Vargas 2015-03-13 14:05:56 +01:00
parent 746850c48b
commit 6dad1bed3a
6 changed files with 75 additions and 15 deletions

View File

@ -4267,14 +4267,36 @@ void Act_LinkFormSubmit (const char *Title,const char *LinkStyle)
// Id can not be NULL // Id can not be NULL
void Act_LinkFormSubmitId (const char *Title,const char *LinkStyle,const char *Id) void Act_LinkFormSubmitId (const char *Title,const char *LinkStyle,const char *Id)
{ {
fprintf (Gbl.F.Out,"<a href=\"javascript:document.getElementById('%s').submit();\"",Id); fprintf (Gbl.F.Out,"<a href=\"\"");
if (Title) if (Title)
if (Title[0]) if (Title[0])
fprintf (Gbl.F.Out," title=\"%s\"",Title); fprintf (Gbl.F.Out," title=\"%s\"",Title);
if (LinkStyle) if (LinkStyle)
if (LinkStyle[0]) if (LinkStyle[0])
fprintf (Gbl.F.Out," class=\"%s\"",LinkStyle); fprintf (Gbl.F.Out," class=\"%s\"",LinkStyle);
fprintf (Gbl.F.Out,">"); fprintf (Gbl.F.Out," onclick=\"javascript:"
"document.getElementById('%s').submit();return false;\">",
Id);
}
void Act_LinkFormSubmitAnimated (const char *Title,const char *LinkStyle,
const char *StaticIconId,
const char *AnimatedIconId)
{
fprintf (Gbl.F.Out,"<a href=\"\"");
if (Title)
if (Title[0])
fprintf (Gbl.F.Out," title=\"%s\"",Title);
if (LinkStyle)
if (LinkStyle[0])
fprintf (Gbl.F.Out," class=\"%s\"",LinkStyle);
fprintf (Gbl.F.Out," onclick=\"javascript:"
"document.getElementById('%s').style.display='none';"
"document.getElementById('%s').style.display='';"
"document.getElementById('%s').submit();return false;\">",
StaticIconId, // Icon to be hiden on click
AnimatedIconId, // Icon to be shown on click
Gbl.FormId);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1336,6 +1336,9 @@ void Act_FormStartId (Act_Action_t NextAction,const char *Id);
void Act_FormEnd (void); void Act_FormEnd (void);
void Act_LinkFormSubmit (const char *Title,const char *LinkStyle); void Act_LinkFormSubmit (const char *Title,const char *LinkStyle);
void Act_LinkFormSubmitId (const char *Title,const char *LinkStyle,const char *Id); void Act_LinkFormSubmitId (const char *Title,const char *LinkStyle,const char *Id);
void Act_LinkFormSubmitAnimated (const char *Title,const char *LinkStyle,
const char *StaticIconId,
const char *AnimatedIconId);
void Act_AdjustActionWhenNoUsrLogged (void); void Act_AdjustActionWhenNoUsrLogged (void);
void Act_AdjustCurrentAction (void); void Act_AdjustCurrentAction (void);
Act_Action_t Act_GetFirstActionAvailableInCurrentTab (void); Act_Action_t Act_GetFirstActionAvailableInCurrentTab (void);

View File

@ -103,11 +103,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.89 (2015/03/13)" #define Log_PLATFORM_VERSION "SWAD 14.90 (2015/03/13)"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 14.90: Mar 13, 2015 Animated gif icon when calculating user's figures.
Changes in all submit links. (181826 lines)
Version 14.89.1: Mar 13, 2015 Optimization in database query for first click time. (181771 lines)
Version 14.89: Mar 13, 2015 Lots of changes related with forms and photos. (181769 lines) Version 14.89: Mar 13, 2015 Lots of changes related with forms and photos. (181769 lines)
Version 14.88: Mar 12, 2015 Changes in layout of public user profile. (181718 lines) Version 14.88: Mar 12, 2015 Changes in layout of public user profile. (181718 lines)
Version 14.87.4: Mar 11, 2015 Added indexes to usr_figures. (181629 lines) Version 14.87.4: Mar 11, 2015 Added indexes to usr_figures. (181629 lines)

View File

@ -979,6 +979,25 @@ void Lay_PutSendIcon (const char *Icon,const char *Alt,const char *Text)
Gbl.Prefs.IconsURL,Icon,Alt,Text); Gbl.Prefs.IconsURL,Icon,Alt,Text);
} }
/*****************************************************************************/
/********** Put a icon with a text to submit a form. **********/
/********** When clicked, the icon will be replaced by an animation **********/
/*****************************************************************************/
void Lay_PutCalculateIcon (const char *Alt,const char *Text,
const char *StaticIconId,
const char *AnimatedIconId)
{
fprintf (Gbl.F.Out,"<img id=\"%s\" src=\"%s/recycle16x16.gif\" alt=\"%s\""
" class=\"ICON16x16\" />"
"<img id=\"%s\" src=\"%s/working16x16.gif\" alt=\"%s\""
" class=\"ICON16x16\" style=\"display:none;\" />" // Animated icon hidden
"&nbsp;%s</a>",
StaticIconId,Gbl.Prefs.IconsURL,Alt,
AnimatedIconId,Gbl.Prefs.IconsURL,Alt,
Text);
}
/*****************************************************************************/ /*****************************************************************************/
/********************** Put a button to submit a form ************************/ /********************** Put a button to submit a form ************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -89,6 +89,9 @@ void Lay_WriteTitle (const char *Title);
void Lay_PutFormToView (Act_Action_t Action); void Lay_PutFormToView (Act_Action_t Action);
void Lay_PutFormToEdit (Act_Action_t Action); void Lay_PutFormToEdit (Act_Action_t Action);
void Lay_PutSendIcon (const char *Icon,const char *Alt,const char *Text); void Lay_PutSendIcon (const char *Icon,const char *Alt,const char *Text);
void Lay_PutCalculateIcon (const char *Alt,const char *Text,
const char *StaticIconId,
const char *AnimatedIconId);
void Lay_PutSendButton (const char *TextSendButton); void Lay_PutSendButton (const char *TextSendButton);
void Lay_StartRoundFrameTable10 (const char *Width,unsigned CellPadding,const char *Title); void Lay_StartRoundFrameTable10 (const char *Width,unsigned CellPadding,const char *Title);
void Lay_StartRoundFrameTable10Shadow (const char *Width,unsigned CellPadding); void Lay_StartRoundFrameTable10Shadow (const char *Width,unsigned CellPadding);

View File

@ -7708,8 +7708,10 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat)
/***** Button to fetch and store first click time *****/ /***** Button to fetch and store first click time *****/
Act_FormStart (ActCal1stClkTim); Act_FormStart (ActCal1stClkTim);
Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Act_LinkFormSubmit (Txt_Calculate,The_ClassFormul[Gbl.Prefs.Theme]); Act_LinkFormSubmitAnimated (Txt_Calculate,The_ClassFormul[Gbl.Prefs.Theme],
Lay_PutSendIcon ("recycle",Txt_Calculate,Txt_Calculate); "calculate1","calculating1");
Lay_PutCalculateIcon (Txt_Calculate,Txt_Calculate,
"calculate1","calculating1");
Act_FormEnd (); Act_FormEnd ();
} }
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -7753,8 +7755,10 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat)
/***** Button to fetch and store number of clicks *****/ /***** Button to fetch and store number of clicks *****/
Act_FormStart (ActCalNumClk); Act_FormStart (ActCalNumClk);
Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Act_LinkFormSubmit (Txt_Calculate,The_ClassFormul[Gbl.Prefs.Theme]); Act_LinkFormSubmitAnimated (Txt_Calculate,The_ClassFormul[Gbl.Prefs.Theme],
Lay_PutSendIcon ("recycle",Txt_Calculate,Txt_Calculate); "calculate2","calculating2");
Lay_PutCalculateIcon (Txt_Calculate,Txt_Calculate,
"calculate2","calculating2");
Act_FormEnd (); Act_FormEnd ();
} }
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -7789,8 +7793,10 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat)
/***** Button to fetch and store number of forum posts *****/ /***** Button to fetch and store number of forum posts *****/
Act_FormStart (ActCalNumForPst); Act_FormStart (ActCalNumForPst);
Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Act_LinkFormSubmit (Txt_Calculate,The_ClassFormul[Gbl.Prefs.Theme]); Act_LinkFormSubmitAnimated (Txt_Calculate,The_ClassFormul[Gbl.Prefs.Theme],
Lay_PutSendIcon ("recycle",Txt_Calculate,Txt_Calculate); "calculate3","calculating3");
Lay_PutCalculateIcon (Txt_Calculate,Txt_Calculate,
"calculate3","calculating3");
Act_FormEnd (); Act_FormEnd ();
} }
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -7825,8 +7831,10 @@ void Usr_ShowDetailsUserProfile (const struct UsrData *UsrDat)
/***** Button to fetch and store number of messages sent *****/ /***** Button to fetch and store number of messages sent *****/
Act_FormStart (ActCalNumMsgSnt); Act_FormStart (ActCalNumMsgSnt);
Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod); Usr_PutParamOtherUsrCodEncrypted (UsrDat->EncryptedUsrCod);
Act_LinkFormSubmit (Txt_Calculate,The_ClassFormul[Gbl.Prefs.Theme]); Act_LinkFormSubmitAnimated (Txt_Calculate,The_ClassFormul[Gbl.Prefs.Theme],
Lay_PutSendIcon ("recycle",Txt_Calculate,Txt_Calculate); "calculate4","calculating4");
Lay_PutCalculateIcon (Txt_Calculate,Txt_Calculate,
"calculate4","calculating4");
Act_FormEnd (); Act_FormEnd ();
} }
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -8017,8 +8025,9 @@ static void Usr_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
Usr_ResetUsrFigures (&UsrFigures); Usr_ResetUsrFigures (&UsrFigures);
/***** Get first click from log table *****/ /***** Get first click from log table *****/
sprintf (Query,"SELECT DATE_FORMAT(ClickTime,'%%Y%%m%%d%%H%%i%%S') FROM log" sprintf (Query,"SELECT DATE_FORMAT("
" WHERE UsrCod='%ld' ORDER BY ClickTime LIMIT 1", "(SELECT MIN(ClickTime) FROM log WHERE UsrCod='%ld')"
",'%%Y%%m%%d%%H%%i%%S')",
UsrCod); UsrCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get user's first click")) if (DB_QuerySELECT (Query,&mysql_res,"can not get user's first click"))
{ {
@ -8026,8 +8035,9 @@ static void Usr_GetFirstClickFromLogAndStoreAsUsrFigure (long UsrCod)
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
/* Get first click (row[0] holds the start date in YYYYMMDDHHMMSS format) */ /* Get first click (row[0] holds the start date in YYYYMMDDHHMMSS format) */
if (!(Dat_GetDateTimeFromYYYYMMDDHHMMSS (&(UsrFigures.FirstClickTime),row[0]))) if (row[0]) // It is NULL when user never logged
Lay_ShowErrorAndExit ("Error when reading first click time."); if (!(Dat_GetDateTimeFromYYYYMMDDHHMMSS (&(UsrFigures.FirstClickTime),row[0])))
Lay_ShowErrorAndExit ("Error when reading first click time.");
} }
/* Free structure that stores the query result */ /* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);