Beispiel #1
0
        // Tools ///////////////////////////////////////////////////////////////////
		private void SaveNewPersonalizationSettings(SNP.Page page, PageState pageState)
        {
            string newSharedDataString = pageState.Encode();
            byte[] newSharedDataBlob = Convert.FromBase64String(newSharedDataString);

            page.PersonalizationSettings.SetStream(new MemoryStream(newSharedDataBlob));
            page.Save();
        }
Beispiel #2
0
		private void DeleteWebPart(string portletId, SNP.Page page)
        {
            BinaryData sharedDataBlobBinaryData = page.PersonalizationSettings;
            if (sharedDataBlobBinaryData == null)
            {
                Console.WriteLine(String.Format("{0} has no personalization data.", page.Path));
                return;
            }

            Console.WriteLine(page.Path);

            PageState pageState = GetPageState(sharedDataBlobBinaryData);
            if (pageState == null)
                return;

            pageState.DynamicParts.Remove(portletId);
            pageState.WebPartSettings.Remove(portletId);
            pageState.Locations.Remove(portletId);

            SaveNewPersonalizationSettings(page, pageState);
        }
Beispiel #3
0
		private void ListWebPartElements(string listType, SNP.Page page)
        {
            if (String.IsNullOrEmpty(listType))
                throw new ArgumentNullException("listType");
            if (page == null)
                throw new ArgumentNullException("page");


            //var page = Node.Load<Page>(pagePath);
            //if (page == null)
            //    throw new ApplicationException("{0} couldn't be loaded.");

            BinaryData sharedDataBlobBinaryData = page.PersonalizationSettings;
            if (sharedDataBlobBinaryData == null)
            {
                Console.WriteLine(String.Format("{0} has no personalization data.", page.Path));
                return;
            }
                

            Console.WriteLine(page.Path);

            PageState pageState = GetPageState(sharedDataBlobBinaryData);
            if (pageState == null)
                return;

            switch (listType)
            {
                case "all":
                    ListZones(pageState, true);
                    break;
                case "zones":
                    ListZones(pageState, false);
                    break;
                case "portlets":
                    ListWebParts(pageState);
                    break;
                default:
                    throw new NotSupportedException(String.Format("{0} listtype is not supported.", listType));
            }
        }
Beispiel #4
0
		private void MoveWebPart(string portletId, string zoneId, SNP.Page page)
        {
            BinaryData sharedDataBlobBinaryData = page.PersonalizationSettings;
            if (sharedDataBlobBinaryData == null)
            {
                Console.WriteLine(String.Format("{0} has no personalization data.", page.Path));
                return;
            }

            Console.WriteLine(page.Path);

            PageState pageState = GetPageState(sharedDataBlobBinaryData);
            if (pageState == null)
                return;

            pageState.Locations[portletId].ZoneID = zoneId;

            SaveNewPersonalizationSettings(page, pageState);
        }
 private string GetChangePasswordUrl(SNP.Page changePwdPage, string siteRepositoryPath)
 {
     string changePwdPageUrl;
     if (string.IsNullOrEmpty(changePwdPage.SmartUrl))
     {
         changePwdPageUrl = Configuration.ChangePasswordPagePath;
         changePwdPageUrl = changePwdPageUrl.Replace(VirtualPathUtility.AppendTrailingSlash(siteRepositoryPath), string.Empty);
     }
     else
         changePwdPageUrl = changePwdPage.SmartUrl;
     changePwdPageUrl = String.Concat(VirtualPathUtility.AppendTrailingSlash(PortalContext.Current.SiteUrl), changePwdPageUrl);
     return changePwdPageUrl;
 }