Exemple #1
0
    protected object UniGridAlias_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerCSafe())
        {
        case "culture":
            return(UniGridFunctions.CultureDisplayName(parameter));

        case "urlpath":
        {
            // Parse the URL path
            string urlPath = ValidationHelper.GetString(parameter, "");

            return(TreePathUtils.GetUrlPathDisplayName(urlPath));
        }
        }

        return(parameter);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterDialogScript(Page);

        btnOk.OnClientClick = DocumentManager.GetAllowSubmitScript();

        EditedObject = DocumentAlias;

        if (IsDialog)
        {
            PageTitle.TitleText = GetString("content.ui.urlsaliases");
        }
        else
        {
            HeaderActions.AddAction(new HeaderAction
            {
                Text        = GetString("doc.urls.addnewalias"),
                RedirectUrl = ResolveUrl("Alias_Edit.aspx?nodeid=" + NodeID),
                ButtonStyle = ButtonStyle.Default
            });

            HeaderActions.AddAction(new HeaderAction
            {
                Text          = GetString("doc.urls.viewallalias"),
                OnClientClick = "modalDialog('" + ResolveUrl(PROPERTIES_FOLDER + "Alias_AliasList.aspx") + "?nodeid=" + NodeID + "&dialog=1" + "','AliasManagement','90%','85%');",
                ButtonStyle   = ButtonStyle.Default
            });
        }

        if (Node != null)
        {
            lblUrlInfoText.Text = Node.NodeAliasPath;

            // Check modify permissions
            if (!DocumentUIHelper.CheckDocumentPermissions(Node, PermissionsEnum.Modify))
            {
                ShowInformation(String.Format(GetString("cmsdesk.notauthorizedtoeditdocument"), Node.NodeAliasPath));

                txtURLExtensions.Enabled = false;

                ctrlURL.Enabled = false;

                cultureSelector.Enabled = false;
            }

            if (!RequestHelper.IsPostBack() && QueryHelper.GetInteger("saved", 0) == 1)
            {
                ShowChangesSaved();
            }

            lblDocumentCulture.Text = GetString("general.culture") + ResHelper.Colon;
            lblURLExtensions.Text   = GetString("doc.urls.urlextensions") + ResHelper.Colon;

            // Show path of document alias only if dialog mode edit
            pnlUrlInfo.Visible = IsDialog;

            // For dialog mode use DefaultNodeID
            defaultNodeID = (IsDialog) ? QueryHelper.GetInteger("defaultNodeID", 0) : NodeID;

            CreateBreadcrumbs();

            cultureSelector.AllowDefault = false;
            cultureSelector.UniSelector.SpecialFields.Add(new SpecialField
            {
                Text  = GetString("general.selectall"),
                Value = String.Empty
            });


            if (!RequestHelper.IsPostBack())
            {
                cultureSelector.Value = Node.DocumentCulture;

                // Edit existing alias
                if (DocumentAlias != null && DocumentAlias.AliasID > 0)
                {
                    txtURLExtensions.Text = DocumentAlias.AliasExtensions;
                    ctrlURL.URLPath       = DocumentAlias.AliasURLPath;

                    cultureSelector.Value         = DocumentAlias.AliasCulture;
                    PageBreadcrumbs.Items[1].Text = TreePathUtils.GetUrlPathDisplayName(DocumentAlias.AliasURLPath);

                    drpAction.SelectedValue = DocumentAlias.AliasActionMode.ToStringRepresentation();
                }
            }

            // Register js synchronization script for split mode
            if (QueryHelper.GetBoolean("refresh", false) && PortalUIHelper.DisplaySplitMode)
            {
                RegisterSplitModeSync(true, false, true);
            }
        }
    }