Пример #1
0
        /// <summary>
        /// Creates the command for opening the properties dialog. Returns empty string if no command exists.
        /// </summary>
        /// <param name="nodeUid">The node uid.</param>
        /// <param name="controlUid">The control uid.</param>
        /// <returns></returns>
        public static string CreatePropertiesCommand(string nodeUid, string controlUid)
        {
            string command = String.Empty;

            Mediachase.Cms.Controls.DynamicControlInfo ctrlInfo = Mediachase.Cms.Controls.DynamicControlFactory.GetControlInfo(controlUid);
            StringBuilder propertyString = new StringBuilder();

            if (ctrlInfo != null)
            {
                propertyString.Append(Mediachase.Commerce.Shared.CommerceHelper.GetAbsolutePath("~/Structure/Base/Controls/PropertyPage.aspx"));
                propertyString.Append("?PropertyPagePath=");
                propertyString.Append(ctrlInfo.PropertyPagePath);
                propertyString.Append("&NodeUID=");
                propertyString.Append(nodeUid);
                propertyString.Append("&ControlUID=");
                propertyString.Append(controlUid);
                // Sasha: added versionid so we can get the specific page settings
                propertyString.Append("&VersionId=");
                propertyString.Append(PageDocument.Current.PageVersionId);
                // Sasha: added siteid to better support multi site
                propertyString.Append("&siteid=");
                propertyString.Append(CMSContext.Current.SiteId);
            }

            // [2007/10/01] Nadya: added ctrlInfo.PropertyPagePath != null
            // 2007/10/2 Sasha: added ctrlInfo != null
            if (ctrlInfo != null && ctrlInfo.PropertyPagePath != null)
            {
                //wControl.Attributes.Add("ondblclick", "PopUpWindow('" + propertyString.ToString() + "');");
                command = "var _uh=$find('MediachaseCmsUtil'); if(_uh!=null) _uh.PopUpWindow('" + propertyString.ToString() + "');";
            }

            return(command);
        }
Пример #2
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);
        }