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);
ICanConfirmUsrID = ICanSeeUsrID &&
!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;

File diff suppressed because it is too large Load Diff

View File

@ -41,14 +41,14 @@
typedef enum
{
Act_CONTENT_NORM,
Act_CONTENT_DATA,
Act_CONT_NORM,
Act_CONT_DATA,
} Act_Content_t;
typedef enum
{
Act_MAIN_WINDOW,
Act_NEW_WINDOW,
Act_THIS_WINDOW, // The current tab in the browser
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_DOWNLD_FILE, // Download a file in a new window. Do not write HTML content.
} Act_BrowserWindow_t;

View File

@ -150,13 +150,14 @@
/****************************** 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 JS_FILE "swad15.238.1.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.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: Oct 20, 2016 Removed country in edition of institutions. (205058 lines)
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 ActTxt[Act_MAX_LENGTH_ACTION_TXT+1];
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 *****/
Cty_GetCountryName (CtyCod,CtyName);

View File

@ -435,7 +435,7 @@ void Gbl_Cleanup (void)
if (!Gbl.Action.UsesAJAX &&
!Gbl.WebService.IsWebService &&
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_MAIN_WINDOW &&
Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW &&
!Gbl.HiddenParamsInsertedIntoDB)
Ses_RemoveHiddenParFromThisSession ();
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_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
{
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");
/***** 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"
"<div id=\"zoomLyr\" class=\"ZOOM\">"
"<img id=\"zoomImg\" src=\"%s/usr_bl.jpg\""
@ -352,7 +352,7 @@ static void Lay_WriteEndOfPage (void)
"</div>"); // main_zone_central_container
/***** 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 ();
/***** End of main zone and page *****/
@ -453,7 +453,7 @@ static void Lay_WriteScripts (void)
#endif
/***** 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_WriteScriptParamsAJAX ();
@ -1387,7 +1387,7 @@ void Lay_ShowErrorAndExit (const char *Message)
if (!Gbl.Layout.HTMLEndWritten)
{
// 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 ();
fprintf (Gbl.F.Out,"</body>\n"

View File

@ -128,7 +128,7 @@ int main (int argc, char *argv[])
Con_RemoveOldConnected ();
/***** 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 ();
/***** Check user and get user's data *****/

View File

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

View File

@ -2062,7 +2062,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
}
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;
if (Ins.InsCod > 0)
@ -2268,7 +2268,7 @@ static void Rec_PutIconsCommands (void)
Gbl.Record.UsrDat->RoleInCurrentCrsDB == Rol_TEACHER);
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
{
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)
{
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
switch (Ch)
{

View File

@ -210,7 +210,7 @@ void Usr_InformAboutNumClicksBeforePhoto (void)
{
if (Gbl.Usrs.Me.NumAccWithoutPhoto >= Pho_MAX_CLICKS_WITHOUT_PHOTO)
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_,
Pho_MAX_CLICKS_WITHOUT_PHOTO-Gbl.Usrs.Me.NumAccWithoutPhoto);