private static void InitializeColumns(BaseViewer oViewer, string columnsXml)
        {
            oViewer.Columns = new List<BaseColumn>();
            if (!string.IsNullOrEmpty(columnsXml))
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(columnsXml);
                XmlNodeList columnNodes = doc.DocumentElement.SelectNodes("Column");

                Database db = Sitecore.Configuration.Factory.GetDatabase(Settings.Instance.ConfigurationDatabase);
                Item ViewerColumnFolder = db.GetItem(Settings.Instance.ViewerColumnsFolder);
                SCDirector director = new SCDirector("master", "en");

                for (int i = 0; i < columnNodes.Count; i++)
                {
                    string name = columnNodes[i].Attributes["name"].Value;
                    Item item = ViewerColumnFolder.Axes.GetItem(name);
                    ColumnItem ci = director.LoadObjectFromItem<ColumnItem>(item);

                    ci.Header = columnNodes[i].InnerText;

                    //If this is the wildcard item populate the name too
                    if (item.Name == "*")
                        ci.Name = name;

                    if (columnNodes[i].Attributes["attributes"] != null)
                        ci.Attributes = columnNodes[i].Attributes["attributes"].Value;

                    oViewer.Columns.Add(BaseColumn.Create(ci));
                }
            }
        }
Пример #2
0
        public void Start(ClientPipelineArgs args)
        {
            if (!args.IsPostBack)
            {
                Util.ShowItemBrowser(
                    "Select the report",
                    "Select the report",
                    "Database/32x32/view_h.png",
                    "Select",
                    Current.Context.Settings.ReportsFolder,
                    Current.Context.ReportItem == null ? Current.Context.Settings.ReportsFolder : Current.Context.ReportItem.Path,
                    Current.Context.Settings.ConfigurationDatabase);
                args.WaitForPostBack();
            }
            else
            {
                if (!Sitecore.Data.ID.IsID(args.Result))
                {
                    return;
                }
                Database database = Sitecore.Configuration.Factory.GetDatabase(Current.Context.Settings.ConfigurationDatabase);
                Sitecore.Diagnostics.Assert.IsNotNull(database,"no configuration databsae");

                Item item = database.GetItem(args.Result);

                Sitecore.Diagnostics.Assert.IsNotNull(item, "report item cannot be loaded");

                switch(item.Template.Key)
                {
                    case "report":
                    SCDirector director = new SCDirector(Current.Context.Settings.ConfigurationDatabase, "en");

                    ReportItem rItem = director.LoadObjectFromItem<ReportItem>(item);
                    if (rItem != null)
                    {
                        Current.Context.ReportItem = rItem;
                        Current.Context.Report = null;
                        Sitecore.Context.ClientPage.SendMessage(this, "ASR.MainForm:update");

                        // Sitecore.Context.ClientPage.SendMessage(this, "ASR.MainForm:toolbarupdate");
                    }
                        break;

                    case "saved report":

                    Message m = Message.Parse(this, "ASR.MainForm:openlink");
                    System.Collections.Specialized.NameValueCollection nvc =
                    Sitecore.StringUtil.ParseNameValueCollection(item["parameters"], '&', '=');

                    m.Arguments.Add(nvc);
                    Sitecore.Context.ClientPage.SendMessage(m);
                    break;
                }

            }
        }
Пример #3
0
        public void Start(ClientPipelineArgs args)
        {
            if (!args.IsPostBack)
            {
                Util.ShowItemBrowser(
                    "Select the report",
                    "Select the report",
                    "Database/32x32/view_h.png",
                    "Select",
                    Current.Context.Settings.ReportsFolder,
                    Current.Context.ReportItem == null ? Current.Context.Settings.ReportsFolder : Current.Context.ReportItem.Path,
                    Current.Context.Settings.ConfigurationDatabase);
                args.WaitForPostBack();
            }
            else
            {
                if (!Sitecore.Data.ID.IsID(args.Result))
                {
                    return;
                }
                Database database = Sitecore.Configuration.Factory.GetDatabase(Current.Context.Settings.ConfigurationDatabase);
                Sitecore.Diagnostics.Assert.IsNotNull(database, "no configuration databsae");

                Item item = database.GetItem(args.Result);

                Sitecore.Diagnostics.Assert.IsNotNull(item, "report item cannot be loaded");

                switch (item.Template.Key)
                {
                case "report":
                    SCDirector director = new SCDirector(Current.Context.Settings.ConfigurationDatabase, "en");

                    ReportItem rItem = director.LoadObjectFromItem <ReportItem>(item);
                    if (rItem != null)
                    {
                        Current.Context.ReportItem = rItem;
                        Current.Context.Report     = null;
                        Sitecore.Context.ClientPage.SendMessage(this, "ASR.MainForm:update");

                        // Sitecore.Context.ClientPage.SendMessage(this, "ASR.MainForm:toolbarupdate");
                    }
                    break;

                case "saved report":

                    Message m = Message.Parse(this, "ASR.MainForm:openlink");
                    System.Collections.Specialized.NameValueCollection nvc =
                        Sitecore.StringUtil.ParseNameValueCollection(item["parameters"], '&', '=');

                    m.Arguments.Add(nvc);
                    Sitecore.Context.ClientPage.SendMessage(m);
                    break;
                }
            }
        }
        private static void InitializeColumns(BaseViewer oViewer, string columnsXml)
        {
            oViewer.Columns = new List <BaseColumn>();
            if (!string.IsNullOrEmpty(columnsXml))
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(columnsXml);
                XmlNodeList columnNodes = doc.DocumentElement.SelectNodes("Column");

                Database   db = Sitecore.Configuration.Factory.GetDatabase(Settings.Instance.ConfigurationDatabase);
                Item       ViewerColumnFolder = db.GetItem(Settings.Instance.ViewerColumnsFolder);
                SCDirector director           = new SCDirector("master", "en");

                for (int i = 0; i < columnNodes.Count; i++)
                {
                    string     name = columnNodes[i].Attributes["name"].Value;
                    Item       item = ViewerColumnFolder.Axes.GetItem(name);
                    ColumnItem ci   = director.LoadObjectFromItem <ColumnItem>(item);

                    ci.Header = columnNodes[i].InnerText;

                    //If this is the wildcard item populate the name too
                    if (item.Name == "*")
                    {
                        ci.Name = name;
                    }

                    if (columnNodes[i].Attributes["attributes"] != null)
                    {
                        ci.Attributes = columnNodes[i].Attributes["attributes"].Value;
                    }

                    oViewer.Columns.Add(BaseColumn.Create(ci));
                }
            }
        }