コード例 #1
0
ファイル: OrderView.xaml.cs プロジェクト: JuRogn/OA
        void OrderView_FBBasePageLoaded(object sender, EventArgs e)
        {

            string typeName = this.Type;

            if (typeName == "AuditOrder")
            {

                AuditOrder ao = new AuditOrder();
                ao.OrderType = typeName;
                ao.InitForm();
                this.LayoutRoot.Children.Add(ao);
                currentPart = ao as IWebPart;
            }
            else
            {
                CommonView commonView = new CommonView();
                Type type = CommonFunction.GetType(typeName, CommonFunction.TypeCategory.EntityObject);
                OrderEntity orderEntity = new OrderEntity(type);
                commonView.DefaultEntity = orderEntity;
                commonView.InitForm();
                this.LayoutRoot.Children.Add(commonView);
                currentPart = commonView as IWebPart;
            }
        }
コード例 #2
0
 /// <summary>
 /// Removes the supplied <see cref="IWebPart"/> from the system.
 /// </summary>
 /// <param name="webPart">The <see cref="IWebPart"/> to remove.</param>
 public void RemoveWebPart(IWebPart webPart)
 {
     if (this.ShouldProcess(webPart.WebPartName, "Remove the web part from Kentico."))
     {
         this.WebPartService.Delete(webPart);
     }
 }
コード例 #3
0
        /// <inheritdoc />
        protected override void ActOnObject(IWebPart webPart)
        {
            if (webPart == null)
            {
                return;
            }

            this.RemoveBusinessLayer.RemoveWebPart(webPart);
        }
コード例 #4
0
        public void ShouldCreateWebPartWithName()
        {
            IWebPart passedWebPart = null;

            var fileName    = "filename.acsx";
            var displayName = "Display Name";
            var name        = "WebPart";

            var webPartCategoryMock = new Mock <IWebPartCategory>();

            webPartCategoryMock
            .Setup(x => x.CategoryID)
            .Returns(66);

            var webPartMock = new Mock <IWebPart>();

            webPartMock
            .Setup(x => x.WebPartDisplayName)
            .Returns(displayName);
            webPartMock
            .Setup(x => x.WebPartFileName)
            .Returns(fileName);
            webPartMock
            .Setup(x => x.WebPartName)
            .Returns(name);

            var webPartServiceMock = new Mock <IWebPartService>();

            webPartServiceMock
            .Setup(x => x.Create(It.IsAny <IWebPart>()))
            .Callback <IWebPart>(x => passedWebPart = x)
            .Returns(webPartMock.Object);

            var businessLayer = new NewCMSWebPartBusiness
            {
                WebPartService = webPartServiceMock.Object,
                WriteDebug     = Assert.NotNull,
                WriteVerbose   = Assert.NotNull,
            };

            var results = businessLayer.CreateWebPart(name, fileName, displayName, webPartCategoryMock.Object);

            results
            .Should()
            .NotBeNull();

            results
            .Should().BeEquivalentTo(webPartMock.Object);

            passedWebPart.WebPartDisplayName.Should().Be(displayName);
            passedWebPart.WebPartFileName.Should().Be(fileName);
            passedWebPart.WebPartName.Should().Be(name);
            passedWebPart.WebPartCategoryID.Should().Be(66);
        }
コード例 #5
0
        private WebUI.WebParts.GenericSilverlightWithOrgUnit GetSilverlightWebPart()
        {
            WebUI.WebParts.GenericSilverlightWithOrgUnit silverlightWebPart = null;

            if (this.WebPartToEdit.Controls.Count > 0)
            {
                IWebPart webPart = (IWebPart)this.WebPartToEdit as IWebPart;
                silverlightWebPart = this.WebPartToEdit.Controls[0] as WebUI.WebParts.GenericSilverlightWithOrgUnit;
            }

            return(silverlightWebPart);
        }
コード例 #6
0
        /// <summary>
        /// Toggles the editor zone.
        /// </summary>
        /// <param name="webPart">The selected portlet.</param>
        /// <param name="page">Running Page instance.</param>
        internal static void ToggleEditorZone(IWebPart webPart, System.Web.UI.Page page)
        {
            var wpm = WebPartManager.GetCurrentWebPartManager(page);

            if (wpm == null)
            {
                return;
            }

            var mode             = wpm.DisplayMode;
            var selectedWebPart  = wpm.SelectedWebPart;
            var displaySidePanel = ((mode == WebPartManager.EditDisplayMode && selectedWebPart != null) || (mode == WebPartManager.CatalogDisplayMode) || (mode == WebPartManager.ConnectDisplayMode && selectedWebPart != null));

            if (!displaySidePanel)
            {
                return;
            }
            if (webPart == null)
            {
                return;
            }

            //var toolPanel = page.Master.FindControl("sndlgToolPanel") as HtmlGenericControl;
            var toolPanel = page.Master.FindControl("snToolPanel") as HtmlGenericControl;

            if (toolPanel == null)
            {
                throw new ApplicationException("sndlgToolPanel element does not exist in the MasterPage.");
            }

            string webPartName = string.Empty;
            var    portletBase = webPart as PortletBase;

            if (portletBase != null)
            {
                webPartName = portletBase.Name;
            }
            var webPartTypeName = webPart.GetType().Name;
            var title           = String.Format("{0} portlet properties ({1})", webPartName, webPartTypeName);
            //var callback = String.Format(@"SN.PortalRemoteControl.showDialog('{0}', {{ autoOpen: true, width: 550, height:600, minWidth: 500, minHeight: 550, resize: SN.PortalRemoteControl.ResizePortletEditorAccordion, title:'{1}' }});", toolPanel.ClientID, title);
            var callback   = String.Format(@"SN.PortalRemoteControl.showDialog('{0}', {{ autoOpen: true, width: 850, height:600, minWidth: 800, minHeight: 550, resize: SN.PortalRemoteControl.ResizePortletEditorAccordion }});", toolPanel.ClientID);
            var editorZone = page.Master.FindControlRecursive("EditorZone_Editor") as CollapsibleEditorZone;

            if (editorZone != null)
            {
                var p = page.ClientScript.GetPostBackEventReference(editorZone, "cancel");
                callback = String.Format(
                    @"SN.PortalRemoteControl.showDialog('{0}', {{ autoOpen: true, width: 850, height:600, minWidth: 800, minHeight: 550, resize: SN.PortalRemoteControl.ResizePortletEditorAccordion, title:'{1}', close: function(event,ui) {{ {2}; }} }} );",
                    toolPanel.ClientID, title, p);
            }

            UITools.RegisterStartupScript("PropertyGridEditorShow", callback, page);
        }
コード例 #7
0
        private void SaveFormUpdates(IWebPart webPart)
        {
            var webPartInfo = WebPartInfoProvider.GetWebPartInfo(webPart.WebPartID);

            if (webPartInfo == null)
            {
                return;
            }

            webPartInfo.WebPartProperties = webPart.WebPartProperties;

            WebPartInfoProvider.SetWebPartInfo(webPartInfo);
        }
コード例 #8
0
        public static IHtmlString Render(IWebPart webPart, params string[] paths)
        {
            if (webPart == null)
            {
                return(Styles.Render(paths));
            }

            string[] tmp = new string[paths.Length];
            for (int i = 0; i < paths.Length; i++)
            {
                tmp[i] = webPart.MapPath(paths[i]);
            }
            return(Styles.Render(tmp));
        }
コード例 #9
0
        private FormFieldInfo AppendWebPart(FormFieldInfo formFieldInfo, IWebPart webPart)
        {
            var options = new ProxyGenerationOptions();

            options.AddMixinInstance(new WebPartHolder
            {
                WebPart = webPart,
            });

            var result = this.proxyGenerator.CreateClassProxyWithTarget(formFieldInfo, options);

            ((IWebPartHolder)result).WebPart = webPart;

            return(result as FormFieldInfo);
        }
コード例 #10
0
        /// <inheritdoc />
        public IWebPart Create(IWebPart webPart)
        {
            var webPartInfo = new WebPartInfo
            {
                WebPartCategoryID  = webPart.WebPartCategoryID,
                WebPartFileName    = webPart.WebPartFileName,
                WebPartDisplayName = webPart.WebPartDisplayName,
                WebPartName        = webPart.WebPartName,
                WebPartProperties  = FormInfo.GetEmptyFormDocument().OuterXml,
            };

            WebPartInfoProvider.SetWebPartInfo(webPartInfo);

            return(webPartInfo.ActLike <IWebPart>());
        }
コード例 #11
0
        /// <inheritdoc />
        public void Update(IWebPart webPart)
        {
            var webPartInfo = WebPartInfoProvider.GetWebPartInfo(webPart.WebPartID);

            if (webPartInfo == null)
            {
                return;
            }

            webPartInfo.WebPartCategoryID  = webPart.WebPartCategoryID;
            webPartInfo.WebPartDisplayName = webPart.WebPartDisplayName;
            webPartInfo.WebPartFileName    = webPart.WebPartFileName;
            webPartInfo.WebPartName        = webPart.WebPartName;
            webPartInfo.WebPartProperties  = webPart.WebPartProperties;

            WebPartInfoProvider.SetWebPartInfo(webPartInfo);
        }
コード例 #12
0
        /// <devdoc>
        /// Intializes an instance of GenericWebPart with the control it is to wrap.
        /// </devdoc>
        protected internal GenericWebPart(Control control) {
            if (control == null) {
                throw new ArgumentNullException("control");
            }
            if (control is WebPart) {
                throw new ArgumentException(SR.GetString(SR.GenericWebPart_CannotWrapWebPart), "control");
            }
            if (control is BasePartialCachingControl) {
                throw new ArgumentException(SR.GetString(SR.GenericWebPart_CannotWrapOutputCachedControl), "control");
            }
            if (String.IsNullOrEmpty(control.ID)) {
                throw new ArgumentException(SR.GetString(SR.GenericWebPart_NoID, control.GetType().FullName));
            }

            ID = IDPrefix + control.ID;
            _childControl = control;
            _childIWebPart = _childControl as IWebPart;
            CopyChildAttributes();
        }
コード例 #13
0
        /// <inheritdoc />
        protected override void ProcessRecord()
        {
            IEnumerable <IWebPart> webparts = null;

            switch (this.ParameterSetName)
            {
            case CATEGORY:
                webparts = this.BusinessLayer.GetWebPartsByCategory(this.WebPartCategory.ActLike <IWebPartCategory>());
                break;

            case CATEGORYNAME:
                webparts = this.BusinessLayer.GetWebPartsByCategories(this.CategoryName, this.RegularExpression.ToBool());
                break;

            case FIELD:
                webparts = new IWebPart[]
                {
                    this.BusinessLayer.GetWebPart(this.Field.ActLike <IWebPartField>()),
                };
                break;

            case NAME:
                webparts = this.BusinessLayer.GetWebParts(this.WebPartName, this.RegularExpression.ToBool());
                break;

            case PATH:
                webparts = new IWebPart[]
                {
                    this.BusinessLayer.GetWebPart(this.WebPartPath),
                };
                break;

            case NONE:
                webparts = this.BusinessLayer.GetWebParts();
                break;
            }

            foreach (var webpart in webparts)
            {
                this.ActOnObject(webpart);
            }
        }
コード例 #14
0
        /// <inheritdoc />
        protected override void ProcessRecord()
        {
            IWebPart webPart = null;

            switch (this.ParameterSetName)
            {
            case PATH:
                webPart = this.BusinessLayer.CreateWebPart(this.Path, this.FileName, this.DisplayName);
                break;

            case CATEGORY:
                webPart = this.BusinessLayer.CreateWebPart(this.Name, this.FileName, this.DisplayName, this.WebPartCategory.ActLike <IWebPartCategory>());
                break;
            }

            if (this.PassThru.ToBool())
            {
                this.WriteObject(webPart.UndoActLike());
            }
        }
コード例 #15
0
        /// <summary>
        /// Adds a field to the specified <see cref="IWebPart"/>.
        /// </summary>
        /// <param name="addFieldParameter">Holds the parameters used to create the field.</param>
        /// <param name="webPart">The <see cref="IWebPart"/> to add the field to.</param>
        /// <returns>The <see cref="IWebPartField"/> that was added to the <see cref="IWebPart"/>.</returns>
        public IWebPartField AddField(AddFieldParameter addFieldParameter, IWebPart webPart)
        {
            var dataType = typeof(FieldDataType).GetMember(addFieldParameter.ColumnType.ToString())
                           .Single()
                           .GetCustomAttributes(typeof(ValueAttribute), false)
                           .Select(x => x as ValueAttribute)
                           .Single()
                           .Value;

            var field = new Field
            {
                AllowEmpty   = !addFieldParameter.Required,
                Caption      = addFieldParameter.Caption,
                DataType     = dataType,
                DefaultValue = addFieldParameter.DefaultValue?.ToString(),
                Name         = addFieldParameter.Name,
                Size         = addFieldParameter.Size,
            };

            return(this.WebPartService.AddField(field, webPart));
        }
コード例 #16
0
        /// <inheritdoc />
        public IWebPartField AddField(IWebPartField field, IWebPart webPart)
        {
            var formInfo  = new FormInfo(webPart.WebPartProperties);
            var fieldInfo = new FormFieldInfo
            {
                AllowEmpty   = field.AllowEmpty,
                Caption      = field.Caption,
                DataType     = field.DataType,
                DefaultValue = field.DefaultValue,
                Name         = field.Name,
                Size         = field.Size,
            };

            formInfo.AddFormItem(fieldInfo);

            webPart.WebPartProperties = formInfo.GetXmlDefinition();

            this.SaveFormUpdates(webPart);

            return(this.AppendWebPart(fieldInfo, webPart).ActLike <IWebPartField>());
        }
コード例 #17
0
 protected internal GenericWebPart(Control control)
 {
     if (control == null)
     {
         throw new ArgumentNullException("control");
     }
     if (control is WebPart)
     {
         throw new ArgumentException(System.Web.SR.GetString("GenericWebPart_CannotWrapWebPart"), "control");
     }
     if (control is BasePartialCachingControl)
     {
         throw new ArgumentException(System.Web.SR.GetString("GenericWebPart_CannotWrapOutputCachedControl"), "control");
     }
     if (string.IsNullOrEmpty(control.ID))
     {
         throw new ArgumentException(System.Web.SR.GetString("GenericWebPart_NoID", new object[] { control.GetType().FullName }));
     }
     this.ID = "gwp" + control.ID;
     this._childControl = control;
     this._childIWebPart = this._childControl as IWebPart;
     this.CopyChildAttributes();
 }
コード例 #18
0
 protected internal GenericWebPart(Control control)
 {
     if (control == null)
     {
         throw new ArgumentNullException("control");
     }
     if (control is WebPart)
     {
         throw new ArgumentException(System.Web.SR.GetString("GenericWebPart_CannotWrapWebPart"), "control");
     }
     if (control is BasePartialCachingControl)
     {
         throw new ArgumentException(System.Web.SR.GetString("GenericWebPart_CannotWrapOutputCachedControl"), "control");
     }
     if (string.IsNullOrEmpty(control.ID))
     {
         throw new ArgumentException(System.Web.SR.GetString("GenericWebPart_NoID", new object[] { control.GetType().FullName }));
     }
     this.ID             = "gwp" + control.ID;
     this._childControl  = control;
     this._childIWebPart = this._childControl as IWebPart;
     this.CopyChildAttributes();
 }
コード例 #19
0
ファイル: OrderView.xaml.cs プロジェクト: jjg0519/OA
        void OrderView_FBBasePageLoaded(object sender, EventArgs e)
        {
            string typeName = this.Type;

            if (typeName == "AuditOrder")
            {
                AuditOrder ao = new AuditOrder();
                ao.OrderType = typeName;
                ao.InitForm();
                this.LayoutRoot.Children.Add(ao);
                currentPart = ao as IWebPart;
            }
            else
            {
                CommonView  commonView  = new CommonView();
                Type        type        = CommonFunction.GetType(typeName, CommonFunction.TypeCategory.EntityObject);
                OrderEntity orderEntity = new OrderEntity(type);
                commonView.DefaultEntity = orderEntity;
                commonView.InitForm();
                this.LayoutRoot.Children.Add(commonView);
                currentPart = commonView as IWebPart;
            }
        }
コード例 #20
0
ファイル: GenericWebPart.cs プロジェクト: dox0/DotNet471RS3
        /// <devdoc>
        /// Intializes an instance of GenericWebPart with the control it is to wrap.
        /// </devdoc>
        protected internal GenericWebPart(Control control)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }
            if (control is WebPart)
            {
                throw new ArgumentException(SR.GetString(SR.GenericWebPart_CannotWrapWebPart), "control");
            }
            if (control is BasePartialCachingControl)
            {
                throw new ArgumentException(SR.GetString(SR.GenericWebPart_CannotWrapOutputCachedControl), "control");
            }
            if (String.IsNullOrEmpty(control.ID))
            {
                throw new ArgumentException(SR.GetString(SR.GenericWebPart_NoID, control.GetType().FullName));
            }

            ID             = IDPrefix + control.ID;
            _childControl  = control;
            _childIWebPart = _childControl as IWebPart;
            CopyChildAttributes();
        }
コード例 #21
0
ファイル: WebPartHost.xaml.cs プロジェクト: jjg0519/OA
        //modify by 安凯航.2011年9月5日
        //如果radtileview有值则表示不进行初始化
        private void LoadWebPartData()
        {
            if (radtileview == null)
            {
                radtileview = new DragDockPanelHost();

                DragDockPanel item2 = new DragDockPanel();
                item2.Header  = "待办任务";
                item2.Content = new SMT.SAAS.Platform.WebParts.Views.PendingTask();
                IWebPart currentContent = item2.Content as IWebPart;
                item2.Maximized += (obj, args) =>
                {
                    currentContent.ShowMaxiWebPart();
                };
                item2.Minimized += (obj1, args1) =>
                {
                    currentContent.ShowMiniWebPart();
                };
                item2.PanelState = PanelState.Maximized;
                //currentContent.OnMoreChanged += (obj3, arg3) =>
                //{
                //    item2.PanelState = PanelState.Maximized;
                //};
                item2.Style = Application.Current.Resources["WebPartDragDockPanelStyle1"] as Style;
                radtileview.AddPanel(item2);

                DragDockPanel item5 = new DragDockPanel();
                item5.Header  = "我的单据";
                item5.Content = new SMT.SAAS.Platform.WebParts.Views.MyRecord();

                currentContent   = item5.Content as SMT.SaaS.Platform.IWebPart;
                item5.Maximized += (obj, args) =>
                {
                    currentContent.ShowMaxiWebPart();
                };
                item5.Minimized += (obj1, args1) =>
                {
                    currentContent.ShowMiniWebPart();
                };
                //currentContent.OnMoreChanged += (obj3, arg3) =>
                //{
                //    item5.PanelState = PanelState.Minimized;
                //};
                item5.Style = Application.Current.Resources["WebPartDragDockPanelStyle1"] as Style;

                radtileview.AddPanel(item5);

                //RadTileViewItem item3 = new RadTileViewItem();
                //item3.TileState = TileViewItemState.Minimized;
                //item3.Header = "消息提醒";
                //item3.Content = new SMT.SAAS.Platform.WebParts.Views.NoteRemind();
                //radtileview.Items.Add(item3);

                DragDockPanel item4 = new DragDockPanel();
                item4.Header  = "新闻动态";
                item4.Content = new SMT.SAAS.Platform.WebParts.Views.News();

                currentContent   = item4.Content as SMT.SaaS.Platform.IWebPart;
                item4.Maximized += (obj, args) =>
                {
                    currentContent.ShowMaxiWebPart();
                };
                item4.Minimized += (obj1, args1) =>
                {
                    currentContent.ShowMiniWebPart();
                };
                //currentContent.OnMoreChanged += (obj3, arg3) =>
                //{
                //    item4.PanelState = PanelState.Minimized;
                //};
                item4.Style = Application.Current.Resources["WebPartDragDockPanelStyle1"] as Style;

                radtileview.AddPanel(item4);

                //CheckeDepends("SMT.SaaS.OA.UI");
                DragDockPanel item6 = new DragDockPanel();
                //item6.TileState = TileViewItemState.Minimized;
                item6.Header  = "公司发文";
                item6.Content = new SMT.SAAS.Platform.WebParts.Views.OAWebPart();

                currentContent   = item6.Content as SMT.SaaS.Platform.IWebPart;
                item6.Maximized += (obj, args) =>
                {
                    currentContent.ShowMaxiWebPart();
                };
                item6.Minimized += (obj1, args1) =>
                {
                    currentContent.ShowMiniWebPart();
                };
                //currentContent.OnMoreChanged += (obj3, arg3) =>
                //{
                //    item6.PanelState = PanelState.Minimized;
                //};
                item6.Style = Application.Current.Resources["WebPartDragDockPanelStyle1"] as Style;

                radtileview.AddPanel(item6);

                Root.Children.Add(radtileview);
            }
            else
            {
                foreach (DragDockPanel item in radtileview.Children)
                {
                    IWebpart webPart = item.Content as IWebpart;
                    if (webPart != null)
                    {
                        webPart.Initialize();
                    }
                }
            }
        }
コード例 #22
0
 /// <summary>
 /// Gets a list of the <see cref="IWebPartField"/> associated with a <see cref="IWebPart"/>.
 /// </summary>
 /// <param name="webPart">The <see cref="IWebPart"/> to get the list <see cref="IWebPartField"/> for.</param>
 /// <returns>A list of <see cref="IWebPartField"/> associated with the <see cref="IWebPart"/>.</returns>
 public IEnumerable <IWebPartField> GetWebPartFields(IWebPart webPart) =>
 this.WebPartService.GetWebPartFields(webPart);
コード例 #23
0
 public WebPartStyleBundle(IWebPart webPart, string virtualPath, string cdnPath)
     : base(webPart == null ? virtualPath : webPart.MapPath(virtualPath), cdnPath)
 {
     this.webPart = webPart;
 }
コード例 #24
0
        /// <summary>
        /// Gets a list of the <see cref="IWebPartField"/> associated with a <see cref="IWebPart"/> which match the supplied criteria.
        /// </summary>
        /// <param name="matchString">The string which to match the webpart fields to.</param>
        /// <param name="isRegex">Indicates whether <paramref name="matchString"/> is a regular expression.</param>
        /// <param name="webPart">The <see cref="IWebPart"/> to get the list <see cref="IWebPartField"/> for.</param>
        /// <returns>A list of <see cref="IWebPartField"/> associated with the <see cref="IWebPart"/> which match the supplied criteria.</returns>
        public IEnumerable <IWebPartField> GetWebPartFields(string matchString, bool isRegex, IWebPart webPart)
        {
            Regex regex = null;

            if (isRegex)
            {
                regex = new Regex(matchString, RegexOptions.Compiled | RegexOptions.IgnoreCase);
            }
            else
            {
                regex = new Regex($"^{matchString.Replace("*", ".*")}$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
            }

            var matched = from f in this.GetWebPartFields(webPart)
                          where regex.IsMatch(f.Name) ||
                          regex.IsMatch(f.Caption ?? string.Empty)
                          select f;

            return(matched.ToArray());
        }
コード例 #25
0
 /// <summary>
 /// Updates the <see cref="IWebPart"/> in the system.
 /// </summary>
 /// <param name="webPart">The <see cref="IWebPart"/> to update.</param>
 public void Set(IWebPart webPart)
 {
     this.WebPartService.Update(webPart);
 }
コード例 #26
0
 /// <inheritdoc />
 public IEnumerable <IWebPartField> GetWebPartFields(IWebPart webPart)
 => (from f in new FormInfo(webPart.WebPartProperties).GetFields <FormFieldInfo>()
     select this.AppendWebPart(f, webPart).ActLike <IWebPartField>()).ToArray();
コード例 #27
0
 /// <summary>
 /// When overridden in a child class, operates on the specified web part.
 /// </summary>
 /// <param name="webPart">The web part to operate on.</param>
 protected virtual void ActOnObject(IWebPart webPart)
 {
     this.WriteObject(webPart?.UndoActLike());
 }
コード例 #28
0
        /// <summary>
        /// Toggles the editor zone.
        /// </summary>
        /// <param name="webPart">The selected portlet.</param>
        /// <param name="page">Running Page instance.</param>
        internal static void ToggleEditorZone(IWebPart webPart, System.Web.UI.Page page)
        {
            var wpm = WebPartManager.GetCurrentWebPartManager(page);
            if (wpm == null)
                return;

            var mode = wpm.DisplayMode;
            var selectedWebPart = wpm.SelectedWebPart;
            var displaySidePanel = ((mode == WebPartManager.EditDisplayMode && selectedWebPart != null) || (mode == WebPartManager.CatalogDisplayMode) || (mode == WebPartManager.ConnectDisplayMode && selectedWebPart != null));

            if (!displaySidePanel)
                return;
            if (webPart == null)
                return;

            //var toolPanel = page.Master.FindControl("sndlgToolPanel") as HtmlGenericControl;
            var toolPanel = page.Master.FindControl("snToolPanel") as HtmlGenericControl;
            if (toolPanel == null)
                throw new ApplicationException("sndlgToolPanel element does not exist in the MasterPage.");

            string webPartName = string.Empty;
            var portletBase = webPart as PortletBase;
            if (portletBase != null)
                webPartName = portletBase.Name;
            var webPartTypeName = webPart.GetType().Name;
            var title = String.Format("{0} portlet properties ({1})", webPartName, webPartTypeName);
            //var callback = String.Format(@"SN.PortalRemoteControl.showDialog('{0}', {{ autoOpen: true, width: 550, height:600, minWidth: 500, minHeight: 550, resize: SN.PortalRemoteControl.ResizePortletEditorAccordion, title:'{1}' }});", toolPanel.ClientID, title);
            var callback = String.Format(@"SN.PortalRemoteControl.showDialog('{0}', {{ autoOpen: true, width: 850, height:600, minWidth: 800, minHeight: 550, resize: SN.PortalRemoteControl.ResizePortletEditorAccordion }});", toolPanel.ClientID);
            var editorZone = page.Master.FindControlRecursive("EditorZone_Editor") as CollapsibleEditorZone;
            if (editorZone != null)
            {
                var p = page.ClientScript.GetPostBackEventReference(editorZone, "cancel");
                callback = String.Format(
                    @"SN.PortalRemoteControl.showDialog('{0}', {{ autoOpen: true, width: 850, height:600, minWidth: 800, minHeight: 550, resize: SN.PortalRemoteControl.ResizePortletEditorAccordion, title:'{1}', close: function(event,ui) {{ {2}; }} }} );",
                    toolPanel.ClientID, title, p);
            }

            UITools.RegisterStartupScript("PropertyGridEditorShow", callback , page);
        }
コード例 #29
0
 /// <inheritdoc />
 public void Delete(IWebPart webPart) =>
 WebPartInfoProvider.DeleteWebPartInfo(webPart.WebPartID);
コード例 #30
0
 public WebPartScriptBundle(IWebPart webPart, string virtualPath)
     : base(webPart == null ? virtualPath : webPart.MapPath(virtualPath))
 {
     this.webPart = webPart;
 }
コード例 #31
0
 /// <summary>
 /// Gets the web part category for the current web part.
 /// </summary>
 /// <param name="webpart">The webpart to get the category for.</param>
 /// <returns>The web part category.</returns>
 public IWebPartCategory GetWebPartCategory(IWebPart webpart) =>
 (from c in this.WebPartService.WebPartCategories
      where c.CategoryID == webpart.WebPartCategoryID
  select c).SingleOrDefault();