Version 22.82: Mar 27, 2023 New module swad_rubric_resource.

This commit is contained in:
acanas 2023-03-27 10:28:58 +02:00
parent ddf3c4e9a1
commit 3207740503
13 changed files with 229 additions and 19 deletions

View File

@ -85,7 +85,7 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_action_list.o \
swad_record.o swad_record_database.o swad_report.o \
swad_report_database.o swad_resource.o swad_role.o swad_role_database.o \
swad_room.o swad_room_database.o swad_RSS.o swad_rubric.o \
swad_rubric_criteria.o swad_rubric_database.o \
swad_rubric_criteria.o swad_rubric_database.o swad_rubric_resource.o \
swad_scope.o swad_search.o swad_session.o swad_session_database.o \
swad_setting.o swad_setting_database.o swad_statistic.o \
swad_statistic_database.o swad_string.o swad_survey.o \

View File

@ -101,6 +101,7 @@
#include "swad_role.h"
#include "swad_rubric.h"
#include "swad_rubric_criteria.h"
#include "swad_rubric_resource.h"
#include "swad_search.h"
#include "swad_session.h"
#include "swad_setting.h"
@ -843,6 +844,7 @@ const struct Act_Actions ActLst_Actions[ActLst_NUM_ACTIONS] =
[ActChgRub ] = {1956,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rub_ReceiveFormRubric ,NULL},
[ActReqRemRub ] = {1957,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rub_AskRemRubric ,NULL},
[ActRemRub ] = {1958,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rub_RemoveRubric ,NULL},
[ActReqLnkRub ] = {1969,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubRsc_GetLinkToRubric ,NULL},
[ActNewRubCri ] = {1959,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_ReceiveFormCriterion ,NULL},
[ActReqRemRubCri ] = {1960,-1,TabUnk,ActSeeAllRub ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,RubCri_ReqRemCriterion ,NULL},
@ -3854,4 +3856,5 @@ Act_Action_t ActLst_FromActCodToAction[1 + ActLst_MAX_ACTION_COD] = // Do not re
ActChgMaxRubCri, // #1966
ActChgWeiRubCri, // #1967
ActChgSrcRubCri, // #1968
ActReqLnkRub, // #1969
};

View File

@ -766,17 +766,18 @@
#define ActChgRub (ActChgCrsTT1stDay + 224)
#define ActReqRemRub (ActChgCrsTT1stDay + 225)
#define ActRemRub (ActChgCrsTT1stDay + 226)
#define ActReqLnkRub (ActChgCrsTT1stDay + 227)
#define ActNewRubCri (ActChgCrsTT1stDay + 227)
#define ActReqRemRubCri (ActChgCrsTT1stDay + 228)
#define ActRemRubCri (ActChgCrsTT1stDay + 229)
#define ActUp_RubCri (ActChgCrsTT1stDay + 230)
#define ActDwnRubCri (ActChgCrsTT1stDay + 231)
#define ActChgTitRubCri (ActChgCrsTT1stDay + 232)
#define ActChgSrcRubCri (ActChgCrsTT1stDay + 233)
#define ActChgMinRubCri (ActChgCrsTT1stDay + 234)
#define ActChgMaxRubCri (ActChgCrsTT1stDay + 235)
#define ActChgWeiRubCri (ActChgCrsTT1stDay + 236)
#define ActNewRubCri (ActChgCrsTT1stDay + 228)
#define ActReqRemRubCri (ActChgCrsTT1stDay + 229)
#define ActRemRubCri (ActChgCrsTT1stDay + 230)
#define ActUp_RubCri (ActChgCrsTT1stDay + 231)
#define ActDwnRubCri (ActChgCrsTT1stDay + 232)
#define ActChgTitRubCri (ActChgCrsTT1stDay + 233)
#define ActChgSrcRubCri (ActChgCrsTT1stDay + 234)
#define ActChgMinRubCri (ActChgCrsTT1stDay + 235)
#define ActChgMaxRubCri (ActChgCrsTT1stDay + 236)
#define ActChgWeiRubCri (ActChgCrsTT1stDay + 237)
/*****************************************************************************/
/******************************** Files tab **********************************/
@ -1769,7 +1770,7 @@
#define ActLst_NUM_ACTIONS (ActChgMyTT1stDay + 1)
#define ActLst_MAX_ACTION_COD 1968
#define ActLst_MAX_ACTION_COD 1969
#define ActLst_DEFAULT_ACTION_AFTER_LOGIN ActSeeGblTL

View File

@ -106,7 +106,7 @@ void CfeRsc_WriteResourceCallForExam (long ExaCod,bool PutFormToGo,
else
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
/***** Write Name of the course and date of exam *****/
/***** Write title of call for exam *****/
HTM_Txt (Title);
/***** End form to download file *****/

View File

@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
*/
#define Log_PLATFORM_VERSION "SWAD 22.81.2 (2023-03-26)"
#define Log_PLATFORM_VERSION "SWAD 22.82 (2023-03-27)"
#define CSS_FILE "swad22.78.15.css"
#define JS_FILE "swad22.49.js"
/*
Version 22.82: Mar 27, 2023 New module swad_rubric_resource. (338149 lines)
Version 22.81.2: Mar 27, 2023 Changes in resources. (337974 lines)
Version 22.81.1: Mar 26, 2023 Changes in resources. (338012 lines)
5 changes necessary in database:

View File

@ -97,7 +97,7 @@ void ExaRsc_WriteResourceExam (long ExaCod,bool PutFormToGo,
else
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
/***** Write Name of the course and date of exam *****/
/***** Write title of exam *****/
HTM_Txt (Title);
/***** End form to download file *****/

View File

@ -117,7 +117,7 @@ void ForRsc_WriteResourceThread (long ThrCod,bool PutFormToGo,
else
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
/***** Write Name of the course and date of exam *****/
/***** Write title of forum *****/
HTM_Txt (Subject);
/***** End form to download file *****/

View File

@ -41,6 +41,7 @@
#include "swad_project_resource.h"
#include "swad_resource.h"
#include "swad_role.h"
#include "swad_rubric_resource.h"
#include "swad_survey_resource.h"
#include "swad_theme.h"
@ -145,7 +146,7 @@ void Rsc_WriteLinkName (const struct Rsc_Link *Link,bool PutFormToGo,
[Rsc_CALL_FOR_EXAM ] = CfeRsc_WriteResourceCallForExam,
[Rsc_EXAM ] = ExaRsc_WriteResourceExam,
[Rsc_GAME ] = GamRsc_WriteResourceGame,
[Rsc_RUBRIC ] = Rsc_WriteResourceEmpty, // TODO
[Rsc_RUBRIC ] = RubRsc_WriteResourceRubric,
[Rsc_DOCUMENT ] = BrwRsc_WriteResourceDocument,
[Rsc_MARKS ] = BrwRsc_WriteResourceMarksFile,
[Rsc_ATTENDANCE_EVENT] = AttRsc_WriteResourceEvent,
@ -192,7 +193,7 @@ void Rsc_GetResourceTitleFromLink (struct Rsc_Link *Link,
[Rsc_CALL_FOR_EXAM ] = CfeRsc_GetTitleFromExaCod,
[Rsc_EXAM ] = ExaRsc_GetTitleFromExaCod,
[Rsc_GAME ] = GamRsc_GetTitleFromGamCod,
[Rsc_RUBRIC ] = NULL, // TODO
[Rsc_RUBRIC ] = RubRsc_GetTitleFromRubCod,
[Rsc_DOCUMENT ] = BrwRsc_GetTitleFromDocFilCod,
[Rsc_MARKS ] = BrwRsc_GetTitleFromMrkFilCod,
[Rsc_ATTENDANCE_EVENT] = AttRsc_GetTitleFromAttCod,

View File

@ -260,6 +260,11 @@ static void Rub_PutIconsListRubrics (void *Rubrics)
if (Rub_CheckIfICanEditRubrics ())
Rub_PutIconToCreateNewRubric ((struct Rub_Rubrics *) Rubrics);
/***** Link to get resource link *****/
if (Rsc_CheckIfICanGetLink ())
Ico_PutContextualIconToGetLink (ActReqLnkRub,NULL,
Rub_PutPars,Rubrics);
/***** Put icon to show a figure *****/
Fig_PutIconToShowFigure (Fig_RUBRICS);
}
@ -483,6 +488,11 @@ static void Rub_PutIconsToRemEditOneRubric (struct Rub_Rubrics *Rubrics)
/***** Icon to edit rubric *****/
Ico_PutContextualIconToEdit (ActEdiOneRub,NULL,
Rub_PutPars,Rubrics);
/***** Link to get resource link *****/
if (Rsc_CheckIfICanGetLink ())
Ico_PutContextualIconToGetLink (ActReqLnkRub,NULL,
Rub_PutPars,Rubrics);
}
}

130
swad_rubric_resource.c Normal file
View File

@ -0,0 +1,130 @@
// swad_rubric_resource.c: links to rubrics as resources
/*
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-2023 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 3 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 "swad_action_list.h"
#include "swad_alert.h"
#include "swad_error.h"
#include "swad_form.h"
#include "swad_parameter_code.h"
#include "swad_program_database.h"
#include "swad_rubric.h"
#include "swad_rubric_database.h"
#include "swad_rubric_resource.h"
/*****************************************************************************/
/**************************** Get link to rubric *****************************/
/*****************************************************************************/
void RubRsc_GetLinkToRubric (void)
{
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
struct Rub_Rubrics Rubrics;
char Title[Rub_MAX_BYTES_TITLE + 1];
/***** Reset rubrics context *****/
Rub_ResetRubrics (&Rubrics);
/***** Get parameters *****/
Rub_GetPars (&Rubrics,true);
/***** Get rubric title *****/
RubRsc_GetTitleFromRubCod (Rubrics.Rubric.RubCod,Title,sizeof (Title) - 1);
/***** Copy link to rubric into resource clipboard *****/
Prg_DB_CopyToClipboard (Rsc_RUBRIC,Rubrics.Rubric.RubCod);
/***** Write sucess message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
Title);
/***** Show rubrics again *****/
Rub_ListAllRubrics (&Rubrics);
}
/*****************************************************************************/
/*************************** Write rubric as resource ************************/
/*****************************************************************************/
void RubRsc_WriteResourceRubric (long RubCod,bool PutFormToGo,
const char *Icon,const char *IconTitle)
{
extern const char *Txt_Actions[ActLst_NUM_ACTIONS];
Act_Action_t NextAction;
char Title[Rub_MAX_BYTES_TITLE + 1];
/***** Get rubric title *****/
RubRsc_GetTitleFromRubCod (RubCod,Title,sizeof (Title) - 1);
/***** Begin form to go to rubric *****/
if (PutFormToGo)
{
NextAction = (RubCod > 0) ? ActSeeRub : // Rubric specified
ActSeeAllRub; // All rubrics
Frm_BeginForm (NextAction);
ParCod_PutPar (ParCod_Rub,RubCod);
HTM_BUTTON_Submit_Begin (Txt_Actions[NextAction],
"class=\"LM BT_LINK PRG_LNK_%s\"",
The_GetSuffix ());
}
/***** Icon depending on type ******/
if (PutFormToGo)
Ico_PutIconLink (Icon,Ico_BLACK,NextAction);
else
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
/***** Write title of rubric *****/
HTM_Txt (Title);
/***** End form to download file *****/
if (PutFormToGo)
{
HTM_BUTTON_End ();
Frm_EndForm ();
}
}
/*****************************************************************************/
/********************* Get rubric title from rubric code *********************/
/*****************************************************************************/
// The trailing null character is not counted in TitleSize
void RubRsc_GetTitleFromRubCod (long RubCod,char *Title,size_t TitleSize)
{
extern const char *Txt_Rubrics;
char TitleFromDB[Rub_MAX_BYTES_TITLE + 1];
if (RubCod > 0)
{
/***** Get rubric title *****/
Rub_DB_GetRubricTitle (RubCod,TitleFromDB);
Str_Copy (Title,TitleFromDB,TitleSize);
}
else
/***** Generic title for all rubrics *****/
Str_Copy (Title,Txt_Rubrics,TitleSize);
}

41
swad_rubric_resource.h Normal file
View File

@ -0,0 +1,41 @@
// swad_rubric_resource.h: links to rubrics as resources
#ifndef _SWAD_RUB_RSC
#define _SWAD_RUB_RSC
/*
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-2023 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 3 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 <stddef.h> // For size_t
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void RubRsc_GetLinkToRubric (void);
void RubRsc_WriteResourceRubric (long RubCod,bool PutFormToGo,
const char *Icon,const char *IconTitle);
void RubRsc_GetTitleFromRubCod (long RubCod,char *Title,size_t TitleSize);
#endif

View File

@ -97,7 +97,7 @@ void SvyRsc_WriteResourceSurvey (long SvyCod,bool PutFormToGo,
else
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
/***** Write Name of the course and date of exam *****/
/***** Write title of survey *****/
HTM_Txt (Title);
/***** End form to download file *****/

View File

@ -14044,6 +14044,29 @@ const char *Txt_Actions[ActLst_NUM_ACTIONS] =
"Remover rubrica"
#elif L==10 // tr
"Puan anahtar&inodot;n&inodot; kald&inodot;r"
#endif
,
[ActReqLnkRub] =
#if L==1 // ca
"Copiar enlla&ccedil; a r&uacute;brica"
#elif L==2 // de
"Link zur Rubrik kopieren"
#elif L==3 // en
"Copy link to rubric"
#elif L==4 // es
"Copiar enlace a r&uacute;brica"
#elif L==5 // fr
"Copier le lien vers la rubrique"
#elif L==6 // gn
"Ekopia enlace rubrica-pe"
#elif L==7 // it
"Copiare il link alla rubrica"
#elif L==8 // pl
"Skopiuj link do rubryki"
#elif L==9 // pt
"Copiar link para rubrica"
#elif L==10 // tr
"Ba&gbreve;lant&inodot;y&inodot; puan anahtar&inodot;na kopyala"
#endif
,
[ActNewRubCri] =