public override string CreateRenderedViewerMarkup(Uri url, int maxWidth, int maxHeight) { string videoUrl = new BcWebClient().ResolveMinifiedUrl(url); //WORKAROUND for telligent bug videoUrl = videoUrl.Replace("&", "&"); Match match = BcRegex.Match(videoUrl); if (match.Success) { int height = 450; int width = 480; bool isHttps = !string.IsNullOrEmpty(match.Groups["https"].Value); string playerId = match.Groups["playerId"].Value; string playerKey = match.Groups["playerKey"].Value; string videoId = match.Groups["videoId"].Value; Globals.ScaleUpDown(ref width, ref height, maxWidth, maxHeight); string playerHtml = string.Format(PlayerHtmlTemplateBody, playerId, videoId, playerKey, width, height, isHttps?PLayerHtmlHttpsModifier:string.Empty); CSContext context = CSContext.Current; Page page = null; if (context.Context != null) { page = context.Context.Handler as Page; } if (page != null) { string id = "video_" + Guid.NewGuid(); var wrapper = new StringBuilder(); wrapper.Append("<script type=\"text/javascript\" src=\""); wrapper.Append( Globals.FullPath(page.ClientScript.GetWebResourceUrl(typeof(BrightcoveMediaViewer), "FourRoads.Common.TelligentCommunity.Plugins.insertmarkup.js"))); wrapper.Append("\"></script>"); wrapper.AppendFormat("<div id=\"{0}\"><noscript>{1}</noscript></div>", id, playerHtml); wrapper.Append(string.Format(PlayerHtmlTemplateHead, isHttps ? "s":string.Empty)); wrapper.Append("<script type=\"text/javascript\">\n"); wrapper.Append("cs_setInnerHtml('"); wrapper.Append(id); wrapper.Append("','"); wrapper.Append(JavaScript.Encode(playerHtml)); wrapper.Append("');"); wrapper.Append("\n</script>"); wrapper.Append(PlayerHtmlTemplateTail); return(wrapper.ToString()); } return(playerHtml); } return(string.Empty); }
public override string CreateRenderedViewerMarkup(Uri url, int maxWidth, int maxHeight) { Match match = CSRegex.DailyMotionViewerIdRegex().Match(url.OriginalString); if (!match.Success) { return(string.Empty); } int width = 420; int height = 0x14b; Globals.ScaleUpDown(ref width, ref height, maxWidth, maxHeight); string playerHtml = string.Format("<iframe source=\"{3}\" frameborder=\"0\" width=\"{1}\" height=\"{2}\" src=\"http://www.dailymotion.com/embed/video/{0}\" allowfullscreen></iframe>", Globals.EnsureHtmlEncoded(match.Groups[1].Value), width, height, HttpUtility.HtmlAttributeEncode(url.ToString())); CSContext current = CSContext.Current; Page handler = null; if (current.Context != null) { handler = current.Context.Handler as Page; } if (handler != null) { string videoId = "video_" + Guid.NewGuid().ToString(); StringBuilder embedHtml = new StringBuilder(); embedHtml.Append("<script type=\"text/javascript\" src=\""); embedHtml.Append(Globals.FullPath(handler.ClientScript.GetWebResourceUrl(typeof(DailyMotionMediaViewer), "FourRoads.Common.TelligentCommunity.Plugins.insertmarkup.js"))); embedHtml.Append("\"></script>"); embedHtml.AppendFormat("<div id=\"{0}\"><noscript>{1}</noscript></div>", videoId, playerHtml); embedHtml.Append("<script type=\"text/javascript\">\n"); embedHtml.Append("cs_setInnerHtml('"); embedHtml.Append(videoId); embedHtml.Append("','"); embedHtml.Append(JavaScript.Encode(playerHtml)); embedHtml.Append("');"); embedHtml.Append("\n</script>"); return(embedHtml.ToString()); } return(playerHtml); }
public string GetHeader(RenderTarget target) { var script = new StringBuilder(); script.Append("<style type = \"text/css\">"); script.Append(@".site-banner .banner.site .lync-indicator { right: -2px; top: 17px; position: absolute; background-color: #e4e4e4; display: block; width: 10px; height: 10px; z-index: 100; -webkit-border-radius: 500px; -moz-border-radius: 500px; border-radius: 500px; } .site-banner .banner.site .lync-indicator.Online, .site-banner .banner.site .lync-indicator.IdleOnline { background-color: #82d34b; } .site-banner .banner.site .lync-indicator.Away, .site-banner .banner.site .lync-indicator.Offwork, .site-banner .banner.site .lync-indicator.BeRightBack{ background-color: #ffeb1e; } .site-banner .banner.site .lync-indicator.Busy, .site-banner .banner.site .lync-indicator.IdleBusy, .site-banner .banner.site .lync-indicator.DoNotDisturb{ background-color: #f40707; } " ); script.Append("</style>"); script.Append("<script type=\"text/javascript\">"); script.Append(@"jQuery(function($) { var popup = null; var statuses = {" ).AppendFormat("'{0}':'{1}',", UserStatus.Away, JavaScript.Encode(_translation.GetLanguageResourceValue("away"))) .AppendFormat("'{0}':'{1}',", UserStatus.BeRightBack, JavaScript.Encode(_translation.GetLanguageResourceValue("be_right_back"))) .AppendFormat("'{0}':'{1}',", UserStatus.Busy, JavaScript.Encode(_translation.GetLanguageResourceValue("busy"))) .AppendFormat("'{0}':'{1}',", UserStatus.DoNotDisturb, JavaScript.Encode(_translation.GetLanguageResourceValue("do_not_disturb"))) .AppendFormat("'{0}':'{1}',", UserStatus.IdleBusy, JavaScript.Encode(_translation.GetLanguageResourceValue("idle_busy"))) .AppendFormat("'{0}':'{1}',", UserStatus.IdleOnline, JavaScript.Encode(_translation.GetLanguageResourceValue("idle_online"))) .AppendFormat("'{0}':'{1}',", UserStatus.Online, JavaScript.Encode(_translation.GetLanguageResourceValue("online"))) .AppendFormat("'{0}':'{1}',", PreferredUserStatus.Offwork, JavaScript.Encode(_translation.GetLanguageResourceValue("offwork"))) .AppendFormat("'{0}':'{1}' ", UserStatus.Offline, JavaScript.Encode(_translation.GetLanguageResourceValue("offline"))).Append(@"}; var preferred = [" ).AppendFormat("'{0}',", PreferredUserStatus.Away) .AppendFormat("'{0}',", PreferredUserStatus.BeRightBack) .AppendFormat("'{0}',", PreferredUserStatus.Busy) .AppendFormat("'{0}',", PreferredUserStatus.DoNotDisturb) .AppendFormat("'{0}',", PreferredUserStatus.Offwork) .AppendFormat("'{0}' ", PreferredUserStatus.Online).Append(@"]; var classes = []; for(var status in statuses) { classes.push(status) }; classes = classes.join(' '); jQuery.telligent.evolution.ui.components.lyncstatus = { setup: function() { var html = ''; for(var status, i=0; i < preferred.length; i++) { status = preferred[i] html += '<li><a href=""javascript:void(0)"" class=""internal-link"" data-status=""' + status + '"">' + statuses[status] + '</a></li>'; } html = '<ul>' + html + '</ul>'; popup = $('<div></div>') .glowPopUpPanel({ cssClass: 'links-popup-panel lync-statuses-panel', zIndex: 1500, hideOnDocumentClick: false }) .glowPopUpPanel('html', html) .on('glowPopUpPanelShown', function() { $.telligent.evolution.messaging.publish('ui.links.show'); setTimeout(function(){ if(!popup.data('over')) popup.glowPopUpPanel('hide'); }, 1000); }) .on('glowPopUpPanelHidden', function() { $.telligent.evolution.messaging.publish('ui.links.hide'); popup.data('over', false); }); $(document).on('mouseenter', '.lync-statuses-panel', function(){ popup.data('over', true); }) .on('mouseleave', '.lync-statuses-panel', function(){ popup.data('over', false); }) .on('glowDelayedMouseLeave', '.lync-statuses-panel', 500, function(el) { el.stopPropagation(); popup.glowPopUpPanel('hide'); }) .on('click', '.lync-statuses-panel .internal-link', function(el) { var statusLink = $('.lync-status'); var old = statusLink.text(); statusLink.text('" ).Append(JavaScript.Encode(_translation.GetLanguageResourceValue("processing"))).Append(@"'); $.telligent.evolution.post({ url: $.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/lync/userstatus.json', data: { UserStatus: $(this).data('status') }, dataType: 'json', success: function(response) { $.telligent.evolution.messaging.publish('lyncstatus.updated.' + response.UserStatus.userid, response.UserStatus.status); }, error: function(response) { statusLink.text(old); } }); popup.glowPopUpPanel('hide'); }); }, add: function(e, options) { var sId = $.telligent.evolution.messaging.subscribe('lyncstatus.updated.' + options.userid, function(status) { try{ $( "".lync-indicator[data-userid*='"" + options.userid + ""']"" ) .attr('data-tip', statuses[status]) .removeClass(classes) .addClass(status); if (e.hasClass('lync-status')){ e.text(statuses[status]).removeClass('disabled'); } }catch (err){ $.telligent.evolution.messaging.unsubscribe(sId); return; } }); $.telligent.evolution.sockets.lync.on('presence', function(data) { $.telligent.evolution.messaging.publish('lyncstatus.updated.' + data.userid, data.presence); }); $.telligent.evolution.get({ url: $.telligent.evolution.site.getBaseUrl() + (options.userid == options.accessinguserid ? 'api.ashx/v2/lync/userstatus.json' : 'api.ashx/v2/lync/userstatus/{UserId}.json'), data: { UserId: options.userid }, dataType: 'json', success: function(response) { $.telligent.evolution.messaging.publish('lyncstatus.updated.' + response.UserStatus.userid, response.UserStatus.status); if (options.userid != options.accessinguserid) { e.attr('href', 'sip:' + options.usersipuri); } else { e.on('click', function() { popup.glowPopUpPanel('show', e); }); } }, error: function(response){ $.telligent.evolution.messaging.publish('lyncstatus.updated.' + options.userid, 'offline'); } }); } }; $.telligent.evolution.messaging.subscribe('socket.connected', function() { //report user activity every 45 seconds setInterval(function() { $.telligent.evolution.sockets." ).Append(LyncSocketName).Append(@".send('reportActivity'); }, 45000); });" ); script.AppendFormat(@"$('.site-banner .user-links a.user:not(.with-icon)').wrap('<span style=""position:relative""></span>').after('<a href=""javascript:void(0)"" class=""ui-lyncstatus ui-tip lync-indicator disabled"" data-userid=""{0}"" data-accessinguserid=""{0}""/>')", PublicApi.Users.AccessingUser.Id); script.Append(@"});"); script.Append("</script>"); return(script.ToString()); }
protected void SaveBtnClick(object sender, EventArgs e) { if (!Page.IsValid) { ShowErrorMessage("Invalid Data"); return; } try { spConfig.SyncEnabled = cbSyncEnable.Checked; spConfig.FarmSyncEnabled = cbFarmSyncEnable.Checked; spConfig.SiteProfileMappedFields = new List <UserFieldMapping>(); ProcessPostedData(spConfig.SiteProfileMappedFields, hdnSiteProfileFieldsMap.Value); spConfig.FarmProfileMappedFields = new List <UserFieldMapping>(); ProcessPostedData(spConfig.FarmProfileMappedFields, hdnFarmProfileFieldsMap.Value); // Save Configuration to a syncSettings object spSyncSettings.SyncConfig = new SPBaseConfig { FarmProfileMappedFields = spConfig.FarmProfileMappedFields, SiteProfileMappedFields = spConfig.SiteProfileMappedFields, SyncEnabled = spConfig.SyncEnabled, FarmSyncEnabled = spConfig.FarmSyncEnabled }; const string script = @"setTimeout(function(){{CloseWindow('{0}');}},100);"; CSControlUtility.Instance().RegisterClientScriptBlock(this, GetType(), "closechildwindow", string.Format(script, JavaScript.Encode(spSyncSettings.ToXml())), true); TempStoreSPSyncSettingsList(true); } catch (Exception ex) { ShowErrorMessage(ex.Message); SPLog.RoleOperationUnavailable(ex, ex.Message); } }
protected void ApplyBtnClick(object sender, EventArgs e) { if (!Page.IsValid) { ShowErrorMessage("Invalid Data"); return; } try { spConfig.SyncEnabled = cbSyncEnable.Checked; spConfig.FarmSyncEnabled = cbFarmSyncEnable.Checked; spConfig.SiteProfileMappedFields = new List <UserFieldMapping>(); ProcessPostedData(spConfig.SiteProfileMappedFields, hdnSiteProfileFieldsMap.Value); spConfig.FarmProfileMappedFields = new List <UserFieldMapping>(); ProcessPostedData(spConfig.FarmProfileMappedFields, hdnFarmProfileFieldsMap.Value); // Save Configuration to a syncSettings object spSyncSettings.SyncConfig = new SPBaseConfig { FarmProfileMappedFields = spConfig.FarmProfileMappedFields, SiteProfileMappedFields = spConfig.SiteProfileMappedFields, SyncEnabled = spConfig.SyncEnabled, FarmSyncEnabled = spConfig.FarmSyncEnabled }; BindDropDownListData(ddlSPSiteProfileFields, spConfig.SiteProfileFields.OrderBy(f => f.Title).ToList(), f => String.Format("{0} - {1}", f.Title, f.Name)); BindDropDownListData(ddlSPFarmProfileFields, spConfig.FarmProfileFields.OrderBy(f => f.Title), f => f.Title); BindDropDownListData(ddlTEProfileFields, TEUserProfileFieldsHelper.GetFields().OrderBy(f => f.Name).ToList(), f => f.Name); const string script = @"setTimeout(function(){{parent.window.frames[0].AddSyncSettings('{0}');}},100);"; CSControlUtility.Instance().RegisterClientScriptBlock(this, GetType(), "applychildwindow", string.Format(script, JavaScript.Encode(spSyncSettings.ToXml())), true); } catch (Exception ex) { ShowErrorMessage(ex.Message); SPLog.RoleOperationUnavailable(ex, ex.Message); } }
protected void SaveBtnClick(object sender, EventArgs e) { if (!Page.IsValid) { return; } TbUserIdFieldName.Text = (string.IsNullOrEmpty(TbUserIdFieldName.Text)) ? "ID" : TbUserIdFieldName.Text; TbUserEmailFieldName.Text = (string.IsNullOrEmpty(TbUserEmailFieldName.Text)) ? "EMail" : TbUserEmailFieldName.Text; TbFarmUserEmailFieldName.Text = (string.IsNullOrEmpty(TbFarmUserEmailFieldName.Text)) ? "WorkEmail" : TbFarmUserEmailFieldName.Text; try { Authentication auth = AuthenticationHelper.FromHtml(CtAuth); if (Mode == PageMode.Add) { spSyncSettings = new SPProfileSyncProvider(TbSPSiteUrl.Text, TbUserIdFieldName.Text, TbUserEmailFieldName.Text, TbFarmUserEmailFieldName.Text, auth); } else { spSyncSettings.SPSiteURL = TbSPSiteUrl.Text; spSyncSettings.SPUserIdFieldName = TbUserIdFieldName.Text; spSyncSettings.SPUserEmailFieldName = TbUserEmailFieldName.Text; spSyncSettings.SPFarmUserEmailFieldName = TbFarmUserEmailFieldName.Text; spSyncSettings.Authentication = auth; } const string script = @"setTimeout(function(){{CloseWindow('{0}');}},100);"; CSControlUtility.Instance().RegisterClientScriptBlock(this, GetType(), "closechildwindow", string.Format(script, JavaScript.Encode(spSyncSettings.ToXml())), true); TempStoreSPSyncSettingsList(true); } catch (Exception) { ShowErrorMessage(); } }
private void UpdateCurrentProvider(string spSiteUrl, Authentication auth) { if (pageMode == PageMode.Add) { currentProvider = new IntegrationProvider(spSiteUrl, 0, auth); } else { currentProvider.SPSiteURL = spSiteUrl; currentProvider.TEGroupId = 0; currentProvider.Authentication = auth; currentProvider.Initialize(); } currentProvider.IsDefault = CbIsDefault.Checked; const string script = @"setTimeout(function(){{CloseWindow('{0}');}},100);"; CSControlUtility.Instance().RegisterClientScriptBlock(this, typeof(Configuration), "closechildwindow", string.Format(script, JavaScript.Encode(currentProvider.ToXml())), true); }