Version 16.30.2

This commit is contained in:
Antonio Cañas Vargas 2016-10-21 00:38:34 +02:00
parent 8c89a1433b
commit 47be015538
14 changed files with 1586 additions and 1587 deletions

View File

@ -374,7 +374,7 @@ void ID_WriteUsrIDs (struct UsrData *UsrDat)
ICanSeeUsrID = ID_ICanSeeAnotherUsrID (UsrDat); ICanSeeUsrID = ID_ICanSeeAnotherUsrID (UsrDat);
ICanConfirmUsrID = ICanSeeUsrID && ICanConfirmUsrID = ICanSeeUsrID &&
!Gbl.Form.Inside && // Only if not inside another form !Gbl.Form.Inside && // Only if not inside another form
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW; // Only in main window Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
} }
for (NumID = 0; for (NumID = 0;

File diff suppressed because it is too large Load Diff

View File

@ -41,14 +41,14 @@
typedef enum typedef enum
{ {
Act_CONTENT_NORM, Act_CONT_NORM,
Act_CONTENT_DATA, Act_CONT_DATA,
} Act_Content_t; } Act_Content_t;
typedef enum typedef enum
{ {
Act_MAIN_WINDOW, Act_THIS_WINDOW, // The current tab in the browser
Act_NEW_WINDOW, Act_BLNK_WINDOW, // A new blank tab in the browser
Act_UPLOAD_FILE, // Upload a file. Do not write HTML content. Write Status code instead for Dropzone.js Act_UPLOAD_FILE, // Upload a file. Do not write HTML content. Write Status code instead for Dropzone.js
Act_DOWNLD_FILE, // Download a file in a new window. Do not write HTML content. Act_DOWNLD_FILE, // Download a file in a new window. Do not write HTML content.
} Act_BrowserWindow_t; } Act_BrowserWindow_t;

View File

@ -150,13 +150,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.30.1 (2016-10-20)" #define Log_PLATFORM_VERSION "SWAD 16.30.2 (2016-10-21)"
#define CSS_FILE "swad16.25.css" #define CSS_FILE "swad16.25.css"
#define JS_FILE "swad15.238.1.js" #define JS_FILE "swad15.238.1.js"
// 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 16.30.2: Oct 21, 2016 Code refactoring related to actions. (205077 lines)
Version 16.30.1: Oct 20, 2016 Code refactoring related to tabs. (205077 lines) Version 16.30.1: Oct 20, 2016 Code refactoring related to tabs. (205077 lines)
Version 16.30: Oct 20, 2016 Removed country in edition of institutions. (205058 lines) Version 16.30: Oct 20, 2016 Removed country in edition of institutions. (205058 lines)
1 change necessary in database: 1 change necessary in database:

View File

@ -1126,7 +1126,7 @@ void Cty_WriteCountryName (long CtyCod,const char *Class)
char CtyName[Cty_MAX_BYTES_COUNTRY_NAME+1]; char CtyName[Cty_MAX_BYTES_COUNTRY_NAME+1];
char ActTxt[Act_MAX_LENGTH_ACTION_TXT+1]; char ActTxt[Act_MAX_LENGTH_ACTION_TXT+1];
bool PutForm = !Gbl.Form.Inside && // Only if not inside another form bool PutForm = !Gbl.Form.Inside && // Only if not inside another form
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW; // Only in main window Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
/***** Get country name *****/ /***** Get country name *****/
Cty_GetCountryName (CtyCod,CtyName); Cty_GetCountryName (CtyCod,CtyName);

View File

@ -435,7 +435,7 @@ void Gbl_Cleanup (void)
if (!Gbl.Action.UsesAJAX && if (!Gbl.Action.UsesAJAX &&
!Gbl.WebService.IsWebService && !Gbl.WebService.IsWebService &&
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW && Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW &&
!Gbl.HiddenParamsInsertedIntoDB) !Gbl.HiddenParamsInsertedIntoDB)
Ses_RemoveHiddenParFromThisSession (); Ses_RemoveHiddenParFromThisSession ();
Usr_FreeMyCourses (); Usr_FreeMyCourses ();

View File

@ -108,7 +108,7 @@ struct Globals
Act_Content_t ContentReceivedByCGI; /* Content send by the form and received by the CGI: Act_Content_t ContentReceivedByCGI; /* Content send by the form and received by the CGI:
Act_CONTENT_NORM (if CONTENT_TYPE==text/plain) or Act_CONTENT_NORM (if CONTENT_TYPE==text/plain) or
Act_CONTENT_DATA (if CONTENT_TYPE==multipart/form-data) */ Act_CONT_DATA (if CONTENT_TYPE==multipart/form-data) */
struct struct
{ {
char StrWithoutCRLF[Par_MAX_LENGTH_BOUNDARY_WITH_CR_LF+1]; char StrWithoutCRLF[Par_MAX_LENGTH_BOUNDARY_WITH_CR_LF+1];

View File

@ -231,7 +231,7 @@ void Lay_WriteStartOfPage (void)
fprintf (Gbl.F.Out,"</head>\n"); fprintf (Gbl.F.Out,"</head>\n");
/***** HTML body *****/ /***** HTML body *****/
if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW) if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW)
fprintf (Gbl.F.Out,"<body onload=\"init()\">\n" fprintf (Gbl.F.Out,"<body onload=\"init()\">\n"
"<div id=\"zoomLyr\" class=\"ZOOM\">" "<div id=\"zoomLyr\" class=\"ZOOM\">"
"<img id=\"zoomImg\" src=\"%s/usr_bl.jpg\"" "<img id=\"zoomImg\" src=\"%s/usr_bl.jpg\""
@ -352,7 +352,7 @@ static void Lay_WriteEndOfPage (void)
"</div>"); // main_zone_central_container "</div>"); // main_zone_central_container
/***** Write page footer *****/ /***** Write page footer *****/
if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW) if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW)
Lay_WriteFootFromHTMLFile (); Lay_WriteFootFromHTMLFile ();
/***** End of main zone and page *****/ /***** End of main zone and page *****/
@ -453,7 +453,7 @@ static void Lay_WriteScripts (void)
#endif #endif
/***** Scripts used only in main window *****/ /***** Scripts used only in main window *****/
if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW) if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW)
{ {
Lay_WriteScriptInit (); Lay_WriteScriptInit ();
Lay_WriteScriptParamsAJAX (); Lay_WriteScriptParamsAJAX ();
@ -1387,7 +1387,7 @@ void Lay_ShowErrorAndExit (const char *Message)
if (!Gbl.Layout.HTMLEndWritten) if (!Gbl.Layout.HTMLEndWritten)
{ {
// Here Gbl.F.Out is stdout // Here Gbl.F.Out is stdout
if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW) if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW)
Lay_WriteAboutZone (); Lay_WriteAboutZone ();
fprintf (Gbl.F.Out,"</body>\n" fprintf (Gbl.F.Out,"</body>\n"

View File

@ -128,7 +128,7 @@ int main (int argc, char *argv[])
Con_RemoveOldConnected (); Con_RemoveOldConnected ();
/***** Get number of sessions *****/ /***** Get number of sessions *****/
if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW) if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW)
Ses_GetNumSessions (); Ses_GetNumSessions ();
/***** Check user and get user's data *****/ /***** Check user and get user's data *****/

View File

@ -83,7 +83,7 @@ bool Par_GetQueryString (void)
{ {
/***** GET method *****/ /***** GET method *****/
Gbl.Params.GetMethod = true; Gbl.Params.GetMethod = true;
Gbl.ContentReceivedByCGI = Act_CONTENT_NORM; Gbl.ContentReceivedByCGI = Act_CONT_NORM;
/* Get content length */ /* Get content length */
Gbl.Params.ContentLength = strlen (getenv ("QUERY_STRING")); Gbl.Params.ContentLength = strlen (getenv ("QUERY_STRING"));
@ -119,7 +119,7 @@ bool Par_GetQueryString (void)
if (!strncmp (ContentType,"multipart/form-data",strlen ("multipart/form-data"))) if (!strncmp (ContentType,"multipart/form-data",strlen ("multipart/form-data")))
{ {
Gbl.ContentReceivedByCGI = Act_CONTENT_DATA; Gbl.ContentReceivedByCGI = Act_CONT_DATA;
Par_GetBoundary (); Par_GetBoundary ();
return Fil_ReadStdinIntoTmpFile (); return Fil_ReadStdinIntoTmpFile ();
} }
@ -129,7 +129,7 @@ bool Par_GetQueryString (void)
} }
else else
{ {
Gbl.ContentReceivedByCGI = Act_CONTENT_NORM; Gbl.ContentReceivedByCGI = Act_CONT_NORM;
/* Allocate memory for query string */ /* Allocate memory for query string */
if ((Gbl.Params.QueryString = (char *) malloc (Gbl.Params.ContentLength + 1)) == NULL) if ((Gbl.Params.QueryString = (char *) malloc (Gbl.Params.ContentLength + 1)) == NULL)
@ -216,10 +216,10 @@ void Par_CreateListOfParams (void)
if (Gbl.Params.ContentLength) if (Gbl.Params.ContentLength)
switch (Gbl.ContentReceivedByCGI) switch (Gbl.ContentReceivedByCGI)
{ {
case Act_CONTENT_NORM: case Act_CONT_NORM:
Par_CreateListOfParamsFromQueryString (); Par_CreateListOfParamsFromQueryString ();
break; break;
case Act_CONTENT_DATA: case Act_CONT_DATA:
Par_CreateListOfParamsFromTmpFile (); Par_CreateListOfParamsFromTmpFile ();
break; break;
} }
@ -515,11 +515,11 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
// Check if the name of the parameter is the same // Check if the name of the parameter is the same
switch (Gbl.ContentReceivedByCGI) switch (Gbl.ContentReceivedByCGI)
{ {
case Act_CONTENT_NORM: case Act_CONT_NORM:
ParamFound = !strncmp (ParamName,&Gbl.Params.QueryString[Param->Name.Start], ParamFound = !strncmp (ParamName,&Gbl.Params.QueryString[Param->Name.Start],
Param->Name.Length); Param->Name.Length);
break; break;
case Act_CONTENT_DATA: case Act_CONT_DATA:
fseek (Gbl.F.Tmp,Param->Name.Start,SEEK_SET); fseek (Gbl.F.Tmp,Param->Name.Start,SEEK_SET);
for (i = 0, ParamFound = true; for (i = 0, ParamFound = true;
i < Param->Name.Length && ParamFound; i < Param->Name.Length && ParamFound;
@ -575,12 +575,12 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
/* Copy parameter value */ /* Copy parameter value */
switch (Gbl.ContentReceivedByCGI) switch (Gbl.ContentReceivedByCGI)
{ {
case Act_CONTENT_NORM: case Act_CONT_NORM:
if (PtrDst) if (PtrDst)
strncpy (PtrDst,&Gbl.Params.QueryString[Param->Value.Start], strncpy (PtrDst,&Gbl.Params.QueryString[Param->Value.Start],
Param->Value.Length); Param->Value.Length);
break; break;
case Act_CONTENT_DATA: case Act_CONT_DATA:
if (Param->FileName.Start == 0 && // Copy into destination only if it's not a file if (Param->FileName.Start == 0 && // Copy into destination only if it's not a file
PtrDst) PtrDst)
{ {

View File

@ -1130,10 +1130,10 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
char Surnames [2*(Usr_MAX_BYTES_NAME_SPEC_CHAR+1)+1]; char Surnames [2*(Usr_MAX_BYTES_NAME_SPEC_CHAR+1)+1];
bool PhotoExists; bool PhotoExists;
bool PutLinkToPublicProfile = !Gbl.Form.Inside && // Only if not inside another form bool PutLinkToPublicProfile = !Gbl.Form.Inside && // Only if not inside another form
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW; // Only in main window Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
bool PutZoomCode = PhotoURL && // Photo exists bool PutZoomCode = PhotoURL && // Photo exists
Zoom == Pho_ZOOM && // Make zoom Zoom == Pho_ZOOM && // Make zoom
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW; // Only in main window Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
char IdCaption[Act_MAX_LENGTH_ID]; char IdCaption[Act_MAX_LENGTH_ID];

View File

@ -2062,7 +2062,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
} }
PutFormLinks = !Gbl.Form.Inside && // Only if not inside another form PutFormLinks = !Gbl.Form.Inside && // Only if not inside another form
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW; // Only in main window Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window
Ins.InsCod = UsrDat->InsCod; Ins.InsCod = UsrDat->InsCod;
if (Ins.InsCod > 0) if (Ins.InsCod > 0)
@ -2268,7 +2268,7 @@ static void Rec_PutIconsCommands (void)
Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_TEACHER); Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_TEACHER);
if (!Gbl.Form.Inside && // Only if not inside another form if (!Gbl.Form.Inside && // Only if not inside another form
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW && // Only in main window Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW && // Only in main window
Gbl.Usrs.Me.Logged) // Only if I am logged Gbl.Usrs.Me.Logged) // Only if I am logged
{ {
fprintf (Gbl.F.Out,"<div class=\"REC_SHORTCUTS\">"); fprintf (Gbl.F.Out,"<div class=\"REC_SHORTCUTS\">");

View File

@ -994,7 +994,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
switch (ChangeFrom) switch (ChangeFrom)
{ {
case Str_FROM_FORM: case Str_FROM_FORM:
if (Gbl.ContentReceivedByCGI == Act_CONTENT_DATA) if (Gbl.ContentReceivedByCGI == Act_CONT_DATA)
// The form contained data and was sent with content type multipart/form-data // The form contained data and was sent with content type multipart/form-data
switch (Ch) switch (Ch)
{ {

View File

@ -210,7 +210,7 @@ void Usr_InformAboutNumClicksBeforePhoto (void)
{ {
if (Gbl.Usrs.Me.NumAccWithoutPhoto >= Pho_MAX_CLICKS_WITHOUT_PHOTO) if (Gbl.Usrs.Me.NumAccWithoutPhoto >= Pho_MAX_CLICKS_WITHOUT_PHOTO)
Lay_ShowAlert (Lay_WARNING,Txt_You_must_send_your_photo_because_); Lay_ShowAlert (Lay_WARNING,Txt_You_must_send_your_photo_because_);
else if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW) else if (Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW)
{ {
sprintf (Message,Txt_You_can_only_perform_X_further_actions_, sprintf (Message,Txt_You_can_only_perform_X_further_actions_,
Pho_MAX_CLICKS_WITHOUT_PHOTO-Gbl.Usrs.Me.NumAccWithoutPhoto); Pho_MAX_CLICKS_WITHOUT_PHOTO-Gbl.Usrs.Me.NumAccWithoutPhoto);