mirror of https://github.com/acanas/swad-core.git
Version 22.89: Apr 01, 2023 New module swad_project_config for projects configuration.
This commit is contained in:
parent
74709e02b3
commit
9eac8bf86d
3
Makefile
3
Makefile
|
@ -79,7 +79,8 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_action_list.o \
|
||||||
swad_place_database.o swad_plugin.o swad_plugin_database.o \
|
swad_place_database.o swad_plugin.o swad_plugin_database.o \
|
||||||
swad_privacy.o swad_process.o swad_profile.o swad_profile_database.o \
|
swad_privacy.o swad_process.o swad_profile.o swad_profile_database.o \
|
||||||
swad_program.o swad_program_database.o swad_program_resource.o \
|
swad_program.o swad_program_database.o swad_program_resource.o \
|
||||||
swad_project.o swad_project_database.o swad_project_resource.o \
|
swad_project.o swad_project_config.o swad_project_database.o \
|
||||||
|
swad_project_resource.o \
|
||||||
swad_question.o swad_question_database.o swad_question_import.o \
|
swad_question.o swad_question_database.o swad_question_import.o \
|
||||||
swad_QR.o \
|
swad_QR.o \
|
||||||
swad_record.o swad_record_database.o swad_report.o \
|
swad_record.o swad_record_database.o swad_report.o \
|
||||||
|
|
|
@ -613,10 +613,10 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] =
|
||||||
[ActUnhAsg ] = { 965,-1,TabUnk,ActSeeAsg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Asg_UnhideAssignment ,NULL},
|
[ActUnhAsg ] = { 965,-1,TabUnk,ActSeeAsg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Asg_UnhideAssignment ,NULL},
|
||||||
[ActReqLnkAsg ] = {1943,-1,TabUnk,ActSeeAsg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,AsgRsc_GetLinkToAssignment ,NULL},
|
[ActReqLnkAsg ] = {1943,-1,TabUnk,ActSeeAsg ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,AsgRsc_GetLinkToAssignment ,NULL},
|
||||||
|
|
||||||
|
[ActCfgPrj ] = {1803,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrjCfg_ShowFormConfig ,NULL},
|
||||||
|
[ActRcvCfgPrj ] = {1804,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,PrjCfg_ReceiveConfig ,NULL},
|
||||||
[ActReqUsrPrj ] = {1805,-1,TabUnk,ActSeePrj ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ListUsrsToSelect ,NULL},
|
[ActReqUsrPrj ] = {1805,-1,TabUnk,ActSeePrj ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ListUsrsToSelect ,NULL},
|
||||||
[ActSeeTblAllPrj ] = {1696,-1,TabUnk,ActSeePrj ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Prj_ShowTableSelectedPrjs ,NULL},
|
[ActSeeTblAllPrj ] = {1696,-1,TabUnk,ActSeePrj ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Prj_ShowTableSelectedPrjs ,NULL},
|
||||||
[ActCfgPrj ] = {1803,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ShowFormConfig ,NULL},
|
|
||||||
[ActRcvCfgPrj ] = {1804,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ReceiveConfigPrj ,NULL},
|
|
||||||
[ActReqLckAllPrj ] = {1775,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ReqLockSelectedPrjsEdition ,NULL},
|
[ActReqLckAllPrj ] = {1775,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ReqLockSelectedPrjsEdition ,NULL},
|
||||||
[ActReqUnlAllPrj ] = {1776,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ReqUnloSelectedPrjsEdition ,NULL},
|
[ActReqUnlAllPrj ] = {1776,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ReqUnloSelectedPrjsEdition ,NULL},
|
||||||
[ActLckAllPrj ] = {1777,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_LockSelectedPrjsEdition ,NULL},
|
[ActLckAllPrj ] = {1777,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_LockSelectedPrjsEdition ,NULL},
|
||||||
|
|
|
@ -540,10 +540,10 @@
|
||||||
#define ActUnhAsg (ActChgCrsTT1stDay + 18)
|
#define ActUnhAsg (ActChgCrsTT1stDay + 18)
|
||||||
#define ActReqLnkAsg (ActChgCrsTT1stDay + 19)
|
#define ActReqLnkAsg (ActChgCrsTT1stDay + 19)
|
||||||
|
|
||||||
#define ActReqUsrPrj (ActChgCrsTT1stDay + 20)
|
#define ActCfgPrj (ActChgCrsTT1stDay + 20)
|
||||||
#define ActSeeTblAllPrj (ActChgCrsTT1stDay + 21)
|
#define ActRcvCfgPrj (ActChgCrsTT1stDay + 21)
|
||||||
#define ActCfgPrj (ActChgCrsTT1stDay + 22)
|
#define ActReqUsrPrj (ActChgCrsTT1stDay + 22)
|
||||||
#define ActRcvCfgPrj (ActChgCrsTT1stDay + 23)
|
#define ActSeeTblAllPrj (ActChgCrsTT1stDay + 23)
|
||||||
#define ActReqLckAllPrj (ActChgCrsTT1stDay + 24)
|
#define ActReqLckAllPrj (ActChgCrsTT1stDay + 24)
|
||||||
#define ActReqUnlAllPrj (ActChgCrsTT1stDay + 25)
|
#define ActReqUnlAllPrj (ActChgCrsTT1stDay + 25)
|
||||||
#define ActLckAllPrj (ActChgCrsTT1stDay + 26)
|
#define ActLckAllPrj (ActChgCrsTT1stDay + 26)
|
||||||
|
|
|
@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr
|
||||||
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
|
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 22.88 (2023-03-31)"
|
#define Log_PLATFORM_VERSION "SWAD 22.89 (2023-04-01)"
|
||||||
#define CSS_FILE "swad22.88.css"
|
#define CSS_FILE "swad22.88.css"
|
||||||
#define JS_FILE "swad22.49.js"
|
#define JS_FILE "swad22.49.js"
|
||||||
/*
|
/*
|
||||||
|
Version 22.89: Apr 01, 2023 New module swad_project_config for projects configuration. (338613 lines)
|
||||||
Version 22.88: Mar 31, 2023 Code refactoring in resources. (338538 lines)
|
Version 22.88: Mar 31, 2023 Code refactoring in resources. (338538 lines)
|
||||||
Version 22.87.1: Mar 31, 2023 Some messages translated. (338610 lines)
|
Version 22.87.1: Mar 31, 2023 Some messages translated. (338610 lines)
|
||||||
Version 22.87: Mar 30, 2023 Code refactoring in select forms. (338607 lines)
|
Version 22.87: Mar 30, 2023 Code refactoring in select forms. (338607 lines)
|
||||||
|
|
162
swad_project.c
162
swad_project.c
|
@ -52,6 +52,7 @@
|
||||||
#include "swad_photo.h"
|
#include "swad_photo.h"
|
||||||
#include "swad_program_resource.h"
|
#include "swad_program_resource.h"
|
||||||
#include "swad_project.h"
|
#include "swad_project.h"
|
||||||
|
#include "swad_project_config.h"
|
||||||
#include "swad_project_database.h"
|
#include "swad_project_database.h"
|
||||||
#include "swad_role.h"
|
#include "swad_role.h"
|
||||||
#include "swad_setting.h"
|
#include "swad_setting.h"
|
||||||
|
@ -196,7 +197,6 @@ static Usr_Who_t Prj_GetParWho (void);
|
||||||
static void Prj_ShowProjectsHead (struct Prj_Projects *Projects);
|
static void Prj_ShowProjectsHead (struct Prj_Projects *Projects);
|
||||||
static void Prj_ShowTableAllProjectsHead (void);
|
static void Prj_ShowTableAllProjectsHead (void);
|
||||||
static bool Prj_CheckIfICanCreateProjects (void);
|
static bool Prj_CheckIfICanCreateProjects (void);
|
||||||
static void Prj_PutIconsListProjects (void *Projects);
|
|
||||||
static void Prj_PutIconToCreateNewPrj (struct Prj_Projects *Projects);
|
static void Prj_PutIconToCreateNewPrj (struct Prj_Projects *Projects);
|
||||||
static void Prj_PutButtonToCreateNewPrj (struct Prj_Projects *Projects);
|
static void Prj_PutButtonToCreateNewPrj (struct Prj_Projects *Projects);
|
||||||
static void Prj_PutIconToShowAllData (struct Prj_Projects *Projects);
|
static void Prj_PutIconToShowAllData (struct Prj_Projects *Projects);
|
||||||
|
@ -295,11 +295,6 @@ static void Prj_EditOneProjectTxtArea (const char *Id,
|
||||||
static void Prj_CreateProject (struct Prj_Project *Prj);
|
static void Prj_CreateProject (struct Prj_Project *Prj);
|
||||||
static void Prj_UpdateProject (struct Prj_Project *Prj);
|
static void Prj_UpdateProject (struct Prj_Project *Prj);
|
||||||
|
|
||||||
static bool Prj_CheckIfICanConfigAllProjects (void);
|
|
||||||
static void Prj_GetCrsPrjsConfig (struct Prj_Projects *Projects);
|
|
||||||
static void Prj_GetConfigDataFromRow (MYSQL_RES *mysql_res,
|
|
||||||
struct Prj_Projects *Projects);
|
|
||||||
static bool Prj_GetEditableFromForm (void);
|
|
||||||
static void Prj_PutIconsToLockUnlockAllProjects (struct Prj_Projects *Projects);
|
static void Prj_PutIconsToLockUnlockAllProjects (struct Prj_Projects *Projects);
|
||||||
|
|
||||||
static void Prj_FormLockUnlock (const struct Prj_Project *Prj);
|
static void Prj_FormLockUnlock (const struct Prj_Project *Prj);
|
||||||
|
@ -328,7 +323,7 @@ long Prj_GetPrjCod (void)
|
||||||
|
|
||||||
void Prj_ResetProjects (struct Prj_Projects *Projects)
|
void Prj_ResetProjects (struct Prj_Projects *Projects)
|
||||||
{
|
{
|
||||||
Projects->Config.Editable = Prj_EDITABLE_DEFAULT;
|
Projects->Config.Editable = PrjCfg_EDITABLE_DEFAULT;
|
||||||
Projects->Filter.Who = Prj_FILTER_WHO_DEFAULT;
|
Projects->Filter.Who = Prj_FILTER_WHO_DEFAULT;
|
||||||
Projects->Filter.Assign = Prj_FILTER_ASSIGNED_DEFAULT |
|
Projects->Filter.Assign = Prj_FILTER_ASSIGNED_DEFAULT |
|
||||||
Prj_FILTER_NONASSIG_DEFAULT;
|
Prj_FILTER_NONASSIG_DEFAULT;
|
||||||
|
@ -1239,13 +1234,13 @@ static bool Prj_CheckIfICanCreateProjects (void)
|
||||||
/***************** Put contextual icons in list of projects ******************/
|
/***************** Put contextual icons in list of projects ******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Prj_PutIconsListProjects (void *Projects)
|
void Prj_PutIconsListProjects (void *Projects)
|
||||||
{
|
{
|
||||||
bool ICanConfigAllProjects;
|
bool ICanConfigAllProjects;
|
||||||
|
|
||||||
if (Projects)
|
if (Projects)
|
||||||
{
|
{
|
||||||
ICanConfigAllProjects = Prj_CheckIfICanConfigAllProjects ();
|
ICanConfigAllProjects = PrjCfg_CheckIfICanConfig ();
|
||||||
|
|
||||||
/***** Put icon to create a new project *****/
|
/***** Put icon to create a new project *****/
|
||||||
if (Prj_CheckIfICanCreateProjects ())
|
if (Prj_CheckIfICanCreateProjects ())
|
||||||
|
@ -3206,7 +3201,7 @@ static void Prj_PutIconsToRemEditOnePrj (struct Prj_Projects *Projects,
|
||||||
Prj_PutCurrentPars,Projects);
|
Prj_PutCurrentPars,Projects);
|
||||||
|
|
||||||
/***** Locked/unlocked project edition *****/
|
/***** Locked/unlocked project edition *****/
|
||||||
if (Prj_CheckIfICanConfigAllProjects ())
|
if (PrjCfg_CheckIfICanConfig ())
|
||||||
{
|
{
|
||||||
/* Icon to lock/unlock project edition */
|
/* Icon to lock/unlock project edition */
|
||||||
HTM_DIV_Begin ("id=\"prj_lck_%ld\" class=\"PRJ_LOCK\"",
|
HTM_DIV_Begin ("id=\"prj_lck_%ld\" class=\"PRJ_LOCK\"",
|
||||||
|
@ -4150,145 +4145,6 @@ static void Prj_UpdateProject (struct Prj_Project *Prj)
|
||||||
Prj_DB_UpdateProject (Prj);
|
Prj_DB_UpdateProject (Prj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************************ Can I configure all projects? **********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static bool Prj_CheckIfICanConfigAllProjects (void)
|
|
||||||
{
|
|
||||||
static const bool ICanConfigAllProjects[Rol_NUM_ROLES] =
|
|
||||||
{
|
|
||||||
[Rol_TCH ] = true,
|
|
||||||
[Rol_SYS_ADM] = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
return ICanConfigAllProjects[Gbl.Usrs.Me.Role.Logged];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/********************** Configuration of all projects ************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Prj_ShowFormConfig (void)
|
|
||||||
{
|
|
||||||
extern const char *Hlp_ASSESSMENT_Projects;
|
|
||||||
extern const char *Txt_Configure_projects;
|
|
||||||
extern const char *Txt_Editable;
|
|
||||||
extern const char *Txt_Editable_by_non_editing_teachers;
|
|
||||||
extern const char *Txt_Save_changes;
|
|
||||||
struct Prj_Projects Projects;
|
|
||||||
|
|
||||||
/***** Reset projects *****/
|
|
||||||
Prj_ResetProjects (&Projects);
|
|
||||||
|
|
||||||
/***** Read projects configuration from database *****/
|
|
||||||
Prj_GetCrsPrjsConfig (&Projects);
|
|
||||||
|
|
||||||
/***** Begin box *****/
|
|
||||||
Box_BoxBegin (NULL,Txt_Configure_projects,
|
|
||||||
Prj_PutIconsListProjects,&Projects,
|
|
||||||
Hlp_ASSESSMENT_Projects,Box_NOT_CLOSABLE);
|
|
||||||
|
|
||||||
/***** Begin form *****/
|
|
||||||
Frm_BeginForm (ActRcvCfgPrj);
|
|
||||||
|
|
||||||
/***** Projects are editable by non-editing teachers? *****/
|
|
||||||
HTM_TABLE_BeginCenterPadding (2);
|
|
||||||
HTM_TR_Begin (NULL);
|
|
||||||
|
|
||||||
/* Label */
|
|
||||||
Frm_LabelColumn ("RT","Editable",Txt_Editable);
|
|
||||||
|
|
||||||
/* Data */
|
|
||||||
HTM_TD_Begin ("class=\"LT\"");
|
|
||||||
HTM_INPUT_CHECKBOX ("Editable",HTM_DONT_SUBMIT_ON_CHANGE,
|
|
||||||
"id=\"Editable\" value=\"Y\"%s",
|
|
||||||
Projects.Config.Editable ? " checked=\"checked\"" :
|
|
||||||
"");
|
|
||||||
HTM_Txt (Txt_Editable_by_non_editing_teachers);
|
|
||||||
HTM_TD_End ();
|
|
||||||
|
|
||||||
HTM_TR_End ();
|
|
||||||
HTM_TABLE_End ();
|
|
||||||
|
|
||||||
/***** Send button *****/
|
|
||||||
Btn_PutConfirmButton (Txt_Save_changes);
|
|
||||||
|
|
||||||
/***** End form *****/
|
|
||||||
Frm_EndForm ();
|
|
||||||
|
|
||||||
/***** End box *****/
|
|
||||||
Box_BoxEnd ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************** Get configuration of projects for current course *************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Prj_GetCrsPrjsConfig (struct Prj_Projects *Projects)
|
|
||||||
{
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
|
|
||||||
/***** Get configuration of projects for current course from database *****/
|
|
||||||
if (Prj_DB_GetCrsPrjsConfig (&mysql_res))
|
|
||||||
Prj_GetConfigDataFromRow (mysql_res,Projects);
|
|
||||||
else
|
|
||||||
Projects->Config.Editable = Prj_EDITABLE_DEFAULT;
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Get configuration values from a database table row *************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Prj_GetConfigDataFromRow (MYSQL_RES *mysql_res,
|
|
||||||
struct Prj_Projects *Projects)
|
|
||||||
{
|
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
/***** Get row *****/
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
/***** Get whether project are visible via plugins or not *****/
|
|
||||||
Projects->Config.Editable = (row[0][0] == 'Y');
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Receive configuration of projects for current course ***********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Prj_ReceiveConfigPrj (void)
|
|
||||||
{
|
|
||||||
extern const char *Txt_The_configuration_of_the_projects_has_been_updated;
|
|
||||||
struct Prj_Projects Projects;
|
|
||||||
|
|
||||||
/***** Reset projects *****/
|
|
||||||
Prj_ResetProjects (&Projects);
|
|
||||||
|
|
||||||
/***** Get whether projects are editable by non-editing teachers or not *****/
|
|
||||||
Projects.Config.Editable = Prj_GetEditableFromForm ();
|
|
||||||
|
|
||||||
/***** Update database *****/
|
|
||||||
Prj_DB_UpdateCrsPrjsConfig (Projects.Config.Editable);
|
|
||||||
|
|
||||||
/***** Show confirmation message *****/
|
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_configuration_of_the_projects_has_been_updated);
|
|
||||||
|
|
||||||
/***** Show again the form to configure projects *****/
|
|
||||||
Prj_ShowFormConfig ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****** Get if projects are editable by non-editing teachers from form *******/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static bool Prj_GetEditableFromForm (void)
|
|
||||||
{
|
|
||||||
return Par_GetParBool ("Editable");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****** Put icons to request locking/unlocking edition of all projects *******/
|
/****** Put icons to request locking/unlocking edition of all projects *******/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4324,7 +4180,7 @@ void Prj_ReqLockSelectedPrjsEdition (void)
|
||||||
Prj_GetPars (&Projects);
|
Prj_GetPars (&Projects);
|
||||||
|
|
||||||
/***** Show question and button to lock all selected projects *****/
|
/***** Show question and button to lock all selected projects *****/
|
||||||
if (Prj_CheckIfICanConfigAllProjects ())
|
if (PrjCfg_CheckIfICanConfig ())
|
||||||
{
|
{
|
||||||
/* Get list of projects */
|
/* Get list of projects */
|
||||||
Prj_GetListProjects (&Projects);
|
Prj_GetListProjects (&Projects);
|
||||||
|
@ -4363,7 +4219,7 @@ void Prj_ReqUnloSelectedPrjsEdition (void)
|
||||||
Prj_GetPars (&Projects);
|
Prj_GetPars (&Projects);
|
||||||
|
|
||||||
/***** Show question and button to unlock all selected projects *****/
|
/***** Show question and button to unlock all selected projects *****/
|
||||||
if (Prj_CheckIfICanConfigAllProjects ())
|
if (PrjCfg_CheckIfICanConfig ())
|
||||||
{
|
{
|
||||||
/* Get list of projects */
|
/* Get list of projects */
|
||||||
Prj_GetListProjects (&Projects);
|
Prj_GetListProjects (&Projects);
|
||||||
|
@ -4405,7 +4261,7 @@ void Prj_LockSelectedPrjsEdition (void)
|
||||||
Prj_GetPars (&Projects);
|
Prj_GetPars (&Projects);
|
||||||
|
|
||||||
/***** Lock all selected projects *****/
|
/***** Lock all selected projects *****/
|
||||||
if (Prj_CheckIfICanConfigAllProjects ())
|
if (PrjCfg_CheckIfICanConfig ())
|
||||||
{
|
{
|
||||||
/* Get list of projects */
|
/* Get list of projects */
|
||||||
Prj_GetListProjects (&Projects);
|
Prj_GetListProjects (&Projects);
|
||||||
|
@ -4442,7 +4298,7 @@ void Prj_UnloSelectedPrjsEdition (void)
|
||||||
Prj_GetPars (&Projects);
|
Prj_GetPars (&Projects);
|
||||||
|
|
||||||
/***** Unlock all selected projects *****/
|
/***** Unlock all selected projects *****/
|
||||||
if (Prj_CheckIfICanConfigAllProjects ())
|
if (PrjCfg_CheckIfICanConfig ())
|
||||||
{
|
{
|
||||||
/* Get list of projects */
|
/* Get list of projects */
|
||||||
Prj_GetListProjects (&Projects);
|
Prj_GetListProjects (&Projects);
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/***** Configuration *****/
|
/***** Configuration *****/
|
||||||
#define Prj_EDITABLE_DEFAULT true
|
#define PrjCfg_EDITABLE_DEFAULT true
|
||||||
|
|
||||||
/***** Filters to list projects *****/
|
/***** Filters to list projects *****/
|
||||||
/* Whose projects */
|
/* Whose projects */
|
||||||
|
@ -222,6 +222,8 @@ void Prj_PutPars (struct Prj_Filter *Filter,
|
||||||
long PrjCod);
|
long PrjCod);
|
||||||
void Prj_GetPars (struct Prj_Projects *Projects);
|
void Prj_GetPars (struct Prj_Projects *Projects);
|
||||||
|
|
||||||
|
void Prj_PutIconsListProjects (void *Projects);
|
||||||
|
|
||||||
void Prj_ShowOneProject (void);
|
void Prj_ShowOneProject (void);
|
||||||
void Prj_ShowOneProjectWithFileBrowser (struct Prj_Projects *Projects);
|
void Prj_ShowOneProjectWithFileBrowser (struct Prj_Projects *Projects);
|
||||||
|
|
||||||
|
@ -262,8 +264,8 @@ void Prj_UnhideProject (void);
|
||||||
|
|
||||||
void Prj_ReceiveFormProject (void);
|
void Prj_ReceiveFormProject (void);
|
||||||
|
|
||||||
void Prj_ShowFormConfig (void);
|
void PrjCfg_ShowFormConfig (void);
|
||||||
void Prj_ReceiveConfigPrj (void);
|
void PrjCfg_ReceiveConfig (void);
|
||||||
void Prj_ReqLockSelectedPrjsEdition (void);
|
void Prj_ReqLockSelectedPrjsEdition (void);
|
||||||
void Prj_ReqUnloSelectedPrjsEdition (void);
|
void Prj_ReqUnloSelectedPrjsEdition (void);
|
||||||
void Prj_LockSelectedPrjsEdition (void);
|
void Prj_LockSelectedPrjsEdition (void);
|
||||||
|
|
|
@ -0,0 +1,192 @@
|
||||||
|
// swad_project_config.c: projects configuration
|
||||||
|
/*
|
||||||
|
SWAD (Shared Workspace At a Distance),
|
||||||
|
is a web platform developed at the University of Granada (Spain),
|
||||||
|
and used to support university teaching.
|
||||||
|
|
||||||
|
This file is part of SWAD core.
|
||||||
|
Copyright (C) 1999-2023 Antonio Cañas Vargas
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************************* Headers ***********************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdbool.h> // For boolean type
|
||||||
|
|
||||||
|
#include "swad_action_list.h"
|
||||||
|
#include "swad_alert.h"
|
||||||
|
#include "swad_box.h"
|
||||||
|
#include "swad_database.h"
|
||||||
|
#include "swad_form.h"
|
||||||
|
#include "swad_global.h"
|
||||||
|
#include "swad_parameter.h"
|
||||||
|
#include "swad_project.h"
|
||||||
|
#include "swad_project_config.h"
|
||||||
|
#include "swad_project_database.h"
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************** External global variables from others modules ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
extern struct Globals Gbl;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Private prototypes ****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void PrjCfg_GetCrsPrjsConfig (struct Prj_Projects *Projects);
|
||||||
|
static void PrjCfg_GetConfigDataFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Prj_Projects *Projects);
|
||||||
|
static bool PrjCfg_GetEditableFromForm (void);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************ Can I configure all projects? **********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
bool PrjCfg_CheckIfICanConfig (void)
|
||||||
|
{
|
||||||
|
static const bool ICanConfigAllProjects[Rol_NUM_ROLES] =
|
||||||
|
{
|
||||||
|
[Rol_TCH ] = true,
|
||||||
|
[Rol_SYS_ADM] = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
return ICanConfigAllProjects[Gbl.Usrs.Me.Role.Logged];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************** Configuration of all projects ************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void PrjCfg_ShowFormConfig (void)
|
||||||
|
{
|
||||||
|
extern const char *Hlp_ASSESSMENT_Projects;
|
||||||
|
extern const char *Txt_Configure_projects;
|
||||||
|
extern const char *Txt_Editable;
|
||||||
|
extern const char *Txt_Editable_by_non_editing_teachers;
|
||||||
|
extern const char *Txt_Save_changes;
|
||||||
|
struct Prj_Projects Projects;
|
||||||
|
|
||||||
|
/***** Reset projects *****/
|
||||||
|
Prj_ResetProjects (&Projects);
|
||||||
|
|
||||||
|
/***** Read projects configuration from database *****/
|
||||||
|
PrjCfg_GetCrsPrjsConfig (&Projects);
|
||||||
|
|
||||||
|
/***** Begin box *****/
|
||||||
|
Box_BoxBegin (NULL,Txt_Configure_projects,
|
||||||
|
Prj_PutIconsListProjects,&Projects,
|
||||||
|
Hlp_ASSESSMENT_Projects,Box_NOT_CLOSABLE);
|
||||||
|
|
||||||
|
/***** Begin form *****/
|
||||||
|
Frm_BeginForm (ActRcvCfgPrj);
|
||||||
|
|
||||||
|
/***** Projects are editable by non-editing teachers? *****/
|
||||||
|
HTM_TABLE_BeginCenterPadding (2);
|
||||||
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
/* Label */
|
||||||
|
Frm_LabelColumn ("RT","Editable",Txt_Editable);
|
||||||
|
|
||||||
|
/* Data */
|
||||||
|
HTM_TD_Begin ("class=\"LT\"");
|
||||||
|
HTM_INPUT_CHECKBOX ("Editable",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||||
|
"id=\"Editable\" value=\"Y\"%s",
|
||||||
|
Projects.Config.Editable ? " checked=\"checked\"" :
|
||||||
|
"");
|
||||||
|
HTM_Txt (Txt_Editable_by_non_editing_teachers);
|
||||||
|
HTM_TD_End ();
|
||||||
|
|
||||||
|
HTM_TR_End ();
|
||||||
|
HTM_TABLE_End ();
|
||||||
|
|
||||||
|
/***** Send button *****/
|
||||||
|
Btn_PutConfirmButton (Txt_Save_changes);
|
||||||
|
|
||||||
|
/***** End form *****/
|
||||||
|
Frm_EndForm ();
|
||||||
|
|
||||||
|
/***** End box *****/
|
||||||
|
Box_BoxEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************** Get configuration of projects for current course *************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void PrjCfg_GetCrsPrjsConfig (struct Prj_Projects *Projects)
|
||||||
|
{
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
|
||||||
|
/***** Get configuration of projects for current course from database *****/
|
||||||
|
if (Prj_DB_GetCrsPrjsConfig (&mysql_res))
|
||||||
|
PrjCfg_GetConfigDataFromRow (mysql_res,Projects);
|
||||||
|
else
|
||||||
|
Projects->Config.Editable = PrjCfg_EDITABLE_DEFAULT;
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Get configuration values from a database table row *************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void PrjCfg_GetConfigDataFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Prj_Projects *Projects)
|
||||||
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
/***** Get row *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
|
/***** Get whether project are visible via plugins or not *****/
|
||||||
|
Projects->Config.Editable = (row[0][0] == 'Y');
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Receive configuration of projects for current course ***********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void PrjCfg_ReceiveConfig (void)
|
||||||
|
{
|
||||||
|
extern const char *Txt_The_configuration_of_the_projects_has_been_updated;
|
||||||
|
struct Prj_Projects Projects;
|
||||||
|
|
||||||
|
/***** Reset projects *****/
|
||||||
|
Prj_ResetProjects (&Projects);
|
||||||
|
|
||||||
|
/***** Get whether projects are editable by non-editing teachers or not *****/
|
||||||
|
Projects.Config.Editable = PrjCfg_GetEditableFromForm ();
|
||||||
|
|
||||||
|
/***** Update database *****/
|
||||||
|
Prj_DB_UpdateCrsPrjsConfig (Projects.Config.Editable);
|
||||||
|
|
||||||
|
/***** Show confirmation message *****/
|
||||||
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_configuration_of_the_projects_has_been_updated);
|
||||||
|
|
||||||
|
/***** Show again the form to configure projects *****/
|
||||||
|
PrjCfg_ShowFormConfig ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/****** Get if projects are editable by non-editing teachers from form *******/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static bool PrjCfg_GetEditableFromForm (void)
|
||||||
|
{
|
||||||
|
return Par_GetParBool ("Editable");
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
// swad_project_config.h: projects configuration
|
||||||
|
|
||||||
|
#ifndef _SWAD_PRJ_CFG
|
||||||
|
#define _SWAD_PRJ_CFG
|
||||||
|
/*
|
||||||
|
SWAD (Shared Workspace At a Distance),
|
||||||
|
is a web platform developed at the University of Granada (Spain),
|
||||||
|
and used to support university teaching.
|
||||||
|
|
||||||
|
This file is part of SWAD core.
|
||||||
|
Copyright (C) 1999-2023 Antonio Cañas Vargas
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************************* Headers ***********************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************** Public types and constants ***********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/***** Configuration *****/
|
||||||
|
#define PrjCfg_EDITABLE_DEFAULT true
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***************************** Public prototypes *****************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
bool PrjCfg_CheckIfICanConfig (void);
|
||||||
|
|
||||||
|
void PrjCfg_ShowFormConfig (void);
|
||||||
|
void PrjCfg_ReceiveConfig (void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -34,6 +34,7 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Prj_DB_UpdateCrsPrjsConfig (bool Editable);
|
void Prj_DB_UpdateCrsPrjsConfig (bool Editable);
|
||||||
|
|
||||||
void Prj_DB_LockProjectEdition (long PrjCod);
|
void Prj_DB_LockProjectEdition (long PrjCod);
|
||||||
void Prj_DB_UnlockProjectEdition (long PrjCod);
|
void Prj_DB_UnlockProjectEdition (long PrjCod);
|
||||||
long Prj_DB_CreateProject (const struct Prj_Project *Prj);
|
long Prj_DB_CreateProject (const struct Prj_Project *Prj);
|
||||||
|
|
|
@ -9375,29 +9375,75 @@ const char *Txt_Actions[ActLst_NUM_ACTIONS] =
|
||||||
"Copy link to assignment" // Precisa de tradução
|
"Copy link to assignment" // Precisa de tradução
|
||||||
#elif L==10 // tr
|
#elif L==10 // tr
|
||||||
"Copy link to assignment" // Çeviri lazim!
|
"Copy link to assignment" // Çeviri lazim!
|
||||||
|
#endif
|
||||||
|
,
|
||||||
|
[ActCfgPrj] =
|
||||||
|
#if L==1 // ca
|
||||||
|
"Configurar tots els projectes"
|
||||||
|
#elif L==2 // de
|
||||||
|
"Konfigurieren Sie alle Projekte"
|
||||||
|
#elif L==3 // en
|
||||||
|
"Configure all projects"
|
||||||
|
#elif L==4 // es
|
||||||
|
"Configurar todos los proyectos"
|
||||||
|
#elif L==5 // fr
|
||||||
|
"Configurer tous les projets"
|
||||||
|
#elif L==6 // gn
|
||||||
|
"Emohenda opaite tembiaporã"
|
||||||
|
#elif L==7 // it
|
||||||
|
"Configurare tutti i progetti"
|
||||||
|
#elif L==8 // pl
|
||||||
|
"Skonfigurować wszystkie projekty"
|
||||||
|
#elif L==9 // pt
|
||||||
|
"Configurar todos os projetos"
|
||||||
|
#elif L==10 // tr
|
||||||
|
"Tüm projeleri yapılandırın"
|
||||||
|
#endif
|
||||||
|
,
|
||||||
|
[ActRcvCfgPrj] =
|
||||||
|
#if L==1 // ca
|
||||||
|
"Canviar configuració de tots els projectes"
|
||||||
|
#elif L==2 // de
|
||||||
|
"Ändern Sie die Einstellungen für alle Projekte"
|
||||||
|
#elif L==3 // en
|
||||||
|
"Change configuration of all projects"
|
||||||
|
#elif L==4 // es
|
||||||
|
"Cambiar configuración de todos los proyectos"
|
||||||
|
#elif L==5 // fr
|
||||||
|
"Modifier la configuration de tous les projets"
|
||||||
|
#elif L==6 // gn
|
||||||
|
"Emoambue ñemboheko opaite tembiaporãme >ilde;uarã"
|
||||||
|
#elif L==7 // it
|
||||||
|
"Modificare la configurazione di tutti i progetti"
|
||||||
|
#elif L==8 // pl
|
||||||
|
"Zmień konfigurację wszystkich projektów"
|
||||||
|
#elif L==9 // pt
|
||||||
|
"Alterar a configuração de todos os projetos"
|
||||||
|
#elif L==10 // tr
|
||||||
|
"Tüm projelerin konfigürasyonunu değiştir"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
[ActReqUsrPrj] =
|
[ActReqUsrPrj] =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Select users to list their projects" // Necessita traducció
|
"Seleccionar usuaris per llistar els projectes"
|
||||||
#elif L==2 // de
|
#elif L==2 // de
|
||||||
"Select users to list their projects" // Need Übersetzung
|
"Wählen Sie Benutzer aus, um ihre Projekte aufzulisten"
|
||||||
#elif L==3 // en
|
#elif L==3 // en
|
||||||
"Select users to list their projects"
|
"Select users to list their projects"
|
||||||
#elif L==4 // es
|
#elif L==4 // es
|
||||||
"Seleccionar usuarios para listar sus proyectos"
|
"Seleccionar usuarios para listar sus proyectos"
|
||||||
#elif L==5 // fr
|
#elif L==5 // fr
|
||||||
"Select users to list their projects" // Besoin de traduction
|
"Sélectionner les utilisateurs pour lister leurs projets"
|
||||||
#elif L==6 // gn
|
#elif L==6 // gn
|
||||||
"Seleccionar usuarios para listar sus proyectos" // Okoteve traducción
|
"Eiporavo puruhára emoĩ ha>ilde;ua iproyectokuéra"
|
||||||
#elif L==7 // it
|
#elif L==7 // it
|
||||||
"Select users to list their projects" // Bisogno di traduzione
|
"Seleziona gli utenti per elencare i loro progetti"
|
||||||
#elif L==8 // pl
|
#elif L==8 // pl
|
||||||
"Select users to list their projects" // Potrzebujesz tlumaczenie
|
"Wybierz użytkowników, aby wyświetlić listę ich projektów"
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Select users to list their projects" // Precisa de tradução
|
"Selecionar usuários para listar seus projetos"
|
||||||
#elif L==10 // tr
|
#elif L==10 // tr
|
||||||
"Select users to list their projects" // Çeviri lazim!
|
"Projelerini listelemek için kullanıcıları seçin"
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
[ActSeeTblAllPrj] =
|
[ActSeeTblAllPrj] =
|
||||||
|
@ -9421,52 +9467,6 @@ const char *Txt_Actions[ActLst_NUM_ACTIONS] =
|
||||||
"Show all projects in a table" // Precisa de tradução
|
"Show all projects in a table" // Precisa de tradução
|
||||||
#elif L==10 // tr
|
#elif L==10 // tr
|
||||||
"Show all projects in a table" // Çeviri lazim!
|
"Show all projects in a table" // Çeviri lazim!
|
||||||
#endif
|
|
||||||
,
|
|
||||||
[ActCfgPrj] =
|
|
||||||
#if L==1 // ca
|
|
||||||
"Configure all projects" // Necessita traducció
|
|
||||||
#elif L==2 // de
|
|
||||||
"Configure all projects" // Need Übersetzung
|
|
||||||
#elif L==3 // en
|
|
||||||
"Configure all projects"
|
|
||||||
#elif L==4 // es
|
|
||||||
"Configurar todos los proyectos"
|
|
||||||
#elif L==5 // fr
|
|
||||||
"Configure all projects" // Besoin de traduction
|
|
||||||
#elif L==6 // gn
|
|
||||||
"Configurar todos los proyectos" // Okoteve traducción
|
|
||||||
#elif L==7 // it
|
|
||||||
"Configure all projects" // Bisogno di traduzione
|
|
||||||
#elif L==8 // pl
|
|
||||||
"Configure all projects" // Potrzebujesz tlumaczenie
|
|
||||||
#elif L==9 // pt
|
|
||||||
"Configure all projects" // Precisa de tradução
|
|
||||||
#elif L==10 // tr
|
|
||||||
"Configure all projects" // Çeviri lazim!
|
|
||||||
#endif
|
|
||||||
,
|
|
||||||
[ActRcvCfgPrj] =
|
|
||||||
#if L==1 // ca
|
|
||||||
"Change configuration of all projects" // Necessita traducció
|
|
||||||
#elif L==2 // de
|
|
||||||
"Change configuration of all projects" // Need Übersetzung
|
|
||||||
#elif L==3 // en
|
|
||||||
"Change configuration of all projects"
|
|
||||||
#elif L==4 // es
|
|
||||||
"Cambiar configuración de todos los proyectos"
|
|
||||||
#elif L==5 // fr
|
|
||||||
"Change configuration of all projects" // Besoin de traduction
|
|
||||||
#elif L==6 // gn
|
|
||||||
"Cambiar configuración de todos los proyectos" // Okoteve traducción
|
|
||||||
#elif L==7 // it
|
|
||||||
"Change configuration of all projects" // Bisogno di traduzione
|
|
||||||
#elif L==8 // pl
|
|
||||||
"Change configuration of all projects" // Potrzebujesz tlumaczenie
|
|
||||||
#elif L==9 // pt
|
|
||||||
"Change configuration of all projects" // Precisa de tradução
|
|
||||||
#elif L==10 // tr
|
|
||||||
"Change configuration of all projects" // Çeviri lazim!
|
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
[ActReqLckAllPrj] =
|
[ActReqLckAllPrj] =
|
||||||
|
|
Loading…
Reference in New Issue