Version 15.100.3

This commit is contained in:
Antonio Cañas Vargas 2016-01-07 11:31:36 +01:00
parent 3d7d9cd83b
commit 1814ed843b
4 changed files with 96 additions and 25 deletions

View File

@ -1739,6 +1739,10 @@ a:hover img.CENTRE_PHOTO_SHOW
padding-left:4px;
vertical-align:bottom;
}
.SOCIAL_FORM_COMMENT
{
padding-top:10px;
}
/*********************************** Messages ********************************/
.MSG_TO_ONE_RCP

View File

@ -463,6 +463,13 @@ function noZoom() {
document.getElementById('zoomLyr').style.top = yPos + 'px';
}
// Change display of a element (hidden or visible)
function toggleDisplay(elementID) {
(function(style) {
style.display = style.display === 'none' ? '' : 'none';
})(document.getElementById(elementID).style);
}
// Select or unselect a radio element in a form
function selectUnselectRadio (radio,groupRadios,numRadiosInGroup){
if (radio.IsChecked) radio.checked = false;

View File

@ -124,13 +124,15 @@ En definitiva, se estar
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.100.1 (2016-01-07)"
#define CSS_FILE "swad15.97.css"
#define JS_FILE "swad15.77.7.js"
#define Log_PLATFORM_VERSION "SWAD 15.100.3 (2016-01-07)"
#define CSS_FILE "swad15.100.2.css"
#define JS_FILE "swad15.100.2.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.100.3: Jan 07, 2016 Fixed bug when sharing and unsharing a social note. (190999 lines)
Version 15.100.2: Jan 07, 2016 Hidden form to reply a social note. (190983 lines)
Version 15.100.1: Jan 07, 2016 New icon in social note to reply. (190937 lines)
Version 15.100: Jan 06, 2016 When an author removes a social note, all the publishings of this note are removed. (190842 lines)
Version 15.99.1: Jan 05, 2016 Change in message in social timeline. (190917 lines)

View File

@ -150,6 +150,7 @@ static void Soc_FormSocialPost (void);
static void Soc_ReceiveSocialPost (void);
static void Soc_PutFormToCommentSocialNote (long NotCod);
static void Soc_PutHiddenFormToSendCommentToASocialNote (long NotCod);
static void Soc_PutDisabledIconShare (unsigned NumShared);
static void Soc_PutFormToShareSocialNote (long NotCod);
static void Soc_PutFormToUnshareSocialPublishing (long PubCod);
@ -577,6 +578,9 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
/* Put icon to remove this publishing */
Soc_PutFormToRemoveSocialPublishing (SocPub->PubCod);
/* Put hidden form to write comment */
Soc_PutHiddenFormToSendCommentToASocialNote (SocNot->NotCod);
/* End of right part */
fprintf (Gbl.F.Out,"</div>");
@ -1162,14 +1166,57 @@ static void Soc_PutFormToCommentSocialNote (long NotCod)
"<input type=\"image\""
" src=\"%s/write64x64.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"ICON20x20\" />"
" class=\"ICON20x20\""
" onclick=\""
"toggleDisplay('div_comment_%ld');"
"return false;\" />"
"</div>",
Gbl.Prefs.IconsURL,
Txt_Comment,
Txt_Comment);
Txt_Comment,
NotCod);
Act_FormEnd ();
}
/*****************************************************************************/
/******************* Form to comment a social publishing *********************/
/*****************************************************************************/
static void Soc_PutHiddenFormToSendCommentToASocialNote (long NotCod)
{
extern const char *Txt_Send_comment;
/***** Start container *****/
fprintf (Gbl.F.Out,"<div id=\"div_comment_%ld\""
" class=\"SOCIAL_FORM_COMMENT\""
" style=\"display:none;\">",
NotCod);
/***** Start form to write the post *****/
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
{
Act_FormStartAnchor (ActComSocNotUsr,"timeline");
Usr_PutParamOtherUsrCodEncrypted ();
}
else
Act_FormStart (ActComSocNotGbl);
fprintf (Gbl.F.Out,"<textarea name=\"Comment%ld\" cols=\"44\" rows=\"5\">"
"</textarea>",
NotCod);
/***** Send button *****/
fprintf (Gbl.F.Out,"<button type=\"submit\" class=\"BT_SUBMIT_INLINE BT_CONFIRM\">"
"%s"
"</button>",
Txt_Send_comment);
/***** End form *****/
Act_FormEnd ();
/***** En container *****/
fprintf (Gbl.F.Out,"</div>");
}
/*****************************************************************************/
/*********************** Put disabled icon to share **************************/
/*****************************************************************************/
@ -1410,8 +1457,9 @@ static void Soc_ShareSocialNote (void)
extern const char *Txt_SOCIAL_PUBLISHING_Shared;
struct SocialNote SocNot;
struct SocialPublishing SocPub;
bool IAmTheAuthor;
bool IAmAPublisherOfThisSocNot;
bool ICanShare;
bool IHavePublishedThisNote;
/***** Get the code of the social publishing to unshare *****/
SocPub.NotCod = Soc_GetParamNotCod ();
@ -1419,29 +1467,31 @@ static void Soc_ShareSocialNote (void)
/***** Get data of social note *****/
Soc_GetDataOfSocialNoteByCod (&SocNot);
IAmTheAuthor = (SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (IAmTheAuthor)
IAmAPublisherOfThisSocNot = true;
else
IAmAPublisherOfThisSocNot = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
ICanShare = (Gbl.Usrs.Me.Logged &&
SocNot.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod); // I am not the author
!IAmTheAuthor && // I am not the author
!IAmAPublisherOfThisSocNot); // I have not shared the note
if (ICanShare)
{
/***** Check if I have yet shared this social note *****/
IHavePublishedThisNote = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,Gbl.Usrs.Me.UsrDat.UsrCod);
if (!IHavePublishedThisNote)
{
/***** Share (publish social note in timeline) *****/
SocPub.AuthorCod = SocNot.UsrCod;
SocPub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
SocPub.NotCod = SocNot.NotCod;
Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod
/***** Share (publish social note in timeline) *****/
SocPub.AuthorCod = SocNot.UsrCod;
SocPub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
SocPub.NotCod = SocNot.NotCod;
Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod
/* Update number of times this social note is shared */
Soc_UpdateNumTimesANoteHasBeenShared (&SocNot);
/* Update number of times this social note is shared */
Soc_UpdateNumTimesANoteHasBeenShared (&SocNot);
/***** Message of success *****/
Lay_ShowAlert (Lay_SUCCESS,Txt_SOCIAL_PUBLISHING_Shared);
/***** Message of success *****/
Lay_ShowAlert (Lay_SUCCESS,Txt_SOCIAL_PUBLISHING_Shared);
/***** Show the social note just shared *****/
Soc_WriteSocialNote (&SocPub,&SocNot,true,true);
}
/***** Show the social note just shared *****/
Soc_WriteSocialNote (&SocPub,&SocNot,true,true);
}
}
@ -1484,6 +1534,8 @@ static void Soc_UnshareSocialPublishing (void)
extern const char *Txt_SOCIAL_PUBLISHING_Unshared;
struct SocialPublishing SocPub;
struct SocialNote SocNot;
bool IAmTheAuthor;
bool IAmAPublisherOfThisSocNot;
bool ICanUnshare;
/***** Get the code of the social publishing to unshare *****/
@ -1496,9 +1548,15 @@ static void Soc_UnshareSocialPublishing (void)
SocNot.NotCod = SocPub.NotCod;
Soc_GetDataOfSocialNoteByCod (&SocNot);
IAmTheAuthor = (SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (IAmTheAuthor)
IAmAPublisherOfThisSocNot = true;
else
IAmAPublisherOfThisSocNot = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
ICanUnshare = (Gbl.Usrs.Me.Logged &&
SocPub.PublisherCod == Gbl.Usrs.Me.UsrDat.UsrCod && // I have shared the note
SocPub.AuthorCod != Gbl.Usrs.Me.UsrDat.UsrCod); // I am not the author
!IAmTheAuthor && // I am not the author
IAmAPublisherOfThisSocNot); // I have shared the note
if (ICanUnshare)
{
/***** Delete social publishing from database *****/