Version 15.173

This commit is contained in:
Antonio Cañas Vargas 2016-04-01 14:44:55 +02:00
parent 9403a8b931
commit f90760fd5e
5 changed files with 66 additions and 22 deletions

View File

@ -1432,7 +1432,7 @@ a:hover img.CENTRE_PHOTO_SHOW
border:solid 1px #EEE;
box-shadow:1px 1px 6px #999;
}
/**************** Attribution (author and license) of images *****************/
#AttributionArea
{
@ -1732,6 +1732,19 @@ a:hover img.CENTRE_PHOTO_SHOW
.TEST_EXA_LIGHT {color:#A0A0A0; font-size:12pt;}
.TEST_EDI {color:#404040; font-size:12pt;}
.TEST_EDI_LIGHT {color:#A0A0A0; font-size:12pt;}
.TEST_IMG_SHOW
{
width:600px;
margin:10px 0;
}
.TEST_IMG_EDIT_LIST
{
width:256px;
}
.TEST_IMG_EDIT_ONE
{
width:600px;
}
/******************************* Time table **********************************/
#timetable

View File

@ -138,14 +138,15 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.172.1 (2016-04-01)"
#define CSS_FILE "swad15.165.5.css"
#define Log_PLATFORM_VERSION "SWAD 15.173 (2016-04-01)"
#define CSS_FILE "swad15.173.css"
#define JS_FILE "swad15.131.3.js"
// 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
/*
Version 15.172.1: Apr 01, 2016 Reception of test image. Not finished. (197398 lines)
Version 15.173: Apr 01, 2016 Show image in test question, if present. (197435 lines)
Version 15.172.1: Apr 01, 2016 Reception of test image. (197398 lines)
Version 15.172: Apr 01, 2016 Reception of test image. Not finished. (197339 lines)
Version 15.171.2: Apr 01, 2016 Change in message related to user photo. (197272 lines)
Version 15.171.1: Apr 01, 2016 Code refactoring in functions to get a parameter and to receive file. (197271 lines)

View File

@ -1444,7 +1444,6 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic,Brw_FileType_t FileT
static void Brw_GetFileNameToShow (Brw_FileBrowser_t FileBrowser,unsigned Level,Brw_FileType_t FileType,
const char *FileName,char *FileNameToShow);
static void Brw_LimitLengthFileNameToShow (Brw_FileType_t FileType,const char *FileName,char *FileNameToShow);
static void Brw_CreateTmpLinkToDownloadFileBrowser (const char *FullPathIncludingFile,const char *FileName);
static void Brw_WriteDatesAssignment (void);
static void Brw_WriteFileSizeAndDate (Brw_FileType_t FileType,struct FileMetadata *FileMetadata);
static void Brw_WriteFileOrFolderPublisher (unsigned Level,unsigned long UsrCod);
@ -5864,19 +5863,20 @@ static void Brw_LimitLengthFileNameToShow (Brw_FileType_t FileType,const char *F
}
/*****************************************************************************/
/****** Create a link in public temporary directory to download a file *******/
/****** Create a link in public temporary directory to a private file ********/
/*****************************************************************************/
static void Brw_CreateTmpLinkToDownloadFileBrowser (const char *FullPathIncludingFile,const char *FileName)
void Brw_CreateTmpPublicLinkToPrivateFile (const char *FullPathIncludingFile,
const char *FileName)
{
char Link[PATH_MAX+1];
/***** Create, into temporary download directory, a symbolic link to file *****/
/***** Create, into temporary public directory, a symbolic link to file *****/
sprintf (Link,"%s/%s/%s/%s",
Cfg_PATH_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
Gbl.FileBrowser.TmpPubDir,FileName);
if (symlink (FullPathIncludingFile,Link) != 0)
Lay_ShowErrorAndExit ("Can not create temporary link for download.");
Lay_ShowErrorAndExit ("Can not create temporary link.");
}
/*****************************************************************************/
@ -9681,7 +9681,7 @@ void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char
Brw_CreateDirDownloadTmp ();
/***** Create symbolic link from temporary public directory to private file in order to gain access to it for downloading *****/
Brw_CreateTmpLinkToDownloadFileBrowser (FullPathIncludingFile,FileName);
Brw_CreateTmpPublicLinkToPrivateFile (FullPathIncludingFile,FileName);
/***** Create URL pointing to symbolic link *****/
sprintf (URLWithSpaces,"%s/%s/%s/%s",

View File

@ -214,6 +214,9 @@ void Brw_CalcSizeOfDir (char *Path);
void Brw_SetFullPathInTree (const char *PathInTreeUntilFileOrFolder,const char *FilFolLnkName);
void Brw_CreateTmpPublicLinkToPrivateFile (const char *FullPathIncludingFile,
const char *FileName);
void Brw_ParamListFiles (Brw_FileType_t FileType,const char *PathInTree,const char *FileName);
void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod);

View File

@ -154,7 +154,7 @@ static void Tst_ShowTestQuestionsWhenSeeing (MYSQL_RES *mysql_res);
static void Tst_ShowTstResultAfterAssess (long TstCod,unsigned *NumQstsNotBlank,double *TotalScore);
static void Tst_WriteQstAndAnsExam (unsigned NumQst,long QstCod,MYSQL_ROW row,
double *ScoreThisQst,bool *AnswerIsNotBlank);
static void Tst_WriteQstImage (const char *Image);
static void Tst_WriteQstImage (const char *Image,const char *ClassImg);
static void Tst_PutFormToUploadNewQstImage (void);
static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotBlank);
static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst);
@ -978,7 +978,7 @@ static void Tst_WriteQstAndAnsExam (unsigned NumQst,long QstCod,MYSQL_ROW row,
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd);
Tst_WriteQstStem (row[4],"TEST_EXA");
Tst_WriteQstImage (row[5]);
Tst_WriteQstImage (row[5],"TEST_IMG_SHOW");
if (Gbl.Action.Act == ActSeeTst)
Tst_WriteAnswersOfAQstSeeExam (NumQst,QstCod,(Str_ConvertToUpperLetter (row[3][0]) == 'Y'));
else // Assessing exam / Viewing old exam
@ -1023,15 +1023,42 @@ void Tst_WriteQstStem (const char *Stem,const char *ClassStem)
/******************** Write the image of a test question *********************/
/*****************************************************************************/
static void Tst_WriteQstImage (const char *Image)
static void Tst_WriteQstImage (const char *Image,const char *ClassImg)
{
if (Image)
if (Image[0])
/***** Write the image *****/
fprintf (Gbl.F.Out,"<div>"
"%s"
"</div>",
Image);
char FileNameImgPriv[PATH_MAX+1];
char FullPathImgPriv[PATH_MAX+1];
char URL[PATH_MAX+1];
if (!Image)
return;
if (!Image[0])
return;
/***** Create a temporary public directory
used to download the zip file *****/
Brw_CreateDirDownloadTmp ();
/***** Create symbolic link from temporary public directory to private file in order to gain access to it for downloading *****/
/* Private path to image */
sprintf (FileNameImgPriv,"%s.jpg",
Image);
sprintf (FullPathImgPriv,"%s/%s/%c%c/%s",
Cfg_PATH_SWAD_PRIVATE,Cfg_FOLDER_IMG,
Image[0],
Image[1],
FileNameImgPriv);
Brw_CreateTmpPublicLinkToPrivateFile (FullPathImgPriv,FileNameImgPriv);
/***** Create URL pointing to symbolic link *****/
sprintf (URL,"%s/%s/%s/%s",
Cfg_HTTPS_URL_SWAD_PUBLIC,Cfg_FOLDER_FILE_BROWSER_TMP,
Gbl.FileBrowser.TmpPubDir,
FileNameImgPriv);
/***** Show image *****/
fprintf (Gbl.F.Out,"<img src=\"%s\" alt=\"\" class=\"%s\"/>"
"<br />",
URL,ClassImg);
}
/*****************************************************************************/
@ -2683,7 +2710,7 @@ static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *m
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd);
Tst_WriteQstStem (row[4],"TEST_EDI");
Tst_WriteQstImage (row[5]);
Tst_WriteQstImage (row[5],"TEST_IMG_EDIT_LIST");
Tst_WriteQstFeedback (row[6],"TEST_EDI_LIGHT");
Tst_WriteAnswersOfAQstEdit (QstCod);
fprintf (Gbl.F.Out,"</td>");
@ -4414,7 +4441,7 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
"<td class=\"LEFT_TOP\">",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Image);
Tst_WriteQstImage (Gbl.Test.Image);
Tst_WriteQstImage (Gbl.Test.Image,"TEST_IMG_EDIT_ONE");
Tst_PutFormToUploadNewQstImage ();
fprintf (Gbl.F.Out,"</td>"
"</tr>");