Exemplo n.º 1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
		protected void Page_Load(object sender, EventArgs e)
		{
            AdminView view = ManagementContext.Current.FindView(this.AppId, this.ViewId);

            // Check view permissions
            if (view.Attributes.Contains("permissions"))
            {
                if (!ProfileContext.Current.CheckPermission(view.Attributes["permissions"].ToString()))
                    throw new UnauthorizedAccessException("Current user does not have enough rights to access the requested operation.");
            }

			Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "InitializeEcfListViewConstants",
				String.Format("CSManagementClient.EcfListView_PrimaryKeySeparator = '{0}';", EcfListView.ExtenderPrimaryKeyAttributeSeparator), true);

			HtmlTable tbl = this.FindControl("topTable") as HtmlTable;
			if (tbl != null)
			{
				if (this.ShowTopToolbar)
				{
					tbl.Visible = true;

					// bind MetaToolbar
					MetaToolbar1.ViewName = this.AppId;
					MetaToolbar1.PlaceName = this.ViewId;
					MetaToolbar1.GridClientId = GetListViewClientID();
					MetaToolbar1.DataBind();
				}
				else
				{
					DockTop.DefaultSize = 0;
					DockTop.Visible = false;
					tbl.Visible = false;
				}
				//tbl.Style["display"] = "none";
			}

			if (InnerListViewTable != null)
                gvHeaderExtender.TargetControlID = InnerListViewTable.UniqueID;

			gvHeaderExtender.ContextKey = UtilHelper.JsonSerialize(new EcfListViewContextKey(this.AppId, this.ViewId));
			gvHeaderExtender.ServicePath = ResolveUrl("~/Apps/Core/Controls/WebServices/EcfListViewExtenderService.asmx");

			DropDownList pagingList = MainListView.FindControl(EcfListView.DefaultPagingDropdownId) as DropDownList;
			if (pagingList != null)
				pagingList.SelectedIndexChanged += new EventHandler(ddPaging_SelectedIndexChanged);

			if (!IsPostBack && CurrentPager != null)
			{
				CurrentPager.SetPageProperties(0, CurrentListView.CurrentPageSize, true);
			}
		}
Exemplo n.º 2
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadContext();

            // bind top toolbar
            MetaToolbar1.ViewName  = this.AppId;
            MetaToolbar1.PlaceName = this.ViewId;
            MetaToolbar1.DataBind();

            if (!this.IsPostBack)
            {
                DataBind();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, System.EventArgs e)
        {
            //if permissions are turned off, always provide permission
            bool permissionsEnabled = ProfileConfiguration.Instance.EnablePermissions;

            //If user is an admin, always provide permission
            bool isAdmin = SecurityManager.CheckPermission(new string[] { AppRoles.AdminRole }, false);

            //determine which section the control is being used for and then determine if permissions are present
            if (String.Compare(AppId, _CatalogSystemName, StringComparison.OrdinalIgnoreCase) == 0 && String.Compare(ViewId, _CurrentViewName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (permissionsEnabled && !isAdmin && !ProfileContext.Current.CheckPermission("catalog:admin:meta:cls:mng:delete"))
                {
                    EditSaveControl.PermissionOverrideHideDeleteButton();
                }
            }
            else if (String.Compare(AppId, _ProfileSystemName, StringComparison.OrdinalIgnoreCase) == 0 && String.Compare(ViewId, _CurrentViewName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (permissionsEnabled && !isAdmin && !ProfileContext.Current.CheckPermission("profile:admin:meta:cls:mng:delete"))
                {
                    EditSaveControl.PermissionOverrideHideDeleteButton();
                }
            }
            else if (String.Compare(AppId, _OrderSystemName, StringComparison.OrdinalIgnoreCase) == 0 && String.Compare(ViewId, _CurrentViewName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (permissionsEnabled && !isAdmin && !ProfileContext.Current.CheckPermission("order:admin:meta:cls:mng:delete"))
                {
                    EditSaveControl.PermissionOverrideHideDeleteButton();
                }
            }

            ApplyLocalization();

            // bind top toolbar
            MetaToolbar1.ViewName  = this.AppId;
            MetaToolbar1.PlaceName = this.ViewId;
            MetaToolbar1.DataBind();

            tblMetaClass.Visible = false;
            if (!IsPostBack || String.Compare(Request.Form["__EVENTTARGET"], CommandManager.GetCurrent(this.Page).ID, false) == 0)
            {
                BindElement();
            }
        }