Beispiel #1
0
    /// <summary>
    /// Saves the specified node uid.
    /// </summary>
    /// <param name="NodeUid">The node uid.</param>
    /// <param name="ControlUid">The control uid.</param>
    void IPropertyPage.Save(string NodeUid, string ControlUid)
    {
        ControlSettings settings = new ControlSettings();

        DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

        if (dNode != null)
        {
            settings         = dNode.GetSettings(dNode.NodeUID);
            dNode.IsModified = true;
        }
        else
        {
            settings = PageDocument.Current.StaticNode.Controls[NodeUid];
            if (settings == null)
            {
                settings = new ControlSettings();
                PageDocument.Current.StaticNode.Controls.Add(NodeUid, settings);
            }
        }

        if (settings.Params == null)
        {
            settings.Params = new Param();
        }

        settings.IsModified = true;

        settings.Params.Remove("ImageUrl");

        if (!String.IsNullOrEmpty(txtUrl.Text))
        {
            settings.Params.Add("ImageUrl", txtUrl.Text);
        }
    }
Beispiel #2
0
        /// <summary>
        /// Saves the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        public void Save(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings         = dNode.GetSettings(dNode.NodeUID);
                dNode.IsModified = true;
            }
            else
            {
                settings = PageDocument.Current.StaticNode.Controls[NodeUid];
                if (settings == null)
                {
                    settings = new ControlSettings();
                    PageDocument.Current.StaticNode.Controls.Add(NodeUid, settings);
                }
            }

            if (settings.Params == null)
            {
                settings.Params = new Param();
            }

            settings.IsModified = true;

            CommonHelper.SaveParameter(settings, "DisplayTemplate", DisplayTemplate.SelectedValue);
            CommonHelper.SaveParameter(settings, "DataSource", DataSourceList.SelectedValue);
            CommonHelper.SaveParameter(settings, "DataMember", DSMemberList.SelectedValue);
        }
Beispiel #3
0
        /// <summary>
        /// Loads the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        void IPropertyPage.Load(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings = dNode.GetSettings(NodeUid);
            }
            else
            {
                settings = PageDocument.Current.StaticNode.Controls[NodeUid];
            }

            // Bind templates
            DisplayTemplate.Items.Clear();
            DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter = "TemplateType = 'menu'";

                foreach (DataRowView row in view)
                {
                    DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
                }

                DisplayTemplate.DataBind();
            }

            string selectedMember = String.Empty;

            if (settings != null && settings.Params != null)
            {
                Param prm = settings.Params;

                if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
                {
                    CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
                }

                if ((prm["DataSource"] != null) && (prm["DataSource"] is string))
                {
                    CommonHelper.SelectListItem(DataSourceList, prm["DataSource"].ToString());
                }

                if ((prm["DataMember"] != null) && (prm["DataMember"] is string))
                {
                    selectedMember = prm["DataMember"].ToString();
                }
            }

            BindSourceMembers(selectedMember);
        }
    /// <summary>
    /// Saves the specified node uid.
    /// </summary>
    /// <param name="NodeUid">The node uid.</param>
    /// <param name="ControlUid">The control uid.</param>
    void IPropertyPage.Save(string NodeUid, string ControlUid)
    {
        ControlSettings settings = new ControlSettings();

        DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

        if (dNode != null)
        {
            settings            = dNode.GetSettings(dNode.NodeUID);
            dNode.IsModified    = true;
            settings.IsModified = true;
        }

        if (settings.Params == null)
        {
            settings.Params = new Param();
        }

        settings.IsModified = true;

        CommonHelper.SaveParameter(settings, "DisplayTemplate", DisplayTemplate.SelectedValue);
        CommonHelper.SaveParameter(settings, "NodeCode", NodeCode.Text);
        CommonHelper.SaveParameter(settings, "RecordsPerPage", NumberOfRecords.Text);
        CommonHelper.SaveParameter(settings, "Catalogs", CatalogList);
        CommonHelper.SaveParameter(settings, "EntryTypes", EntryTypeList);
        CommonHelper.SaveParameter(settings, "EntryClasses", MetaClassList);

        /*
         * CommonHelper.SaveParameter(settings, "FTSPhrase", FTSPhrase.Text);
         * CommonHelper.SaveParameter(settings, "AdvancedFTSPhrase", AdvancedFTSPhrase.Text);
         * CommonHelper.SaveParameter(settings, "SQLClause", SQLClause.Text);
         * CommonHelper.SaveParameter(settings, "MetaSQLClause", MetaSQLClause.Text);
         * */

        // Orderby
        string orderByValue = String.Empty;

        if (!String.IsNullOrEmpty(OrderByList.SelectedValue))
        {
            if (OrderByList.SelectedValue == "custom")
            {
                orderByValue = OrderBy.Text;
            }
            else
            {
                orderByValue = OrderByList.SelectedValue;
                if (OrderDesc.Checked)
                {
                    orderByValue = orderByValue + " DESC";
                }
            }
        }
        CommonHelper.SaveParameter(settings, "OrderBy", orderByValue);
    }
Beispiel #5
0
        /// <summary>
        /// Saves the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        void IPropertyPage.Save(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings         = dNode.GetSettings(dNode.NodeUID);
                dNode.IsModified = true;
            }

            if (settings.Params == null)
            {
                settings.Params = new Param();
            }

            settings.IsModified = true;

            settings.Params.Remove("DisplayTemplate");

            if (!String.IsNullOrEmpty(DisplayTemplate.SelectedValue))
            {
                settings.Params.Add("DisplayTemplate", DisplayTemplate.SelectedValue);
            }

            settings.Params.Remove("NodeCode");

            if (!String.IsNullOrEmpty(NodeCode.Text))
            {
                settings.Params.Add("NodeCode", NodeCode.Text);
            }

            settings.Params.Remove("EntryCode");

            if (!String.IsNullOrEmpty(NodeCode.Text))
            {
                settings.Params.Add("EntryCode", EntryCode.Text);
            }

            settings.Params.Remove("CatalogName");

            if (!String.IsNullOrEmpty(CatalogList.SelectedValue))
            {
                settings.Params.Add("CatalogName", CatalogList.SelectedValue);
            }

            settings.Params.Remove(DEPOSITORY_KEY);
            if (!String.IsNullOrEmpty(this.ddlDepository.SelectedValue))
            {
                settings.Params[DEPOSITORY_KEY] = this.ddlDepository.SelectedValue;
            }
        }
        public new void Load(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();
            DynamicNode     dNode    = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings = dNode.GetSettings(NodeUid);
            }
            if (settings != null && settings.Params != null)
            {
                if (settings.Params[DEPOSITORY_KEY] == null)
                {
                    settings.Params[DEPOSITORY_KEY] = NWTD.InfoManager.Depository.NWTD.ToString();
                }
                this.ddlDepos.SelectedValue = settings.Params[DEPOSITORY_KEY].ToString();
            }
        }
        public void Save(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings         = dNode.GetSettings(dNode.NodeUID);
                dNode.IsModified = true;
            }

            if (settings.Params == null)
            {
                settings.Params = new Param();
            }

            settings.IsModified = true;
            settings.Params.Remove(DEPOSITORY_KEY);
            settings.Params[DEPOSITORY_KEY] = this.ddlDepos.SelectedValue;
        }
Beispiel #8
0
        /// <summary>
        /// Creates the dynamic control.
        /// </summary>
        /// <param name="DNodeUID">The D node UID.</param>
        /// <returns></returns>
        protected virtual Control CreateDynamicControl(string DNodeUID)
        {
            DynamicNode dn = Mediachase.Cms.Pages.PageDocument.Current.DynamicNodes.LoadByUID(DNodeUID);

            if (dn == null)
            {
                throw new ArgumentNullException(String.Format("DynamicNodeUID: {0}", DNodeUID));
            }

            Mediachase.Cms.Controls.DynamicControlInfo dci = Mediachase.Cms.Controls.DynamicControlFactory.GetControlInfo(dn.FactoryControlUID);
            Control c = new Control();

            if (dci != null)
            {
                c = this.Page.LoadControl(typeof(BaseErrorControl), null);  //Mediachase.Cms.Controls.DynamicControlFactory.Create(this.Page, dci.Uid);
                Control dynamicControl = Mediachase.Cms.Controls.DynamicControlFactory.Create(this.Page, dci.Uid);

                if (dynamicControl is ICmsDataAdapter)
                {
                    ControlSettings settings = new ControlSettings();
                    settings = dn.GetSettings(dn.NodeUID);
                    ((ICmsDataAdapter)dynamicControl).SetParamInfo(settings);
                }

                c.Controls.Add(dynamicControl);
            }
            else
            {
                c = this.Page.LoadControl("~/Structure/Base/Controls/Common/SysEmptyControl.ascx");
            }

            if (CMSContext.Current.IsDesignMode)
            {
                return(this.CreateDesignWrapper(c, dn));
            }

            return(c);
        }
Beispiel #9
0
    /// <summary>
    /// Loads the specified node uid.
    /// </summary>
    /// <param name="NodeUid">The node uid.</param>
    /// <param name="ControlUid">The control uid.</param>
    void IPropertyPage.Load(string NodeUid, string ControlUid)
    {
        ControlSettings settings = new ControlSettings();

        DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

        if (dNode != null)
        {
            settings = dNode.GetSettings(NodeUid);
        }
        else
        {
            settings = PageDocument.Current.StaticNode.Controls[NodeUid];
        }

        if (settings != null && settings.Params != null)
        {
            Param prm = settings.Params;
            if ((prm["ImageUrl"] != null) && (prm["ImageUrl"] is string))
            {
                txtUrl.Text = prm["ImageUrl"].ToString();
            }
        }
    }
Beispiel #10
0
        /// <summary>
        /// Loads the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        void IPropertyPage.Load(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings = dNode.GetSettings(NodeUid);
            }

            // Bind Meta Types
            // Bind Meta classes
            // MetaDataContext.Current = CatalogContext.MetaDataContext;
            MetaClass catalogEntry = MetaClass.Load(CatalogContext.MetaDataContext, "CatalogEntry");

            MetaClassList.Items.Clear();
            if (catalogEntry != null)
            {
                MetaClassCollection metaClasses = catalogEntry.ChildClasses;
                foreach (MetaClass metaClass in metaClasses)
                {
                    MetaClassList.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Name));
                }
                MetaClassList.DataBind();
            }

            // Bind templates
            DisplayTemplate.Items.Clear();
            DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter = "TemplateType = 'search-index'";

                foreach (DataRowView row in view)
                {
                    DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
                }

                DisplayTemplate.DataBind();
            }

            // Bind Types
            EntryTypeList.Items.Clear();
            EntryTypeList.Items.Add(new ListItem(EntryType.Product, EntryType.Product));
            EntryTypeList.Items.Add(new ListItem(EntryType.Package, EntryType.Package));
            EntryTypeList.Items.Add(new ListItem(EntryType.Bundle, EntryType.Bundle));
            EntryTypeList.Items.Add(new ListItem(EntryType.DynamicPackage, EntryType.DynamicPackage));
            EntryTypeList.Items.Add(new ListItem(EntryType.Variation, EntryType.Variation));
            EntryTypeList.DataBind();

            // Bind catalogs
            CatalogList.Items.Clear();
            CatalogDto catalogs = CatalogContext.Current.GetCatalogDto(CMSContext.Current.SiteId);

            if (catalogs.Catalog.Count > 0)
            {
                foreach (CatalogDto.CatalogRow row in catalogs.Catalog)
                {
                    if (row.IsActive && row.StartDate <= FrameworkContext.Current.CurrentDateTime && row.EndDate >= FrameworkContext.Current.CurrentDateTime)
                    {
                        CatalogList.Items.Add(new ListItem(row.Name, row.Name));
                    }
                }

                CatalogList.DataBind();
            }

            //Bind Depositories
            this.ddlDepository.DataSource = Enum.GetNames(typeof(NWTD.InfoManager.Depository));
            this.ddlDepository.DataBind();

            if (settings != null && settings.Params != null)
            {
                Param prm = settings.Params;

                CommonHelper.LoadTextBox(settings, "NodeCode", NodeCode);
                CommonHelper.LoadTextBox(settings, "RecordsPerPage", NumberOfRecords);

                /*
                 * CommonHelper.LoadTextBox(settings, "FTSPhrase", FTSPhrase);
                 * CommonHelper.LoadTextBox(settings, "AdvancedFTSPhrase", AdvancedFTSPhrase);
                 * CommonHelper.LoadTextBox(settings, "MetaSQLClause", MetaSQLClause);
                 * CommonHelper.LoadTextBox(settings, "SQLClause", SQLClause);
                 * */

                if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
                {
                    CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
                }

                CommonHelper.SelectList(settings, "Catalogs", CatalogList);
                CommonHelper.SelectList(settings, "EntryClasses", MetaClassList);
                CommonHelper.SelectList(settings, "EntryTypes", EntryTypeList);

                // Orderby
                if ((prm["OrderBy"] != null) && (prm["OrderBy"] is string))
                {
                    string orderBy = prm["OrderBy"].ToString();
                    bool   isDesc  = orderBy.Contains("DESC");

                    string listOrderBy = orderBy.Replace(" DESC", "");
                    listOrderBy = listOrderBy.Replace(" ASC", "");

                    CommonHelper.SelectListItem(OrderByList, listOrderBy);

                    if (!String.IsNullOrEmpty(OrderByList.SelectedValue))
                    {
                        if (OrderByList.SelectedValue == "custom")
                        {
                            OrderBy.Text = orderBy;
                        }
                        else
                        {
                            OrderDesc.Checked = isDesc;
                        }
                    }
                }


                if (prm[DEPOSITORY_KEY] == null)
                {
                    prm[DEPOSITORY_KEY] = NWTD.InfoManager.Depository.NWTD.ToString();
                }
                this.ddlDepository.SelectedValue = settings.Params[DEPOSITORY_KEY].ToString();
            }
        }
Beispiel #11
0
        /// <summary>
        /// Loads the specified node uid.
        /// </summary>
        /// <param name="NodeUid">The node uid.</param>
        /// <param name="ControlUid">The control uid.</param>
        void IPropertyPage.Load(string NodeUid, string ControlUid)
        {
            ControlSettings settings = new ControlSettings();

            DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

            if (dNode != null)
            {
                settings = dNode.GetSettings(NodeUid);
            }

            // Bind templates
            DisplayTemplate.Items.Clear();
            DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
            TemplateDto templates = DictionaryManager.GetTemplateDto();

            if (templates.main_Templates.Count > 0)
            {
                DataView view = templates.main_Templates.DefaultView;
                view.RowFilter = "TemplateType = 'entry'";

                foreach (DataRowView row in view)
                {
                    DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
                }

                DisplayTemplate.DataBind();
            }

            // Bind catalogs
            CatalogList.Items.Clear();
            CatalogList.Items.Add(new ListItem("(use default)", ""));
            CatalogDto catalogs = CatalogContext.Current.GetCatalogDto(CMSContext.Current.SiteId);

            if (catalogs.Catalog.Count > 0)
            {
                foreach (CatalogDto.CatalogRow row in catalogs.Catalog)
                {
                    if (row.IsActive && row.StartDate <= FrameworkContext.Current.CurrentDateTime && row.EndDate >= FrameworkContext.Current.CurrentDateTime)
                    {
                        CatalogList.Items.Add(new ListItem(row.Name, row.Name));
                    }
                }

                CatalogList.DataBind();
            }

            //Bind Depositories
            this.ddlDepository.DataSource = Enum.GetNames(typeof(NWTD.InfoManager.Depository));
            this.ddlDepository.DataBind();


            if (settings != null && settings.Params != null)
            {
                Param prm = settings.Params;
                if ((prm["NodeCode"] != null) && (prm["NodeCode"] is string))
                {
                    NodeCode.Text = prm["NodeCode"].ToString();
                }

                if ((prm["EntryCode"] != null) && (prm["EntryCode"] is string))
                {
                    EntryCode.Text = prm["EntryCode"].ToString();
                }

                if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
                {
                    CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
                }

                if ((prm["CatalogName"] != null) && (prm["CatalogName"] is string))
                {
                    CommonHelper.SelectListItem(CatalogList, prm["CatalogName"].ToString());
                }

                if (prm[DEPOSITORY_KEY] == null)
                {
                    prm[DEPOSITORY_KEY] = NWTD.InfoManager.Depository.NWTD.ToString();
                }
                this.ddlDepository.SelectedValue = settings.Params[DEPOSITORY_KEY].ToString();
            }
        }