示例#1
0
 /// <summary>
 /// Page_PreRender event handler.
 /// </summary>
 protected void Page_PreRender(object sender, EventArgs e)
 {
     // Initialize JavaScript module
     ScriptHelper.RegisterModule(this, "AdminControls/DocumentsGrid", new
     {
         GridSelector         = "#" + gridElem.ClientID,
         PagesApplicationHash = UIContextHelper.GetApplicationHash("cms.content", "content"),
         OpenInNewWindow      = (ListingType == ListingTypeEnum.PageTemplateDocuments) && IsCMSDesk
     });
 }
示例#2
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        ScriptHelper.RegisterModule(this, "CMS.EventManager/EventsGrid", new
        {
            GridSelector         = "#" + gridElem.ClientID,
            PagesApplicationHash = UIContextHelper.GetApplicationHash("cms.content", "content"),
            EventDetailURL       = UIContextHelper.GetElementUrl("CMS.EventManager", "DetailsEvent")
        });
    }
示例#3
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        if (StopProcessing)
        {
            return;
        }

        // Hide document link column when placed on LiveSite
        if (IsLiveSite)
        {
            gridBoards.GridView.Columns[7].Visible = false;
        }

        // Display info message
        if (GroupID != 0)
        {
            if (!URLHelper.IsPostback() && gridBoards.IsEmpty)
            {
                ShowInformation(GetString("messageboards.board_list.groupinfo"));
                txtBoardName.Enabled = false;
                btnFilter.Enabled    = false;
            }
        }
        else
        {
            ShowInformation(GetString("messageboards.board_list.info"));
        }

        ScriptHelper.RegisterModule(this, "CMS.MessageBoards/MessageBoardsGrid", new
        {
            GridSelector         = "#" + gridBoards.ClientID,
            PagesApplicationHash = UIContextHelper.GetApplicationHash("cms.content", "content"),
        });
    }
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        // Register listing scripts
        ScriptHelper.RegisterStartupScript(this, typeof(String), "ListingContentAppHash", "cmsListingContentApp = '" + UIContextHelper.GetApplicationHash("cms.content", "content") + "';", true);
        ScriptHelper.RegisterScriptFile(this, @"~/CMSModules/Content/CMSDesk/View/Listing.js");

        // Register tooltip scripts
        RegisterTooltipScript();

        if (DocumentListingDisplayed)
        {
            // No data message for document mode
            docList.Grid.ZeroRowsText = GetString("general.nodatafound");

            // Do not hide product filter
            docList.Grid.FilterLimit = 0;

            if (ShowSections)
            {
                CreateCloseListingLink();
            }
        }
        else
        {
            // No data message for SKU mode
            gridData.ZeroRowsText   = GetString("general.nodatafound");
            gridData.WhereCondition = GetWhereCondition().ToString(true);
        }

        InitializeMasterPage();
    }
    /// <summary>
    /// OnButtonCreated event handler.
    /// </summary>
    protected void ucUIToolbar_OnButtonCreated(object sender, UniMenuArgs e)
    {
        if ((e.UIElement == null) || (e.ButtonControl == null))
        {
            return;
        }

        switch (e.UIElement.ElementName.ToLowerCSafe())
        {
        case "onsitedelete":
            if (isRootDocument)
            {
                DisableButton(e, GetString("onsitedit.deleteroot"));
            }
            break;

        case "onsitesave":
            if (e.ButtonControl != null)
            {
                string saveEnabledTooltip  = GetString("onsiteedit.saveenabledtooltip");
                string saveDisabledTooltip = GetString("onsiteedit.savedisabledtooltip");

                e.ButtonControl.CssClass = "BigButtonDisabled OESaveButton";
                e.ButtonControl.Attributes.Add("data-enabledTooltip", saveEnabledTooltip);
                e.ButtonControl.Attributes.Add("data-disabledTooltip", saveDisabledTooltip);
                e.ButtonControl.ToolTip = saveDisabledTooltip;
            }
            break;

        case "onsiteclose":
        case "onsitesignout":
        {
            string script = string.Empty;

            // Show javascript confirmation when the document is not found or published
            if (IsPageNotFound ||
                ((CurrentPageInfo != null) && !CurrentPageInfo.IsPublished && URLRewriter.PageNotFoundForNonPublished(SiteContext.CurrentSiteName)))
            {
                script = "if (!confirm(" + ScriptHelper.GetLocalizedString("onsiteedit.signout404confirmation") + ")) { return false; } ";
                is404  = true;
            }

            // Sign out postback script
            string eventCode = (e.UIElement.ElementName.ToLowerCSafe() == "onsitesignout") ? "signout" : "changeviewmode";
            script += ControlsHelper.GetPostBackEventReference(this, eventCode);
            script  = checkChanges + script;

            e.ButtonControl.Attributes.Add("onclick", script);
        }
        break;

        case "onsitecmsdesk":
        {
            string buttonScript = String.Format("self.location.href = '{0}?nodeid={1}&returnviewmode=editlive{2}';", ResolveUrl(UIHelper.GetAdministrationUrl()), NodeId, UIContextHelper.GetApplicationHash("cms.content", "content"));
            buttonScript = checkChanges + buttonScript;
            e.ButtonControl.Attributes.Add("onclick", buttonScript);
        }
        break;
        }
    }
示例#6
0
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        var currentUserInfo = MembershipContext.AuthenticatedUser;

        if (!RequiresDialog)
        {
            ScriptHelper.RegisterStartupScript(this, typeof(String), "ListingContentAppHash", "cmsListingContentApp = '" + UIContextHelper.GetApplicationHash("cms.content", "content") + "';", true);
            ScriptHelper.RegisterScriptFile(this, CONTENT_CMSDESK_FOLDER + "View/Listing.js");
        }

        // Set selected document type
        docList.ClassID = ValidationHelper.GetInteger(SelectClass.Value, UniSelector.US_ALL_RECORDS);

        if (docList.NodeID > 0)
        {
            TreeNode node = docList.Node;
            // Set edited document
            EditedDocument = node;

            if (node != null)
            {
                if (currentUserInfo.IsAuthorizedPerDocument(node, NodePermissionsEnum.ExploreTree) != AuthorizationResultEnum.Allowed)
                {
                    RedirectToAccessDenied("CMS.Content", "exploretree");
                }

                if (RequiresDialog)
                {
                    ScriptHelper.RegisterScriptFile(this, CONTENT_CMSDESK_FOLDER + "View/ListingDialog.js");

                    // Set JavaScript for new button
                    CurrentMaster.HeaderActions.AddAction(new HeaderAction
                    {
                        Text          = GetString("content.newtitle"),
                        OnClientClick = "AddItem(" + node.NodeID + ");"
                    });

                    // Ensure breadcrumbs
                    EnsureBreadcrumbs(node);
                }
                else
                {
                    // Ensure breadcrumbs for UI
                    EnsureDocumentBreadcrumbs(PageBreadcrumbs, node);

                    // Setup the link to the parent document
                    if (!node.IsRoot() && (currentUserInfo.UserStartingAliasPath.ToLowerCSafe() != node.NodeAliasPath.ToLowerCSafe()))
                    {
                        CurrentMaster.HeaderActions.AddAction(new HeaderAction
                        {
                            Text          = GetString("Listing.ParentDirectory"),
                            OnClientClick = "SelectItem(" + node.NodeParentID + ");"
                        });
                    }
                }

                // Define target window for modal dialogs (used for mobile Android browser which cannot open more than one modal dialog window at a time).
                // If set: The target window will be used for opening the new dialog in the following way: targetWindow.location.href = '...new dialog url...';
                // If not set: New modal dialog window will be opened
                string actionTargetWindow = "var targetWindow = " + (DeviceContext.CurrentDevice.IsMobile ? "this" : "null");
                ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "listingScript", actionTargetWindow, true);
            }
        }
    }
示例#7
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (!StopProcessing)
        {
            bool     show   = true;
            TreeNode curDoc = DocumentContext.CurrentDocument;

            // Check if permissions should be checked
            if (ShowOnlyWhenAuthorized)
            {
                // Check permissions
                if (!((MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Editor, SiteContext.CurrentSiteName)) && CMSPage.IsUserAuthorizedPerContent() && (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(curDoc, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Allowed)))
                {
                    show    = false;
                    Visible = false;
                }
            }

            if (show)
            {
                // Create edit link
                StringBuilder sb = new StringBuilder("<a class=\"EditDocumentLink\" href=\"");
                // On-Site edit
                if (PreferOnSiteEdit && PortalHelper.IsOnSiteEditingEnabled(CurrentSiteName))
                {
                    string onsiteEditUrl = URLHelper.ResolveUrl(PortalHelper.OnSiteEditRelativeURL);

                    string retUrl = RequestContext.CurrentURL;
                    // handle default alias path
                    if ((ViewMode == CMS.PortalEngine.ViewModeEnum.LiveSite) && (URLRewritingContext.CurrentPageInfoSource == PageInfoSource.DefaultAliasPath))
                    {
                        string aliasPath = PageInfoProvider.GetDefaultAliasPath(RequestContext.CurrentDomain, SiteContext.CurrentSiteName);
                        if (!String.IsNullOrEmpty(aliasPath))
                        {
                            string query = URLHelper.GetQuery(retUrl);
                            retUrl = URLHelper.ResolveUrl(DocumentURLProvider.GetUrl(aliasPath));
                            retUrl = URLHelper.AppendQuery(retUrl, query);
                        }
                    }

                    onsiteEditUrl = URLHelper.UpdateParameterInUrl(onsiteEditUrl, "returnurl", HTMLHelper.HTMLEncode(HttpUtility.UrlEncode(retUrl)));
                    sb.Append(onsiteEditUrl);
                }
                // CMSDesk edit
                else
                {
                    sb.Append("~/Admin/cmsadministration.aspx?action=edit&amp;nodeid=");
                    sb.Append(curDoc.NodeID);
                    sb.Append("&amp;culture=");
                    sb.Append(curDoc.DocumentCulture);
                    sb.Append(UIContextHelper.GetApplicationHash("cms.content", "content"));
                }
                sb.Append("\">");
                // Text link
                if (String.IsNullOrEmpty(ImageURL))
                {
                    sb.Append(LinkText);
                }
                // Image link
                else
                {
                    sb.Append("<img src=\"");
                    sb.Append(URLHelper.ResolveUrl(ImageURL));
                    sb.Append("\" alt=\"");
                    sb.Append(HTMLHelper.HTMLEncode(LinkText));
                    sb.Append("\" title=\"");
                    sb.Append(HTMLHelper.HTMLEncode(LinkText));
                    sb.Append("\" />");
                }
                sb.Append("</a>");
                ltlEditLink.Text = sb.ToString();
            }
        }
    }