Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set where condition - show nothing when nodeId is zero
        UniGridAlias.WhereCondition = "AliasNodeID = " + NodeID;

        if (Node != null)
        {
            // Hide parts which are not relevant to content only nodes
            if (ShowContentOnlyProperties)
            {
                pnlUIPath.Visible          = false;
                pnlUIExtended.Visible      = false;
                pnlUIDocumentAlias.Visible = false;
                headAlias.Visible          = false;
            }

            if (Node.NodeAliasPath == "/")
            {
                valAlias.Visible = false;
            }

            // Check modify permissions
            if ((MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied))
            {
                pnlAlias.Enabled = false;
                menuElem.Enabled = false;
                UniGridAlias.GridView.Enabled = false;
                btnNewAlias.Enabled           = false;

                chkCustomExtensions.Enabled = false;
                ctrlURL.Enabled             = false;
            }
            else
            {
                ltlScript.Text = ScriptHelper.GetScript("var node = " + NodeID + "; \n var deleteMsg = '" + GetString("DocumentAlias.DeleteMsg") + "';");

                UniGridAlias.OnAction            += UniGridAlias_OnAction;
                UniGridAlias.OnExternalDataBound += UniGridAlias_OnExternalDataBound;
                btnNewAlias.OnClientClick         = "window.location.replace('" + UrlResolver.ResolveUrl("Alias_Edit.aspx?nodeid=" + NodeID) + "'); return false;";
            }

            chkCustomExtensions.Text = GetString("GeneralProperties.UseCustomExtensions");
            valAlias.ErrorMessage    = GetString("GeneralProperties.RequiresAlias");

            lblExtensions.Text = GetString("doc.urls.urlextensions") + ResHelper.Colon;

            txtAlias.MaxLength = TreePathUtils.MaxAliasLength;
            if (!mIsRoot)
            {
                txtAlias.Enabled = !TreePathUtils.AutomaticallyUpdateDocumentAlias(Node.NodeSiteName);
            }

            if (!RequestHelper.IsPostBack())
            {
                ReloadData();
            }

            // Get automatic URL path
            var culture = CultureHelper.GetShortCultureCode(Node.DocumentCulture);
            ctrlURL.AutomaticURLPath = TreePathUtils.GetUniqueUrlPath(Node, culture);

            // Reflect processing action
            pnlPageContent.Enabled = DocumentManager.AllowSave;
        }
    }