Version18.114

This commit is contained in:
Antonio Cañas Vargas 2019-04-17 22:06:23 +02:00
parent 03dc50cad4
commit a3faef8f22
8 changed files with 113 additions and 1831 deletions

File diff suppressed because it is too large Load Diff

View File

@ -455,10 +455,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.113 (2019-04-17)"
#define Log_PLATFORM_VERSION "SWAD 18.114 (2019-04-17)"
#define CSS_FILE "swad18.112.1.css"
#define JS_FILE "swad18.92.js"
#define JS_FILE "swad18.114.js"
/*
Version 18.114: Apr 17, 2019 Project locking/unlocking is made via AJAX. (243023 lines)
Version 18.113: Apr 17, 2019 Individual locking of the edition of each project through a padlock icon. Only the teacher of the subject can lock / unlock each project. Suggested by Pedro Villar Castro. (243000 lines)
ALTER TABLE projects ADD COLUMN Locked ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER DptCod;

View File

@ -288,24 +288,6 @@ void Ico_PutContextualIconToPrint (Act_Action_t NextAction,void (*FuncParams) (v
Txt_Print);
}
void Ico_PutContextualIconToLock (Act_Action_t NextAction,void (*FuncParams) (void))
{
extern const char *Txt_Lock;
Lay_PutContextualLinkOnlyIcon (NextAction,NULL,FuncParams,
"unlock.svg",
Txt_Lock);
}
void Ico_PutContextualIconToUnlock (Act_Action_t NextAction,void (*FuncParams) (void))
{
extern const char *Txt_Unlock;
Lay_PutContextualLinkOnlyIcon (NextAction,NULL,FuncParams,
"lock.svg",
Txt_Unlock);
}
/*****************************************************************************/
/**************** Show an icon inside a div (without text) *******************/
/*****************************************************************************/

View File

@ -65,8 +65,6 @@ void Ico_PutContextualIconToView (Act_Action_t NextAction,void (*FuncParams) (vo
void Ico_PutContextualIconToUnhide (Act_Action_t NextAction,const char *Anchor,void (*FuncParams) (void));
void Ico_PutContextualIconToHide (Act_Action_t NextAction,const char *Anchor,void (*FuncParams) (void));
void Ico_PutContextualIconToPrint (Act_Action_t NextAction,void (*FuncParams) (void));
void Ico_PutContextualIconToLock (Act_Action_t NextAction,void (*FuncParams) (void));
void Ico_PutContextualIconToUnlock (Act_Action_t NextAction,void (*FuncParams) (void));
void Ico_PutDivIcon (const char *DivClass,const char *Icon,const char *Title);
void Ico_PutDivIconLink (const char *DivClass,const char *Icon,const char *Title);

View File

@ -740,7 +740,8 @@ void Par_GetMainParameters (void)
Gbl.Action.Act == ActFavSocNotGbl || Gbl.Action.Act == ActFavSocNotUsr ||
Gbl.Action.Act == ActUnfSocNotGbl || Gbl.Action.Act == ActUnfSocNotUsr ||
Gbl.Action.Act == ActFavSocComGbl || Gbl.Action.Act == ActFavSocComUsr ||
Gbl.Action.Act == ActUnfSocComGbl || Gbl.Action.Act == ActUnfSocComUsr)
Gbl.Action.Act == ActUnfSocComGbl || Gbl.Action.Act == ActUnfSocComUsr ||
Gbl.Action.Act == ActLckPrj || Gbl.Action.Act == ActUnlPrj)
{
Gbl.Action.UsesAJAX = true;
Gbl.Action.IsAJAXAutoRefresh = false;

View File

@ -180,6 +180,7 @@ static void Prj_PutFormsToRemEditOnePrj (const struct Project *Prj,
static bool Prj_CheckIfICanEditProject (long PrjCod);
static bool Prj_CheckIfICanLockProject (void);
static void Prj_FormLockUnlock (const struct Project *Prj);
static void Prj_ResetProject (struct Project *Prj);
@ -2228,15 +2229,11 @@ static void Prj_PutFormsToRemEditOnePrj (const struct Project *Prj,
/***** Put form to lock project *****/
if (Prj_CheckIfICanLockProject ())
switch (Prj->Locked)
{
case Prj_LOCKED:
Ico_PutContextualIconToUnlock (ActUnlPrj,Prj_PutCurrentParams);
break;
case Prj_UNLOCKED:
Ico_PutContextualIconToLock (ActLckPrj,Prj_PutCurrentParams);
break;
}
{
fprintf (Gbl.F.Out,"<div id=\"prj_lck_%ld\">",Prj->PrjCod);
Prj_FormLockUnlock (Prj);
fprintf (Gbl.F.Out,"</div>");
}
}
/*****************************************************************************/
@ -2292,6 +2289,53 @@ static bool Prj_CheckIfICanLockProject (void)
}
}
/*****************************************************************************/
/*********************** Form to lock/unlock a project ***********************/
/*****************************************************************************/
static void Prj_FormLockUnlock (const struct Project *Prj)
{
extern const char *Txt_Lock_Unlock[Prj_NUM_LOCKED_UNLOCKED];
char *OnSubmit;
static const Act_Action_t Prj_LockActions[Prj_NUM_LOCKED_UNLOCKED] =
{
ActUnlPrj, // Prj_LOCKED
ActLckPrj, // Prj_UNLOCKED
};
static const char *Prj_LockIcons[Prj_NUM_LOCKED_UNLOCKED] =
{
"lock.svg", // Prj_LOCKED
"unlock.svg", // Prj_UNLOCKED
};
/*
+---------------------+
| div (parent of form)|
| +-----------------+ |
| | this form | |
| | +-------------+ | |
| | | icon | | |
| | +-------------+ | |
| +-----------------+ |
+---------------------+
*/
/***** Form and icon to mark note as favourite *****/
/* Form with icon */
if (asprintf (&OnSubmit,"updateDivLockUnlockProject(this,"
"'act=%ld&ses=%s&PrjCod=%ld');"
" return false;", // return false is necessary to not submit form
Act_GetActCod (Prj_LockActions[Prj->Locked]),
Gbl.Session.Id,
Prj->PrjCod) < 0)
Lay_NotEnoughMemoryExit ();
Frm_StartFormOnSubmit (ActUnk,OnSubmit);
Ico_PutIconLink (Prj_LockIcons[Prj->Locked],Txt_Lock_Unlock[Prj->Locked]);
Frm_EndForm ();
/* Free allocated memory for subquery */
free ((void *) OnSubmit);
}
/*****************************************************************************/
/************************** List all the projects ****************************/
/*****************************************************************************/
@ -2896,7 +2940,7 @@ void Prj_ShowProject (void)
void Prj_LockProjectEdition (void)
{
extern const char *Txt_The_edition_of_project_X_is_now_locked;
// extern const char *Txt_The_edition_of_project_X_is_now_locked;
struct Project Prj;
/***** Allocate memory for the project *****/
@ -2913,14 +2957,16 @@ void Prj_LockProjectEdition (void)
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
{
/***** Hide project *****/
DB_QueryUPDATE ("can not hide project",
DB_QueryUPDATE ("can not lock project",
"UPDATE projects SET Locked='Y'"
" WHERE PrjCod=%ld AND CrsCod=%ld",
Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod);
Prj.Locked = Prj_LOCKED;
/***** Write message to show the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_edition_of_project_X_is_now_locked,
Prj.Title);
// Ale_ShowAlert (Ale_SUCCESS,Txt_The_edition_of_project_X_is_now_locked,
// Prj.Title);
Prj_FormLockUnlock (&Prj);
}
else
Lay_NoPermissionExit ();
@ -2928,8 +2974,11 @@ void Prj_LockProjectEdition (void)
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);
/***** All the output is made, so don't write anymore *****/
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
/***** Show projects again *****/
Prj_ShowProjectsInCurrentPage ();
// Prj_ShowProjectsInCurrentPage ();
}
/*****************************************************************************/
@ -2938,7 +2987,7 @@ void Prj_LockProjectEdition (void)
void Prj_UnlockProjectEdition (void)
{
extern const char *Txt_The_edition_of_project_X_is_now_unlocked;
// extern const char *Txt_The_edition_of_project_X_is_now_unlocked;
struct Project Prj;
/***** Allocate memory for the project *****/
@ -2955,14 +3004,16 @@ void Prj_UnlockProjectEdition (void)
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
{
/***** Show project *****/
DB_QueryUPDATE ("can not show project",
DB_QueryUPDATE ("can not unlock project",
"UPDATE projects SET Locked='N'"
" WHERE PrjCod=%ld AND CrsCod=%ld",
Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod);
Prj.Locked = Prj_UNLOCKED;
/***** Write message to show the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_The_edition_of_project_X_is_now_unlocked,
Prj.Title);
// Ale_ShowAlert (Ale_SUCCESS,Txt_The_edition_of_project_X_is_now_unlocked,
// Prj.Title);
Prj_FormLockUnlock (&Prj);
}
else
Lay_NoPermissionExit ();
@ -2970,8 +3021,11 @@ void Prj_UnlockProjectEdition (void)
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);
/***** All the output is made, so don't write anymore *****/
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
/***** Show projects again *****/
Prj_ShowProjectsInCurrentPage ();
// Prj_ShowProjectsInCurrentPage ();
}
/*****************************************************************************/

View File

@ -57,13 +57,15 @@ typedef enum
#define Prj_FILTER_PREASSIGNED_DEFAULT (1 << Prj_PREASSIGNED) // on
#define Prj_FILTER_NONPREASSIG_DEFAULT (1 << Prj_NONPREASSIG) // on
/* Locked/unlocked project */
#define Prj_NUM_LOCKED_UNLOCKED 2
typedef enum
{
Prj_LOCKED = 0,
Prj_UNLOCKED = 1,
} Prj_Locked_t;
/* Hidden projects / visible projects */
/* Hidden/visible project */
#define Prj_NUM_HIDDEN_VISIBL 2
typedef enum
{

View File

@ -17581,26 +17581,48 @@ const char *Txt_Locations =
"Localiza&ccedil;&otilde;es";
#endif
const char *Txt_Lock =
const char *Txt_Lock_Unlock[Prj_NUM_LOCKED_UNLOCKED] =
{
#if L==1 // ca
"Tancar";
"Desbloquejar"
#elif L==2 // de
"Abschlie&szlig;en";
"Aufschlie&szlig;en"
#elif L==3 // en
"Lock";
"Unlock"
#elif L==4 // es
"Bloquear";
"Desbloquear"
#elif L==5 // fr
"Verrouiller";
"D&eacute;verouiller"
#elif L==6 // gn
"Bloquear"; // Okoteve traducción
"Desbloquear" // Okoteve traducción
#elif L==7 // it
"Bloccare";
"Sbloccare"
#elif L==8 // pl
"Zablokowa&cacute;";
"Odblokowa&cacute;"
#elif L==9 // pt
"Trancar";
"Desbloquear"
#endif
,
#if L==1 // ca
"Tancar"
#elif L==2 // de
"Abschlie&szlig;en"
#elif L==3 // en
"Lock"
#elif L==4 // es
"Bloquear"
#elif L==5 // fr
"Verrouiller"
#elif L==6 // gn
"Bloquear" // Okoteve traducción
#elif L==7 // it
"Bloccare"
#elif L==8 // pl
"Zablokowa&cacute;"
#elif L==9 // pt
"Bloquear"
#endif
};
const char *Txt_LOG_More_info =
#if L==1 // ca
@ -44011,48 +44033,6 @@ const char *Txt_The_department_X_has_been_renamed_as_Y = // Warning: it is very
"O departamento <strong>%s</strong> foi renomeado como <strong>%s</strong>.";
#endif
const char *Txt_The_edition_of_project_X_is_now_locked = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"L'edici&oacute; del projecte <strong>%s</strong> ara est&agrave; bloquejada.";
#elif L==2 // de
"Die Edition des Projekts <strong>%s</strong> ist jetzt gesperrt.";
#elif L==3 // en
"The edition of the project <strong>%s</strong> is now locked.";
#elif L==4 // es
"La edici&oacute;n del proyecto <strong>%s</strong> ahora est&aacute; bloqueada.";
#elif L==5 // fr
"L'&eacute;dition du projet <strong>%s</strong> est maintenant verrouill&eacute;e.";
#elif L==6 // gn
"La edici&oacute;n del proyecto <strong>%s</strong> ahora est&aacute; bloqueada."; // Okoteve traducción
#elif L==7 // it
"L'edizione del progetto <strong>%s</strong> &egrave; ora chiusa a chiave.";
#elif L==8 // pl
"Edycja projektu <strong>%s</strong> jest teraz zablokowana.";
#elif L==9 // pt
"A edi&ccedil;&atilde;o do projeto <strong>%s</strong> est&aacute; agora bloqueada.";
#endif
const char *Txt_The_edition_of_project_X_is_now_unlocked = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"L'edici&oacute; del projecte <strong>%s</strong> ara est&agrave; desbloquejada.";
#elif L==2 // de
"Die Edition des Projekts <strong>%s</strong> ist jetzt freigeschaltet.";
#elif L==3 // en
"The edition of the project <strong>%s</strong> is now unlocked.";
#elif L==4 // es
"La edici&oacute;n del proyecto <strong>%s</strong> ahora est&aacute; desbloqueada.";
#elif L==5 // fr
"L'&eacute;dition du projet <strong>%s</strong> est maintenant ouverte.";
#elif L==6 // gn
"La edici&oacute;n del proyecto <strong>%s</strong> ahora est&aacute; desbloqueada."; // Okoteve traducción
#elif L==7 // it
"L'edizione del progetto <strong>%s</strong> &egrave; ora chiusa a chiave.";
#elif L==8 // pl
"Edycja projektu <strong>%s</strong> jest teraz odblokowana.";
#elif L==9 // pt
"A edi&ccedil;&atilde;o do projeto <strong>%s</strong> est&aacute; agora desbloqueada.";
#endif
const char *Txt_The_email_X_has_been_confirmed = // Warning: it is very important to include %s in the following sentences
#if L==1 // ca
"El correo <strong>%s</strong> ha sido confirmado."; // Necessita traduccio
@ -51434,27 +51414,6 @@ const char *Txt_unknown_TIME =
"desconhecido";
#endif
const char *Txt_Unlock =
#if L==1 // ca
"Desbloquejar";
#elif L==2 // de
"Aufschlie&szlig;en";
#elif L==3 // en
"Unlock";
#elif L==4 // es
"Desbloquear";
#elif L==5 // fr
"D&eacute;verouiller";
#elif L==6 // gn
"Desbloquear"; // Okoteve traducción
#elif L==7 // it
"Sbloccare";
#elif L==8 // pl
"Odblokowa&cacute;";
#elif L==9 // pt
"Desbloquear";
#endif
const char *Txt_unread_MESSAGE =
#if L==1 // ca
"no le&iacute;do"; // Necessita traduccio