Version 17.26.7

This commit is contained in:
Antonio Cañas Vargas 2017-12-09 18:32:23 +01:00
parent 2614cfd359
commit 8081d59d6c
4 changed files with 287 additions and 5 deletions

185
swad_alert.c Normal file
View File

@ -0,0 +1,185 @@
// swad_alert.c: alerts
/*
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-2017 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 <linux/stddef.h> // For NULL
#include "swad_alert.h"
#include "swad_global.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private constants *****************************/
/*****************************************************************************/
static const char *Ale_AlertIcons[Ale_NUM_ALERT_TYPES] =
{
NULL, // Ale_NONE
"copy_on16x16.gif", // Ale_CLIPBOARD
"info64x64.png", // Ale_INFO
"success64x64.png", // Ale_SUCCESS
"question64x64.gif", // Ale_QUESTION animated gif
"warning64x64.gif", // Ale_WARNING animated gif
"error64x64.gif", // Ale_ERROR animated gif
};
/*****************************************************************************/
/******************************* Private types *******************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private prototypes ****************************/
/*****************************************************************************/
/*****************************************************************************/
/*********************** Show a write-pending alert **************************/
/*****************************************************************************/
// Gbl.Alert.Type must be Ale_NONE or any type of alert
// If Gbl.Alert.Type != Ale_NONE ==> Gbl.Alert.Txt must hold the message
void Ale_ShowPendingAlert (void)
{
/***** Anything to show? *****/
if (Gbl.Alert.Type != Ale_NONE)
/***** Show alert *****/
Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt);
// Do not be tempted to restore the value of Gbl.Alert.Type to Ale_NONE here,
// since it can still be used after calling this function.
}
/*****************************************************************************/
/******************** Show an alert message to the user **********************/
/*****************************************************************************/
void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *Txt)
{
if (AlertType != Ale_NONE)
Ale_ShowAlertAndButton (AlertType,Txt,
ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);
}
void Ale_ShowAlertAndButton (Ale_AlertType_t AlertType,const char *Txt,
Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton)
{
Ale_ShowAlertAndButton1 (AlertType,Txt);
Ale_ShowAlertAndButton2 (NextAction,Anchor,OnSubmit,
FuncParams,Button,TxtButton);
}
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt)
{
extern const char *Txt_Close;
char IdAlert[Act_MAX_BYTES_ID];
static const bool AlertClosable[Ale_NUM_ALERT_TYPES] =
{
false, // Ale_NONE
false, // Ale_CLIPBOARD
false, // Ale_INFO
true, // Ale_SUCCESS
true, // Ale_QUESTION
true, // Ale_WARNING
true, // Ale_ERROR
};
/****** If start of page is not written yet, do it now ******/
if (!Gbl.Layout.HTMLStartWritten)
Lay_WriteStartOfPage ();
/***** Start box *****/
fprintf (Gbl.F.Out,"<div");
if (AlertClosable[AlertType])
{
/* Create unique id for alert */
Act_SetUniqueId (IdAlert);
fprintf (Gbl.F.Out," id=\"%s\"",IdAlert);
}
fprintf (Gbl.F.Out," class=\"CENTER_MIDDLE\">"
"<div class=\"ALERT\">");
/***** Icon to close the alert *****/
if (AlertClosable[AlertType])
fprintf (Gbl.F.Out,"<div class=\"ALERT_CLOSE\">"
"<a href=\"\""
" onclick=\"toggleDisplay('%s');return false;\" />"
"<img src=\"%s/close64x64.png\""
" alt=\"%s\" title=\"%s\""
" class=\"ICO20x20\" />"
"</a>"
"</div>",
IdAlert,
Gbl.Prefs.IconsURL,
Txt_Close,Txt_Close);
/***** Write message *****/
fprintf (Gbl.F.Out,"<div class=\"ALERT_TXT\"");
if (AlertType != Ale_NONE)
fprintf (Gbl.F.Out," style=\"background-image:url('%s/%s');\"",
Gbl.Prefs.IconsURL,Ale_AlertIcons[AlertType]);
fprintf (Gbl.F.Out,">");
if (Txt)
fprintf (Gbl.F.Out,"%s",Txt);
fprintf (Gbl.F.Out,"</div>");
}
void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton)
{
/***** Optional button *****/
if (NextAction != ActUnk &&
Button != Btn_NO_BUTTON &&
TxtButton)
if (TxtButton[0])
{
/* Start form */
Act_FormStartAnchor (NextAction,Anchor);
Act_FormStartAnchorOnSubmit (NextAction,Anchor,OnSubmit);
if (FuncParams)
FuncParams ();
/* Put button *****/
Btn_PutButton (Button,TxtButton);
/* End form */
Act_FormEnd ();
}
/***** End box *****/
fprintf (Gbl.F.Out,"</div>"
"</div>");
}

72
swad_alert.h Normal file
View File

@ -0,0 +1,72 @@
// swad_alert.h: alerts
#ifndef _SWAD_ALE
#define _SWAD_ALE
/*
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-2017 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 "swad_action.h"
#include "swad_button.h"
#include "swad_layout.h"
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Ale_MAX_BYTES_ALERT (16 * 1024 - 1) // Max. size for alert message
// Important: the size of alert message must be enough large to store the longest message.
/*****************************************************************************/
/********************************* Public types ******************************/
/*****************************************************************************/
#define Ale_NUM_ALERT_TYPES 7
typedef enum
{
Ale_NONE = 0,
Ale_CLIPBOARD = 1,
Ale_INFO = 2,
Ale_SUCCESS = 3,
Ale_QUESTION = 4,
Ale_WARNING = 5,
Ale_ERROR = 6,
} Ale_AlertType_t;
/*****************************************************************************/
/****************************** Public prototypes ****************************/
/*****************************************************************************/
void Ale_ShowPendingAlert (void);
void Ale_ShowAlert (Ale_AlertType_t AlertType,const char *Txt);
void Ale_ShowAlertAndButton (Ale_AlertType_t AlertType,const char *Txt,
Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton);
void Ale_ShowAlertAndButton1 (Ale_AlertType_t AlertType,const char *Txt);
void Ale_ShowAlertAndButton2 (Act_Action_t NextAction,const char *Anchor,const char *OnSubmit,
void (*FuncParams) (),
Btn_Button_t Button,const char *TxtButton);
#endif

View File

@ -264,6 +264,31 @@
// TODO: Enviar correo a todos los profesores de una asignatura, sugerido por Pedro Villar Castro
// TODO: Sugerencias de Pilar Ossorio Castellanos:
/*
Hola Antonio, estoy redactando preguntas en los test tipo: "rellenar hueco con la respuesta exacta". Se puede hacer seleccionando la modalidad "texto". El problema es cuando hay varios huecos en una frase, ya que no consigo que en los tests se respete el orden de mis preguntas, sino que salen aleatoriamente. ¿Hay alguna manera de fijar el orden de las preguntas? porque en ese caso ya no tendría problema con utilizar varios huecos en la misma frase, ya que cada pregunta sería una continuación de la primera. No se si me explico.
Otra cosa ¿Cómo hago para bloquear la entrada de los alumnos que han terminado un curso sin cancelar sus fichas y todo lo que se ha realizado. SImplemente quiero que no entren ya a ese curso. (pero no eliminar los datos del curso ni los alumnos que han participado)
*/
/*
En realidad no son cursos online sino la modalidad "plataforma" que se combina la parte online con tutorías virtuales (que tenemos que hacer externamente porque creo que no tenéis una herramienta tipo videoconferencia, webinar o skype) o con sesiones presenciales. Piden siempre un 75% de asistencia en la parte online, esto es: si un curso presencial tiene 10 h, por teleformación el alumno debe estar 7,5 usando la plataforma.
En swad he visto algo más importante que el tiempo conectado, que son los clics, y eso es lo que de verdad demuestra que el alumno está participando y no solo tiene el programa abierto.
Si sería útil poder tener los resultados de todos en bloque, porque sino tengo que entrar uno por uno y no puedo comparar, que es otra cosa que me gusta comprobar.
Por cierto, los test realizados por los alumnos solo se visualizan para los profesores si el alumno ha señalado la opción "dejar ver al profesor", ¿verdad? porque no me sale ninguno.
----- Mensaje original -----
Hola, Pilar:
Con control de asistencia en horas y minutos supongo que te refieres a asistencia online. La herramienta de control de asistencia actual sirve para pasar lista en clase presencial. Para controlar lo que ha hecho cada alumno lo que podrías usar los las estadísticas de acceso, que están en Estadísticas > Accesos > Accesos asignatura. Luego puedes seleccionar los usuarios y ver diversas estadísticas, como el listado detallado de cada estudiante, o unas gráficas de acceso por fechas. Si quieres el detalle de cada alumno, efectivamente debes ir sacando un informe de uno por uno.
Esto no está programado de otra forma porque eres la primera persona que lo solicita. Ten en cuenta que la herramienta se usa principalmente para apoyo a la docencia presencial. De todas formas, apunto en la lista de sugerencia por hacer, la posibilidad de sacar un informe de accesos individualizado para cada alumno, pero sin tener que ir uno por uno.
----- Mensaje original -----
Hola Antonio, ya hemos terminado un curso y me piden un control de la asistencia por parte de cada alumno en horas y minutos. ¿Sabes si los puedo visualizar todos sin tener que ir entrando uno por uno?
Gracias
*/
// TODO: Check actions table. All actions must be present in table.
// TODO: Poner icono superior izquierdo de "Lugares" también en la caja de información de la institución
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
@ -276,10 +301,10 @@
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* Printing:
En local:
enscript -1 --file-align=2 --highlight --line-numbers -o - * > swad17.26.5_bn_1_columna.ps
enscript -1 --color --file-align=2 --highlight --line-numbers -o - * > swad17.26.5_color_1_columna.ps
enscript -2 --landscape --file-align=2 --highlight --line-numbers -o - * > swad17.26.5_bn_2_columnas.ps
enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * > swad17.26.5_color_2_columnas.ps
enscript -1 --file-align=2 --highlight --line-numbers -o - * > swad17.26.7_bn_1_columna.ps
enscript -1 --color --file-align=2 --highlight --line-numbers -o - * > swad17.26.7_color_1_columna.ps
enscript -2 --landscape --file-align=2 --highlight --line-numbers -o - * > swad17.26.7_bn_2_columnas.ps
enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * > swad17.26.7_color_2_columnas.ps
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/

View File

@ -3675,7 +3675,7 @@ void Svy_ReceiveSurveyAnswers (void)
{
/***** Receive and store user's answers *****/
Svy_ReceiveAndStoreUserAnswersToASurvey (Svy.SvyCod);
Ale_ShowAlert (Ale_INFO,Txt_Thanks_for_answering_the_survey);
Ale_ShowAlert (Ale_SUCCESS,Txt_Thanks_for_answering_the_survey);
}
/***** Show current survey *****/