mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-01 14:25:27 +02:00
Version19.138.1
This commit is contained in:
parent
d26d9c3387
commit
fac1012109
|
@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
|
||||||
En OpenSWAD:
|
En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 19.138 (2020-02-29)"
|
#define Log_PLATFORM_VERSION "SWAD 19.138.1 (2020-02-29)"
|
||||||
#define CSS_FILE "swad19.136.css"
|
#define CSS_FILE "swad19.136.css"
|
||||||
#define JS_FILE "swad19.91.1.js"
|
#define JS_FILE "swad19.91.1.js"
|
||||||
/*
|
/*
|
||||||
|
@ -523,10 +523,12 @@ Param
|
||||||
// TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado)
|
// TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado)
|
||||||
// TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo
|
// TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo
|
||||||
|
|
||||||
Version 19.138: Feb 27, 2020 Move subtrees up and down in course program. (282230 lines)
|
Version 19.138.2: Feb 29, 2020 Check if arrows are correct (move up is wring). (? lines)
|
||||||
Version 19.137: Feb 27, 2020 Removed pagination in course program. (282305 lines)
|
Version 19.138.1: Feb 29, 2020 Fixed bugs in course program. (282252 lines)
|
||||||
Version 19.136.3: Feb 27, 2020 Fixed bugs in numeration of items in course program. (282363 lines)
|
Version 19.138: Feb 29, 2020 Move subtrees up and down in course program. (282230 lines)
|
||||||
Version 19.136.2: Feb 27, 2020 Move to left items in course program. (282330 lines)
|
Version 19.137: Feb 29, 2020 Removed pagination in course program. (282305 lines)
|
||||||
|
Version 19.136.3: Feb 29, 2020 Fixed bugs in numeration of items in course program. (282363 lines)
|
||||||
|
Version 19.136.2: Feb 29, 2020 Move to left items in course program. (282330 lines)
|
||||||
Version 19.136.1: Feb 29, 2020 Fixed bugs in course program. (282301 lines)
|
Version 19.136.1: Feb 29, 2020 Fixed bugs in course program. (282301 lines)
|
||||||
Version 19.136: Feb 27, 2020 Move to right (indent) items in course program. (282292 lines)
|
Version 19.136: Feb 27, 2020 Move to right (indent) items in course program. (282292 lines)
|
||||||
3 changes necessary in database:
|
3 changes necessary in database:
|
||||||
|
|
229
swad_program.c
229
swad_program.c
|
@ -972,8 +972,8 @@ void Prg_MoveUpPrgItem (void)
|
||||||
This.End = Prg_GetLastChildIndex (Item.Index,Item.Level);
|
This.End = Prg_GetLastChildIndex (Item.Index,Item.Level);
|
||||||
|
|
||||||
/* Exchange items */
|
/* Exchange items */
|
||||||
Prg_ExchangeItems (Prev.Begin,Prev.End,
|
Prg_ExchangeItems ((int) Prev.Begin,(int) Prev.End,
|
||||||
This.Begin,This.End);
|
(int) This.Begin,(int) This.End);
|
||||||
|
|
||||||
/***** Show program items again *****/
|
/***** Show program items again *****/
|
||||||
Prg_SeeCourseProgram ();
|
Prg_SeeCourseProgram ();
|
||||||
|
@ -1007,6 +1007,12 @@ void Prg_MoveDownPrgItem (void)
|
||||||
Next.Begin = Prg_GetNextBrotherIndex (Item.Index,Item.Level);
|
Next.Begin = Prg_GetNextBrotherIndex (Item.Index,Item.Level);
|
||||||
Next.End = Prg_GetLastChildIndex (Next.Begin,Item.Level);
|
Next.End = Prg_GetLastChildIndex (Next.Begin,Item.Level);
|
||||||
|
|
||||||
|
Ale_ShowAlert (Ale_INFO,"This.Begin = %u<br />"
|
||||||
|
"This.End = %u<br />"
|
||||||
|
"Next.Begin = %u<br />"
|
||||||
|
"Next.End = %u",
|
||||||
|
This.Begin,This.End,Next.Begin,Next.End);
|
||||||
|
|
||||||
/* Exchange items */
|
/* Exchange items */
|
||||||
Prg_ExchangeItems (This.Begin,This.End,
|
Prg_ExchangeItems (This.Begin,This.End,
|
||||||
Next.Begin,Next.End);
|
Next.Begin,Next.End);
|
||||||
|
@ -1129,29 +1135,31 @@ static unsigned Prg_GetPrevIndex (unsigned Index)
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned PrevIndex = 0;
|
unsigned PrevIndex = 0;
|
||||||
|
|
||||||
/***** Get previous item index in a course from database *****/
|
if (Index)
|
||||||
if (!DB_QuerySELECT (&mysql_res,"can not get previous item index",
|
{
|
||||||
"SELECT MAX(ItmInd)" // row[0]
|
/***** Get previous item index in a course from database *****/
|
||||||
" FROM prg_items"
|
if (!DB_QuerySELECT (&mysql_res,"can not get previous item index",
|
||||||
" WHERE CrsCod=%ld"
|
"SELECT MAX(ItmInd)" // row[0]
|
||||||
" AND ItmInd<%u",
|
" FROM prg_items"
|
||||||
Gbl.Hierarchy.Crs.CrsCod,Index))
|
" WHERE CrsCod=%ld"
|
||||||
Lay_ShowErrorAndExit ("Error: previous item index not found.");
|
" AND ItmInd<%u",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,Index))
|
||||||
|
Lay_ShowErrorAndExit ("Error: previous item index not found.");
|
||||||
|
|
||||||
/***** Get previous item index (row[0]) *****/
|
/***** Get previous item index (row[0]) *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if (row)
|
if (row)
|
||||||
if (row[0])
|
if (row[0])
|
||||||
if (sscanf (row[0],"%u",&PrevIndex) != 1)
|
if (sscanf (row[0],"%u",&PrevIndex) != 1)
|
||||||
Lay_ShowErrorAndExit ("Error when getting previous item index.");
|
Lay_ShowErrorAndExit ("Error when getting previous item index.");
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
}
|
||||||
|
|
||||||
return PrevIndex;
|
return PrevIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************ Get parent index to a given index in current course ************/
|
/************ Get parent index to a given index in current course ************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1163,27 +1171,28 @@ static unsigned Prg_GetParentIndex (unsigned Index,unsigned Level)
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned ParentIndex = 0;
|
unsigned ParentIndex = 0;
|
||||||
|
|
||||||
if (Level > 1)
|
if (Index)
|
||||||
{
|
if (Level > 1)
|
||||||
/***** Get parent item index in a course from database *****/
|
{
|
||||||
if (!DB_QuerySELECT (&mysql_res,"can not get parent item index",
|
/***** Get parent item index in a course from database *****/
|
||||||
"SELECT MAX(ItmInd)" // row[0]
|
if (!DB_QuerySELECT (&mysql_res,"can not get parent item index",
|
||||||
" FROM prg_items"
|
"SELECT MAX(ItmInd)" // row[0]
|
||||||
" WHERE CrsCod=%ld"
|
" FROM prg_items"
|
||||||
" AND ItmInd<%u AND Level=%u",
|
" WHERE CrsCod=%ld"
|
||||||
Gbl.Hierarchy.Crs.CrsCod,Index,Level - 1))
|
" AND ItmInd<%u AND Level=%u",
|
||||||
Lay_ShowErrorAndExit ("Error: parent item index not found.");
|
Gbl.Hierarchy.Crs.CrsCod,Index,Level - 1))
|
||||||
|
Lay_ShowErrorAndExit ("Error: parent item index not found.");
|
||||||
|
|
||||||
/***** Get previous item index (row[0]) *****/
|
/***** Get previous item index (row[0]) *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if (row)
|
if (row)
|
||||||
if (row[0])
|
if (row[0])
|
||||||
if (sscanf (row[0],"%u",&ParentIndex) != 1)
|
if (sscanf (row[0],"%u",&ParentIndex) != 1)
|
||||||
Lay_ShowErrorAndExit ("Error when getting parent item index.");
|
Lay_ShowErrorAndExit ("Error when getting parent item index.");
|
||||||
}
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
}
|
||||||
|
|
||||||
return ParentIndex;
|
return ParentIndex;
|
||||||
}
|
}
|
||||||
|
@ -1199,24 +1208,27 @@ static unsigned Prg_GetNextLowerIndex (unsigned Index,unsigned Level)
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned NextLowerIndex = 0;
|
unsigned NextLowerIndex = 0;
|
||||||
|
|
||||||
/***** Get next item index in a course from database *****/
|
if (Index)
|
||||||
if (!DB_QuerySELECT (&mysql_res,"can not get next brother item index",
|
{
|
||||||
"SELECT MIN(ItmInd)" // row[0]
|
/***** Get next item index in a course from database *****/
|
||||||
" FROM prg_items"
|
if (!DB_QuerySELECT (&mysql_res,"can not get next brother item index",
|
||||||
" WHERE CrsCod=%ld"
|
"SELECT MIN(ItmInd)" // row[0]
|
||||||
" AND ItmInd>%u AND Level>%u",
|
" FROM prg_items"
|
||||||
Gbl.Hierarchy.Crs.CrsCod,Index,Level))
|
" WHERE CrsCod=%ld"
|
||||||
Lay_ShowErrorAndExit ("Error: next brother item index not found.");
|
" AND ItmInd>%u AND Level>%u",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,Index,Level))
|
||||||
|
Lay_ShowErrorAndExit ("Error: next brother item index not found.");
|
||||||
|
|
||||||
/***** Get previous item index (row[0]) *****/
|
/***** Get previous item index (row[0]) *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if (row)
|
if (row)
|
||||||
if (row[0])
|
if (row[0])
|
||||||
if (sscanf (row[0],"%u",&NextLowerIndex) != 1)
|
if (sscanf (row[0],"%u",&NextLowerIndex) != 1)
|
||||||
Lay_ShowErrorAndExit ("Error when getting next brother item index.");
|
Lay_ShowErrorAndExit ("Error when getting next brother item index.");
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
}
|
||||||
|
|
||||||
return NextLowerIndex;
|
return NextLowerIndex;
|
||||||
}
|
}
|
||||||
|
@ -1230,28 +1242,33 @@ static unsigned Prg_GetPrevBrotherIndex (unsigned Index,unsigned Level)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
unsigned ParentIndex;
|
||||||
unsigned PrevBrotherIndex = 0;
|
unsigned PrevBrotherIndex = 0;
|
||||||
unsigned ParentIndex = Prg_GetParentIndex (Index,Level);
|
|
||||||
|
|
||||||
/***** Get previous brother item index in a course from database *****/
|
if (Index)
|
||||||
if (!DB_QuerySELECT (&mysql_res,"can not get previous brother item index",
|
{
|
||||||
"SELECT MAX(ItmInd)" // row[0]
|
ParentIndex = Prg_GetParentIndex (Index,Level);
|
||||||
" FROM prg_items"
|
|
||||||
" WHERE CrsCod=%ld"
|
|
||||||
" AND ItmInd>%u AND ItmInd<%u AND Level=%u",
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
|
||||||
ParentIndex,Index,Level))
|
|
||||||
Lay_ShowErrorAndExit ("Error: previous brother item index not found.");
|
|
||||||
|
|
||||||
/***** Get previous item index (row[0]) *****/
|
/***** Get previous brother item index in a course from database *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
if (!DB_QuerySELECT (&mysql_res,"can not get previous brother item index",
|
||||||
if (row)
|
"SELECT MAX(ItmInd)" // row[0]
|
||||||
if (row[0])
|
" FROM prg_items"
|
||||||
if (sscanf (row[0],"%u",&PrevBrotherIndex) != 1)
|
" WHERE CrsCod=%ld"
|
||||||
Lay_ShowErrorAndExit ("Error when getting previous brother item index.");
|
" AND ItmInd>%u AND ItmInd<%u AND Level=%u",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
|
ParentIndex,Index,Level))
|
||||||
|
Lay_ShowErrorAndExit ("Error: previous brother item index not found.");
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Get previous item index (row[0]) *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
if (row)
|
||||||
|
if (row[0])
|
||||||
|
if (sscanf (row[0],"%u",&PrevBrotherIndex) != 1)
|
||||||
|
Lay_ShowErrorAndExit ("Error when getting previous brother item index.");
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
}
|
||||||
|
|
||||||
return PrevBrotherIndex;
|
return PrevBrotherIndex;
|
||||||
}
|
}
|
||||||
|
@ -1265,42 +1282,47 @@ static unsigned Prg_GetNextBrotherIndex (unsigned Index,unsigned Level)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
|
unsigned NextLowerIndex;
|
||||||
unsigned NextBrotherIndex = 0;
|
unsigned NextBrotherIndex = 0;
|
||||||
unsigned NextLowerIndex = Prg_GetNextLowerIndex (Index,Level);
|
|
||||||
|
|
||||||
/***** Get next brother item index in a course from database *****/
|
if (Index)
|
||||||
if (NextLowerIndex)
|
|
||||||
{
|
{
|
||||||
if (!DB_QuerySELECT (&mysql_res,"can not get next brother item index",
|
NextLowerIndex = Prg_GetNextLowerIndex (Index,Level);
|
||||||
"SELECT MIN(ItmInd)" // row[0]
|
|
||||||
" FROM prg_items"
|
|
||||||
" WHERE CrsCod=%ld"
|
|
||||||
" AND ItmInd>%u AND Level=%u",
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
|
||||||
Index,Level))
|
|
||||||
Lay_ShowErrorAndExit ("Error: next brother item index not found.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!DB_QuerySELECT (&mysql_res,"can not get next brother item index",
|
|
||||||
"SELECT MIN(ItmInd)" // row[0]
|
|
||||||
" FROM prg_items"
|
|
||||||
" WHERE CrsCod=%ld"
|
|
||||||
" AND ItmInd>%u AND ItmInd<%u AND Level=%u",
|
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
|
||||||
Index,NextLowerIndex,Level))
|
|
||||||
Lay_ShowErrorAndExit ("Error: next brother item index not found.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Get previous item index (row[0]) *****/
|
/***** Get next brother item index in a course from database *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
if (NextLowerIndex)
|
||||||
if (row)
|
{
|
||||||
if (row[0])
|
if (!DB_QuerySELECT (&mysql_res,"can not get next brother item index",
|
||||||
if (sscanf (row[0],"%u",&NextBrotherIndex) != 1)
|
"SELECT MIN(ItmInd)" // row[0]
|
||||||
Lay_ShowErrorAndExit ("Error when getting next brother item index.");
|
" FROM prg_items"
|
||||||
|
" WHERE CrsCod=%ld"
|
||||||
|
" AND ItmInd>%u AND ItmInd<%u AND Level=%u",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
|
Index,NextLowerIndex,Level))
|
||||||
|
Lay_ShowErrorAndExit ("Error: next brother item index not found.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!DB_QuerySELECT (&mysql_res,"can not get next brother item index",
|
||||||
|
"SELECT MIN(ItmInd)" // row[0]
|
||||||
|
" FROM prg_items"
|
||||||
|
" WHERE CrsCod=%ld"
|
||||||
|
" AND ItmInd>%u AND Level=%u",
|
||||||
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
|
Index,Level))
|
||||||
|
Lay_ShowErrorAndExit ("Error: next brother item index not found.");
|
||||||
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Get previous item index (row[0]) *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
if (row)
|
||||||
|
if (row[0])
|
||||||
|
if (sscanf (row[0],"%u",&NextBrotherIndex) != 1)
|
||||||
|
Lay_ShowErrorAndExit ("Error when getting next brother item index.");
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
}
|
||||||
|
|
||||||
return NextBrotherIndex;
|
return NextBrotherIndex;
|
||||||
}
|
}
|
||||||
|
@ -1357,7 +1379,6 @@ static void Prg_MoveItemAndChildrenLeft (const struct ProgramItem *Item)
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************** Move item and its children to left or right ****************/
|
/**************** Move item and its children to left or right ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user