protected void Page_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(ProductItem.ItemName)) return;

            var userSelector = new AdvancedUserSelector
                                   {
                                       ID = "userSelector_" + ProductItem.ItemName,
                                       LinkText = CustomNamingPeople.Substitute<Resources.Resource>("AccessRightsAddUser"),
                                       IsLinkView = true,
                                       DisabledUsers = new List<Guid> { PortalOwnerId }
                                   };
            phUserSelector.Controls.Add(userSelector);

            var groupSelector = (GroupSelector)LoadControl(GroupSelector.Location);
            groupSelector.JsId = "groupSelector_" + ProductItem.ItemName;
            groupSelector.LinkText = CustomNamingPeople.Substitute<Resources.Resource>("AccessRightsAddGroup");
            groupSelector.WithGroupEveryone = true;
            phGroupSelector.Controls.Add(groupSelector);

            var ids = ProductItem.SelectedUsers.Select(i => i.ID).ToArray();
            var names = ProductItem.SelectedUsers.Select(i => i.DisplayUserName()).ToArray();
            var key = Guid.NewGuid().ToString();

            Page.ClientScript.RegisterClientScriptBlock(typeof(AccessRightsProductItem), key, "SelectedUsers_" + ProductItem.ItemName + " = " +
                                                                          JavaScriptSerializer.Serialize(
                                                                              new
                                                                              {
                                                                                  IDs = ids,
                                                                                  Names = names,
                                                                                  PeopleImgSrc = PeopleImgSrc,
                                                                                  TrashImgSrc = TrashImgSrc,
                                                                                  TrashImgTitle = Resources.Resource.DeleteButton,
                                                                                  CurrentUserID = SecurityContext.CurrentAccount.ID
                                                                              }) + "; ", true);

            ids = ProductItem.SelectedGroups.Select(i => i.ID).ToArray();
            names = ProductItem.SelectedGroups.Select(i => i.Name).ToArray();
            key = Guid.NewGuid().ToString();

            Page.ClientScript.RegisterClientScriptBlock(typeof(AccessRightsProductItem), key, "SelectedGroups_" + ProductItem.ItemName + " = " +
                                                                          JavaScriptSerializer.Serialize(
                                                                              new
                                                                              {
                                                                                  IDs = ids,
                                                                                  Names = names,
                                                                                  GroupImgSrc = GroupImgSrc,
                                                                                  TrashImgSrc = TrashImgSrc,
                                                                                  TrashImgTitle = Resources.Resource.DeleteButton
                                                                              }) + "; ", true);

            _managePanel.Options.IsPopup = true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //init advUserSelector
            var userSelector = new AdvancedUserSelector
              {
                  ID = "advUserSelectorListView"+ObjId,
                  IsLinkView = true,
                  LinkText = CustomNamingPeople.Substitute<CRMCommonResource>("AddUser"),
                  AdditionalFunction = "ASC.CRM.UserSelectorListView" + ObjId + ".pushUserIntoList"
              };

            if (UserList != null && UserList.Count > 0)
                userSelector.UserList = UserList;

            if (DisabledUsers != null && DisabledUsers.Count > 0)
                userSelector.DisabledUsers = DisabledUsers;

            _phAdvUserSelector.Controls.Add(userSelector);

            var ids = SelectedUsers != null && SelectedUsers.Count > 0 ? SelectedUsers.Select(i => i.Key).ToArray() : new List<Guid>().ToArray();
            var names = SelectedUsers != null && SelectedUsers.Count > 0 ? SelectedUsers.Select(i => i.Value).ToArray() : new List<string>().ToArray();

            var key = Guid.NewGuid().ToString();

            Page.ClientScript.RegisterClientScriptBlock(typeof(PrivatePanel), key, "SelectedUsers" + ObjId + " = " +
                                                                          JavaScriptSerializer.Serialize(
                                                                              new
                                                                              {
                                                                                  IDs = ids,
                                                                                  Names = names,
                                                                                  PeopleImgSrc = PeopleImgSrc,
                                                                                  DeleteImgSrc = DeleteImgSrc,
                                                                                  DeleteImgTitle = CRMCommonResource.DeleteUser,
                                                                                  CurrentUserID = SecurityContext.CurrentAccount.ID
                                                                              }) + "; ", true);
        }
Пример #3
0
 private void LoadProjectManagerSelector()
 {
     var projectManagerSelector = new AdvancedUserSelector
     {
         ID = "projectManagerSelector"
     };
     if (Project != null)
     {
         projectManagerSelector.SelectedUserId = Project.Responsible;
     }
     projectManagerPlaceHolder.Controls.Add(projectManagerSelector);
 }
Пример #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnInit(e);

            var js = new StringBuilder();
            js.Append("<script id=\"template-filter-combobox-options\" type=\"text/x-jquery-tmpl\">");
            js.Append("  <option class=\"${classname}\" value=\"${value}\"{{if typeof def === 'boolean' && def === true}} selected=\"selected\"{{/if}}>${title}</option>");
            js.Append("</script>");

            js.Append("<script id=\"template-filter-filtervalues\" type=\"text/x-jquery-tmpl\">");
            js.Append("  <div class=\"advansed-item-list advansed-filter-list\">");
            js.Append("    <ul class=\"item-list filter-list\"></ul>");
            js.Append("  </div>");
            js.Append("</script>");

            js.Append("<script id=\"template-filter-sortervalues\" type=\"text/x-jquery-tmpl\">");
            js.Append("  <div class=\"advansed-item-list advansed-sorter-list\">");
            js.Append("    <ul class=\"item-list sorter-list\"></ul>");
            js.Append("  </div>");
            js.Append("</script>");

            js.Append("<script id=\"template-filter-container\" type=\"text/x-jquery-tmpl\">");
            js.Append("  <div class=\"advansed-filter empty-filter-list\"><div class=\"advansed-filter-wrapper\">");
            js.Append("    <label class=\"advansed-filter-state btn-start-filter\"></label>");
            js.Append("    <label class=\"advansed-filter-sort btn-show-sorters\"></label>");
            js.Append("    <div class=\"advansed-filter-container\">");
            js.Append("      <div class=\"advansed-filter-filters empty-list\">");
            js.Append("        <div class=\"btn-show-hidden-filters\">" + Resources.UserControlsCommonResource.BtnHiddenFilter + "</div>");
            js.Append("        <div class=\"hidden-filters-container\">");
            js.Append("          <div class=\"control-top hidden-filters-container-top\"></div>");
            js.Append("        </div>");
            js.Append("      </div>");
            js.Append("      <div class=\"advansed-filter-button btn-show-filters\"><div class=\"inner-text\"><span class=\"text\">" + Resources.UserControlsCommonResource.LblFilterButton + "</span></span></div></div>");
            js.Append("      <div class=\"advansed-filter-input\">");
            js.Append("        <label class=\"advansed-filter-reset btn-reset-filter\"></label>");
            js.Append("        <input class=\"advansed-filter advansed-filter-input advansed-filter-complete\" type=\"text\" placeholder=\"" + Resources.UserControlsCommonResource.LblFilterPlaceholder + "\" />");
            js.Append("      </div>");
            js.Append("    </div>");
            js.Append("    {{if filtervalues.length > 0}}");
            js.Append("      {{tmpl '#template-filter-filtervalues'}}");
            js.Append("    {{/if}}");
            js.Append("    {{if sortervalues.length > 0}}");
            js.Append("      {{tmpl '#template-filter-sortervalues'}}");
            js.Append("    {{/if}}");
            js.Append("  </div><div class=\"advansed-filter-helper\"></div></div>");
            js.Append("</script>");

            js.Append("<script id=\"template-filter-item\" type=\"text/x-jquery-tmpl\">");
            js.Append("  <div class=\"default-value\">");
            js.Append("    <span class=\"title\">{{if filtertitle}}${filtertitle}{{else}}${title}{{/if}}</span>");
            js.Append("      <span class=\"selector-wrapper\">");
            js.Append("        <span class=\"daterange-selector from-daterange-selector\">");
            js.Append("          <span class=\"label\">" + Resources.UserControlsCommonResource.LblFrom + "</span>");
            js.Append("          <span class=\"advansed-filter-dateselector-date dateselector-from-date\">");
            js.Append("            <span class=\"btn-show-datepicker btn-show-datepicker-container\"><span class=\"btn-show-datepicker btn-show-datepicker-title\"></span></span>");
            js.Append("            <span class=\"advansed-filter-datepicker-container asc-datepicker\">");
            js.Append("              <span class=\"control-top dateselector-top\"></span>");
            js.Append("              <span class=\"datepicker-container\"></span>");
            js.Append("            </span>");
            js.Append("          </span>");
            js.Append("        </span>");
            js.Append("        <span class=\"daterange-selector to-daterange-selector\">");
            js.Append("          <span class=\"label\">" + Resources.UserControlsCommonResource.LblTo + "</span>");
            js.Append("          <span class=\"advansed-filter-dateselector-date dateselector-to-date\">");
            js.Append("            <span class=\"btn-show-datepicker btn-show-datepicker-container\"><span class=\"btn-show-datepicker btn-show-datepicker-title\"></span></span>");
            js.Append("            <span class=\"advansed-filter-datepicker-container asc-datepicker\">");
            js.Append("              <span class=\"control-top dateselector-top\"></span>");
            js.Append("              <span class=\"datepicker-container\"></span>");
            js.Append("            </span>");
            js.Append("          </span>");
            js.Append("        </span>");
            js.Append("        {{if options}}");
            js.Append("          <span class=\"combobox-selector\">");
            js.Append("            <select class=\"advansed-filter-combobox\"{{if $data.multiple === true}} multiple=\"multiple\"{{/if}}>");
            js.Append("              {{tmpl(options) '#template-filter-combobox-options'}}");
            js.Append("            </select>");
            js.Append("          </span>");
            js.Append("        {{/if}}");
            js.Append("        <span class=\"group-selector\">");
            //js.Append("          <span class=\"custom-value\"><span class=\"value\"></span>&nbsp;<small>▼</small></span>");
            js.Append("          <span class=\"custom-value\"><span class=\"inner-text\"><span class=\"value\"></span></span></span>");
            //js.Append("          <span class=\"default-value\"><span class=\"value\">" + Resources.UserControlsCommonResource.LblSelect + "</span>&nbsp;<small>▼</small></span>");
            js.Append("          <span class=\"default-value\"><span class=\"inner-text\"><span class=\"value\">" + Resources.UserControlsCommonResource.LblSelect + "</span></span></span>");
            js.Append("        </span>");
            js.Append("        <span class=\"person-selector\">");
            //js.Append("          <span class=\"custom-value\"><span class=\"value\"></span>&nbsp;<small>▼</small></span>");
            js.Append("          <span class=\"custom-value\"><span class=\"inner-text\"><span class=\"value\"></span></span></span>");
            //js.Append("          <span class=\"default-value\"><span class=\"value\">" + Resources.UserControlsCommonResource.LblSelect + "</span>&nbsp;<small>▼</small></span>");
            js.Append("          <span class=\"default-value\"><span class=\"inner-text\"><span class=\"value\">" + Resources.UserControlsCommonResource.LblSelect + "</span></span></span>");
            js.Append("        </span>");
            js.Append("      </span>");
            js.Append("      <span class=\"btn-delete\"></span>");
            js.Append("  </div>");
            js.Append("</script>");

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "jquery-advansedfilter", "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + WebSkin.GetUserSkin().GetAbsoluteWebPath("/skins/<theme_folder>/jquery-advansedfilter.css") + "\" />", false);
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "advansedfilter-templates", js.ToString(), false);
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "jquery-customcombobox", WebPath.GetPath("js/jquery-customcombobox.js"));
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "jquery-advansedfilter", WebPath.GetPath("js/jquery-advansedfilter.js"));

            var groupSelector = Page.LoadControl(GroupSelector.Location) as GroupSelector;
            //groupSelector.ID = "groupSelector";
            groupSelector.JsId = "groupSelector";
            //groupSelector.ClickButtonId = "someGrouSelectorButton11";
            Controls.Add(groupSelector);

            var userSelector = new AdvancedUserSelector {ID = "userSelector"};
            userSelector.IsLinkView = true;
            this.Controls.Add(userSelector);
        }
 private void LoadProjectManagerSelector()
 {
     var projectManagerSelector = new AdvancedUserSelector{ID = "projectManagerSelector"};
     projectManagerPlaceHolder.Controls.Add(projectManagerSelector);
 }