Version 16.193.3

This commit is contained in:
Antonio Cañas Vargas 2017-04-27 15:02:00 +02:00
parent e97a86ff4a
commit 15604a0608
4 changed files with 106 additions and 76 deletions

View File

@ -221,13 +221,15 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.193.2 (2017-04-27)"
#define Log_PLATFORM_VERSION "SWAD 16.193.3 (2017-04-27)"
#define CSS_FILE "swad16.192.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.193.3: Apr 27, 2017 Changes in layout of alerts.
Changed dialog to remove my photo. (218291 lines)
Version 16.193.2: Apr 27, 2017 Statistics tab is renamed as Analytics tab. (218265 lines)
Version 16.193.1: Apr 27, 2017 Exam announcements action moved to end of assessment tab. (218263 lines)
Version 16.193: Apr 27, 2017 Surveys action moved from statistics to assessment tab. (218262 lines)

View File

@ -65,12 +65,18 @@ extern struct Globals Gbl;
/***************************** Private constants *****************************/
/*****************************************************************************/
/*****************************************************************************/
/******************************* Private types *******************************/
/*****************************************************************************/
static const char *Lay_AlertIcons[Lay_NUM_ALERT_TYPES] =
{
"info16x16.gif",
"success16x16.gif",
"question16x16.gif",
"warning16x16.gif",
"error16x16.gif",
"copy_on16x16.gif",
};
/*****************************************************************************/
/***************************** Private variables *****************************/
/******************************* Private types *******************************/
/*****************************************************************************/
/*****************************************************************************/
@ -98,6 +104,8 @@ static void Lay_WriteTitleAction (void);
static void Lay_ShowLeftColumn (void);
static void Lay_ShowRightColumn (void);
static void Lay_PutButton (Lay_Button_t Button,const char *TxtButton);
static void Lay_StartRoundFrameInternal (const char *Width,const char *Title,
void (*FunctionToDrawContextualIcons) (void),
const char *HelpLink,
@ -1291,58 +1299,78 @@ void Lay_PutIconRemove (void)
/********************** Put a button to submit a form ************************/
/*****************************************************************************/
void Lay_PutCreateButton (const char *Text)
static void Lay_PutButton (Lay_Button_t Button,const char *TxtButton)
{
if (TxtButton)
if (TxtButton[0])
switch (Button)
{
case Lay_NO_BUTTON:
break;
case Lay_CREATE_BUTTON:
Lay_PutCreateButton (TxtButton);
break;
case Lay_CONFIRM_BUTTON:
Lay_PutConfirmButton (TxtButton);
break;
case Lay_REMOVE_BUTTON:
Lay_PutRemoveButton (TxtButton);
break;
}
}
void Lay_PutCreateButton (const char *TxtButton)
{
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
"<button type=\"submit\" class=\"BT_SUBMIT BT_CREATE\">"
"%s"
"</button>"
"</div>",
Text);
TxtButton);
}
void Lay_PutCreateButtonInline (const char *Text)
void Lay_PutCreateButtonInline (const char *TxtButton)
{
fprintf (Gbl.F.Out,"<button type=\"submit\" class=\"BT_SUBMIT_INLINE BT_CREATE\">"
"%s"
"</button>",
Text);
TxtButton);
}
void Lay_PutConfirmButton (const char *Text)
void Lay_PutConfirmButton (const char *TxtButton)
{
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
"<button type=\"submit\" class=\"BT_SUBMIT BT_CONFIRM\">"
"%s"
"</button>"
"</div>",
Text);
TxtButton);
}
void Lay_PutConfirmButtonInline (const char *Text)
void Lay_PutConfirmButtonInline (const char *TxtButton)
{
fprintf (Gbl.F.Out,"<button type=\"submit\" class=\"BT_SUBMIT_INLINE BT_CONFIRM\">"
"%s"
"</button>",
Text);
TxtButton);
}
void Lay_PutRemoveButton (const char *Text)
void Lay_PutRemoveButton (const char *TxtButton)
{
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
"<button type=\"submit\" class=\"BT_SUBMIT BT_REMOVE\">"
"%s"
"</button>"
"</div>",
Text);
TxtButton);
}
void Lay_PutRemoveButtonInline (const char *Text)
void Lay_PutRemoveButtonInline (const char *TxtButton)
{
fprintf (Gbl.F.Out,"<button type=\"submit\" class=\"BT_SUBMIT_INLINE BT_REMOVE\">"
"%s"
"</button>",
Text);
TxtButton);
}
/*****************************************************************************/
@ -1458,24 +1486,7 @@ void Lay_EndRoundFrameTableWithButton (Lay_Button_t Button,const char *TxtButton
void Lay_EndRoundFrameWithButton (Lay_Button_t Button,const char *TxtButton)
{
/***** Button *****/
if (TxtButton)
if (TxtButton[0])
switch (Button)
{
case Lay_NO_BUTTON:
break;
case Lay_CREATE_BUTTON:
Lay_PutCreateButton (TxtButton);
break;
case Lay_CONFIRM_BUTTON:
Lay_PutConfirmButton (TxtButton);
break;
case Lay_REMOVE_BUTTON:
Lay_PutRemoveButton (TxtButton);
break;
}
Lay_PutButton (Button,TxtButton);
Lay_EndRoundFrame ();
}
@ -1504,8 +1515,13 @@ void Lay_ShowErrorAndExit (const char *Message)
if (!Gbl.WebService.IsWebService)
{
/****** If start of page is not written yet, do it now ******/
if (!Gbl.Layout.HTMLStartWritten)
Lay_WriteStartOfPage ();
/***** Write possible error message *****/
Lay_ShowAlert (Lay_ERROR,Message);
if (Message)
Lay_ShowAlert (Lay_ERROR,Message);
/***** Finish the page, except </body> and </html> *****/
Lay_WriteEndOfPage ();
@ -1571,28 +1587,43 @@ void Lay_ShowErrorAndExit (const char *Message)
void Lay_ShowAlert (Lay_AlertType_t AlertType,const char *Message)
{
static const char *MsgIcons[Lay_NUM_ALERT_TYPES] =
{
"info16x16.gif",
"success16x16.gif",
"warning16x16.gif",
"error16x16.gif",
"copy_on16x16.gif",
};
Lay_ShowAlertAndButton1 (AlertType,Message);
Lay_ShowAlertAndButton2 (ActUnk,Lay_NO_BUTTON,NULL);
}
void Lay_ShowAlertAndButton1 (Lay_AlertType_t AlertType,const char *Message)
{
/****** If start of page is not written yet, do it now ******/
if (!Gbl.Layout.HTMLStartWritten)
Lay_WriteStartOfPage ();
/***** Start box *****/
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
"<div class=\"ALERT\""
" style=\"background-image:url('%s/%s');\">",
Gbl.Prefs.IconsURL,Lay_AlertIcons[AlertType]);
/***** Write message *****/
if (Message)
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
"<div class=\"ALERT\""
" style=\"background-image:url('%s/%s');\">"
"%s"
"</div>"
"</div>",
Gbl.Prefs.IconsURL,MsgIcons[AlertType],
Message);
fprintf (Gbl.F.Out,"%s",Message);
}
void Lay_ShowAlertAndButton2 (Act_Action_t NextAction,Lay_Button_t Button,const char *TxtButton)
{
/***** Optional button *****/
if (NextAction != ActUnk &&
Button != Lay_NO_BUTTON &&
TxtButton)
if (TxtButton[0])
{
Act_FormStart (NextAction);
Lay_PutButton (Button,TxtButton);
Act_FormEnd ();
}
/***** End box *****/
fprintf (Gbl.F.Out,"</div>"
"</div>");
}
/*****************************************************************************/

View File

@ -47,14 +47,15 @@
/********************************* Public types ******************************/
/*****************************************************************************/
#define Lay_NUM_ALERT_TYPES 5
#define Lay_NUM_ALERT_TYPES 6
typedef enum
{
Lay_INFO = 0,
Lay_SUCCESS = 1,
Lay_WARNING = 2,
Lay_ERROR = 3,
Lay_CLIPBOARD = 4,
Lay_QUESTION = 2,
Lay_WARNING = 3,
Lay_ERROR = 4,
Lay_CLIPBOARD = 5,
} Lay_AlertType_t;
typedef enum
@ -90,12 +91,12 @@ void Lay_PutIconRemovalNotAllowed (void);
void Lay_PutIconBRemovalNotAllowed (void);
void Lay_PutIconRemove (void);
void Lay_PutCreateButton (const char *Text);
void Lay_PutCreateButtonInline (const char *Text);
void Lay_PutConfirmButton (const char *Text);
void Lay_PutConfirmButtonInline (const char *Text);
void Lay_PutRemoveButton (const char *Text);
void Lay_PutRemoveButtonInline (const char *Text);
void Lay_PutCreateButton (const char *TxtButton);
void Lay_PutCreateButtonInline (const char *TxtButton);
void Lay_PutConfirmButton (const char *TxtButton);
void Lay_PutConfirmButtonInline (const char *TxtButton);
void Lay_PutRemoveButton (const char *TxtButton);
void Lay_PutRemoveButtonInline (const char *TxtButton);
void Lay_StartRoundFrameTable (const char *Width,const char *Title,
void (*FunctionToDrawContextualIcons) (void),
@ -118,6 +119,8 @@ void Lay_EndRoundFrame (void);
void Lay_ShowErrorAndExit (const char *Message);
void Lay_ShowAlert (Lay_AlertType_t AlertType,const char *Message);
void Lay_ShowAlertAndButton1 (Lay_AlertType_t AlertType,const char *Message);
void Lay_ShowAlertAndButton2 (Act_Action_t NextAction,Lay_Button_t Button,const char *TxtButton);
void Lay_RefreshNotifsAndConnected (void);
void Lay_RefreshLastClicks (void);

View File

@ -405,8 +405,6 @@ void Pho_RecOtherUsrPhotoDetFaces (void)
void Pho_ReqRemoveMyPhoto (void)
{
extern const char *Hlp_PROFILE_Photo;
extern const char *Txt_Photo;
extern const char *Txt_Do_you_really_want_to_remove_your_photo;
extern const char *Txt_Remove_photo;
extern const char *Txt_The_photo_no_longer_exists;
@ -414,22 +412,18 @@ void Pho_ReqRemoveMyPhoto (void)
/***** Show current photo and help message *****/
if (Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL))
{
/***** Start frame *****/
Lay_StartRoundFrame (NULL,Txt_Photo,
Pho_PutIconToRequestRemoveMyPhoto,Hlp_PROFILE_Photo);
/***** Show question and button to remove my photo *****/
/* Start alert */
Lay_ShowAlertAndButton1 (Lay_QUESTION,Txt_Do_you_really_want_to_remove_your_photo);
/***** Show current photo and help message *****/
/* Show current photo */
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">");
Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL,
"PHOTO186x248",Pho_NO_ZOOM,false);
Lay_ShowAlert (Lay_INFO,Txt_Do_you_really_want_to_remove_your_photo);
fprintf (Gbl.F.Out,"</div>");
/***** Button to remove my photo *****/
Act_FormStart (ActRemMyPho);
Lay_PutRemoveButton (Txt_Remove_photo);
Act_FormEnd ();
/***** End frame *****/
Lay_EndRoundFrame ();
/* End alert */
Lay_ShowAlertAndButton2 (ActRemMyPho,Lay_REMOVE_BUTTON,Txt_Remove_photo);
}
else
Lay_ShowAlert (Lay_INFO,Txt_The_photo_no_longer_exists);