Version 17.10.4

This commit is contained in:
Antonio Cañas Vargas 2017-09-25 00:33:57 +02:00
parent eb72243b58
commit 6cd32ccf9a
2 changed files with 50 additions and 42 deletions

View File

@ -252,13 +252,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 17.10.3 (2017-09-25)" #define Log_PLATFORM_VERSION "SWAD 17.10.4 (2017-09-25)"
#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.10.4: Sep 25, 2017 Changes in form behaviour when editing a project. (231365 lines)
Version 17.10.3: Sep 25, 2017 Check permission when editing projects. Version 17.10.3: Sep 25, 2017 Check permission when editing projects.
Check permission when removing a user from a project. (231359 lines) Check permission when removing a user from a project. (231359 lines)
Version 17.10.2: Sep 24, 2017 Add users to projects even if they don't belong to course. (231335 lines) Version 17.10.2: Sep 24, 2017 Add users to projects even if they don't belong to course. (231335 lines)

View File

@ -120,6 +120,7 @@ static void Prj_ResetProject (struct Project *Prj);
static void Prj_PutParamPrjCod (long PrjCod); static void Prj_PutParamPrjCod (long PrjCod);
static void Prj_RequestCreatOrEditPrj (long PrjCod); static void Prj_RequestCreatOrEditPrj (long PrjCod);
static void Prj_PutFormProject (struct Project *Prj,bool ItsANewProject);
static void Prj_EditOneProjectTxtArea (const char *Id, static void Prj_EditOneProjectTxtArea (const char *Id,
const char *Label,char *TxtField, const char *Label,char *TxtField,
unsigned NumRows); unsigned NumRows);
@ -1997,27 +1998,8 @@ void Prj_RequestEditPrj (void)
static void Prj_RequestCreatOrEditPrj (long PrjCod) static void Prj_RequestCreatOrEditPrj (long PrjCod)
{ {
extern const char *Hlp_ASSESSMENT_Projects_new_project;
extern const char *Hlp_ASSESSMENT_Projects_edit_project;
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_New_project;
extern const char *Txt_Edit_project;
extern const char *Txt_Project_data;
extern const char *Txt_Title;
extern const char *Txt_Department;
extern const char *Txt_Description;
extern const char *Txt_Required_knowledge;
extern const char *Txt_Required_materials;
extern const char *Txt_URL;
extern const char *Txt_Preassigned_QUESTION;
extern const char *Txt_No;
extern const char *Txt_Yes;
extern const char *Txt_Create_project;
extern const char *Txt_Save;
extern const char *Txt_Project_members;
struct Project Prj; struct Project Prj;
bool ItsANewProject; bool ItsANewProject;
Prj_RoleInProject_t RoleInProject;
/***** Allocate memory for the project *****/ /***** Allocate memory for the project *****/
Prj_AllocMemProject (&Prj); Prj_AllocMemProject (&Prj);
@ -2043,6 +2025,38 @@ static void Prj_RequestCreatOrEditPrj (long PrjCod)
/* Get data of the project from database */ /* Get data of the project from database */
Prj_GetDataOfProjectByCod (&Prj); Prj_GetDataOfProjectByCod (&Prj);
/***** Put form to edit project *****/
Prj_PutFormProject (&Prj,ItsANewProject);
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);
/***** Show current projects, if any *****/
Prj_ShowProjectsInCurrentPage ();
}
static void Prj_PutFormProject (struct Project *Prj,bool ItsANewProject)
{
extern const char *Hlp_ASSESSMENT_Projects_new_project;
extern const char *Hlp_ASSESSMENT_Projects_edit_project;
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_New_project;
extern const char *Txt_Edit_project;
extern const char *Txt_Project_data;
extern const char *Txt_Title;
extern const char *Txt_Department;
extern const char *Txt_Description;
extern const char *Txt_Required_knowledge;
extern const char *Txt_Required_materials;
extern const char *Txt_URL;
extern const char *Txt_Preassigned_QUESTION;
extern const char *Txt_No;
extern const char *Txt_Yes;
extern const char *Txt_Create_project;
extern const char *Txt_Save;
extern const char *Txt_Project_members;
Prj_RoleInProject_t RoleInProject;
/***** Start box and form *****/ /***** Start box and form *****/
if (ItsANewProject) if (ItsANewProject)
{ {
@ -2056,7 +2070,7 @@ static void Prj_RequestCreatOrEditPrj (long PrjCod)
Box_StartBox (NULL,Txt_Edit_project,NULL, Box_StartBox (NULL,Txt_Edit_project,NULL,
Hlp_ASSESSMENT_Projects_edit_project,Box_NOT_CLOSABLE); Hlp_ASSESSMENT_Projects_edit_project,Box_NOT_CLOSABLE);
Act_FormStart (ActChgPrj); Act_FormStart (ActChgPrj);
Gbl.Prjs.PrjCodToEdit = Prj.PrjCod; Gbl.Prjs.PrjCodToEdit = Prj->PrjCod;
} }
Prj_PutParams (); Prj_PutParams ();
@ -2077,10 +2091,10 @@ static void Prj_RequestCreatOrEditPrj (long PrjCod)
"</td>" "</td>"
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme],Txt_Title, The_ClassForm[Gbl.Prefs.Theme],Txt_Title,
Prj_MAX_CHARS_PROJECT_TITLE,Prj.Title); Prj_MAX_CHARS_PROJECT_TITLE,Prj->Title);
/* Project start and end dates */ /* Project start and end dates */
Dat_PutFormStartEndClientLocalDateTimes (Prj.TimeUTC,Dat_FORM_SECONDS_ON); Dat_PutFormStartEndClientLocalDateTimes (Prj->TimeUTC,Dat_FORM_SECONDS_ON);
/* Department */ /* Department */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -2090,22 +2104,22 @@ static void Prj_RequestCreatOrEditPrj (long PrjCod)
"<td class=\"LEFT_MIDDLE\">", "<td class=\"LEFT_MIDDLE\">",
The_ClassForm[Gbl.Prefs.Theme],Txt_Department); The_ClassForm[Gbl.Prefs.Theme],Txt_Department);
Dpt_WriteSelectorDepartment (Gbl.CurrentIns.Ins.InsCod, Dpt_WriteSelectorDepartment (Gbl.CurrentIns.Ins.InsCod,
Prj.DptCod, // Selected department Prj->DptCod, // Selected department
false); // Don't submit on change false); // Don't submit on change
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");
/* Description of the project */ /* Description of the project */
Prj_EditOneProjectTxtArea ("Description",Txt_Description, Prj_EditOneProjectTxtArea ("Description",Txt_Description,
Prj.Description,12); Prj->Description,12);
/* Required knowledge to carry out the project */ /* Required knowledge to carry out the project */
Prj_EditOneProjectTxtArea ("Knowledge",Txt_Required_knowledge, Prj_EditOneProjectTxtArea ("Knowledge",Txt_Required_knowledge,
Prj.Knowledge,4); Prj->Knowledge,4);
/* Required materials to carry out the project */ /* Required materials to carry out the project */
Prj_EditOneProjectTxtArea ("Materials",Txt_Required_materials, Prj_EditOneProjectTxtArea ("Materials",Txt_Required_materials,
Prj.Materials,4); Prj->Materials,4);
/* URL for additional info */ /* URL for additional info */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -2119,7 +2133,7 @@ static void Prj_RequestCreatOrEditPrj (long PrjCod)
"</tr>", "</tr>",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_URL, Txt_URL,
Cns_MAX_CHARS_WWW,Prj.URL); Cns_MAX_CHARS_WWW,Prj->URL);
/* Preassigned? */ /* Preassigned? */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
@ -2132,12 +2146,12 @@ static void Prj_RequestCreatOrEditPrj (long PrjCod)
Txt_Preassigned_QUESTION); Txt_Preassigned_QUESTION);
fprintf (Gbl.F.Out,"<option value=\"N\""); fprintf (Gbl.F.Out,"<option value=\"N\"");
if (Prj.Preassigned == Prj_NOT_PREASSIGNED) if (Prj->Preassigned == Prj_NOT_PREASSIGNED)
fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",Txt_No); fprintf (Gbl.F.Out,">%s</option>",Txt_No);
fprintf (Gbl.F.Out,"<option value=\"Y\""); fprintf (Gbl.F.Out,"<option value=\"Y\"");
if (Prj.Preassigned == Prj_PREASSIGNED) if (Prj->Preassigned == Prj_PREASSIGNED)
fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",Txt_Yes); fprintf (Gbl.F.Out,">%s</option>",Txt_Yes);
@ -2162,18 +2176,12 @@ static void Prj_RequestCreatOrEditPrj (long PrjCod)
for (RoleInProject = Prj_ROLE_STD; for (RoleInProject = Prj_ROLE_STD;
RoleInProject <= Prj_ROLE_EVA; RoleInProject <= Prj_ROLE_EVA;
RoleInProject++) RoleInProject++)
Prj_ShowOneProjectUsrs (&Prj,Prj_EDIT_ONE_PROJECT,RoleInProject); Prj_ShowOneProjectUsrs (Prj,Prj_EDIT_ONE_PROJECT,RoleInProject);
Box_EndBoxTable (); Box_EndBoxTable ();
} }
/***** End box *****/ /***** End box *****/
Box_EndBox (); Box_EndBox ();
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);
/***** Show current projects, if any *****/
Prj_ShowProjectsInCurrentPage ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2334,13 +2342,12 @@ void Prj_RecFormProject (void)
/***** Write success message *****/ /***** Write success message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_project_has_been_modified); Ale_ShowAlert (Ale_SUCCESS,Txt_The_project_has_been_modified);
} }
/***** Show projects again *****/
Prj_SeeProjects ();
} }
else else
// TODO: The form should be filled with partial data, now is always empty Prj_PutFormProject (&Prj,ItsANewProject);
Prj_RequestCreatOrEditPrj (Prj.PrjCod);
/***** Show projects again *****/
Prj_SeeProjects ();
} }
else else
Ale_ShowAlert (Ale_ERROR,"You don't have permission to edit this project."); Ale_ShowAlert (Ale_ERROR,"You don't have permission to edit this project.");