/Development/IENM-20150216/Intranet.root/Intranet.Website/Profile/SocialMediaFeed.ascx
ASP.NET | 182 lines | 153 code | 29 blank | 0 comment | 23 complexity | c187287e2b1bb955b2fd61fd89548264 MD5 | raw file
Possible License(s): LGPL-2.0, GPL-2.0, LGPL-2.1
- <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SocialMediaFeed.ascx.cs" Inherits="Intranet.WebSite.Profile.SocialMediaFeed" %>
- <div class="ProfileComponentWrapper">
- <div class="ProfileComponent">
- <div class="ProfileComponentTitleBar">
- <span class="widget_handle"><%= WidgetTitle %></span>
- </div>
-
- <asp:Label ID="ErrorMessages" Visible="false" runat="server" />
- <asp:Panel ID="Feed" CssClass="socialMediaFeed widget_content collapsed" runat="server">
- loading...
- </asp:Panel>
-
- <asp:PlaceHolder ID="ScriptConfig" runat="server" />
- <script type="text/javascript">
- $(document).ready(function () {
- var identityType = "<%= IdentityTypeName %>".toLowerCase();
- var accessToken = "<%= AccessToken %>";
-
- if (accessToken && identityType) {
- if (identityType == "yammer") {
- $.ajax({
- type: "POST",
- data: JSON.stringify({ accessToken: accessToken }),
- dataType: "json",
- url: Config.YammerServiceUrl + "/GetMessagesSentByUser",
- contentType: "application/json; charset=utf-8",
- success: function (data, textStatus, jqXHR) {
- $("#<%= Feed.ClientID %>").html(data);
- $('span.humaneDate').humaneDates();
- //$("span.twitterdate").humaneDates();
- $('a.ymsgopen').each(YammerMessageLengthToggle);
-
-
- $(".moreyammerbutton").click(function () {
- $(".moreyammerbutton").parent().children(".rssfeed").each(function () {
- toggleYammerMSGDisplay($(this));
- });
- return false;
- });
- },
- error: function (jqXHR, textStatus, errorThrown) {
- $("#<%= Feed.ClientID %>").html("<%= currentLanguagePack.GeneralYammerMessageError %><!-- " + jqXHR.responseText + "-->");
- }
- });
- }
- else if (identityType == "twitter") {
- $.ajax({
- type: "GET",
- dataType: "json",
- url: Config.TwitterServiceUrl + "/GetUserTweets?accessToken=" + accessToken,
- contentType: "application/json; charset=utf-8",
- success: function (data, textStatus, jqXHR) {
- data = Global.GetFirstProperty(data); // Get first property (because we get wrapped JSON objects)
-
- $("#<%= Feed.ClientID %>").html(data);
- $('span.humaneDate').humaneDates();
- $("span.twitterdate").humaneDates();
- //$('a.ymsgopen').each(YammerMessageLengthToggle);
-
-
- $(".moretwitterbutton").click(function () {
- $(".moretwitterbutton").parent().each(function () {
- toggleTwitterDisplay($(this));
- });
- return false;
- });
- },
- error: function (jqXHR, textStatus, errorThrown) {
- $("#<%= Feed.ClientID %>").html("<%= currentLanguagePack.GeneralTwitterMessageError %><!-- " + jqXHR.responseText + "-->");
- }
- });
- }
- else if (identityType == "linkedin") {
- $.ajax({
- type: "GET",
- dataType: "json",
- url: Config.LinkedInServiceUrl + "/GetUserPositions?accessToken=" + accessToken,
- contentType: "application/json; charset=utf-8",
- success: function (data, textStatus, jqXHR) {
- data = Global.GetFirstProperty(data); // Get first property (because we get wrapped JSON objects)
-
- $("#<%= Feed.ClientID %>").html(data);
-
- $('div.linkedInSummary').attr("style", "display: none;");
- // using the Jquery Expander plugin, just for slicing text. We don't use the expand functionality from expander
- $('div.linkedInSummaryShort').expander({ slicePoint: 135, expandText: '' });
- $('div.linkedInSummaryShort').attr("style", "display: block;");
-
- $(".morelinkedinbutton").click(function () {
- $(".morelinkedinbutton").parent().each(function () {
- toggleLinkedInDisplay($(this));
- });
- return false;
- });
-
-
- },
- error: function (jqXHR, textStatus, errorThrown) {
- $("#<%= Feed.ClientID %>").html("Error: " + jqXHR.responseText);
- }
- });
- }
-
-
- }
- });
-
- function toggleTwitterDisplay(list) {
- if (list.hasClass("collapsed")) {
- var count = 0;
- list.children("div").each(function () {
- if (count++ >= 1) $(this).slideDown(400);
- });
- list.removeClass("collapsed");
- $('.moretwitterbutton').html('Toon minder').addClass("morebuttonup").removeClass("morebuttondown"); ;
- }
- else {
- var count = 0;
- list.children("div").each(function () {
- if (count++ >= 1) $(this).slideUp(400);
- });
- list.addClass("collapsed");
- $('.moretwitterbutton').html('Toon meer').addClass("morebuttondown").removeClass("morebuttonup");
- }
- }
-
- function toggleLinkedInDisplay(list) {
- if (list.hasClass("collapsed")) {
- $('div.linkedInSummary').attr("style", "display: block;");
- $('div.linkedInSummaryShort').attr("style", "display: none;");
-
-
- var count = 0;
- list.children("div").each(function () {
- if (count++ >= 1) $(this).slideDown(400);
- });
- list.removeClass("collapsed");
- $('.morelinkedinbutton').html('Toon minder').addClass("morebuttonup").removeClass("morebuttondown"); ;
- }
- else {
-
- //$('div.linkedInSummary').text($(this).text().substr(0, 4000) + '...');
-
- $('div.linkedInSummary').attr("style", "display: none;");
- $('div.linkedInSummaryShort').attr("style", "display: block;");
-
- var count = 0;
- list.children("div").each(function () {
- if (count++ >= 1) $(this).slideUp(400);
- });
- list.addClass("collapsed");
- $('.morelinkedinbutton').html('Toon meer').addClass("morebuttondown").removeClass("morebuttonup");
- }
- }
-
-
-
- function toggleYammerMSGDisplay(list) {
- if (list.parent().hasClass("collapsed")) {
- var count = 0;
- list.children("div").each(function () {
- if (count++ >= 1) $(this).slideDown(400);
- });
- list.parent().removeClass("collapsed");
- $('.moreyammerbutton').html('Toon minder').addClass("morebuttonup").removeClass("morebuttondown"); ;
- }
- else {
- var count = 0;
- list.children("div").each(function () {
- if (count++ >= 2) $(this).slideUp(400);
- });
- list.parent().addClass("collapsed");
- $('.moreyammerbutton').html('Toon meer').addClass("morebuttondown").removeClass("morebuttonup");
- }
-
-
-
-
- }
- </script>
- </div>
- </div>