コード例 #1
0
    /// <summary>
    /// Sets the navigation links images.
    /// </summary>
    protected void siteLinks_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        INavigateUIData dataItem = e.Item.DataItem as INavigateUIData;

        if (dataItem != null && !string.IsNullOrEmpty(dataItem.Description))
        {
            string descr = dataItem.Description;
            Image  image = (Image)e.Item.FindControl("linkIm");
            image.ImageUrl = this.ResolveUrl/**/ (descr.Split('|')[0]);
        }
    }
コード例 #2
0
    /// <summary>
    /// The tree node bound event handler.
    /// </summary>
    private void tree_NodeDataBound(object sender, PXTreeNodeEventArgs e)
    {
        INavigateUIData dataItem = e.Node.DataItem as INavigateUIData;

        // sets the node images
        PX.Data.PXSiteMapNode node = e.Node.DataItem as PX.Data.PXSiteMapNode;

        string descr = dataItem.Description;

        if (!string.IsNullOrEmpty(descr))
        {
            string[] im = descr.Split('|');
            e.Node.Images.Normal = this.ResolveUrl/**/ (im[0]);
            if (im.Length > 1)
            {
                e.Node.Images.Selected = this.ResolveUrl/**/ (im[1]);
            }
        }
コード例 #3
0
    /// <summary>
    /// Create the tree view control inside each band.
    /// </summary>
    protected void navPanel_BarItemDataBound(object sender, PXBarItemDataBoundEventArgs e)
    {
        if (bindComplete)
        {
            return;
        }

        INavigateUIData dataItem = e.BarItem.DataItem as INavigateUIData;

        PX.Data.PXSiteMapNode swNode = dataItem as PX.Data.PXSiteMapNode;
        int    index = navPanel.Bars.IndexOf(e.BarItem);
        string req   = this.Request.Params["__CALLBACKID"];
        string trId  = swNode.ScreenID == "FV000000" ? "favorites" : "tree" + swNode.Key.Replace('-', '_');
        string descr = dataItem.Description;

        if (this.IsCallback &&
            !req.Contains("sp" + index) &&
            !req.Contains(trId))
        {
            return;
        }

        if (!string.IsNullOrEmpty(descr))
        {
            string[] im = descr.Split('|');
            e.BarItem.ImageUrl = PXImages.ResolveImageUrl(im[0], this);
            if (im.Length > 1)
            {
                if (im[1].Contains(".") || im[1].Contains("@"))
                {
                    e.BarItem.SmallImageUrl = PXImages.ResolveImageUrl(im[1], this);
                }
                else
                {
                    e.BarItem.SmallText = im[1];
                }
            }
        }
        e.BarItem.Tooltip    = dataItem.Name;
        e.BarItem.ContentUrl = this.ResolveUrl/**/ (dataItem.NavigateUrl);
        e.BarItem.Target     = "main";
        PXSmartPanel panel = new PXSmartPanel();

        panel.ID            = "sp" + index.ToString();
        panel.LoadOnDemand  = index != 0;
        panel.AllowResize   = panel.AllowMove = false;
        panel.RenderVisible = true;
        panel.Width         = panel.Height = Unit.Percentage(100);

        e.BarItem.TemplateContainer.Controls.Add(panel);
        SiteMapDataSource ds = new SiteMapDataSource();

        ds.ID = "ds" + index.ToString();
        ds.StartingNodeUrl  = dataItem.NavigateUrl;
        ds.ShowStartingNode = false;
        panel.Controls.Add(ds);

        Control content = null;

        if (PXSiteMap.WikiProvider.FindSiteMapNodeFromKey(swNode.NodeID) != null)
        {
            if (PXSiteMap.WikiProvider.GetWikiID(swNode.Title) != Guid.Empty || PXSiteMap.WikiProvider.GetWikiIDFromUrl(swNode.Url) != Guid.Empty)
            {
                content = CreateWikiTree(swNode, trId);
            }
        }
        else if (swNode.ScreenID == "FV000000")
        {
            ds.Provider        = PXSiteMap.FavoritesProvider;
            ds.StartingNodeUrl = SiteMap.RootNode.Url;
            content            = CreateTree(ds, trId);
        }
        else
        {
            content = CreateTree(ds, trId);
        }

        if (content == null)
        {
            return;
        }
        panel.Controls.Add(content);
    }

    protected void navPanel_OnDataBound(object sender, EventArgs e)
    {
        bindComplete = true;
    }

    #endregion

    #region Methods to work with sitemap tree

    private PXTreeView CreateTree(SiteMapDataSource ds, string controlName)
    {
        PXTreeView tree = new PXTreeView();

        tree.DataSourceID = ds.ID;
        tree.ID           = controlName;
        tree.Width        = tree.Height = Unit.Percentage(100);
        tree.Style[HtmlTextWriterStyle.BorderWidth] = Unit.Pixel(0).ToString();
        tree.ShowRootNode = false;
        tree.Target       = "main";
        tree.ApplyStyleSheetSkin(this);
        tree.Style[HtmlTextWriterStyle.Position] = "absolute";
        tree.NodeDataBound         += new PXTreeNodeEventHandler(tree_NodeDataBound);
        tree.ShowLines              = false;
        tree.ClientEvents.NodeClick = "treeClick";
        tree.Synchronize           += new PXTreeSyncEventHandler(tree_Synchronize);
        return(tree);
    }

    private PXWikiTree CreateWikiTree(PX.Data.PXSiteMapNode node, string treeId)
    {
        PXWikiTree tree   = new PXWikiTree();
        string     url    = node.Url;
        Guid       wikiId = PX.Data.PXSiteMap.WikiProvider.GetWikiIDFromUrl(node.Url);

        PX.SM.WikiReader     reader = new PX.SM.WikiReader();
        PX.SM.WikiDescriptor wiki   = reader.wikis.SelectWindowed(0, 1, wikiId);

        tree.Provider = PX.Data.PXSiteMap.WikiProvider;
        url           = PX.SM.Wiki.Url(wikiId);

        tree.ID              = treeId;
        tree.WikiID          = wikiId;
        tree.ShowRootNode    = false;
        tree.Target          = "main";
        tree.StartingNodeUrl = this.ResolveUrl/**/ (url);
        tree.SearchUrl       = this.ResolveUrl/**/ ("~/Search/Wiki.aspx") + "?query=";
        tree.NewArticleUrl   = wiki == null || string.IsNullOrEmpty(wiki.UrlEdit) ? "" : this.ResolveUrl/**/ (wiki.UrlEdit) + "?wiki=" + wikiId;
        if (PXSiteMap.IsPortal)
        {
            tree.SearchUrl = this.ResolveUrl("~/Search/WikiSP.aspx") + "?adv=1&query=";
        }
        tree.Width = tree.Height = Unit.Percentage(100);
        tree.Style[HtmlTextWriterStyle.Position] = "absolute";

        tree.ClientEvents.NodeClick = "treeClick";
        tree.Synchronize           += new PXTreeSyncEventHandler(wikiTree_Synchronize);
        return(tree);
    }
コード例 #4
0
        internal void Bind(IHierarchyData hierarchyData)
        {
            this.hierarchyData = hierarchyData;
            DataBound          = true;
            DataPath           = hierarchyData.Path;
            dataItem           = hierarchyData.Item;

            TreeNodeBinding bin = GetBinding();

            if (bin != null)
            {
                // Bind ImageToolTip property

                if (bin.ImageToolTipField.Length > 0)
                {
                    ImageToolTip = Convert.ToString(GetBoundPropertyValue(bin.ImageToolTipField));
                    if (ImageToolTip.Length == 0)
                    {
                        ImageToolTip = bin.ImageToolTip;
                    }
                }
                else if (bin.ImageToolTip.Length > 0)
                {
                    ImageToolTip = bin.ImageToolTip;
                }

                // Bind ImageUrl property

                if (bin.ImageUrlField.Length > 0)
                {
                    ImageUrl = Convert.ToString(GetBoundPropertyValue(bin.ImageUrlField));
                    if (ImageUrl.Length == 0)
                    {
                        ImageUrl = bin.ImageUrl;
                    }
                }
                else if (bin.ImageUrl.Length > 0)
                {
                    ImageUrl = bin.ImageUrl;
                }

                // Bind NavigateUrl property

                if (bin.NavigateUrlField.Length > 0)
                {
                    NavigateUrl = Convert.ToString(GetBoundPropertyValue(bin.NavigateUrlField));
                    if (NavigateUrl.Length == 0)
                    {
                        NavigateUrl = bin.NavigateUrl;
                    }
                }
                else if (bin.NavigateUrl.Length > 0)
                {
                    NavigateUrl = bin.NavigateUrl;
                }

                // Bind PopulateOnDemand property

                if (bin.HasPropertyValue("PopulateOnDemand"))
                {
                    PopulateOnDemand = bin.PopulateOnDemand;
                }

                // Bind SelectAction property

                if (bin.HasPropertyValue("SelectAction"))
                {
                    SelectAction = bin.SelectAction;
                }

                // Bind ShowCheckBox property

                if (bin.HasPropertyValue("ShowCheckBox"))
                {
                    ShowCheckBox = bin.ShowCheckBox;
                }

                // Bind Target property

                if (bin.TargetField.Length > 0)
                {
                    Target = Convert.ToString(GetBoundPropertyValue(bin.TargetField));
                    if (Target.Length == 0)
                    {
                        Target = bin.Target;
                    }
                }
                else if (bin.Target.Length > 0)
                {
                    Target = bin.Target;
                }

                // Bind Text property
                string text = null;
                if (bin.TextField.Length > 0)
                {
                    text = Convert.ToString(GetBoundPropertyValue(bin.TextField));
                    if (bin.FormatString.Length > 0)
                    {
                        text = string.Format(bin.FormatString, text);
                    }
                }
                if (String.IsNullOrEmpty(text))
                {
                    if (bin.Text.Length > 0)
                    {
                        text = bin.Text;
                    }
                    else if (bin.Value.Length > 0)
                    {
                        text = bin.Value;
                    }
                }
                if (!String.IsNullOrEmpty(text))
                {
                    Text = text;
                }

                // Bind ToolTip property

                if (bin.ToolTipField.Length > 0)
                {
                    ToolTip = Convert.ToString(GetBoundPropertyValue(bin.ToolTipField));
                    if (ToolTip.Length == 0)
                    {
                        ToolTip = bin.ToolTip;
                    }
                }
                else if (bin.ToolTip.Length > 0)
                {
                    ToolTip = bin.ToolTip;
                }

                // Bind Value property
                string value = null;
                if (bin.ValueField.Length > 0)
                {
                    value = Convert.ToString(GetBoundPropertyValue(bin.ValueField));
                }
                if (String.IsNullOrEmpty(value))
                {
                    if (bin.Value.Length > 0)
                    {
                        value = bin.Value;
                    }
                    else if (bin.Text.Length > 0)
                    {
                        value = bin.Text;
                    }
                }
                if (!String.IsNullOrEmpty(value))
                {
                    Value = value;
                }
            }
            else
            {
                Text = Value = GetDefaultBoundText();
            }

            INavigateUIData navigateUIData = hierarchyData as INavigateUIData;

            if (navigateUIData != null)
            {
                SelectAction = TreeNodeSelectAction.None;
                Text         = navigateUIData.ToString();
                NavigateUrl  = navigateUIData.NavigateUrl;
                ToolTip      = navigateUIData.Description;
            }
        }
コード例 #5
0
        internal void Bind(IHierarchyData hierarchyData)
        {
            this.hierarchyData = hierarchyData;
            DataBound          = true;
            DataPath           = hierarchyData.Path;
            dataItem           = hierarchyData.Item;

            MenuItemBinding bin = GetBinding();

            if (bin != null)
            {
                // Bind Enabled property

                if (bin.EnabledField != "")
                {
                    try { Enabled = Convert.ToBoolean(GetBoundPropertyValue(bin.EnabledField)); }
                    catch { Enabled = bin.Enabled; }
                }
                else
                {
                    Enabled = bin.Enabled;
                }

                // Bind ImageUrl property

                if (bin.ImageUrlField.Length > 0)
                {
                    ImageUrl = Convert.ToString(GetBoundPropertyValue(bin.ImageUrlField));
                    if (ImageUrl.Length == 0)
                    {
                        ImageUrl = bin.ImageUrl;
                    }
                }
                else if (bin.ImageUrl.Length > 0)
                {
                    ImageUrl = bin.ImageUrl;
                }

                // Bind NavigateUrl property

                if (bin.NavigateUrlField.Length > 0)
                {
                    NavigateUrl = Convert.ToString(GetBoundPropertyValue(bin.NavigateUrlField));
                    if (NavigateUrl.Length == 0)
                    {
                        NavigateUrl = bin.NavigateUrl;
                    }
                }
                else if (bin.NavigateUrl.Length > 0)
                {
                    NavigateUrl = bin.NavigateUrl;
                }

                // Bind PopOutImageUrl property

                if (bin.PopOutImageUrlField.Length > 0)
                {
                    PopOutImageUrl = Convert.ToString(GetBoundPropertyValue(bin.PopOutImageUrlField));
                    if (PopOutImageUrl.Length == 0)
                    {
                        PopOutImageUrl = bin.PopOutImageUrl;
                    }
                }
                else if (bin.PopOutImageUrl.Length > 0)
                {
                    PopOutImageUrl = bin.PopOutImageUrl;
                }

                // Bind Selectable property

                if (bin.SelectableField != "")
                {
                    try { Selectable = Convert.ToBoolean(GetBoundPropertyValue(bin.SelectableField)); }
                    catch { Selectable = bin.Selectable; }
                }
                else
                {
                    Selectable = bin.Selectable;
                }

                // Bind SeparatorImageUrl property

                if (bin.SeparatorImageUrlField.Length > 0)
                {
                    SeparatorImageUrl = Convert.ToString(GetBoundPropertyValue(bin.SeparatorImageUrlField));
                    if (SeparatorImageUrl.Length == 0)
                    {
                        SeparatorImageUrl = bin.SeparatorImageUrl;
                    }
                }
                else if (bin.SeparatorImageUrl.Length > 0)
                {
                    SeparatorImageUrl = bin.SeparatorImageUrl;
                }

                // Bind Target property

                if (bin.TargetField.Length > 0)
                {
                    Target = Convert.ToString(GetBoundPropertyValue(bin.TargetField));
                    if (Target.Length == 0)
                    {
                        Target = bin.Target;
                    }
                }
                else if (bin.Target.Length > 0)
                {
                    Target = bin.Target;
                }

                // Bind ToolTip property

                if (bin.ToolTipField.Length > 0)
                {
                    ToolTip = Convert.ToString(GetBoundPropertyValue(bin.ToolTipField));
                    if (ToolTip.Length == 0)
                    {
                        ToolTip = bin.ToolTip;
                    }
                }
                else if (bin.ToolTip.Length > 0)
                {
                    ToolTip = bin.ToolTip;
                }

                // Bind Value property
                string value = null;
                if (bin.ValueField.Length > 0)
                {
                    value = Convert.ToString(GetBoundPropertyValue(bin.ValueField));
                }
                if (String.IsNullOrEmpty(value))
                {
                    if (bin.Value.Length > 0)
                    {
                        value = bin.Value;
                    }
                    else if (bin.Text.Length > 0)
                    {
                        value = bin.Text;
                    }
                    else
                    {
                        value = String.Empty;
                    }
                }
                Value = value;

                // Bind Text property
                string text = null;
                if (bin.TextField.Length > 0)
                {
                    text = Convert.ToString(GetBoundPropertyValue(bin.TextField));
                    if (bin.FormatString.Length > 0)
                    {
                        text = string.Format(bin.FormatString, text);
                    }
                }
                if (String.IsNullOrEmpty(text))
                {
                    if (bin.Text.Length > 0)
                    {
                        text = bin.Text;
                    }
                    else if (bin.Value.Length > 0)
                    {
                        text = bin.Value;
                    }
                    else
                    {
                        text = String.Empty;
                    }
                }
                Text = text;
            }
            else
            {
                Text = Value = GetDefaultBoundText();
            }

            INavigateUIData navigateUIData = hierarchyData as INavigateUIData;

            if (navigateUIData != null)
            {
                ToolTip     = navigateUIData.Description;
                Text        = navigateUIData.ToString();
                NavigateUrl = navigateUIData.NavigateUrl;
            }
        }