2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_action.h: actions
|
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_ACT
|
|
|
|
|
#define _SWAD_ACT
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Copyright (C) 1999-2023 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 **********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-10-16 02:24:29 +02:00
|
|
|
|
#include <stdbool.h> // For boolean type
|
|
|
|
|
|
2018-10-17 01:08:42 +02:00
|
|
|
|
#include "swad_constant.h"
|
2016-04-14 14:21:38 +02:00
|
|
|
|
#include "swad_cryptography.h"
|
2018-12-08 16:43:13 +01:00
|
|
|
|
#include "swad_language.h"
|
2017-03-08 14:12:33 +01:00
|
|
|
|
#include "swad_string.h"
|
2016-10-12 14:02:56 +02:00
|
|
|
|
#include "swad_tab.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************************** Public constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-08 20:31:49 +01:00
|
|
|
|
#define Act_MAX_CHARS_ACTION_TXT (256 - 1) // 255
|
|
|
|
|
#define Act_MAX_BYTES_ACTION_TXT Act_MAX_CHARS_ACTION_TXT // 255
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2022-11-06 18:11:10 +01:00
|
|
|
|
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************** Public types *******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-11-10 23:05:08 +01:00
|
|
|
|
#define Act_NUM_CONTENTS 2
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2016-10-21 00:38:34 +02:00
|
|
|
|
Act_CONT_NORM,
|
|
|
|
|
Act_CONT_DATA,
|
2014-12-01 23:55:08 +01:00
|
|
|
|
} Act_Content_t;
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2018-04-24 13:21:53 +02:00
|
|
|
|
Act_BRW_UNK_TAB, // Unknown tab
|
2017-09-14 01:10:20 +02:00
|
|
|
|
Act_BRW_1ST_TAB, // The main (original, first) tab in the browser
|
|
|
|
|
Act_BRW_NEW_TAB, // A new (second) blank tab in the browser
|
|
|
|
|
Act_BRW_2ND_TAB, // The second tab in the browser
|
2019-04-19 13:11:54 +02:00
|
|
|
|
Act_AJAX_NORMAL, // Update a zone of the page using AJAX
|
|
|
|
|
Act_AJAX_RFRESH, // Update a zone of the page using AJAX, with auto-refresh
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Act_UPLOAD_FILE, // Upload a file. Do not write HTML content. Write Status code instead for Dropzone.js
|
2017-09-14 01:10:20 +02:00
|
|
|
|
Act_DOWNLD_FILE, // Download a file in a new tab. Do not write HTML content.
|
2017-10-04 12:20:58 +02:00
|
|
|
|
Act_204_NO_CONT, // Do not write HTML content. HTTP will return Status 204 No Content
|
2019-04-19 13:11:54 +02:00
|
|
|
|
Act_WEB_SERVICE, // Web service. Send output to client using SOAP.
|
2017-09-14 01:10:20 +02:00
|
|
|
|
} Act_BrowserTab_t;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-01-29 21:41:08 +01:00
|
|
|
|
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
struct Act_Actions
|
|
|
|
|
{
|
|
|
|
|
long ActCod; // Unique, time-persistent numerical code for the action
|
|
|
|
|
signed int IndexInMenu;
|
2016-10-12 14:02:56 +02:00
|
|
|
|
Tab_Tab_t Tab;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Act_Action_t SuperAction;
|
2017-02-08 23:25:29 +01:00
|
|
|
|
unsigned PermissionCrsIfIBelong;
|
|
|
|
|
unsigned PermissionCrsIfIDontBelong;
|
|
|
|
|
unsigned PermissionDeg;
|
|
|
|
|
unsigned PermissionCtr;
|
|
|
|
|
unsigned PermissionIns;
|
|
|
|
|
unsigned PermissionCty;
|
|
|
|
|
unsigned PermissionSys;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Act_Content_t ContentType;
|
2017-10-04 12:20:58 +02:00
|
|
|
|
Act_BrowserTab_t BrowserTab;
|
2018-04-24 13:21:53 +02:00
|
|
|
|
void (*FunctionPriori) ();
|
|
|
|
|
void (*FunctionPosteriori) ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
const char *Icon;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-05-09 20:56:02 +02:00
|
|
|
|
Act_Action_t Act_GetActionFromActCod (long ActCod);
|
2018-04-24 13:21:53 +02:00
|
|
|
|
long Act_GetActCod (Act_Action_t Action);
|
|
|
|
|
signed int Act_GetIndexInMenu (Act_Action_t Action);
|
|
|
|
|
Tab_Tab_t Act_GetTab (Act_Action_t Action);
|
|
|
|
|
Act_Action_t Act_GetSuperAction (Act_Action_t Action);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
bool Act_CheckIfIHavePermissionToExecuteAction (Act_Action_t Action);
|
2018-04-24 13:21:53 +02:00
|
|
|
|
Act_Content_t Act_GetContentType (Act_Action_t Action);
|
|
|
|
|
Act_BrowserTab_t Act_GetBrowserTab (Act_Action_t Action);
|
|
|
|
|
void (*Act_GetFunctionPriori (Act_Action_t Action)) (void);
|
|
|
|
|
void (*Act_GetFunctionPosteriori (Act_Action_t Action)) (void);
|
|
|
|
|
const char *Act_GetIcon (Act_Action_t Action);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
const char *Act_GetTitleAction (Act_Action_t Action);
|
2020-01-02 13:58:13 +01:00
|
|
|
|
const char *Act_GetActionText (Act_Action_t Action);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
void Act_AdjustActionWhenNoUsrLogged (void);
|
|
|
|
|
void Act_AdjustCurrentAction (void);
|
|
|
|
|
|
|
|
|
|
#endif
|