protected void MainView() { if (ContentBlockId > 0) { Ektron.Cms.LibraryData libData = new LibraryData(); Ektron.Cms.API.Library lib = new Library(); libData = lib.GetLibraryItem(ContentBlockId); if (!ReferenceEquals(libData, null)) { string title = libData.Title; string strTooltip = ToolTip.Trim() == "" ? libData.Title : ToolTip.Trim(); string strHtml = string.Format(@"<img src=""{0}"" border=""{1}"" width=""{2}"" height=""{3}"" title=""{4}"" alt=""{5}""></img>", libData.FileName.Replace("//", "/"), ImageBorder, Width, Height, strTooltip, strTooltip); ltrImage.Text = strHtml; ltrImage.Visible = true; } phContent.Visible = true; phHelpText.Visible = false; } else { phContent.Visible = false; phHelpText.Visible = true; } if (!(_host == null || _host.IsEditable == false)) { divHelpText.Visible = true; } else { divHelpText.Visible = false; } }
void EditEvent(string settings) { try { string webserviceURL = sitePath + "/widgets/image/ImageHandler.ashx"; // Register JS JS.RegisterJSInclude(this, JS.ManagedScript.EktronJS); Ektron.Cms.API.JS.RegisterJSInclude(this, Ektron.Cms.API.JS.ManagedScript.EktronJQueryClueTipJS); JS.RegisterJSInclude(this, JS.ManagedScript.EktronScrollToJS); JS.RegisterJSInclude(this, sitePath + "/widgets/image/behavior.js", "ImageWidgetBehaviorJS"); JS.RegisterJSInclude(this, sitePath + "/widgets/image/Image.js", "ImageJS"); // Insert CSS Links Css.RegisterCss(this, sitePath + "/widgets/image/ImageStyle.css", "ImageWidgetCSS"); JS.RegisterJSBlock(this, "Ektron.PFWidgets.Image.webserviceURL = \"" + webserviceURL + "\"; Ektron.PFWidgets.Image.setupAll('" + uniqueId + "');", "EktronPFWidgetsImageInit" + this.ID); txtWidth.Text = Width; txtHeight.Text = Height; txtToolTip.Text = ToolTip; txtBorder.Text = ImageBorder.ToString(); ViewSet.SetActiveView(Edit); if (ContentBlockId > 0) { //load & set selected folder path Ektron.Cms.API.Library lib = new Library(); Ektron.Cms.LibraryData ld = lib.GetLibraryItem(ContentBlockId); if (!ReferenceEquals(ld, null)) { long folderid = ld.ParentId; txtSource.InnerText = ld.Title; hdnContentId.Value = ld.Id.ToString(); hdnFolderId.Value = folderid.ToString(); hdnFolderPath.Value = folderid.ToString(); while (folderid != 0) { folderid = _api.GetParentIdByFolderId(folderid); if (folderid > 0) hdnFolderPath.Value += "," + folderid.ToString(); } //this will open the properties tab in edit mode JS.RegisterJSBlock(this, "LoadPropertiesTab('" + uniqueId + "');", "LoadPropertiesTab" + this.ID); } } } catch (Exception e) { errorLb.Text = e.Message + e.Data + e.StackTrace + e.Source + e.ToString(); _host.Title = _host.Title + " error"; ViewSet.SetActiveView(View); } }