Inheritance: System.Web.UI.MasterPage
Exemplo n.º 1
0
        protected void rptNamespaces_ItemCommand(object sender, RepeaterCommandEventArgs e)
        {
            txtCurrentNamespace.Value = e.CommandArgument as string;

            NamespaceInfo nspace = txtCurrentNamespace.Value != RootName?
                                   Pages.FindNamespace(txtCurrentNamespace.Value) : null;

            if (e.CommandName == "Select")
            {
                // rptNamespaces.DataBind(); Not needed because the list is hidden on select

                string theme = Settings.GetTheme(nspace != null ? nspace.Name : null);

                txtName.Enabled = false;
                txtName.Text    = nspace != null ? nspace.Name : RootNameUnescaped;
                txtNewName.Text = "";
                cvName.Enabled  = false;
                cvName2.Enabled = false;
                LoadDefaultPages();
                lstTheme.SelectedIndex = -1;
                foreach (ListItem item in lstTheme.Items)
                {
                    if (item.Value == theme)
                    {
                        item.Selected = true;
                        break;
                    }
                }
                providerSelector.SelectedProvider = nspace != null?nspace.Provider.ToString() : Settings.DefaultPagesProvider;

                providerSelector.Enabled = false;

                btnCreate.Visible = false;
                btnSave.Visible   = true;
                btnDelete.Visible = true;
                // Cannot delete root namespace
                btnDelete.Enabled = nspace != null;
                // Cannot rename root namespace
                btnRename.Enabled = nspace != null;

                pnlList.Visible          = false;
                pnlEditNamespace.Visible = true;

                lblResult.Text     = "";
                lblResult.CssClass = "";
            }
            else if (e.CommandName == "Perms")
            {
                if (!AdminMaster.CanManagePermissions(SessionFacade.GetCurrentUsername(), SessionFacade.GetCurrentGroupNames()))
                {
                    return;
                }

                permissionsManager.CurrentResourceName = nspace != null ? nspace.Name : null;

                lblNamespaceName.Text = nspace != null ? nspace.Name : RootName;

                pnlList.Visible        = false;
                pnlPermissions.Visible = true;

                lblResult.Text     = "";
                lblResult.CssClass = "";
            }
        }