2021-02-21 21:30:06 +01:00
|
|
|
|
// swad_timeline_form.c: social timeline forms
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
|
|
|
|
Copyright (C) 1999-2021 Antonio Ca<EFBFBD>as Vargas
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General 3 License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************************** Headers *********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
|
|
|
|
#include <stdio.h> // For asprintf
|
2021-04-23 22:57:57 +02:00
|
|
|
|
#include <stdlib.h> // For free
|
2021-02-21 21:30:06 +01:00
|
|
|
|
|
|
|
|
|
#include "swad_action.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2021-02-21 21:30:06 +01:00
|
|
|
|
#include "swad_global.h"
|
|
|
|
|
#include "swad_timeline.h"
|
2021-03-03 02:15:32 +01:00
|
|
|
|
#include "swad_timeline_favourite.h"
|
2021-02-21 21:30:06 +01:00
|
|
|
|
#include "swad_timeline_form.h"
|
2021-03-03 02:15:32 +01:00
|
|
|
|
#include "swad_timeline_share.h"
|
2021-02-21 21:30:06 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Private constants and types ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
#define Tml_Frm_ICON_ELLIPSIS "ellipsis-h.svg"
|
2021-02-21 21:30:06 +01:00
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
const Act_Action_t Tml_Frm_ActionGbl[Tml_Frm_NUM_ACTIONS] =
|
2021-02-21 21:30:06 +01:00
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
[Tml_Frm_RECEIVE_POST] = ActRcvPstGblTL,
|
|
|
|
|
[Tml_Frm_RECEIVE_COMM] = ActRcvComGblTL,
|
|
|
|
|
[Tml_Frm_REQ_REM_NOTE] = ActReqRemPubGblTL,
|
|
|
|
|
[Tml_Frm_REQ_REM_COMM] = ActReqRemComGblTL,
|
|
|
|
|
[Tml_Frm_REM_NOTE ] = ActRemPubGblTL,
|
|
|
|
|
[Tml_Frm_REM_COMM ] = ActRemComGblTL,
|
|
|
|
|
[Tml_Frm_SHA_NOTE ] = ActShaNotGblTL,
|
|
|
|
|
[Tml_Frm_UNS_NOTE ] = ActUnsNotGblTL,
|
|
|
|
|
[Tml_Frm_FAV_NOTE ] = ActFavNotGblTL,
|
|
|
|
|
[Tml_Frm_FAV_COMM ] = ActFavComGblTL,
|
|
|
|
|
[Tml_Frm_UNF_NOTE ] = ActUnfNotGblTL,
|
|
|
|
|
[Tml_Frm_UNF_COMM ] = ActUnfComGblTL,
|
|
|
|
|
[Tml_Frm_ALL_SHA_NOTE] = ActAllShaNotGblTL,
|
|
|
|
|
[Tml_Frm_ALL_FAV_NOTE] = ActAllFavNotGblTL,
|
|
|
|
|
[Tml_Frm_ALL_FAV_COMM] = ActAllFavComGblTL,
|
|
|
|
|
[Tml_Frm_SHO_HID_COMM] = ActShoHidComGblTL,
|
2021-02-21 21:30:06 +01:00
|
|
|
|
};
|
2021-03-04 17:47:08 +01:00
|
|
|
|
const Act_Action_t Tml_Frm_ActionUsr[Tml_Frm_NUM_ACTIONS] =
|
2021-02-21 21:30:06 +01:00
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
[Tml_Frm_RECEIVE_POST] = ActRcvPstUsrTL,
|
|
|
|
|
[Tml_Frm_RECEIVE_COMM] = ActRcvComUsrTL,
|
|
|
|
|
[Tml_Frm_REQ_REM_NOTE] = ActReqRemPubUsrTL,
|
|
|
|
|
[Tml_Frm_REQ_REM_COMM] = ActReqRemComUsrTL,
|
|
|
|
|
[Tml_Frm_REM_NOTE ] = ActRemPubUsrTL,
|
|
|
|
|
[Tml_Frm_REM_COMM ] = ActRemComUsrTL,
|
|
|
|
|
[Tml_Frm_SHA_NOTE ] = ActShaNotUsrTL,
|
|
|
|
|
[Tml_Frm_UNS_NOTE ] = ActUnsNotUsrTL,
|
|
|
|
|
[Tml_Frm_FAV_NOTE ] = ActFavNotUsrTL,
|
|
|
|
|
[Tml_Frm_FAV_COMM ] = ActFavComUsrTL,
|
|
|
|
|
[Tml_Frm_UNF_NOTE ] = ActUnfNotUsrTL,
|
|
|
|
|
[Tml_Frm_UNF_COMM ] = ActUnfComUsrTL,
|
|
|
|
|
[Tml_Frm_ALL_SHA_NOTE] = ActAllShaNotUsrTL,
|
|
|
|
|
[Tml_Frm_ALL_FAV_NOTE] = ActAllFavNotUsrTL,
|
|
|
|
|
[Tml_Frm_ALL_FAV_COMM] = ActAllFavComUsrTL,
|
|
|
|
|
[Tml_Frm_SHO_HID_COMM] = ActShoHidComUsrTL,
|
2021-02-21 21:30:06 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
2021-03-03 02:15:32 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Form to fav/unfav or share/unshare *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Frm_PutFormToFavUnfShaUns (Tml_Usr_FavSha_t FavSha,long Cod)
|
2021-03-03 02:15:32 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_TIMELINE_Mark_as_favourite;
|
|
|
|
|
extern const char *Txt_TIMELINE_Favourite;
|
|
|
|
|
extern const char *Txt_TIMELINE_Share;
|
|
|
|
|
extern const char *Txt_TIMELINE_Shared;
|
2021-11-12 01:12:15 +01:00
|
|
|
|
struct Tml_Form Form[Tml_Usr_NUM_FAV_SHA][2] =
|
2021-03-03 02:15:32 +01:00
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
[Tml_Usr_FAV_UNF_NOTE] =
|
2021-03-03 02:15:32 +01:00
|
|
|
|
{
|
|
|
|
|
[false] = // I have not faved ==> fav
|
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Action = Tml_Frm_FAV_NOTE,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.ParamFormat = "NotCod=%ld",
|
|
|
|
|
.ParamCod = Cod,
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Icon = Tml_Fav_ICON_FAV,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.Title = Txt_TIMELINE_Mark_as_favourite,
|
|
|
|
|
},
|
|
|
|
|
[true] = // I have faved ==> unfav
|
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Action = Tml_Frm_UNF_NOTE,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.ParamFormat = "NotCod=%ld",
|
|
|
|
|
.ParamCod = Cod,
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Icon = Tml_Fav_ICON_FAVED,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.Title = Txt_TIMELINE_Favourite,
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-03-04 17:47:08 +01:00
|
|
|
|
[Tml_Usr_FAV_UNF_COMM] =
|
2021-03-03 02:15:32 +01:00
|
|
|
|
{
|
|
|
|
|
[false] = // I have not faved ==> fav
|
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Action = Tml_Frm_FAV_COMM,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.ParamFormat = "PubCod=%ld",
|
|
|
|
|
.ParamCod = Cod,
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Icon = Tml_Fav_ICON_FAV,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.Title = Txt_TIMELINE_Mark_as_favourite,
|
|
|
|
|
},
|
|
|
|
|
[true] = // I have faved ==> unfav
|
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Action = Tml_Frm_UNF_COMM,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.ParamFormat = "PubCod=%ld",
|
|
|
|
|
.ParamCod = Cod,
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Icon = Tml_Fav_ICON_FAVED,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.Title = Txt_TIMELINE_Favourite,
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-03-04 17:47:08 +01:00
|
|
|
|
[Tml_Usr_SHA_UNS_NOTE] =
|
2021-03-03 02:15:32 +01:00
|
|
|
|
{
|
|
|
|
|
[false] = // I have not shared ==> share
|
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Action = Tml_Frm_SHA_NOTE,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.ParamFormat = "NotCod=%ld",
|
|
|
|
|
.ParamCod = Cod,
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Icon = Tml_Sha_ICON_SHARE,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.Title = Txt_TIMELINE_Share,
|
|
|
|
|
},
|
|
|
|
|
[true] = // I have shared ==> unshare
|
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Action = Tml_Frm_UNS_NOTE,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.ParamFormat = "NotCod=%ld",
|
|
|
|
|
.ParamCod = Cod,
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Icon = Tml_Sha_ICON_SHARED,
|
2021-03-03 02:15:32 +01:00
|
|
|
|
.Title = Txt_TIMELINE_Shared,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
bool FavedShared;
|
|
|
|
|
|
|
|
|
|
/***** Form and icon to fav/unfav note *****/
|
2021-03-04 17:47:08 +01:00
|
|
|
|
FavedShared = Tml_Usr_CheckIfFavedSharedByUsr (FavSha,Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
|
|
|
Tml_Frm_FormFavSha (&Form[FavSha][FavedShared]);
|
2021-03-03 02:15:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-21 21:30:06 +01:00
|
|
|
|
/*****************************************************************************/
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***************** Begin a form in global or user timeline *******************/
|
2021-02-21 21:30:06 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-04-29 23:35:21 +02:00
|
|
|
|
void Tml_Frm_BeginForm (const struct Tml_Timeline *Timeline,
|
|
|
|
|
Tml_Frm_Action_t Action)
|
2021-02-21 21:30:06 +01:00
|
|
|
|
{
|
|
|
|
|
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
|
|
|
|
{
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin form in user timeline *****/
|
2021-06-29 15:25:42 +02:00
|
|
|
|
Frm_BeginFormAnchor (Tml_Frm_ActionUsr[Action],"timeline");
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
|
2021-02-21 21:30:06 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin form in global timeline *****/
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Frm_BeginForm (Tml_Frm_ActionGbl[Action]);
|
2021-12-01 01:43:13 +01:00
|
|
|
|
Usr_PutHiddenParamWho (Timeline->Who);
|
2021-02-21 21:30:06 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Frm_EndForm (void)
|
2021-03-02 00:54:26 +01:00
|
|
|
|
{
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-21 21:30:06 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************* Form to show all favers/sharers ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Frm_PutFormToSeeAllFaversSharers (Tml_Frm_Action_t Action,
|
2021-04-29 23:35:21 +02:00
|
|
|
|
const char *ParamFormat,long ParamCod,
|
|
|
|
|
Tml_Usr_HowManyUsrs_t HowManyUsrs)
|
2021-02-21 21:30:06 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_View_all_USERS;
|
2021-11-12 01:12:15 +01:00
|
|
|
|
struct Tml_Form Form =
|
2021-02-23 11:05:18 +01:00
|
|
|
|
{
|
|
|
|
|
.Action = Action,
|
|
|
|
|
.ParamFormat = ParamFormat,
|
|
|
|
|
.ParamCod = ParamCod,
|
2021-03-04 17:47:08 +01:00
|
|
|
|
.Icon = Tml_Frm_ICON_ELLIPSIS,
|
2021-02-23 11:05:18 +01:00
|
|
|
|
.Title = Txt_View_all_USERS,
|
|
|
|
|
};
|
2021-02-21 21:30:06 +01:00
|
|
|
|
|
|
|
|
|
switch (HowManyUsrs)
|
|
|
|
|
{
|
2021-03-04 17:47:08 +01:00
|
|
|
|
case Tml_Usr_SHOW_FEW_USRS:
|
2021-02-23 11:05:18 +01:00
|
|
|
|
/***** Form and icon to view all users *****/
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Tml_Frm_FormFavSha (&Form);
|
2021-02-21 21:30:06 +01:00
|
|
|
|
break;
|
2021-03-04 17:47:08 +01:00
|
|
|
|
case Tml_Usr_SHOW_ALL_USRS:
|
2021-02-23 11:05:18 +01:00
|
|
|
|
/***** Disabled icon *****/
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Ico_PutIconOff (Tml_Frm_ICON_ELLIPSIS,Txt_View_all_USERS);
|
2021-02-21 21:30:06 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******* Form to fav/unfav or share/unshare in global or user timeline *******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-11-12 01:12:15 +01:00
|
|
|
|
void Tml_Frm_FormFavSha (const struct Tml_Form *Form)
|
2021-02-21 21:30:06 +01:00
|
|
|
|
{
|
|
|
|
|
char *OnSubmit;
|
2021-11-12 01:12:15 +01:00
|
|
|
|
const char *Anchor;
|
2021-02-21 21:30:06 +01:00
|
|
|
|
char ParamStr[7 + Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
|
|
|
|
|
|
|
|
|
/***** Create parameter string *****/
|
2021-02-23 11:05:18 +01:00
|
|
|
|
sprintf (ParamStr,Form->ParamFormat,Form->ParamCod);
|
2021-02-21 21:30:06 +01:00
|
|
|
|
|
|
|
|
|
/*
|
2021-11-12 01:12:15 +01:00
|
|
|
|
___________________________________________________________________________
|
2021-02-21 21:30:06 +01:00
|
|
|
|
| div which content will be updated (parent of parent of form) |
|
2021-11-12 01:12:15 +01:00
|
|
|
|
| _____________________ _______ _____________________________________ |
|
2021-02-21 21:30:06 +01:00
|
|
|
|
| | div (parent of form)| | div | | div for users | |
|
2021-11-12 01:12:15 +01:00
|
|
|
|
| | _________________ | | for | | ______ ______ ______ ______ | |
|
2021-02-21 21:30:06 +01:00
|
|
|
|
| | | this form | | | num. | | | | | | | | | form | | |
|
2021-11-12 01:12:15 +01:00
|
|
|
|
| | | _____________ | | | of | | | user | | user | | user | | to | | |
|
2021-02-21 21:30:06 +01:00
|
|
|
|
| | | | fav icon | | | | users | | | 1 | | 2 | | 3 | | show | | |
|
2021-11-12 01:12:15 +01:00
|
|
|
|
| | | |_____________| | | | | | | | | | | | | all | | |
|
|
|
|
|
| | |_________________| | | | | |______| |______| |______| |______| | |
|
|
|
|
|
| |_____________________| |_______| |_____________________________________| |
|
|
|
|
|
|___________________________________________________________________________|
|
2021-02-21 21:30:06 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/***** Form and icon to mark note as favourite *****/
|
|
|
|
|
/* Form with icon */
|
|
|
|
|
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
|
|
|
|
{
|
|
|
|
|
if (asprintf (&OnSubmit,"updateDivFaversSharers(this,"
|
|
|
|
|
"'act=%ld&ses=%s&%s&OtherUsrCod=%s');"
|
|
|
|
|
" return false;", // return false is necessary to not submit form
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Act_GetActCod (Tml_Frm_ActionUsr[Form->Action]),
|
2021-02-21 21:30:06 +01:00
|
|
|
|
Gbl.Session.Id,
|
|
|
|
|
ParamStr,
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.EnUsrCod) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2021-11-12 01:12:15 +01:00
|
|
|
|
Anchor = "timeline";
|
2021-02-21 21:30:06 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (asprintf (&OnSubmit,"updateDivFaversSharers(this,"
|
|
|
|
|
"'act=%ld&ses=%s&%s');"
|
|
|
|
|
" return false;", // return false is necessary to not submit form
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Act_GetActCod (Tml_Frm_ActionGbl[Form->Action]),
|
2021-02-21 21:30:06 +01:00
|
|
|
|
Gbl.Session.Id,
|
|
|
|
|
ParamStr) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2021-11-12 01:12:15 +01:00
|
|
|
|
Anchor = NULL;
|
2021-02-21 21:30:06 +01:00
|
|
|
|
}
|
2021-11-12 01:12:15 +01:00
|
|
|
|
Frm_BeginFormUniqueAnchorOnSubmit (ActUnk,Anchor,OnSubmit);
|
2021-02-21 21:30:06 +01:00
|
|
|
|
free (OnSubmit);
|
2021-11-12 01:12:15 +01:00
|
|
|
|
Ico_PutIconLink (Form->Icon,Form->Title);
|
|
|
|
|
Frm_EndForm ();
|
2021-02-21 21:30:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Form to show hidden coments in global or user timeline ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Frm_FormToShowHiddenComms (long NotCod,
|
2021-04-29 23:35:21 +02:00
|
|
|
|
char IdComms[Frm_MAX_BYTES_ID + 1],
|
|
|
|
|
unsigned NumInitialComms)
|
2021-02-21 21:30:06 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *The_ClassFormLinkInBox[The_NUM_THEMES];
|
|
|
|
|
extern const char *Txt_See_the_previous_X_COMMENTS;
|
|
|
|
|
char *OnSubmit;
|
2021-11-12 01:12:15 +01:00
|
|
|
|
const char *Anchor;
|
2021-02-21 21:30:06 +01:00
|
|
|
|
|
2021-03-03 20:30:49 +01:00
|
|
|
|
/***** Begin container which content will be updated via AJAX *****/
|
2021-11-12 01:12:15 +01:00
|
|
|
|
HTM_DIV_Begin ("id=\"%s\" class=\"Tml_RIGHT_WIDTH\"",IdComms);
|
2021-03-02 00:54:26 +01:00
|
|
|
|
|
2021-03-03 20:30:49 +01:00
|
|
|
|
/***** Begin container *****/
|
2021-11-12 01:12:15 +01:00
|
|
|
|
HTM_DIV_Begin ("id=\"exp_%s\" class=\"Tml_EXPAND_COM Tml_RIGHT_WIDTH\"",
|
2021-03-03 20:30:49 +01:00
|
|
|
|
IdComms);
|
|
|
|
|
|
|
|
|
|
/***** Form and icon-text to show hidden comments *****/
|
|
|
|
|
/* Begin form */
|
|
|
|
|
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
|
|
|
|
{
|
|
|
|
|
if (asprintf (&OnSubmit,"toggleComments('%s');"
|
|
|
|
|
"updateDivHiddenComments(this,"
|
|
|
|
|
"'act=%ld&ses=%s&NotCod=%ld&IdComments=%s&NumHidCom=%u&OtherUsrCod=%s');"
|
|
|
|
|
" return false;", // return false is necessary to not submit form
|
|
|
|
|
IdComms,
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Act_GetActCod (Tml_Frm_ActionUsr[Tml_Frm_SHO_HID_COMM]),
|
2021-03-03 20:30:49 +01:00
|
|
|
|
Gbl.Session.Id,
|
|
|
|
|
NotCod,
|
|
|
|
|
IdComms,
|
|
|
|
|
NumInitialComms,
|
|
|
|
|
Gbl.Usrs.Other.UsrDat.EnUsrCod) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2021-11-12 01:12:15 +01:00
|
|
|
|
Anchor = "timeline";
|
2021-03-03 20:30:49 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (asprintf (&OnSubmit,"toggleComments('%s');"
|
|
|
|
|
"updateDivHiddenComments(this,"
|
|
|
|
|
"'act=%ld&ses=%s&NotCod=%ld&IdComments=%s&NumHidCom=%u');"
|
|
|
|
|
" return false;", // return false is necessary to not submit form
|
|
|
|
|
IdComms,
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Act_GetActCod (Tml_Frm_ActionGbl[Tml_Frm_SHO_HID_COMM]),
|
2021-03-03 20:30:49 +01:00
|
|
|
|
Gbl.Session.Id,
|
|
|
|
|
NotCod,
|
|
|
|
|
IdComms,
|
|
|
|
|
NumInitialComms) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2021-11-12 01:12:15 +01:00
|
|
|
|
Anchor = NULL;
|
2021-03-03 20:30:49 +01:00
|
|
|
|
}
|
2021-11-12 01:12:15 +01:00
|
|
|
|
Frm_BeginFormUniqueAnchorOnSubmit (ActUnk,Anchor,OnSubmit);
|
|
|
|
|
free (OnSubmit);
|
2021-03-03 20:30:49 +01:00
|
|
|
|
|
2021-11-12 01:12:15 +01:00
|
|
|
|
/* Put icon and text with link to show the first hidden comments */
|
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (NULL,The_ClassFormLinkInBox[Gbl.Prefs.Theme],NULL);
|
|
|
|
|
Ico_PutIconTextLink ("angle-up.svg",
|
2021-12-15 14:02:49 +01:00
|
|
|
|
Str_BuildString (Txt_See_the_previous_X_COMMENTS,
|
|
|
|
|
NumInitialComms));
|
2021-12-15 00:47:29 +01:00
|
|
|
|
Str_FreeStrings ();
|
2021-11-12 01:12:15 +01:00
|
|
|
|
HTM_BUTTON_End ();
|
2021-03-03 20:30:49 +01:00
|
|
|
|
|
|
|
|
|
/* End form */
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
|
|
|
|
|
/***** End container *****/
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
/***** Begin container which content will be updated via AJAX *****/
|
2021-02-21 21:30:06 +01:00
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
}
|
2021-02-22 09:16:57 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-02-22 10:03:36 +01:00
|
|
|
|
/********************** Form to remove note / comment ************************/
|
2021-02-22 09:16:57 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-04 17:47:08 +01:00
|
|
|
|
void Tml_Frm_BeginAlertRemove (const char *QuestionTxt)
|
2021-02-22 10:03:36 +01:00
|
|
|
|
{
|
|
|
|
|
Ale_ShowAlertAndButton1 (Ale_QUESTION,QuestionTxt);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 23:35:21 +02:00
|
|
|
|
void Tml_Frm_EndAlertRemove (struct Tml_Timeline *Timeline,
|
|
|
|
|
Tml_Frm_Action_t Action,
|
|
|
|
|
void (*FuncParams) (void *Args))
|
2021-02-22 09:16:57 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Remove;
|
|
|
|
|
|
|
|
|
|
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Ale_ShowAlertAndButton2 (Tml_Frm_ActionUsr[Action],"timeline",NULL,
|
2021-02-22 09:25:29 +01:00
|
|
|
|
FuncParams,Timeline,
|
2021-02-22 09:16:57 +01:00
|
|
|
|
Btn_REMOVE_BUTTON,Txt_Remove);
|
|
|
|
|
else
|
2021-03-04 17:47:08 +01:00
|
|
|
|
Ale_ShowAlertAndButton2 (Tml_Frm_ActionGbl[Action],NULL,NULL,
|
2021-02-22 09:25:29 +01:00
|
|
|
|
FuncParams,Timeline,
|
2021-02-22 09:16:57 +01:00
|
|
|
|
Btn_REMOVE_BUTTON,Txt_Remove);
|
|
|
|
|
}
|