diff --git a/swad_changelog.h b/swad_changelog.h
index f9e15580c..a816554ef 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -455,11 +455,12 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 18.114.1 (2019-04-18)"
+#define Log_PLATFORM_VERSION "SWAD 18.114.2 (2019-04-18)"
#define CSS_FILE "swad18.112.1.css"
#define JS_FILE "swad18.114.js"
/*
- Version 18.114.1: Apr 18, 2019 Changes in translation of title related to project locking/unlocking. (? lines)
+ Version 18.114.2: Apr 18, 2019 Icons to inform about locked/unlocked project edition. (243023 lines)
+ Version 18.114.1: Apr 18, 2019 Changes in translation of title related to project locking/unlocking. (243024 lines)
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;
diff --git a/swad_project.c b/swad_project.c
index a7168073a..685162270 100644
--- a/swad_project.c
+++ b/swad_project.c
@@ -88,19 +88,25 @@ static const char *Prj_Proposal_DB[Prj_NUM_PROPOSAL_TYPES] =
"unmodified", // Prj_PROPOSAL_UNMODIFIED
};
-/***** Image for preassigned and non-preassigned projects *****/
+/***** Preassigned/non-preassigned project *****/
static const char *PreassignedNonpreassigImage[Prj_NUM_PREASSIGNED_NONPREASSIG] =
{
"user.svg", // Prj_PREASSIGNED
"user-slash.svg", // Prj_NONPREASSIG
};
-/*
-static const char *PreassignedNonpreassigImage[Prj_NUM_PREASSIGNED_NONPREASSIG] =
+
+/***** Locked/unlocked project edition *****/
+static const char *Prj_LockIcons[Prj_NUM_LOCKED_UNLOCKED] =
{
- "lock.svg", // Prj_PREASSIGNED
- "unlock.svg", // Prj_NONPREASSIG
+ "lock.svg", // Prj_LOCKED
+ "unlock.svg", // Prj_UNLOCKED
};
-*/
+static const Act_Action_t Prj_LockActions[Prj_NUM_LOCKED_UNLOCKED] =
+ {
+ ActUnlPrj, // Prj_LOCKED
+ ActLckPrj, // Prj_UNLOCKED
+ };
+
/*****************************************************************************/
/***************************** Private variables *****************************/
/*****************************************************************************/
@@ -181,6 +187,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_PutIconOffLockedUnlocked (const struct Project *Prj);
static void Prj_ResetProject (struct Project *Prj);
@@ -2227,13 +2234,17 @@ static void Prj_PutFormsToRemEditOnePrj (const struct Project *Prj,
/***** Put form to print project *****/
Ico_PutContextualIconToPrint (ActPrnOnePrj,Prj_PutCurrentParams);
- /***** Put form to lock project *****/
+ /***** Locked/unlocked project edition *****/
if (Prj_CheckIfICanLockProject ())
{
+ /* Put form to lock/unlock project edition */
fprintf (Gbl.F.Out,"
",Prj->PrjCod);
Prj_FormLockUnlock (Prj);
fprintf (Gbl.F.Out,"
");
}
+ else
+ /* Put icon toinform about locked/unlocked project edition */
+ Prj_PutIconOffLockedUnlocked (Prj);
}
/*****************************************************************************/
@@ -2290,23 +2301,13 @@ static bool Prj_CheckIfICanLockProject (void)
}
/*****************************************************************************/
-/*********************** Form to lock/unlock a project ***********************/
+/******************** Form to lock/unlock project edition ********************/
/*****************************************************************************/
static void Prj_FormLockUnlock (const struct Project *Prj)
{
extern const char *Txt_LOCKED_UNLOCKED[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)|
@@ -2319,7 +2320,7 @@ static void Prj_FormLockUnlock (const struct Project *Prj)
+---------------------+
*/
- /***** Form and icon to mark note as favourite *****/
+ /***** Form and icon to lock/unlock project edition *****/
/* Form with icon */
if (asprintf (&OnSubmit,"updateDivLockUnlockProject(this,"
"'act=%ld&ses=%s&PrjCod=%ld');"
@@ -2336,6 +2337,18 @@ static void Prj_FormLockUnlock (const struct Project *Prj)
free ((void *) OnSubmit);
}
+/*****************************************************************************/
+/********* Put icon to inform about locked/unlocked project edition **********/
+/*****************************************************************************/
+
+static void Prj_PutIconOffLockedUnlocked (const struct Project *Prj)
+ {
+ extern const char *Txt_LOCKED_UNLOCKED[Prj_NUM_LOCKED_UNLOCKED];
+
+ /***** Icon to inform about locked/unlocked project edition *****/
+ Ico_PutIconOff (Prj_LockIcons[Prj->Locked],Txt_LOCKED_UNLOCKED[Prj->Locked]);
+ }
+
/*****************************************************************************/
/************************** List all the projects ****************************/
/*****************************************************************************/
@@ -2940,7 +2953,6 @@ void Prj_ShowProject (void)
void Prj_LockProjectEdition (void)
{
- // extern const char *Txt_The_edition_of_project_X_is_now_locked;
struct Project Prj;
/***** Allocate memory for the project *****/
@@ -2956,16 +2968,14 @@ void Prj_LockProjectEdition (void)
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
{
- /***** Hide project *****/
- DB_QueryUPDATE ("can not lock project",
+ /***** Lock project edition *****/
+ DB_QueryUPDATE ("can not lock project edition",
"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);
+ /***** Show updated form and icon *****/
Prj_FormLockUnlock (&Prj);
}
else
@@ -2976,9 +2986,6 @@ void Prj_LockProjectEdition (void)
/***** All the output is made, so don't write anymore *****/
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
-
- /***** Show projects again *****/
- // Prj_ShowProjectsInCurrentPage ();
}
/*****************************************************************************/
@@ -2987,7 +2994,6 @@ void Prj_LockProjectEdition (void)
void Prj_UnlockProjectEdition (void)
{
- // extern const char *Txt_The_edition_of_project_X_is_now_unlocked;
struct Project Prj;
/***** Allocate memory for the project *****/
@@ -3003,16 +3009,14 @@ void Prj_UnlockProjectEdition (void)
if (Prj_CheckIfICanEditProject (Prj.PrjCod))
{
- /***** Show project *****/
- DB_QueryUPDATE ("can not unlock project",
+ /***** Unlock project edition *****/
+ DB_QueryUPDATE ("can not unlock project edition",
"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);
+ /***** Show updated form and icon *****/
Prj_FormLockUnlock (&Prj);
}
else
@@ -3023,9 +3027,6 @@ void Prj_UnlockProjectEdition (void)
/***** All the output is made, so don't write anymore *****/
Gbl.Layout.DivsEndWritten = Gbl.Layout.HTMLEndWritten = true;
-
- /***** Show projects again *****/
- // Prj_ShowProjectsInCurrentPage ();
}
/*****************************************************************************/
diff --git a/swad_text.c b/swad_text.c
index 7305e84c5..90d03ae21 100644
--- a/swad_text.c
+++ b/swad_text.c
@@ -17584,43 +17584,43 @@ const char *Txt_Locations =
const char *Txt_LOCKED_UNLOCKED[Prj_NUM_LOCKED_UNLOCKED] =
{
#if L==1 // ca
- "Edició bloquejada. Premi per desbloquejar-la."
+ "Edició bloquejada"
#elif L==2 // de
- "Gesperrte Ausgabe. Drücke zum Entsperren."
+ "Gesperrte Ausgabe"
#elif L==3 // en
- "Locked edition. Press to unlock it."
+ "Locked edition"
#elif L==4 // es
- "Edición bloqueada. Pulse para desbloquearla."
+ "Edición bloqueada"
#elif L==5 // fr
- "Edition verrouillée. Appuyez pour la déverrouiller."
+ "Edition verrouillée"
#elif L==6 // gn
- "Edición bloqueada. Pulse para desbloquearla." // Okoteve traducción
+ "Edición bloqueada" // Okoteve traducción
#elif L==7 // it
- "Edizione bloccata. Premere per sbloccarela."
+ "Edizione bloccata"
#elif L==8 // pl
- "Zamknięta edycja. Naciśnij, aby go odblokować."
+ "Zamknięta edycja"
#elif L==9 // pt
- "Edição bloqueada. Pressione para desbloquear."
+ "Edição bloqueada"
#endif
,
#if L==1 // ca
- "Edició permesa. Premi per bloquejar-la."
+ "Edició permesa"
#elif L==2 // de
- "Erlaubte Ausgabe. Drücken Sie, um es zu sperren."
+ "Erlaubte Ausgabe"
#elif L==3 // en
- "Allowed edition. Press to lock it."
+ "Allowed edition"
#elif L==4 // es
- "Edición permitida. Pulse para bloquearla."
+ "Edición permitida"
#elif L==5 // fr
- "Édition autorisée. Appuyez sur pour la verrouiller."
+ "Édition autorisée"
#elif L==6 // gn
- "Edición permitida. Pulse para bloquearla." // Okoteve traducción
+ "Edición permitida" // Okoteve traducción
#elif L==7 // it
- "Edizione consentita. Premere per bloccarla."
+ "Edizione consentita"
#elif L==8 // pl
- "Dozwolone wydanie. Naciśnij, aby go zablokować."
+ "Dozwolone wydanie"
#elif L==9 // pt
- "Edição permitida. Pressione para travar."
+ "Edição permitida"
#endif
};