void IWebControlPlace.Init(Mediachase.WebSaltatoryControl.ControlPlace cp, bool bFirstRun) { // TODO: Add ControlPlace.Init implementation if (bFirstRun) { Controls_InitHash(); } else { Controls_Clear(); } Bind_Cotrols(cp); }
private void Bind_Cotrols(Mediachase.WebSaltatoryControl.ControlPlace cp) { int allcntrls = cp.ControlWrappers.Count; HtmlTableRow tr; HtmlTableCell td; int td_top_pad = 20; for (int i = 0; i <= allcntrls; i++) { if (i == allcntrls && !ControlManager.CurrentView.CustomizeEnabled) { break; } tr = new HtmlTableRow(); tbMain.Rows.Add(tr); tbMain.Style.Remove("border"); if (ControlManager.CurrentView.CustomizeEnabled) { tbMain.Style.Add("border", "1px solid red"); td = new HtmlTableCell(); tr.Cells.Add(td); HtmlImage img = new HtmlImage(); img.Src = "Layouts/Images/insert.gif"; img.Width = 14; img.Height = 21; img.Border = 0; img.Attributes.Add("CP_ClientID", this.ClientID); img.Attributes.Add("CP_Index", i.ToString()); img.Style.Add("position", "relative"); img.Style.Add("top", "-" + ((img.Height) / 2).ToString()); img.Style.Add("z-index", "255"); img.Style.Add("cursor", "pointer"); img.Attributes.Add("onclick", "javascript:" + "CP_ImgClick('" + txtSourceControl.ClientID + "','" + txtSourceNewControl.ClientID + "','" + txtSourceElement.ClientID + "','" + txtImgSubmit.ClientID + "'," + i.ToString() + ");" + Page.ClientScript.GetPostBackEventReference(ImgSubmit, "") + ";"); img.Style.Add("display", "none"); td.Controls.Add(img); td.VAlign = "top"; td.Width = "1%"; td.Style.Add("padding-top", td_top_pad.ToString() + "px"); } td = new HtmlTableCell(); tr.Cells.Add(td); td.VAlign = "top"; td.Width = "99%"; if (ControlManager.CurrentView.CustomizeEnabled) { td.Style.Add("padding-top", td_top_pad.ToString() + "px"); } if (i < allcntrls) { if (td.ColSpan > 1) { td.ColSpan = 1; } if (td.InnerHtml != String.Empty) { td.InnerHtml = String.Empty; } Mediachase.UI.Web.Modules.MetaDataBlockViewControl control = (Mediachase.UI.Web.Modules.MetaDataBlockViewControl)cp.ControlWrappers[i].Control; CustomizeView CustomizeControl = (CustomizeView)this.LoadControl("CustomizeView.ascx"); CustomizeControl.Path_Img = path_img; CustomizeControl.Title = control.Name; if (!ControlManager.CurrentView.CustomizeEnabled) { if (control.ContainFileds) { CustomizeControl.Control(cp.ControlWrappers[i].Control); //string bmDiv_Html = "<A HREF='../Common/MetaDataEdit.aspx?id=335&class=ProjectsEx_28'><img alt='' src='../Layouts/Images/Edit.gif'/> Edit</A>"; //CustomizeControl.DropMenuHtml = bmDiv_Html; if (editlinkhtml != string.Empty) { CustomizeControl.DropMenuHtml = string.Format(editlinkhtml, this.GetObjectId().ToString(), this.ID, i); } } else { CustomizeControl.Description = control.Description; } } else { CustomizeControl.Description = control.Description; string bmDiv_Id = td.ClientID + "dv"; string bmDiv_sUrl = "ShowRelDivBMenu('" + this.ClientID + "'," + i.ToString() + ",'" + txtActiveElement.ClientID + "','" + tbView.MainDivClientID + "', '" + bmDiv_Id + "', 0, 100);"; string bmDiv_Html = "<div style='position:relative;left:0px;top:2px;z-index:255;' onmouseover=\"this.className='selectednavover';\" onmouseout=\"this.className='selectednav';\" class='selectednav' id='" + bmDiv_Id + "' onclick=\"" + bmDiv_sUrl + "\">" + " <img alt='' src='" + path_img + "Layouts/Images/Menu/downbtn.gif' border='0' width='9' height='5' align='absmiddle'/> " + "</div>"; CustomizeControl.DropMenuHtml = bmDiv_Html; } td.Controls.Add(CustomizeControl); } else { //customizeallow true td.InnerHtml = "<br>"; td.ColSpan = 2; } } if (allcntrls == 0 && !ControlManager.CurrentView.CustomizeEnabled) { this.Visible = false; return; } else { this.Visible = true; } ArrayList BlockMenuItemList = new ArrayList(); tbView.ClearBlockMenu(); BlockMenuItemList.Add(new BlockMenuItem("<img alt='' src='" + path_img + "Layouts/Images/Menu/Icons/move.gif' border='0' width='16' height='16' align='absmiddle' title='" + LocRM.GetString("tMove") + "'/> ", LocRM.GetString("tMove"), "CP_Move('" + txtActiveElement.ClientID + "','" + this.ID + "','" + this.ClientID + "','" + tbView.MainDivClientID + "')", "")); BlockMenuItemList.Add(new BlockMenuItem("<img alt='' src='" + path_img + "Layouts/Images/Menu/Icons/info.gif' border='0' width='16' height='16' align='absmiddle' title='" + LocRM.GetString("tProperties") + "'/> ", LocRM.GetString("tProperties"), "CP_Properties('" + propertypageurl + "','" + ControlManager.CurrentView.Id + "','" + this.ID + "','" + txtActiveElement.ClientID + "')", "")); BlockMenuItemList.Add(new BlockMenuItem("<img alt='' src='" + path_img + "Layouts/Images/Menu/Icons/hide.gif' border='0' width='16' height='16' align='absmiddle' title='" + LocRM.GetString("tDelete") + "'/> ", LocRM.GetString("tDelete"), "if(confirm('" + LocRM.GetString("tWarningControl") + "')){CP_Hide('" + txtHideSubmit.ClientID + "','" + txtActiveElement.ClientID + "');" + Page.ClientScript.GetPostBackEventReference(HideSubmit, "") + "}", "")); tbView.AddBlockMenu(tbView.MainDivClientID, BlockMenuItemList); if (!ControlManager.CurrentView.CustomizeEnabled) { tbView.Visible = false; } //tbView.AddBlockMenu(" <img alt='' src='Layouts/Images/Menu/downbtn.gif' border='0' width=9 height=5 align='absmiddle' /> " + "", "_divIncGen01", BlockMenuItemList); if (!Page.ClientScript.IsClientScriptBlockRegistered("PlaceControlScript")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PlaceControlScript", "<link href='" + path_img + "Layouts/Styles/menuStyle.css' type='text/css' rel='stylesheet'/><script type='text/javascript' src='" + path_img + "Scripts/ControlPlace.js'></script>"); } }