swad-core/swad_global.h

860 lines
27 KiB
C
Raw Normal View History

2014-12-01 23:55:08 +01:00
// swad_global.h: global variables
#ifndef _SWAD_GBL
#define _SWAD_GBL
/*
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.
2019-01-07 21:52:19 +01:00
Copyright (C) 1999-2019 Antonio Ca<EFBFBD>as Vargas
2014-12-01 23:55:08 +01:00
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 <limits.h> // For maximum values
#include <stdio.h> // For FILE
#include <sys/time.h> // For tz
#include <mysql/mysql.h> // To access MySQL databases
2017-05-11 23:45:46 +02:00
#include "swad_alert.h"
2016-11-30 22:49:48 +01:00
#include "swad_agenda.h"
2014-12-01 23:55:08 +01:00
#include "swad_assignment.h"
#include "swad_attendance.h"
#include "swad_banner.h"
#include "swad_centre.h"
2018-12-29 15:03:30 +01:00
#include "swad_classroom.h"
2014-12-01 23:55:08 +01:00
#include "swad_connected.h"
#include "swad_config.h"
#include "swad_country.h"
#include "swad_course.h"
#include "swad_cryptography.h"
#include "swad_department.h"
2016-03-20 16:30:52 +01:00
#include "swad_degree_type.h"
2017-03-30 11:20:06 +02:00
#include "swad_enrolment.h"
2016-12-12 02:21:41 +01:00
#include "swad_exam.h"
2019-02-12 14:46:14 +01:00
#include "swad_figure.h"
2014-12-01 23:55:08 +01:00
#include "swad_file.h"
#include "swad_file_browser.h"
#include "swad_forum.h"
2017-09-07 18:38:18 +02:00
#include "swad_game.h"
2014-12-01 23:55:08 +01:00
#include "swad_holiday.h"
2016-04-03 01:24:20 +02:00
#include "swad_icon.h"
2016-06-08 14:14:31 +02:00
#include "swad_indicator.h"
2014-12-01 23:55:08 +01:00
#include "swad_institution.h"
#include "swad_layout.h"
#include "swad_link.h"
#include "swad_mail.h"
#include "swad_mark.h"
2019-03-02 21:49:11 +01:00
#include "swad_media.h"
2015-01-02 01:19:27 +01:00
#include "swad_menu.h"
2019-03-02 21:49:11 +01:00
#include "swad_message.h"
2016-03-31 15:03:00 +02:00
#include "swad_parameter.h"
2014-12-01 23:55:08 +01:00
#include "swad_password.h"
#include "swad_photo.h"
#include "swad_place.h"
#include "swad_plugin.h"
2017-09-23 21:15:17 +02:00
#include "swad_project.h"
2014-12-01 23:55:08 +01:00
#include "swad_record.h"
#include "swad_search.h"
#include "swad_session.h"
#include "swad_survey.h"
#include "swad_syllabus.h"
2019-04-04 10:45:15 +02:00
#include "swad_system.h"
2014-12-01 23:55:08 +01:00
#include "swad_test.h"
2019-03-12 21:25:55 +01:00
#include "swad_timeline.h"
2014-12-01 23:55:08 +01:00
#include "swad_timetable.h"
#include "swad_web_service.h"
/*****************************************************************************/
/***************************** Public constants ******************************/
/*****************************************************************************/
/*****************************************************************************/
/******************************* Public types ********************************/
/*****************************************************************************/
struct Globals
{
struct
{
2017-01-28 15:58:46 +01:00
char DatabasePassword[Cfg_MAX_BYTES_DATABASE_PASSWORD + 1];
char SMTPPassword[Cfg_MAX_BYTES_SMTP_PASSWORD + 1];
2014-12-01 23:55:08 +01:00
} Config;
struct Files F;
MYSQL mysql;
pid_t PID; // PID of current process
2016-01-14 10:31:09 +01:00
struct
{
int Num; // Number of form, used in form submit links
char Id[32]; // Identifier string used in forms
2017-03-07 01:56:41 +01:00
char UniqueId[32 + Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 10 + 1]; // Unique identifier string used in forms
2016-01-14 10:31:09 +01:00
bool Inside; // Set to true inside a form to avoid nested forms
} Form;
2017-05-10 10:25:01 +02:00
struct
{
2019-03-25 19:05:10 +01:00
size_t Num; // Number of alert
2019-03-09 20:12:44 +01:00
struct
{
Ale_AlertType_t Type;
2019-03-25 19:05:10 +01:00
char *Text; // Message to be displayed
char *Section; // Where to display the alert
2019-03-09 20:12:44 +01:00
} List[Ale_MAX_ALERTS];
} Alerts; // Alert message created in a function and printed in a subsequent function.
2016-03-30 14:25:04 +02:00
struct
{
size_t ContentLength;
char *QueryString; // String allocated dynamically with the arguments sent to the CGI
struct Param *List; // Linked list of parameters
bool GetMethod; // Am I accessing using GET method?
} Params;
2014-12-01 23:55:08 +01:00
Act_Content_t ContentReceivedByCGI; /* Content send by the form and received by the CGI:
2016-03-30 14:25:04 +02:00
Act_CONTENT_NORM (if CONTENT_TYPE==text/plain) or
2016-10-21 00:38:34 +02:00
Act_CONT_DATA (if CONTENT_TYPE==multipart/form-data) */
2016-03-31 15:03:00 +02:00
struct
{
2018-10-04 21:57:25 +02:00
char StrWithoutCRLF[Par_MAX_BYTES_BOUNDARY_WITHOUT_CR_LF + 1];
char StrWithCRLF [Par_MAX_BYTES_BOUNDARY_WITH_CR_LF + 1];
2016-03-31 15:03:00 +02:00
size_t LengthWithoutCRLF;
size_t LengthWithCRLF;
} Boundary;
2016-03-30 14:25:04 +02:00
struct soap *soap; // gSOAP runtime environment
2014-12-01 23:55:08 +01:00
struct
{
bool WritingHTMLStart; // Used to avoid writing the HTML head when aborting program on error
bool HTMLStartWritten; // Used to avoid writing more than once the HTML head
2015-11-27 21:24:24 +01:00
bool DivsEndWritten; // Used to avoid writing more than once the HTML end
2014-12-01 23:55:08 +01:00
bool HTMLEndWritten; // Used to avoid writing more than once the HTML end
2017-06-12 14:16:33 +02:00
unsigned NestedBox;
2014-12-01 23:55:08 +01:00
} Layout;
struct
{
bool DatabaseIsOpen;
bool LockedTables;
} DB;
2016-03-30 14:25:04 +02:00
bool HiddenParamsInsertedIntoDB; // If parameters are inserted in the database in this execution
2014-12-01 23:55:08 +01:00
/* To compute execution time of the program */
2019-04-09 20:05:16 +02:00
struct timeval tvStart;
struct timeval tvPageCreated;
struct timeval tvPageSent;
2014-12-01 23:55:08 +01:00
struct timezone tz;
long TimeGenerationInMicroseconds;
long TimeSendInMicroseconds;
2017-03-07 11:03:05 +01:00
char IP[Cns_MAX_BYTES_IP + 1];
2017-03-07 01:56:41 +01:00
char UniqueNameEncrypted[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Used for session id, temporary directory names, etc.
2014-12-01 23:55:08 +01:00
struct
{
2018-12-08 16:43:13 +01:00
Lan_Language_t Language;
2015-11-21 20:23:28 +01:00
unsigned FirstDayOfWeek;
2017-05-04 02:19:23 +02:00
Dat_Format_t DateFormat;
2015-11-21 20:23:28 +01:00
Mnu_Menu_t Menu;
unsigned SideCols;
2014-12-01 23:55:08 +01:00
The_Theme_t Theme;
Ico_IconSet_t IconSet;
2019-01-09 01:41:54 +01:00
char URLTheme[PATH_MAX + 1];
char URLIconSet[PATH_MAX + 1];
2014-12-01 23:55:08 +01:00
} Prefs;
struct
{
unsigned NumSessions;
bool IsOpen;
bool HasBeenDisconnected;
2018-10-17 01:08:42 +02:00
char Id[Cns_BYTES_SESSION_ID + 1];
2014-12-01 23:55:08 +01:00
long UsrCod;
} Session;
2016-01-17 15:10:54 +01:00
struct
{
2016-10-12 14:02:56 +02:00
Tab_Tab_t Tab;
2016-01-17 15:10:54 +01:00
Act_Action_t Act;
2017-05-09 20:56:02 +02:00
Act_Action_t Original; // Used in some actions to know what action gave rise to the current action
2017-02-05 22:23:41 +01:00
bool UsesAJAX; // Do not generate full HTML page, only the content of a div
bool IsAJAXAutoRefresh; // It's an automatic refresh drom time to time
2016-01-17 15:10:54 +01:00
} Action;
2015-10-27 19:00:21 +01:00
time_t StartExecutionTimeUTC;
2014-12-01 23:55:08 +01:00
struct DateTime Now;
struct Date Yesterday;
2017-01-13 01:51:23 +01:00
char Title[Lay_MAX_BYTES_TITLE + 1]; // String for the help message in a link
2015-09-03 00:59:03 +02:00
unsigned RowEvenOdd; // To alternate row colors in listings
2014-12-01 23:55:08 +01:00
char *ColorRows[2];
const char *XMLPtr;
struct
{
2017-01-28 15:58:46 +01:00
char FileName[PATH_MAX + 1];
2014-12-21 14:47:04 +01:00
} HTMLOutput;
2014-12-01 23:55:08 +01:00
struct
{
2019-04-04 11:22:08 +02:00
Hie_Level_t Level; // Current level in the hierarchy: system, country, institution, centre, degree or course
long Cod; // Code of the current country, institution, centre, degree or course
struct System Sys; // Top level of the hierarchy (system or platform)
struct Country Cty; // Current country
struct Instit Ins; // Current institution
struct Centre Ctr; // Current centre
struct Degree Deg; // Current degree
struct Course Crs; // Current course. Aditional info about course is stored in Gbl.Crs.
} Hierarchy;
2019-04-04 10:45:15 +02:00
struct
{
unsigned Num; // Number of degree types
struct DegreeType *Lst; // List of degree types
} DegTypes;
2014-12-01 23:55:08 +01:00
struct
{
unsigned Num; // Number of departments
struct Department *Lst; // List of departments
2017-01-29 12:42:19 +01:00
Dpt_Order_t SelectedOrder;
2014-12-01 23:55:08 +01:00
} Dpts;
struct
{
unsigned Num; // Number of places
struct Place *Lst; // List of places
2017-01-29 12:42:19 +01:00
Plc_Order_t SelectedOrder;
2014-12-01 23:55:08 +01:00
} Plcs;
2018-12-29 15:03:30 +01:00
struct
{
unsigned Num; // Number of classrooms
struct Classroom *Lst; // List of classrooms
Cla_Order_t SelectedOrder;
} Classrooms;
2014-12-01 23:55:08 +01:00
struct
{
bool LstIsRead; // Is the list already read from database, or it needs to be read?
unsigned Num; // Number of holidays
struct Holiday *Lst; // List of holidays
2017-01-29 12:42:19 +01:00
Hld_Order_t SelectedOrder;
2014-12-01 23:55:08 +01:00
} Hlds;
struct
{
unsigned Num; // Number of mail domains
struct Mail *Lst; // List of mail domains
2017-01-29 12:42:19 +01:00
Mai_DomainsOrder_t SelectedOrder;
2014-12-01 23:55:08 +01:00
} Mails;
struct
{
unsigned Num; // Number of banners
struct Banner *Lst; // List of banners
long BanCodClicked;
} Banners;
struct
{
unsigned Num; // Number of institutional links
struct Link *Lst; // List of institutional links
} Links;
struct
{
Sch_WhatToSearch_t WhatToSearch;
2017-03-07 11:03:05 +01:00
char Str[Sch_MAX_BYTES_STRING_TO_FIND + 1];
2017-02-27 01:41:46 +01:00
bool LogSearch;
2014-12-01 23:55:08 +01:00
} Search;
struct
{
unsigned Num; // Number of plugins
struct Plugin *Lst; // List of plugins
} Plugins;
struct
{
bool IsWebService; // Must generate HTML output (IsWebService==false) or SOAP-XML output (IsWebService==true)?
long PlgCod;
Svc_Function_t Function;
} WebService;
struct
{
struct
{
struct UsrData UsrDat;
struct UsrLast UsrLast;
2017-06-04 14:22:04 +02:00
struct
{
unsigned Available;
2017-06-04 18:18:54 +02:00
Rol_Role_t FromSession;
Rol_Role_t Logged;
Rol_Role_t LoggedBeforeCloseSession;
2017-06-04 14:22:04 +02:00
Rol_Role_t Max;
2017-06-04 18:18:54 +02:00
bool HasChanged; // Set when I have changed my role
} Role;
2017-03-13 13:17:53 +01:00
char UsrIdLogin[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]; // String to store the ID, nickname or email entered in the user's login
2017-03-07 01:56:41 +01:00
char LoginPlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD + 1];
2017-03-13 14:22:36 +01:00
char LoginEncryptedPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
char PendingPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
2017-01-15 22:58:26 +01:00
char PathDir[PATH_MAX + 1];
2014-12-01 23:55:08 +01:00
bool Logged;
2015-01-20 20:03:38 +01:00
bool IBelongToCurrentIns;
bool IBelongToCurrentCtr;
bool IBelongToCurrentDeg;
2014-12-01 23:55:08 +01:00
bool IBelongToCurrentCrs;
bool MyPhotoExists;
unsigned NumAccWithoutPhoto;
2017-01-15 22:58:26 +01:00
char PhotoURL[PATH_MAX + 1];
2014-12-01 23:55:08 +01:00
time_t TimeLastAccToThisFileBrowser;
2016-11-16 23:19:52 +01:00
bool ConfirmEmailJustSent; // An email to confirm my email address has just been sent
2016-10-27 01:30:14 +02:00
struct
{
bool Filled; // My institutions are already filled?
unsigned Num;
struct
{
long CtyCod;
Rol_Role_t MaxRole;
2016-10-28 10:03:37 +02:00
} Ctys[Cty_MAX_COUNTRS_PER_USR];
} MyCtys;
2014-12-01 23:55:08 +01:00
struct
{
bool Filled; // My institutions are already filled?
unsigned Num;
struct
{
long InsCod;
Rol_Role_t MaxRole;
2016-10-28 10:03:37 +02:00
} Inss[Ins_MAX_INSTITS_PER_USR];
} MyInss;
2014-12-01 23:55:08 +01:00
struct
{
bool Filled; // My centres are already filled?
unsigned Num;
struct
{
long CtrCod;
Rol_Role_t MaxRole;
} Ctrs[Ctr_MAX_CENTRES_PER_USR];
2016-10-28 10:03:37 +02:00
} MyCtrs;
2014-12-01 23:55:08 +01:00
struct
{
bool Filled; // My degrees are already filled?
unsigned Num;
struct
{
long DegCod;
Rol_Role_t MaxRole;
} Degs[Deg_MAX_DEGREES_PER_USR];
2016-10-28 10:03:37 +02:00
} MyDegs;
2014-12-01 23:55:08 +01:00
struct
{
bool Filled; // My courses are already filled?
unsigned Num;
struct
{
long CrsCod;
Rol_Role_t Role;
long DegCod;
} Crss[Crs_MAX_COURSES_PER_USR];
2016-10-28 10:03:37 +02:00
} MyCrss;
2014-12-01 23:55:08 +01:00
Usr_ShowUsrsType_t ListType; // My preference about user's list type
2015-12-29 14:24:37 +01:00
unsigned NumFollowers; // Number of users who follow me
unsigned NumFollowing; // Number of users I follow
2014-12-01 23:55:08 +01:00
} Me; // The user logged
struct
{
struct UsrData UsrDat;
2017-05-08 19:54:05 +02:00
unsigned NumIDToConfirm; // Used as hidden parameter to confirm a user's ID
2014-12-01 23:55:08 +01:00
} Other; // Another user, used for example to register in / remove from a course
2016-06-23 13:10:43 +02:00
struct ListUsrs LstUsrs[Rol_NUM_ROLES];
2019-03-11 13:33:34 +01:00
struct
{
char *List[Rol_NUM_ROLES]; // Lists of encrypted codes of users selected from a form
bool Filled; // If lists are already filled/readed
2019-03-12 09:27:04 +01:00
Usr_ListUsrsOption_t Option; // What option I have selected to do with these selected users
2019-03-11 13:33:34 +01:00
} Selected;
2014-12-01 23:55:08 +01:00
char *ListOtherRecipients; // List of ID or nicks of users written explicitely on a form
struct
{
Rec_UsrsType_t RecsUsrs; // Students' records or teachers' records
unsigned RecsPerPag; // Number of rows of records in a row (only for printing)
bool WithPhotos;
} Listing;
struct
{
unsigned Cols;
bool AllGroups;
} ClassPhoto;
struct
{
unsigned long TimeToRefreshInMs;
unsigned NumUsr;
unsigned NumUsrs;
unsigned NumUsrsToList;
2015-12-20 01:41:07 +01:00
struct ConnectedUsrs Usrs[Rol_NUM_ROLES];
2014-12-01 23:55:08 +01:00
struct
{
long UsrCod;
bool ThisCrs;
2015-10-26 22:34:29 +01:00
time_t TimeDiff;
2014-12-01 23:55:08 +01:00
} Lst[Cfg_MAX_CONNECTED_SHOWN];
} Connected;
2017-01-28 15:58:46 +01:00
char FileNamePhoto[NAME_MAX + 1]; // File name (with no path and no .jpg) of the temporary file with the selected face
2017-03-30 11:20:06 +02:00
Enr_RegRemOneUsrAction_t RegRemAction; // Enrolment action
2014-12-01 23:55:08 +01:00
} Usrs;
2016-05-05 14:20:38 +02:00
struct
{
struct UsrData *UsrDat;
2016-11-18 00:17:53 +01:00
Rec_SharedRecordViewType_t TypeOfView;
2016-05-05 14:20:38 +02:00
} Record;
2016-12-02 00:24:16 +01:00
struct
{
bool LstIsRead; // Is the list already read from database, or it needs to be read?
unsigned Num; // Number of events
long *LstAgdCods; // List of agenda codes
2017-03-21 14:36:22 +01:00
unsigned Past__FutureEvents;
unsigned PrivatPublicEvents;
unsigned HiddenVisiblEvents;
2017-01-29 12:42:19 +01:00
Agd_Order_t SelectedOrder;
2016-12-02 00:24:16 +01:00
long AgdCodToEdit; // Used as parameter in contextual links
2017-04-13 20:09:22 +02:00
unsigned CurrentPage;
2016-12-02 00:24:16 +01:00
} Agenda;
2014-12-01 23:55:08 +01:00
struct
{
2019-04-03 20:57:04 +02:00
Hie_Level_t Current;
Hie_Level_t Default;
2014-12-01 23:55:08 +01:00
unsigned Allowed;
} Scope;
2019-04-04 10:45:15 +02:00
struct
{
char PathPriv[PATH_MAX + 1]; // Absolute path to the private directory of the course
char PathRelPubl[PATH_MAX + 1]; // Relative path to the public directory of the course
char PathURLPubl[PATH_MAX + 1]; // Abolute URL to the public part of the course
2014-12-01 23:55:08 +01:00
struct
{
2019-04-04 10:45:15 +02:00
unsigned NumGrps;
struct GroupTypes GrpTypes;
struct GroupType GrpTyp;
long GrpCod; // Group to be edited, removed...
char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1];
long ClaCod;
unsigned MaxStudents;
bool Open;
bool FileZones;
struct ListCodGrps LstGrpsSel;
Grp_WhichGroups_t WhichGrps; // Show my groups or all groups
} Grps;
struct
{
Inf_InfoType_t Type;
char URL[Cns_MAX_BYTES_WWW + 1];
bool MustBeRead[Inf_NUM_INFO_TYPES]; // Students must read info?
bool ShowMsgMustBeRead;
} Info;
struct
{
struct RecordField Field;
struct LstRecordFields LstFields;
} Records;
struct
{
long NotCod; // Notice to be edited, removed... used as parameter
long HighlightNotCod; // Notice code of a notice to be highlighted
} Notices;
} Crs;
2016-05-30 15:25:21 +02:00
struct
{
2017-01-28 15:58:46 +01:00
char PathDir[PATH_MAX + 1];
2019-04-08 23:34:58 +02:00
unsigned NumItem; // Item being edited
2017-09-10 23:24:23 +02:00
unsigned ParamNumItem; // Used as parameter in forms
2016-05-30 15:25:21 +02:00
bool EditionIsActive;
Syl_WhichSyllabus_t WhichSyllabus;
} Syllabus;
2014-12-01 23:55:08 +01:00
struct
{
2019-03-25 19:05:10 +01:00
struct Exa_ExamCodeAndDate *Lst; // List of exam announcements
2016-06-01 13:43:22 +02:00
unsigned NumExaAnns; // Number of announcements of exam in the list
2019-03-25 19:05:10 +01:00
long NewExaCod; // New exam announcement just created
2017-01-28 15:58:46 +01:00
long HighlightExaCod; // Exam announcement to be highlighted
2019-03-25 19:05:10 +01:00
char HighlightDate[4 + 2 + 2 + 1]; // Date with exam announcements to be highlighted (in YYYYMMDD format)
long ExaCod; // Used to put contextual icons
const char *Anchor; // Used to put contextual icons
2016-12-12 02:21:41 +01:00
struct ExamData ExaDat;
2017-01-15 18:02:52 +01:00
} ExamAnns;
2014-12-01 23:55:08 +01:00
struct
{
2015-10-03 00:38:01 +02:00
unsigned Id; // Each file browser in the page has a unique identifier
2014-12-01 23:55:08 +01:00
Brw_FileBrowser_t Type;
bool FullTree; // Show full tree?
bool ShowOnlyPublicFiles; // Show only public files?
bool UploadingWithDropzone;
struct
{
unsigned long MaxFiles;
unsigned long MaxFolds;
unsigned long long int MaxQuota;
unsigned NumLevls;
unsigned long NumFolds;
unsigned long NumFiles;
unsigned long long int TotalSiz;
} Size;
struct
{
2017-01-13 01:51:23 +01:00
char PathAboveRootFolder[PATH_MAX + 1];
char PathRootFolder[PATH_MAX + 1];
char PathInTreeUntilFilFolLnk[PATH_MAX + 1];
char FullPathInTree[PATH_MAX + 1];
2014-12-01 23:55:08 +01:00
} Priv;
2017-01-13 01:51:23 +01:00
char NewFilFolLnkName[NAME_MAX + 1];
char FilFolLnkName[NAME_MAX + 1];
2014-12-01 23:55:08 +01:00
Brw_FileType_t FileType;
unsigned Level;
2016-11-14 11:57:42 +01:00
bool ICanEditFileOrFolder; // Can I modify (remove, rename, create inside, etc.) a file or folder?
2016-11-07 10:22:17 +01:00
Brw_IconViewEdit_t IconViewEdit;
2014-12-01 23:55:08 +01:00
struct
{
Brw_FileBrowser_t FileBrowser; // Type of the file browser
2015-01-24 19:30:44 +01:00
long Cod; // Code of the institution/centre/degree/course/group related to the file browser with the clipboard
2014-12-01 23:55:08 +01:00
long WorksUsrCod; // User code of the user related to the works file browser with the clipboard
2017-01-13 01:51:23 +01:00
char Path[PATH_MAX + 1]; // Complete path in the file browser
char FileName[NAME_MAX + 1]; // File name, last part of complete path in the file browser
2016-11-14 19:18:34 +01:00
unsigned Level;
2014-12-01 23:55:08 +01:00
Brw_FileType_t FileType; // Folder, file or link
bool IsThisTree; // When showing a file browser, is it that corresponding to the clipboard?
bool IsThisFile; // When showing a row of a file browser, are we in the path of the clipboard?
} Clipboard;
2019-03-20 14:36:26 +01:00
struct
{
char L[2 + 1]; // Left directory: 2 first chars
char R[NAME_MAX + 1]; // Right directory: rest of chars
} TmpPubDir;
2017-01-13 01:51:23 +01:00
bool HiddenLevels[1 + Brw_MAX_DIR_LEVELS];
2014-12-01 23:55:08 +01:00
const char *TxtStyle;
const char *InputStyle;
struct Assignment Asg; // Data of assignment when browsing level 1 or an assignment zone
struct
{
bool CreateZIP;
2017-01-13 01:51:23 +01:00
char TmpDir[NAME_MAX + 1];
2014-12-01 23:55:08 +01:00
} ZIP;
} FileBrowser; // Struct used for a file browser
struct
{
2017-04-13 20:09:22 +02:00
bool LstIsRead; // Is the list already read from database, or it needs to be read?
unsigned Num; // Number of assignments
long *LstAsgCods; // List of assigment codes
2017-01-29 12:42:19 +01:00
Dat_StartEndTime_t SelectedOrder;
2015-12-13 19:37:08 +01:00
long AsgCodToEdit; // Used as parameter in contextual links
2017-04-13 20:09:22 +02:00
unsigned CurrentPage;
2014-12-01 23:55:08 +01:00
} Asgs;
2017-09-17 16:58:09 +02:00
struct
{
2017-10-10 12:52:02 +02:00
struct Prj_Filter Filter;
2017-09-17 16:58:09 +02:00
bool LstIsRead; // Is the list already read from database, or it needs to be read?
unsigned Num; // Number of projects
long *LstPrjCods; // List of project codes
2017-09-23 21:15:17 +02:00
Prj_Order_t SelectedOrder;
2017-09-17 16:58:09 +02:00
unsigned CurrentPage;
2017-10-10 01:26:45 +02:00
long PrjCod; // Current project
2017-09-17 16:58:09 +02:00
} Prjs;
2014-12-01 23:55:08 +01:00
struct
{
bool LstIsRead; // Is the list already read from database, or it needs to be read?
unsigned Num; // Number of attendance events
struct AttendanceEvent *Lst; // List of attendance events
2017-01-29 12:42:19 +01:00
Dat_StartEndTime_t SelectedOrder;
2014-12-01 23:55:08 +01:00
long AttCod;
2015-04-02 18:39:49 +02:00
bool ShowDetails;
char *StrAttCodsSelected;
2015-12-13 19:37:08 +01:00
long AttCodToEdit; // Used as parameter in contextual links
2017-04-13 20:09:22 +02:00
unsigned CurrentPage;
2014-12-01 23:55:08 +01:00
} AttEvents;
2017-02-24 03:38:18 +01:00
struct
{
2019-03-12 21:25:55 +01:00
TL_WhichUsrs_t WhichUsrs;
2017-04-28 12:52:58 +02:00
long NotCod; // Used as parameter about social note to be edited, removed...
long PubCod; // Used as parameter about social publishing to be edited, removed...
2019-03-12 21:25:55 +01:00
} Timeline;
2014-12-01 23:55:08 +01:00
struct
{
2017-04-17 11:57:55 +02:00
For_ForumSet_t ForumSet;
2017-04-18 13:17:40 +02:00
For_Order_t ThreadsOrder;
2017-04-13 20:09:22 +02:00
unsigned CurrentPageThrs;
unsigned CurrentPagePsts;
2017-04-18 13:17:40 +02:00
struct Forum ForumSelected; // Forum type, location, thread and post
long ThreadToMove;
2014-12-01 23:55:08 +01:00
} Forum;
2016-12-11 20:16:15 +01:00
struct
{
long AnnCod;
} Announcements;
2014-12-01 23:55:08 +01:00
struct
{
2016-11-07 12:31:14 +01:00
Msg_TypeOfMessages_t TypeOfMessages;
unsigned NumMsgs;
2014-12-01 23:55:08 +01:00
int MsgId;
2017-01-13 01:51:23 +01:00
char Subject[Cns_MAX_BYTES_SUBJECT + 1];
2014-12-01 23:55:08 +01:00
unsigned NumCourses;
struct
{
long CrsCod;
2017-03-08 14:12:33 +01:00
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
2014-12-01 23:55:08 +01:00
} Courses[Crs_MAX_COURSES_PER_USR]; // Distinct courses in my messages sent or received
2017-03-07 19:55:29 +01:00
long FilterCrsCod; // Show only messages sent from this course code
2017-03-08 14:12:33 +01:00
char FilterCrsShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
2017-03-07 19:55:29 +01:00
char FilterFromTo[Usr_MAX_BYTES_FULL_NAME + 1]; // Show only messages from/to these users
char FilterContent[Msg_MAX_BYTES_FILTER_CONTENT + 1]; // Show only messages that match this content
2014-12-01 23:55:08 +01:00
bool ShowOnlyUnreadMsgs; // Show only unread messages (this option is applicable only for received messages)
long ExpandedMsgCod; // The current expanded message code
2015-12-22 13:22:35 +01:00
struct
{
bool IsReply; // Is the message I am editing a reply?
long OriginalMsgCod; // Original message code when I am editing a reply
} Reply;
2015-12-22 14:00:36 +01:00
bool ShowOnlyOneRecipient; // Shown only a selected recipient or also other potential recipients?
2017-01-13 01:51:23 +01:00
char FileNameMail[PATH_MAX + 1];
2014-12-01 23:55:08 +01:00
FILE *FileMail;
unsigned CurrentPage;
2017-05-02 12:13:27 +02:00
long MsgCod; // Used as parameter with message to be removed
2017-04-13 20:09:22 +02:00
} Msg;
2014-12-01 23:55:08 +01:00
struct
{
2017-04-25 11:57:36 +02:00
struct
{
2017-04-25 21:20:19 +02:00
struct TT_Range Range;
2017-04-25 11:57:36 +02:00
unsigned HoursPerDay; // From start hour to end hour
unsigned SecondsPerInterval;
unsigned IntervalsPerHour;
unsigned IntervalsPerDay;
unsigned IntervalsBeforeStartHour;
} Config;
2016-03-18 14:07:21 +01:00
TT_TimeTableType_t Type;
2017-04-25 21:42:29 +02:00
TT_TimeTableView_t View;
2017-04-24 21:12:53 +02:00
unsigned Weekday;
unsigned Interval;
2016-03-18 14:07:21 +01:00
unsigned Column;
2017-04-24 13:39:55 +02:00
TT_ClassType_t ClassType;
2017-04-25 21:20:19 +02:00
unsigned DurationIntervals;
2019-01-07 17:00:04 +01:00
char Info[TT_MAX_BYTES_INFO + 1];
// char Place[TT_MAX_BYTES_PLACE + 1];
2014-12-01 23:55:08 +01:00
long GrpCod; // Group code (-1 if no group selected)
2016-03-18 14:07:21 +01:00
struct
{
bool PutIconEditCrsTT;
bool PutIconEditOfficeHours;
2016-12-04 20:12:56 +01:00
bool PutIconPrint;
2016-03-18 14:07:21 +01:00
} ContextualIcons;
2014-12-01 23:55:08 +01:00
} TimeTable;
struct
{
struct Tst_Config Config;
long QstCod;
2016-04-06 22:27:33 +02:00
struct
{
unsigned Num;
bool All;
char *List;
2017-01-17 03:10:43 +01:00
char Txt[Tst_MAX_TAGS_PER_QUESTION][Tst_MAX_BYTES_TAG + 1];
2016-04-06 22:27:33 +02:00
} Tags;
2014-12-01 23:55:08 +01:00
Tst_AnswerType_t AnswerType;
unsigned NumQsts;
2016-11-21 13:15:08 +01:00
long QstCodes[Tst_MAX_QUESTIONS_PER_TEST]; // Codes of the sent/received questions in a test
2017-03-13 19:02:15 +01:00
char StrIndexesOneQst[Tst_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_INDEXES_ONE_QST + 1]; // 0 1 2 3, 3 0 2 1, etc.
char StrAnswersOneQst[Tst_MAX_QUESTIONS_PER_TEST][Tst_MAX_BYTES_ANSWERS_ONE_QST + 1]; // Answers selected by user
2016-11-21 13:15:08 +01:00
bool AllowTeachers; // Can teachers of this course see the test result?
2014-12-01 23:55:08 +01:00
bool AllAnsTypes;
struct
{
char *Text;
size_t Length;
} Stem, Feedback;
2019-03-02 21:49:11 +01:00
struct Media Media;
2014-12-01 23:55:08 +01:00
bool Shuffle;
struct
{
unsigned NumOptions;
char TF;
struct
{
bool Correct;
char *Text;
char *Feedback;
2019-03-02 21:49:11 +01:00
struct Media Media;
2014-12-01 23:55:08 +01:00
} Options[Tst_MAX_OPTIONS_PER_QUESTION];
long Integer;
double FloatingPoint[2];
} Answer;
2017-01-17 03:10:43 +01:00
char ListAnsTypes[Tst_MAX_BYTES_LIST_ANSWER_TYPES + 1];
2017-01-29 12:42:19 +01:00
Tst_QuestionsOrder_t SelectedOrder;
2014-12-01 23:55:08 +01:00
struct
{
bool CreateXML; // Create an XML file and Export questions into it?
FILE *FileXML;
} XML;
} Test;
struct
{
2015-10-27 19:00:21 +01:00
struct DateTime DateIni; // TODO: Remove in future versions
struct DateTime DateEnd; // TODO: Remove in future versions
2015-10-25 00:23:22 +02:00
time_t TimeUTC[2];
2014-12-01 23:55:08 +01:00
} DateRange;
2017-07-04 00:57:18 +02:00
struct
{
bool LstIsRead; // Is the list already read from database, or it needs to be read?
unsigned Num; // Number of surveys
long *LstGamCods; // List of game codes
2017-09-07 18:38:18 +02:00
Gam_Order_t SelectedOrder;
2017-09-01 14:36:25 +02:00
long CurrentGamCod; // Used as parameter in contextual links
long CurrentQstCod; // Used as parameter in contextual links
2017-07-04 00:57:18 +02:00
unsigned CurrentPage;
2017-07-18 20:34:32 +02:00
char *ListQuestions;
2017-07-04 00:57:18 +02:00
} Games;
2014-12-01 23:55:08 +01:00
struct
{
bool LstIsRead; // Is the list already read from database, or it needs to be read?
unsigned Num; // Number of surveys
long *LstSvyCods; // List of survey codes
2017-01-29 12:42:19 +01:00
Svy_Order_t SelectedOrder;
2015-12-13 19:37:08 +01:00
long SvyCodToEdit; // Used as parameter in contextual links
2016-04-05 13:07:33 +02:00
long SvyQstCodToEdit; // Used as parameter in contextual links
2017-04-13 20:09:22 +02:00
unsigned CurrentPage;
2014-12-01 23:55:08 +01:00
} Svys;
2019-02-12 14:46:14 +01:00
struct
{
Fig_FigureType_t FigureType;
} Figures;
2014-12-01 23:55:08 +01:00
struct
{
2015-09-25 01:48:00 +02:00
Sta_ClicksGroupedBy_t ClicksGroupedBy;
2014-12-01 23:55:08 +01:00
Sta_Role_t Role;
Sta_CountType_t CountType;
Act_Action_t NumAction;
unsigned long FirstRow;
unsigned long LastRow;
unsigned long RowsPerPage;
long DegTypCod;
long DptCod;
2017-01-28 15:58:46 +01:00
char StrIndicatorsSelected[Ind_MAX_SIZE_INDICATORS_SELECTED + 1];
bool IndicatorsSelected[1 + Ind_NUM_INDICATORS];
2014-12-01 23:55:08 +01:00
struct
{
Pho_AvgPhotoTypeOfAverage_t TypeOfAverage;
Pho_HowComputePhotoSize_t HowComputePhotoSize;
Pho_HowOrderDegrees_t HowOrderDegrees;
int MaxStds;
int MaxStdsWithPhoto;
float MaxPercent;
} DegPhotos;
} Stat;
2016-12-05 09:38:34 +01:00
struct
{
char *Str;
} QR;
2017-06-20 14:43:26 +02:00
/* Cache */
struct
{
struct
{
long CtyCod;
char CtyName[Cty_MAX_BYTES_NAME + 1];
} CountryName;
struct
{
long InsCod;
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
} InstitutionShrtName;
struct
{
long InsCod;
2019-03-07 13:00:18 +01:00
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1];
2017-06-20 14:43:26 +02:00
char CtyName[Hie_MAX_BYTES_FULL_NAME + 1];
2019-03-07 13:00:18 +01:00
} InstitutionShrtNameAndCty;
2017-06-20 14:43:26 +02:00
struct
{
long UsrCod;
bool IsSuperuser;
} UsrIsSuperuser;
struct
{
long UsrCod;
long InsCod;
bool Belongs;
} UsrBelongsToIns;
struct
{
long UsrCod;
long CtrCod;
bool Belongs;
} UsrBelongsToCtr;
struct
{
long UsrCod;
long DegCod;
bool Belongs;
} UsrBelongsToDeg;
struct
{
long UsrCod;
long CrsCod;
bool CountOnlyAcceptedCourses;
bool Belongs;
} UsrBelongsToCrs;
struct
{
long UsrCod;
bool Belongs;
} UsrBelongsToCurrentCrs;
struct
{
long UsrCod;
bool Accepted;
} UsrHasAcceptedInCurrentCrs;
struct
{
long UsrCod;
bool SharesAnyOfMyCrs;
} UsrSharesAnyOfMyCrs;
struct
{
long GrpCod;
bool IBelong;
} IBelongToGrp;
struct
{
long UsrCod;
bool Shares;
} UsrSharesAnyOfMyGrpsInCurrentCrs;
struct
{
long UsrCod;
long CrsCod;
Rol_Role_t Role;
} RoleUsrInCrs;
2017-10-08 16:12:58 +02:00
struct
{
long PrjCod;
Prj_RoleInProject_t RoleInProject;
} MyRoleInProject;
2019-02-22 14:04:54 +01:00
struct
{
long UsrCod;
unsigned NumFollowing;
unsigned NumFollowers;
} Follow;
2017-06-20 14:43:26 +02:00
} Cache;
2014-12-01 23:55:08 +01:00
};
/*****************************************************************************/
/****************************** Public prototypes ****************************/
/*****************************************************************************/
void Gbl_InitializeGlobals (void);
void Gbl_Cleanup (void);
#endif