protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context) { return(new List <KeyValuePair <string, object> >(1) { RegisterObject(new { emptyScreenPeopleFilter = WebImageSupplier.GetAbsoluteWebPath("empty_screen_filter.png"), userDisplayFormat = (int)UserFormatter.GetUserDisplayDefaultOrder() }) }); }
protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context) { return(new List <KeyValuePair <string, object> >(1) { RegisterObject(new { file_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_21.png"), file_archive_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_archive_21.png"), file_avi_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_avi_21.png"), file_cal_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_cal_21.png"), file_csv_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_csv_21.png"), file_djvu_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_djvu_21.png"), file_doc_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_doc_21.png"), file_doct_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_doct_21.png"), file_docx_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_docx_21.png"), file_dvd_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_dvd_21.png"), file_ebook_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_ebook_21.png"), file_flv_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_flv_21.png"), file_gdoc_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_gdoc_21.png"), file_gsheet_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_gsheet_21.png"), file_gslides_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_gslides_21.png"), file_html_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_html_21.png"), file_iaf_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_iaf_21.png"), file_image_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_image_21.png"), file_m2ts_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_m2ts_21.png"), file_mkv_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_mkv_21.png"), file_mov_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_mov_21.png"), file_mp4_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_mp4_21.png"), file_mpg_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_mpg_21.png"), file_odp_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_odp_21.png"), file_ods_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_ods_21.png"), file_odt_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_odt_21.png"), file_pdf_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_pdf_21.png"), file_pps_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_pps_21.png"), file_ppsx_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_ppsx_21.png"), file_ppt_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_ppt_21.png"), file_pptt_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_pptt_21.png"), file_pptx_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_pptx_21.png"), file_rtf_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_rtf_21.png"), file_sound_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_sound_21.png"), file_svg_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_svg_21.png"), file_txt_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_txt_21.png"), file_xls_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_xls_21.png"), file_xlst_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_xlst_21.png"), file_xlsx_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_xlsx_21.png"), file_xml_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_xml_21.png"), file_xps_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_xps_21.png"), file_docm_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_docm_21.png"), file_dot_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_dot_21.png"), file_dotm_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_dotm_21.png"), file_dotx_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_dotx_21.png"), file_pot_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_pot_21.png"), file_potm_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_potm_21.png"), file_potx_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_potx_21.png"), file_ppsm_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_ppsm_21.png"), file_pptm_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_pptm_21.png"), file_soundunk_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_soundunk_21.png"), file_video_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_video_21.png"), file_videounk_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_videounk_21.png"), file_xlsm_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_xlsm_21.png"), file_xlt_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_xlt_21.png"), file_xltm_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_xltm_21.png"), file_xltx_21 = CommonLinkUtility.GetFullAbsolutePath("~/UserControls/Common/ckeditor/plugins/filetype/images/file_xltx_21.png"), IsTurnOnAttachmentsGroupOperations = Defines.IsAttachmentsGroupOperationsAvailable, IsTurnOnOAuth = GoogleLoginProvider.Instance.IsEnabled && Convert.ToBoolean(ConfigurationManagerExtension.AppSettings["mail.google-oauth"] ?? "true"), OAuthLocation = VirtualPathUtility.ToAbsolute(OAuth.Location), userDisplayFormat = (int)UserFormatter.GetUserDisplayDefaultOrder() }) }); }
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); }