mirror of https://github.com/acanas/swad-core.git
Version19.108.8
This commit is contained in:
parent
8cfbaf1b45
commit
90444b6e8e
|
@ -27,7 +27,7 @@
|
|||
|
||||
#define _GNU_SOURCE // For vasprintf
|
||||
#include <stdarg.h> // For va_start, va_end
|
||||
#include <stdio.h> // For fprintf, vasprintf
|
||||
#include <stdio.h> // For vasprintf
|
||||
#include <stdlib.h> // For free
|
||||
|
||||
#include "swad_global.h"
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For fprintf
|
||||
#include <string.h> // For string functions
|
||||
|
||||
#include "swad_account.h"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define _GNU_SOURCE // For vasprintf
|
||||
#include <stdarg.h> // For va_start, va_end
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For FILE, fprintf, vasprintf
|
||||
#include <stdio.h> // For FILE, vasprintf
|
||||
#include <stdlib.h> // For free
|
||||
#include <string.h> // For string functions
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#include <stdbool.h> // For boolean type
|
||||
#include <stdio.h> // For fprintf
|
||||
#include <stdlib.h> // For malloc and free
|
||||
|
||||
#include "swad_action.h"
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <stdio.h> // For fprintf
|
||||
|
||||
#include "swad_button.h"
|
||||
#include "swad_global.h"
|
||||
#include "swad_HTML.h"
|
||||
|
|
|
@ -492,7 +492,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
|||
En OpenSWAD:
|
||||
ps2pdf source.ps destination.pdf
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.108.7 (2019-12-30)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.108.8 (2019-12-30)"
|
||||
#define CSS_FILE "swad19.101.5.css"
|
||||
#define JS_FILE "swad19.91.1.js"
|
||||
/*
|
||||
|
@ -500,8 +500,9 @@ ps2pdf source.ps destination.pdf
|
|||
// TODO: Impedir la creación y edición de proyectos si no son editables.
|
||||
// TODO: No se puede entrar con DNI '1' suponiendo que no tenga password ¿por qué?
|
||||
|
||||
Version 19.10x: Dec 30, 2019 Map in country information. (? lines)
|
||||
Version 19.10x: Dec 30, 2019 Map in institution information. (? lines)
|
||||
Version 19.10x: Dec 31, 2019 Map in country information. (? lines)
|
||||
Version 19.10x: Dec 31, 2019 Map in institution information. (? lines)
|
||||
Version 19.108.8: Dec 30, 2019 Code refactoring related to printing messages. (249700 lines)
|
||||
Version 19.108.7: Dec 30, 2019 Code refactoring related to printing messages. (249674 lines)
|
||||
Version 19.108.6: Dec 30, 2019 Code refactoring related to printing messages. (249717 lines)
|
||||
Version 19.108.5: Dec 30, 2019 Code refactoring related to printing messages. (249712 lines)
|
||||
|
|
|
@ -25,10 +25,11 @@
|
|||
/*********************************** Headers *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
#include <limits.h> // For maximum values
|
||||
#include <linux/limits.h> // For PATH_MAX
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For fprintf
|
||||
#include <stdio.h> // For asprintf
|
||||
#include <string.h> // For string functions
|
||||
|
||||
#include "swad_box.h"
|
||||
|
@ -83,6 +84,7 @@ void Con_ShowConnectedUsrs (void)
|
|||
{
|
||||
extern const char *Hlp_USERS_Connected;
|
||||
extern const char *Txt_Connected_users;
|
||||
char *Title;
|
||||
|
||||
/***** Contextual menu *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
|
@ -98,12 +100,13 @@ void Con_ShowConnectedUsrs (void)
|
|||
|
||||
/***** Begin box *****/
|
||||
/* Current time */
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%s"
|
||||
if (asprintf (&Title,"%s"
|
||||
"<div id=\"connected_current_time\"></div>",
|
||||
Txt_Connected_users);
|
||||
Box_BoxBegin (NULL,Gbl.Title,Con_PutIconToUpdateConnected,
|
||||
Txt_Connected_users) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
Box_BoxBegin (NULL,Title,Con_PutIconToUpdateConnected,
|
||||
Hlp_USERS_Connected,Box_NOT_CLOSABLE);
|
||||
free (Title);
|
||||
Dat_WriteLocalDateHMSFromUTC ("connected_current_time",Gbl.StartExecutionTimeUTC,
|
||||
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
|
||||
false,false,true,0x7);
|
||||
|
|
|
@ -25,8 +25,10 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
#include <stdbool.h> // For boolean type
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For asprintf
|
||||
#include <string.h> // For string functions
|
||||
|
||||
#include "swad_database.h"
|
||||
|
@ -440,6 +442,7 @@ static void CrsCfg_Indicators (void)
|
|||
extern const char *Txt_of_PART_OF_A_TOTAL;
|
||||
struct Ind_IndicatorsCrs Indicators;
|
||||
int NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (Gbl.Hierarchy.Crs.CrsCod);
|
||||
char *Title;
|
||||
|
||||
/***** Compute indicators ******/
|
||||
Ind_ComputeAndStoreIndicatorsCrs (Gbl.Hierarchy.Crs.CrsCod,
|
||||
|
@ -454,16 +457,17 @@ static void CrsCfg_Indicators (void)
|
|||
/* Data */
|
||||
HTM_TD_Begin ("class=\"LB\"");
|
||||
Frm_StartForm (ActReqStaCrs);
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s %u",
|
||||
if (asprintf (&Title,"%u %s %u",
|
||||
Indicators.NumIndicators,
|
||||
Txt_of_PART_OF_A_TOTAL,Ind_NUM_INDICATORS);
|
||||
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,"BT_LINK DAT",NULL);
|
||||
HTM_TxtF ("%s ",Gbl.Title);
|
||||
Txt_of_PART_OF_A_TOTAL,Ind_NUM_INDICATORS) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_BUTTON_SUBMIT_Begin (Title,"BT_LINK DAT",NULL);
|
||||
HTM_TxtF ("%s ",Title);
|
||||
Ico_PutIcon ((Indicators.NumIndicators == Ind_NUM_INDICATORS) ? "check-circle.svg" :
|
||||
"exclamation-triangle.svg",
|
||||
Gbl.Title,"ICO16x16");
|
||||
Title,"ICO16x16");
|
||||
HTM_BUTTON_End ();
|
||||
free (Title);
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <stdio.h> // For fprintf
|
||||
#include <string.h> // For string functions
|
||||
#include <unistd.h> // For access, lstat, getpid, chdir, symlink
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <mysql/mysql.h> // To access MySQL databases
|
||||
#include <stdarg.h> // For va_start, va_end
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For FILE, fprintf, vasprintf
|
||||
#include <stdio.h> // For FILE, vasprintf
|
||||
#include <stdlib.h> // For free
|
||||
|
||||
#include "swad_config.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <ctype.h> // For isprint, isspace, etc.
|
||||
#include <stdbool.h> // For boolean type
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For fprintf, etc.
|
||||
#include <stdlib.h> // For exit, system, calloc, free, etc.
|
||||
#include <string.h> // For string functions
|
||||
#include <mysql/mysql.h> // To access MySQL databases
|
||||
|
|
|
@ -202,7 +202,6 @@ struct Globals
|
|||
time_t StartExecutionTimeUTC;
|
||||
struct DateTime Now;
|
||||
struct Date Yesterday;
|
||||
char Title[Lay_MAX_BYTES_TITLE + 1]; // String for the help message in a link
|
||||
unsigned RowEvenOdd; // To alternate row colors in listings
|
||||
char *ColorRows[2];
|
||||
const char *XMLPtr;
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Lay_MAX_BYTES_TITLE (4096 - 1)
|
||||
|
||||
#define Lay_HIDE_BOTH_COLUMNS 0 // 00
|
||||
#define Lay_SHOW_RIGHT_COLUMN 1 // 01
|
||||
#define Lay_SHOW_LEFT_COLUMN 2 // 10
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <stdio.h> // For fprintf, etc.
|
||||
|
||||
#include "swad_box.h"
|
||||
#include "swad_database.h"
|
||||
#include "swad_form.h"
|
||||
|
|
|
@ -95,7 +95,7 @@ static unsigned long Msg_GetSentOrReceivedMsgs (long UsrCod,
|
|||
const char *FilterFromToSubquery,
|
||||
MYSQL_RES **mysql_res);
|
||||
|
||||
static char *Msg_WriteNumMsgs (unsigned NumUnreadMsgs);
|
||||
static void Msg_SetNumMsgsStr (char **NumMsgsStr,unsigned NumUnreadMsgs);
|
||||
|
||||
static void Msg_PutIconsListMsgs (void);
|
||||
static void Msg_PutHiddenParamsOneMsg (void);
|
||||
|
@ -1700,6 +1700,7 @@ static void Msg_ShowSentOrReceivedMessages (void)
|
|||
MYSQL_ROW row;
|
||||
unsigned long NumRow;
|
||||
unsigned long NumRows;
|
||||
char *NumMsgsStr;
|
||||
unsigned long NumMsg = 0; // Initialized to avoid warning
|
||||
unsigned NumUnreadMsgs = 0; // Initialized to avoid warning
|
||||
struct Pagination Pagination;
|
||||
|
@ -1755,8 +1756,10 @@ static void Msg_ShowSentOrReceivedMessages (void)
|
|||
Gbl.Msg.NumMsgs = (unsigned) NumRows;
|
||||
|
||||
/***** Begin box with messages *****/
|
||||
Box_BoxBegin ("97%",Msg_WriteNumMsgs (NumUnreadMsgs),Msg_PutIconsListMsgs,
|
||||
Msg_SetNumMsgsStr (&NumMsgsStr,NumUnreadMsgs);
|
||||
Box_BoxBegin ("97%",NumMsgsStr,Msg_PutIconsListMsgs,
|
||||
Help[Gbl.Msg.TypeOfMessages],Box_NOT_CLOSABLE);
|
||||
free (NumMsgsStr);
|
||||
|
||||
/***** Filter messages *****/
|
||||
/* Begin box with filter */
|
||||
|
@ -2425,11 +2428,11 @@ unsigned Msg_GetNumMsgsReceived (Hie_Level_t Scope,Msg_Status_t MsgStatus)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Write number of messages and number of unread messages ************/
|
||||
/***** Set string with number of messages and number of unread messages ******/
|
||||
/*****************************************************************************/
|
||||
// Fill Gbl.Title
|
||||
// The string must be deallocated after calling this function
|
||||
|
||||
static char *Msg_WriteNumMsgs (unsigned NumUnreadMsgs)
|
||||
static void Msg_SetNumMsgsStr (char **NumMsgsStr,unsigned NumUnreadMsgs)
|
||||
{
|
||||
extern const char *Txt_message_received;
|
||||
extern const char *Txt_message_sent;
|
||||
|
@ -2444,45 +2447,55 @@ static char *Msg_WriteNumMsgs (unsigned NumUnreadMsgs)
|
|||
if (Gbl.Msg.NumMsgs == 1)
|
||||
{
|
||||
if (NumUnreadMsgs)
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"1 %s, 1 %s",
|
||||
Txt_message_received,Txt_unread_MESSAGE);
|
||||
{
|
||||
if (asprintf (NumMsgsStr,"1 %s, 1 %s",
|
||||
Txt_message_received,Txt_unread_MESSAGE) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
else
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"1 %s",
|
||||
Txt_message_received);
|
||||
{
|
||||
if (asprintf (NumMsgsStr,"1 %s",Txt_message_received) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NumUnreadMsgs == 0)
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received);
|
||||
{
|
||||
if (asprintf (NumMsgsStr,"%u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
else if (NumUnreadMsgs == 1)
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s, 1 %s",
|
||||
{
|
||||
if (asprintf (NumMsgsStr,"%u %s, 1 %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received,
|
||||
Txt_unread_MESSAGE);
|
||||
Txt_unread_MESSAGE) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
else
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s, %u %s",
|
||||
{
|
||||
if (asprintf (NumMsgsStr,"%u %s, %u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_received,
|
||||
NumUnreadMsgs,Txt_unread_MESSAGES);
|
||||
NumUnreadMsgs,Txt_unread_MESSAGES) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Msg_MESSAGES_SENT:
|
||||
if (Gbl.Msg.NumMsgs == 1)
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"1 %s",
|
||||
Txt_message_sent);
|
||||
{
|
||||
if (asprintf (NumMsgsStr,"1 %s",Txt_message_sent) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
else
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_sent);
|
||||
{
|
||||
if (asprintf (NumMsgsStr,"%u %s",
|
||||
Gbl.Msg.NumMsgs,Txt_messages_sent) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return Gbl.Title;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -155,6 +155,7 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
extern const char *Txt_FORUM_Post_banned;
|
||||
unsigned NumPage;
|
||||
char *ClassLink;
|
||||
char *Title;
|
||||
|
||||
/***** Link to page 1, including a text *****/
|
||||
if (Subject)
|
||||
|
@ -243,12 +244,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
1,Pagination->NumPags);
|
||||
if (asprintf (&ClassLink,"BT_LINK LT %s",ClassTxt) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
||||
if (asprintf (&Title,Txt_Page_X_of_Y,1,Pagination->NumPags) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_BUTTON_SUBMIT_Begin (Title,ClassLink,NULL);
|
||||
free (Title);
|
||||
free (ClassLink);
|
||||
}
|
||||
else
|
||||
|
@ -357,12 +358,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
1,Pagination->NumPags);
|
||||
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
||||
if (asprintf (&Title,Txt_Page_X_of_Y,1,Pagination->NumPags) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_BUTTON_SUBMIT_Begin (Title,ClassLink,NULL);
|
||||
HTM_Unsigned (1);
|
||||
HTM_BUTTON_End ();
|
||||
free (Title);
|
||||
Frm_EndForm ();
|
||||
if (Pagination->LeftPage > 2)
|
||||
{
|
||||
|
@ -457,13 +458,13 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
Pagination->LeftPage,
|
||||
Pagination->NumPags);
|
||||
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
||||
if (asprintf (&Title,Txt_Page_X_of_Y,
|
||||
Pagination->LeftPage,Pagination->NumPags) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_BUTTON_SUBMIT_Begin (Title,ClassLink,NULL);
|
||||
HTM_Unsigned (Pagination->LeftPage);
|
||||
HTM_BUTTON_End ();
|
||||
free (Title);
|
||||
Frm_EndForm ();
|
||||
if (Pagination->LeftPage < Pagination->StartPage - 1)
|
||||
{
|
||||
|
@ -478,12 +479,11 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
NumPage <= Pagination->EndPage;
|
||||
NumPage++)
|
||||
{
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
NumPage,Pagination->NumPags);
|
||||
if (asprintf (&Title,Txt_Page_X_of_Y,NumPage,Pagination->NumPags) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
if (!LinkToPagCurrent && NumPage == Pagination->CurrentPage)
|
||||
{
|
||||
HTM_SPAN_Begin ("title=\"%s\" class=\"PAG_CUR %s\"",Gbl.Title,ClassTxt);
|
||||
HTM_SPAN_Begin ("title=\"%s\" class=\"PAG_CUR %s\"",Title,ClassTxt);
|
||||
HTM_Unsigned (NumPage);
|
||||
HTM_SPAN_End ();
|
||||
}
|
||||
|
@ -570,11 +570,12 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
||||
HTM_BUTTON_SUBMIT_Begin (Title,ClassLink,NULL);
|
||||
HTM_Unsigned (NumPage);
|
||||
HTM_BUTTON_End ();
|
||||
Frm_EndForm ();
|
||||
}
|
||||
free (Title);
|
||||
}
|
||||
|
||||
/***** Posible link to page right *****/
|
||||
|
@ -668,12 +669,13 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
Pagination->RightPage,Pagination->NumPags);
|
||||
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
||||
if (asprintf (&Title,Txt_Page_X_of_Y,
|
||||
Pagination->RightPage,Pagination->NumPags) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_BUTTON_SUBMIT_Begin (Title,ClassLink,NULL);
|
||||
HTM_Unsigned (Pagination->RightPage);
|
||||
HTM_BUTTON_End ();
|
||||
free (Title);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
|
@ -767,12 +769,13 @@ void Pag_WriteLinksToPages (Pag_WhatPaginate_t WhatPaginate,
|
|||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
break;
|
||||
}
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
Txt_Page_X_of_Y,
|
||||
Pagination->NumPags,Pagination->NumPags);
|
||||
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,ClassLink,NULL);
|
||||
if (asprintf (&Title,Txt_Page_X_of_Y,
|
||||
Pagination->NumPags,Pagination->NumPags) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_BUTTON_SUBMIT_Begin (Title,ClassLink,NULL);
|
||||
HTM_Unsigned (Pagination->NumPags);
|
||||
HTM_BUTTON_End ();
|
||||
free (Title);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
/*********************************** Headers *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For asprintf
|
||||
#include <string.h> // For string functions
|
||||
|
||||
#include "swad_box.h"
|
||||
|
@ -943,17 +945,16 @@ static void Prf_ShowRanking (unsigned long Rank,unsigned long NumUsrs)
|
|||
{
|
||||
extern const char *The_ClassFormLinkOutBox[The_NUM_THEMES];
|
||||
extern const char *Txt_of_PART_OF_A_TOTAL;
|
||||
|
||||
/***** Part of a total and end container *****/
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"#%lu %s %lu",
|
||||
Rank,Txt_of_PART_OF_A_TOTAL,NumUsrs);
|
||||
char *Title;
|
||||
|
||||
/***** Rank in form to go to ranking *****/
|
||||
Frm_StartForm (ActSeeUseGbl);
|
||||
Sco_PutParamScope ("ScopeSta",Hie_SYS);
|
||||
Par_PutHiddenParamUnsigned (NULL,"FigureType",(unsigned) Fig_USERS_RANKING);
|
||||
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,The_ClassFormLinkOutBox[Gbl.Prefs.Theme],NULL);
|
||||
if (asprintf (&Title,"#%lu %s %lu",Rank,Txt_of_PART_OF_A_TOTAL,NumUsrs) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
HTM_BUTTON_SUBMIT_Begin (Title,The_ClassFormLinkOutBox[Gbl.Prefs.Theme],NULL);
|
||||
free (Title);
|
||||
HTM_TxtF ("#%lu",Rank);
|
||||
HTM_BUTTON_End ();
|
||||
Frm_EndForm ();
|
||||
|
|
|
@ -2275,7 +2275,7 @@ static void Prj_ReqAddUsrs (Prj_RoleInProject_t RoleInProject)
|
|||
[Prj_ROLE_TUT] = ActAddTutPrj, // Tutor
|
||||
[Prj_ROLE_EVL] = ActAddEvlPrj, // Evaluator
|
||||
};
|
||||
char TxtButton[Lay_MAX_BYTES_TITLE + 1];
|
||||
char *TxtButton;
|
||||
|
||||
/***** Get parameters *****/
|
||||
Prj_GetParams ();
|
||||
|
@ -2283,15 +2283,16 @@ static void Prj_ReqAddUsrs (Prj_RoleInProject_t RoleInProject)
|
|||
Lay_ShowErrorAndExit ("Code of project is missing.");
|
||||
|
||||
/***** Put form to select users *****/
|
||||
snprintf (TxtButton,sizeof (TxtButton),
|
||||
Txt_Add_USERS,
|
||||
Txt_PROJECT_ROLES_PLURAL_abc[RoleInProject]);
|
||||
if (asprintf (&TxtButton,Txt_Add_USERS,
|
||||
Txt_PROJECT_ROLES_PLURAL_abc[RoleInProject]) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
Usr_PutFormToSelectUsrsToGoToAct (&Prj_MembersToAdd,
|
||||
ActionAddUsr[RoleInProject],Prj_PutCurrentParams,
|
||||
TxtButton,
|
||||
Hlp_ASSESSMENT_Projects_add_user,
|
||||
TxtButton,
|
||||
false); // Do not put form with date range
|
||||
free (TxtButton);
|
||||
|
||||
/***** Put a form to create/edit project *****/
|
||||
Prj_RequestCreatOrEditPrj (Gbl.Prjs.PrjCod);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
/*********************************** Headers *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <stdio.h> // For fprintf...
|
||||
#include <string.h> // For string functions...
|
||||
|
||||
#include "swad_box.h"
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include <stdbool.h> // For boolean type
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For fprintf, etc.
|
||||
#include <string.h>
|
||||
|
||||
#include "swad_box.h"
|
||||
|
|
|
@ -2606,6 +2606,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
|
|||
MYSQL_ROW row;
|
||||
unsigned NumAns;
|
||||
unsigned NumAnswers = 0;
|
||||
char *Title;
|
||||
Svy_AnswerType_t AnsType;
|
||||
|
||||
if (Gbl.Action.Act == ActEdiOneSvyQst) // If no receiving the question, but editing a new or existing question
|
||||
|
@ -2664,11 +2665,11 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
|
|||
Svy_CurrentSvyCod = SvyCod;
|
||||
Svy_CurrentQstCod = SvyQst->QstCod;
|
||||
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%s %u",
|
||||
Txt_Question,SvyQst->QstInd + 1); // Question index may be 0, 1, 2, 3,...
|
||||
Box_BoxBegin (NULL,Gbl.Title,Svy_PutIconToRemoveOneQst,
|
||||
if (asprintf (&Title,"%s %u",Txt_Question,SvyQst->QstInd + 1) < 0) // Question index may be 0, 1, 2, 3,...
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
Box_BoxBegin (NULL,Title,Svy_PutIconToRemoveOneQst,
|
||||
NULL,Box_NOT_CLOSABLE);
|
||||
free (Title);
|
||||
}
|
||||
else
|
||||
Box_BoxBegin (NULL,Txt_New_question,NULL,
|
||||
|
@ -3473,18 +3474,23 @@ static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs)
|
|||
{
|
||||
extern const char *Txt_of_PART_OF_A_TOTAL;
|
||||
unsigned BarWidth = 0;
|
||||
char *Title;
|
||||
|
||||
/***** String with the number of users *****/
|
||||
/***** Build string with the number of users *****/
|
||||
if (MaxUsrs)
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%u (%u%% %s %u)",
|
||||
{
|
||||
if (asprintf (&Title,"%u (%u%% %s %u)",
|
||||
NumUsrs,
|
||||
(unsigned) ((((double) NumUsrs * 100.0) / (double) MaxUsrs) + 0.5),
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
else
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"0 (0%% %s %u)",
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs);
|
||||
{
|
||||
if (asprintf (&Title,"0 (0%% %s %u)",
|
||||
Txt_of_PART_OF_A_TOTAL,MaxUsrs) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
}
|
||||
|
||||
HTM_TD_Begin ("class=\"DAT LT\" style=\"width:%upx;\"",Svy_MAX_BAR_WIDTH + 125);
|
||||
|
||||
|
@ -3494,11 +3500,14 @@ static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs)
|
|||
(double) MaxUsrs) + 0.5);
|
||||
if (BarWidth < 2)
|
||||
BarWidth = 2;
|
||||
HTM_IMG (Cfg_URL_ICON_PUBLIC,"o1x1.png",Gbl.Title,
|
||||
HTM_IMG (Cfg_URL_ICON_PUBLIC,"o1x1.png",Title,
|
||||
"class=\"LT\" style=\"width:%upx; height:20px;\"",BarWidth);
|
||||
|
||||
/***** Write the number of users *****/
|
||||
HTM_TxtF (" %s",Gbl.Title);
|
||||
HTM_TxtF (" %s",Title);
|
||||
|
||||
/***** Free string with the number of users *****/
|
||||
free (Title);
|
||||
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
|
19
swad_test.c
19
swad_test.c
|
@ -31,7 +31,7 @@
|
|||
#include <mysql/mysql.h> // To access MySQL databases
|
||||
#include <stdbool.h> // For boolean type
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For fprintf, asprintf, etc.
|
||||
#include <stdio.h> // For asprintf
|
||||
#include <stdlib.h> // For exit, system, malloc, free, etc
|
||||
#include <string.h> // For string functions
|
||||
#include <sys/stat.h> // For mkdir
|
||||
|
@ -5085,6 +5085,7 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
|||
bool DisplayRightColumn;
|
||||
char StrTagTxt[6 + Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
char StrInteger[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
char *Title;
|
||||
|
||||
/***** Begin box *****/
|
||||
if (Gbl.Test.QstCod > 0) // The question already has assigned a code
|
||||
|
@ -5361,29 +5362,29 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
|
|||
HTM_TxtF ("%c)",'a' + (char) NumOpt);
|
||||
|
||||
/* Icon to expand (show the answer) */
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%s %c)",
|
||||
Txt_Expand,'a' + (char) NumOpt);
|
||||
HTM_A_Begin ("href=\"\" id=\"exp_%u\"%s"
|
||||
" onclick=\"toggleAnswer('%u');return false;\"",
|
||||
NumOpt,
|
||||
DisplayRightColumn ? " style=\"display:none;\"" : // Answer does have content ==> Hide icon
|
||||
"",
|
||||
NumOpt);
|
||||
Ico_PutIcon ("caret-right.svg",Gbl.Title,"ICO16x16");
|
||||
if (asprintf (&Title,"%s %c)",Txt_Expand,'a' + (char) NumOpt) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
Ico_PutIcon ("caret-right.svg",Title,"ICO16x16");
|
||||
free (Title);
|
||||
HTM_A_End ();
|
||||
|
||||
/* Icon to contract (hide the answer) */
|
||||
snprintf (Gbl.Title,sizeof (Gbl.Title),
|
||||
"%s %c)",
|
||||
Txt_Contract,'a' + (char) NumOpt);
|
||||
HTM_A_Begin ("href=\"\" id=\"con_%u\"%s"
|
||||
" onclick=\"toggleAnswer(%u);return false;\"",
|
||||
NumOpt,
|
||||
DisplayRightColumn ? "" :
|
||||
" style=\"display:none;\"", // Answer does not have content ==> Hide icon
|
||||
NumOpt);
|
||||
Ico_PutIcon ("caret-down.svg",Gbl.Title,"ICO16x16");
|
||||
if (asprintf (&Title,"%s %c)",Txt_Contract,'a' + (char) NumOpt) < 0)
|
||||
Lay_NotEnoughMemoryExit ();
|
||||
Ico_PutIcon ("caret-down.svg",Title,"ICO16x16");
|
||||
free (Title);
|
||||
HTM_A_End ();
|
||||
|
||||
HTM_TD_End ();
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
/********************************** Headers **********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <stdio.h> // For fprintf, etc.
|
||||
#include <string.h>
|
||||
|
||||
#include "swad_box.h"
|
||||
|
|
Loading…
Reference in New Issue