protected override void OnPreRender(EventArgs e) { SPContext context = SPContext.Current; SPWeb web = context.Web; SEID = Guid.NewGuid(); string layoutPath = web.SafeServerRelativeUrl() + "/_layouts/15/epmlive/"; SPPageContentManager.RegisterStyleFile(layoutPath + "stylesheets/SocialStream.min.css"); EPMLiveScriptManager.RegisterScript(Page, new[] { "libraries/jquery.min", "libraries/handlebars-v1.3.0", "@libraries/amplify", "@libraries/bundles/moment", "@EPMLive.SocialStream" }); SetTimeZone(web, context); CurrentUserDisplayName = EPMLiveCore.CoreFunctions.GetSafeUserTitle(Convert.ToString(web.CurrentUser.Name)); try { var picture = (string)(web.SiteUserInfoList.Items.GetItemById(web.CurrentUser.ID)["Picture"] ?? string.Empty); CurrentUserAvatar = string.IsNullOrEmpty(picture) ? string.Empty : picture.Split(',')[0].Trim(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { foreach (string style in new[] { "Vendors/ImageAreaSelect/imgareaselect-default.min" }) { SPPageContentManager.RegisterStyleFile(LAYOUT_PATH + "stylesheets/" + style + ".css"); } }
// Protected Methods (2) protected override void OnPreRender(EventArgs e) { SPPageContentManager.RegisterStyleFile(LAYOUT_PATH + "stylesheets/notifications.v2.min.css"); EPMLiveScriptManager.RegisterScript(Page, new[] { "libraries/jquery.min", "@EPMLive.Notifications.v2" }); GetProfilePicture(); }
private void InitFields() { try { list = SPContext.Current.List; } catch (Exception ex) { Trace.WriteLine(ex.ToString()); } var gridSettings = new GridGanttSettings(list); DisplayFormRedirect = gridSettings.DisplayFormRedirect; if (DisplayFormRedirect && ControlMode == SPControlMode.New && Page.Request[IsDialogParameter] != ModifiedType) { SPContext.Current.FormContext.OnSaveHandler += CustomHandler; } else if (!string.IsNullOrWhiteSpace(Page.Request[SourceParam])) { RedirectUrl = Page.Request[SourceParam]; SPContext.Current.FormContext.OnSaveHandler += HandleNewItemRecent; } else { SPContext.Current.FormContext.OnSaveHandler += HandleNewItemRecent; } if (gridSettings.DisplaySettings != string.Empty) { fieldProperties = ListDisplayUtils.ConvertFromString(gridSettings.DisplaySettings); } try { isWorkList = gridSettings.EnableWorkList; } catch (Exception ex) { Trace.WriteLine(ex.ToString()); } if (isWorkList) { SPPageContentManager.RegisterClientScriptInclude( this, GetType(), "WorkEngineStatusing", "/_layouts/15/epmlive/WorkEngineStatusing.js"); } if (list == null) { list = SPContext.Current.Web.Lists[new Guid(Page.Request[Listid])]; } }
// Protected Methods (1) protected void Page_Load(object sender, EventArgs e) { string fileVersion = GetFileVersion(); foreach (string path in new[] { "libraries/jquery.min", "jquery.signalR-1.1.3.min" } .Select(s => JS_PATH + s + ".js?v=" + fileVersion)) { SPPageContentManager.RegisterScriptFile(Page, path, false, true, "javascript", null); } }
public static void RegisterScript(Page page, string[] scripts, bool localizable = false) { if (page == null) { return; } bool debugMode = false; try { string debug = HttpContext.Current.Request.Params["epmdebug"]; if ((debug ?? string.Empty).ToLower().Equals("true")) { debugMode = true; } } catch { } var bundledScripts = new[] { "jquery", "jquery-ui", "UplandV5", "jquery.cookie", "tooltip", "bindWithDelay", "EPM" }; foreach (string script in from script in scripts where !string.IsNullOrEmpty(script) select script.Trim().ToLower() into script where !string.IsNullOrEmpty(script) where !script.Equals("@") where !script.Equals("/") where !script.Equals("@/") select script) { string scrpt = script.Replace("@", string.Empty); if ((from bundledScript in bundledScripts select bundledScript.ToLower() into s select new[] { s, s + ".js", s + ".min", s + ".min.js", s + ".debug.js" } into variations let pieces = scrpt.Split('/') let currentScript = pieces[pieces.Length - 1] where variations.Any(v => v.Equals(currentScript)) select variations).Any()) { continue; } bool defer = !scrpt.Equals("masterpages/uplandv5.master"); SPPageContentManager.RegisterScriptFile(page, GetScript(script, debugMode), localizable, defer, "javascript", null); } }
private void RegisterScripts() { foreach (string style in new[] { "MyWorkWebPart.min" }) { SPPageContentManager.RegisterStyleFile(LAYOUT_PATH + style + ".css"); } EPMLiveScriptManager.RegisterScript(Page, new[] { "libraries/jquery.min", "@EPM", "/treegrid/GridE", "/xml2json", "/MD5", "@/MyWorkWebPart", "GanttGrid" }); ServicePointManager.ServerCertificateValidationCallback += delegate { return(true); }; }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); foreach (string style in new[] { "upgrader.min" }) { SPPageContentManager.RegisterStyleFile(LAYOUT_PATH + "stylesheets/" + style + ".css"); } EPMLiveScriptManager.RegisterScript(Page, new[] { "@EPMLive.Upgrader" }); }
protected override void OnPreRender(EventArgs e) { string func_ChooseFromChanged = string.Format(@" function ChooseFromChanged() {{ var chooseFrom = (document.querySelector('input[name=""{0}""]:checked')); var ddlGroup = (document.getElementById('{1}')); ddlGroup.disabled = (chooseFrom.value === 'RadChooseFromAllPeopleGroups'); }} ", radioList_ChooseFrom.UniqueID, ddl_Groups.ClientID); SPPageContentManager.RegisterClientScriptBlock(this.Page, base.GetType(), "ChooseFromChanged", func_ChooseFromChanged); //SPPageContentManager.RegisterArrayDeclaration(this.Page, strArray[i], builder.ToString()); base.OnPreRender(e); }
// Protected Methods (1) protected void Page_Load(object sender, EventArgs e) { string layoutPath = SPContext.Current.Web.SafeServerRelativeUrl() + "/_layouts/15/epmlive/"; SPPageContentManager.RegisterStyleFile(layoutPath + "stylesheets/SocialStream.Logs.min.css"); SPPageContentManager.RegisterStyleFile(layoutPath + "javascripts/libraries/highlight/styles/vs.css"); EPMLiveScriptManager.RegisterScript(Page, new[] { "libraries/jquery.min", "libraries/handlebars-v1.3.0", "@libraries/amplify", "@libraries/bundles/moment", "libraries/highlight/highlight.pack", "@EPMLive.SocialStream.Logs" }); SetTimeZone(SPContext.Current.Web, SPContext.Current); }
protected override void RenderWebPart(HtmlTextWriter output) { if (this.ServerInitialRender) { Type typeWebPartPlatform = typeof(OriginalSearchBoxScriptWebPart).Assembly.GetType("Microsoft.Office.Server.Search.WebControls.WebPartPlatform"); object instanceWebPartPlatform = typeWebPartPlatform.GetProperty("Current", BindingFlags.Static | BindingFlags.NonPublic).GetValue(typeWebPartPlatform); MethodInfo wppgetLocResourceString = typeWebPartPlatform.GetMethod("GetLocResourceString", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); Type typeLocStringIdO = typeof(OriginalSearchBoxScriptWebPart).Assembly.GetType("Microsoft.Office.Server.Search.LocStringId"); Type typeLocStringIdP = typeof(OriginalSearchBoxScriptWebPart).Assembly.GetType("Microsoft.SharePoint.Portal.WebControls.LocStringId"); Type typeSearchCommon = typeof(OriginalSearchBoxScriptWebPart).Assembly.GetType("Microsoft.SharePoint.Portal.WebControls.SearchCommon"); MethodInfo scGetLocResourceStringO = typeSearchCommon.GetMethod("GetLocResourceString", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeLocStringIdO }, null); MethodInfo scGetLocResourceStringP = typeSearchCommon.GetMethod("GetLocResourceString", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeLocStringIdP }, null); SPWeb web = SPContext.Current.Web; bool flag = this.NavigationNodes != null && this.NavigationNodes.Length > 1; string text = string.Empty; Type kv = typeof(OriginalScriptApplicationManager).Assembly.GetType("Microsoft.Office.Server.Search.WebControls.KeywordQueryReader"); var instance = kv.GetMethod("GetInstance", new Type[] { this.Page.GetType() }).Invoke(kv, new object[] { this.Page }); if (instance != null) { text = (string)kv.GetProperty("Keywords", BindingFlags.Public | BindingFlags.Instance).GetValue(instance, null); } string locResourceString = this.InitialPrompt; if (string.IsNullOrEmpty(locResourceString)) { locResourceString = (string)wppgetLocResourceString.Invoke(instanceWebPartPlatform, new object[] { Enum.Parse(typeLocStringIdO, "SearchBox_KeywordTextBoxToolTip_Text") }); } string text2 = ""; if (string.IsNullOrWhiteSpace(text)) { text = locResourceString; text2 = "ms-srch-sb-prompt ms-helperText"; } string text3 = base.CsrContainerId + "_sboxdiv"; string text4 = base.CsrContainerId + "_sbox"; string text5 = base.CsrContainerId + "_NavButton"; string text6 = base.CsrContainerId + "_AutoCompList"; string text7 = base.CsrContainerId + "_NavDropdownList"; string text8 = base.CsrContainerId + "_SearchLink"; string scriptLiteralToEncode = "ms-srch-sbprogress"; output.Write("<div componentid=\"{0}\" id=\"{0}\"><div id=\"SearchBox\" data-ddd=\"DDD\" name=\"Control\"><div class=\"ms-srch-sb ms-srch-sb-border\" id=\"{1}\">", HttpUtility.HtmlAttributeEncode(base.CsrContainerId), HttpUtility.HtmlAttributeEncode(text3)); output.Write("<input type=\"text\" value=\"{0}\" maxlength=\"2048\" accessKey=\"{1}\" title=\"{2}\" id=\"{3}\" autocomplete=\"off\" autocorrect=\"off\" onkeypress=\"{4}\" onkeydown=\"{5}\" onfocus=\"{6}\" onblur=\"{7}\" class=\"ms-textSmall {8}\"/>", new object[] { HttpUtility.HtmlAttributeEncode((text != null) ? text : ""), HttpUtility.HtmlAttributeEncode((string)scGetLocResourceStringP.Invoke(typeSearchCommon, new object[] { Enum.Parse(typeLocStringIdP, "ResultMgmt_ToggleAdvControls_AccessKey") })), HttpUtility.HtmlAttributeEncode(locResourceString), HttpUtility.HtmlAttributeEncode(text4), string.Concat(new string[] { "EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {if (Srch.U.isEnterKey(String.fromCharCode(event.keyCode))) {$find('", SPHttpUtility.EcmaScriptStringLiteralEncode(base.CsrContainerId), "').search($get('", SPHttpUtility.EcmaScriptStringLiteralEncode(text4), "').value);return Srch.U.cancelEvent(event);}})" }), "EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {var ctl = $find('" + SPHttpUtility.EcmaScriptStringLiteralEncode(base.CsrContainerId) + "');ctl.activateDefaultQuerySuggestionBehavior();})", "EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {var ctl = $find('" + SPHttpUtility.EcmaScriptStringLiteralEncode(base.CsrContainerId) + "');ctl.hidePrompt();ctl.setBorder(true);})", "EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {var ctl = $find('" + SPHttpUtility.EcmaScriptStringLiteralEncode(base.CsrContainerId) + "'); if (ctl){ ctl.showPrompt(); ctl.setBorder(false);}})", HttpUtility.HtmlAttributeEncode(text2) }); string text9 = null; if (web != null) { text9 = SPUtility.GetThemedImageUrl(SPUtility.ConcatUrls("/", SPUtility.ConcatUrls(SPUtility.ContextLayoutsFolder, "images/searchresultui.png")), "searchresultui"); } if (flag) { output.Write("<a title=\"{0}\" id=\"{1}\" onclick=\"{2}\" href=\"{3}\" class=\"ms-srch-sb-navLink\" >", new object[] { HttpUtility.HtmlAttributeEncode((string)wppgetLocResourceString.Invoke(instanceWebPartPlatform, new object[] { Enum.Parse(typeLocStringIdO, "SearchBox_NavigationButtonToolTip_Text") })), HttpUtility.HtmlAttributeEncode(text5), "EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {$find('" + SPHttpUtility.EcmaScriptStringLiteralEncode(base.CsrContainerId) + "').activateDefaultNavigationBehavior();return Srch.U.cancelEvent(event);})", "javascript: {}" }); if (!string.IsNullOrEmpty(text9)) { output.Write("<img src=\"{0}\" class=\"ms-srch-sb-navImg\" id=\"navImg\" alt=\"{1}\" />", HttpUtility.HtmlAttributeEncode(text9), HttpUtility.HtmlAttributeEncode((string)wppgetLocResourceString.Invoke(instanceWebPartPlatform, new object[] { Enum.Parse(typeLocStringIdO, "SearchBox_NavigationButtonToolTip_Text") }))); } output.Write("</a>"); } output.Write("<a title=\"{0}\" class=\"ms-srch-sb-searchLink\" id=\"{1}\" onclick=\"{2}\" href=\"{3}\" >", new object[] { HttpUtility.HtmlAttributeEncode((string)wppgetLocResourceString.Invoke(instanceWebPartPlatform, new object[] { Enum.Parse(typeLocStringIdO, "SearchBox_SearchButtonToolTip_Text") })), HttpUtility.HtmlAttributeEncode(text8), string.Concat(new string[] { "EnsureScriptFunc('Search.ClientControls.js', 'Srch.U', function() {$find('", SPHttpUtility.EcmaScriptStringLiteralEncode(base.CsrContainerId), "').search($get('", SPHttpUtility.EcmaScriptStringLiteralEncode(text4), "').value);})" }), "javascript: {}" }); if (!string.IsNullOrEmpty(text9)) { output.Write("<img src=\"{0}\" class=\"ms-srch-sb-searchImg\" id=\"searchImg\" alt=\"{1}\" />", HttpUtility.HtmlAttributeEncode(text9), HttpUtility.HtmlAttributeEncode((string)wppgetLocResourceString.Invoke(instanceWebPartPlatform, new object[] { Enum.Parse(typeLocStringIdO, "SearchBox_SearchButtonToolTip_Text") }))); } output.Write("</a>"); if (this.ShowQuerySuggestions) { output.Write("<div class=\"ms-qSuggest-container ms-shadow\" id=\"AutoCompContainer\">"); output.Write("<div id=\"{0}\"></div>", HttpUtility.HtmlAttributeEncode(text6)); output.Write("</div>"); } if (flag) { output.Write("<div class=\"ms-qSuggest-container ms-shadow\" id=\"NavDropdownListContainer\">"); output.Write("<div id=\"{0}\"></div>", HttpUtility.HtmlAttributeEncode(text7)); output.Write("</div>"); } output.Write("</div>"); if (this.ShowAdvancedLink && !string.IsNullOrEmpty(this.AdvancedSearchPageAddress)) { output.Write("<div class='ms-srch-sb-link'><a id='AdvancedLink' href='{0}'>{1}</a></div>", SPHttpUtility.HtmlUrlAttributeEncode(this.AdvancedSearchPageAddress), SPHttpUtility.HtmlEncode((string)wppgetLocResourceString.Invoke(instanceWebPartPlatform, new object[] { Enum.Parse(typeLocStringIdO, "SearchBox_AdvancedSearchText") }))); } if (this.ShowPreferencesLink) { string text10 = string.Empty; if (web != null) { text10 = SPUtility.ConcatUrls(SPUtility.ContextLayoutsFolder, "EditUserPref.aspx?Source=" + SPHttpUtility.UrlKeyValueEncode(SPAlternateUrl.ContextUri.OriginalString)); text10 = SPUtility.ConcatUrls(web.ServerRelativeUrl, text10); } if (!string.IsNullOrEmpty(text10)) { output.Write("<div class='ms-srch-sb-link'><a id='PreferencesLink' href='{0}'>{1}</a></div>", SPHttpUtility.HtmlUrlAttributeEncode(text10), SPHttpUtility.HtmlEncode((string)wppgetLocResourceString.Invoke(instanceWebPartPlatform, new object[] { Enum.Parse(typeLocStringIdO, "SearchBox_PreferencesText") }))); } } output.Write("</div>"); output.Write("</div>"); Type swpsbd = typeof(OriginalScriptApplicationManager).Assembly.GetType("Microsoft.Office.Server.Search.WebControls.ScriptWebPartScriptBehaviorDescriptor"); var scriptWebPartScriptBehaviorDescriptor = Activator.CreateInstance(swpsbd, this.ClientControlType, base.CsrContainerId); typeof(ScriptObjectBuilder).GetMethod("DescribeSimpleComponent", BindingFlags.NonPublic | BindingFlags.Static).Invoke(typeof(ScriptObjectBuilder), new object[] { this, scriptWebPartScriptBehaviorDescriptor }); string behaviorScript = (string)swpsbd.GetMethod("GetBehaviorScript", BindingFlags.Instance | BindingFlags.Public).Invoke(scriptWebPartScriptBehaviorDescriptor, new object[] { }); this.OnAfterSerializeToClient(new ScriptWebPart.AfterSerializeToClientEventArgs(this)); string text11 = string.Concat(new string[] { "\r\n ExecuteOrDelayUntilScriptLoaded(\r\n function() \r\n {\r\n if ($isNull($find('", SPHttpUtility.EcmaScriptStringLiteralEncode(base.CsrContainerId), "')))\r\n {\r\n var sb = ", behaviorScript, "\r\n sb.activate('", SPHttpUtility.EcmaScriptStringLiteralEncode(locResourceString), "', '", SPHttpUtility.EcmaScriptStringLiteralEncode(text4), "', '", SPHttpUtility.EcmaScriptStringLiteralEncode(text3), "', '", SPHttpUtility.EcmaScriptStringLiteralEncode(text5), "', '", SPHttpUtility.EcmaScriptStringLiteralEncode(text6), "', '", SPHttpUtility.EcmaScriptStringLiteralEncode(text7), "', '", SPHttpUtility.EcmaScriptStringLiteralEncode(text8), "', '", SPHttpUtility.EcmaScriptStringLiteralEncode(scriptLiteralToEncode), "', '", SPHttpUtility.EcmaScriptStringLiteralEncode(text2), "');\r\n }\r\n }, 'Search.ClientControls.js');" }); if (this.SetFocusOnPageLoad) { Guid guid = Guid.NewGuid(); string text12 = text11; text11 = string.Concat(new string[] { text12, "\r\n function initSearchBox", guid.ToString("N"), "() {\r\n $get('", SPHttpUtility.EcmaScriptStringLiteralEncode(text4), "').focus();\r\n }\r\n _spBodyOnLoadFunctionNames.push('initSearchBox", guid.ToString("N"), "');" }); } if (!SPPageContentManager.IsStartupScriptRegistered(this.Page, base.GetType(), "SearchBoxScriptWebPart" + text4)) { SPPageContentManager.RegisterStartupScript(this.Page, base.GetType(), "SearchBoxScriptWebPart" + text4, text11); } } typeof(ScriptWebPart).GetMethod("RenderWebPart", BindingFlags.Instance | BindingFlags.NonPublic).InvokeNotOverride(this, output); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.PreRender" /> event. /// </summary> /// <param name="e"> /// An <see cref="T:System.EventArgs" /> object that contains the event data. /// </param> protected override void OnPreRender(EventArgs e) { _currentWeb = SPContext.Current.Web; _reqWebId = Convert.ToString(_currentWeb.ID); SPList resourcesList; if (_currentWeb.IsRootWeb && string.IsNullOrEmpty(Request["listId"]) && string.IsNullOrEmpty(Request["id"])) { resourcesList = _currentWeb.Lists.TryGetList("Resources"); } else { resourcesList = _currentWeb.Lists.TryGetList("Team"); } if (resourcesList != null) { foreach (string style in new[] { "libraries/jquery-ui" }) { SPPageContentManager.RegisterStyleFile(LAYOUT_PATH + "stylesheets/" + style + ".css"); } EPMLiveScriptManager.RegisterScript(Page, new[] { "libraries/jquery.min", "@EPM", "/treegrid/GridE", "@EPMLive.ResourceGrid" }); ServicePointManager.ServerCertificateValidationCallback += delegate { return(true); }; } else { lblError.Text = @"<b>ERROR: </b>There is no ""Resources"" list at this level."; pnlGrid.Visible = false; pnlError.Visible = true; } var gSettings = new GridGanttSettings(resourcesList); if (string.IsNullOrEmpty(gSettings.RibbonBehavior)) { RibbonBehavior = 0; } else { RibbonBehavior = Convert.ToInt16(gSettings.RibbonBehavior); } SPRibbon spRibbon = SPRibbon.GetCurrent(Page); if (spRibbon != null) { if (!CurrentUserHaveResourceCenterPermission(SPBasePermissions.AddListItems)) { spRibbon.TrimById("Ribbon.ResourceGrid.New.NewItem", "false"); } if (!CurrentUserHaveResourceCenterPermission(SPBasePermissions.EditListItems)) { spRibbon.TrimById("Ribbon.ResourceGrid.Manage.EditItem", "false"); } if (!CurrentUserHaveResourceCenterPermission(SPBasePermissions.DeleteListItems)) { spRibbon.TrimById("Ribbon.ResourceGrid.Manage.DeleteItem", "false"); } } }