protected override void Render(HtmlTextWriter writer) { bind(); if (false && Editable && ImEditable) { //<div class=Eheader><a href=""javascript:lw_Editor.edit('{0}', '{1}')"">Edit</a></div> writer.Write(string.Format(@"<div class=""editingarea {1}"" id=""Edit_{0}""> ", UniqueID.Replace(":", "_"), _class + " " + _property)); base.Render(writer); //writer.Write(string.Format("</div>", // this.UniqueID.Replace(":", "_"), "")); writer.Write("</div>"); } else { if (InjectHashTagsLinks) { Text = HashTagsManager.InjectTagLinks(Text); } base.Render(writer); } }
protected override void Render(HtmlTextWriter writer) { bind(); if (LoadFromDraft && ImEditable) { writer.Write(string.Format(@"<div class=""hidden original-version {1}"" id=""For_Edit_{0}""> ", UniqueID.Replace(":", "_"), _class + " " + _property)); writer.Write(ControlUtils.GetBoundedDataField(NamingContainer, _property, false)); //writer.Write(string.Format("</div>", // this.UniqueID.Replace(":", "_"), "")); writer.Write("</div>"); } if (Editable && ImEditable) { //<div class=Eheader><a href=""javascript:lw_Editor.edit('{0}', '{1}')"">Edit</a></div> writer.Write(string.Format(@"<div class=""editingarea {1}"" id=""Edit_{0}""> ", UniqueID.Replace(":", "_"), _class + " " + _property)); base.Render(writer); //writer.Write(string.Format("</div>", // this.UniqueID.Replace(":", "_"), "")); writer.Write("</div>"); } else { if (InjectHashTagsLinks) { Text = HashTagsManager.InjectTagLinks(Text); } base.Render(writer); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); _jsObjName = String.IsNullOrEmpty(ID) ? "pageNavigator" + UniqueID.Replace('$', '_') : ID; if (HttpContext.Current != null && HttpContext.Current.Request != null && AutoDetectCurrentPage) { if (!String.IsNullOrEmpty(HttpContext.Current.Request[this.ParamName])) { try { CurrentPageNumber = Convert.ToInt32(HttpContext.Current.Request[this.ParamName]); } catch { CurrentPageNumber = 0; } } } if (CurrentPageNumber <= 0) { CurrentPageNumber = 1; } var scriptNav = String.Format(@"window.{0} = new ASC.Controls.PageNavigator.init('{0}', 'body', '{1}', {2}, {3}, '{4}', '{5}');", _jsObjName, EntryCountOnPage, VisiblePageCount, CurrentPageNumber, UserControlsCommonResource.PreviousPage, UserControlsCommonResource.NextPage); Page.RegisterInlineScript(scriptNav, onReady: false); _page_amount = Convert.ToInt32(Math.Ceiling(EntryCount / (EntryCountOnPage * 1.0))); _start_page = CurrentPageNumber - 1 - VisiblePageCount / 2; if (_start_page + VisiblePageCount > _page_amount) { _start_page = _page_amount - VisiblePageCount; } if (_start_page < 0) { _start_page = 0; } _end_page = _start_page + VisiblePageCount; if (_end_page > _page_amount) { _end_page = _page_amount; } if ((_page_amount == 1 && VisibleOnePage) || _start_page >= _end_page || _end_page - _start_page <= 1) { return; } var spliter = "&"; if (PageUrl.IndexOf("?") == -1) { spliter = "&"; } var isFirst = (CurrentPageNumber == 1); var isLast = (CurrentPageNumber == _page_amount); var prevURL = PageUrl + spliter + ParamName + "=" + (CurrentPageNumber - 1).ToString(); var nextURL = PageUrl + spliter + ParamName + "=" + (CurrentPageNumber + 1).ToString(); var script = @"document.onkeydown = function(e) { var code; if (!e) var e = window.event; if (e.keyCode) code = e.keyCode; else if (e.which) code = e.which;" + ((!isFirst) ? @"if ((code == 37) && (e.ctrlKey == true)) { window.open('" + prevURL + @"','_self'); }" : "") + ((!isLast) ? @"if ((code == 39) && (e.ctrlKey == true)) { window.open('" + nextURL + @"','_self'); }" : "") + @"}; "; Page.RegisterInlineScript(script, onReady: false); }
protected override void OnLoad(EventArgs e) { base.OnInit(e); _jsObjName = String.IsNullOrEmpty(ID) ? "advancedUserSelector" + UniqueID.Replace('$', '_') : ID; if (!Page.ClientScript.IsClientScriptIncludeRegistered(GetType(), "ASC_Controls_AdvUserSelector_Script")) { Page.ClientScript.RegisterClientScriptInclude("ASC_Controls_AdvUserSelector_Script", Page.ClientScript.GetWebResourceUrl(GetType(), "ASC.Web.Controls.AdvancedUserSelector.js.AdvUserSelectorScript.js")); } if (!Page.ClientScript.IsClientScriptBlockRegistered("ASC_Controls_AdvUserSelector_Style")) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "ASC_Controls_AdvUserSelector_Style", "<link href=\"" + Page.ClientScript.GetWebResourceUrl(GetType(), "ASC.Web.Controls.AdvancedUserSelector.css.default.css") + "\" type=\"text/css\" rel=\"stylesheet\"/>", false); } var scriptInit = new StringBuilder(); scriptInit.AppendFormat("\nASC.Controls.AdvancedUserSelector._profiles = '{0}';\n", new Api.ApiServer().GetApiResponse("api/1.0/people.json?fields=id,displayname,avatarsmall,groups", "GET")); scriptInit.AppendFormat("\nASC.Controls.AdvancedUserSelector._groups = '{0}';\n", new Api.ApiServer().GetApiResponse("api/1.0/group.json", "GET")); scriptInit.AppendFormat("\nASC.Controls.AdvancedUserSelector.UserNameFormat = {0};\n", (int)UserFormatter.GetUserDisplayDefaultOrder()); if (!Page.ClientScript.IsClientScriptBlockRegistered(GetType(), "ASC_Controls_AdvUserSelector_ScriptInit")) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "ASC_Controls_AdvUserSelector_ScriptInit", scriptInit.ToString(), true); } var script = new StringBuilder(); script.AppendFormat("var {0} = new ASC.Controls.AdvancedUserSelector.UserSelectorPrototype('{1}', '{0}', '<{2}>', '{3}', {4}, {5}, '{6}');\n", _jsObjName, _selectorID, Resources.AdvancedUserSelectorResource.EmptyList, Resources.AdvancedUserSelectorResource.ClearFilter, IsMobileVersion.ToString().ToLower(), IsLinkView.ToString().ToLower(), IsMobileVersion ? _linkText.HtmlEncode().ReplaceSingleQuote() : ""); if (UserList != null && UserList.Count > 0) { if (DisabledUsers != null && DisabledUsers.Count > 0) { UserList.RemoveAll(ui => (DisabledUsers.Find(dui => dui.Equals(ui.ID)) != Guid.Empty)); } script.AppendFormat("\n{0}.UserIDs = [", _jsObjName); foreach (var u in UserList.SortByUserName()) { script.AppendFormat("'{0}',", u.ID); } if (UserList.Count > 0) { script.Remove(script.Length - 1, 1); } script.Append("];\n"); } if (DisabledUsers != null && DisabledUsers.Count > 0) { script.AppendFormat("\n{0}.DisabledUserIDs = [", _jsObjName); foreach (var u in DisabledUsers) { script.AppendFormat("'{0}',", u); } script.Remove(script.Length - 1, 1); script.Append("];\n"); } Page.ClientScript.RegisterClientScriptBlock(GetType(), Guid.NewGuid().ToString(), script.ToString(), true); script = new StringBuilder(); script.AppendFormat("{0}.AllDepartmentsGroupName = '{1}';\n", _jsObjName, Resources.AdvancedUserSelectorResource.AllDepartments.HtmlEncode().ReplaceSingleQuote()); if (!String.IsNullOrEmpty(AdditionalFunction)) { script.AppendFormat("{0}.AdditionalFunction = {1};", _jsObjName, AdditionalFunction); } if (!Guid.Empty.Equals(SelectedUserId)) { script.AppendFormat("{0}.SelectedUserId = '{1}';\n", _jsObjName, SelectedUserId); } else if (IsMobileVersion) { script.AppendFormat("{0}.SelectedUserId = {0}.Me().find('option:first').attr('selected', 'selected').val();", _jsObjName); } script.Append("jq(function(){jq(document).click(function(event){\n"); script.Append(_jsObjName + ".dropdownRegAutoHide(event);\n"); script.Append("}); });\n"); Page.ClientScript.RegisterStartupScript(GetType(), Guid.NewGuid().ToString(), script.ToString(), true); }
protected override void OnLoad(EventArgs e) { base.OnInit(e); _jsObjName = String.IsNullOrEmpty(ID) ? "advancedUserSelector" + UniqueID.Replace('$', '_') : ID; RegisterStartupScripts(Page, this); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); _jsObjName = String.IsNullOrEmpty(ID) ? "pageNavigator" + UniqueID.Replace('$', '_') : ID; if (HttpContext.Current != null && HttpContext.Current.Request != null && AutoDetectCurrentPage) { if (!String.IsNullOrEmpty(HttpContext.Current.Request[this.ParamName])) { try { CurrentPageNumber = Convert.ToInt32(HttpContext.Current.Request[this.ParamName]); } catch { CurrentPageNumber = 0; } } } if (CurrentPageNumber <= 0) { CurrentPageNumber = 1; } if (!Page.ClientScript.IsClientScriptIncludeRegistered(GetType(), "ASC_Controls_PageNavigator_Script")) { Page.ClientScript.RegisterClientScriptInclude("ASC_Controls_PageNavigator_Script", Page.ClientScript.GetWebResourceUrl(GetType(), "ASC.Web.Controls.PageNavigator.js.pagenavigator.js")); } var scriptNav = String.Format(@"var {1} = new ASC.Controls.PageNavigator.initPrototype('{0}', '{1}', {2}, {3}, {4},'{5}','{6}', '{7}','{8}','{9}','{10}');", _navigatorID, _jsObjName, EntryCountOnPage, VisiblePageCount, CurrentPageNumber, Resources.PageNavigator.PreviousPage, Resources.PageNavigator.NextPage, NavigationLinkCSSClass, CurrentPositionCSSClass, PrevButtonCSSClass, NextButtonCSSClass ); Page.ClientScript.RegisterStartupScript(typeof(string), "navigationControlMod", scriptNav, true); _page_amount = Convert.ToInt32(Math.Ceiling(EntryCount / (EntryCountOnPage * 1.0))); _start_page = CurrentPageNumber - 1 - VisiblePageCount / 2; if (_start_page + VisiblePageCount > _page_amount) { _start_page = _page_amount - VisiblePageCount; } if (_start_page < 0) { _start_page = 0; } _end_page = _start_page + VisiblePageCount; if (_end_page > _page_amount) { _end_page = _page_amount; } if ((_page_amount == 1 && VisibleOnePage) || _start_page >= _end_page || _end_page - _start_page <= 1) { return; } string spliter = "&"; if (PageUrl.IndexOf("?") == -1) { spliter = "&"; } string url = PageUrl; bool isFirst = (CurrentPageNumber == 1); bool isLast = (CurrentPageNumber == _page_amount); string prevURL = PageUrl + spliter + ParamName + "=" + (CurrentPageNumber - 1).ToString(); string nextURL = PageUrl + spliter + ParamName + "=" + (CurrentPageNumber + 1).ToString(); string script = @"document.onkeydown = function(e) { var code; if (!e) var e = window.event; if (e.keyCode) code = e.keyCode; else if (e.which) code = e.which;" + ((!isFirst) ? @"if ((code == 37) && (e.ctrlKey == true)) { window.open('" + prevURL + @"','_self'); }" : "") + ((!isLast) ? @"if ((code == 39) && (e.ctrlKey == true)) { window.open('" + nextURL + @"','_self'); }" : "") + @"}; "; Page.ClientScript.RegisterClientScriptBlock(typeof(string), "navigationControlScript", script, true); }