mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-12 03:35:27 +02:00
Version 15.218
This commit is contained in:
parent
14e0476163
commit
e3089e5ae7
1
Makefile
1
Makefile
|
@ -41,6 +41,7 @@ OBJS = swad_account.o swad_action.o swad_announcement.o swad_assignment.o \
|
||||||
swad_info.o swad_institution.o \
|
swad_info.o swad_institution.o \
|
||||||
swad_layout.o swad_link.o swad_logo.o \
|
swad_layout.o swad_link.o swad_logo.o \
|
||||||
swad_mail.o swad_main.o swad_mark.o swad_menu.o swad_message.o \
|
swad_mail.o swad_main.o swad_mark.o swad_menu.o swad_message.o \
|
||||||
|
swad_MFU.o \
|
||||||
swad_network.o swad_nickname.o swad_notice.o swad_notification.o \
|
swad_network.o swad_nickname.o swad_notice.o swad_notification.o \
|
||||||
swad_pagination.o swad_parameter.o swad_password.o swad_photo.o \
|
swad_pagination.o swad_parameter.o swad_password.o swad_photo.o \
|
||||||
swad_place.o swad_plugin.o swad_preference.o swad_profile.o \
|
swad_place.o swad_plugin.o swad_preference.o swad_profile.o \
|
||||||
|
|
|
@ -568,7 +568,7 @@ a:hover /* Default ==> underlined */
|
||||||
}
|
}
|
||||||
.LEFT_RIGHT_CELL
|
.LEFT_RIGHT_CELL
|
||||||
{
|
{
|
||||||
padding:3px 6px;
|
padding:0 6px 6px 6px;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
vertical-align:top;
|
vertical-align:top;
|
||||||
}
|
}
|
||||||
|
@ -963,6 +963,25 @@ a:hover /* Default ==> underlined */
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
text-overflow:ellipsis;
|
text-overflow:ellipsis;
|
||||||
}
|
}
|
||||||
|
#MFU_actions img
|
||||||
|
{
|
||||||
|
width:20px;
|
||||||
|
height:20px;
|
||||||
|
margin:1px;
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#MFU_actions_big
|
||||||
|
{
|
||||||
|
padding:5px;
|
||||||
|
}
|
||||||
|
#MFU_actions_big img
|
||||||
|
{
|
||||||
|
width:40px;
|
||||||
|
height:40px;
|
||||||
|
margin:1px 4px 1px 0;
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************** Month ***********************************/
|
/*********************************** Month ***********************************/
|
||||||
.MONTH_CONTAINER
|
.MONTH_CONTAINER
|
323
swad_action.c
323
swad_action.c
|
@ -50,6 +50,7 @@
|
||||||
#include "swad_indicator.h"
|
#include "swad_indicator.h"
|
||||||
#include "swad_mail.h"
|
#include "swad_mail.h"
|
||||||
#include "swad_mark.h"
|
#include "swad_mark.h"
|
||||||
|
#include "swad_MFU.h"
|
||||||
#include "swad_network.h"
|
#include "swad_network.h"
|
||||||
#include "swad_nickname.h"
|
#include "swad_nickname.h"
|
||||||
#include "swad_notice.h"
|
#include "swad_notice.h"
|
||||||
|
@ -2724,7 +2725,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
||||||
/* ActReqEdiRecCom */{ 285, 5,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ShowFormMyCommRecord ,"card64x64.gif" },
|
/* ActReqEdiRecCom */{ 285, 5,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ShowFormMyCommRecord ,"card64x64.gif" },
|
||||||
/* ActEdiPrf */{ 673, 6,TabPrf,ActEdiPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pre_EditPrefs ,"heart64x64.gif" },
|
/* ActEdiPrf */{ 673, 6,TabPrf,ActEdiPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pre_EditPrefs ,"heart64x64.gif" },
|
||||||
/* ActAdmBrf */{ 23, 7,TabPrf,ActAdmBrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Brw_ShowFileBrowserOrWorks ,"pendrive64x64.gif" },
|
/* ActAdmBrf */{ 23, 7,TabPrf,ActAdmBrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Brw_ShowFileBrowserOrWorks ,"pendrive64x64.gif" },
|
||||||
/* ActMFUAct */{ 993, 8,TabPrf,ActMFUAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Act_ShowMyMFUActions ,"star64x64.gif" },
|
/* ActMFUAct */{ 993, 8,TabPrf,ActMFUAct ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,MFU_ShowMyMFUActions ,"star64x64.gif" },
|
||||||
|
|
||||||
// Actions not in menu:
|
// Actions not in menu:
|
||||||
/* ActReqSndNewPwd */{ 665,-1,TabPrf,ActFrmLogIn ,0x000,0x001,0x001,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pwd_ShowFormSendNewPwd ,NULL},
|
/* ActReqSndNewPwd */{ 665,-1,TabPrf,ActFrmLogIn ,0x000,0x001,0x001,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pwd_ShowFormSendNewPwd ,NULL},
|
||||||
|
@ -4400,7 +4401,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*************************** Internal prototypes *****************************/
|
/**************************** Private prototypes *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Act_FormStartInternal (Act_Action_t NextAction,bool PutParameterLocationIfNoSesion,const char *Id,const char *Anchor);
|
static void Act_FormStartInternal (Act_Action_t NextAction,bool PutParameterLocationIfNoSesion,const char *Id,const char *Anchor);
|
||||||
|
@ -4912,321 +4913,3 @@ void Act_AdjustCurrentAction (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************** Allocate list of most frequently used actions ****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Act_AllocateMFUActions (struct Act_ListMFUActions *ListMFUActions,unsigned MaxActionsShown)
|
|
||||||
{
|
|
||||||
if ((ListMFUActions->Actions = (Act_Action_t *) malloc (sizeof (Act_Action_t) * MaxActionsShown)) == NULL)
|
|
||||||
Lay_ShowErrorAndExit ("Can not allocate memory for list of most frequently used actions.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**************** Free list of most frequently used actions ******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Act_FreeMFUActions (struct Act_ListMFUActions *ListMFUActions)
|
|
||||||
{
|
|
||||||
if (ListMFUActions->Actions != NULL)
|
|
||||||
free ((void *) ListMFUActions->Actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*************** Get and write most frequently used actions ******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
// ListMFUActions->Actions must have space for MaxActionsShown actions
|
|
||||||
|
|
||||||
void Act_GetMFUActions (struct Act_ListMFUActions *ListMFUActions,unsigned MaxActionsShown)
|
|
||||||
{
|
|
||||||
char Query[512];
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned long NumRow,NumRows;
|
|
||||||
long ActCod;
|
|
||||||
Act_Action_t Action;
|
|
||||||
|
|
||||||
/***** Get most frequently used actions *****/
|
|
||||||
sprintf (Query,"SELECT ActCod FROM actions_MFU"
|
|
||||||
" WHERE UsrCod='%ld' ORDER BY Score DESC,LastClick DESC",
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get most frequently used actions");
|
|
||||||
|
|
||||||
/***** Write list of frequently used actions *****/
|
|
||||||
for (NumRow = 0, ListMFUActions->NumActions = 0;
|
|
||||||
NumRow < NumRows && ListMFUActions->NumActions < MaxActionsShown;
|
|
||||||
NumRow++)
|
|
||||||
{
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
/* Get action code (row[0]) */
|
|
||||||
ActCod = Str_ConvertStrCodToLongCod (row[0]);
|
|
||||||
if (ActCod >= 0 && ActCod <= Act_MAX_ACTION_COD)
|
|
||||||
if ((Action = Act_FromActCodToAction[ActCod]) >= 0)
|
|
||||||
if (Act_Actions[Action].IndexInMenu >= 0) // MFU actions must be only actions shown on menu (database could contain wrong action numbers)
|
|
||||||
if (Act_CheckIfIHavePermissionToExecuteAction (Action))
|
|
||||||
ListMFUActions->Actions[ListMFUActions->NumActions++] = Action;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****************** Get my last action in the current tab ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
Act_Action_t Act_GetMyLastActionInCurrentTab (void)
|
|
||||||
{
|
|
||||||
char Query[512];
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumActions;
|
|
||||||
unsigned NumAct;
|
|
||||||
long ActCod;
|
|
||||||
Act_Action_t Action;
|
|
||||||
Act_Action_t MoreRecentActionInCurrentTab = ActUnk;
|
|
||||||
|
|
||||||
if (Gbl.Usrs.Me.UsrDat.UsrCod > 0)
|
|
||||||
{
|
|
||||||
/***** Get my most frequently used actions *****/
|
|
||||||
sprintf (Query,"SELECT ActCod FROM actions_MFU"
|
|
||||||
" WHERE UsrCod='%ld'"
|
|
||||||
" ORDER BY LastClick DESC,Score DESC",
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
NumActions = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get most frequently used actions");
|
|
||||||
|
|
||||||
/***** Loop over list of frequently used actions *****/
|
|
||||||
for (NumAct = 0;
|
|
||||||
NumAct < NumActions;
|
|
||||||
NumAct++)
|
|
||||||
{
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
/* Get action code (row[0]) */
|
|
||||||
ActCod = Str_ConvertStrCodToLongCod (row[0]);
|
|
||||||
if (ActCod >= 0 && ActCod <= Act_MAX_ACTION_COD)
|
|
||||||
if ((Action = Act_FromActCodToAction[ActCod]) >= 0)
|
|
||||||
if (Act_Actions[Action].Tab == Gbl.Action.Tab)
|
|
||||||
if (Act_CheckIfIHavePermissionToExecuteAction (Action))
|
|
||||||
{
|
|
||||||
MoreRecentActionInCurrentTab = Action;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
}
|
|
||||||
|
|
||||||
return MoreRecentActionInCurrentTab;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************* Show a list of my most frequently used actions ****************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Act_ShowMyMFUActions (void)
|
|
||||||
{
|
|
||||||
struct Act_ListMFUActions ListMFUActions;
|
|
||||||
|
|
||||||
Act_AllocateMFUActions (&ListMFUActions,10);
|
|
||||||
|
|
||||||
Act_GetMFUActions (&ListMFUActions,10);
|
|
||||||
Act_WriteBigMFUActions (&ListMFUActions);
|
|
||||||
|
|
||||||
Act_FreeMFUActions (&ListMFUActions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*************** Write list of most frequently used actions ******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Act_WriteBigMFUActions (struct Act_ListMFUActions *ListMFUActions)
|
|
||||||
{
|
|
||||||
extern const char *The_ClassFormNoWrap[The_NUM_THEMES];
|
|
||||||
extern const char *Txt_Frequent_actions;
|
|
||||||
extern const char *Txt_TABS_FULL_TXT[Tab_NUM_TABS];
|
|
||||||
extern const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB];
|
|
||||||
unsigned NumAct;
|
|
||||||
Act_Action_t Action;
|
|
||||||
const char *Title;
|
|
||||||
char TabStr[128+1];
|
|
||||||
char MenuStr[128+1];
|
|
||||||
char TabMenuStr[128+6+128+1];
|
|
||||||
|
|
||||||
/***** Table head *****/
|
|
||||||
Lay_StartRoundFrameTable (NULL,0,Txt_Frequent_actions);
|
|
||||||
|
|
||||||
/***** Write list of frequently used actions *****/
|
|
||||||
for (NumAct = 0;
|
|
||||||
NumAct < ListMFUActions->NumActions;
|
|
||||||
NumAct++)
|
|
||||||
{
|
|
||||||
Action = ListMFUActions->Actions[NumAct];
|
|
||||||
|
|
||||||
if ((Title = Act_GetTitleAction (Action)) != NULL)
|
|
||||||
{
|
|
||||||
/* Action string */
|
|
||||||
strncpy (TabStr,Txt_TABS_FULL_TXT[Act_Actions[Action].Tab],128);
|
|
||||||
TabStr[128] = '\0';
|
|
||||||
strncpy (MenuStr,Title,128);
|
|
||||||
MenuStr[128] = '\0';
|
|
||||||
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
|
||||||
|
|
||||||
/* Icon and text */
|
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
|
||||||
"<td class=\"LEFT_MIDDLE\""
|
|
||||||
" style=\"padding-left:2px;\">");
|
|
||||||
Act_FormStart (Action);
|
|
||||||
Act_LinkFormSubmit (TabMenuStr,The_ClassFormNoWrap[Gbl.Prefs.Theme]);
|
|
||||||
fprintf (Gbl.F.Out,"<img src=\"%s/%s/%s\""
|
|
||||||
" alt=\"%s\" title=\"%s\""
|
|
||||||
" class=\"ICON40x40\" style=\"margin:5px;\" />",
|
|
||||||
Gbl.Prefs.PathIconSet,Cfg_ICON_ACTION,
|
|
||||||
Act_Actions[Action].Icon,
|
|
||||||
MenuStr,TabMenuStr);
|
|
||||||
fprintf (Gbl.F.Out," %s</a>",TabMenuStr);
|
|
||||||
Act_FormEnd ();
|
|
||||||
fprintf (Gbl.F.Out,"</td>"
|
|
||||||
"</tr>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** End table *****/
|
|
||||||
Lay_EndRoundFrameTable ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/*************** Get and write most frequently used actions ******************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Act_WriteSmallMFUActions (struct Act_ListMFUActions *ListMFUActions)
|
|
||||||
{
|
|
||||||
extern const char *Txt_Frequent_actions;
|
|
||||||
extern const char *Txt_Frequent_ACTIONS;
|
|
||||||
extern const char *Txt_TABS_FULL_TXT[Tab_NUM_TABS];
|
|
||||||
extern const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB];
|
|
||||||
unsigned NumAct;
|
|
||||||
Act_Action_t Action;
|
|
||||||
const char *Title;
|
|
||||||
char TabStr[128+1];
|
|
||||||
char MenuStr[128+1];
|
|
||||||
char TabMenuStr[128+6+128+1];
|
|
||||||
|
|
||||||
/***** Start frame and link *****/
|
|
||||||
fprintf (Gbl.F.Out,"<div id=\"MFU_actions\">");
|
|
||||||
Act_FormStart (ActMFUAct);
|
|
||||||
Act_LinkFormSubmit (Txt_Frequent_actions,"MFU_ACT");
|
|
||||||
fprintf (Gbl.F.Out," %s"
|
|
||||||
"</a>",
|
|
||||||
Txt_Frequent_ACTIONS);
|
|
||||||
Act_FormEnd ();
|
|
||||||
|
|
||||||
/***** Write list of frequently used actions *****/
|
|
||||||
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
|
|
||||||
for (NumAct = 0;
|
|
||||||
NumAct < ListMFUActions->NumActions;
|
|
||||||
NumAct++)
|
|
||||||
{
|
|
||||||
Action = ListMFUActions->Actions[NumAct];
|
|
||||||
|
|
||||||
if ((Title = Act_GetTitleAction (Action)) != NULL)
|
|
||||||
{
|
|
||||||
/* Action string */
|
|
||||||
strncpy (TabStr,Txt_TABS_FULL_TXT[Act_Actions[Action].Tab],128);
|
|
||||||
TabStr[128] = '\0';
|
|
||||||
strncpy (MenuStr,Title,128);
|
|
||||||
MenuStr[128] = '\0';
|
|
||||||
sprintf (TabMenuStr,"%s > %s",TabStr,MenuStr);
|
|
||||||
|
|
||||||
/* Icon and text */
|
|
||||||
fprintf (Gbl.F.Out,"<li>");
|
|
||||||
Act_FormStart (Action);
|
|
||||||
Act_LinkFormSubmit (Title,NULL);
|
|
||||||
fprintf (Gbl.F.Out,"<img src=\"%s/%s/%s\""
|
|
||||||
" alt=\"%s\" title=\"%s\""
|
|
||||||
" class=\"ICON20x20\""
|
|
||||||
" style=\"margin:1px;\" />",
|
|
||||||
Gbl.Prefs.PathIconSet,Cfg_ICON_ACTION,
|
|
||||||
Act_Actions[Action].Icon,
|
|
||||||
MenuStr,TabMenuStr);
|
|
||||||
fprintf (Gbl.F.Out," %s</a>",MenuStr);
|
|
||||||
Act_FormEnd ();
|
|
||||||
fprintf (Gbl.F.Out,"</li>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf (Gbl.F.Out,"</ul>");
|
|
||||||
|
|
||||||
/***** End frame *****/
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/******************** Update most frequently used actions ********************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
#define Act_MIN_SCORE 0.5
|
|
||||||
#define Act_MAX_SCORE 100.0
|
|
||||||
#define Act_INCREASE_FACTOR 1.2
|
|
||||||
#define Act_DECREASE_FACTOR 0.99
|
|
||||||
|
|
||||||
void Act_UpdateMFUActions (void)
|
|
||||||
{
|
|
||||||
char Query[1024];
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
float Score;
|
|
||||||
|
|
||||||
/***** In some cases, don't register action *****/
|
|
||||||
if (!Gbl.Usrs.Me.Logged)
|
|
||||||
return;
|
|
||||||
if (Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].IndexInMenu < 0)
|
|
||||||
return;
|
|
||||||
if (Act_Actions[Gbl.Action.Act].SuperAction == ActMFUAct)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!setlocale (LC_NUMERIC,"en_US.utf8")) // To get the decimal point
|
|
||||||
Lay_ShowAlert (Lay_ERROR,"Can not set locale to en_US.");
|
|
||||||
|
|
||||||
/***** Get current score *****/
|
|
||||||
sprintf (Query,"SELECT Score FROM actions_MFU"
|
|
||||||
" WHERE UsrCod='%ld' AND ActCod='%ld'",
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].ActCod);
|
|
||||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get score for current action"))
|
|
||||||
{
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
if (sscanf (row[0],"%f",&Score) != 1)
|
|
||||||
Lay_ShowErrorAndExit ("Error when getting score for current action.");
|
|
||||||
Score *= Act_INCREASE_FACTOR;
|
|
||||||
if (Score > Act_MAX_SCORE)
|
|
||||||
Score = Act_MAX_SCORE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Score = Act_MIN_SCORE; // Initial score for a new action not present in MFU table
|
|
||||||
|
|
||||||
/* Free structure that stores the query result */
|
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
|
||||||
|
|
||||||
/***** Update score for the current action *****/
|
|
||||||
sprintf (Query,"REPLACE INTO actions_MFU"
|
|
||||||
" (UsrCod,ActCod,Score,LastClick)"
|
|
||||||
" VALUES ('%ld','%ld','%f',NOW())",
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].ActCod,
|
|
||||||
Score);
|
|
||||||
DB_QueryREPLACE (Query,"can not update most frequently used actions");
|
|
||||||
|
|
||||||
/***** Update score for other actions *****/
|
|
||||||
sprintf (Query,"UPDATE actions_MFU SET Score=GREATEST(Score*'%f','%f')"
|
|
||||||
" WHERE UsrCod='%ld' AND ActCod<>'%ld'",
|
|
||||||
Act_DECREASE_FACTOR,Act_MIN_SCORE,
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
||||||
Act_Actions[Act_Actions[Gbl.Action.Act].SuperAction].ActCod);
|
|
||||||
DB_QueryUPDATE (Query,"can not update most frequently used actions");
|
|
||||||
|
|
||||||
if (!setlocale (LC_NUMERIC,"es_ES.utf8"))
|
|
||||||
Lay_ShowAlert (Lay_ERROR,"Can not set locale to es_ES.");
|
|
||||||
}
|
|
||||||
|
|
|
@ -1477,12 +1477,6 @@ struct Act_Actions
|
||||||
const char *Icon;
|
const char *Icon;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Act_ListMFUActions
|
|
||||||
{
|
|
||||||
unsigned NumActions;
|
|
||||||
Act_Action_t *Actions;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***************************** Public prototypes *****************************/
|
/***************************** Public prototypes *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1511,13 +1505,4 @@ void Act_SetUniqueId (char UniqueId[Act_MAX_LENGTH_ID]);
|
||||||
void Act_AdjustActionWhenNoUsrLogged (void);
|
void Act_AdjustActionWhenNoUsrLogged (void);
|
||||||
void Act_AdjustCurrentAction (void);
|
void Act_AdjustCurrentAction (void);
|
||||||
|
|
||||||
void Act_AllocateMFUActions (struct Act_ListMFUActions *ListMFUActions,unsigned MaxActionsShown);
|
|
||||||
void Act_FreeMFUActions (struct Act_ListMFUActions *ListMFUActions);
|
|
||||||
void Act_GetMFUActions (struct Act_ListMFUActions *ListMFUActions,unsigned MaxActionsShown);
|
|
||||||
Act_Action_t Act_GetMyLastActionInCurrentTab (void);
|
|
||||||
void Act_ShowMyMFUActions (void);
|
|
||||||
void Act_WriteBigMFUActions (struct Act_ListMFUActions *ListMFUActions);
|
|
||||||
void Act_WriteSmallMFUActions (struct Act_ListMFUActions *ListMFUActions);
|
|
||||||
void Act_UpdateMFUActions (void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -130,19 +130,20 @@
|
||||||
// TODO: FIX BUG: Txt_Save_file_properties does not have sense in briefcase, because nothing to save (license should be editable in briefcase?)
|
// TODO: FIX BUG: Txt_Save_file_properties does not have sense in briefcase, because nothing to save (license should be editable in briefcase?)
|
||||||
// TODO: In listing of courses, teachers column is before than students column. In edition of courses, students column is before teachers column.
|
// TODO: In listing of courses, teachers column is before than students column. In edition of courses, students column is before teachers column.
|
||||||
// TODO: Check value returned by setlocale in all calls
|
// TODO: Check value returned by setlocale in all calls
|
||||||
// TODO: Write "Tab > Action" in title of text in most frequent actions
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.217.2 (2016-06-03)"
|
#define Log_PLATFORM_VERSION "SWAD 15.218 (2016-06-03)"
|
||||||
#define CSS_FILE "swad15.210.css"
|
#define CSS_FILE "swad15.218.css"
|
||||||
#define JS_FILE "swad15.216.js"
|
#define JS_FILE "swad15.216.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 15.218: Jun 03, 2016 New module swad_MFU for most frequently used actions.
|
||||||
|
Change in layout of most frequent actions. (201934 lines)
|
||||||
Version 15.217.2: Jun 03, 2016 Fixed bug in copy-paste from briefcase to another file browser. (201827 lines)
|
Version 15.217.2: Jun 03, 2016 Fixed bug in copy-paste from briefcase to another file browser. (201827 lines)
|
||||||
Version 15.217.1: Jun 03, 2016 Fixed bug when creating zip file for students works, reported by Francisco Barranco Expósito. (201809 lines)
|
Version 15.217.1: Jun 03, 2016 Fixed bug when creating zip file for students works, reported by Francisco Barranco Expósito. (201809 lines)
|
||||||
Version 15.217: Jun 01, 2016 When clicking on a social note associated to an exam announcement, show that exam announcement highlighted. (201801 lines)
|
Version 15.217: Jun 01, 2016 When clicking on a social note associated to an exam announcement, show that exam announcement highlighted. (201801 lines)
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "swad_exam.h"
|
#include "swad_exam.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
#include "swad_logo.h"
|
#include "swad_logo.h"
|
||||||
|
#include "swad_MFU.h"
|
||||||
#include "swad_notice.h"
|
#include "swad_notice.h"
|
||||||
#include "swad_notification.h"
|
#include "swad_notification.h"
|
||||||
#include "swad_parameter.h"
|
#include "swad_parameter.h"
|
||||||
|
@ -932,7 +933,7 @@ static void Lay_WriteTitleAction (void)
|
||||||
|
|
||||||
static void Lay_ShowLeftColumn (void)
|
static void Lay_ShowLeftColumn (void)
|
||||||
{
|
{
|
||||||
struct Act_ListMFUActions ListMFUActions;
|
struct MFU_ListMFUActions ListMFUActions;
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<div style=\"width:160px;\">");
|
fprintf (Gbl.F.Out,"<div style=\"width:160px;\">");
|
||||||
|
|
||||||
|
@ -940,10 +941,10 @@ static void Lay_ShowLeftColumn (void)
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"LEFT_RIGHT_CELL\">");
|
fprintf (Gbl.F.Out,"<div class=\"LEFT_RIGHT_CELL\">");
|
||||||
Act_AllocateMFUActions (&ListMFUActions,6);
|
MFU_AllocateMFUActions (&ListMFUActions,6);
|
||||||
Act_GetMFUActions (&ListMFUActions,6);
|
MFU_GetMFUActions (&ListMFUActions,6);
|
||||||
Act_WriteSmallMFUActions (&ListMFUActions);
|
MFU_WriteSmallMFUActions (&ListMFUActions);
|
||||||
Act_FreeMFUActions (&ListMFUActions);
|
MFU_FreeMFUActions (&ListMFUActions);
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "swad_database.h"
|
#include "swad_database.h"
|
||||||
#include "swad_degree.h"
|
#include "swad_degree.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
|
#include "swad_MFU.h"
|
||||||
#include "swad_parameter.h"
|
#include "swad_parameter.h"
|
||||||
#include "swad_preference.h"
|
#include "swad_preference.h"
|
||||||
#include "swad_notification.h"
|
#include "swad_notification.h"
|
||||||
|
@ -139,7 +140,7 @@ int main (int argc, char *argv[])
|
||||||
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
Lay_ShowErrorAndExit (Txt_You_dont_have_permission_to_perform_this_action);
|
||||||
|
|
||||||
/***** Update most frequently used actions *****/
|
/***** Update most frequently used actions *****/
|
||||||
Act_UpdateMFUActions ();
|
MFU_UpdateMFUActions ();
|
||||||
|
|
||||||
/***** Execute a function depending on the action *****/
|
/***** Execute a function depending on the action *****/
|
||||||
if (Act_Actions[Gbl.Action.Act].FunctionPriori != NULL)
|
if (Act_Actions[Gbl.Action.Act].FunctionPriori != NULL)
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "swad_group.h"
|
#include "swad_group.h"
|
||||||
#include "swad_help.h"
|
#include "swad_help.h"
|
||||||
#include "swad_ID.h"
|
#include "swad_ID.h"
|
||||||
|
#include "swad_MFU.h"
|
||||||
#include "swad_nickname.h"
|
#include "swad_nickname.h"
|
||||||
#include "swad_notification.h"
|
#include "swad_notification.h"
|
||||||
#include "swad_parameter.h"
|
#include "swad_parameter.h"
|
||||||
|
@ -2056,7 +2057,7 @@ void Usr_ChkUsrAndGetUsrData (void)
|
||||||
{
|
{
|
||||||
if (Gbl.Usrs.Me.Logged)
|
if (Gbl.Usrs.Me.Logged)
|
||||||
{
|
{
|
||||||
if ((Action = Act_GetMyLastActionInCurrentTab ()) == ActUnk)
|
if ((Action = MFU_GetMyLastActionInCurrentTab ()) == ActUnk)
|
||||||
Action = Mnu_GetFirstActionAvailableInCurrentTab ();
|
Action = Mnu_GetFirstActionAvailableInCurrentTab ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user