mirror of https://github.com/acanas/swad-core.git
Version 16.154.3
This commit is contained in:
parent
a00c376f12
commit
72817bd1a1
|
@ -447,9 +447,11 @@ static void Asg_WriteAssignmentFolder (struct Assignment *Asg)
|
||||||
if (Asg->SendWork == Asg_SEND_WORK)
|
if (Asg->SendWork == Asg_SEND_WORK)
|
||||||
{
|
{
|
||||||
/***** Folder icon *****/
|
/***** Folder icon *****/
|
||||||
if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT &&
|
if (!Asg->Hidden && // It's visible (not hidden)
|
||||||
Asg->Open &&
|
Asg->Open && // It's open (inside dates)
|
||||||
Asg->IBelongToCrsOrGrps) // I can send files to this assignment folder
|
Asg->IBelongToCrsOrGrps && // I belong to course or groups
|
||||||
|
Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) // I am a student
|
||||||
|
// I can send files to this assignment folder
|
||||||
{
|
{
|
||||||
/* Form to create a new file or folder */
|
/* Form to create a new file or folder */
|
||||||
Act_FormStart (ActFrmCreAsgUsr);
|
Act_FormStart (ActFrmCreAsgUsr);
|
||||||
|
@ -739,11 +741,11 @@ static void Asg_GetDataOfAssignment (struct Assignment *Asg,const char *Query)
|
||||||
|
|
||||||
/* Get the title of the assignment (row[6]) */
|
/* Get the title of the assignment (row[6]) */
|
||||||
Str_Copy (Asg->Title,row[6],
|
Str_Copy (Asg->Title,row[6],
|
||||||
Asg_MAX_CHARS_ASSIGNMENT_TITLE);
|
Asg_MAX_BYTES_ASSIGNMENT_TITLE);
|
||||||
|
|
||||||
/* Get the folder for the assignment files (row[7]) */
|
/* Get the folder for the assignment files (row[7]) */
|
||||||
Str_Copy (Asg->Folder,row[7],
|
Str_Copy (Asg->Folder,row[7],
|
||||||
Asg_MAX_BYTES_FOLDER);
|
Brw_MAX_BYTES_FOLDER);
|
||||||
Asg->SendWork = (Asg->Folder[0] != '\0');
|
Asg->SendWork = (Asg->Folder[0] != '\0');
|
||||||
|
|
||||||
/* Can I do this assignment? */
|
/* Can I do this assignment? */
|
||||||
|
@ -1148,14 +1150,14 @@ void Asg_RequestCreatOrEditAsg (void)
|
||||||
"<td class=\"LEFT_MIDDLE\">"
|
"<td class=\"LEFT_MIDDLE\">"
|
||||||
"<label class=\"DAT\">%s:"
|
"<label class=\"DAT\">%s:"
|
||||||
"<input type=\"text\" name=\"Folder\""
|
"<input type=\"text\" name=\"Folder\""
|
||||||
" size=\"%u\" maxlength=\"%u\" value=\"%s\" />"
|
" size=\"30\" maxlength=\"%u\" value=\"%s\" />"
|
||||||
"</label>"
|
"</label>"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>",
|
"</tr>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],
|
The_ClassForm[Gbl.Prefs.Theme],
|
||||||
Txt_Upload_files_QUESTION,
|
Txt_Upload_files_QUESTION,
|
||||||
Txt_Folder,
|
Txt_Folder,
|
||||||
Asg_MAX_CHARS_FOLDER,Asg_MAX_CHARS_FOLDER,Asg.Folder);
|
Brw_MAX_CHARS_FOLDER,Asg.Folder);
|
||||||
|
|
||||||
/***** Assignment text *****/
|
/***** Assignment text *****/
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
|
@ -1288,7 +1290,7 @@ void Asg_RecFormAssignment (void)
|
||||||
Par_GetParToText ("Title",NewAsg.Title,Asg_MAX_BYTES_ASSIGNMENT_TITLE);
|
Par_GetParToText ("Title",NewAsg.Title,Asg_MAX_BYTES_ASSIGNMENT_TITLE);
|
||||||
|
|
||||||
/***** Get folder name where to send works of the assignment *****/
|
/***** Get folder name where to send works of the assignment *****/
|
||||||
Par_GetParToText ("Folder",NewAsg.Folder,Asg_MAX_BYTES_FOLDER);
|
Par_GetParToText ("Folder",NewAsg.Folder,Brw_MAX_BYTES_FOLDER);
|
||||||
NewAsg.SendWork = (NewAsg.Folder[0]) ? Asg_SEND_WORK :
|
NewAsg.SendWork = (NewAsg.Folder[0]) ? Asg_SEND_WORK :
|
||||||
Asg_DO_NOT_SEND_WORK;
|
Asg_DO_NOT_SEND_WORK;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#include "swad_date.h"
|
#include "swad_date.h"
|
||||||
|
#include "swad_file_browser.h"
|
||||||
#include "swad_notification.h"
|
#include "swad_notification.h"
|
||||||
#include "swad_user.h"
|
#include "swad_user.h"
|
||||||
|
|
||||||
|
@ -38,9 +39,6 @@
|
||||||
#define Asg_MAX_CHARS_ASSIGNMENT_TITLE (128 - 1) // 127
|
#define Asg_MAX_CHARS_ASSIGNMENT_TITLE (128 - 1) // 127
|
||||||
#define Asg_MAX_BYTES_ASSIGNMENT_TITLE ((Asg_MAX_CHARS_ASSIGNMENT_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
#define Asg_MAX_BYTES_ASSIGNMENT_TITLE ((Asg_MAX_CHARS_ASSIGNMENT_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||||
|
|
||||||
#define Asg_MAX_CHARS_FOLDER NAME_MAX // 255
|
|
||||||
#define Asg_MAX_BYTES_FOLDER Asg_MAX_CHARS_FOLDER // 255
|
|
||||||
|
|
||||||
#define Asg_NUM_TYPES_SEND_WORK 2
|
#define Asg_NUM_TYPES_SEND_WORK 2
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -57,7 +55,7 @@ struct Assignment
|
||||||
bool Open;
|
bool Open;
|
||||||
char Title[Asg_MAX_BYTES_ASSIGNMENT_TITLE + 1];
|
char Title[Asg_MAX_BYTES_ASSIGNMENT_TITLE + 1];
|
||||||
Asg_SendWork_t SendWork;
|
Asg_SendWork_t SendWork;
|
||||||
char Folder[Asg_MAX_BYTES_FOLDER + 1];
|
char Folder[Brw_MAX_BYTES_FOLDER + 1];
|
||||||
bool IBelongToCrsOrGrps; // I can do this assignment
|
bool IBelongToCrsOrGrps; // I can do this assignment
|
||||||
// (it is associated to no groups
|
// (it is associated to no groups
|
||||||
// or, if associated to groups,
|
// or, if associated to groups,
|
||||||
|
|
|
@ -204,13 +204,14 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.154.2 (2017-03-08)"
|
#define Log_PLATFORM_VERSION "SWAD 16.154.3 (2017-03-08)"
|
||||||
#define CSS_FILE "swad16.147.css"
|
#define CSS_FILE "swad16.147.css"
|
||||||
#define JS_FILE "swad16.144.js"
|
#define JS_FILE "swad16.144.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 16.154.3: Mar 08, 2017 Bug fixing related to folders in assignments and file browsers. (216473 lines)
|
||||||
Version 16.154.2: Mar 08, 2017 Adjusting size of database fields. (216466 lines)
|
Version 16.154.2: Mar 08, 2017 Adjusting size of database fields. (216466 lines)
|
||||||
2 changes necessary in database:
|
2 changes necessary in database:
|
||||||
ALTER TABLE assignments CHANGE COLUMN Title Title VARCHAR(2047) NOT NULL;
|
ALTER TABLE assignments CHANGE COLUMN Title Title VARCHAR(2047) NOT NULL;
|
||||||
|
|
|
@ -289,7 +289,7 @@ mysql> DESCRIBE assignments;
|
||||||
"StartTime DATETIME NOT NULL,"
|
"StartTime DATETIME NOT NULL,"
|
||||||
"EndTime DATETIME NOT NULL,"
|
"EndTime DATETIME NOT NULL,"
|
||||||
"Title VARCHAR(2047) NOT NULL," // Asg_MAX_BYTES_ASSIGNMENT_TITLE
|
"Title VARCHAR(2047) NOT NULL," // Asg_MAX_BYTES_ASSIGNMENT_TITLE
|
||||||
"Folder VARBINARY(255) NOT NULL," // Asg_MAX_BYTES_FOLDER
|
"Folder VARBINARY(255) NOT NULL," // Brw_MAX_BYTES_FOLDER
|
||||||
"Txt TEXT NOT NULL," // Cns_MAX_BYTES_TEXT
|
"Txt TEXT NOT NULL," // Cns_MAX_BYTES_TEXT
|
||||||
"UNIQUE INDEX(AsgCod),"
|
"UNIQUE INDEX(AsgCod),"
|
||||||
"INDEX(CrsCod,Hidden))");
|
"INDEX(CrsCod,Hidden))");
|
||||||
|
@ -313,15 +313,15 @@ mysql> DESCRIBE att_events;
|
||||||
9 rows in set (0.00 sec)
|
9 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS att_events ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS att_events ("
|
||||||
"AttCod INT NOT NULL AUTO_INCREMENT,"
|
"AttCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
"CrsCod INT NOT NULL DEFAULT -1,"
|
"CrsCod INT NOT NULL DEFAULT -1,"
|
||||||
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
"StartTime DATETIME NOT NULL,"
|
"StartTime DATETIME NOT NULL,"
|
||||||
"EndTime DATETIME NOT NULL,"
|
"EndTime DATETIME NOT NULL,"
|
||||||
"CommentTchVisible ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
"CommentTchVisible ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||||
"Title VARCHAR(255) NOT NULL,"
|
"Title VARCHAR(255) NOT NULL,"
|
||||||
"Txt TEXT NOT NULL,"
|
"Txt TEXT NOT NULL,"
|
||||||
"UNIQUE INDEX(AttCod),"
|
"UNIQUE INDEX(AttCod),"
|
||||||
"INDEX(CrsCod,Hidden))");
|
"INDEX(CrsCod,Hidden))");
|
||||||
|
|
||||||
|
|
|
@ -1565,7 +1565,7 @@ static bool Brw_PasteTreeIntoFolder (unsigned Level,
|
||||||
const char PathDstInTree[PATH_MAX + 1],
|
const char PathDstInTree[PATH_MAX + 1],
|
||||||
struct Brw_NumObjects *Pasted,
|
struct Brw_NumObjects *Pasted,
|
||||||
long *FirstFilCod);
|
long *FirstFilCod);
|
||||||
static void Brw_PutFormToCreateAFolder (const char *FileNameToShow);
|
static void Brw_PutFormToCreateAFolder (const char FileNameToShow[NAME_MAX + 1]);
|
||||||
static void Brw_PutFormToUploadFilesUsingDropzone (const char *FileNameToShow);
|
static void Brw_PutFormToUploadFilesUsingDropzone (const char *FileNameToShow);
|
||||||
static void Brw_PutFormToUploadOneFileClassic (const char *FileNameToShow);
|
static void Brw_PutFormToUploadOneFileClassic (const char *FileNameToShow);
|
||||||
static void Brw_PutFormToPasteAFileOrFolder (const char *FileNameToShow);
|
static void Brw_PutFormToPasteAFileOrFolder (const char *FileNameToShow);
|
||||||
|
@ -2500,7 +2500,7 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
|
||||||
if (Gbl.FileBrowser.Level == 1)
|
if (Gbl.FileBrowser.Level == 1)
|
||||||
// We are in this case: assignments/assignment-folder
|
// We are in this case: assignments/assignment-folder
|
||||||
Str_Copy (Gbl.FileBrowser.Asg.Folder,Gbl.FileBrowser.FilFolLnkName,
|
Str_Copy (Gbl.FileBrowser.Asg.Folder,Gbl.FileBrowser.FilFolLnkName,
|
||||||
Asg_MAX_BYTES_FOLDER);
|
Brw_MAX_BYTES_FOLDER);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We are in this case: assignments/assignment-folder/rest-of-path
|
// We are in this case: assignments/assignment-folder/rest-of-path
|
||||||
|
@ -2510,7 +2510,7 @@ static void Brw_GetParamsPathInTreeAndFileName (void)
|
||||||
if (*Ptr == '/')
|
if (*Ptr == '/')
|
||||||
Ptr++; // Skip '/'
|
Ptr++; // Skip '/'
|
||||||
for (i = 0;
|
for (i = 0;
|
||||||
i < Asg_MAX_BYTES_FOLDER && *Ptr && *Ptr != '/';
|
i < Brw_MAX_BYTES_FOLDER && *Ptr && *Ptr != '/';
|
||||||
i++, Ptr++)
|
i++, Ptr++)
|
||||||
Gbl.FileBrowser.Asg.Folder[i] = *Ptr; // Copy assignment folder
|
Gbl.FileBrowser.Asg.Folder[i] = *Ptr; // Copy assignment folder
|
||||||
Gbl.FileBrowser.Asg.Folder[i] = '\0';
|
Gbl.FileBrowser.Asg.Folder[i] = '\0';
|
||||||
|
@ -5206,7 +5206,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,Brw_ExpandTree_t ExpandTree,
|
||||||
if (Level == 1) // Main folder of the assignment
|
if (Level == 1) // Main folder of the assignment
|
||||||
{
|
{
|
||||||
Str_Copy (Gbl.FileBrowser.Asg.Folder,FileName,
|
Str_Copy (Gbl.FileBrowser.Asg.Folder,FileName,
|
||||||
Asg_MAX_BYTES_FOLDER);
|
Brw_MAX_BYTES_FOLDER);
|
||||||
Asg_GetDataOfAssignmentByFolder (&Gbl.FileBrowser.Asg);
|
Asg_GetDataOfAssignmentByFolder (&Gbl.FileBrowser.Asg);
|
||||||
// The data of this assignment remains in Gbl.FileBrowser.Asg
|
// The data of this assignment remains in Gbl.FileBrowser.Asg
|
||||||
// for all subsequent rows with Level > 1 (files or folders inside this folder),
|
// for all subsequent rows with Level > 1 (files or folders inside this folder),
|
||||||
|
@ -5905,10 +5905,11 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic,
|
||||||
if (Gbl.FileBrowser.ICanEditFileOrFolder) // Can I rename this folder?
|
if (Gbl.FileBrowser.ICanEditFileOrFolder) // Can I rename this folder?
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"NewFolderName\""
|
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"NewFolderName\""
|
||||||
" maxlength=\"30\" value=\"%s\""
|
" maxlength=\"%u\" value=\"%s\""
|
||||||
" class=\"%s %s\""
|
" class=\"%s %s\""
|
||||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||||
FileName,Gbl.FileBrowser.InputStyle,
|
Brw_MAX_CHARS_FOLDER,FileName,
|
||||||
|
Gbl.FileBrowser.InputStyle,
|
||||||
Gbl.FileBrowser.Clipboard.IsThisFile ? "LIGHT_GREEN" :
|
Gbl.FileBrowser.Clipboard.IsThisFile ? "LIGHT_GREEN" :
|
||||||
Gbl.ColorRows[Gbl.RowEvenOdd],
|
Gbl.ColorRows[Gbl.RowEvenOdd],
|
||||||
Gbl.Form.Id);
|
Gbl.Form.Id);
|
||||||
|
@ -7904,7 +7905,7 @@ void Brw_ShowFormFileBrowser (void)
|
||||||
/************* Put form to create a new folder in a file browser *************/
|
/************* Put form to create a new folder in a file browser *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Brw_PutFormToCreateAFolder (const char *FileNameToShow)
|
static void Brw_PutFormToCreateAFolder (const char FileNameToShow[NAME_MAX + 1])
|
||||||
{
|
{
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||||
extern const char *Txt_Create_folder;
|
extern const char *Txt_Create_folder;
|
||||||
|
@ -7928,10 +7929,11 @@ static void Brw_PutFormToCreateAFolder (const char *FileNameToShow)
|
||||||
fprintf (Gbl.F.Out,"<label class=\"%s\">"
|
fprintf (Gbl.F.Out,"<label class=\"%s\">"
|
||||||
"%s: "
|
"%s: "
|
||||||
"<input type=\"text\" name=\"NewFolderName\""
|
"<input type=\"text\" name=\"NewFolderName\""
|
||||||
" size=\"30\" maxlength=\"30\" value=\"\""
|
" size=\"30\" maxlength=\"%u\" value=\"\""
|
||||||
" required=\"required\" />"
|
" required=\"required\" />"
|
||||||
"</label>",
|
"</label>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],Txt_Folder);
|
The_ClassForm[Gbl.Prefs.Theme],Txt_Folder,
|
||||||
|
Brw_MAX_CHARS_FOLDER);
|
||||||
|
|
||||||
/* Button to send and end frame *****/
|
/* Button to send and end frame *****/
|
||||||
Lay_EndRoundFrameWithButton (Lay_CREATE_BUTTON,Txt_Create_folder);
|
Lay_EndRoundFrameWithButton (Lay_CREATE_BUTTON,Txt_Create_folder);
|
||||||
|
@ -8128,11 +8130,12 @@ static void Brw_PutFormToCreateALink (const char *FileNameToShow)
|
||||||
"<td class=\"LEFT_MIDDLE\">"
|
"<td class=\"LEFT_MIDDLE\">"
|
||||||
"<input type=\"text\""
|
"<input type=\"text\""
|
||||||
" id=\"NewLinkName\" name=\"NewLinkName\""
|
" id=\"NewLinkName\" name=\"NewLinkName\""
|
||||||
" size=\"30\" maxlength=\"100\" value=\"\" />"
|
" size=\"30\" maxlength=\"%u\" value=\"\" />"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>"
|
"</tr>"
|
||||||
"</table>",
|
"</table>",
|
||||||
The_ClassForm[Gbl.Prefs.Theme],Txt_Save_as,Txt_optional);
|
The_ClassForm[Gbl.Prefs.Theme],Txt_Save_as,Txt_optional,
|
||||||
|
Brw_MAX_CHARS_FOLDER);
|
||||||
|
|
||||||
/***** Send button and end frame *****/
|
/***** Send button and end frame *****/
|
||||||
Lay_EndRoundFrameWithButton (Lay_CREATE_BUTTON,Txt_Create_link);
|
Lay_EndRoundFrameWithButton (Lay_CREATE_BUTTON,Txt_Create_link);
|
||||||
|
|
|
@ -33,9 +33,12 @@
|
||||||
#include "swad_notification.h"
|
#include "swad_notification.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************************* Public types ********************************/
|
/************************ Public types and constants *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#define Brw_MAX_CHARS_FOLDER 30 // 30
|
||||||
|
#define Brw_MAX_BYTES_FOLDER NAME_MAX // 255
|
||||||
|
|
||||||
#define Brw_NUM_TYPES_FILE_BROWSER 27
|
#define Brw_NUM_TYPES_FILE_BROWSER 27
|
||||||
// The following types are stored in several database tables as numeric fields,
|
// The following types are stored in several database tables as numeric fields,
|
||||||
// so don't change numbers!
|
// so don't change numbers!
|
||||||
|
|
Loading…
Reference in New Issue