Version 15.29.4

This commit is contained in:
Antonio Cañas Vargas 2015-10-29 22:59:40 +01:00
parent 99bf9985af
commit efe35f9603
5 changed files with 82 additions and 54 deletions

View File

@ -659,18 +659,18 @@ function disableDetailedClicks () {
/******************************** Draw a month *******************************/
/*****************************************************************************/
function DrawCurrentMonth (id,TimeUTC) {
function DrawCurrentMonth (id,TimeUTC,CGI,FormEventParams) {
var d = new Date;
d.setTime(TimeUTC * 1000);
DrawMonth (id,d.getFullYear(),d.getMonth() + 1,d.getDate(),false,false);
DrawMonth (id,d.getFullYear(),d.getMonth() + 1,d.getDate(),false,false,CGI,FormEventParams);
}
/*****************************************************************************/
/******************************** Draw a month *******************************/
/*****************************************************************************/
function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView)
function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView,CGI,FormEventParams)
{
var NumDaysMonth = [
0,
@ -703,6 +703,8 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView)
// var ContinueSearching;
var ThisDayHasEvent;
var IsToday;
var FormEventIdNum = 0;
var FormEventId;
/***** Compute number of day of month for the first box *****/
/* The initial day of month can be -5, -4, -3, -2, -1, 0, or 1
@ -811,43 +813,37 @@ function DrawMonth (id,Year,Month,Today,DrawingCalendar,PrintView)
'">';
/* If day has an exam announcement */
/* if (!PrintView && ThisDayHasEvent)
if (!PrintView && ThisDayHasEvent)
{
Act_FormStart (ActSeeExaAnn);
fprintf (Gbl.F.Out,"<table style=\"width:100%%;\">"
"<tr>"
"<td class=\"%s\">",
ClassForDay);
Act_LinkFormSubmit (Gbl.Title,ClassForDay);
FormEventIdNum++;
FormEventId = 'cal_event_' + FormEventIdNum;
HTMLContent += '<form method="post" action="' +
CGI +
'" id="' +
FormEventId +
'">';
HTMLContent += FormEventParams;
HTMLContent += '<div class="' + ClassForDay + '">';
HTMLContent += '<a href="" class="' + ClassForDay + '"' +
' onclick="document.getElementById(\'' + FormEventId + '\').submit();return false;">';
}
else
{
*/
HTMLContent += '<div class="' + ClassForDay + '"';
/*
if (TextForDay)
fprintf (Gbl.F.Out," title=\"%s\"",TextForDay);
*/
HTMLContent += '>';
/*
}
*/
/* Write the day of month */
HTMLContent += Day;
/* If day has an exam announcement */
/*
if (!PrintView && ThisDayHasEvent)
{
fprintf (Gbl.F.Out,"</a>"
"</td>"
"</tr>"
"</table>");
Act_FormEnd ();
}
HTMLContent += '</a></div></form>';
else
*/
HTMLContent += '</div>';
HTMLContent += '</td>';

View File

@ -4368,9 +4368,11 @@ void Act_FormStartId (Act_Action_t NextAction,const char *Id)
static void Act_FormStartInternal (Act_Action_t NextAction,bool PutParameterLocationIfNoSesion,const char *Id,const char *Anchor)
{
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
if (!Gbl.InsideForm)
{
/* Start form */
fprintf (Gbl.F.Out,"<form method=\"post\" action=\"%s/%s",
Cfg_HTTPS_URL_SWAD_CGI,
Txt_STR_LANG_ID[Gbl.Prefs.Language]);
@ -4378,7 +4380,6 @@ static void Act_FormStartInternal (Act_Action_t NextAction,bool PutParameterLoca
if (Anchor[0])
fprintf (Gbl.F.Out,"#%s",Anchor);
fprintf (Gbl.F.Out,"\" id=\"%s\"",Id);
switch (Act_Actions[NextAction].BrowserWindow)
{
case Act_NEW_WINDOW:
@ -4388,37 +4389,60 @@ static void Act_FormStartInternal (Act_Action_t NextAction,bool PutParameterLoca
default:
break;
}
if (Act_Actions[NextAction].ContentType == Act_CONTENT_DATA)
fprintf (Gbl.F.Out," enctype=\"multipart/form-data\"");
fprintf (Gbl.F.Out,">");
/* Put basic form parameters */
Act_SetParamsForm (Params,NextAction,PutParameterLocationIfNoSesion);
fprintf (Gbl.F.Out,"%s",Params);
Gbl.InsideForm = true;
if (NextAction != ActUnk)
Par_PutHiddenParamLong ("act",Act_Actions[NextAction].ActCod);
if (Gbl.Session.Id[0])
Par_PutHiddenParamString ("ses",Gbl.Session.Id);
else if (PutParameterLocationIfNoSesion) // Extra parameters necessary when there's no open session
{
/* If session is open, course code will be get from session data,
but if there is not an open session, and next action is known, it is necessary to send a parameter with course code */
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // If course selected...
Crs_PutParamCrsCod (Gbl.CurrentCrs.Crs.CrsCod);
else if (Gbl.CurrentDeg.Deg.DegCod > 0) // If no course selected, but degree selected...
Deg_PutParamDegCod (Gbl.CurrentDeg.Deg.DegCod);
else if (Gbl.CurrentCtr.Ctr.CtrCod > 0) // If no degree selected, but centre selected...
Ctr_PutParamCtrCod (Gbl.CurrentCtr.Ctr.CtrCod);
else if (Gbl.CurrentIns.Ins.InsCod > 0) // If no centre selected, but institution selected...
Ins_PutParamInsCod (Gbl.CurrentIns.Ins.InsCod);
else if (Gbl.CurrentCty.Cty.CtyCod > 0) // If no institution selected, but country selected...
Cty_PutParamCtyCod (Gbl.CurrentCty.Cty.CtyCod);
}
}
}
// Params should have space for 256+256+Ses_LENGTH_SESSION_ID+256 bytes
void Act_SetParamsForm (char *Params,Act_Action_t NextAction,bool PutParameterLocationIfNoSesion)
{
char ParamAction[256];
char ParamSession[256+Ses_LENGTH_SESSION_ID];
char ParamLocation[256];
ParamAction[0] = '\0';
ParamSession[0] = '\0';
ParamLocation[0] = '\0';
if (NextAction != ActUnk)
sprintf (ParamAction,"<input type=\"hidden\" name=\"act\" value=\"%ld\" />",
Act_Actions[NextAction].ActCod);
if (Gbl.Session.Id[0])
sprintf (ParamSession,"<input type=\"hidden\" name=\"ses\" value=\"%s\" />",
Gbl.Session.Id);
else if (PutParameterLocationIfNoSesion) // Extra parameters necessary when there's no open session
{
/* If session is open, course code will be get from session data,
but if there is not an open session, and next action is known, it is necessary to send a parameter with course code */
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // If course selected...
sprintf (ParamLocation,"<input type=\"hidden\" name=\"crs\" value=\"%ld\" />",
Gbl.CurrentCrs.Crs.CrsCod);
else if (Gbl.CurrentDeg.Deg.DegCod > 0) // If no course selected, but degree selected...
sprintf (ParamLocation,"<input type=\"hidden\" name=\"deg\" value=\"%ld\" />",
Gbl.CurrentDeg.Deg.DegCod);
else if (Gbl.CurrentCtr.Ctr.CtrCod > 0) // If no degree selected, but centre selected...
sprintf (ParamLocation,"<input type=\"hidden\" name=\"ctr\" value=\"%ld\" />",
Gbl.CurrentCtr.Ctr.CtrCod);
else if (Gbl.CurrentIns.Ins.InsCod > 0) // If no centre selected, but institution selected...
sprintf (ParamLocation,"<input type=\"hidden\" name=\"ins\" value=\"%ld\" />",
Gbl.CurrentIns.Ins.InsCod);
else if (Gbl.CurrentCty.Cty.CtyCod > 0) // If no institution selected, but country selected...
sprintf (ParamLocation,"<input type=\"hidden\" name=\"cty\" value=\"%ld\" />",
Gbl.CurrentCty.Cty.CtyCod);
}
sprintf (Params,"%s%s%s",ParamAction,ParamSession,ParamLocation);
}
void Act_FormEnd (void)
{
if (Gbl.InsideForm)

View File

@ -1381,6 +1381,7 @@ void Act_FormStart (Act_Action_t NextAction);
void Act_FormGoToStart (Act_Action_t NextAction);
void Act_FormStartAnchor (Act_Action_t NextAction,const char *Anchor);
void Act_FormStartId (Act_Action_t NextAction,const char *Id);
void Act_SetParamsForm (char *Params,Act_Action_t NextAction,bool PutParameterLocationIfNoSesion);
void Act_FormEnd (void);
void Act_LinkFormSubmit (const char *Title,const char *LinkStyle);
void Act_LinkFormSubmitId (const char *Title,const char *LinkStyle,const char *Id);

View File

@ -55,9 +55,11 @@ void Cal_DrawCurrentMonth (void)
{
extern const char *Txt_MONTHS_CAPS[12];
extern const char *Txt_DAYS_CAPS[7];
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
unsigned Month;
unsigned DayOfWeek; /* 0, 1, 2, 3, 4, 5, 6 */
unsigned NumExamAnnouncement; // Number of exam announcement
char Params[256+256+Ses_LENGTH_SESSION_ID+256];
/***** Get list of holidays *****/
if (!Gbl.Hlds.LstIsRead)
@ -109,9 +111,13 @@ void Cal_DrawCurrentMonth (void)
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Year,
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Month,
Gbl.LstExamAnnouncements.Lst[NumExamAnnouncement].Day);
fprintf (Gbl.F.Out," DrawCurrentMonth ('CurrentMonth',%ld);\n"
Act_SetParamsForm (Params,ActSeeExaAnn,true);
fprintf (Gbl.F.Out," DrawCurrentMonth ('CurrentMonth',%ld,'%s/%s','%s');\n"
"</script>\n",
(long) Gbl.StartExecutionTimeUTC);
(long) Gbl.StartExecutionTimeUTC,
Cfg_HTTPS_URL_SWAD_CGI,Txt_STR_LANG_ID[Gbl.Prefs.Language],
Params);
/***** Free list of dates of exam announcements *****/
Exa_FreeListExamAnnouncements ();
@ -368,7 +374,7 @@ static void Cal_DrawMonth (unsigned RealYear,unsigned RealMonth,
"DAY_HLD_LIGHT";
/* Date being drawn is today? */
IsToday = (!PrintView && Month == RealMonth &&
IsToday = (Month == RealMonth &&
Year == Gbl.Now.Date.Year &&
Month == Gbl.Now.Date.Month &&
DayOfMonth == Gbl.Now.Date.Day);
@ -398,10 +404,10 @@ static void Cal_DrawMonth (unsigned RealYear,unsigned RealMonth,
/***** Write the box with the day *****/
fprintf (Gbl.F.Out,"<td class=\"%s\">",
IsToday ? (ThisDayHasEvent ? "TODAY_EVENT" :
"TODAY") :
(ThisDayHasEvent ? "DAY_EVENT" :
"DAY" ));
(IsToday && !PrintView) ? (ThisDayHasEvent ? "TODAY_EVENT" :
"TODAY") :
(ThisDayHasEvent ? "DAY_EVENT" :
"DAY" ));
/* If day has an exam announcement */
if (!PrintView && ThisDayHasEvent)

View File

@ -108,11 +108,12 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.29.3 (2015/10/29)"
#define Log_PLATFORM_VERSION "SWAD 15.29.4 (2015/10/29)"
// 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 15.29.4: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186729 lines)
Version 15.29.3: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186703 lines)
Version 15.29.2: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186694 lines)
Version 15.29.1: Oct 29, 2015 Writing JavaScript function to draw a month in browser. Not finished. (186694 lines)