Version19.138.1

This commit is contained in:
Antonio Cañas Vargas 2020-02-29 22:39:06 +01:00
parent d26d9c3387
commit fac1012109
2 changed files with 132 additions and 109 deletions

View File

@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
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 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: 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.137: Feb 27, 2020 Removed pagination in course program. (282305 lines)
Version 19.136.3: Feb 27, 2020 Fixed bugs in numeration of items in course program. (282363 lines)
Version 19.136.2: Feb 27, 2020 Move to left items in course program. (282330 lines)
Version 19.138.2: Feb 29, 2020 Check if arrows are correct (move up is wring). (? lines)
Version 19.138.1: Feb 29, 2020 Fixed bugs in course program. (282252 lines)
Version 19.138: Feb 29, 2020 Move subtrees up and down in course program. (282230 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: Feb 27, 2020 Move to right (indent) items in course program. (282292 lines)
3 changes necessary in database:

View File

@ -972,8 +972,8 @@ void Prg_MoveUpPrgItem (void)
This.End = Prg_GetLastChildIndex (Item.Index,Item.Level);
/* Exchange items */
Prg_ExchangeItems (Prev.Begin,Prev.End,
This.Begin,This.End);
Prg_ExchangeItems ((int) Prev.Begin,(int) Prev.End,
(int) This.Begin,(int) This.End);
/***** Show program items again *****/
Prg_SeeCourseProgram ();
@ -1007,6 +1007,12 @@ void Prg_MoveDownPrgItem (void)
Next.Begin = Prg_GetNextBrotherIndex (Item.Index,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 */
Prg_ExchangeItems (This.Begin,This.End,
Next.Begin,Next.End);
@ -1129,6 +1135,8 @@ static unsigned Prg_GetPrevIndex (unsigned Index)
MYSQL_ROW row;
unsigned PrevIndex = 0;
if (Index)
{
/***** Get previous item index in a course from database *****/
if (!DB_QuerySELECT (&mysql_res,"can not get previous item index",
"SELECT MAX(ItmInd)" // row[0]
@ -1147,11 +1155,11 @@ static unsigned Prg_GetPrevIndex (unsigned Index)
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
return PrevIndex;
}
/*****************************************************************************/
/************ Get parent index to a given index in current course ************/
/*****************************************************************************/
@ -1163,6 +1171,7 @@ static unsigned Prg_GetParentIndex (unsigned Index,unsigned Level)
MYSQL_ROW row;
unsigned ParentIndex = 0;
if (Index)
if (Level > 1)
{
/***** Get parent item index in a course from database *****/
@ -1180,10 +1189,10 @@ static unsigned Prg_GetParentIndex (unsigned Index,unsigned Level)
if (row[0])
if (sscanf (row[0],"%u",&ParentIndex) != 1)
Lay_ShowErrorAndExit ("Error when getting parent item index.");
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
return ParentIndex;
}
@ -1199,6 +1208,8 @@ static unsigned Prg_GetNextLowerIndex (unsigned Index,unsigned Level)
MYSQL_ROW row;
unsigned NextLowerIndex = 0;
if (Index)
{
/***** Get next item index in a course from database *****/
if (!DB_QuerySELECT (&mysql_res,"can not get next brother item index",
"SELECT MIN(ItmInd)" // row[0]
@ -1217,6 +1228,7 @@ static unsigned Prg_GetNextLowerIndex (unsigned Index,unsigned Level)
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
return NextLowerIndex;
}
@ -1230,8 +1242,12 @@ static unsigned Prg_GetPrevBrotherIndex (unsigned Index,unsigned Level)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned ParentIndex;
unsigned PrevBrotherIndex = 0;
unsigned ParentIndex = Prg_GetParentIndex (Index,Level);
if (Index)
{
ParentIndex = Prg_GetParentIndex (Index,Level);
/***** Get previous brother item index in a course from database *****/
if (!DB_QuerySELECT (&mysql_res,"can not get previous brother item index",
@ -1252,6 +1268,7 @@ static unsigned Prg_GetPrevBrotherIndex (unsigned Index,unsigned Level)
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
return PrevBrotherIndex;
}
@ -1265,8 +1282,12 @@ static unsigned Prg_GetNextBrotherIndex (unsigned Index,unsigned Level)
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NextLowerIndex;
unsigned NextBrotherIndex = 0;
unsigned NextLowerIndex = Prg_GetNextLowerIndex (Index,Level);
if (Index)
{
NextLowerIndex = Prg_GetNextLowerIndex (Index,Level);
/***** Get next brother item index in a course from database *****/
if (NextLowerIndex)
@ -1275,9 +1296,9 @@ static unsigned Prg_GetNextBrotherIndex (unsigned Index,unsigned Level)
"SELECT MIN(ItmInd)" // row[0]
" FROM prg_items"
" WHERE CrsCod=%ld"
" AND ItmInd>%u AND Level=%u",
" AND ItmInd>%u AND ItmInd<%u AND Level=%u",
Gbl.Hierarchy.Crs.CrsCod,
Index,Level))
Index,NextLowerIndex,Level))
Lay_ShowErrorAndExit ("Error: next brother item index not found.");
}
else
@ -1286,9 +1307,9 @@ static unsigned Prg_GetNextBrotherIndex (unsigned Index,unsigned Level)
"SELECT MIN(ItmInd)" // row[0]
" FROM prg_items"
" WHERE CrsCod=%ld"
" AND ItmInd>%u AND ItmInd<%u AND Level=%u",
" AND ItmInd>%u AND Level=%u",
Gbl.Hierarchy.Crs.CrsCod,
Index,NextLowerIndex,Level))
Index,Level))
Lay_ShowErrorAndExit ("Error: next brother item index not found.");
}
@ -1301,6 +1322,7 @@ static unsigned Prg_GetNextBrotherIndex (unsigned Index,unsigned Level)
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
return NextBrotherIndex;
}
@ -1357,7 +1379,6 @@ static void Prg_MoveItemAndChildrenLeft (const struct ProgramItem *Item)
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
}
/*****************************************************************************/
/**************** Move item and its children to left or right ****************/
/*****************************************************************************/