Version 17.20.1

This commit is contained in:
Antonio Cañas Vargas 2017-10-07 12:28:19 +02:00
parent 95ebf5b9cd
commit 983e6e0226
4 changed files with 61 additions and 30 deletions

View File

@ -250,17 +250,20 @@
// TODO: Mover PROFILE.Briefcase a FILES.Briefcase en la ayuda de GitHub (aquí ya está cambiado) // TODO: Mover PROFILE.Briefcase a FILES.Briefcase en la ayuda de GitHub (aquí ya está cambiado)
// TODO: Los profesores no editores no deberían recibir notificaciones de solicitudes de inscripción.
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 17.20 (2017-10-06)" #define Log_PLATFORM_VERSION "SWAD 17.20.1 (2017-10-07)"
#define CSS_FILE "swad17.0.css" #define CSS_FILE "swad17.0.css"
#define JS_FILE "swad17.17.1.js" #define JS_FILE "swad17.17.1.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 17.20.1: Oct 07, 2017 Fixed bug in file browser clipboard. (? lines)
Version 17.20: Oct 06, 2017 New file browser for project documents. Not finished. (232915 lines) Version 17.20: Oct 06, 2017 New file browser for project documents. Not finished. (232915 lines)
18 changes necessary in database: 18 changes necessary in database:
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1698','es','N','Subir archivo a docs. proyecto (ant.)'); INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1698','es','N','Subir archivo a docs. proyecto (ant.)');

View File

@ -7071,6 +7071,7 @@ static void Brw_WriteCurrentClipboard (void)
Usr_UsrDataDestructor (&UsrDat); Usr_UsrDataDestructor (&UsrDat);
break; break;
case Brw_ADMI_DOCUM_PRJ: case Brw_ADMI_DOCUM_PRJ:
Prj_AllocMemProject (&Prj);
Prj.PrjCod = Gbl.FileBrowser.Clipboard.Cod; Prj.PrjCod = Gbl.FileBrowser.Clipboard.Cod;
Prj_GetDataOfProjectByCod (&Prj); Prj_GetDataOfProjectByCod (&Prj);
Crs.CrsCod = Prj.CrsCod; Crs.CrsCod = Prj.CrsCod;
@ -7079,6 +7080,7 @@ static void Brw_WriteCurrentClipboard (void)
Txt_project_documents, Txt_project_documents,
Txt_course,Crs.ShrtName, Txt_course,Crs.ShrtName,
Txt_project,Prj.Title); Txt_project,Prj.Title);
Prj_FreeMemProject (&Prj);
break; break;
case Brw_ADMI_MARKS_CRS: case Brw_ADMI_MARKS_CRS:
Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod; Crs.CrsCod = Gbl.FileBrowser.Clipboard.Cod;
@ -7896,7 +7898,7 @@ static void Brw_PasteClipboard (void)
struct Degree Deg; struct Degree Deg;
struct Course Crs; struct Course Crs;
struct GroupData GrpDat; struct GroupData GrpDat;
struct Project Prj; long PrjCod;
char PathOrg[PATH_MAX + 1]; char PathOrg[PATH_MAX + 1];
struct Brw_NumObjects Pasted; struct Brw_NumObjects Pasted;
long FirstFilCod = -1L; // First file code of the first file or link pasted. Important: initialize here to -1L long FirstFilCod = -1L; // First file code of the first file or link pasted. Important: initialize here to -1L
@ -7922,7 +7924,7 @@ static void Brw_PasteClipboard (void)
(unsigned) Ins.InsCod, (unsigned) Ins.InsCod,
Gbl.FileBrowser.Clipboard.Path); Gbl.FileBrowser.Clipboard.Path);
else else
Lay_ShowErrorAndExit ("The institution of copy source does not exist."); Lay_ShowErrorAndExit ("The copy source does not exist.");
break; break;
case Brw_ADMI_DOCUM_CTR: case Brw_ADMI_DOCUM_CTR:
case Brw_ADMI_SHARE_CTR: case Brw_ADMI_SHARE_CTR:
@ -7934,7 +7936,7 @@ static void Brw_PasteClipboard (void)
(unsigned) Ctr.CtrCod, (unsigned) Ctr.CtrCod,
Gbl.FileBrowser.Clipboard.Path); Gbl.FileBrowser.Clipboard.Path);
else else
Lay_ShowErrorAndExit ("The centre of copy source does not exist."); Lay_ShowErrorAndExit ("The copy source does not exist.");
break; break;
case Brw_ADMI_DOCUM_DEG: case Brw_ADMI_DOCUM_DEG:
case Brw_ADMI_SHARE_DEG: case Brw_ADMI_SHARE_DEG:
@ -7946,7 +7948,7 @@ static void Brw_PasteClipboard (void)
(unsigned) Deg.DegCod, (unsigned) Deg.DegCod,
Gbl.FileBrowser.Clipboard.Path); Gbl.FileBrowser.Clipboard.Path);
else else
Lay_ShowErrorAndExit ("The degree of copy source does not exist."); Lay_ShowErrorAndExit ("The copy source does not exist.");
break; break;
case Brw_ADMI_DOCUM_CRS: case Brw_ADMI_DOCUM_CRS:
case Brw_ADMI_TEACH_CRS: case Brw_ADMI_TEACH_CRS:
@ -7958,7 +7960,7 @@ static void Brw_PasteClipboard (void)
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs.CrsCod, Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs.CrsCod,
Gbl.FileBrowser.Clipboard.Path); Gbl.FileBrowser.Clipboard.Path);
else else
Lay_ShowErrorAndExit ("The course of copy source does not exist."); Lay_ShowErrorAndExit ("The copy source does not exist.");
break; break;
case Brw_ADMI_DOCUM_GRP: case Brw_ADMI_DOCUM_GRP:
case Brw_ADMI_TEACH_GRP: case Brw_ADMI_TEACH_GRP:
@ -7973,7 +7975,7 @@ static void Brw_PasteClipboard (void)
GrpDat.GrpCod, GrpDat.GrpCod,
Gbl.FileBrowser.Clipboard.Path); Gbl.FileBrowser.Clipboard.Path);
else else
Lay_ShowErrorAndExit ("The course of copy source does not exist."); Lay_ShowErrorAndExit ("The copy source does not exist.");
break; break;
case Brw_ADMI_ASSIG_USR: case Brw_ADMI_ASSIG_USR:
case Brw_ADMI_WORKS_USR: case Brw_ADMI_WORKS_USR:
@ -7985,25 +7987,19 @@ static void Brw_PasteClipboard (void)
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.FileBrowser.Clipboard.Path); Gbl.FileBrowser.Clipboard.Path);
else else
Lay_ShowErrorAndExit ("The course of copy source does not exist."); Lay_ShowErrorAndExit ("The copy source does not exist.");
break; break;
case Brw_ADMI_DOCUM_PRJ: case Brw_ADMI_DOCUM_PRJ:
Prj.PrjCod = Gbl.FileBrowser.Clipboard.Cod; PrjCod = Gbl.FileBrowser.Clipboard.Cod;
Prj_GetDataOfProjectByCod (&Prj); Crs.CrsCod = Prj_GetCourseOfProject (PrjCod);
if (Prj.PrjCod > 0) if (Crs_GetDataOfCourseByCod (&Crs))
{ sprintf (PathOrg,"%s/%s/%ld/%s/%02u/%ld/%s",
Crs.CrsCod = Prj.CrsCod; Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs.CrsCod,Cfg_FOLDER_PRJ,
if (Crs_GetDataOfCourseByCod (&Crs)) (unsigned) (PrjCod % 100),
sprintf (PathOrg,"%s/%s/%ld/%s/%02u/%ld/%s", PrjCod,
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_CRS,Crs.CrsCod,Cfg_FOLDER_PRJ, Gbl.FileBrowser.Clipboard.Path);
(unsigned) (Prj.PrjCod % 100), else
Prj.PrjCod, Lay_ShowErrorAndExit ("The copy source does not exist.");
Gbl.FileBrowser.Clipboard.Path);
else
Lay_ShowErrorAndExit ("The course of copy source does not exist.");
}
else
Lay_ShowErrorAndExit ("The course of copy source does not exist.");
break; break;
case Brw_ADMI_BRIEF_USR: case Brw_ADMI_BRIEF_USR:
sprintf (PathOrg,"%s/%s", sprintf (PathOrg,"%s/%s",

View File

@ -148,9 +148,6 @@ static void Prj_EditOneProjectTxtArea (const char *Id,
const char *Label,char *TxtField, const char *Label,char *TxtField,
unsigned NumRows); unsigned NumRows);
static void Prj_AllocMemProject (struct Project *Prj);
static void Prj_FreeMemProject (struct Project *Prj);
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);
@ -1786,7 +1783,7 @@ static bool Prj_GetIfIAmTutorInProject (long PrjCod)
sprintf (Query,"SELECT COUNT(*) FROM prj_usr" sprintf (Query,"SELECT COUNT(*) FROM prj_usr"
" WHERE PrjCod=%ld AND RoleInProject=%u AND UsrCod=%ld", " WHERE PrjCod=%ld AND RoleInProject=%u AND UsrCod=%ld",
PrjCod,Prj_ROLE_TUT,Gbl.Usrs.Me.UsrDat.UsrCod); PrjCod,Prj_ROLE_TUT,Gbl.Usrs.Me.UsrDat.UsrCod);
return (bool) (DB_QueryCOUNT (Query,"can not get number of projects in course") != 0); return (bool) (DB_QueryCOUNT (Query,"can not check if I am a tutor in a project") != 0);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1945,6 +1942,37 @@ void Prj_GetListProjects (void)
Gbl.Prjs.LstIsRead = true; Gbl.Prjs.LstIsRead = true;
} }
/*****************************************************************************/
/****************** Check if a project exists in a course ********************/
/*****************************************************************************/
long Prj_GetCourseOfProject (long PrjCod)
{
char Query[128];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
long CrsCod = -1L;
if (PrjCod > 0)
{
/***** Get course code from database *****/
sprintf (Query,"SELECT CrsCod FROM projects WHERE PrjCod=%ld",PrjCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get project course")) // Project found...
{
/* Get row */
row = mysql_fetch_row (mysql_res);
/* Get code of the course (row[0]) */
CrsCod = Str_ConvertStrCodToLongCod (row[0]);
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
return CrsCod;
}
/*****************************************************************************/ /*****************************************************************************/
/********************* Get project data using its code ***********************/ /********************* Get project data using its code ***********************/
/*****************************************************************************/ /*****************************************************************************/
@ -2628,7 +2656,7 @@ static void Prj_EditOneProjectTxtArea (const char *Id,
/*** Allocate memory for those parameters of a project with a lot of text ****/ /*** Allocate memory for those parameters of a project with a lot of text ****/
/*****************************************************************************/ /*****************************************************************************/
static void Prj_AllocMemProject (struct Project *Prj) void Prj_AllocMemProject (struct Project *Prj)
{ {
if ((Prj->Description = malloc (Cns_MAX_BYTES_TEXT + 1)) == NULL) if ((Prj->Description = malloc (Cns_MAX_BYTES_TEXT + 1)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store project."); Lay_ShowErrorAndExit ("Not enough memory to store project.");
@ -2644,7 +2672,7 @@ static void Prj_AllocMemProject (struct Project *Prj)
/****** Free memory of those parameters of a project with a lot of text ******/ /****** Free memory of those parameters of a project with a lot of text ******/
/*****************************************************************************/ /*****************************************************************************/
static void Prj_FreeMemProject (struct Project *Prj) void Prj_FreeMemProject (struct Project *Prj)
{ {
if (Prj->Description) if (Prj->Description)
{ {

View File

@ -136,8 +136,12 @@ void Prj_PutHiddenParamPrjOrder (void);
void Prj_RequestCreatePrj (void); void Prj_RequestCreatePrj (void);
void Prj_RequestEditPrj (void); void Prj_RequestEditPrj (void);
void Prj_AllocMemProject (struct Project *Prj);
void Prj_FreeMemProject (struct Project *Prj);
void Prj_GetListProjects (void); void Prj_GetListProjects (void);
void Prj_GetDataOfProjectByCod (struct Project *Prj); void Prj_GetDataOfProjectByCod (struct Project *Prj);
long Prj_GetCourseOfProject (long PrjCod);
void Prj_FreeListProjects (void); void Prj_FreeListProjects (void);
void Prj_PutParamPrjCod (long PrjCod); void Prj_PutParamPrjCod (long PrjCod);