mirror of https://github.com/acanas/swad-core.git
Version 17.3.5
This commit is contained in:
parent
78961a942d
commit
06341e818d
|
@ -1291,7 +1291,7 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod)
|
||||||
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgPrjAttSvyGam (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
AsgCod,Grp_ASSIGNMENT);
|
AsgCod,Grp_ASSIGNMENT);
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
|
|
|
@ -1213,7 +1213,7 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod)
|
||||||
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgPrjAttSvyGam (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
AttCod,Grp_ATT_EVENT);
|
AttCod,Grp_ATT_EVENT);
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
|
|
|
@ -252,13 +252,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 17.3.4 (2017-09-19)"
|
#define Log_PLATFORM_VERSION "SWAD 17.3.5 (2017-09-19)"
|
||||||
#define CSS_FILE "swad17.0.css"
|
#define CSS_FILE "swad17.0.css"
|
||||||
#define JS_FILE "swad16.206.3.js"
|
#define JS_FILE "swad16.206.3.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 17.3.5: Sep 19, 2017 Removed groups in projects. (229858 lines)
|
||||||
Version 17.3.4: Sep 19, 2017 Changes in edition of projects. (230170 lines)
|
Version 17.3.4: Sep 19, 2017 Changes in edition of projects. (230170 lines)
|
||||||
Version 17.3.3: Sep 19, 2017 Changes in listing of projects. (230169 lines)
|
Version 17.3.3: Sep 19, 2017 Changes in listing of projects. (230169 lines)
|
||||||
Version 17.3.2: Sep 19, 2017 Changes in listing of projects. (230168 lines)
|
Version 17.3.2: Sep 19, 2017 Changes in listing of projects. (230168 lines)
|
||||||
|
|
|
@ -2002,7 +2002,7 @@ static void Gam_ShowLstGrpsToEditGame (long GamCod)
|
||||||
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgPrjAttSvyGam (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
GamCod,Grp_SURVEY);
|
GamCod,Grp_SURVEY);
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
|
|
|
@ -1651,8 +1651,8 @@ static void Grp_WriteHeadingGroups (void)
|
||||||
/********* to edit assignments, attendance events, surveys or games **********/
|
/********* to edit assignments, attendance events, surveys or games **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Grp_ListGrpsToEditAsgPrjAttSvyGam (struct GroupType *GrpTyp,long Cod,
|
void Grp_ListGrpsToEditAsgAttSvyGam (struct GroupType *GrpTyp,long Cod,
|
||||||
Grp_AsgPrjAttSvyGam_t Grp_AsgAttOrSvy)
|
Grp_AsgAttSvyGam_t Grp_AsgAttOrSvy)
|
||||||
{
|
{
|
||||||
struct ListCodGrps LstGrpsIBelong;
|
struct ListCodGrps LstGrpsIBelong;
|
||||||
unsigned NumGrpThisType;
|
unsigned NumGrpThisType;
|
||||||
|
@ -1692,9 +1692,6 @@ void Grp_ListGrpsToEditAsgPrjAttSvyGam (struct GroupType *GrpTyp,long Cod,
|
||||||
case Grp_ASSIGNMENT:
|
case Grp_ASSIGNMENT:
|
||||||
AssociatedToGrp = Asg_CheckIfAsgIsAssociatedToGrp (Cod,Grp->GrpCod);
|
AssociatedToGrp = Asg_CheckIfAsgIsAssociatedToGrp (Cod,Grp->GrpCod);
|
||||||
break;
|
break;
|
||||||
case Grp_PROJECT:
|
|
||||||
AssociatedToGrp = Prj_CheckIfPrjIsAssociatedToGrp (Cod,Grp->GrpCod);
|
|
||||||
break;
|
|
||||||
case Grp_ATT_EVENT:
|
case Grp_ATT_EVENT:
|
||||||
AssociatedToGrp = Att_CheckIfAttEventIsAssociatedToGrp (Cod,Grp->GrpCod);
|
AssociatedToGrp = Att_CheckIfAttEventIsAssociatedToGrp (Cod,Grp->GrpCod);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -124,11 +124,10 @@ typedef enum
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Grp_ASSIGNMENT,
|
Grp_ASSIGNMENT,
|
||||||
Grp_PROJECT,
|
|
||||||
Grp_ATT_EVENT,
|
Grp_ATT_EVENT,
|
||||||
Grp_SURVEY,
|
Grp_SURVEY,
|
||||||
Grp_GAME,
|
Grp_GAME,
|
||||||
} Grp_AsgPrjAttSvyGam_t;
|
} Grp_AsgAttSvyGam_t;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Public prototypes ****************************/
|
/****************************** Public prototypes ****************************/
|
||||||
|
@ -153,8 +152,8 @@ void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGr
|
||||||
unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps);
|
unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGrps);
|
||||||
void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod);
|
void Grp_RemUsrFromAllGrpsInCrs (long UsrCod,long CrsCod);
|
||||||
void Grp_RemUsrFromAllGrps (long UsrCod);
|
void Grp_RemUsrFromAllGrps (long UsrCod);
|
||||||
void Grp_ListGrpsToEditAsgPrjAttSvyGam (struct GroupType *GrpTyp,long Cod,
|
void Grp_ListGrpsToEditAsgAttSvyGam (struct GroupType *GrpTyp,long Cod,
|
||||||
Grp_AsgPrjAttSvyGam_t Grp_AsgOrSvy);
|
Grp_AsgAttSvyGam_t Grp_AsgOrSvy);
|
||||||
|
|
||||||
void Grp_ReqRegisterInGrps (void);
|
void Grp_ReqRegisterInGrps (void);
|
||||||
void Grp_ShowLstGrpsToChgMyGrps (void);
|
void Grp_ShowLstGrpsToChgMyGrps (void);
|
||||||
|
|
366
swad_project.c
366
swad_project.c
|
@ -33,7 +33,6 @@
|
||||||
#include "swad_box.h"
|
#include "swad_box.h"
|
||||||
#include "swad_database.h"
|
#include "swad_database.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
#include "swad_group.h"
|
|
||||||
#include "swad_notification.h"
|
#include "swad_notification.h"
|
||||||
#include "swad_pagination.h"
|
#include "swad_pagination.h"
|
||||||
#include "swad_parameter.h"
|
#include "swad_parameter.h"
|
||||||
|
@ -70,8 +69,6 @@ static bool Prj_CheckIfICanCreateProjects (void);
|
||||||
static void Prj_PutIconsListProjects (void);
|
static void Prj_PutIconsListProjects (void);
|
||||||
static void Prj_PutIconToCreateNewPrj (void);
|
static void Prj_PutIconToCreateNewPrj (void);
|
||||||
static void Prj_PutButtonToCreateNewPrj (void);
|
static void Prj_PutButtonToCreateNewPrj (void);
|
||||||
static void Prj_PutFormToSelectWhichGroupsToShow (void);
|
|
||||||
static void Prj_ParamsWhichGroupsToShow (void);
|
|
||||||
static void Prj_ShowOneProject (struct Project *Prj,bool PrintView);
|
static void Prj_ShowOneProject (struct Project *Prj,bool PrintView);
|
||||||
static void Prj_WritePrjAuthor (struct Project *Prj);
|
static void Prj_WritePrjAuthor (struct Project *Prj);
|
||||||
static void Prj_GetParamPrjOrder (void);
|
static void Prj_GetParamPrjOrder (void);
|
||||||
|
@ -86,14 +83,8 @@ static bool Prj_CheckIfSimilarProjectsExists (const char *Field,const char *Valu
|
||||||
static void Prj_AllocMemProject (struct Project *Prj);
|
static void Prj_AllocMemProject (struct Project *Prj);
|
||||||
static void Prj_FreeMemProject (struct Project *Prj);
|
static void Prj_FreeMemProject (struct Project *Prj);
|
||||||
|
|
||||||
static void Prj_ShowLstGrpsToEditProject (long PrjCod);
|
|
||||||
static void Prj_CreateProject (struct Project *Prj);
|
static void Prj_CreateProject (struct Project *Prj);
|
||||||
static void Prj_UpdateProject (struct Project *Prj);
|
static void Prj_UpdateProject (struct Project *Prj);
|
||||||
static bool Prj_CheckIfPrjIsAssociatedToGrps (long PrjCod);
|
|
||||||
static void Prj_RemoveAllTheGrpsAssociatedToAProject (long PrjCod);
|
|
||||||
static void Prj_CreateGrps (long PrjCod);
|
|
||||||
static void Prj_GetAndWriteNamesOfGrpsAssociatedToPrj (struct Project *Prj);
|
|
||||||
static bool Prj_CheckIfIBelongToCrsOrGrpsThisProject (long PrjCod);
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************************** List all the projects ****************************/
|
/************************** List all the projects ****************************/
|
||||||
|
@ -103,7 +94,6 @@ void Prj_SeeProjects (void)
|
||||||
{
|
{
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Prj_GetParamPrjOrder ();
|
Prj_GetParamPrjOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
|
||||||
Gbl.Prjs.CurrentPage = Pag_GetParamPagNum (Pag_PROJECTS);
|
Gbl.Prjs.CurrentPage = Pag_GetParamPagNum (Pag_PROJECTS);
|
||||||
|
|
||||||
/***** Show all the projects *****/
|
/***** Show all the projects *****/
|
||||||
|
@ -142,10 +132,6 @@ static void Prj_ShowAllProjects (void)
|
||||||
Box_StartBox ("100%",Txt_Projects,Prj_PutIconsListProjects,
|
Box_StartBox ("100%",Txt_Projects,Prj_PutIconsListProjects,
|
||||||
Hlp_ASSESSMENT_Projects,Box_NOT_CLOSABLE);
|
Hlp_ASSESSMENT_Projects,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
/***** Select whether show only my groups or all groups *****/
|
|
||||||
if (Gbl.CurrentCrs.Grps.NumGrps)
|
|
||||||
Prj_PutFormToSelectWhichGroupsToShow ();
|
|
||||||
|
|
||||||
if (Gbl.Prjs.Num)
|
if (Gbl.Prjs.Num)
|
||||||
{
|
{
|
||||||
/***** Allocate memory for the project *****/
|
/***** Allocate memory for the project *****/
|
||||||
|
@ -217,7 +203,6 @@ static void Prj_PutHeadForSeeing (bool PrintView)
|
||||||
if (!PrintView)
|
if (!PrintView)
|
||||||
{
|
{
|
||||||
Act_FormStart (ActSeePrj);
|
Act_FormStart (ActSeePrj);
|
||||||
Grp_PutParamWhichGrps ();
|
|
||||||
Pag_PutHiddenParamPagNum (Pag_PROJECTS,Gbl.Prjs.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_PROJECTS,Gbl.Prjs.CurrentPage);
|
||||||
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
|
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
|
||||||
Act_LinkFormSubmit (Txt_START_END_TIME_HELP[Order],"TIT_TBL",NULL);
|
Act_LinkFormSubmit (Txt_START_END_TIME_HELP[Order],"TIT_TBL",NULL);
|
||||||
|
@ -302,23 +287,6 @@ static void Prj_PutButtonToCreateNewPrj (void)
|
||||||
Act_FormEnd ();
|
Act_FormEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/***************** Put form to select which groups to show *******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Prj_PutFormToSelectWhichGroupsToShow (void)
|
|
||||||
{
|
|
||||||
fprintf (Gbl.F.Out,"<div style=\"display:table; margin:0 auto;\">");
|
|
||||||
Grp_ShowFormToSelWhichGrps (ActSeePrj,Prj_ParamsWhichGroupsToShow);
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Prj_ParamsWhichGroupsToShow (void)
|
|
||||||
{
|
|
||||||
Prj_PutHiddenParamPrjOrder ();
|
|
||||||
Pag_PutHiddenParamPagNum (Pag_PROJECTS,Gbl.Prjs.CurrentPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************** Show print view of one project ***********************/
|
/********************** Show print view of one project ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -466,18 +434,6 @@ static void Prj_ShowOneProject (struct Project *Prj,bool PrintView)
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
/* Groups of the project */
|
|
||||||
fprintf (Gbl.F.Out,"<td colspan=\"2\" class=\"LEFT_TOP");
|
|
||||||
if (!PrintView)
|
|
||||||
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
|
|
||||||
fprintf (Gbl.F.Out,"\">");
|
|
||||||
|
|
||||||
if (Gbl.CurrentCrs.Grps.NumGrps)
|
|
||||||
Prj_GetAndWriteNamesOfGrpsAssociatedToPrj (Prj);
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
|
||||||
"</tr>");
|
|
||||||
|
|
||||||
/* Description of the project */
|
/* Description of the project */
|
||||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||||
Prj->Description,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
Prj->Description,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
|
||||||
|
@ -645,7 +601,6 @@ static void Prj_PutParams (void)
|
||||||
if (Gbl.Prjs.PrjCodToEdit > 0)
|
if (Gbl.Prjs.PrjCodToEdit > 0)
|
||||||
Prj_PutParamPrjCod (Gbl.Prjs.PrjCodToEdit);
|
Prj_PutParamPrjCod (Gbl.Prjs.PrjCodToEdit);
|
||||||
Prj_PutHiddenParamPrjOrder ();
|
Prj_PutHiddenParamPrjOrder ();
|
||||||
Grp_PutParamWhichGrps ();
|
|
||||||
Pag_PutHiddenParamPagNum (Pag_PROJECTS,Gbl.Prjs.CurrentPage);
|
Pag_PutHiddenParamPagNum (Pag_PROJECTS,Gbl.Prjs.CurrentPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,24 +641,11 @@ void Prj_GetListProjects (void)
|
||||||
sprintf (OrderBySubQuery,"EndTime DESC,StartTime DESC,Title DESC");
|
sprintf (OrderBySubQuery,"EndTime DESC,StartTime DESC,Title DESC");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Gbl.CurrentCrs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS)
|
sprintf (Query,"SELECT PrjCod"
|
||||||
sprintf (Query,"SELECT PrjCod"
|
" FROM projects"
|
||||||
" FROM projects"
|
" WHERE CrsCod=%ld%s"
|
||||||
" WHERE CrsCod=%ld%s"
|
" ORDER BY %s",
|
||||||
" AND (PrjCod NOT IN (SELECT PrjCod FROM prj_grp) OR"
|
Gbl.CurrentCrs.Crs.CrsCod,HiddenSubQuery,OrderBySubQuery);
|
||||||
" PrjCod IN (SELECT prj_grp.PrjCod FROM prj_grp,crs_grp_usr"
|
|
||||||
" WHERE crs_grp_usr.UsrCod=%ld AND prj_grp.GrpCod=crs_grp_usr.GrpCod))"
|
|
||||||
" ORDER BY %s",
|
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,
|
|
||||||
HiddenSubQuery,
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
OrderBySubQuery);
|
|
||||||
else // Gbl.CurrentCrs.Grps.WhichGrps == Grp_ALL_GROUPS
|
|
||||||
sprintf (Query,"SELECT PrjCod"
|
|
||||||
" FROM projects"
|
|
||||||
" WHERE CrsCod=%ld%s"
|
|
||||||
" ORDER BY %s",
|
|
||||||
Gbl.CurrentCrs.Crs.CrsCod,HiddenSubQuery,OrderBySubQuery);
|
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get projects");
|
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get projects");
|
||||||
|
|
||||||
if (NumRows) // Projects found...
|
if (NumRows) // Projects found...
|
||||||
|
@ -852,9 +794,6 @@ static void Prj_GetDataOfProject (struct Project *Prj,const char *Query)
|
||||||
/* Get the URL of the project (row[11]) */
|
/* Get the URL of the project (row[11]) */
|
||||||
Str_Copy (Prj->URL,row[11],
|
Str_Copy (Prj->URL,row[11],
|
||||||
Cns_MAX_BYTES_WWW);
|
Cns_MAX_BYTES_WWW);
|
||||||
|
|
||||||
/* Can I do this project? */
|
|
||||||
Prj->IBelongToCrsOrGrps = Prj_CheckIfIBelongToCrsOrGrpsThisProject (Prj->PrjCod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -880,7 +819,6 @@ static void Prj_ResetProject (struct Project *Prj)
|
||||||
Prj->Knowledge[0] = '\0';
|
Prj->Knowledge[0] = '\0';
|
||||||
Prj->Materials[0] = '\0';
|
Prj->Materials[0] = '\0';
|
||||||
Prj->URL[0] = '\0';
|
Prj->URL[0] = '\0';
|
||||||
Prj->IBelongToCrsOrGrps = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -930,7 +868,6 @@ void Prj_ReqRemProject (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Prj_GetParamPrjOrder ();
|
Prj_GetParamPrjOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
|
||||||
Gbl.Prjs.CurrentPage = Pag_GetParamPagNum (Pag_PROJECTS);
|
Gbl.Prjs.CurrentPage = Pag_GetParamPagNum (Pag_PROJECTS);
|
||||||
|
|
||||||
/***** Get project code *****/
|
/***** Get project code *****/
|
||||||
|
@ -969,9 +906,6 @@ void Prj_RemoveProject (void)
|
||||||
/***** Get data of the project from database *****/
|
/***** Get data of the project from database *****/
|
||||||
Prj_GetDataOfProjectByCod (&Prj); // Inside this function, the course is checked to be the current one
|
Prj_GetDataOfProjectByCod (&Prj); // Inside this function, the course is checked to be the current one
|
||||||
|
|
||||||
/***** Remove all the groups of this project *****/
|
|
||||||
Prj_RemoveAllTheGrpsAssociatedToAProject (Prj.PrjCod);
|
|
||||||
|
|
||||||
/***** Remove project *****/
|
/***** Remove project *****/
|
||||||
sprintf (Query,"DELETE FROM projects"
|
sprintf (Query,"DELETE FROM projects"
|
||||||
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
" WHERE PrjCod=%ld AND CrsCod=%ld",
|
||||||
|
@ -1107,7 +1041,6 @@ void Prj_RequestCreatOrEditPrj (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
Prj_GetParamPrjOrder ();
|
Prj_GetParamPrjOrder ();
|
||||||
Grp_GetParamWhichGrps ();
|
|
||||||
Gbl.Prjs.CurrentPage = Pag_GetParamPagNum (Pag_PROJECTS);
|
Gbl.Prjs.CurrentPage = Pag_GetParamPagNum (Pag_PROJECTS);
|
||||||
|
|
||||||
/***** Get the code of the project *****/
|
/***** Get the code of the project *****/
|
||||||
|
@ -1247,9 +1180,6 @@ void Prj_RequestCreatOrEditPrj (void)
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>");
|
"</tr>");
|
||||||
|
|
||||||
/***** Groups *****/
|
|
||||||
Prj_ShowLstGrpsToEditProject (Prj.PrjCod);
|
|
||||||
|
|
||||||
/***** End table, send button and end box *****/
|
/***** End table, send button and end box *****/
|
||||||
if (ItsANewProject)
|
if (ItsANewProject)
|
||||||
Box_EndBoxTableWithButton (Btn_CREATE_BUTTON,Txt_Create_project);
|
Box_EndBoxTableWithButton (Btn_CREATE_BUTTON,Txt_Create_project);
|
||||||
|
@ -1305,66 +1235,6 @@ static void Prj_FreeMemProject (struct Project *Prj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************** Show list of groups to edit and project ******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Prj_ShowLstGrpsToEditProject (long PrjCod)
|
|
||||||
{
|
|
||||||
extern const char *Hlp_USERS_Groups;
|
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
|
||||||
extern const char *Txt_Groups;
|
|
||||||
extern const char *Txt_The_whole_course;
|
|
||||||
unsigned NumGrpTyp;
|
|
||||||
|
|
||||||
/***** Get list of groups types and groups in this course *****/
|
|
||||||
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
|
|
||||||
|
|
||||||
if (Gbl.CurrentCrs.Grps.GrpTypes.Num)
|
|
||||||
{
|
|
||||||
/***** Start box and table *****/
|
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
|
||||||
"<td class=\"%s RIGHT_TOP\">"
|
|
||||||
"%s:"
|
|
||||||
"</td>"
|
|
||||||
"<td class=\"LEFT_TOP\">",
|
|
||||||
The_ClassForm[Gbl.Prefs.Theme],
|
|
||||||
Txt_Groups);
|
|
||||||
Box_StartBoxTable ("100%",NULL,NULL,
|
|
||||||
Hlp_USERS_Groups,Box_NOT_CLOSABLE,0);
|
|
||||||
|
|
||||||
/***** First row: checkbox to select the whole course *****/
|
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
|
||||||
"<td colspan=\"7\" class=\"DAT LEFT_MIDDLE\">"
|
|
||||||
"<label>"
|
|
||||||
"<input type=\"checkbox\" id=\"WholeCrs\" name=\"WholeCrs\" value=\"Y\"");
|
|
||||||
if (!Prj_CheckIfPrjIsAssociatedToGrps (PrjCod))
|
|
||||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
|
||||||
fprintf (Gbl.F.Out," onclick=\"uncheckChildren(this,'GrpCods')\" />"
|
|
||||||
"%s %s"
|
|
||||||
"</label>"
|
|
||||||
"</td>"
|
|
||||||
"</tr>",
|
|
||||||
Txt_The_whole_course,Gbl.CurrentCrs.Crs.ShrtName);
|
|
||||||
|
|
||||||
/***** List the groups for each group type *****/
|
|
||||||
for (NumGrpTyp = 0;
|
|
||||||
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
|
||||||
NumGrpTyp++)
|
|
||||||
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
|
||||||
Grp_ListGrpsToEditAsgPrjAttSvyGam (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
|
||||||
PrjCod,Grp_PROJECT);
|
|
||||||
|
|
||||||
/***** End table and box *****/
|
|
||||||
Box_EndBoxTable ();
|
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
|
||||||
"</tr>");
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Free list of groups types and groups in this course *****/
|
|
||||||
Grp_FreeListGrpTypesAndGrps ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Receive form to create a new project *******************/
|
/******************** Receive form to create a new project *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1440,9 +1310,6 @@ void Prj_RecFormProject (void)
|
||||||
/***** Create a new project or update an existing one *****/
|
/***** Create a new project or update an existing one *****/
|
||||||
if (NewProjectIsCorrect)
|
if (NewProjectIsCorrect)
|
||||||
{
|
{
|
||||||
/* Get groups for this projects */
|
|
||||||
Grp_GetParCodsSeveralGrps ();
|
|
||||||
|
|
||||||
if (ItsANewProject)
|
if (ItsANewProject)
|
||||||
{
|
{
|
||||||
Prj_CreateProject (&Prj); // Add new project to database
|
Prj_CreateProject (&Prj); // Add new project to database
|
||||||
|
@ -1459,9 +1326,6 @@ void Prj_RecFormProject (void)
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_project_has_been_modified);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_project_has_been_modified);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free memory for list of selected groups */
|
|
||||||
Grp_FreeListCodSelectedGrps ();
|
|
||||||
|
|
||||||
/***** Show projects again *****/
|
/***** Show projects again *****/
|
||||||
Prj_SeeProjects ();
|
Prj_SeeProjects ();
|
||||||
}
|
}
|
||||||
|
@ -1505,10 +1369,6 @@ static void Prj_CreateProject (struct Project *Prj)
|
||||||
Prj->Materials,
|
Prj->Materials,
|
||||||
Prj->URL);
|
Prj->URL);
|
||||||
Prj->PrjCod = DB_QueryINSERTandReturnCode (Query,"can not create new project");
|
Prj->PrjCod = DB_QueryINSERTandReturnCode (Query,"can not create new project");
|
||||||
|
|
||||||
/***** Create groups *****/
|
|
||||||
if (Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps)
|
|
||||||
Prj_CreateGrps (Prj->PrjCod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1543,176 +1403,6 @@ static void Prj_UpdateProject (struct Project *Prj)
|
||||||
Prj->URL,
|
Prj->URL,
|
||||||
Prj->PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
Prj->PrjCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||||
DB_QueryUPDATE (Query,"can not update project");
|
DB_QueryUPDATE (Query,"can not update project");
|
||||||
|
|
||||||
/***** Update groups *****/
|
|
||||||
/* Remove old groups */
|
|
||||||
Prj_RemoveAllTheGrpsAssociatedToAProject (Prj->PrjCod);
|
|
||||||
|
|
||||||
/* Create new groups */
|
|
||||||
if (Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps)
|
|
||||||
Prj_CreateGrps (Prj->PrjCod);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************* Check if a project is associated to any group *****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static bool Prj_CheckIfPrjIsAssociatedToGrps (long PrjCod)
|
|
||||||
{
|
|
||||||
char Query[256];
|
|
||||||
|
|
||||||
/***** Get if a project is associated to a group from database *****/
|
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM prj_grp WHERE PrjCod=%ld",
|
|
||||||
PrjCod);
|
|
||||||
return (DB_QueryCOUNT (Query,"can not check if a project is associated to groups") != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************** Check if a project is associated to a group ******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
bool Prj_CheckIfPrjIsAssociatedToGrp (long PrjCod,long GrpCod)
|
|
||||||
{
|
|
||||||
char Query[256];
|
|
||||||
|
|
||||||
/***** Get if a project is associated to a group from database *****/
|
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM prj_grp"
|
|
||||||
" WHERE PrjCod=%ld AND GrpCod=%ld",
|
|
||||||
PrjCod,GrpCod);
|
|
||||||
return (DB_QueryCOUNT (Query,"can not check if a project is associated to a group") != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********************** Remove groups of a project **************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Prj_RemoveAllTheGrpsAssociatedToAProject (long PrjCod)
|
|
||||||
{
|
|
||||||
char Query[256];
|
|
||||||
|
|
||||||
/***** Remove groups of the project *****/
|
|
||||||
sprintf (Query,"DELETE FROM prj_grp WHERE PrjCod=%ld",PrjCod);
|
|
||||||
DB_QueryDELETE (Query,"can not remove the groups associated to a project");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************** Remove one group from all the projects *******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Prj_RemoveGroup (long GrpCod)
|
|
||||||
{
|
|
||||||
char Query[256];
|
|
||||||
|
|
||||||
/***** Remove group from all the projects *****/
|
|
||||||
sprintf (Query,"DELETE FROM prj_grp WHERE GrpCod=%ld",GrpCod);
|
|
||||||
DB_QueryDELETE (Query,"can not remove group from the associations between projects and groups");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************* Remove groups of one type from all the projects ***************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Prj_RemoveGroupsOfType (long GrpTypCod)
|
|
||||||
{
|
|
||||||
char Query[256];
|
|
||||||
|
|
||||||
/***** Remove group from all the projects *****/
|
|
||||||
sprintf (Query,"DELETE FROM prj_grp USING crs_grp,prj_grp"
|
|
||||||
" WHERE crs_grp.GrpTypCod=%ld"
|
|
||||||
" AND crs_grp.GrpCod=prj_grp.GrpCod",
|
|
||||||
GrpTypCod);
|
|
||||||
DB_QueryDELETE (Query,"can not remove groups of a type from the associations between projects and groups");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********************** Create groups of a project **************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Prj_CreateGrps (long PrjCod)
|
|
||||||
{
|
|
||||||
unsigned NumGrpSel;
|
|
||||||
char Query[256];
|
|
||||||
|
|
||||||
/***** Create groups of the project *****/
|
|
||||||
for (NumGrpSel = 0;
|
|
||||||
NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps;
|
|
||||||
NumGrpSel++)
|
|
||||||
{
|
|
||||||
/* Create group */
|
|
||||||
sprintf (Query,"INSERT INTO prj_grp"
|
|
||||||
" (PrjCod,GrpCod)"
|
|
||||||
" VALUES"
|
|
||||||
" (%ld,%ld)",
|
|
||||||
PrjCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
|
||||||
DB_QueryINSERT (Query,"can not associate a group to a project");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********** Get and write the names of the groups of a project **************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Prj_GetAndWriteNamesOfGrpsAssociatedToPrj (struct Project *Prj)
|
|
||||||
{
|
|
||||||
extern const char *Txt_Group;
|
|
||||||
extern const char *Txt_Groups;
|
|
||||||
extern const char *Txt_and;
|
|
||||||
extern const char *Txt_The_whole_course;
|
|
||||||
char Query[512];
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned long NumRow;
|
|
||||||
unsigned long NumRows;
|
|
||||||
|
|
||||||
/***** Get groups associated to a project from database *****/
|
|
||||||
sprintf (Query,"SELECT crs_grp_types.GrpTypName,crs_grp.GrpName"
|
|
||||||
" FROM prj_grp,crs_grp,crs_grp_types"
|
|
||||||
" WHERE prj_grp.PrjCod=%ld"
|
|
||||||
" AND prj_grp.GrpCod=crs_grp.GrpCod"
|
|
||||||
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
|
|
||||||
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
|
|
||||||
Prj->PrjCod);
|
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get groups of a project");
|
|
||||||
|
|
||||||
/***** Write heading *****/
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"%s\">%s: ",
|
|
||||||
Prj->Hidden ? "ASG_GRP_LIGHT" :
|
|
||||||
"ASG_GRP",
|
|
||||||
(NumRows == 1) ? Txt_Group :
|
|
||||||
Txt_Groups);
|
|
||||||
|
|
||||||
/***** Write groups *****/
|
|
||||||
if (NumRows) // Groups found...
|
|
||||||
{
|
|
||||||
/* Get and write the group types and names */
|
|
||||||
for (NumRow = 0;
|
|
||||||
NumRow < NumRows;
|
|
||||||
NumRow++)
|
|
||||||
{
|
|
||||||
/* Get next group */
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
/* Write group type name and group name */
|
|
||||||
fprintf (Gbl.F.Out,"%s %s",row[0],row[1]);
|
|
||||||
|
|
||||||
if (NumRows >= 2)
|
|
||||||
{
|
|
||||||
if (NumRow == NumRows-2)
|
|
||||||
fprintf (Gbl.F.Out," %s ",Txt_and);
|
|
||||||
if (NumRows >= 3)
|
|
||||||
if (NumRow < NumRows-2)
|
|
||||||
fprintf (Gbl.F.Out,", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fprintf (Gbl.F.Out,"%s %s",
|
|
||||||
Txt_The_whole_course,Gbl.CurrentCrs.Crs.ShrtName);
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1723,57 +1413,11 @@ void Prj_RemoveCrsProjects (long CrsCod)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[512];
|
||||||
|
|
||||||
/***** Remove groups *****/
|
|
||||||
sprintf (Query,"DELETE FROM prj_grp USING projects,prj_grp"
|
|
||||||
" WHERE projects.CrsCod=%ld"
|
|
||||||
" AND projects.PrjCod=prj_grp.PrjCod",
|
|
||||||
CrsCod);
|
|
||||||
DB_QueryDELETE (Query,"can not remove all the groups associated to projects of a course");
|
|
||||||
|
|
||||||
/***** Remove projects *****/
|
/***** Remove projects *****/
|
||||||
sprintf (Query,"DELETE FROM projects WHERE CrsCod=%ld",CrsCod);
|
sprintf (Query,"DELETE FROM projects WHERE CrsCod=%ld",CrsCod);
|
||||||
DB_QueryDELETE (Query,"can not remove all the projects of a course");
|
DB_QueryDELETE (Query,"can not remove all the projects of a course");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*********** Check if I belong to any of the groups of a project *************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static bool Prj_CheckIfIBelongToCrsOrGrpsThisProject (long PrjCod)
|
|
||||||
{
|
|
||||||
char Query[512];
|
|
||||||
|
|
||||||
switch (Gbl.Usrs.Me.Role.Logged)
|
|
||||||
{
|
|
||||||
case Rol_STD:
|
|
||||||
case Rol_NET:
|
|
||||||
case Rol_TCH:
|
|
||||||
// Students and teachers can do projects depending on groups
|
|
||||||
/***** Get if I can do a project from database *****/
|
|
||||||
sprintf (Query,"SELECT COUNT(*) FROM projects"
|
|
||||||
" WHERE PrjCod=%ld"
|
|
||||||
" AND "
|
|
||||||
"("
|
|
||||||
"PrjCod NOT IN (SELECT PrjCod FROM prj_grp)" // Project is for the whole course
|
|
||||||
" OR "
|
|
||||||
"PrjCod IN" // Project is for specific groups
|
|
||||||
" (SELECT prj_grp.PrjCod FROM prj_grp,crs_grp_usr"
|
|
||||||
" WHERE crs_grp_usr.UsrCod=%ld"
|
|
||||||
" AND prj_grp.GrpCod=crs_grp_usr.GrpCod)"
|
|
||||||
")",
|
|
||||||
PrjCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
return (DB_QueryCOUNT (Query,"can not check if I can do a project") != 0);
|
|
||||||
case Rol_DEG_ADM:
|
|
||||||
case Rol_CTR_ADM:
|
|
||||||
case Rol_INS_ADM:
|
|
||||||
case Rol_SYS_ADM:
|
|
||||||
// Admins can view projects
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************** Get number of projects in a course *********************/
|
/******************** Get number of projects in a course *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -59,10 +59,6 @@ struct Project
|
||||||
char *Knowledge;
|
char *Knowledge;
|
||||||
char *Materials;
|
char *Materials;
|
||||||
char URL[Cns_MAX_BYTES_WWW + 1];
|
char URL[Cns_MAX_BYTES_WWW + 1];
|
||||||
bool IBelongToCrsOrGrps; // I can do this assignment
|
|
||||||
// (it is associated to no groups
|
|
||||||
// or, if associated to groups,
|
|
||||||
// I belong to any of the groups)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define Prj_ORDER_DEFAULT Dat_START_TIME
|
#define Prj_ORDER_DEFAULT Dat_START_TIME
|
||||||
|
@ -86,9 +82,6 @@ void Prj_RemoveProject (void);
|
||||||
void Prj_HideProject (void);
|
void Prj_HideProject (void);
|
||||||
void Prj_ShowProject (void);
|
void Prj_ShowProject (void);
|
||||||
void Prj_RecFormProject (void);
|
void Prj_RecFormProject (void);
|
||||||
bool Prj_CheckIfPrjIsAssociatedToGrp (long PrjCod,long GrpCod);
|
|
||||||
void Prj_RemoveGroup (long GrpCod);
|
|
||||||
void Prj_RemoveGroupsOfType (long GrpTypCod);
|
|
||||||
void Prj_RemoveCrsProjects (long CrsCod);
|
void Prj_RemoveCrsProjects (long CrsCod);
|
||||||
unsigned Prj_GetNumProjectsInCrs(long CrsCod);
|
unsigned Prj_GetNumProjectsInCrs(long CrsCod);
|
||||||
|
|
||||||
|
|
|
@ -2044,7 +2044,7 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod)
|
||||||
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
|
||||||
NumGrpTyp++)
|
NumGrpTyp++)
|
||||||
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
|
||||||
Grp_ListGrpsToEditAsgPrjAttSvyGam (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp],
|
||||||
SvyCod,Grp_SURVEY);
|
SvyCod,Grp_SURVEY);
|
||||||
|
|
||||||
/***** End table and box *****/
|
/***** End table and box *****/
|
||||||
|
|
Loading…
Reference in New Issue