Version 15.169.5

This commit is contained in:
Antonio Cañas Vargas 2016-03-31 20:09:47 +02:00
parent 0f19db742f
commit fc52b5d644
4 changed files with 21 additions and 9 deletions

View File

@ -138,13 +138,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.169.4 (2016-03-31)"
#define Log_PLATFORM_VERSION "SWAD 15.169.5 (2016-03-31)"
#define CSS_FILE "swad15.165.5.css"
#define JS_FILE "swad15.131.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 15.169.5: Mar 31, 2016 Code refactoring in function to get a parameter. (197292 lines)
Version 15.169.4: Mar 31, 2016 Code refactoring in list of parameters. (197280 lines)
Version 15.169.3: Mar 31, 2016 Code refactoring in list of parameters. (197271 lines)
Version 15.169.2: Mar 31, 2016 Code refactoring in list of parameters. Not finished. (197298 lines)

View File

@ -1885,7 +1885,8 @@ void Inf_RecAndChangePlainTxtInfo (void)
Gbl.CurrentCrs.Info.Type = Inf_AsignInfoType ();
/***** Get text with course information from form *****/
Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT);
Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat,
Cns_MAX_BYTES_LONG_TEXT,NULL);
strcpy (Txt_MarkdownFormat,Txt_HTMLFormat);
Str_ChangeFormat (Str_FROM_FORM,Str_TO_HTML,
Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT,true); // Store in HTML format (not rigorous)
@ -1919,7 +1920,8 @@ void Inf_RecAndChangeRichTxtInfo (void)
Gbl.CurrentCrs.Info.Type = Inf_AsignInfoType ();
/***** Get text with course information from form *****/
Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT);
Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat,
Cns_MAX_BYTES_LONG_TEXT,NULL);
strcpy (Txt_MarkdownFormat,Txt_HTMLFormat);
Str_ChangeFormat (Str_FROM_FORM,Str_TO_HTML,
Txt_HTMLFormat,Cns_MAX_BYTES_LONG_TEXT,true); // Store in HTML format (not rigorous)

View File

@ -521,9 +521,11 @@ void Par_FreeParams (void)
/************************* Get the value of a parameter **********************/
/*****************************************************************************/
// Return the number of parameters found
// If ParamPtr is not null, on return it will point to the first ocurrence in list of parameters
unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
char *ParamValue,size_t MaxBytes)
char *ParamValue,size_t MaxBytes,
struct Param *ParamPtr) // NULL is not used
{
size_t BytesAlreadyCopied = 0;
unsigned i;
@ -578,9 +580,15 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
if (ParamFound)
{
/***** Add separator when param multiple *****/
if (NumTimes) // Not the first ocurrence of this parameter
if (NumTimes == 0) // The first ocurrence of this parameter
{
/***** Get the first ocurrence of this parameter in list *****/
if (ParamPtr)
ParamPtr = Param;
}
else // Not the first ocurrence of this parameter
{
/***** Add separator when param multiple *****/
/* Check if there is space to copy separator */
if (BytesAlreadyCopied + 1 > MaxBytes)
{
@ -930,7 +938,7 @@ unsigned Par_GetParToHTML (const char *ParamName,char *ParamValue,size_t MaxByte
unsigned Par_GetParMultiToText (const char *ParamName,char *ParamValue,size_t MaxBytes)
{
unsigned NumTimes = Par_GetParameter (Par_PARAM_MULTIPLE,ParamName,
ParamValue,MaxBytes);
ParamValue,MaxBytes,NULL);
Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT,
ParamValue,MaxBytes,true);
return NumTimes;
@ -945,7 +953,7 @@ unsigned Par_GetParAndChangeFormat (const char *ParamName,char *ParamValue,size_
Str_ChangeTo_t ChangeTo,bool RemoveLeadingAndTrailingSpaces)
{
unsigned NumTimes = Par_GetParameter (Par_PARAM_SINGLE,ParamName,
ParamValue,MaxBytes);
ParamValue,MaxBytes,NULL);
Str_ChangeFormat (Str_FROM_FORM,ChangeTo,
ParamValue,MaxBytes,RemoveLeadingAndTrailingSpaces);
return NumTimes;

View File

@ -66,7 +66,8 @@ bool Par_GetQueryString (void);
void Par_CreateListOfParams (void);
void Par_FreeParams (void);
unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
char *ParamValue,size_t MaxBytes);
char *ParamValue,size_t MaxBytes,
struct Param *ParamPtr);
void Par_GetMainParameters (void);