Beispiel #1
0
 public void AddToWebPartGallery(WebPartGalleryItem webPartGalleryItem)
 {
     base.AddObject("WebPartGallery", webPartGalleryItem);
 }
Beispiel #2
0
 public static WebPartGalleryItem CreateWebPartGalleryItem(int ID)
 {
     WebPartGalleryItem webPartGalleryItem = new WebPartGalleryItem();
     webPartGalleryItem.Id = ID;
     return webPartGalleryItem;
 }
Beispiel #3
0
        public override void AddItemToPage(System.Web.UI.WebControls.WebParts.WebPartZoneBase zone, int zoneIndex, WebPartGalleryItem item, string wpid)
        {
            if (zone == null)
            {
                throw new ArgumentNullException("zone");
            }
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            System.Web.UI.WebControls.WebParts.WebPart webPart = ((WebPartGalleryItemBase)item).Instantiate();

            /*
             * if (!item.IsSafeAgainstScript)
             * {
             *  SPWebPartManager currentWebPartManager = WebPartManager.GetCurrentWebPartManager(this.Page) as SPWebPartManager;
             *  if (!CanUserScript(SPContext.Current.Web))
             *  {
             *      currentWebPartManager.SafeForScriptingManager.ProcessAllowContributorScriptPropertiesRollback(webPart);
             *  }
             * }
             */
            if (!string.IsNullOrEmpty(wpid))
            {
                webPart.ID = wpid;
                webPart.TitleIconImageUrl = webPart.CatalogIconImageUrl;
                webPart.ChromeType        = PartChromeType.None;
            }

            this.AddItemToPage(zone, zoneIndex, webPart);
        }