Version18.121

This commit is contained in:
Antonio Cañas Vargas 2019-05-16 14:02:06 +02:00
parent 1cf76a6f13
commit df541e7758
14 changed files with 570 additions and 294 deletions

View File

@ -27,7 +27,7 @@
###############################################################################
OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \
swad_announcement.o swad_assignment.o swad_attendance.o \
swad_announcement.o swad_API.o swad_assignment.o swad_attendance.o \
swad_banner.o swad_box.o swad_button.o \
swad_calendar.o swad_centre.o swad_chat.o swad_classroom.o \
swad_config.o swad_connected.o swad_cookie.o swad_country.o \
@ -54,7 +54,6 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \
swad_tab.o swad_table.o swad_test.o swad_test_import.o swad_theme.o \
swad_timeline.o swad_timetable.o \
swad_user.o \
swad_web_service.o \
swad_xml.o \
swad_zip.o
SOAPOBJS = soap/soapC.o soap/soapServer.o

View File

@ -242,6 +242,32 @@ struct swad__getTrivialQuestionOutput
struct swad__answersArray answersArray;
};
/* getGames */
struct swad__game
{
int gameCode;
char *userSurname1;
char *userSurname2;
char *userFirstname;
char *userPhoto;
int startTime;
int endTime;
char *title;
char *text;
char *groups;
};
struct swad__gamesArray
{
struct swad__game *__ptr; // pointer to array
int __size; // number of elements pointed to
};
struct swad__getGamesOutput
{
int numGames;
struct swad__gamesArray gamesArray;
};
/* structs used in getUsers and sendMessage */
struct swad__user
{
@ -416,6 +442,10 @@ int swad__getTests (char *wsKey,int courseCode,long beginTime,
int swad__getTrivialQuestion (char *wsKey,char *degrees,float lowerScore,float upperScore,
struct swad__getTrivialQuestionOutput *getTrivialQuestionOut);
/* Games */
int swad__getGames (char *wsKey,int courseCode,
struct swad__getGamesOutput *getGamesOut);
/* List of users */
int swad__getUsers (char *wsKey,int courseCode,char *groups,int userRole,
struct swad__getUsersOutput *getUsersOut);

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// swad_web_service.h: SWAD web service provided to external plugins
// swad_API.h: SWAD web API provided to external plugins
#ifndef _SWAD_SVC
#define _SWAD_SVC
#ifndef _SWAD_API
#define _SWAD_API
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
@ -31,7 +31,7 @@
/***************************** Public constants ******************************/
/*****************************************************************************/
#define Svc_NUM_FUNCTIONS 27
#define API_NUM_FUNCTIONS 28
/*****************************************************************************/
/******************************* Public types ********************************/
@ -40,42 +40,43 @@
// Add new functions at the end
typedef enum
{
Svc_unknown = 0, // unknown function
Svc_loginBySessionKey = 1,
Svc_loginByUserPassword = 2, // deprecated
Svc_loginByUserPasswordKey = 3,
Svc_getCourses = 4,
Svc_getUsers = 5,
Svc_getNotifications = 6,
Svc_getTestConfig = 7,
Svc_getTests = 8,
Svc_sendMessage = 9,
Svc_sendNotice = 10,
Svc_getDirectoryTree = 11,
Svc_getGroups = 12,
Svc_getGroupTypes = 13,
Svc_sendMyGroups = 14,
Svc_getFile = 15,
Svc_markNotificationsAsRead = 16,
Svc_getNewPassword = 17,
Svc_getCourseInfo = 18,
Svc_getAttendanceEvents = 19,
Svc_sendAttendanceEvent = 20,
Svc_getAttendanceUsers = 21,
Svc_sendAttendanceUsers = 22,
Svc_createAccount = 23,
Svc_getMarks = 24,
Svc_getTrivialQuestion = 25,
Svc_findUsers = 26,
Svc_removeAttendanceEvent = 27,
} Svc_Function_t;
API_unknown = 0, // unknown function
API_loginBySessionKey = 1,
API_loginByUserPassword = 2, // deprecated
API_loginByUserPasswordKey = 3,
API_getCourses = 4,
API_getUsers = 5,
API_getNotifications = 6,
API_getTestConfig = 7,
API_getTests = 8,
API_sendMessage = 9,
API_sendNotice = 10,
API_getDirectoryTree = 11,
API_getGroups = 12,
API_getGroupTypes = 13,
API_sendMyGroups = 14,
API_getFile = 15,
API_markNotificationsAsRead = 16,
API_getNewPassword = 17,
API_getCourseInfo = 18,
API_getAttendanceEvents = 19,
API_sendAttendanceEvent = 20,
API_getAttendanceUsers = 21,
API_sendAttendanceUsers = 22,
API_createAccount = 23,
API_getMarks = 24,
API_getTrivialQuestion = 25,
API_findUsers = 26,
API_removeAttendanceEvent = 27,
API_getGames = 28,
} API_Function_t;
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Svc_WebService (void);
void Svc_Exit (const char *DetailErrorMessage);
const char *Svc_GetFunctionNameFromFunCod (long FunCod);
void API_WebService (void);
void API_Exit (const char *DetailErrorMessage);
const char *API_GetFunctionNameFromFunCod (long FunCod);
#endif

View File

@ -1617,7 +1617,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActRefNewSocPubGbl*/{1509,-1,TabUnk,ActRefNewSocPubGbl ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_AJAX_RFRESH,NULL ,TL_RefreshNewTimelineGbl ,NULL},
/* ActRefOldSocPubGbl*/{1510,-1,TabUnk,ActRefOldSocPubGbl ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_RefreshOldTimelineGbl ,NULL},
/* ActRefOldSocPubUsr*/{1511,-1,TabUnk,ActRefOldSocPubUsr ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_RefreshOldTimelineUsr ,NULL},
/* ActWebSvc */{ 892,-1,TabUnk,ActWebSvc ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_WEB_SERVICE,NULL ,Svc_WebService ,NULL},
/* ActWebSvc */{ 892,-1,TabUnk,ActWebSvc ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_WEB_SERVICE,NULL ,API_WebService ,NULL},
// TabStr ******************************************************************
/* ActFrmLogIn */{1521, 0,TabStr,ActFrmLogIn , 0,0x001,0x001,0x001,0x001,0x001,0x001,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WriteLandingPage ,"power-off" },

View File

@ -448,10 +448,12 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.120.2 (2019-04-30)"
#define Log_PLATFORM_VERSION "SWAD 18.121 (2019-05-13)"
#define CSS_FILE "swad18.112.1.css"
#define JS_FILE "swad18.116.5.js"
/*
Version 18.121: May 13, 2019 Module swad_web_service is renamed as swad_API.
New API function getCourses. (242708 lines)
Version 18.120.2: Apr 30, 2019 Code refactoring related to boxes. (242465 lines)
Version 18.120.1: Apr 25, 2019 Code refactoring related to file browser. (242461 lines)
Version 18.120: Apr 25, 2019 Code refactoring related to file browser. (242466 lines)

View File

@ -28,9 +28,9 @@
/** Uncomment one of the following installations of SWAD or create your own **/
/*****************************************************************************/
//#define LOCALHOST_UBUNTU // Comment this line if not applicable
#define LOCALHOST_UBUNTU // Comment this line if not applicable
//#define OPENSWAD_ORG // Comment this line if not applicable
#define SWAD_UGR_ES // Comment this line if not applicable
//#define SWAD_UGR_ES // Comment this line if not applicable
//#define SWADBERRY_UGR_ES // Comment this line if not applicable
/*****************************************************************************/

View File

@ -3091,7 +3091,7 @@ mysql> DESCRIBE ws_keys;
4 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS ws_keys ("
"WSKey CHAR(43) NOT NULL," // Svc_BYTES_WS_KEY
"WSKey CHAR(43) NOT NULL," // API_BYTES_WS_KEY
"UsrCod INT NOT NULL,"
"PlgCod INT NOT NULL,"
"LastTime DATETIME NOT NULL,"

View File

@ -954,7 +954,7 @@ void Gam_GetListGames (void)
"",
Sco_GetDBStrFromScope (Hie_CRS),Cods[Hie_CRS],
(HiddenAllowed & 1 << Hie_CRS) ? "" :
" AND Hidden='N'",
" AND Hidden='N'",
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
Lay_NotEnoughMemoryExit ();
}
@ -965,7 +965,7 @@ void Gam_GetListGames (void)
"",
Sco_GetDBStrFromScope (Hie_CRS),Cods[Hie_CRS],
(HiddenAllowed & 1 << Hie_CRS) ? "" :
" AND Hidden='N'") < 0)
" AND Hidden='N'") < 0)
Lay_NotEnoughMemoryExit ();
}
SubQueryFilled = true;

View File

@ -34,6 +34,7 @@
#include <unistd.h> // For getpid
#include "swad_action.h"
#include "swad_API.h"
#include "swad_calendar.h"
#include "swad_classroom.h"
#include "swad_config.h"
@ -47,7 +48,6 @@
#include "swad_role.h"
#include "swad_setting.h"
#include "swad_theme.h"
#include "swad_web_service.h"
/*****************************************************************************/
/****************************** Public variables *****************************/
@ -400,7 +400,7 @@ void Gbl_InitializeGlobals (void)
Gbl.ColorRows[0] = "COLOR0"; // Darker
Gbl.ColorRows[1] = "COLOR1"; // Lighter
Gbl.WebService.Function = Svc_unknown;
Gbl.WebService.Function = API_unknown;
/* Flush caches */
Cty_FlushCacheCountryName ();

View File

@ -34,6 +34,7 @@
#include "swad_alert.h"
#include "swad_agenda.h"
#include "swad_API.h"
#include "swad_assignment.h"
#include "swad_attendance.h"
#include "swad_banner.h"
@ -79,7 +80,6 @@
#include "swad_test.h"
#include "swad_timeline.h"
#include "swad_timetable.h"
#include "swad_web_service.h"
/*****************************************************************************/
/***************************** Public constants ******************************/
@ -278,7 +278,7 @@ struct Globals
{
bool IsWebService; // Must generate HTML output (IsWebService==false) or SOAP-XML output (IsWebService==true)?
long PlgCod;
Svc_Function_t Function;
API_Function_t Function;
} WebService;
struct
{

View File

@ -30,6 +30,7 @@
#include <string.h> // For string functions
#include "swad_action.h"
#include "swad_API.h"
#include "swad_box.h"
#include "swad_calendar.h"
#include "swad_changelog.h"
@ -53,7 +54,6 @@
#include "swad_tab.h"
#include "swad_theme.h"
#include "swad_timeline.h"
#include "swad_web_service.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
@ -1369,7 +1369,7 @@ void Lay_ShowErrorAndExit (const char *Txt)
/***** Exit *****/
if (Gbl.WebService.IsWebService)
Svc_Exit (Txt);
API_Exit (Txt);
exit (0);
}

View File

@ -34,6 +34,7 @@ TODO: Check if web service is called from an authorized IP.
#include <stdlib.h> // For calloc, free
#include <string.h>
#include "swad_API.h"
#include "swad_box.h"
#include "swad_config.h"
#include "swad_constant.h"
@ -46,7 +47,6 @@ TODO: Check if web service is called from an authorized IP.
#include "swad_plugin.h"
#include "swad_session.h"
#include "swad_table.h"
#include "swad_web_service.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/

View File

@ -3295,7 +3295,7 @@ static void Sta_ShowNumHitsPerWSFunction (unsigned long NumRows,
"<td class=\"LOG LEFT_TOP\">"
"%s&nbsp;"
"</td>",
Svc_GetFunctionNameFromFunCod (FunCod));
API_GetFunctionNameFromFunCod (FunCod));
/* Draw bar proportional to number of hits */
Hits.Num = Str_GetFloatNumFromStr (row[1]);