예제 #1
0
        /// <summary>
        /// Handles the <see cref="E:System.Web.UI.Control.Init"></see> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"></see> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            PlaceHolderManager.GetCurrent(this.Page).PlaceHolders.Add(this);
        }
예제 #2
0
        /// <summary>
        /// Creates the design wrapper.
        /// </summary>
        /// <param name="ctrl">The CTRL.</param>
        /// <param name="dn">The dn.</param>
        /// <returns></returns>
        protected virtual Control CreateDesignWrapper(Control ctrl, DynamicNode dn)
        {
            ComponentArt.Web.UI.Snap snap = new ComponentArt.Web.UI.Snap();

            snap.DockingContainers = CMSContext.Current.ControlPlaces;
            snap.DockingStyle      = SnapDockingStyleType.TransparentRectangle;

            snap.MustBeDocked     = true;
            snap.CollapseDuration = 300;
            snap.ExpandDuration   = 300;

            Panel wControl = new Panel();

            snap.ID = dn.NodeUID;

            Image moveImg     = new Image();
            Image moveDelete  = new Image();
            Image propertyImg = new Image();

            wControl.Attributes.Add("ActionSet", "NoneMenu");

            wControl.Style.Add("position", "relative");
            wControl.Style.Add("z-index", "1");
            wControl.ID = dn.NodeUID + "_wControl";

            moveImg.Attributes.Add("ActionBtn", "Move");
            moveDelete.Attributes.Add("ActionBtn", "Delete");

            moveImg.CssClass     = "imgMove";
            moveDelete.CssClass  = "imgDelete";
            propertyImg.CssClass = "imgProperty";

            snap.CurrentDockingContainer = dn.ControlPlaceId;
            snap.CurrentDockingIndex     = dn.ControlPlaceIndex;

            //add move button
            moveImg.ID = dn.NodeUID + "_move";
            moveImg.Attributes.Add("onmousedown", this.ClientID + "_" + snap.ClientID + ".StartDragging(event);");
            moveImg.ImageUrl = Mediachase.Commerce.Shared.CommerceHelper.GetAbsolutePath("/Images/move.gif");

            //add delete button
            //moveDelete.Attributes.Add("onclick", snap.ClientID + ".Collapse();MakeModified('del','" + PlaceHolderManager.GetCurrent(this.Page).hfDeletetedId + "','" + snap.ID + "');");
            moveDelete.ID = dn.NodeUID + "_deleted";
            //moveDelete.Attributes.Add("onclick", this.ClientID + "_" + snap.ClientID + ".Collapse(); FillDeleteSnapInfo('" + PlaceHolderManager.GetCurrent(this.Page).hfDeletetedId + "','" + dn.NodeUID + "'); ");
            moveDelete.Attributes.Add("onclick", this.ClientID + "_" + snap.ClientID + ".Collapse(); var _sh=$find('SnapHolder1_Snap'); if(_sh!=null) _sh.FillDeleteSnapInfo('" + PlaceHolderManager.GetCurrent(this.Page).hfDeletetedId + "','" + dn.NodeUID + "'); ");
            moveDelete.ImageUrl = Mediachase.Commerce.Shared.CommerceHelper.GetAbsolutePath("/Images/delete.gif");

            wControl.Controls.Add(moveImg);
            wControl.Controls.Add(moveDelete);

            string command = CreatePropertiesCommand(dn.NodeUID, dn.FactoryControlUID);

            if (!String.IsNullOrEmpty(command) && ctrl.GetType().FullName != "ASP.structure_base_controls_inlinebase_inlineeditor_ascx" && ctrl.GetType().FullName != "ASP.structure_base_controls_popupbase_popupeditor_ascx")
            {
                wControl.Attributes.Add("ondblclick", command);
            }

            SnapContent content = new SnapContent();

            content.Controls.Add(wControl);
            snap.Content = content;

            //add property page call
            //wControl.Attributes.Add("onclick", String.Format("EditControlHandler('{0}', '{1}');", PlaceHolderManager.GetCurrent(this.Page).hfEdited.ClientID, dn.NodeUID));
            wControl.Attributes.Add("onclick", String.Format(" var _sh=$find('SnapHolder1_Snap'); if(_sh!=null) _sh.EditControlHandler('{0}', '{1}');", PlaceHolderManager.GetCurrent(this.Page).hfEdited.ClientID, dn.NodeUID));
            wControl.Controls.Add(ctrl); // <---- crash

            dn.AssignedControl = snap;

            return(snap);
        }