mirror of https://github.com/acanas/swad-core.git
Version 16.78
This commit is contained in:
parent
c899d13400
commit
5db0ce249d
13
sql/swad.sql
13
sql/swad.sql
|
@ -602,10 +602,15 @@ CREATE TABLE IF NOT EXISTS links (
|
|||
--
|
||||
CREATE TABLE IF NOT EXISTS locations (
|
||||
LocCod INT NOT NULL AUTO_INCREMENT,
|
||||
StartDate DATE NOT NULL,
|
||||
EndDate DATE NOT NULL,
|
||||
Location VARCHAR(255) NOT NULL,
|
||||
UNIQUE INDEX(LocCod));
|
||||
UsrCod INT NOT NULL,
|
||||
Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',
|
||||
NumNotif INT NOT NULL DEFAULT 0,
|
||||
StartTime DATETIME NOT NULL,
|
||||
EndTime DATETIME NOT NULL,
|
||||
Title VARCHAR(255) NOT NULL,
|
||||
Txt TEXT NOT NULL,
|
||||
UNIQUE INDEX(LocCod),
|
||||
INDEX(UsrCod,Hidden));
|
||||
--
|
||||
-- Table log_banners: stores the log of clicked banners
|
||||
--
|
||||
|
|
|
@ -2794,14 +2794,14 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActAnnSee */{1234,-1,TabUnk,ActFrmRolSes ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Ann_MarkAnnouncementAsSeen ,NULL},
|
||||
/* ActChgMyRol */{ 589,-1,TabUnk,ActFrmRolSes ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,Rol_ChangeMyRole ,Usr_ShowFormsLogoutAndRole ,NULL},
|
||||
|
||||
/* ActFrmNewLoc */{1603,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x000,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RequestCreatOrEditLoc ,NULL},
|
||||
/* ActEdiOneLoc */{1604,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x000,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RequestCreatOrEditLoc ,NULL},
|
||||
/* ActNewLoc */{1605,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x000,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RecFormLocation ,NULL},
|
||||
/* ActChgLoc */{1606,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x000,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RecFormLocation ,NULL},
|
||||
/* ActReqRemLoc */{1607,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x000,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_AskRemLocation ,NULL},
|
||||
/* ActRemLoc */{1608,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x000,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RemoveLocation ,NULL},
|
||||
/* ActHidLoc */{1609,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x000,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_HideLocation ,NULL},
|
||||
/* ActShoLoc */{1610,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x000,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_ShowLocation ,NULL},
|
||||
/* ActFrmNewLoc */{1603,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RequestCreatOrEditLoc ,NULL},
|
||||
/* ActEdiOneLoc */{1604,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RequestCreatOrEditLoc ,NULL},
|
||||
/* ActNewLoc */{1605,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RecFormLocation ,NULL},
|
||||
/* ActChgLoc */{1606,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RecFormLocation ,NULL},
|
||||
/* ActReqRemLoc */{1607,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_AskRemLocation ,NULL},
|
||||
/* ActRemLoc */{1608,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_RemoveLocation ,NULL},
|
||||
/* ActHidLoc */{1609,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_HideLocation ,NULL},
|
||||
/* ActShoLoc */{1610,-1,TabUnk,ActSeeMyLoc ,0x100,0x100,0x100,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Loc_ShowLocation ,NULL},
|
||||
|
||||
/* ActChkUsrAcc */{1584,-1,TabUnk,ActFrmMyAcc ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Acc_CheckIfEmptyAccountExists ,NULL},
|
||||
/* ActCreUsrAcc */{1163,-1,TabUnk,ActFrmMyAcc ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Acc_AfterCreationNewAccount ,NULL},
|
||||
|
|
|
@ -172,6 +172,8 @@
|
|||
|
||||
// TODO: List only confirmed emails to send a message with MESSAGES > Email ?
|
||||
|
||||
// TODO: Add SWAD API to https://www.programmableweb.com/add/api
|
||||
|
||||
// TODO: When activating folders in groups, go to section for that type of group
|
||||
// TODO: I can not remove a folder inside assignments (see swad.ugr.es -> EC -> assignment acanas)
|
||||
// TODO: When teacher sees "No hay estudiantes", put a button to add students
|
||||
|
@ -181,13 +183,18 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.77 (2016-11-29)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.78 (2016-11-30)"
|
||||
#define CSS_FILE "swad16.69.css"
|
||||
#define JS_FILE "swad16.46.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.78: Nov 30, 2016 Changes in location. Not finished. (209486 lines)
|
||||
2 changes necessary in database:
|
||||
DROP TABLE IF EXISTS locations;
|
||||
CREATE TABLE IF NOT EXISTS locations (LocCod INT NOT NULL AUTO_INCREMENT,UsrCod INT NOT NULL,Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',NumNotif INT NOT NULL DEFAULT 0,StartTime DATETIME NOT NULL,EndTime DATETIME NOT NULL,Title VARCHAR(255) NOT NULL,Txt TEXT NOT NULL,UNIQUE INDEX(LocCod),INDEX(UsrCod,Hidden));
|
||||
|
||||
Version 16.77: Nov 29, 2016 Changes in location. Not finished. (209483 lines)
|
||||
Version 16.76: Nov 29, 2016 New form to create location. Not finished. (208936 lines)
|
||||
8 changes necessary in database:
|
||||
|
|
|
@ -1300,22 +1300,31 @@ mysql> DESCRIBE links;
|
|||
/***** Table locations *****/
|
||||
/*
|
||||
mysql> DESCRIBE locations;
|
||||
+-----------+--------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-----------+--------------+------+-----+---------+----------------+
|
||||
| LocCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| StartDate | date | NO | | NULL | |
|
||||
| EndDate | date | NO | | NULL | |
|
||||
| Location | varchar(255) | NO | | NULL | |
|
||||
+-----------+--------------+------+-----+---------+----------------+
|
||||
4 rows in set (0,01 sec)
|
||||
+-----------+---------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-----------+---------------+------+-----+---------+----------------+
|
||||
| LocCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||
| Hidden | enum('N','Y') | NO | | N | |
|
||||
| NumNotif | int(11) | NO | | 0 | |
|
||||
| StartTime | datetime | NO | | NULL | |
|
||||
| EndTime | datetime | NO | | NULL | |
|
||||
| Title | varchar(255) | NO | | NULL | |
|
||||
| Txt | text | NO | | NULL | |
|
||||
+-----------+---------------+------+-----+---------+----------------+
|
||||
8 rows in set (0,01 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS locations ("
|
||||
"LocCod INT NOT NULL AUTO_INCREMENT,"
|
||||
"StartDate DATE NOT NULL,"
|
||||
"EndDate DATE NOT NULL,"
|
||||
"Location VARCHAR(255) NOT NULL,"
|
||||
"UNIQUE INDEX (LocCod))");
|
||||
"UsrCod INT NOT NULL,"
|
||||
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"NumNotif INT NOT NULL DEFAULT 0,"
|
||||
"StartTime DATETIME NOT NULL,"
|
||||
"EndTime DATETIME NOT NULL,"
|
||||
"Title VARCHAR(255) NOT NULL,"
|
||||
"Txt TEXT NOT NULL,"
|
||||
"UNIQUE INDEX(LocCod),"
|
||||
"INDEX(UsrCod,Hidden))");
|
||||
|
||||
/***** Table log_banners *****/
|
||||
/*
|
||||
|
|
374
swad_location.c
374
swad_location.c
|
@ -78,10 +78,8 @@ static void Loc_GetDataOfLocation (struct Location *Loc,const char *Query);
|
|||
static void Loc_GetLocationTxtFromDB (long LocCod,char *Txt);
|
||||
static void Loc_PutParamLocCod (long LocCod);
|
||||
static bool Loc_CheckIfSimilarLocationExists (const char *Field,const char *Value,long LocCod);
|
||||
static void Loc_UpdateNumUsrsNotifiedByEMailAboutLocation (long LocCod,unsigned NumUsrsToBeNotifiedByEMail);
|
||||
static void Loc_CreateLocation (struct Location *Loc,const char *Txt);
|
||||
static void Loc_UpdateLocation (struct Location *Loc,const char *Txt);
|
||||
static bool Loc_CheckIfIBelongToCrsThisLocation (long LocCod);
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* List all the locations ****************************/
|
||||
|
@ -109,8 +107,6 @@ static void Loc_ShowAllLocations (void)
|
|||
extern const char *Txt_ASG_ATT_OR_SVY_HELP_ORDER[2];
|
||||
extern const char *Txt_ASG_ATT_OR_SVY_ORDER[2];
|
||||
extern const char *Txt_Location;
|
||||
extern const char *Txt_Upload_files_QUESTION;
|
||||
extern const char *Txt_Folder;
|
||||
extern const char *Txt_No_locations;
|
||||
Loc_Order_t Order;
|
||||
struct Pagination Pagination;
|
||||
|
@ -158,18 +154,10 @@ static void Loc_ShowAllLocations (void)
|
|||
fprintf (Gbl.F.Out,"</th>");
|
||||
}
|
||||
fprintf (Gbl.F.Out,"<th class=\"LEFT_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"CENTER_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"<th class=\"CENTER_MIDDLE\">"
|
||||
"%s"
|
||||
"</th>"
|
||||
"</tr>",
|
||||
Txt_Location,
|
||||
Txt_Upload_files_QUESTION,
|
||||
Txt_Folder);
|
||||
Txt_Location);
|
||||
|
||||
/***** Write all the locations *****/
|
||||
for (NumLoc = Pagination.FirstItemVisible;
|
||||
|
@ -270,9 +258,6 @@ static void Loc_PutParamsToCreateNewLoc (void)
|
|||
static void Loc_ShowOneLocation (long LocCod)
|
||||
{
|
||||
extern const char *Txt_Today;
|
||||
extern const char *Txt_ASSIGNMENT_TYPES[Loc_NUM_TYPES_SEND_WORK];
|
||||
extern const char *Txt_Yes;
|
||||
extern const char *Txt_No;
|
||||
static unsigned UniqueId = 0;
|
||||
struct Location Loc;
|
||||
char Txt[Cns_MAX_BYTES_TEXT+1];
|
||||
|
@ -320,24 +305,8 @@ static void Loc_ShowOneLocation (long LocCod)
|
|||
Loc.Hidden ? "ASG_TITLE_LIGHT" :
|
||||
"ASG_TITLE",
|
||||
Loc.Title);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/* Send work? */
|
||||
fprintf (Gbl.F.Out,"<td rowspan=\"2\" class=\"%s CENTER_TOP COLOR%u\">"
|
||||
"<img src=\"%s/%s16x16.gif\""
|
||||
" alt=\"%s\" title=\"%s\" class=\"ICO20x20\" />"
|
||||
"<br />%s"
|
||||
"</td>",
|
||||
(Loc.SendWork == Loc_SEND_WORK) ? "DAT_N" :
|
||||
"DAT",
|
||||
Gbl.RowEvenOdd,
|
||||
Gbl.Prefs.IconsURL,
|
||||
(Loc.SendWork == Loc_SEND_WORK) ? "file_on" :
|
||||
"file_off",
|
||||
Txt_ASSIGNMENT_TYPES[Loc.SendWork],
|
||||
Txt_ASSIGNMENT_TYPES[Loc.SendWork],
|
||||
(Loc.SendWork == Loc_SEND_WORK) ? Txt_Yes :
|
||||
Txt_No);
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
|
||||
/***** Write second row of data of this location *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
@ -377,11 +346,6 @@ static void Loc_ShowOneLocation (long LocCod)
|
|||
Txt);
|
||||
|
||||
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
||||
|
||||
/***** Mark possible notification as seen *****/
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_ASSIGNMENT,
|
||||
LocCod,Gbl.CurrentCrs.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -546,9 +510,9 @@ void Loc_GetListLocations (void)
|
|||
}
|
||||
sprintf (Query,"SELECT LocCod"
|
||||
" FROM locations"
|
||||
" WHERE CrsCod='%ld'%s"
|
||||
" WHERE UsrCod='%ld'%s"
|
||||
" ORDER BY %s",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,HiddenSubQuery,OrderBySubQuery);
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,HiddenSubQuery,OrderBySubQuery);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get locations");
|
||||
|
||||
if (NumRows) // Locations found...
|
||||
|
@ -588,14 +552,14 @@ void Loc_GetDataOfLocationByCod (struct Location *Loc)
|
|||
char Query[1024];
|
||||
|
||||
/***** Build query *****/
|
||||
sprintf (Query,"SELECT LocCod,Hidden,UsrCod,"
|
||||
sprintf (Query,"SELECT LocCod,UsrCod,Hidden,"
|
||||
"UNIX_TIMESTAMP(StartTime),"
|
||||
"UNIX_TIMESTAMP(EndTime),"
|
||||
"NOW() BETWEEN StartTime AND EndTime,"
|
||||
"Title,Folder"
|
||||
"Title"
|
||||
" FROM locations"
|
||||
" WHERE LocCod='%ld' AND CrsCod='%ld'",
|
||||
Loc->LocCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
" WHERE LocCod='%ld' AND UsrCod='%ld'",
|
||||
Loc->LocCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
/***** Get data of location *****/
|
||||
Loc_GetDataOfLocation (Loc,Query);
|
||||
|
@ -613,15 +577,12 @@ static void Loc_GetDataOfLocation (struct Location *Loc,const char *Query)
|
|||
|
||||
/***** Clear all location data *****/
|
||||
Loc->LocCod = -1L;
|
||||
Loc->Hidden = false;
|
||||
Loc->UsrCod = -1L;
|
||||
Loc->Hidden = false;
|
||||
Loc->TimeUTC[Loc_START_TIME] =
|
||||
Loc->TimeUTC[Loc_END_TIME ] = (time_t) 0;
|
||||
Loc->Open = false;
|
||||
Loc->Title[0] = '\0';
|
||||
Loc->SendWork = false;
|
||||
Loc->Folder[0] = '\0';
|
||||
Loc->IBelongToCrsOrGrps = false;
|
||||
|
||||
/***** Get data of location from database *****/
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get location data");
|
||||
|
@ -634,11 +595,11 @@ static void Loc_GetDataOfLocation (struct Location *Loc,const char *Query)
|
|||
/* Get code of the location (row[0]) */
|
||||
Loc->LocCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
|
||||
/* Get whether the location is hidden or not (row[1]) */
|
||||
Loc->Hidden = (row[1][0] == 'Y');
|
||||
/* Get author of the location (row[1]) */
|
||||
Loc->UsrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||
|
||||
/* Get author of the location (row[2]) */
|
||||
Loc->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
/* Get whether the location is hidden or not (row[2]) */
|
||||
Loc->Hidden = (row[2][0] == 'Y');
|
||||
|
||||
/* Get start date (row[3] holds the start UTC time) */
|
||||
Loc->TimeUTC[Loc_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
|
||||
|
@ -651,13 +612,6 @@ static void Loc_GetDataOfLocation (struct Location *Loc,const char *Query)
|
|||
|
||||
/* Get the title of the location (row[6]) */
|
||||
strcpy (Loc->Title,row[6]);
|
||||
|
||||
/* Get the folder for the location files (row[7]) */
|
||||
strcpy (Loc->Folder,row[7]);
|
||||
Loc->SendWork = (Loc->Folder[0] != '\0');
|
||||
|
||||
/* Can I do this location? */
|
||||
Loc->IBelongToCrsOrGrps = Loc_CheckIfIBelongToCrsThisLocation (Loc->LocCod);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -693,8 +647,8 @@ static void Loc_GetLocationTxtFromDB (long LocCod,char *Txt)
|
|||
|
||||
/***** Get text of location from database *****/
|
||||
sprintf (Query,"SELECT Txt FROM locations"
|
||||
" WHERE LocCod='%ld' AND CrsCod='%ld'",
|
||||
LocCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
" WHERE LocCod='%ld' AND UsrCod='%ld'",
|
||||
LocCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get location text");
|
||||
|
||||
/***** The result of the query must have one row or none *****/
|
||||
|
@ -714,49 +668,6 @@ static void Loc_GetLocationTxtFromDB (long LocCod,char *Txt)
|
|||
Lay_ShowErrorAndExit ("Error when getting location text.");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get summary and content of a location *******************/
|
||||
/*****************************************************************************/
|
||||
// This function may be called inside a web service
|
||||
|
||||
void Loc_GetNotifLocation (char *SummaryStr,char **ContentStr,
|
||||
long LocCod,unsigned MaxChars,bool GetContent)
|
||||
{
|
||||
char Query[512];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
SummaryStr[0] = '\0'; // Return nothing on error
|
||||
|
||||
/***** Build query *****/
|
||||
sprintf (Query,"SELECT Title,Txt FROM locations WHERE LocCod='%ld'",
|
||||
LocCod);
|
||||
if (!mysql_query (&Gbl.mysql,Query))
|
||||
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
|
||||
{
|
||||
/***** Result should have a unique row *****/
|
||||
if (mysql_num_rows (mysql_res) == 1)
|
||||
{
|
||||
/***** Get row *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/***** Get summary *****/
|
||||
strcpy (SummaryStr,row[0]);
|
||||
if (MaxChars)
|
||||
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
|
||||
|
||||
/***** Get content *****/
|
||||
if (GetContent)
|
||||
{
|
||||
if ((*ContentStr = (char *) malloc (512+Cns_MAX_BYTES_TEXT)) == NULL)
|
||||
Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
|
||||
strcpy (*ContentStr,row[1]);
|
||||
}
|
||||
}
|
||||
mysql_free_result (mysql_res);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Write parameter with code of location ********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -838,13 +749,10 @@ void Loc_RemoveLocation (void)
|
|||
|
||||
/***** Remove location *****/
|
||||
sprintf (Query,"DELETE FROM locations"
|
||||
" WHERE LocCod='%ld' AND CrsCod='%ld'",
|
||||
Loc.LocCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
" WHERE LocCod='%ld' AND UsrCod='%ld'",
|
||||
Loc.LocCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove location");
|
||||
|
||||
/***** Mark possible notifications as removed *****/
|
||||
Ntf_MarkNotifAsRemoved (Ntf_EVENT_ASSIGNMENT,Loc.LocCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_Location_X_removed,
|
||||
Loc.Title);
|
||||
|
@ -873,8 +781,8 @@ void Loc_HideLocation (void)
|
|||
|
||||
/***** Hide location *****/
|
||||
sprintf (Query,"UPDATE locations SET Hidden='Y'"
|
||||
" WHERE LocCod='%ld' AND CrsCod='%ld'",
|
||||
Loc.LocCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
" WHERE LocCod='%ld' AND UsrCod='%ld'",
|
||||
Loc.LocCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not hide location");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
|
@ -905,8 +813,8 @@ void Loc_ShowLocation (void)
|
|||
|
||||
/***** Hide location *****/
|
||||
sprintf (Query,"UPDATE locations SET Hidden='N'"
|
||||
" WHERE LocCod='%ld' AND CrsCod='%ld'",
|
||||
Loc.LocCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
" WHERE LocCod='%ld' AND UsrCod='%ld'",
|
||||
Loc.LocCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not show location");
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
|
@ -928,8 +836,8 @@ static bool Loc_CheckIfSimilarLocationExists (const char *Field,const char *Valu
|
|||
|
||||
/***** Get number of locations with a field value from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM locations"
|
||||
" WHERE CrsCod='%ld' AND %s='%s' AND LocCod<>'%ld'",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,Field,Value,LocCod);
|
||||
" WHERE UsrCod='%ld' AND %s='%s' AND LocCod<>'%ld'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,Field,Value,LocCod);
|
||||
return (DB_QueryCOUNT (Query,"can not get similar locations") != 0);
|
||||
}
|
||||
|
||||
|
@ -945,8 +853,6 @@ void Loc_RequestCreatOrEditLoc (void)
|
|||
extern const char *Txt_New_location;
|
||||
extern const char *Txt_Edit_location;
|
||||
extern const char *Txt_Title;
|
||||
extern const char *Txt_Upload_files_QUESTION;
|
||||
extern const char *Txt_Folder;
|
||||
extern const char *Txt_Description;
|
||||
extern const char *Txt_Create_location;
|
||||
extern const char *Txt_Save;
|
||||
|
@ -967,13 +873,11 @@ void Loc_RequestCreatOrEditLoc (void)
|
|||
{
|
||||
/* Initialize to empty location */
|
||||
Loc.LocCod = -1L;
|
||||
Loc.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
Loc.TimeUTC[Loc_START_TIME] = Gbl.StartExecutionTimeUTC;
|
||||
Loc.TimeUTC[Loc_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours
|
||||
Loc.Open = true;
|
||||
Loc.Title[0] = '\0';
|
||||
Loc.SendWork = false;
|
||||
Loc.Folder[0] = '\0';
|
||||
Loc.IBelongToCrsOrGrps = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -986,7 +890,7 @@ void Loc_RequestCreatOrEditLoc (void)
|
|||
|
||||
/***** Start form *****/
|
||||
if (ItsANewLocation)
|
||||
Act_FormStart (ActFrmNewLoc);
|
||||
Act_FormStart (ActNewLoc);
|
||||
else
|
||||
{
|
||||
Act_FormStart (ActChgLoc);
|
||||
|
@ -1023,22 +927,6 @@ void Loc_RequestCreatOrEditLoc (void)
|
|||
/***** Location start and end dates *****/
|
||||
Dat_PutFormStartEndClientLocalDateTimes (Loc.TimeUTC);
|
||||
|
||||
/***** Send work? *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
"%s:"
|
||||
"</td>"
|
||||
"<td class=\"DAT LEFT_MIDDLE\">"
|
||||
"%s: "
|
||||
"<input type=\"text\" name=\"Folder\""
|
||||
" size=\"%u\" maxlength=\"%u\" value=\"%s\" />"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
The_ClassForm[Gbl.Prefs.Theme],
|
||||
Txt_Upload_files_QUESTION,
|
||||
Txt_Folder,
|
||||
Loc_MAX_LENGTH_FOLDER,Loc_MAX_LENGTH_FOLDER,Loc.Folder);
|
||||
|
||||
/***** Location text *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s RIGHT_TOP\">"
|
||||
|
@ -1071,7 +959,7 @@ void Loc_RequestCreatOrEditLoc (void)
|
|||
|
||||
void Loc_RecFormLocation (void)
|
||||
{
|
||||
extern const char *Txt_Already_existed_an_location_with_the_title_X;
|
||||
extern const char *Txt_Already_existed_a_location_with_the_title_X;
|
||||
extern const char *Txt_You_must_specify_the_title_of_the_location;
|
||||
extern const char *Txt_Created_new_location_X;
|
||||
extern const char *Txt_The_location_has_been_modified;
|
||||
|
@ -1079,7 +967,6 @@ void Loc_RecFormLocation (void)
|
|||
struct Location NewLoc;
|
||||
bool ItsANewLocation;
|
||||
bool NewLocationIsCorrect = true;
|
||||
unsigned NumUsrsToBeNotifiedByEMail;
|
||||
char Txt[Cns_MAX_BYTES_TEXT+1];
|
||||
|
||||
/***** Get the code of the location *****/
|
||||
|
@ -1099,11 +986,6 @@ void Loc_RecFormLocation (void)
|
|||
/***** Get location title *****/
|
||||
Par_GetParToText ("Title",NewLoc.Title,Loc_MAX_LENGTH_ASSIGNMENT_TITLE);
|
||||
|
||||
/***** Get folder name where to send works of the location *****/
|
||||
Par_GetParToText ("Folder",NewLoc.Folder,Loc_MAX_LENGTH_FOLDER);
|
||||
NewLoc.SendWork = (NewLoc.Folder[0]) ? Loc_SEND_WORK :
|
||||
Loc_DO_NOT_SEND_WORK;
|
||||
|
||||
/***** Get location text *****/
|
||||
Par_GetParToHTML ("Txt",Txt,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
|
||||
|
||||
|
@ -1120,7 +1002,7 @@ void Loc_RecFormLocation (void)
|
|||
if (Loc_CheckIfSimilarLocationExists ("Title",NewLoc.Title,NewLoc.LocCod))
|
||||
{
|
||||
NewLocationIsCorrect = false;
|
||||
sprintf (Gbl.Message,Txt_Already_existed_an_location_with_the_title_X,
|
||||
sprintf (Gbl.Message,Txt_Already_existed_a_location_with_the_title_X,
|
||||
NewLoc.Title);
|
||||
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
|
||||
}
|
||||
|
@ -1144,26 +1026,15 @@ void Loc_RecFormLocation (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (OldLoc.Folder[0] && NewLoc.Folder[0])
|
||||
if (strcmp (OldLoc.Folder,NewLoc.Folder)) // Folder name has changed
|
||||
NewLocationIsCorrect = Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (OldLoc.Folder,NewLoc.Folder);
|
||||
if (NewLocationIsCorrect)
|
||||
{
|
||||
Loc_UpdateLocation (&NewLoc,Txt);
|
||||
Loc_UpdateLocation (&NewLoc,Txt);
|
||||
|
||||
/***** Write success message *****/
|
||||
Lay_ShowAlert (Lay_SUCCESS,Txt_The_location_has_been_modified);
|
||||
}
|
||||
/***** Write success message *****/
|
||||
Lay_ShowAlert (Lay_SUCCESS,Txt_The_location_has_been_modified);
|
||||
}
|
||||
|
||||
/* Free memory for list of selected groups */
|
||||
Grp_FreeListCodSelectedGrps ();
|
||||
|
||||
/***** Notify by email about the new location *****/
|
||||
if ((NumUsrsToBeNotifiedByEMail = Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_ASSIGNMENT,NewLoc.LocCod)))
|
||||
Loc_UpdateNumUsrsNotifiedByEMailAboutLocation (NewLoc.LocCod,NumUsrsToBeNotifiedByEMail);
|
||||
Ntf_ShowAlertNumUsrsToBeNotifiedByEMail (NumUsrsToBeNotifiedByEMail);
|
||||
|
||||
/***** Show locations again *****/
|
||||
Loc_SeeLocations ();
|
||||
}
|
||||
|
@ -1172,21 +1043,6 @@ void Loc_RecFormLocation (void)
|
|||
Loc_RequestCreatOrEditLoc ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********* Update number of users notified in table of locations *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Loc_UpdateNumUsrsNotifiedByEMailAboutLocation (long LocCod,unsigned NumUsrsToBeNotifiedByEMail)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Update number of users notified *****/
|
||||
sprintf (Query,"UPDATE locations SET NumNotif=NumNotif+'%u'"
|
||||
" WHERE LocCod='%ld'",
|
||||
NumUsrsToBeNotifiedByEMail,LocCod);
|
||||
DB_QueryUPDATE (Query,"can not update the number of notifications of an location");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Create a new location *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1197,16 +1053,14 @@ static void Loc_CreateLocation (struct Location *Loc,const char *Txt)
|
|||
|
||||
/***** Create a new location *****/
|
||||
sprintf (Query,"INSERT INTO locations"
|
||||
" (CrsCod,UsrCod,StartTime,EndTime,Title,Folder,Txt)"
|
||||
" (UsrCod,StartTime,EndTime,Title,Txt)"
|
||||
" VALUES"
|
||||
" ('%ld','%ld',FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
||||
"'%s','%s','%s')",
|
||||
Gbl.CurrentCrs.Crs.CrsCod,
|
||||
" ('%ld',FROM_UNIXTIME('%ld'),FROM_UNIXTIME('%ld'),"
|
||||
"'%s','%s')",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Loc->TimeUTC[Loc_START_TIME],
|
||||
Loc->TimeUTC[Loc_END_TIME ],
|
||||
Loc->Title,
|
||||
Loc->Folder,
|
||||
Txt);
|
||||
Loc->LocCod = DB_QueryINSERTandReturnCode (Query,"can not create new location");
|
||||
}
|
||||
|
@ -1223,155 +1077,135 @@ static void Loc_UpdateLocation (struct Location *Loc,const char *Txt)
|
|||
sprintf (Query,"UPDATE locations SET "
|
||||
"StartTime=FROM_UNIXTIME('%ld'),"
|
||||
"EndTime=FROM_UNIXTIME('%ld'),"
|
||||
"Title='%s',Folder='%s',Txt='%s'"
|
||||
" WHERE LocCod='%ld' AND CrsCod='%ld'",
|
||||
"Title='%s',Txt='%s'"
|
||||
" WHERE LocCod='%ld' AND UsrCod='%ld'",
|
||||
Loc->TimeUTC[Loc_START_TIME],
|
||||
Loc->TimeUTC[Loc_END_TIME ],
|
||||
Loc->Title,
|
||||
Loc->Folder,
|
||||
Txt,
|
||||
Loc->LocCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
Loc->LocCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update location");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Remove all the locations of a course ********************/
|
||||
/******************** Remove all the locations of a user *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Loc_RemoveCrsLocations (long CrsCod)
|
||||
void Loc_RemoveUsrLocations (long UsrCod)
|
||||
{
|
||||
char Query[128];
|
||||
|
||||
/***** Remove locations *****/
|
||||
sprintf (Query,"DELETE FROM locations WHERE CrsCod='%ld'",CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove all the locations of a course");
|
||||
sprintf (Query,"DELETE FROM locations WHERE UsrCod='%ld'",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove all the locations of a user");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Check if I belong to any of the groups of an location ************/
|
||||
/******************* Get number of locations from a user *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Loc_CheckIfIBelongToCrsThisLocation (long LocCod)
|
||||
unsigned Loc_GetNumLocationsFromUsr (long UsrCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_TEACHER)
|
||||
{
|
||||
// Students and teachers can edit locations depending on groups
|
||||
/***** Get if I can edit an location from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM locations"
|
||||
" WHERE LocCod='%ld'",
|
||||
LocCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if I can do an location") != 0);
|
||||
}
|
||||
else
|
||||
return (Gbl.Usrs.Me.LoggedRole > Rol_TEACHER); // Admins can edit locations
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get number of locations in a course *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Loc_GetNumLocationsInCrs (long CrsCod)
|
||||
{
|
||||
char Query[256];
|
||||
char Query[128];
|
||||
|
||||
/***** Get number of locations in a course from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM locations WHERE CrsCod='%ld'",
|
||||
CrsCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of locations in course");
|
||||
sprintf (Query,"SELECT COUNT(*) FROM locations WHERE UsrCod='%ld'",
|
||||
UsrCod);
|
||||
return (unsigned) DB_QueryCOUNT (Query,"can not get number of locations from user");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get number of courses with locations ********************/
|
||||
/******************** Get number of users with locations *********************/
|
||||
/*****************************************************************************/
|
||||
// Returns the number of courses with locations
|
||||
// in this location (all the platform, current degree or current course)
|
||||
// Returns the number of users with locations in a given scope
|
||||
|
||||
unsigned Loc_GetNumCoursesWithLocations (Sco_Scope_t Scope)
|
||||
unsigned Loc_GetNumUsrsWithLocations (Sco_Scope_t Scope)
|
||||
{
|
||||
char Query[1024];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumCourses;
|
||||
unsigned NumUsrs;
|
||||
|
||||
/***** Get number of courses with locations from database *****/
|
||||
switch (Scope)
|
||||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT CrsCod)"
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
|
||||
" FROM locations"
|
||||
" WHERE CrsCod>'0'");
|
||||
" WHERE UsrCod>'0'");
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT locations.CrsCod)"
|
||||
" FROM institutions,centres,degrees,courses,locations"
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT locations.UsrCod)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,locations"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=locations.CrsCod",
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT locations.CrsCod)"
|
||||
" FROM centres,degrees,courses,locations"
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT locations.UsrCod)"
|
||||
" FROM centres,degrees,courses,crs_usr,locations"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=locations.CrsCod",
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT locations.CrsCod)"
|
||||
" FROM degrees,courses,locations"
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT locations.UsrCod)"
|
||||
" FROM degrees,courses,crs_usr,locations"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=locations.CrsCod",
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT locations.CrsCod)"
|
||||
" FROM courses,locations"
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT locations.UsrCod)"
|
||||
" FROM courses,crs_usr,locations"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" AND courses.Status=0"
|
||||
" AND courses.CrsCod=locations.CrsCod",
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT CrsCod)"
|
||||
" FROM locations"
|
||||
" WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(DISTINCT locations.UsrCod)"
|
||||
" FROM crs_usr,locations"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||
break;
|
||||
}
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get number of courses with locations");
|
||||
DB_QuerySELECT (Query,&mysql_res,"can not get number of users with locations");
|
||||
|
||||
/***** Get number of courses *****/
|
||||
/***** Get number of users *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
if (sscanf (row[0],"%u",&NumCourses) != 1)
|
||||
Lay_ShowErrorAndExit ("Error when getting number of courses with locations.");
|
||||
if (sscanf (row[0],"%u",&NumUsrs) != 1)
|
||||
Lay_ShowErrorAndExit ("Error when getting number of users with locations.");
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
return NumCourses;
|
||||
return NumUsrs;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Get number of locations ***************************/
|
||||
/*****************************************************************************/
|
||||
// Returns the number of locations
|
||||
// in this location (all the platform, current degree or current course)
|
||||
// Returns the number of locations in a given scope
|
||||
|
||||
unsigned Loc_GetNumLocations (Sco_Scope_t Scope,unsigned *NumNotif)
|
||||
unsigned Loc_GetNumLocations (Sco_Scope_t Scope)
|
||||
{
|
||||
char Query[1024];
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -1382,48 +1216,53 @@ unsigned Loc_GetNumLocations (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
switch (Scope)
|
||||
{
|
||||
case Sco_SCOPE_SYS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM locations"
|
||||
" WHERE CrsCod>'0'");
|
||||
" WHERE UsrCod>'0'");
|
||||
break;
|
||||
case Sco_SCOPE_CTY:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(locations.NumNotif)"
|
||||
" FROM institutions,centres,degrees,courses,locations"
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM institutions,centres,degrees,courses,crs_usr,locations"
|
||||
" WHERE institutions.CtyCod='%ld'"
|
||||
" AND institutions.InsCod=centres.InsCod"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=locations.CrsCod",
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentCty.Cty.CtyCod);
|
||||
break;
|
||||
case Sco_SCOPE_INS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(locations.NumNotif)"
|
||||
" FROM centres,degrees,courses,locations"
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM centres,degrees,courses,crs_usr,locations"
|
||||
" WHERE centres.InsCod='%ld'"
|
||||
" AND centres.CtrCod=degrees.CtrCod"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=locations.CrsCod",
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentIns.Ins.InsCod);
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(locations.NumNotif)"
|
||||
" FROM degrees,courses,locations"
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM degrees,courses,crs_usr,locations"
|
||||
" WHERE degrees.CtrCod='%ld'"
|
||||
" AND degrees.DegCod=courses.DegCod"
|
||||
" AND courses.CrsCod=locations.CrsCod",
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentCtr.Ctr.CtrCod);
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(locations.NumNotif)"
|
||||
" FROM courses,locations"
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM courses,crs_usr,locations"
|
||||
" WHERE courses.DegCod='%ld'"
|
||||
" AND courses.CrsCod=locations.CrsCod",
|
||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentDeg.Deg.DegCod);
|
||||
break;
|
||||
case Sco_SCOPE_CRS:
|
||||
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM locations"
|
||||
" WHERE CrsCod='%ld'",
|
||||
sprintf (Query,"SELECT COUNT(*)"
|
||||
" FROM crs_usr,locations"
|
||||
" WHERE crs_usr.CrsCod='%ld'"
|
||||
" AND crs_usr.UsrCod=locations.UsrCod",
|
||||
Gbl.CurrentCrs.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
|
@ -1437,15 +1276,6 @@ unsigned Loc_GetNumLocations (Sco_Scope_t Scope,unsigned *NumNotif)
|
|||
if (sscanf (row[0],"%u",&NumLocations) != 1)
|
||||
Lay_ShowErrorAndExit ("Error when getting number of locations.");
|
||||
|
||||
/***** Get number of notifications by email *****/
|
||||
if (row[1])
|
||||
{
|
||||
if (sscanf (row[1],"%u",NumNotif) != 1)
|
||||
Lay_ShowErrorAndExit ("Error when getting number of notifications of locations.");
|
||||
}
|
||||
else
|
||||
*NumNotif = 0;
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
|
|
|
@ -60,12 +60,6 @@ struct Location
|
|||
time_t TimeUTC[Loc_NUM_DATES];
|
||||
bool Open;
|
||||
char Title[Loc_MAX_LENGTH_ASSIGNMENT_TITLE+1];
|
||||
Loc_SendWork_t SendWork;
|
||||
char Folder[Loc_MAX_LENGTH_FOLDER+1];
|
||||
bool IBelongToCrsOrGrps; // I can do this location
|
||||
// (it is associated to no groups
|
||||
// or, if associated to groups,
|
||||
// I belong to any of the groups)
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
@ -87,18 +81,16 @@ void Loc_GetListLocations (void);
|
|||
void Loc_GetDataOfLocationByCod (struct Location *Loc);
|
||||
void Loc_FreeListLocations (void);
|
||||
|
||||
void Loc_GetNotifLocation (char *SummaryStr,char **ContentStr,long LocCod,unsigned MaxChars,bool GetContent);
|
||||
|
||||
long Loc_GetParamLocCod (void);
|
||||
void Loc_AskRemLocation (void);
|
||||
void Loc_RemoveLocation (void);
|
||||
void Loc_HideLocation (void);
|
||||
void Loc_ShowLocation (void);
|
||||
void Loc_RecFormLocation (void);
|
||||
void Loc_RemoveCrsLocations (long CrsCod);
|
||||
unsigned Loc_GetNumLocationsInCrs(long CrsCod);
|
||||
void Loc_RemoveUsrLocations (long UsrCod);
|
||||
unsigned Loc_GetNumLocationsFromUsr (long UsrCod);
|
||||
|
||||
unsigned Loc_GetNumCoursesWithLocations (Sco_Scope_t Scope);
|
||||
unsigned Loc_GetNumLocations (Sco_Scope_t Scope,unsigned *NumNotif);
|
||||
unsigned Loc_GetNumUsrsWithLocations (Sco_Scope_t Scope);
|
||||
unsigned Loc_GetNumLocations (Sco_Scope_t Scope);
|
||||
|
||||
#endif
|
||||
|
|
153
swad_text.c
153
swad_text.c
|
@ -2321,6 +2321,27 @@ const char *Txt_Alphabetic_BR_code_BR_ISO_3166_1 =
|
|||
"Cód.<br />alfabético<br />ISO 3166-1";
|
||||
#endif
|
||||
|
||||
const char *Txt_Already_existed_a_location_with_the_title_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"Ja existia una ubicació amb el títol <strong>%s</strong>.";
|
||||
#elif L==2
|
||||
"Es gibt bereits einen Standort mit dem Namen <strong>%s</strong>.";
|
||||
#elif L==3
|
||||
"Already existed a location with the title <strong>%s</strong>.";
|
||||
#elif L==4
|
||||
"Ya existía una ubicación con el título <strong>%s</strong>.";
|
||||
#elif L==5
|
||||
"Il existe déjà un emplacement du titre <strong>%s</strong>.";
|
||||
#elif L==6
|
||||
"Ya existía una ubicación con el título <strong>%s</strong>."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Esiste già una posizione con il titolo <strong>%s</strong>.";
|
||||
#elif L==8
|
||||
"Istniala juz lokalizację z tytulu <strong>%s</strong>.";
|
||||
#elif L==9
|
||||
"Já existe uma localização com o título <strong>%s</strong>.";
|
||||
#endif
|
||||
|
||||
const char *Txt_Already_existed_an_assignment_with_the_folder_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"Ja existia una activitat amb la carpeta <strong>%s</strong>.";
|
||||
|
@ -9172,6 +9193,27 @@ const char *Txt_Do_you_really_want_to_remove_the_group_X_Y_students_ = // Warnin
|
|||
"Doing so will remove %u students from that group."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_Do_you_really_want_to_remove_the_location_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"¿De veres voleu eliminar la ubicació <strong>%s</strong>?";
|
||||
#elif L==2
|
||||
"Wollen Sie die Standort <strong>%s</strong> wirklich entfernen?";
|
||||
#elif L==3
|
||||
"Do you really want to remove the location <strong>%s</strong>?";
|
||||
#elif L==4
|
||||
"¿Realmente desea eliminar la ubicación <strong>%s</strong>?";
|
||||
#elif L==5
|
||||
"Voulez-vous vraiment supprimer l'emplacement <strong>%s</strong>?";
|
||||
#elif L==6
|
||||
"¿Realmente desea eliminar la ubicación <strong>%s</strong>?"; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Vuoi realmente rimuovere la posizione <strong>%s</strong>?";
|
||||
#elif L==8
|
||||
"Czy na pewno chcesz usunac lokacja <strong>%s</strong>?";
|
||||
#elif L==9
|
||||
"Você realmente deseja remover a localização <strong>%s</strong>?";
|
||||
#endif
|
||||
|
||||
const char *Txt_Do_you_really_want_to_remove_the_photo_of_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"De veres voleu eliminar la foto de <strong>%s</strong>?";
|
||||
|
@ -9780,7 +9822,7 @@ const char *Txt_Edit =
|
|||
|
||||
const char *Txt_Edit_assignment =
|
||||
#if L==1
|
||||
"Editar actividad"; // Necessita traduccio
|
||||
"Editar activitat";
|
||||
#elif L==2
|
||||
"Aufgabe bearbeiten";
|
||||
#elif L==3
|
||||
|
@ -9820,6 +9862,27 @@ const char *Txt_Edit_event =
|
|||
"Editar evento";
|
||||
#endif
|
||||
|
||||
const char *Txt_Edit_location =
|
||||
#if L==1
|
||||
"Editar ubicació";
|
||||
#elif L==2
|
||||
"Aufgabe Standort";
|
||||
#elif L==3
|
||||
"Edit location";
|
||||
#elif L==4
|
||||
"Editar ubicación";
|
||||
#elif L==5
|
||||
"Éditer emplacement";
|
||||
#elif L==6
|
||||
"Editar ubicación"; // Okoteve traducción
|
||||
#elif L==7
|
||||
"Editare posizione";
|
||||
#elif L==8
|
||||
"Edytuj lokacja";
|
||||
#elif L==9
|
||||
"Editar localização";
|
||||
#endif
|
||||
|
||||
const char *Txt_Edit_my_institution =
|
||||
#if L==1
|
||||
"Edita la meva institució";
|
||||
|
@ -17110,6 +17173,48 @@ const char *Txt_Location =
|
|||
"Localização";
|
||||
#endif
|
||||
|
||||
const char *Txt_Location_X_is_now_hidden = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"La ubicació <strong>%s</strong> ara està oculta.";
|
||||
#elif L==2
|
||||
"Die Standort <strong>%s</strong> ist jetzt ausgeblendet.";
|
||||
#elif L==3
|
||||
"Location <strong>%s</strong> is now hidden.";
|
||||
#elif L==4
|
||||
"La ubicación <strong>%s</strong> ahora está oculta.";
|
||||
#elif L==5
|
||||
"L'emplacement <strong>%s</strong> est maintenant cachée.";
|
||||
#elif L==6
|
||||
"La ubicación <strong>%s</strong> ahora está oculta."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"La posizione <strong>%s</strong> è ora nascosta.";
|
||||
#elif L==8
|
||||
"Lokacja <strong>%s</strong> jest ukryte.";
|
||||
#elif L==9
|
||||
"A localização <strong>%s</strong> é agora oculta.";
|
||||
#endif
|
||||
|
||||
const char *Txt_Location_X_is_now_visible = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"La ubicació <strong>%s</strong> ara està visible.";
|
||||
#elif L==2
|
||||
"Die Standort <strong>%s</strong> ist jetzt sichtbar.";
|
||||
#elif L==3
|
||||
"Location <strong>%s</strong> is now visible.";
|
||||
#elif L==4
|
||||
"La ubicación <strong>%s</strong> ahora está visible.";
|
||||
#elif L==5
|
||||
"L'emplacement <strong>%s</strong> est maintenant visible.";
|
||||
#elif L==6
|
||||
"La ubicación <strong>%s</strong> ahora está visible."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"La posizione <strong>%s</strong> è ora visibile.";
|
||||
#elif L==8
|
||||
"Lokacja <strong>%s</strong> jest teraz widoczny.";
|
||||
#elif L==9
|
||||
"A localização <strong>%s</strong> é agora visível.";
|
||||
#endif
|
||||
|
||||
const char *Txt_Location_X_removed = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==1
|
||||
"Ubicació <strong>%s</strong> eliminada.";
|
||||
|
@ -43601,6 +43706,27 @@ const char *Txt_The_list_of_X_users_is_too_large_to_be_displayed = // Warning: i
|
|||
"The list of %u users is too large to be displayed."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_The_location_has_been_modified =
|
||||
#if L==1
|
||||
"La ubicació s'ha modificat.";
|
||||
#elif L==2
|
||||
"Die Standort wurde geändert.";
|
||||
#elif L==3
|
||||
"The location has been modified.";
|
||||
#elif L==4
|
||||
"La ubicación ha sido modificada.";
|
||||
#elif L==5
|
||||
"L'emplacement a été modifié.";
|
||||
#elif L==6
|
||||
"La ubicación ha sido modificada."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"La posizione è stata modificata.";
|
||||
#elif L==8
|
||||
"Lokalizacja została zmodyfikowana.";
|
||||
#elif L==9
|
||||
"A localização foi modificada.";
|
||||
#endif
|
||||
|
||||
const char *Txt_The_lower_limit_of_correct_answers_must_be_less_than_or_equal_to_the_upper_limit =
|
||||
#if L==1
|
||||
"El límite inferior del intervalo de respuestas correctas"
|
||||
|
@ -54301,7 +54427,7 @@ const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_pla
|
|||
|
||||
const char *Txt_You_must_specify_the_title_of_the_assignment =
|
||||
#if L==1
|
||||
"Debe especificar el título de la actividad."; // Necessita traduccio
|
||||
"Cal especificar el títol de l'activitat.";
|
||||
#elif L==2
|
||||
"Die Aufgabe muss angegeben werden.";
|
||||
#elif L==3
|
||||
|
@ -54315,7 +54441,7 @@ const char *Txt_You_must_specify_the_title_of_the_assignment =
|
|||
#elif L==7
|
||||
"È necessario specificare il titolo dell'attività.";
|
||||
#elif L==8
|
||||
"You must specify the title of the assignment."; // Potrzebujesz tlumaczenie
|
||||
"Musisz podać tytuł zadania.";
|
||||
#elif L==9
|
||||
"Você deve especificar o título da atividade.";
|
||||
#endif
|
||||
|
@ -54341,6 +54467,27 @@ const char *Txt_You_must_specify_the_title_of_the_event =
|
|||
"Você deve especificar o título do evento.";
|
||||
#endif
|
||||
|
||||
const char *Txt_You_must_specify_the_title_of_the_location =
|
||||
#if L==1
|
||||
"Cal especificar el títol de la ubicació.";
|
||||
#elif L==2
|
||||
"Sie müssen den Titel des Standorts angeben.";
|
||||
#elif L==3
|
||||
"You must specify the title of the location.";
|
||||
#elif L==4
|
||||
"Debe especificar el título de la ubicación.";
|
||||
#elif L==5
|
||||
"Vous devez spécifier le titre du emplacement.";
|
||||
#elif L==6
|
||||
"Debe especificar el título de la ubicación."; // Okoteve traducción
|
||||
#elif L==7
|
||||
"È necessario specificare il titolo della posizione.";
|
||||
#elif L==8
|
||||
"Musisz podać tytuł lokalizacji.";
|
||||
#elif L==9
|
||||
"Você deve especificar o título da localização.";
|
||||
#endif
|
||||
|
||||
const char *Txt_You_must_specify_the_title_of_the_survey =
|
||||
#if L==1
|
||||
"Debe especificar el título de la encuesta."; // Necessita traduccio
|
||||
|
|
Loading…
Reference in New Issue