Ejemplo n.º 1
0
        private string ProcessPageText(SPSite site, SPList list, String pageText)
        {
            pageText = pageText.Replace("<h5>", "<h2>");
            pageText = pageText.Replace("</h5>", "</h2>");


            List <String> referencedURLs = WBUtils.GetReferencedURLs(pageText);

            foreach (String referencedURL in referencedURLs)
            {
                string withTrailing = WBUtils.EnsureHasHostHeader("http://izzi/", referencedURL);
                withTrailing = WBUtils.EnsureTrailingForwardSlash(withTrailing);

                SPListItem mappedPage = WBUtils.FindItemByColumn(site, list, RemotePageURLColumn, withTrailing);

                if (mappedPage == null)
                {
                    string withoutTrailing = WBUtils.EnsureNoTrailingForwardSlash(withTrailing);
                    mappedPage = WBUtils.FindItemByColumn(site, list, RemotePageURLColumn, withoutTrailing);
                }

                if (mappedPage != null)
                {
                    string newURLToUse = mappedPage.WBxGetColumnAsString(LOCAL_PAGE_URL);

                    if (newURLToUse == "")
                    {
                        string mappedPageNewLogicalLocation = mappedPage.WBxGetColumnAsString(NEW_LOGICAL_LOCATION);
                        string mappedPageSiteOrPage         = mappedPage.WBxGetColumnAsString(SITE_OR_PAGE);

                        newURLToUse = MakeLocalPageURL(mappedPageNewLogicalLocation, mappedPageSiteOrPage);
                    }

                    newURLToUse = WBUtils.GetURLWithoutHostHeader(newURLToUse);

                    WBLogging.Migration.Verbose("Replacing URL -> URL: " + referencedURL + " -> " + newURLToUse);

                    pageText = pageText.Replace(referencedURL, newURLToUse);
                }
                else
                {
                    WBLogging.Migration.Verbose("NOT Replacing URL: " + referencedURL);
                }
            }

            return(pageText);
        }