示例#1
0
    /// <summary>
    /// Returns the form definition for the web part zone properties.
    /// </summary>
    private FormInfo BuildFormInfo(WebPartZoneInstance webPartZone)
    {
        FormInfo fi = null;

        string formDefinition = String.Empty;

        // Dashboard zone properties
        if ((pti != null) && (pti.PageTemplateType == PageTemplateTypeEnum.Dashboard))
        {
            formDefinition = PortalFormHelper.LoadProperties("WebPartZone", "Dashboard.xml");
        }
        // UI page template properties
        else if ((pti != null) && (pti.PageTemplateType == PageTemplateTypeEnum.UI))
        {
            formDefinition = PortalFormHelper.LoadProperties("WebPartZone", "UI.xml");
        }
        // Classic web part/widget properties
        else
        {
            formDefinition = PortalFormHelper.LoadProperties("WebPartZone", "Standard.xml");
        }

        if (!String.IsNullOrEmpty(formDefinition))
        {
            // Load properties
            fi = new FormInfo(formDefinition);
            fi.UpdateExistingFields(fi);

            DataRow dr = fi.GetDataRow();
            LoadDataRowFromWebPartZone(dr, webPartZone);
        }

        return(fi);
    }
    /// <summary>
    /// Returns the form definition for the webpart zone properties.
    /// </summary>
    private FormInfo BuildFormInfo(WebPartZoneInstance webPartZone)
    {
        FormInfo fi = null;

        string formDefinition = String.Empty;

        // Dashboard zone properties
        if ((pti != null) && (pti.PageTemplateType == PageTemplateTypeEnum.Dashboard))
        {
            formDefinition = File.ReadAllText(Server.MapPath("~/CMSModules/PortalEngine/Controls/WebParts/WebPartZone_Dashboard_Properties.xml"));
        }
        // Classic webpart/widget properties
        else
        {
            formDefinition = File.ReadAllText(Server.MapPath("~/CMSModules/PortalEngine/Controls/WebParts/WebPartZone_Properties.xml"));
        }

        if (!String.IsNullOrEmpty(formDefinition))
        {
            // Load properties
            fi = new FormInfo(formDefinition);
            fi.UpdateExistingFields(fi);

            DataRow dr = fi.GetDataRow();
            LoadDataRowFromWebPartZone(dr, webPartZone);
        }

        return(fi);
    }
    /// <summary>
    /// Returns the form definition for the web part zone properties.
    /// </summary>
    private FormInfo BuildFormInfo(WebPartZoneInstance webPartZone)
    {
        FormInfo fi = null;

        string formDefinition = String.Empty;

        // Dashboard zone properties
        if ((pti != null) && (pti.PageTemplateType == PageTemplateTypeEnum.Dashboard))
        {
            formDefinition = PortalFormHelper.LoadProperties("WebPartZone", "Dashboard.xml");
        }
        // UI page template properties
        else if ((pti != null) && (pti.PageTemplateType == PageTemplateTypeEnum.UI))
        {
            formDefinition = PortalFormHelper.LoadProperties("WebPartZone", "UI.xml");
        }
        // Classic web part/widget properties
        else
        {
            formDefinition = PortalFormHelper.LoadProperties("WebPartZone", "Standard.xml");
        }

        if (!String.IsNullOrEmpty(formDefinition))
        {
            // Load properties
            fi = new FormInfo(formDefinition);
            fi.UpdateExistingFields(fi);

            DataRow dr = fi.GetDataRow();
            LoadDataRowFromWebPartZone(dr, webPartZone);
        }

        return fi;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string aliasPath = QueryHelper.GetString("aliaspath", "");
        string webpartId = QueryHelper.GetString("webpartid", "");
        string zoneId = QueryHelper.GetString("zoneid", "");
        Guid webpartGuid = QueryHelper.GetGuid("webpartguid", Guid.Empty);

        // Get page info
        PageInfo pi = PageInfoProvider.GetPageInfo(CMSContext.CurrentSiteName, aliasPath, CMSContext.PreferredCultureCode, null, CMSContext.CurrentSite.CombineWithDefaultCulture);
        if (pi != null)
        {
            // Get template
            PageTemplateInfo pti = pi.GetInheritedTemplateInfo(CMSContext.PreferredCultureCode, CMSContext.CurrentSite.CombineWithDefaultCulture);

            // Get web part
            WebPartInstance webPart = pti.GetWebPart(webpartGuid, webpartId);
            if (webPart != null)
            {
                StringBuilder sb = new StringBuilder();
                Hashtable properties = webPart.Properties;

                // Get the webpart object
                WebPartInfo wi = WebPartInfoProvider.GetWebPartInfo(webPart.WebPartType);
                if (wi != null)
                {
                    // Add the header
                    sb.Append("Webpart properties (" + wi.WebPartDisplayName + ")" + Environment.NewLine + Environment.NewLine);
                    sb.Append("Alias path: " + aliasPath + Environment.NewLine);
                    sb.Append("Zone ID: " + zoneId + Environment.NewLine + Environment.NewLine);

                    string wpProperties = "<default></default>";
                    // Get the form info object and load it with the data

                    if (wi.WebPartParentID > 0)
                    {
                        // Load parent properties
                        WebPartInfo wpi = WebPartInfoProvider.GetWebPartInfo(wi.WebPartParentID);
                        if (wpi != null)
                        {
                            wpProperties = wpi.WebPartProperties;
                        }
                    }
                    else
                    {
                        wpProperties = wi.WebPartProperties;
                    }

                    FormInfo fi = new FormInfo(wpProperties);

                    // General properties of webparts
                    string beforeFormDefinition = PortalHelper.GetWebPartProperties((WebPartTypeEnum)wi.WebPartType, PropertiesPosition.Before);
                    string afterFormDefinition = PortalHelper.GetWebPartProperties((WebPartTypeEnum)wi.WebPartType, PropertiesPosition.After);

                    // General properties before custom
                    if (!String.IsNullOrEmpty(beforeFormDefinition))
                    {
                        // Load before properties
                        FormInfo bfi = new FormInfo(beforeFormDefinition);
                        bfi.UpdateExistingFields(fi);
                        sb.Append(Environment.NewLine + "Default" + Environment.NewLine + Environment.NewLine + Environment.NewLine);
                        sb.Append(GetProperties(bfi.GetFormElements(true, false), webPart));
                    }

                    // Generate custom properties
                    sb.Append(GetProperties(fi.GetFormElements(true, false), webPart));

                    // General properties after custom
                    if (!String.IsNullOrEmpty(afterFormDefinition))
                    {
                        FormInfo afi = new FormInfo(afterFormDefinition);
                        // Load before properties
                        afi.UpdateExistingFields(fi);

                        sb.Append(GetProperties(afi.GetFormElements(true, false), webPart));
                    }

                    // Send the text file to the user to download
                    UTF8Encoding enc = new UTF8Encoding();
                    byte[] file = enc.GetBytes(sb.ToString());

                    Response.AddHeader("Content-disposition", "attachment; filename=webpartproperties_" + webPart.ControlID + ".txt");
                    Response.ContentType = "text/plain";
                    Response.BinaryWrite(file);

                    RequestHelper.EndResponse();
                }
            }
        }
    }
    /// <summary>
    /// Returns the form definition for the webpart zone properties.
    /// </summary>
    private FormInfo BuildFormInfo(WebPartZoneInstance webPartZone)
    {
        FormInfo fi = null;

        string formDefinition = String.Empty;

        // Dashboard zone properties
        if ((pti != null) && (pti.PageTemplateType == PageTemplateTypeEnum.Dashboard))
        {
            formDefinition = File.ReadAllText(Server.MapPath("~/CMSModules/PortalEngine/Controls/WebParts/WebPartZone_Dashboard_Properties.xml"));
        }
        // Classic webpart/widget properties
        else
        {
            formDefinition = File.ReadAllText(Server.MapPath("~/CMSModules/PortalEngine/Controls/WebParts/WebPartZone_Properties.xml"));
        }

        if (!String.IsNullOrEmpty(formDefinition))
        {
            // Load properties
            fi = new FormInfo(formDefinition);
            fi.UpdateExistingFields(fi);

            DataRow dr = fi.GetDataRow();
            LoadDataRowFromWebPartZone(dr, webPartZone);
        }

        return fi;
    }
示例#6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string aliasPath   = QueryHelper.GetString("aliaspath", "");
        string webpartId   = QueryHelper.GetString("webpartid", "");
        string zoneId      = QueryHelper.GetString("zoneid", "");
        Guid   webpartGuid = QueryHelper.GetGuid("webpartguid", Guid.Empty);

        // Get page info
        PageInfo pi = PageInfoProvider.GetPageInfo(CMSContext.CurrentSiteName, aliasPath, CMSContext.PreferredCultureCode, null, CMSContext.CurrentSite.CombineWithDefaultCulture);

        if (pi != null)
        {
            // Get template
            PageTemplateInfo pti = pi.GetInheritedTemplateInfo(CMSContext.PreferredCultureCode, CMSContext.CurrentSite.CombineWithDefaultCulture);

            // Get web part
            WebPartInstance webPart = pti.GetWebPart(webpartGuid, webpartId);
            if (webPart != null)
            {
                StringBuilder sb         = new StringBuilder();
                Hashtable     properties = webPart.Properties;

                // Get the webpart object
                WebPartInfo wi = WebPartInfoProvider.GetWebPartInfo(webPart.WebPartType);
                if (wi != null)
                {
                    // Add the header
                    sb.Append("Webpart properties (" + wi.WebPartDisplayName + ")" + Environment.NewLine + Environment.NewLine);
                    sb.Append("Alias path: " + aliasPath + Environment.NewLine);
                    sb.Append("Zone ID: " + zoneId + Environment.NewLine + Environment.NewLine);


                    string wpProperties = "<default></default>";
                    // Get the form info object and load it with the data

                    if (wi.WebPartParentID > 0)
                    {
                        // Load parent properties
                        WebPartInfo wpi = WebPartInfoProvider.GetWebPartInfo(wi.WebPartParentID);
                        if (wpi != null)
                        {
                            wpProperties = wpi.WebPartProperties;
                        }
                    }
                    else
                    {
                        wpProperties = wi.WebPartProperties;
                    }

                    FormInfo fi = new FormInfo(wpProperties);

                    // General properties of webparts
                    string beforeFormDefinition = PortalHelper.GetWebPartProperties((WebPartTypeEnum)wi.WebPartType, PropertiesPosition.Before);
                    string afterFormDefinition  = PortalHelper.GetWebPartProperties((WebPartTypeEnum)wi.WebPartType, PropertiesPosition.After);

                    // General properties before custom
                    if (!String.IsNullOrEmpty(beforeFormDefinition))
                    {
                        // Load before properties
                        FormInfo bfi = new FormInfo(beforeFormDefinition);
                        bfi.UpdateExistingFields(fi);
                        sb.Append(Environment.NewLine + "Default" + Environment.NewLine + Environment.NewLine + Environment.NewLine);
                        sb.Append(GetProperties(bfi.GetFormElements(true, false), webPart));
                    }

                    // Generate custom properties
                    sb.Append(GetProperties(fi.GetFormElements(true, false), webPart));

                    // General properties after custom
                    if (!String.IsNullOrEmpty(afterFormDefinition))
                    {
                        FormInfo afi = new FormInfo(afterFormDefinition);
                        // Load before properties
                        afi.UpdateExistingFields(fi);

                        sb.Append(GetProperties(afi.GetFormElements(true, false), webPart));
                    }

                    // Send the text file to the user to download
                    UTF8Encoding enc  = new UTF8Encoding();
                    byte[]       file = enc.GetBytes(sb.ToString());

                    Response.AddHeader("Content-disposition", "attachment; filename=webpartproperties_" + webPart.ControlID + ".txt");
                    Response.ContentType = "text/plain";
                    Response.BinaryWrite(file);

                    RequestHelper.EndResponse();
                }
            }
        }
    }