Version 16.84

This commit is contained in:
Antonio Cañas Vargas 2016-12-03 19:22:06 +01:00
parent ef9d615329
commit 04c06799b1
6 changed files with 275 additions and 161 deletions

View File

@ -1350,8 +1350,10 @@ Profile:
1159. ActChgEvtMyAgd Modify data of an event from my agenda
1160. ActReqRemEvtMyAgd Request the removal of an event from my agenda
1161. ActRemEvtMyAgd Remove an event from my agenda
1162. ActHidEvtMyAgd Hide an event from my agenda
1163. ActShoEvtMyAgd Show an event from my agenda
NEW. ActHidEvtMyAgd Hide an event from my agenda
NEW. ActShoEvtMyAgd Show an event from my agenda
1162. ActPrvEvtMyAgd Make private an event from my agenda
1163. ActPubEvtMyAgd Make public an event from my agenda
1164. ActChkUsrAcc Check if already exists a new account without password associated to a ID
1165. ActCreUsrAcc Create new user account
@ -2801,8 +2803,10 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActChgEvtMyAgd */{1606,-1,TabUnk,ActSeeMyAgd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_RecFormEvent ,NULL},
/* ActReqRemEvtMyAgd */{1607,-1,TabUnk,ActSeeMyAgd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_AskRemEvent ,NULL},
/* ActRemEvtMyAgd */{1608,-1,TabUnk,ActSeeMyAgd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_RemoveEvent ,NULL},
/* ActHidEvtMyAgd */{1609,-1,TabUnk,ActSeeMyAgd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_SetEventPrivate ,NULL},
/* ActShoEvtMyAgd */{1610,-1,TabUnk,ActSeeMyAgd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_SetEventPublic ,NULL},
/* ActHidEvtMyAgd */{1612,-1,TabUnk,ActSeeMyAgd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_HideEvent ,NULL},
/* ActShoEvtMyAgd */{1613,-1,TabUnk,ActSeeMyAgd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_ShowEvent ,NULL},
/* ActPrvEvtMyAgd */{1609,-1,TabUnk,ActSeeMyAgd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_MakeEventPrivate ,NULL},
/* ActPubEvtMyAgd */{1610,-1,TabUnk,ActSeeMyAgd ,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Agd_MakeEventPublic ,NULL},
/* ActChkUsrAcc */{1584,-1,TabUnk,ActFrmMyAcc ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Acc_CheckIfEmptyAccountExists ,NULL},
/* ActCreUsrAcc */{1163,-1,TabUnk,ActFrmMyAcc ,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Acc_AfterCreationNewAccount ,NULL},
@ -4502,9 +4506,11 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActChgEvtMyAgd, // #1606
ActReqRemEvtMyAgd, // #1607
ActRemEvtMyAgd, // #1608
ActHidEvtMyAgd, // #1609
ActShoEvtMyAgd, // #1610
ActPrvEvtMyAgd, // #1609
ActPubEvtMyAgd, // #1610
ActSeeUsrAgd, // #1611
ActHidEvtMyAgd, // #1612
ActShoEvtMyAgd, // #1613
};
/*****************************************************************************/

View File

@ -55,9 +55,9 @@ typedef enum
typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (1+9+51+14+93+73+70+249+186+156+172+36+31+93)
#define Act_NUM_ACTIONS (1+9+51+14+93+73+70+249+186+156+172+36+31+95)
#define Act_MAX_ACTION_COD 1611
#define Act_MAX_ACTION_COD 1613
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 11
@ -1390,84 +1390,86 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
#define ActRemEvtMyAgd (ActSeeMyUsgRep+23)
#define ActHidEvtMyAgd (ActSeeMyUsgRep+24)
#define ActShoEvtMyAgd (ActSeeMyUsgRep+25)
#define ActChkUsrAcc (ActSeeMyUsgRep+26)
#define ActCreUsrAcc (ActSeeMyUsgRep+27)
#define ActRemID_Me (ActSeeMyUsgRep+28)
#define ActNewIDMe (ActSeeMyUsgRep+29)
#define ActRemOldNic (ActSeeMyUsgRep+30)
#define ActChgNic (ActSeeMyUsgRep+31)
#define ActRemMaiMe (ActSeeMyUsgRep+32)
#define ActNewMaiMe (ActSeeMyUsgRep+33)
#define ActCnfMai (ActSeeMyUsgRep+34)
#define ActFrmChgMyPwd (ActSeeMyUsgRep+35)
#define ActChgPwd (ActSeeMyUsgRep+36)
#define ActReqRemMyAcc (ActSeeMyUsgRep+37)
#define ActRemMyAcc (ActSeeMyUsgRep+38)
#define ActPrvEvtMyAgd (ActSeeMyUsgRep+26)
#define ActPubEvtMyAgd (ActSeeMyUsgRep+27)
#define ActChkUsrAcc (ActSeeMyUsgRep+28)
#define ActCreUsrAcc (ActSeeMyUsgRep+29)
#define ActRemID_Me (ActSeeMyUsgRep+30)
#define ActNewIDMe (ActSeeMyUsgRep+31)
#define ActRemOldNic (ActSeeMyUsgRep+32)
#define ActChgNic (ActSeeMyUsgRep+33)
#define ActRemMaiMe (ActSeeMyUsgRep+34)
#define ActNewMaiMe (ActSeeMyUsgRep+35)
#define ActCnfMai (ActSeeMyUsgRep+36)
#define ActFrmChgMyPwd (ActSeeMyUsgRep+37)
#define ActChgPwd (ActSeeMyUsgRep+38)
#define ActReqRemMyAcc (ActSeeMyUsgRep+39)
#define ActRemMyAcc (ActSeeMyUsgRep+40)
#define ActChgMyData (ActSeeMyUsgRep+39)
#define ActChgMyData (ActSeeMyUsgRep+41)
#define ActReqMyPho (ActSeeMyUsgRep+40)
#define ActDetMyPho (ActSeeMyUsgRep+41)
#define ActUpdMyPho (ActSeeMyUsgRep+42)
#define ActReqRemMyPho (ActSeeMyUsgRep+43)
#define ActRemMyPho (ActSeeMyUsgRep+44)
#define ActReqMyPho (ActSeeMyUsgRep+42)
#define ActDetMyPho (ActSeeMyUsgRep+43)
#define ActUpdMyPho (ActSeeMyUsgRep+44)
#define ActReqRemMyPho (ActSeeMyUsgRep+45)
#define ActRemMyPho (ActSeeMyUsgRep+46)
#define ActEdiPri (ActSeeMyUsgRep+45)
#define ActChgPriPho (ActSeeMyUsgRep+46)
#define ActChgPriPrf (ActSeeMyUsgRep+47)
#define ActEdiPri (ActSeeMyUsgRep+47)
#define ActChgPriPho (ActSeeMyUsgRep+48)
#define ActChgPriPrf (ActSeeMyUsgRep+49)
#define ActReqEdiMyIns (ActSeeMyUsgRep+48)
#define ActChgCtyMyIns (ActSeeMyUsgRep+49)
#define ActChgMyIns (ActSeeMyUsgRep+50)
#define ActChgMyCtr (ActSeeMyUsgRep+51)
#define ActChgMyDpt (ActSeeMyUsgRep+52)
#define ActChgMyOff (ActSeeMyUsgRep+53)
#define ActChgMyOffPho (ActSeeMyUsgRep+54)
#define ActReqEdiMyIns (ActSeeMyUsgRep+50)
#define ActChgCtyMyIns (ActSeeMyUsgRep+51)
#define ActChgMyIns (ActSeeMyUsgRep+52)
#define ActChgMyCtr (ActSeeMyUsgRep+53)
#define ActChgMyDpt (ActSeeMyUsgRep+54)
#define ActChgMyOff (ActSeeMyUsgRep+55)
#define ActChgMyOffPho (ActSeeMyUsgRep+56)
#define ActReqEdiMyNet (ActSeeMyUsgRep+55)
#define ActChgMyNet (ActSeeMyUsgRep+56)
#define ActReqEdiMyNet (ActSeeMyUsgRep+57)
#define ActChgMyNet (ActSeeMyUsgRep+58)
#define ActChgThe (ActSeeMyUsgRep+57)
#define ActReqChgLan (ActSeeMyUsgRep+58)
#define ActChgLan (ActSeeMyUsgRep+59)
#define ActChg1stDay (ActSeeMyUsgRep+60)
#define ActChgCol (ActSeeMyUsgRep+61)
#define ActHidLftCol (ActSeeMyUsgRep+62)
#define ActHidRgtCol (ActSeeMyUsgRep+63)
#define ActShoLftCol (ActSeeMyUsgRep+64)
#define ActShoRgtCol (ActSeeMyUsgRep+65)
#define ActChgIco (ActSeeMyUsgRep+66)
#define ActChgMnu (ActSeeMyUsgRep+67)
#define ActChgNtfPrf (ActSeeMyUsgRep+68)
#define ActChgThe (ActSeeMyUsgRep+59)
#define ActReqChgLan (ActSeeMyUsgRep+60)
#define ActChgLan (ActSeeMyUsgRep+61)
#define ActChg1stDay (ActSeeMyUsgRep+62)
#define ActChgCol (ActSeeMyUsgRep+63)
#define ActHidLftCol (ActSeeMyUsgRep+64)
#define ActHidRgtCol (ActSeeMyUsgRep+65)
#define ActShoLftCol (ActSeeMyUsgRep+66)
#define ActShoRgtCol (ActSeeMyUsgRep+67)
#define ActChgIco (ActSeeMyUsgRep+68)
#define ActChgMnu (ActSeeMyUsgRep+69)
#define ActChgNtfPrf (ActSeeMyUsgRep+70)
#define ActPrnUsrQR (ActSeeMyUsgRep+69)
#define ActPrnUsrQR (ActSeeMyUsgRep+71)
#define ActPrnMyTT (ActSeeMyUsgRep+70)
#define ActEdiTut (ActSeeMyUsgRep+71)
#define ActChgTut (ActSeeMyUsgRep+72)
#define ActChgMyTT1stDay (ActSeeMyUsgRep+73)
#define ActPrnMyTT (ActSeeMyUsgRep+72)
#define ActEdiTut (ActSeeMyUsgRep+73)
#define ActChgTut (ActSeeMyUsgRep+74)
#define ActChgMyTT1stDay (ActSeeMyUsgRep+75)
#define ActReqRemFilBrf (ActSeeMyUsgRep+74)
#define ActRemFilBrf (ActSeeMyUsgRep+75)
#define ActRemFolBrf (ActSeeMyUsgRep+76)
#define ActCopBrf (ActSeeMyUsgRep+77)
#define ActPasBrf (ActSeeMyUsgRep+78)
#define ActRemTreBrf (ActSeeMyUsgRep+79)
#define ActFrmCreBrf (ActSeeMyUsgRep+80)
#define ActCreFolBrf (ActSeeMyUsgRep+81)
#define ActCreLnkBrf (ActSeeMyUsgRep+82)
#define ActRenFolBrf (ActSeeMyUsgRep+83)
#define ActRcvFilBrfDZ (ActSeeMyUsgRep+84)
#define ActRcvFilBrfCla (ActSeeMyUsgRep+85)
#define ActExpBrf (ActSeeMyUsgRep+86)
#define ActConBrf (ActSeeMyUsgRep+87)
#define ActZIPBrf (ActSeeMyUsgRep+88)
#define ActReqDatBrf (ActSeeMyUsgRep+89)
#define ActChgDatBrf (ActSeeMyUsgRep+90)
#define ActDowBrf (ActSeeMyUsgRep+91)
#define ActReqRemFilBrf (ActSeeMyUsgRep+76)
#define ActRemFilBrf (ActSeeMyUsgRep+77)
#define ActRemFolBrf (ActSeeMyUsgRep+78)
#define ActCopBrf (ActSeeMyUsgRep+79)
#define ActPasBrf (ActSeeMyUsgRep+80)
#define ActRemTreBrf (ActSeeMyUsgRep+81)
#define ActFrmCreBrf (ActSeeMyUsgRep+82)
#define ActCreFolBrf (ActSeeMyUsgRep+83)
#define ActCreLnkBrf (ActSeeMyUsgRep+84)
#define ActRenFolBrf (ActSeeMyUsgRep+85)
#define ActRcvFilBrfDZ (ActSeeMyUsgRep+86)
#define ActRcvFilBrfCla (ActSeeMyUsgRep+87)
#define ActExpBrf (ActSeeMyUsgRep+88)
#define ActConBrf (ActSeeMyUsgRep+89)
#define ActZIPBrf (ActSeeMyUsgRep+90)
#define ActReqDatBrf (ActSeeMyUsgRep+91)
#define ActChgDatBrf (ActSeeMyUsgRep+92)
#define ActDowBrf (ActSeeMyUsgRep+93)
#define ActReqRemOldBrf (ActSeeMyUsgRep+92)
#define ActRemOldBrf (ActSeeMyUsgRep+93)
#define ActReqRemOldBrf (ActSeeMyUsgRep+94)
#define ActRemOldBrf (ActSeeMyUsgRep+95)
/*****************************************************************************/
/******************************** Public types *******************************/

View File

@ -78,7 +78,7 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod);
static void Agd_WriteEventAuthor (struct AgendaEvent *AgdEvent);
static void Agd_GetParamEventOrderType (void);
static void Agd_PutFormsToRemEditOneEvent (long AgdCod,bool Public);
static void Agd_PutFormsToRemEditOneEvent (struct AgendaEvent *AgdEvent);
static void Agd_PutParams (void);
static void Agd_GetListEvents (Agd_AgendaType_t AgendaType);
static void Agd_GetDataOfEventByCod (struct AgendaEvent *AgdEvent);
@ -315,8 +315,8 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
"</script>"
"</td>",
UniqueId,
AgdEvent.Public ? Dat_TimeStatusClassVisible[AgdEvent.TimeStatus] :
Dat_TimeStatusClassHidden[AgdEvent.TimeStatus],
AgdEvent.Hidden ? Dat_TimeStatusClassHidden[AgdEvent.TimeStatus] :
Dat_TimeStatusClassVisible[AgdEvent.TimeStatus],
Gbl.RowEvenOdd,
UniqueId,AgdEvent.TimeUTC[Agd_START_TIME],Txt_Today);
@ -328,8 +328,8 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
"</script>"
"</td>",
UniqueId,
AgdEvent.Public ? Dat_TimeStatusClassVisible[AgdEvent.TimeStatus] :
Dat_TimeStatusClassHidden[AgdEvent.TimeStatus],
AgdEvent.Hidden ? Dat_TimeStatusClassHidden[AgdEvent.TimeStatus] :
Dat_TimeStatusClassVisible[AgdEvent.TimeStatus],
Gbl.RowEvenOdd,
UniqueId,AgdEvent.TimeUTC[Agd_END_TIME],Txt_Today);
@ -338,8 +338,8 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
"<div class=\"%s\">%s</div>"
"</td>",
Gbl.RowEvenOdd,
AgdEvent.Public ? "ASG_TITLE" :
"ASG_TITLE_LIGHT",
AgdEvent.Hidden ? "ASG_TITLE_LIGHT" :
"ASG_TITLE",
AgdEvent.Event);
/* Event */
@ -348,8 +348,8 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
"</td>"
"</tr>",
Gbl.RowEvenOdd,
AgdEvent.Public ? "ASG_TITLE" :
"ASG_TITLE_LIGHT",
AgdEvent.Hidden ? "ASG_TITLE_LIGHT" :
"ASG_TITLE",
AgdEvent.Location);
/***** Write second row of data of this event *****/
@ -362,7 +362,7 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
/* Forms to remove/edit this event */
if (AgendaType == Agd_MY_AGENDA)
Agd_PutFormsToRemEditOneEvent (AgdEvent.AgdCod,AgdEvent.Public);
Agd_PutFormsToRemEditOneEvent (&AgdEvent);
fprintf (Gbl.F.Out,"</td>");
@ -379,8 +379,8 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
"</p>"
"</td>"
"</tr>",
AgdEvent.Public ? "DAT" :
"DAT_LIGHT",
AgdEvent.Hidden ? "DAT_LIGHT" :
"DAT",
Txt);
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
@ -422,8 +422,8 @@ static void Agd_WriteEventAuthor (struct AgendaEvent *AgdEvent)
Str_LimitLengthHTMLStr (FirstName,9);
Str_LimitLengthHTMLStr (Surnames,9);
fprintf (Gbl.F.Out,"<span class=\"%s\">%s %s</span>",
AgdEvent->Public ? "MSG_AUT" :
"MSG_AUT_LIGHT",
AgdEvent->Hidden ? "MSG_AUT_LIGHT" :
"MSG_AUT",
FirstName,Surnames);
/***** Free memory used for user's data *****/
@ -459,16 +459,18 @@ void Agd_PutHiddenParamEventsOrderType (void)
/******************* Put a link (form) to edit one event *********************/
/*****************************************************************************/
static void Agd_PutFormsToRemEditOneEvent (long AgdCod,bool Public)
static void Agd_PutFormsToRemEditOneEvent (struct AgendaEvent *AgdEvent)
{
extern const char *Txt_Remove;
extern const char *Txt_Show;
extern const char *Txt_Hide;
extern const char *Txt_Event_private_click_to_make_it_visible_to_the_users_of_your_courses;
extern const char *Txt_Event_visible_to_the_users_of_your_courses_click_to_make_it_private;
extern const char *Txt_Edit;
fprintf (Gbl.F.Out,"<div>");
Gbl.Agenda.AgdCodToEdit = AgdCod; // Used as parameter in contextual links
Gbl.Agenda.AgdCodToEdit = AgdEvent->AgdCod; // Used as parameter in contextual links
/***** Put form to remove event *****/
Lay_PutContextualLink (ActReqRemEvtMyAgd,Agd_PutParams,
@ -476,22 +478,34 @@ static void Agd_PutFormsToRemEditOneEvent (long AgdCod,bool Public)
Txt_Remove,NULL,
NULL);
/***** Put form to hide/show event *****/
if (AgdEvent->Hidden)
Lay_PutContextualLink (ActShoEvtMyAgd,Agd_PutParams,
"eye-slash-on64x64.png",
Txt_Show,NULL,
NULL);
else
Lay_PutContextualLink (ActHidEvtMyAgd,Agd_PutParams,
"eye-on64x64.png",
Txt_Hide,NULL,
NULL);
/***** Put form to edit event *****/
Lay_PutContextualLink (ActEdiOneEvtMyAgd,Agd_PutParams,
"edit64x64.png",
Txt_Edit,NULL,
NULL);
/***** Put form to hide/show event *****/
/***** Put form to make event public/private *****/
if (Gbl.Usrs.Me.AvailableRoles & (1 << Rol_TEACHER)) // I am a teacher in some courses
{
if (Public)
Lay_PutContextualLink (ActHidEvtMyAgd,Agd_PutParams,
if (AgdEvent->Public)
Lay_PutContextualLink (ActPrvEvtMyAgd,Agd_PutParams,
"open_on16x16.gif",
Txt_Event_visible_to_the_users_of_your_courses_click_to_make_it_private,NULL,
NULL);
else
Lay_PutContextualLink (ActShoEvtMyAgd,Agd_PutParams,
Lay_PutContextualLink (ActPubEvtMyAgd,Agd_PutParams,
"closed_on16x16.gif",
Txt_Event_private_click_to_make_it_visible_to_the_users_of_your_courses,NULL,
NULL);
@ -518,7 +532,7 @@ static void Agd_PutParams (void)
static void Agd_GetListEvents (Agd_AgendaType_t AgendaType)
{
char OrderBySubQuery[256];
char Query[2048];
char Query[1024];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned long NumRows;
@ -531,10 +545,16 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType)
switch (Gbl.Agenda.SelectedOrderType)
{
case Agd_ORDER_BY_START_DATE:
sprintf (OrderBySubQuery,"StartTime DESC,EndTime DESC,Location DESC,Event DESC");
sprintf (OrderBySubQuery,"StartTime DESC,"
"EndTime DESC,"
"Event DESC,"
"Location DESC");
break;
case Agd_ORDER_BY_END_DATE:
sprintf (OrderBySubQuery,"EndTime DESC,StartTime DESC,Location DESC,Event DESC");
sprintf (OrderBySubQuery,"EndTime DESC,"
"StartTime DESC,"
"Event DESC,"
"Location DESC");
break;
}
switch (AgendaType)
@ -542,7 +562,7 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType)
case Agd_USR_AGENDA:
sprintf (Query,"SELECT AgdCod"
" FROM agendas"
" WHERE UsrCod='%ld' AND Public='Y'"
" WHERE UsrCod='%ld' AND Public='Y' AND Hidden='N'"
" AND EndTime>NOW()" // Only present and future events
" ORDER BY %s",
Gbl.Usrs.Other.UsrDat.UsrCod,OrderBySubQuery);
@ -591,10 +611,10 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType)
static void Agd_GetDataOfEventByCod (struct AgendaEvent *AgdEvent)
{
char Query[1024];
char Query[512];
/***** Build query *****/
sprintf (Query,"SELECT AgdCod,UsrCod,Public,"
sprintf (Query,"SELECT AgdCod,UsrCod,Public,Hidden,"
"UNIX_TIMESTAMP(StartTime),"
"UNIX_TIMESTAMP(EndTime),"
"NOW()>EndTime," // Past event?
@ -622,6 +642,7 @@ static void Agd_GetDataOfEvent (struct AgendaEvent *AgdEvent,const char *Query)
AgdEvent->AgdCod = -1L;
AgdEvent->UsrCod = -1L;
AgdEvent->Public = false;
AgdEvent->Hidden = false;
AgdEvent->TimeUTC[Agd_START_TIME] =
AgdEvent->TimeUTC[Agd_END_TIME ] = (time_t) 0;
AgdEvent->TimeStatus = Dat_FUTURE;
@ -637,12 +658,13 @@ static void Agd_GetDataOfEvent (struct AgendaEvent *AgdEvent,const char *Query)
row[0] AgdCod
row[1] UsrCod
row[2] Public
row[3] UNIX_TIMESTAMP(StartTime)
row[4] UNIX_TIMESTAMP(EndTime)
row[5] NOW()>EndTime // Past event?
row[6] NOW()<StartTime // Future event?
row[7] Event
row[8] Location
row[3] Hidden
row[4] UNIX_TIMESTAMP(StartTime)
row[5] UNIX_TIMESTAMP(EndTime)
row[6] NOW()>EndTime // Past event?
row[7] NOW()<StartTime // Future event?
row[8] Event
row[9] Location
*/
row = mysql_fetch_row (mysql_res);
@ -655,22 +677,25 @@ static void Agd_GetDataOfEvent (struct AgendaEvent *AgdEvent,const char *Query)
/* Get whether the event is public or not (row[2]) */
AgdEvent->Public = (row[2][0] == 'Y');
/* Get start date (row[3] holds the start UTC time) */
AgdEvent->TimeUTC[Agd_START_TIME] = Dat_GetUNIXTimeFromStr (row[3]);
/* Get whether the event is hidden or not (row[3]) */
AgdEvent->Hidden = (row[3][0] == 'Y');
/* Get end date (row[4] holds the end UTC time) */
AgdEvent->TimeUTC[Agd_END_TIME ] = Dat_GetUNIXTimeFromStr (row[4]);
/* Get start date (row[4] holds the start UTC time) */
AgdEvent->TimeUTC[Agd_START_TIME] = Dat_GetUNIXTimeFromStr (row[4]);
/* Get whether the event is past, present or futur (row(5), row[6]) */
AgdEvent->TimeStatus = ((row[5][0] == '1') ? Dat_PAST :
((row[6][0] == '1') ? Dat_FUTURE :
/* Get end date (row[5] holds the end UTC time) */
AgdEvent->TimeUTC[Agd_END_TIME ] = Dat_GetUNIXTimeFromStr (row[5]);
/* Get whether the event is past, present or futur (row(6), row[7]) */
AgdEvent->TimeStatus = ((row[6][0] == '1') ? Dat_PAST :
((row[7][0] == '1') ? Dat_FUTURE :
Dat_PRESENT));
/* Get the event (row[7]) */
strcpy (AgdEvent->Event,row[7]);
/* Get the event (row[8]) */
strcpy (AgdEvent->Location,row[8]);
strcpy (AgdEvent->Event,row[8]);
/* Get the event (row[9]) */
strcpy (AgdEvent->Location,row[9]);
}
/***** Free structure that stores the query result *****/
@ -821,10 +846,75 @@ void Agd_RemoveEvent (void)
}
/*****************************************************************************/
/****************************** Set event private ****************************/
/********************************* Hide event ********************************/
/*****************************************************************************/
void Agd_SetEventPrivate (void)
void Agd_HideEvent (void)
{
extern const char *Txt_Event_X_is_now_hidden;
char Query[512];
struct AgendaEvent AgdEvent;
/***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of event is missing.");
/***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Agd_GetDataOfEventByCod (&AgdEvent);
/***** Set event private *****/
sprintf (Query,"UPDATE agendas SET Hidden='Y'"
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
AgdEvent.AgdCod,Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE (Query,"can not hide event");
/***** Write message to show the change made *****/
sprintf (Gbl.Message,Txt_Event_X_is_now_hidden,AgdEvent.Event);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
/***** Show events again *****/
Agd_ShowMyAgenda ();
}
/*****************************************************************************/
/******************************** Show event *********************************/
/*****************************************************************************/
void Agd_ShowEvent (void)
{
extern const char *Txt_Event_X_is_now_visible;
char Query[256];
struct AgendaEvent AgdEvent;
/***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of event is missing.");
/***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Agd_GetDataOfEventByCod (&AgdEvent);
/***** Set event public *****/
sprintf (Query,"UPDATE agendas SET Hidden='N'"
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
AgdEvent.AgdCod,Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE (Query,"can not show event");
/***** Write message to show the change made *****/
sprintf (Gbl.Message,Txt_Event_X_is_now_visible,
AgdEvent.Event);
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
/***** Show events again *****/
Agd_ShowMyAgenda ();
}
/*****************************************************************************/
/****************************** Make event private ***************************/
/*****************************************************************************/
void Agd_MakeEventPrivate (void)
{
extern const char *Txt_Event_X_is_now_private;
char Query[512];
@ -838,11 +928,11 @@ void Agd_SetEventPrivate (void)
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Agd_GetDataOfEventByCod (&AgdEvent);
/***** Set event private *****/
/***** Make event private *****/
sprintf (Query,"UPDATE agendas SET Public='N'"
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
AgdEvent.AgdCod,Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE (Query,"can not set event as private");
DB_QueryUPDATE (Query,"can not make event private");
/***** Write message to show the change made *****/
sprintf (Gbl.Message,Txt_Event_X_is_now_private,AgdEvent.Event);
@ -853,10 +943,10 @@ void Agd_SetEventPrivate (void)
}
/*****************************************************************************/
/********* Set event public (make it visible to users of my courses) *********/
/******** Make event public (make it visible to users of my courses) *********/
/*****************************************************************************/
void Agd_SetEventPublic (void)
void Agd_MakeEventPublic (void)
{
extern const char *Txt_Event_X_is_now_visible_to_users_of_your_courses;
char Query[256];
@ -870,11 +960,11 @@ void Agd_SetEventPublic (void)
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Agd_GetDataOfEventByCod (&AgdEvent);
/***** Set event public *****/
/***** Make event public *****/
sprintf (Query,"UPDATE agendas SET Public='Y'"
" WHERE AgdCod='%ld' AND UsrCod='%ld'",
AgdEvent.AgdCod,Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE (Query,"can not show event");
DB_QueryUPDATE (Query,"can not make event public");
/***** Write message to show the change made *****/
sprintf (Gbl.Message,Txt_Event_X_is_now_visible_to_users_of_your_courses,

View File

@ -47,8 +47,9 @@ typedef enum
struct AgendaEvent
{
long AgdCod;
bool Public;
long UsrCod;
bool Public;
bool Hidden;
time_t TimeUTC[Agd_NUM_DATES];
Dat_TimeStatus_t TimeStatus;
char Event[Agd_MAX_LENGTH_EVENT+1];
@ -75,11 +76,18 @@ void Agd_RequestCreatOrEditEvent (void);
void Agd_FreeListEvents (void);
long Agd_GetParamAgdCod (void);
void Agd_AskRemEvent (void);
void Agd_RemoveEvent (void);
void Agd_SetEventPrivate (void);
void Agd_SetEventPublic (void);
void Agd_HideEvent (void);
void Agd_ShowEvent (void);
void Agd_MakeEventPrivate (void);
void Agd_MakeEventPublic (void);
void Agd_RecFormEvent (void);
void Agd_RemoveUsrEvents (long UsrCod);
unsigned Agd_GetNumEventsFromUsr (long UsrCod);

View File

@ -187,15 +187,21 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.83 (2016-12-03)"
#define Log_PLATFORM_VERSION "SWAD 16.84 (2016-12-03)"
#define CSS_FILE "swad16.82.2.css"
#define JS_FILE "swad16.46.1.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
Version 16.84: Dec 03, 2016 Agenda events can be hidden. (209580 lines)
3 changes necessary in database:
ALTER TABLE agendas ADD COLUMN Hidden ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER Public;
DROP INDEX UsrCod ON agendas;
ALTER TABLE agendas ADD INDEX(UsrCod,Public,Hidden);
Version 16.83: Dec 03, 2016 Change in layout of agenda.
Agenda events are private by default. (? lines)
Agenda events are private by default. (209488 lines)
5 changes necessary in database:
ALTER TABLE agendas ADD COLUMN Public ENUM('N','Y') NOT NULL DEFAULT 'N' AFTER Hidden;
UPDATE agendas SET Public='Y' WHERE Hidden='N';

View File

@ -175,6 +175,37 @@ mysql> DESCRIBE admin;
"UNIQUE INDEX(UsrCod,Scope,Cod),"
"INDEX (Scope,Cod))");
/***** Table agendas *****/
/*
mysql> DESCRIBE agendas;
+-----------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------+------+-----+---------+----------------+
| AgdCod | int(11) | NO | PRI | NULL | auto_increment |
| UsrCod | int(11) | NO | MUL | NULL | |
| Public | enum('N','Y') | NO | | N | |
| Hidden | enum('N','Y') | NO | | N | |
| StartTime | datetime | NO | | NULL | |
| EndTime | datetime | NO | | NULL | |
| Event | varchar(255) | NO | | NULL | |
| Location | varchar(255) | NO | | NULL | |
| Txt | text | NO | | NULL | |
+-----------+---------------+------+-----+---------+----------------+
9 rows in set (0,00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS agendas ("
"AgdCod INT NOT NULL AUTO_INCREMENT,"
"UsrCod INT NOT NULL,"
"Public ENUM('N','Y') NOT NULL DEFAULT 'N',"
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
"StartTime DATETIME NOT NULL,"
"EndTime DATETIME NOT NULL,"
"Event VARCHAR(255) NOT NULL,"
"Location VARCHAR(255) NOT NULL,"
"Txt TEXT NOT NULL,"
"UNIQUE INDEX(AgdCod),"
"INDEX(UsrCod,Public,Hidden))");
/***** Table ann_seen *****/
/*
mysql> DESCRIBE ann_seen;
@ -214,35 +245,6 @@ mysql> DESCRIBE announcements;
"UNIQUE INDEX(AnnCod),"
"INDEX(Status))");
/***** Table agendas *****/
/*
mysql> DESCRIBE agendas;
+-----------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------+------+-----+---------+----------------+
| AgdCod | int(11) | NO | PRI | NULL | auto_increment |
| UsrCod | int(11) | NO | MUL | NULL | |
| Public | enum('N','Y') | NO | | N | |
| StartTime | datetime | NO | | NULL | |
| EndTime | datetime | NO | | NULL | |
| Event | varchar(255) | NO | | NULL | |
| Location | varchar(255) | NO | | NULL | |
| Txt | text | NO | | NULL | |
+-----------+---------------+------+-----+---------+----------------+
8 rows in set (0,00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS agendas ("
"AgdCod INT NOT NULL AUTO_INCREMENT,"
"UsrCod INT NOT NULL,"
"Public ENUM('N','Y') NOT NULL DEFAULT 'N',"
"StartTime DATETIME NOT NULL,"
"EndTime DATETIME NOT NULL,"
"Event VARCHAR(255) NOT NULL,"
"Location VARCHAR(255) NOT NULL,"
"Txt TEXT NOT NULL,"
"UNIQUE INDEX(AgdCod),"
"INDEX(UsrCod,Public))");
/***** Table asg_grp *****/
/*
mysql> DESCRIBE asg_grp;