Version 14.51.1

This commit is contained in:
Antonio Cañas Vargas 2015-01-02 12:57:26 +01:00
parent f4d8a97900
commit 31f7658e9d
11 changed files with 520 additions and 315 deletions

View File

@ -116,12 +116,12 @@ void Asg_SeeAssignments (void)
static void Asg_ShowAllAssignments (void)
{
extern const char *Txt_Assignments;
extern const char *Txt_ASG_ATT_OR_SVY_HELP_ORDER[2];
extern const char *Txt_ASG_ATT_OR_SVY_ORDER[2];
extern const char *Txt_Assignment;
extern const char *Txt_Upload_files_QUESTION;
extern const char *Txt_Folder;
extern const char *Txt_No_assignments;
tAsgsOrderType Order;
struct Pagination Pagination;
unsigned NumAsg;
@ -129,74 +129,77 @@ static void Asg_ShowAllAssignments (void)
/***** Get list of assignments *****/
Asg_GetListAssignments ();
/***** Compute variables related to pagination *****/
Pagination.NumItems = Gbl.Asgs.Num;
Pagination.CurrentPage = (int) Gbl.Pag.CurrentPage;
Pag_CalculatePagination (&Pagination);
Gbl.Pag.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,0,&Pagination);
/***** Start table *****/
Lay_StartRoundFrameTable10 (NULL,2,Txt_Assignments);
/***** Select whether show only my groups or all groups *****/
if (Gbl.CurrentCrs.Grps.NumGrps)
Asg_PutFormToSelectWhichGroupsToShow ();
if (Gbl.Asgs.Num) // There are assignments in current course
{
/***** Compute variables related to pagination *****/
Pagination.NumItems = Gbl.Asgs.Num;
Pagination.CurrentPage = (int) Gbl.Pag.CurrentPage;
Pag_CalculatePagination (&Pagination);
Gbl.Pag.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,0,&Pagination);
/***** Table head *****/
Lay_StartRoundFrameTable10 (NULL,2,NULL);
fprintf (Gbl.F.Out,"<tr>");
for (Order = Asg_ORDER_BY_START_DATE;
Order <= Asg_ORDER_BY_END_DATE;
Order++)
{
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\""
" style=\"text-align:left;\">");
Act_FormStart (ActSeeAsg);
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
Act_LinkFormSubmit (Txt_ASG_ATT_OR_SVY_HELP_ORDER[Order],"TIT_TBL");
if (Order == Gbl.Asgs.SelectedOrderType)
fprintf (Gbl.F.Out,"<u>");
fprintf (Gbl.F.Out,"%s",Txt_ASG_ATT_OR_SVY_ORDER[Order]);
if (Order == Gbl.Asgs.SelectedOrderType)
fprintf (Gbl.F.Out,"</u>");
fprintf (Gbl.F.Out,"</a>"
"</form>"
"</th>");
}
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\" style=\"text-align:left;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:center;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:center;\">"
"%s"
"</th>"
"</tr>",
Txt_Assignment,
Txt_Upload_files_QUESTION,
Txt_Folder);
/***** Write all the assignments *****/
for (NumAsg = Pagination.FirstItemVisible;
NumAsg <= Pagination.LastItemVisible;
NumAsg++)
Asg_ShowOneAssignment (Gbl.Asgs.LstAsgCods[NumAsg-1]);
/***** Table end *****/
Lay_EndRoundFrameTable10 ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,0,&Pagination);
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"5\">");
Asg_PutFormToSelectWhichGroupsToShow ();
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
else // There are no assignments in current course
Lay_ShowAlert (Lay_INFO,Txt_No_assignments);
/***** Table head *****/
fprintf (Gbl.F.Out,"<tr>");
for (Order = Asg_ORDER_BY_START_DATE;
Order <= Asg_ORDER_BY_END_DATE;
Order++)
{
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\""
" style=\"text-align:left;\">");
Act_FormStart (ActSeeAsg);
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
Act_LinkFormSubmit (Txt_ASG_ATT_OR_SVY_HELP_ORDER[Order],"TIT_TBL");
if (Order == Gbl.Asgs.SelectedOrderType)
fprintf (Gbl.F.Out,"<u>");
fprintf (Gbl.F.Out,"%s",Txt_ASG_ATT_OR_SVY_ORDER[Order]);
if (Order == Gbl.Asgs.SelectedOrderType)
fprintf (Gbl.F.Out,"</u>");
fprintf (Gbl.F.Out,"</a>"
"</form>"
"</th>");
}
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\" style=\"text-align:left;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:center;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:center;\">"
"%s"
"</th>"
"</tr>",
Txt_Assignment,
Txt_Upload_files_QUESTION,
Txt_Folder);
/***** Write all the assignments *****/
for (NumAsg = Pagination.FirstItemVisible;
NumAsg <= Pagination.LastItemVisible;
NumAsg++)
Asg_ShowOneAssignment (Gbl.Asgs.LstAsgCods[NumAsg-1]);
/***** Table end *****/
Lay_EndRoundFrameTable10 ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,0,&Pagination);
/***** Free list of assignments *****/
Asg_FreeListAssignments ();
@ -208,13 +211,11 @@ static void Asg_ShowAllAssignments (void)
static void Asg_PutFormToSelectWhichGroupsToShow (void)
{
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
Act_FormStart (ActSeeAsg);
Asg_PutHiddenParamAsgOrderType ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Grp_ShowSelectorWhichGrps ();
fprintf (Gbl.F.Out,"</form>"
"</div>");
fprintf (Gbl.F.Out,"</form>");
}
/*****************************************************************************/

View File

@ -147,11 +147,11 @@ void Att_SeeAttEvents (void)
static void Att_ShowAllAttEvents (void)
{
extern const char *Txt_Events;
extern const char *Txt_ASG_ATT_OR_SVY_HELP_ORDER[2];
extern const char *Txt_ASG_ATT_OR_SVY_ORDER[2];
extern const char *Txt_Event;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_No_events;
Att_EventsOrderType_t Order;
struct Pagination Pagination;
unsigned NumAttEvent;
@ -159,70 +159,73 @@ static void Att_ShowAllAttEvents (void)
/***** Get list of attendance events *****/
Att_GetListAttEvents (Att_NEWEST_FIRST);
/***** Compute variables related to pagination *****/
Pagination.NumItems = Gbl.AttEvents.Num;
Pagination.CurrentPage = (int) Gbl.Pag.CurrentPage;
Pag_CalculatePagination (&Pagination);
Gbl.Pag.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,0,&Pagination);
/***** Table start *****/
Lay_StartRoundFrameTable10 (NULL,2,Txt_Events);
/***** Select whether show only my groups or all groups *****/
if (Gbl.CurrentCrs.Grps.NumGrps)
Att_PutFormToSelectWhichGroupsToShow ();
if (Gbl.AttEvents.Num) // There are attendance events in current course
{
/***** Compute variables related to pagination *****/
Pagination.NumItems = Gbl.AttEvents.Num;
Pagination.CurrentPage = (int) Gbl.Pag.CurrentPage;
Pag_CalculatePagination (&Pagination);
Gbl.Pag.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,0,&Pagination);
/***** Table head *****/
Lay_StartRoundFrameTable10 (NULL,2,NULL);
fprintf (Gbl.F.Out,"<tr>");
for (Order = Att_ORDER_BY_START_DATE;
Order <= Att_ORDER_BY_END_DATE;
Order++)
{
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\""
" style=\"text-align:left;\">");
Act_FormStart (ActSeeAtt);
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
Act_LinkFormSubmit (Txt_ASG_ATT_OR_SVY_HELP_ORDER[Order],"TIT_TBL");
if (Order == Gbl.AttEvents.SelectedOrderType)
fprintf (Gbl.F.Out,"<u>");
fprintf (Gbl.F.Out,"%s",Txt_ASG_ATT_OR_SVY_ORDER[Order]);
if (Order == Gbl.AttEvents.SelectedOrderType)
fprintf (Gbl.F.Out,"</u>");
fprintf (Gbl.F.Out,"</a>"
"</form>"
"</th>");
}
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\" style=\"text-align:left;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"</tr>",
Txt_Event,
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]);
/***** Write all the attendance events *****/
for (NumAttEvent = Pagination.FirstItemVisible, Gbl.RowEvenOdd = 0;
NumAttEvent <= Pagination.LastItemVisible;
NumAttEvent++)
Att_ShowOneAttEvent (&Gbl.AttEvents.Lst[NumAttEvent-1],false);
/***** Table end *****/
Lay_EndRoundFrameTable10 ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,0,&Pagination);
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"4\">");
Att_PutFormToSelectWhichGroupsToShow ();
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
else // There are no attendance events in current course
Lay_ShowAlert (Lay_INFO,Txt_No_events);
/***** Table head *****/
fprintf (Gbl.F.Out,"<tr>");
for (Order = Att_ORDER_BY_START_DATE;
Order <= Att_ORDER_BY_END_DATE;
Order++)
{
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\""
" style=\"text-align:left;\">");
Act_FormStart (ActSeeAtt);
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
Act_LinkFormSubmit (Txt_ASG_ATT_OR_SVY_HELP_ORDER[Order],"TIT_TBL");
if (Order == Gbl.AttEvents.SelectedOrderType)
fprintf (Gbl.F.Out,"<u>");
fprintf (Gbl.F.Out,"%s",Txt_ASG_ATT_OR_SVY_ORDER[Order]);
if (Order == Gbl.AttEvents.SelectedOrderType)
fprintf (Gbl.F.Out,"</u>");
fprintf (Gbl.F.Out,"</a>"
"</form>"
"</th>");
}
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\" style=\"text-align:left;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:right;\">"
"%s"
"</th>"
"</tr>",
Txt_Event,
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]);
/***** Write all the attendance events *****/
for (NumAttEvent = Pagination.FirstItemVisible, Gbl.RowEvenOdd = 0;
NumAttEvent <= Pagination.LastItemVisible;
NumAttEvent++)
Att_ShowOneAttEvent (&Gbl.AttEvents.Lst[NumAttEvent-1],false);
/***** Table end *****/
Lay_EndRoundFrameTable10 ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,0,&Pagination);
/***** Free list of attendance events *****/
Att_FreeListAttEvents ();
@ -234,13 +237,11 @@ static void Att_ShowAllAttEvents (void)
static void Att_PutFormToSelectWhichGroupsToShow (void)
{
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
Act_FormStart (ActSeeAtt);
Att_PutHiddenParamAttOrderType ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Grp_ShowSelectorWhichGrps ();
fprintf (Gbl.F.Out,"</form>"
"</div>");
fprintf (Gbl.F.Out,"</form>");
}
/*****************************************************************************/

View File

@ -35,11 +35,12 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.51 (2015/01/01)"
#define Log_PLATFORM_VERSION "SWAD 14.51.1 (2015/01/02)"
// 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 | tail -1
/*
Version 14.51.1 :Jan 02, 2014 Changes in layout and titles of some options. (172963 lines)
Version 14.51 :Jan 01, 2014 Users can select horizontal or vertical menu. (172958 lines)
1 change necessary in Makefile:
Add swad_menu.o to list of object files

View File

@ -4186,7 +4186,7 @@ void Grp_ShowSelectorWhichGrps (void)
Grp_WhichGroups_t WhichGrps;
fprintf (Gbl.F.Out,"<ul style=\"list-style-type:none;"
" padding:0; margin:10px auto;\">");
" padding:0; margin:0 auto 10px auto;\">");
for (WhichGrps = Grp_ONLY_MY_GROUPS;
WhichGrps <= Grp_ALL_GROUPS;
WhichGrps++)

143
swad_menu.c Normal file
View File

@ -0,0 +1,143 @@
// swad_menu.h: menu (horizontal or vertical) selection
/*
SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2015 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include <stdio.h> // For fprintf, etc.
// #include <string.h>
// #include "swad_config.h"
#include "swad_database.h"
#include "swad_global.h"
// #include "swad_icon.h"
#include "swad_layout.h"
#include "swad_menu.h"
#include "swad_parameter.h"
#include "swad_preference.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/******************************** Private constants **************************/
/*****************************************************************************/
#define MAX_MENU_ID 16
const char *Mnu_MenuId[Mnu_NUM_MENUS] =
{
"horizontal",
"vertical",
};
const char *Mnu_MenuNames[Mnu_NUM_MENUS] =
{
"Horizontal",
"Vertical",
};
const char *Mnu_MenuIcons[Mnu_NUM_MENUS] =
{
"horizontal",
"vertical",
};
/*****************************************************************************/
/************* Put icons to select menu (horizontal or vertical) *************/
/*****************************************************************************/
void Mnu_PutIconsToSelectMenu (void)
{
extern const char *Txt_Menu;
extern const char *Txt_MENU_NAMES[Mnu_NUM_MENUS];
Mnu_Menu_t Menu;
Lay_StartRoundFrameTable10 (NULL,2,Txt_Menu);
fprintf (Gbl.F.Out,"<tr>");
for (Menu = (Mnu_Menu_t) 0;
Menu < Mnu_NUM_MENUS;
Menu++)
{
fprintf (Gbl.F.Out,"<td class=\"%s\">",
Menu == Gbl.Prefs.Menu ? "LAYOUT_ON" :
"LAYOUT_OFF");
Act_FormStart (ActChgMnu);
Par_PutHiddenParamUnsigned ("Menu",(unsigned) Menu);
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/%s32x32.gif\""
" alt=\"%s\" title=\"%s\" class=\"ICON32x32B\""
" style=\"margin:0 auto;\" />"
"</form>"
"</td>",
Gbl.Prefs.IconsURL,
Mnu_MenuIcons[Menu],
Txt_MENU_NAMES[Menu],
Txt_MENU_NAMES[Menu]);
}
fprintf (Gbl.F.Out,"</tr>");
Lay_EndRoundFrameTable10 ();
}
/*****************************************************************************/
/******************************** Change menu ********************************/
/*****************************************************************************/
void Mnu_ChangeMenu (void)
{
char Query[512];
/***** Get param with menu *****/
Gbl.Prefs.Menu = Mnu_GetParamMenu ();
/***** Store menu in database *****/
if (Gbl.Usrs.Me.Logged)
{
sprintf (Query,"UPDATE usr_data SET Menu='%u' WHERE UsrCod='%ld'",
(unsigned) Gbl.Prefs.Menu,Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE (Query,"can not update your preference about menu");
}
/***** Set preferences from current IP *****/
Prf_SetPrefsFromIP ();
}
/*****************************************************************************/
/************************* Get parameter with menu ***************************/
/*****************************************************************************/
Mnu_Menu_t Mnu_GetParamMenu (void)
{
char UnsignedStr[1+10+1];
unsigned UnsignedNum;
Par_GetParToText ("Menu",UnsignedStr,1+10);
if (sscanf (UnsignedStr,"%u",&UnsignedNum) == 1)
if (UnsignedNum < Mnu_NUM_MENUS)
return (Mnu_Menu_t) UnsignedNum;
return Mnu_MENU_UNKNOWN;
}

56
swad_menu.h Normal file
View File

@ -0,0 +1,56 @@
// swad_menu.h: menu (horizontal or vertical) selection
#ifndef _SWAD_MNU
#define _SWAD_MNU
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2015 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Public constants ******************************/
/*****************************************************************************/
#define Mnu_NUM_MENUS 2
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
typedef enum
{
Mnu_MENU_HORIZONTAL = 0,
Mnu_MENU_VERTICAL = 1,
Mnu_MENU_UNKNOWN = 2,
} Mnu_Menu_t; // Stored in database. Don't change numbers!
#define Mnu_MENU_DEFAULT Mnu_MENU_HORIZONTAL
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Mnu_PutIconsToSelectMenu (void);
void Mnu_ChangeMenu (void);
Mnu_Menu_t Mnu_GetParamMenu (void);
#endif

View File

@ -1121,7 +1121,7 @@ void Rec_ListRecordsStdsCrs (void)
void Rec_ListRecordOneTchCrs (void)
{
extern const char *Txt_Office_hours;
extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES];
/***** Asign users listing type depending on current action *****/
Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_TEACHERS;
@ -1156,7 +1156,7 @@ void Rec_ListRecordOneTchCrs (void)
Rec_ShowCommonRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat);
/* Office hours */
Lay_StartRoundFrameTable10 (NULL,0,Txt_Office_hours);
Lay_StartRoundFrameTable10 (NULL,0,Txt_TIMETABLE_TYPES[TT_TUTOR_TIMETABLE]);
fprintf (Gbl.F.Out,"<tr>"
"<td style=\"text-align:center;\">");
TT_ShowTimeTable (TT_TUTOR_TIMETABLE,Gbl.Usrs.Other.UsrDat.UsrCod);
@ -1175,7 +1175,7 @@ void Rec_ListRecordOneTchCrs (void)
void Rec_ListRecordsTchsCrs (void)
{
extern const char *Txt_You_must_select_one_ore_more_teachers;
extern const char *Txt_Office_hours;
extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES];
unsigned NumUsrs = 0;
const char *Ptr;
Rec_RecordViewType_t TypeOfView = (Gbl.CurrentAct == ActSeeRecSevTch) ? Rec_RECORD_LIST :
@ -1251,7 +1251,7 @@ void Rec_ListRecordsTchsCrs (void)
/* Office hours */
if (ShowOfficeHours)
{
Lay_StartRoundFrameTable10 (NULL,0,Txt_Office_hours);
Lay_StartRoundFrameTable10 (NULL,0,Txt_TIMETABLE_TYPES[TT_TUTOR_TIMETABLE]);
fprintf (Gbl.F.Out,"<tr>"
"<td style=\"text-align:center;\">");
TT_ShowTimeTable (TT_TUTOR_TIMETABLE,UsrDat.UsrCod);

View File

@ -164,11 +164,11 @@ void Svy_SeeAllSurveys (void)
static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst)
{
extern const char *Txt_Surveys;
extern const char *Txt_ASG_ATT_OR_SVY_HELP_ORDER[2];
extern const char *Txt_ASG_ATT_OR_SVY_ORDER[2];
extern const char *Txt_Survey;
extern const char *Txt_Status;
extern const char *Txt_No_surveys;
tSvysOrderType Order;
struct Pagination Pagination;
unsigned NumSvy;
@ -184,69 +184,72 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst)
/***** Get list of surveys *****/
Svy_GetListSurveys ();
/***** Compute variables related to pagination *****/
Pagination.NumItems = Gbl.Svys.Num;
Pagination.CurrentPage = (int) Gbl.Pag.CurrentPage;
Pag_CalculatePagination (&Pagination);
Gbl.Pag.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,0,&Pagination);
/***** Start table *****/
Lay_StartRoundFrameTable10 (NULL,2,Txt_Surveys);
/***** Select whether show only my groups or all groups *****/
if (Gbl.CurrentCrs.Grps.NumGrps)
Svy_PutFormToSelectWhichGroupsToShow ();
if (Gbl.Svys.Num) // There are surveys in current course
{
/***** Compute variables related to pagination *****/
Pagination.NumItems = Gbl.Svys.Num;
Pagination.CurrentPage = (int) Gbl.Pag.CurrentPage;
Pag_CalculatePagination (&Pagination);
Gbl.Pag.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,0,&Pagination);
/***** Table head *****/
Lay_StartRoundFrameTable10 (NULL,2,NULL);
fprintf (Gbl.F.Out,"<tr>");
for (Order = Svy_ORDER_BY_START_DATE;
Order <= Svy_ORDER_BY_END_DATE;
Order++)
{
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\" style=\"text-align:center;\">");
Act_FormStart (ActSeeAllSvy);
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
Act_LinkFormSubmit (Txt_ASG_ATT_OR_SVY_HELP_ORDER[Order],"TIT_TBL");
if (Order == Gbl.Svys.SelectedOrderType)
fprintf (Gbl.F.Out,"<u>");
fprintf (Gbl.F.Out,"%s",Txt_ASG_ATT_OR_SVY_ORDER[Order]);
if (Order == Gbl.Svys.SelectedOrderType)
fprintf (Gbl.F.Out,"</u>");
fprintf (Gbl.F.Out,"</a>"
"</form>"
"</th>");
}
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\" style=\"text-align:center;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:center;\">"
"%s"
"</th>"
"</tr>",
Txt_Survey,
Txt_Status);
/***** Write all the surveys *****/
for (NumSvy = Pagination.FirstItemVisible;
NumSvy <= Pagination.LastItemVisible;
NumSvy++)
Svy_ShowOneSurvey (Gbl.Svys.LstSvyCods[NumSvy-1],SvyQst,false);
/***** Table end *****/
Lay_EndRoundFrameTable10 ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,0,&Pagination);
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"4\">");
Svy_PutFormToSelectWhichGroupsToShow ();
fprintf (Gbl.F.Out,"</td>"
"</tr>");
}
else // There are no surveys in current course
Lay_ShowAlert (Lay_INFO,Txt_No_surveys);
/***** Table head *****/
fprintf (Gbl.F.Out,"<tr>");
for (Order = Svy_ORDER_BY_START_DATE;
Order <= Svy_ORDER_BY_END_DATE;
Order++)
{
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\" style=\"text-align:center;\">");
Act_FormStart (ActSeeAllSvy);
Grp_PutParamWhichGrps ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Par_PutHiddenParamUnsigned ("Order",(unsigned) Order);
Act_LinkFormSubmit (Txt_ASG_ATT_OR_SVY_HELP_ORDER[Order],"TIT_TBL");
if (Order == Gbl.Svys.SelectedOrderType)
fprintf (Gbl.F.Out,"<u>");
fprintf (Gbl.F.Out,"%s",Txt_ASG_ATT_OR_SVY_ORDER[Order]);
if (Order == Gbl.Svys.SelectedOrderType)
fprintf (Gbl.F.Out,"</u>");
fprintf (Gbl.F.Out,"</a>"
"</form>"
"</th>");
}
fprintf (Gbl.F.Out,"<th class=\"TIT_TBL\" style=\"text-align:center;\">"
"%s"
"</th>"
"<th class=\"TIT_TBL\" style=\"text-align:center;\">"
"%s"
"</th>"
"</tr>",
Txt_Survey,
Txt_Status);
/***** Write all the surveys *****/
for (NumSvy = Pagination.FirstItemVisible;
NumSvy <= Pagination.LastItemVisible;
NumSvy++)
Svy_ShowOneSurvey (Gbl.Svys.LstSvyCods[NumSvy-1],SvyQst,false);
/***** Table end *****/
Lay_EndRoundFrameTable10 ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,0,&Pagination);
/***** Free list of surveys *****/
Svy_FreeListSurveys ();
@ -278,13 +281,11 @@ static bool Svy_CheckIfICanCreateSvy (void)
static void Svy_PutFormToSelectWhichGroupsToShow (void)
{
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
Act_FormStart (ActSeeAllSvy);
Svy_PutHiddenParamSvyOrderType ();
Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage);
Grp_ShowSelectorWhichGrps ();
fprintf (Gbl.F.Out,"</form>"
"</div>");
fprintf (Gbl.F.Out,"</form>");
}
/*****************************************************************************/
@ -2389,7 +2390,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,ch
extern const char *Txt_New_question;
extern const char *Txt_Stem;
extern const char *Txt_Type;
extern const char *Txt_SVY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES];
extern const char *Txt_SURVEY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES];
extern const char *Txt_Send;
char Query[512];
MYSQL_RES *mysql_res;
@ -2500,7 +2501,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,ch
if (AnsType == SvyQst->AnswerType)
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />%s<br />",
Txt_SVY_STR_ANSWER_TYPES[AnsType]);
Txt_SURVEY_STR_ANSWER_TYPES[AnsType]);
}
fprintf (Gbl.F.Out,"</td>"
"</tr>");
@ -2946,7 +2947,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
extern const char *Txt_No_INDEX;
extern const char *Txt_Type;
extern const char *Txt_Question;
extern const char *Txt_SVY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES];
extern const char *Txt_SURVEY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES];
extern const char *Txt_This_survey_has_no_questions;
extern const char *Txt_Send_survey;
extern const char *Txt_Remove_question;
@ -3064,7 +3065,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ
" vertical-align:top; background-color:%s;\">"
"%s",
Gbl.ColorRows[Gbl.RowEvenOdd],
Txt_SVY_STR_ANSWER_TYPES[SvyQst->AnswerType]);
Txt_SURVEY_STR_ANSWER_TYPES[SvyQst->AnswerType]);
/* Write the stem (row[3]) */
Svy_WriteQstStem (row[3],"TEST_EDI");

View File

@ -18206,7 +18206,7 @@ const char *Txt_MENU_SUBTITLE[Act_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] =
#elif L==4
"Horaire"
#elif L==5
"Horario de clases de la asignatura"// Okoteve traducción
"Horario de clases de la asignatura" // Okoteve traducción
#elif L==6
"Orario del corso"
#elif L==7
@ -22043,27 +22043,6 @@ const char *Txt_No =
"N&atilde;o";
#endif
const char *Txt_No_assignments =
#if L==0
"No hay actividades."; // Necessita traduccio
#elif L==1
"Keine Aufgaben.";
#elif L==2
"No assignments.";
#elif L==3
"No hay actividades.";
#elif L==4
"Il n'y a pas d'activit&eacute;s.";
#elif L==5
"No hay actividades."; // Okoteve traducción
#elif L==6
"Non ci sono attivit&agrave;.";
#elif L==7
"Nr zadania.";
#elif L==8
"N&atilde;o h&aacute; atividades.";
#endif
const char *Txt_No_announcements_of_exams_of_X = // Warning: it is very important to include %s in the following sentences
#if L==0
"No hay convocatorias de examen de <strong>%s</strong>."; // Necessita traduccio
@ -22232,27 +22211,6 @@ const char *Txt_No_enrollment_requests =
"No enrollment requests."; // Necessita de tradução
#endif
const char *Txt_No_events =
#if L==0
"No hay eventos."; // Necessita traduccio
#elif L==1
"Keine Ereignisse.";
#elif L==2
"No events.";
#elif L==3
"No hay eventos.";
#elif L==4
"Il n'y a pas d'&eacute;v&eacute;nements.";
#elif L==5
"No hay eventos."; // Okoteve traducción
#elif L==6
"Non ci sono eventi.";
#elif L==7
"Nr wydarzenie.";
#elif L==8
"N&atilde;o h&aacute; eventos.";
#endif
const char *Txt_No_file_index_html_index_htm_found_within_the_ZIP_file =
#if L==0
"No se ha encontrado un archivo <em>index.html</em> / <em>index.htm</em>"
@ -22943,27 +22901,6 @@ const char *Txt_no_subject =
"sem assunto";
#endif
const char *Txt_No_surveys =
#if L==0
"No hi ha enquestes.";
#elif L==1
"Keine Umfragen.";
#elif L==2
"No surveys.";
#elif L==3
"No hay encuestas.";
#elif L==4
"Il n'y a pas de sondages.";
#elif L==5
"No hay encuestas."; // Okoteve traducción
#elif L==6
"Non ci sono sondaggi.";
#elif L==7
"Brak badan.";
#elif L==8
"N&atilde;o h&aacute; inqu&eacute;ritos.";
#endif
const char *Txt_no_tags = // Tags used in test
#if L==0
"sin descriptores"; // Necessita traduccio
@ -24668,27 +24605,6 @@ const char *Txt_Office =
"Gabinete";
#endif
const char *Txt_Office_hours =
#if L==0
"Horari de tutories";
#elif L==1
"Gesch&auml;ftszeiten";
#elif L==2
"Office hours";
#elif L==3
"Horario de tutor&iacute;as";
#elif L==4
"Heures de tuteur";
#elif L==5
"Horario de tutor&iacute;as"; // Okoteve traducción
#elif L==6
"Orario di tutoraggi";
#elif L==7
"Godziny pracy";
#elif L==8
"Hor&aacute;rio de tutor";
#endif
const char *Txt_Official_students =
#if L==0
"Estudiants oficials";
@ -36045,7 +35961,7 @@ const char *Txt_Survey_X_reset = // Warning: it is very important to include %s
"Inqu&eacute;rito <strong>%s</strong> fixado em zero.";
#endif
const char *Txt_SVY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES] =
const char *Txt_SURVEY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES] =
{
#if L==0
"Elecci&oacute; &uacute;nica"
@ -36088,6 +36004,27 @@ const char *Txt_SVY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES] =
#endif
};
const char *Txt_Surveys =
#if L==0
"Enquestes";
#elif L==1
"Umfragen";
#elif L==2
"Surveys";
#elif L==3
"Encuestas";
#elif L==4
"Sondages";
#elif L==5
"Encuestas"; // Okoteve traducción
#elif L==6
"Sondaggi";
#elif L==7
"Ankiety";
#elif L==8
"Inqu&eacute;ritos";
#endif
const char *Txt_Syllabus =
#if L==0
"Programa";
@ -43242,8 +43179,74 @@ const char *Txt_time =
"tempo";
#endif
const char *Txt_TIME_TABLE_CLASS_TYPES[TT_NUM_CLASS_TYPES] =
{
const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES] =
{
// TT_COURSE_TIMETABLE
#if L==0
"Horari de classes de l'assignatura"
#elif L==1
"Stundenplan"
#elif L==2
"Class timetable"
#elif L==3
"Horario de clases de la asignatura"
#elif L==4
"Horaire"
#elif L==5
"Horario de clases de la asignatura" // Okoteve traducción
#elif L==6
"Orario del corso"
#elif L==7
"Harmonogram klasy"
#elif L==8
"Hor&aacute;rio"
#endif
,
// TT_MY_TIMETABLE
#if L==0
"Horari de les meves assignatures"
#elif L==1
"Stundenplan"
#elif L==2
"My timetable"
#elif L==3
"Horario de mis asignaturas"
#elif L==4
"Horaire mes mati&egrave;res"
#elif L==5
"Horario de mis asignaturas" // Okoteve traducción
#elif L==6
"Orario dei miei corsi"
#elif L==7
"M&oacute;j plan lekcji"
#elif L==8
"Hor&aacute;rio minha disciplinas"
#endif
,
// TT_TUTOR_TIMETABLE
#if L==0
"Horari de tutories"
#elif L==1
"Gesch&auml;ftszeiten"
#elif L==2
"Office hours"
#elif L==3
"Horario de tutor&iacute;as"
#elif L==4
"Heures de tuteur"
#elif L==5
"Horario de tutor&iacute;as" // Okoteve traducción
#elif L==6
"Orario di tutoraggi"
#elif L==7
"Godziny pracy"
#elif L==8
"Hor&aacute;rio de tutor"
#endif
};
const char *Txt_TIMETABLE_CLASS_TYPES[TT_NUM_CLASS_TYPES] =
{
// TT_NO_CLASS
#if L==0
"Lliure"

View File

@ -221,13 +221,14 @@ void TT_ShowClassTimeTable (void)
extern const char *The_ClassFormul[The_NUM_THEMES];
extern const char *Txt_Edit;
extern const char *Txt_Edit_office_hours;
extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES];
TT_TimeTableType_t TimeTableType = TT_COURSE_TIMETABLE;
bool PutEditButton = (Gbl.CurrentAct == ActSeeCrsTimTbl &&
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER);
bool PutEditOfficeHours = (Gbl.CurrentAct == ActSeeMyTimTbl &&
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_ROLE_TEACHER)));
bool PrintView = (Gbl.CurrentAct == ActSeeCrsTimTbl ||
Gbl.CurrentAct == ActSeeMyTimTbl);
bool PrintView = (Gbl.CurrentAct == ActPrnCrsTimTbl ||
Gbl.CurrentAct == ActPrnMyTimTbl);
/***** Get whether to show only my groups or all groups *****/
Grp_GetParamWhichGrps ();
@ -246,7 +247,7 @@ void TT_ShowClassTimeTable (void)
}
/***** Put buttons *****/
if (PutEditButton || PutEditOfficeHours || PrintView)
if (PutEditButton || PutEditOfficeHours || !PrintView)
{
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
@ -267,7 +268,7 @@ void TT_ShowClassTimeTable (void)
fprintf (Gbl.F.Out,"</form>");
}
if (PrintView)
if (!PrintView)
{
Lay_PutLinkToPrintView1 (Gbl.CurrentAct == ActSeeCrsTimTbl ? ActPrnCrsTimTbl :
ActPrnMyTimTbl);
@ -278,7 +279,7 @@ void TT_ShowClassTimeTable (void)
}
/***** Start frame *****/
Lay_StartRoundFrameTable10 (NULL,0,NULL);
Lay_StartRoundFrameTable10 (NULL,0,Txt_TIMETABLE_TYPES[TimeTableType]);
/***** Start time table drawing *****/
if (TimeTableType == TT_COURSE_TIMETABLE)
@ -286,6 +287,9 @@ void TT_ShowClassTimeTable (void)
Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentCrs.Crs.CrsCod);
if (PrintView)
/***** Show whether only my groups or all groups are selected *****/
TT_ShowTimeTableGrpsSelected ();
else
{
/***** Select whether show only my groups or all groups *****/
fprintf (Gbl.F.Out,"<tr>"
@ -296,9 +300,6 @@ void TT_ShowClassTimeTable (void)
"</td>"
"</tr>");
}
else
/***** Show whether only my groups or all groups are selected *****/
TT_ShowTimeTableGrpsSelected ();
/***** Show the time table *****/
fprintf (Gbl.F.Out,"<tr>"
@ -350,7 +351,7 @@ void TT_ShowMyTutTimeTable (void)
{
extern const char *The_ClassFormul[The_NUM_THEMES];
extern const char *Txt_Show_timetable;
extern const char *Txt_Office_hours;
extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES];
/***** Link (form) to see my timetable *****/
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
@ -361,7 +362,7 @@ void TT_ShowMyTutTimeTable (void)
"</div>");
/***** Time table *****/
Lay_StartRoundFrameTable10 ("98%",0,Txt_Office_hours);
Lay_StartRoundFrameTable10 (NULL,0,Txt_TIMETABLE_TYPES[TT_TUTOR_TIMETABLE]);
fprintf (Gbl.F.Out,"<tr>"
"<td style=\"text-align:center;\">");
TT_ShowTimeTable (TT_TUTOR_TIMETABLE,Gbl.Usrs.Me.UsrDat.UsrCod);
@ -780,7 +781,7 @@ static void TT_DrawTimeTable (void)
}
/***** Table start *****/
fprintf (Gbl.F.Out,"<table style=\"min-width:520px;\">");
fprintf (Gbl.F.Out,"<table style=\"min-width:520px; margin:0 auto;\">");
/***** Top row used for column adjustement *****/
TT_TimeTableDrawAdjustRow ();
@ -1035,7 +1036,7 @@ static void TT_TimeTableDrawCell (unsigned Day,unsigned Hour,unsigned Column,uns
long CrsCod,TT_HourType_t HourType,TT_ClassType_t ClassType,unsigned Duration,char *Group,long GrpCod,char *Place)
{
extern const char *Txt_unknown_course;
extern const char *Txt_TIME_TABLE_CLASS_TYPES[TT_NUM_CLASS_TYPES];
extern const char *Txt_TIMETABLE_CLASS_TYPES[TT_NUM_CLASS_TYPES];
extern const char *Txt_Group;
extern const char *Txt_All_groups;
extern const char *Txt_Classroom;
@ -1148,7 +1149,7 @@ static void TT_TimeTableDrawCell (unsigned Day,unsigned Hour,unsigned Column,uns
Txt_unknown_course);
}
fprintf (Gbl.F.Out,"%s (%dh%s)",
Txt_TIME_TABLE_CLASS_TYPES[ClassType],
Txt_TIMETABLE_CLASS_TYPES[ClassType],
Duration / 2,
Duration % 2 ? "30'" :
"");
@ -1199,7 +1200,7 @@ static void TT_TimeTableDrawCell (unsigned Day,unsigned Hour,unsigned Column,uns
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out," value=\"%s\">%s</option>",
TimeTableStrsClassTypeDB[CT],
Txt_TIME_TABLE_CLASS_TYPES[CT]);
Txt_TIMETABLE_CLASS_TYPES[CT]);
}
fprintf (Gbl.F.Out,"</select>");
if (HourType == TT_FREE_HOUR)

View File

@ -30,22 +30,20 @@
#include "swad_bool.h"
/*****************************************************************************/
/****************************** Public constants *****************************/
/************************* Public constants and types ************************/
/*****************************************************************************/
#define TT_MAX_BYTES_PLACE 127
#define TT_MAX_BYTES_GROUP 255
/*****************************************************************************/
/******************************** Public types *******************************/
/*****************************************************************************/
#define TT_NUM_TIMETABLE_TYPES 3
typedef enum
{
TT_COURSE_TIMETABLE,
TT_MY_TIMETABLE,
TT_TUTOR_TIMETABLE,
TT_COURSE_TIMETABLE = 0,
TT_MY_TIMETABLE = 1,
TT_TUTOR_TIMETABLE = 2,
} TT_TimeTableType_t;
typedef enum
{
TT_FREE_HOUR,