diff --git a/sql/swad.sql b/sql/swad.sql index 4cccdf111..ca7649fe6 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -984,6 +984,7 @@ CREATE TABLE IF NOT EXISTS projects ( PrjCod INT NOT NULL AUTO_INCREMENT, CrsCod INT NOT NULL DEFAULT -1, DptCod INT NOT NULL DEFAULT -1, + Locked ENUM('N','Y') NOT NULL DEFAULT 'N', Hidden ENUM('N','Y') NOT NULL DEFAULT 'N', Preassigned ENUM('N','Y') NOT NULL DEFAULT 'N', NumStds INT NOT NULL DEFAULT 1, diff --git a/swad_action.c b/swad_action.c index 6a9e26d21..509c8edc0 100644 --- a/swad_action.c +++ b/swad_action.c @@ -506,6 +506,8 @@ Assessment: 363. ActRemPrj Remove project 364. ActHidPrj Hide project 365. ActShoPrj Show project + NEW. ActLckPrj Lock project edition + NEW. ActUnlPrj Unlock project edition 366. ActReqAddStdPrj Request adding a student to a project 367. ActReqAddTutPrj Request adding a tutor to a project 368. ActReqAddEvlPrj Request adding an evaluator to a project @@ -2043,6 +2045,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActRemPrj */{1681,-1,TabUnk,ActSeePrj ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_RemoveProject ,NULL}, /* ActHidPrj */{1682,-1,TabUnk,ActSeePrj ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_HideProject ,NULL}, /* ActShoPrj */{1683,-1,TabUnk,ActSeePrj ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ShowProject ,NULL}, + /* ActLckPrj */{1773,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_LockProjectEdition ,NULL}, + /* ActUnlPrj */{1774,-1,TabUnk,ActSeePrj ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_UnlockProjectEdition ,NULL}, /* ActReqAddStdPrj */{1684,-1,TabUnk,ActSeePrj ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ReqAddStds ,NULL}, /* ActReqAddTutPrj */{1685,-1,TabUnk,ActSeePrj ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ReqAddTuts ,NULL}, /* ActReqAddEvlPrj */{1686,-1,TabUnk,ActSeePrj ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prj_ReqAddEvls ,NULL}, @@ -4949,6 +4953,8 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActAllFavSocNotUsr, // #1770 ActAllFavSocComUsr, // #1771 ActReqMaiUsr, // #1772 + ActLckPrj, // #1773 + ActUnlPrj, // #1774 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 10dfa0cd1..974f1d740 100644 --- a/swad_action.h +++ b/swad_action.h @@ -61,9 +61,9 @@ typedef enum typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (1 + 8 + 61 + 38 + 12 + 42 + 36 + 19 + 110 + 157 + 437 + 176 + 169 + 15 + 67) +#define Act_NUM_ACTIONS (1 + 8 + 61 + 38 + 12 + 42 + 36 + 19 + 110 + 159 + 437 + 176 + 169 + 15 + 67) -#define Act_MAX_ACTION_COD 1772 +#define Act_MAX_ACTION_COD 1774 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13 @@ -522,133 +522,135 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActRemPrj (ActChgCrsTT1stDay + 35) #define ActHidPrj (ActChgCrsTT1stDay + 36) #define ActShoPrj (ActChgCrsTT1stDay + 37) -#define ActReqAddStdPrj (ActChgCrsTT1stDay + 38) -#define ActReqAddTutPrj (ActChgCrsTT1stDay + 39) -#define ActReqAddEvlPrj (ActChgCrsTT1stDay + 40) -#define ActAddStdPrj (ActChgCrsTT1stDay + 41) -#define ActAddTutPrj (ActChgCrsTT1stDay + 42) -#define ActAddEvlPrj (ActChgCrsTT1stDay + 43) -#define ActReqRemStdPrj (ActChgCrsTT1stDay + 44) -#define ActReqRemTutPrj (ActChgCrsTT1stDay + 45) -#define ActReqRemEvlPrj (ActChgCrsTT1stDay + 46) -#define ActRemStdPrj (ActChgCrsTT1stDay + 47) -#define ActRemTutPrj (ActChgCrsTT1stDay + 48) -#define ActRemEvlPrj (ActChgCrsTT1stDay + 49) +#define ActLckPrj (ActChgCrsTT1stDay + 38) +#define ActUnlPrj (ActChgCrsTT1stDay + 39) +#define ActReqAddStdPrj (ActChgCrsTT1stDay + 40) +#define ActReqAddTutPrj (ActChgCrsTT1stDay + 41) +#define ActReqAddEvlPrj (ActChgCrsTT1stDay + 42) +#define ActAddStdPrj (ActChgCrsTT1stDay + 43) +#define ActAddTutPrj (ActChgCrsTT1stDay + 44) +#define ActAddEvlPrj (ActChgCrsTT1stDay + 45) +#define ActReqRemStdPrj (ActChgCrsTT1stDay + 46) +#define ActReqRemTutPrj (ActChgCrsTT1stDay + 47) +#define ActReqRemEvlPrj (ActChgCrsTT1stDay + 48) +#define ActRemStdPrj (ActChgCrsTT1stDay + 49) +#define ActRemTutPrj (ActChgCrsTT1stDay + 50) +#define ActRemEvlPrj (ActChgCrsTT1stDay + 51) -#define ActAdmDocPrj (ActChgCrsTT1stDay + 50) -#define ActReqRemFilDocPrj (ActChgCrsTT1stDay + 51) -#define ActRemFilDocPrj (ActChgCrsTT1stDay + 52) -#define ActRemFolDocPrj (ActChgCrsTT1stDay + 53) -#define ActCopDocPrj (ActChgCrsTT1stDay + 54) -#define ActPasDocPrj (ActChgCrsTT1stDay + 55) -#define ActRemTreDocPrj (ActChgCrsTT1stDay + 56) -#define ActFrmCreDocPrj (ActChgCrsTT1stDay + 57) -#define ActCreFolDocPrj (ActChgCrsTT1stDay + 58) -#define ActCreLnkDocPrj (ActChgCrsTT1stDay + 59) -#define ActRenFolDocPrj (ActChgCrsTT1stDay + 60) -#define ActRcvFilDocPrjDZ (ActChgCrsTT1stDay + 61) -#define ActRcvFilDocPrjCla (ActChgCrsTT1stDay + 62) -#define ActExpDocPrj (ActChgCrsTT1stDay + 63) -#define ActConDocPrj (ActChgCrsTT1stDay + 64) -#define ActZIPDocPrj (ActChgCrsTT1stDay + 65) -#define ActReqDatDocPrj (ActChgCrsTT1stDay + 66) -#define ActChgDatDocPrj (ActChgCrsTT1stDay + 67) -#define ActDowDocPrj (ActChgCrsTT1stDay + 68) +#define ActAdmDocPrj (ActChgCrsTT1stDay + 52) +#define ActReqRemFilDocPrj (ActChgCrsTT1stDay + 53) +#define ActRemFilDocPrj (ActChgCrsTT1stDay + 54) +#define ActRemFolDocPrj (ActChgCrsTT1stDay + 55) +#define ActCopDocPrj (ActChgCrsTT1stDay + 56) +#define ActPasDocPrj (ActChgCrsTT1stDay + 57) +#define ActRemTreDocPrj (ActChgCrsTT1stDay + 58) +#define ActFrmCreDocPrj (ActChgCrsTT1stDay + 59) +#define ActCreFolDocPrj (ActChgCrsTT1stDay + 60) +#define ActCreLnkDocPrj (ActChgCrsTT1stDay + 61) +#define ActRenFolDocPrj (ActChgCrsTT1stDay + 62) +#define ActRcvFilDocPrjDZ (ActChgCrsTT1stDay + 63) +#define ActRcvFilDocPrjCla (ActChgCrsTT1stDay + 64) +#define ActExpDocPrj (ActChgCrsTT1stDay + 65) +#define ActConDocPrj (ActChgCrsTT1stDay + 66) +#define ActZIPDocPrj (ActChgCrsTT1stDay + 67) +#define ActReqDatDocPrj (ActChgCrsTT1stDay + 68) +#define ActChgDatDocPrj (ActChgCrsTT1stDay + 69) +#define ActDowDocPrj (ActChgCrsTT1stDay + 70) -#define ActAdmAssPrj (ActChgCrsTT1stDay + 69) -#define ActReqRemFilAssPrj (ActChgCrsTT1stDay + 70) -#define ActRemFilAssPrj (ActChgCrsTT1stDay + 71) -#define ActRemFolAssPrj (ActChgCrsTT1stDay + 72) -#define ActCopAssPrj (ActChgCrsTT1stDay + 73) -#define ActPasAssPrj (ActChgCrsTT1stDay + 74) -#define ActRemTreAssPrj (ActChgCrsTT1stDay + 75) -#define ActFrmCreAssPrj (ActChgCrsTT1stDay + 76) -#define ActCreFolAssPrj (ActChgCrsTT1stDay + 77) -#define ActCreLnkAssPrj (ActChgCrsTT1stDay + 78) -#define ActRenFolAssPrj (ActChgCrsTT1stDay + 79) -#define ActRcvFilAssPrjDZ (ActChgCrsTT1stDay + 80) -#define ActRcvFilAssPrjCla (ActChgCrsTT1stDay + 81) -#define ActExpAssPrj (ActChgCrsTT1stDay + 82) -#define ActConAssPrj (ActChgCrsTT1stDay + 83) -#define ActZIPAssPrj (ActChgCrsTT1stDay + 84) -#define ActReqDatAssPrj (ActChgCrsTT1stDay + 85) -#define ActChgDatAssPrj (ActChgCrsTT1stDay + 86) -#define ActDowAssPrj (ActChgCrsTT1stDay + 87) +#define ActAdmAssPrj (ActChgCrsTT1stDay + 71) +#define ActReqRemFilAssPrj (ActChgCrsTT1stDay + 72) +#define ActRemFilAssPrj (ActChgCrsTT1stDay + 73) +#define ActRemFolAssPrj (ActChgCrsTT1stDay + 74) +#define ActCopAssPrj (ActChgCrsTT1stDay + 75) +#define ActPasAssPrj (ActChgCrsTT1stDay + 76) +#define ActRemTreAssPrj (ActChgCrsTT1stDay + 77) +#define ActFrmCreAssPrj (ActChgCrsTT1stDay + 78) +#define ActCreFolAssPrj (ActChgCrsTT1stDay + 79) +#define ActCreLnkAssPrj (ActChgCrsTT1stDay + 80) +#define ActRenFolAssPrj (ActChgCrsTT1stDay + 81) +#define ActRcvFilAssPrjDZ (ActChgCrsTT1stDay + 82) +#define ActRcvFilAssPrjCla (ActChgCrsTT1stDay + 83) +#define ActExpAssPrj (ActChgCrsTT1stDay + 84) +#define ActConAssPrj (ActChgCrsTT1stDay + 85) +#define ActZIPAssPrj (ActChgCrsTT1stDay + 86) +#define ActReqDatAssPrj (ActChgCrsTT1stDay + 87) +#define ActChgDatAssPrj (ActChgCrsTT1stDay + 88) +#define ActDowAssPrj (ActChgCrsTT1stDay + 89) -#define ActSeeTst (ActChgCrsTT1stDay + 88) -#define ActAssTst (ActChgCrsTT1stDay + 89) -#define ActEdiTstQst (ActChgCrsTT1stDay + 90) -#define ActEdiOneTstQst (ActChgCrsTT1stDay + 91) -#define ActReqImpTstQst (ActChgCrsTT1stDay + 92) -#define ActImpTstQst (ActChgCrsTT1stDay + 93) -#define ActLstTstQst (ActChgCrsTT1stDay + 94) -#define ActRcvTstQst (ActChgCrsTT1stDay + 95) -#define ActReqRemTstQst (ActChgCrsTT1stDay + 96) -#define ActRemTstQst (ActChgCrsTT1stDay + 97) -#define ActShfTstQst (ActChgCrsTT1stDay + 98) -#define ActCfgTst (ActChgCrsTT1stDay + 99) -#define ActEnableTag (ActChgCrsTT1stDay + 100) -#define ActDisableTag (ActChgCrsTT1stDay + 101) -#define ActRenTag (ActChgCrsTT1stDay + 102) -#define ActRcvCfgTst (ActChgCrsTT1stDay + 103) +#define ActSeeTst (ActChgCrsTT1stDay + 90) +#define ActAssTst (ActChgCrsTT1stDay + 91) +#define ActEdiTstQst (ActChgCrsTT1stDay + 92) +#define ActEdiOneTstQst (ActChgCrsTT1stDay + 93) +#define ActReqImpTstQst (ActChgCrsTT1stDay + 94) +#define ActImpTstQst (ActChgCrsTT1stDay + 95) +#define ActLstTstQst (ActChgCrsTT1stDay + 96) +#define ActRcvTstQst (ActChgCrsTT1stDay + 97) +#define ActReqRemTstQst (ActChgCrsTT1stDay + 98) +#define ActRemTstQst (ActChgCrsTT1stDay + 99) +#define ActShfTstQst (ActChgCrsTT1stDay + 100) +#define ActCfgTst (ActChgCrsTT1stDay + 101) +#define ActEnableTag (ActChgCrsTT1stDay + 102) +#define ActDisableTag (ActChgCrsTT1stDay + 103) +#define ActRenTag (ActChgCrsTT1stDay + 104) +#define ActRcvCfgTst (ActChgCrsTT1stDay + 105) -#define ActReqSeeMyTstRes (ActChgCrsTT1stDay + 104) -#define ActSeeMyTstRes (ActChgCrsTT1stDay + 105) -#define ActSeeOneTstResMe (ActChgCrsTT1stDay + 106) -#define ActReqSeeUsrTstRes (ActChgCrsTT1stDay + 107) -#define ActSeeUsrTstRes (ActChgCrsTT1stDay + 108) -#define ActSeeOneTstResOth (ActChgCrsTT1stDay + 109) +#define ActReqSeeMyTstRes (ActChgCrsTT1stDay + 106) +#define ActSeeMyTstRes (ActChgCrsTT1stDay + 107) +#define ActSeeOneTstResMe (ActChgCrsTT1stDay + 108) +#define ActReqSeeUsrTstRes (ActChgCrsTT1stDay + 109) +#define ActSeeUsrTstRes (ActChgCrsTT1stDay + 110) +#define ActSeeOneTstResOth (ActChgCrsTT1stDay + 111) -#define ActSeeOneGam (ActChgCrsTT1stDay + 110) -#define ActPlyGam (ActChgCrsTT1stDay + 111) -#define ActPlyGam1stQst (ActChgCrsTT1stDay + 112) -#define ActPlyGamNxtQst (ActChgCrsTT1stDay + 113) -#define ActPlyGamAns (ActChgCrsTT1stDay + 114) -#define ActAnsGam (ActChgCrsTT1stDay + 115) -#define ActFrmNewGam (ActChgCrsTT1stDay + 116) -#define ActEdiOneGam (ActChgCrsTT1stDay + 117) -#define ActNewGam (ActChgCrsTT1stDay + 118) -#define ActChgGam (ActChgCrsTT1stDay + 119) -#define ActReqRemGam (ActChgCrsTT1stDay + 120) -#define ActRemGam (ActChgCrsTT1stDay + 121) -#define ActReqRstGam (ActChgCrsTT1stDay + 122) -#define ActRstGam (ActChgCrsTT1stDay + 123) -#define ActHidGam (ActChgCrsTT1stDay + 124) -#define ActShoGam (ActChgCrsTT1stDay + 125) -#define ActAddOneGamQst (ActChgCrsTT1stDay + 126) -#define ActGamLstTstQst (ActChgCrsTT1stDay + 127) -#define ActAddTstQstToGam (ActChgCrsTT1stDay + 128) -#define ActReqRemGamQst (ActChgCrsTT1stDay + 129) -#define ActRemGamQst (ActChgCrsTT1stDay + 130) -#define ActUp_GamQst (ActChgCrsTT1stDay + 131) -#define ActDwnGamQst (ActChgCrsTT1stDay + 132) +#define ActSeeOneGam (ActChgCrsTT1stDay + 112) +#define ActPlyGam (ActChgCrsTT1stDay + 113) +#define ActPlyGam1stQst (ActChgCrsTT1stDay + 114) +#define ActPlyGamNxtQst (ActChgCrsTT1stDay + 115) +#define ActPlyGamAns (ActChgCrsTT1stDay + 116) +#define ActAnsGam (ActChgCrsTT1stDay + 117) +#define ActFrmNewGam (ActChgCrsTT1stDay + 118) +#define ActEdiOneGam (ActChgCrsTT1stDay + 119) +#define ActNewGam (ActChgCrsTT1stDay + 120) +#define ActChgGam (ActChgCrsTT1stDay + 121) +#define ActReqRemGam (ActChgCrsTT1stDay + 122) +#define ActRemGam (ActChgCrsTT1stDay + 123) +#define ActReqRstGam (ActChgCrsTT1stDay + 124) +#define ActRstGam (ActChgCrsTT1stDay + 125) +#define ActHidGam (ActChgCrsTT1stDay + 126) +#define ActShoGam (ActChgCrsTT1stDay + 127) +#define ActAddOneGamQst (ActChgCrsTT1stDay + 128) +#define ActGamLstTstQst (ActChgCrsTT1stDay + 129) +#define ActAddTstQstToGam (ActChgCrsTT1stDay + 130) +#define ActReqRemGamQst (ActChgCrsTT1stDay + 131) +#define ActRemGamQst (ActChgCrsTT1stDay + 132) +#define ActUp_GamQst (ActChgCrsTT1stDay + 133) +#define ActDwnGamQst (ActChgCrsTT1stDay + 134) -#define ActSeeOneSvy (ActChgCrsTT1stDay + 133) -#define ActAnsSvy (ActChgCrsTT1stDay + 134) -#define ActFrmNewSvy (ActChgCrsTT1stDay + 135) -#define ActEdiOneSvy (ActChgCrsTT1stDay + 136) -#define ActNewSvy (ActChgCrsTT1stDay + 137) -#define ActChgSvy (ActChgCrsTT1stDay + 138) -#define ActReqRemSvy (ActChgCrsTT1stDay + 139) -#define ActRemSvy (ActChgCrsTT1stDay + 140) -#define ActReqRstSvy (ActChgCrsTT1stDay + 141) -#define ActRstSvy (ActChgCrsTT1stDay + 142) -#define ActHidSvy (ActChgCrsTT1stDay + 143) -#define ActShoSvy (ActChgCrsTT1stDay + 144) -#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 145) -#define ActRcvSvyQst (ActChgCrsTT1stDay + 146) -#define ActReqRemSvyQst (ActChgCrsTT1stDay + 147) -#define ActRemSvyQst (ActChgCrsTT1stDay + 148) +#define ActSeeOneSvy (ActChgCrsTT1stDay + 135) +#define ActAnsSvy (ActChgCrsTT1stDay + 136) +#define ActFrmNewSvy (ActChgCrsTT1stDay + 137) +#define ActEdiOneSvy (ActChgCrsTT1stDay + 138) +#define ActNewSvy (ActChgCrsTT1stDay + 139) +#define ActChgSvy (ActChgCrsTT1stDay + 140) +#define ActReqRemSvy (ActChgCrsTT1stDay + 141) +#define ActRemSvy (ActChgCrsTT1stDay + 142) +#define ActReqRstSvy (ActChgCrsTT1stDay + 143) +#define ActRstSvy (ActChgCrsTT1stDay + 144) +#define ActHidSvy (ActChgCrsTT1stDay + 145) +#define ActShoSvy (ActChgCrsTT1stDay + 146) +#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 147) +#define ActRcvSvyQst (ActChgCrsTT1stDay + 148) +#define ActReqRemSvyQst (ActChgCrsTT1stDay + 149) +#define ActRemSvyQst (ActChgCrsTT1stDay + 150) -#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 149) -#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 150) -#define ActEdiExaAnn (ActChgCrsTT1stDay + 151) -#define ActRcvExaAnn (ActChgCrsTT1stDay + 152) -#define ActPrnExaAnn (ActChgCrsTT1stDay + 153) -#define ActReqRemExaAnn (ActChgCrsTT1stDay + 154) -#define ActRemExaAnn (ActChgCrsTT1stDay + 155) -#define ActHidExaAnn (ActChgCrsTT1stDay + 156) -#define ActShoExaAnn (ActChgCrsTT1stDay + 157) +#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 151) +#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 152) +#define ActEdiExaAnn (ActChgCrsTT1stDay + 153) +#define ActRcvExaAnn (ActChgCrsTT1stDay + 154) +#define ActPrnExaAnn (ActChgCrsTT1stDay + 155) +#define ActReqRemExaAnn (ActChgCrsTT1stDay + 156) +#define ActRemExaAnn (ActChgCrsTT1stDay + 157) +#define ActHidExaAnn (ActChgCrsTT1stDay + 158) +#define ActShoExaAnn (ActChgCrsTT1stDay + 159) /*****************************************************************************/ /******************************** Files tab **********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 92a4b3f2c..1e7c864ac 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -455,10 +455,13 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.112.2 (2019-04-12)" +#define Log_PLATFORM_VERSION "SWAD 18.113 (2019-04-17)" #define CSS_FILE "swad18.112.1.css" #define JS_FILE "swad18.92.js" /* + 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; + Version 18.112.2: Apr 12, 2019 Changed icons for preassigned/non-preassigned projects. (242783 lines) Copy the following icon to icon public directory: sudo cp icon/user-slash.svg /var/www/html/swad/icon/ diff --git a/swad_database.c b/swad_database.c index b2ed910e5..8dc0f183d 100644 --- a/swad_database.c +++ b/swad_database.c @@ -2097,6 +2097,7 @@ mysql> DESCRIBE projects; | PrjCod | int(11) | NO | PRI | NULL | auto_increment | | CrsCod | int(11) | NO | MUL | -1 | | | DptCod | int(11) | NO | | -1 | | +| Locked | enum('N','Y') | NO | | N | | | Hidden | enum('N','Y') | NO | | N | | | Preassigned | enum('N','Y') | NO | | N | | | NumStds | int(11) | NO | | 1 | | @@ -2109,12 +2110,13 @@ mysql> DESCRIBE projects; | Materials | text | NO | | NULL | | | URL | varchar(255) | NO | | NULL | | +-------------+-------------------------------------+------+-----+---------+----------------+ -14 rows in set (0,00 sec) +15 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS projects (" "PrjCod INT NOT NULL AUTO_INCREMENT," "CrsCod INT NOT NULL DEFAULT -1," "DptCod INT NOT NULL DEFAULT -1," + "Locked ENUM('N','Y') NOT NULL DEFAULT 'N'," "Hidden ENUM('N','Y') NOT NULL DEFAULT 'N'," "Preassigned ENUM('N','Y') NOT NULL DEFAULT 'N'," "NumStds INT NOT NULL DEFAULT 1," diff --git a/swad_icon.c b/swad_icon.c index 37cbfda51..469479b70 100644 --- a/swad_icon.c +++ b/swad_icon.c @@ -288,6 +288,24 @@ 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) *******************/ /*****************************************************************************/ diff --git a/swad_icon.h b/swad_icon.h index 5838c71e2..7325a2df2 100644 --- a/swad_icon.h +++ b/swad_icon.h @@ -65,6 +65,8 @@ 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); diff --git a/swad_project.c b/swad_project.c index f7b3bcd4e..4b308441e 100644 --- a/swad_project.c +++ b/swad_project.c @@ -94,7 +94,13 @@ 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] = + { + "lock.svg", // Prj_PREASSIGNED + "unlock.svg", // Prj_NONPREASSIG + }; +*/ /*****************************************************************************/ /***************************** Private variables *****************************/ /*****************************************************************************/ @@ -169,10 +175,11 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject); static void Prj_GetParamPrjOrder (void); -static void Prj_PutFormsToRemEditOnePrj (long PrjCod,Prj_HiddenVisibl_t Hidden, +static void Prj_PutFormsToRemEditOnePrj (const struct Project *Prj, bool ICanViewProjectFiles); static bool Prj_CheckIfICanEditProject (long PrjCod); +static bool Prj_CheckIfICanLockProject (void); static void Prj_ResetProject (struct Project *Prj); @@ -948,18 +955,14 @@ static void Prj_ShowOneProject (unsigned NumIndex,struct Project *Prj, switch (ProjectView) { case Prj_LIST_PROJECTS: - fprintf (Gbl.F.Out,"", - Gbl.RowEvenOdd); - Prj_PutFormsToRemEditOnePrj (Prj->PrjCod,Prj->Hidden, - ICanViewProjectFiles); + case Prj_FILE_BROWSER_PROJECT: + fprintf (Gbl.F.Out,""); + Prj_PutFormsToRemEditOnePrj (Prj,ICanViewProjectFiles); fprintf (Gbl.F.Out,""); break; - case Prj_FILE_BROWSER_PROJECT: - fprintf (Gbl.F.Out,""); - Prj_PutFormsToRemEditOnePrj (Prj->PrjCod,Prj->Hidden, - ICanViewProjectFiles); - fprintf (Gbl.F.Out,""); - break; default: break; } @@ -2191,18 +2194,18 @@ void Prj_PutHiddenParamPrjOrder (void) /****************** Put a link (form) to edit one project ********************/ /*****************************************************************************/ -static void Prj_PutFormsToRemEditOnePrj (long PrjCod,Prj_HiddenVisibl_t Hidden, +static void Prj_PutFormsToRemEditOnePrj (const struct Project *Prj, bool ICanViewProjectFiles) { - Gbl.Prjs.PrjCod = PrjCod; // Used as parameter in contextual links + Gbl.Prjs.PrjCod = Prj->PrjCod; // Used as parameter in contextual links - if (Prj_CheckIfICanEditProject (PrjCod)) + if (Prj_CheckIfICanEditProject (Prj->PrjCod)) { /***** Put form to remove project *****/ Ico_PutContextualIconToRemove (ActReqRemPrj,Prj_PutCurrentParams); /***** Put form to hide/show project *****/ - switch (Hidden) + switch (Prj->Hidden) { case Prj_HIDDEN: Ico_PutContextualIconToUnhide (ActShoPrj,NULL,Prj_PutCurrentParams); @@ -2222,6 +2225,18 @@ static void Prj_PutFormsToRemEditOnePrj (long PrjCod,Prj_HiddenVisibl_t Hidden, /***** Put form to print project *****/ Ico_PutContextualIconToPrint (ActPrnOnePrj,Prj_PutCurrentParams); + + /***** 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; + } } /*****************************************************************************/ @@ -2261,6 +2276,22 @@ static bool Prj_CheckIfICanEditProject (long PrjCod) } } +/*****************************************************************************/ +/************************ Can I block a given project? ***********************/ +/*****************************************************************************/ + +static bool Prj_CheckIfICanLockProject (void) + { + switch (Gbl.Usrs.Me.Role.Logged) + { + case Rol_TCH: + case Rol_SYS_ADM: + return true; + default: + return false; + } + } + /*****************************************************************************/ /************************** List all the projects ****************************/ /*****************************************************************************/ @@ -2516,17 +2547,18 @@ void Prj_GetDataOfProjectByCod (struct Project *Prj) "SELECT PrjCod," // row[ 0] "CrsCod," // row[ 1] "DptCod," // row[ 2] - "Hidden," // row[ 3] - "Preassigned," // row[ 4] - "NumStds," // row[ 5] - "Proposal," // row[ 6] - "UNIX_TIMESTAMP(CreatTime)," // row[ 7] - "UNIX_TIMESTAMP(ModifTime)," // row[ 8] - "Title," // row[ 9] - "Description," // row[10] - "Knowledge," // row[11] - "Materials," // row[12] - "URL" // row[13] + "Locked," // row[ 3] + "Hidden," // row[ 4] + "Preassigned," // row[ 5] + "NumStds," // row[ 6] + "Proposal," // row[ 7] + "UNIX_TIMESTAMP(CreatTime)," // row[ 8] + "UNIX_TIMESTAMP(ModifTime)," // row[ 9] + "Title," // row[10] + "Description," // row[11] + "Knowledge," // row[12] + "Materials," // row[13] + "URL" // row[14] " FROM projects" " WHERE PrjCod=%ld AND CrsCod=%ld", Prj->PrjCod, @@ -2544,56 +2576,60 @@ void Prj_GetDataOfProjectByCod (struct Project *Prj) /* Get code of the department (row[2]) */ Prj->DptCod = Str_ConvertStrCodToLongCod (row[2]); - /* Get whether the project is hidden or not (row[3]) */ - Prj->Hidden = (row[3][0] == 'Y') ? Prj_HIDDEN : + /* Get whether the project is locked or not (row[3]) */ + Prj->Locked = (row[3][0] == 'Y') ? Prj_LOCKED : + Prj_UNLOCKED; + + /* Get whether the project is hidden or not (row[4]) */ + Prj->Hidden = (row[4][0] == 'Y') ? Prj_HIDDEN : Prj_VISIBL; - /* Get if project is preassigned or not (row[4]) */ - Prj->Preassigned = (row[4][0] == 'Y') ? Prj_PREASSIGNED : + /* Get if project is preassigned or not (row[5]) */ + Prj->Preassigned = (row[5][0] == 'Y') ? Prj_PREASSIGNED : Prj_NONPREASSIG; - /* Get if project is preassigned or not (row[5]) */ - NumLong = Str_ConvertStrCodToLongCod (row[5]); + /* Get if project is preassigned or not (row[6]) */ + NumLong = Str_ConvertStrCodToLongCod (row[6]); if (NumLong >= 0) Prj->NumStds = (unsigned) NumLong; else Prj->NumStds = 1; - /* Get project status (row[6]) */ + /* Get project status (row[7]) */ Prj->Proposal = Prj_PROPOSAL_DEFAULT; for (Proposal = (Prj_Proposal_t) 0; Proposal <= (Prj_Proposal_t) (Prj_NUM_PROPOSAL_TYPES - 1); Proposal++) - if (!strcmp (Prj_Proposal_DB[Proposal],row[6])) + if (!strcmp (Prj_Proposal_DB[Proposal],row[7])) { Prj->Proposal = Proposal; break; } - /* Get creation date/time (row[7] holds the creation UTC time) */ - Prj->CreatTime = Dat_GetUNIXTimeFromStr (row[7]); + /* Get creation date/time (row[8] holds the creation UTC time) */ + Prj->CreatTime = Dat_GetUNIXTimeFromStr (row[8]); - /* Get modification date/time (row[8] holds the modification UTC time) */ - Prj->ModifTime = Dat_GetUNIXTimeFromStr (row[8]); + /* Get modification date/time (row[9] holds the modification UTC time) */ + Prj->ModifTime = Dat_GetUNIXTimeFromStr (row[9]); - /* Get the title of the project (row[9]) */ - Str_Copy (Prj->Title,row[9], + /* Get the title of the project (row[10]) */ + Str_Copy (Prj->Title,row[10], Prj_MAX_BYTES_PROJECT_TITLE); - /* Get the description of the project (row[10]) */ - Str_Copy (Prj->Description,row[10], + /* Get the description of the project (row[11]) */ + Str_Copy (Prj->Description,row[11], Cns_MAX_BYTES_TEXT); - /* Get the required knowledge for the project (row[11]) */ - Str_Copy (Prj->Knowledge,row[11], + /* Get the required knowledge for the project (row[12]) */ + Str_Copy (Prj->Knowledge,row[12], Cns_MAX_BYTES_TEXT); - /* Get the required materials for the project (row[12]) */ - Str_Copy (Prj->Materials,row[12], + /* Get the required materials for the project (row[13]) */ + Str_Copy (Prj->Materials,row[13], Cns_MAX_BYTES_TEXT); - /* Get the URL of the project (row[13]) */ - Str_Copy (Prj->URL,row[13], + /* Get the URL of the project (row[14]) */ + Str_Copy (Prj->URL,row[14], Cns_MAX_BYTES_WWW); } @@ -2617,6 +2653,7 @@ static void Prj_ResetProject (struct Project *Prj) if (Prj->PrjCod <= 0) // If > 0 ==> keep value Prj->PrjCod = -1L; Prj->CrsCod = -1L; + Prj->Locked = Prj_UNLOCKED; Prj->Hidden = Prj_NEW_PRJ_HIDDEN_VISIBL_DEFAULT; Prj->Preassigned = Prj_NEW_PRJ_PREASSIGNED_NONPREASSIG_DEFAULT; Prj->NumStds = 1; @@ -2853,6 +2890,90 @@ void Prj_ShowProject (void) Prj_ShowProjectsInCurrentPage (); } +/*****************************************************************************/ +/************************** Lock edition of a project ************************/ +/*****************************************************************************/ + +void Prj_LockProjectEdition (void) + { + extern const char *Txt_The_edition_of_project_X_is_now_locked; + struct Project Prj; + + /***** Allocate memory for the project *****/ + Prj_AllocMemProject (&Prj); + + /***** Get parameters *****/ + Prj_GetParams (); + if ((Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) + Lay_ShowErrorAndExit ("Code of project is missing."); + + /***** Get data of the project from database *****/ + Prj_GetDataOfProjectByCod (&Prj); + + if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + { + /***** Hide project *****/ + DB_QueryUPDATE ("can not hide project", + "UPDATE projects SET Locked='Y'" + " WHERE PrjCod=%ld AND CrsCod=%ld", + Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); + + /***** Write message to show the change made *****/ + Ale_ShowAlert (Ale_SUCCESS,Txt_The_edition_of_project_X_is_now_locked, + Prj.Title); + } + else + Lay_NoPermissionExit (); + + /***** Free memory of the project *****/ + Prj_FreeMemProject (&Prj); + + /***** Show projects again *****/ + Prj_ShowProjectsInCurrentPage (); + } + +/*****************************************************************************/ +/************************* Unlock edition of a project ***********************/ +/*****************************************************************************/ + +void Prj_UnlockProjectEdition (void) + { + extern const char *Txt_The_edition_of_project_X_is_now_unlocked; + struct Project Prj; + + /***** Allocate memory for the project *****/ + Prj_AllocMemProject (&Prj); + + /***** Get parameters *****/ + Prj_GetParams (); + if ((Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) + Lay_ShowErrorAndExit ("Code of project is missing."); + + /***** Get data of the project from database *****/ + Prj_GetDataOfProjectByCod (&Prj); + + if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + { + /***** Show project *****/ + DB_QueryUPDATE ("can not show project", + "UPDATE projects SET Locked='N'" + " WHERE PrjCod=%ld AND CrsCod=%ld", + Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); + + /***** Write message to show the change made *****/ + Ale_ShowAlert (Ale_SUCCESS,Txt_The_edition_of_project_X_is_now_unlocked, + Prj.Title); + } + else + Lay_NoPermissionExit (); + + /***** Free memory of the project *****/ + Prj_FreeMemProject (&Prj); + + /***** Show projects again *****/ + Prj_ShowProjectsInCurrentPage (); + } + /*****************************************************************************/ /********************* Put a form to create/edit project *********************/ /*****************************************************************************/ diff --git a/swad_project.h b/swad_project.h index fe9795d74..fc667ec5d 100644 --- a/swad_project.h +++ b/swad_project.h @@ -57,6 +57,12 @@ typedef enum #define Prj_FILTER_PREASSIGNED_DEFAULT (1 << Prj_PREASSIGNED) // on #define Prj_FILTER_NONPREASSIG_DEFAULT (1 << Prj_NONPREASSIG) // on +typedef enum + { + Prj_LOCKED = 0, + Prj_UNLOCKED = 1, + } Prj_Locked_t; + /* Hidden projects / visible projects */ #define Prj_NUM_HIDDEN_VISIBL 2 typedef enum @@ -121,6 +127,7 @@ struct Project { long PrjCod; long CrsCod; + Prj_Locked_t Locked; Prj_HiddenVisibl_t Hidden; Prj_PreassignedNonpreassig_t Preassigned; unsigned NumStds; @@ -191,6 +198,8 @@ void Prj_ReqRemProject (void); void Prj_RemoveProject (void); void Prj_HideProject (void); void Prj_ShowProject (void); +void Prj_LockProjectEdition (void); +void Prj_UnlockProjectEdition (void); void Prj_RecFormProject (void); void Prj_RemoveCrsProjects (long CrsCod); diff --git a/swad_text.c b/swad_text.c index d751cdd47..fb341b258 100644 --- a/swad_text.c +++ b/swad_text.c @@ -17581,6 +17581,27 @@ const char *Txt_Locations = "Localizações"; #endif +const char *Txt_Lock = +#if L==1 // ca + "Tancar"; +#elif L==2 // de + "Abschließ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ć"; +#elif L==9 // pt + "Trancar"; +#endif + const char *Txt_LOG_More_info = #if L==1 // ca "Observaciones"; // Necessita traduccio @@ -43990,6 +44011,48 @@ const char *Txt_The_department_X_has_been_renamed_as_Y = // Warning: it is very "O departamento %s foi renomeado como %s."; #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ó del projecte %s ara està bloquejada."; +#elif L==2 // de + "Die Edition des Projekts %s ist jetzt gesperrt."; +#elif L==3 // en + "The edition of the project %s is now locked."; +#elif L==4 // es + "La edición del proyecto %s ahora está bloqueada."; +#elif L==5 // fr + "L'édition du projet %s est maintenant verrouillée."; +#elif L==6 // gn + "La edición del proyecto %s ahora está bloqueada."; // Okoteve traducción +#elif L==7 // it + "L'edizione del progetto %s è ora chiusa a chiave."; +#elif L==8 // pl + "Edycja projektu %s jest teraz zablokowana."; +#elif L==9 // pt + "A edição do projeto %s está 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ó del projecte %s ara està desbloquejada."; +#elif L==2 // de + "Die Edition des Projekts %s ist jetzt freigeschaltet."; +#elif L==3 // en + "The edition of the project %s is now unlocked."; +#elif L==4 // es + "La edición del proyecto %s ahora está desbloqueada."; +#elif L==5 // fr + "L'édition du projet %s est maintenant ouverte."; +#elif L==6 // gn + "La edición del proyecto %s ahora está desbloqueada."; // Okoteve traducción +#elif L==7 // it + "L'edizione del progetto %s è ora chiusa a chiave."; +#elif L==8 // pl + "Edycja projektu %s jest teraz odblokowana."; +#elif L==9 // pt + "A edição do projeto %s está 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 %s ha sido confirmado."; // Necessita traduccio @@ -51371,6 +51434,27 @@ const char *Txt_unknown_TIME = "desconhecido"; #endif +const char *Txt_Unlock = +#if L==1 // ca + "Desbloquejar"; +#elif L==2 // de + "Aufschließen"; +#elif L==3 // en + "Unlock"; +#elif L==4 // es + "Desbloquear"; +#elif L==5 // fr + "Déverouiller"; +#elif L==6 // gn + "Desbloquear"; // Okoteve traducción +#elif L==7 // it + "Sbloccare"; +#elif L==8 // pl + "Odblokować"; +#elif L==9 // pt + "Desbloquear"; +#endif + const char *Txt_unread_MESSAGE = #if L==1 // ca "no leído"; // Necessita traduccio