Example #1
0
        /// <summary>
        /// Display the homepage/mainpage. If no page has been tagged with the 'homepage' tag,
        /// then a dummy PageSummary is put in its place.
        /// </summary>
        public ActionResult Index()
        {
            PageManager manager = new PageManager();

            // Get the first locked homepage
            PageSummary summary = manager.FindByTag("homepage").FirstOrDefault(h => h.IsLocked);
            if (summary == null)
            {
                // Look for a none-locked page as a fallback
                summary = manager.FindByTag("homepage").FirstOrDefault();
            }

            if (summary == null)
            {
                summary = new PageSummary();
                summary.Title = SiteStrings.NoMainPage_Title;
                summary.Content = SiteStrings.NoMainPage_Label;
                summary.CreatedBy = "";
                summary.CreatedOn = DateTime.Now;
                summary.Tags = "homepage";
                summary.ModifiedOn = DateTime.Now;
                summary.ModifiedBy = "";
            }

            RoadkillContext.Current.Page = summary;
            return View(summary);
        }
        public ApplicationManager(ICapabilities capabilities, string baseUrl, string hubUrl)
        {
            Pages = new PageManager(capabilities, baseUrl, hubUrl);

            Auth = new LoginHelper(this);
            Navigator = new NavigationHelper(this);
        }
Example #3
0
        /// <summary>
        /// Displays the wiki page using the provided id.
        /// </summary>
        /// <param name="id">The page id</param>
        /// <param name="title">This parameter is passed in, but never used in queries.</param>
        /// <returns>A <see cref="PageSummary"/> to the Index view.</returns>
        /// <remarks>This action adds a "Last-Modified" header using the page's last modified date, if no user is currently logged in.</remarks>
        /// <exception cref="HttpNotFoundResult">Thrown if the page with the id cannot be found.</exception>
        public ActionResult Index(int? id, string title)
        {
            if (id == null || id < 1)
                return RedirectToAction("Index", "Home");

            PageManager manager = new PageManager();
            PageSummary summary = manager.Get(id.Value);

            if (summary == null)
                return new HttpNotFoundResult(string.Format("The page with id '{0}' could not be found", id));

            RoadkillContext.Current.Page = summary;

            // This is using RFC 1123, the header needs RFC 2822 but this gives the same date output
            if (!RoadkillContext.Current.IsLoggedIn)
            {
                Response.AddHeader("Last-Modified", summary.ModifiedOn.ToString("r"));
            }
            else
            {
                // Don't cache for logged in users
                Response.AddHeader("Last-Modified", DateTime.Now.ToString("r"));
            }

            return View(summary);
        }
Example #4
0
        /// <summary>
        /// Display the homepage/mainpage. If no page has been tagged with the 'homepage' tag,
        /// then a dummy PageSummary is put in its place.
        /// </summary>
        public ActionResult Index()
        {
            PageManager manager = new PageManager();

            // Get the first locked homepage
            PageSummary summary = manager.FindByTag("homepage").FirstOrDefault(h => h.IsLocked);
            if (summary == null)
            {
                // Look for a none-locked page as a fallback
                summary = manager.FindByTag("homepage").FirstOrDefault();
            }

            if (summary == null)
            {
                summary = new PageSummary();
                summary.Title = "You have no mainpage set";
                summary.Content = "To set a main page, create a page and assign the tag 'homepage' to it.";
                summary.CreatedBy = "";
                summary.CreatedOn = DateTime.Now;
                summary.Tags = "homepage";
                summary.ModifiedOn = DateTime.Now;
                summary.ModifiedBy = "";
            }

            RoadkillContext.Current.Page = summary;
            return View(summary);
        }
        /// <summary>
        /// Performs logic to get the property of 'pageToLookUp'. If a propertyName is passed then it looks for the property with that name,
        /// if not then it returns the first property it finds.
        /// </summary>
        /// <param name="pManager">The page manager</param>
        /// <param name="siteMapRootNodeId">The sitemaprootnodeid</param>
        /// <param name="pageToLookUp">The page to look up</param>
        /// <param name="propertyName">The property name</param>
        /// <param name="pfi">The list of fields</param>
        /// <returns></returns>
        public ControlProperty BuildFieldInfo(PageManager pManager, Guid siteMapRootNodeId, string pageToLookUp, string propertyName, List<PageFieldInfo> pfi)
        {
            ControlProperty controlProperty = null;
            var page = pManager.GetPageDataList().FirstOrDefault(p => p.NavigationNode.Title.GetString(p.NavigationNode.AvailableCultures[0], false) == pageToLookUp
                                                                 && p.NavigationNode.ParentId == siteMapRootNodeId
                                                                 && !p.NavigationNode.IsDeleted
                                                                 && p.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live);

            if (page != null)
            {
                foreach (var property in page.Controls[0].Properties.First(r => r.Name.ToLower() == "settings").ChildProperties.ToList())
                {
                    if (pfi.Any(a => a.FieldName == property.Name))
                        continue;

                    if (propertyName == "" || propertyName == property.Name)
                    {
                        controlProperty = property;
                        break;
                    }
                }
            }

            return controlProperty;
        }
        /// <summary>
        /// Gets the currnt page's preview version
        /// </summary>
        /// <param name="pageManager">The page manager</param>
        /// <param name="pageName">The current page name</param>
        /// <returns>The current page preview</returns>
        public PageDraft GetCurrentPagePreview(PageManager pageManager, string pageName)
        {
            var homePage = new PageData();

            foreach (var f in pageManager.GetPageDataList())
            {
                if (f.NavigationNode.Title.GetString(f.NavigationNode.AvailableCultures[0], false).ToLower() == pageName.ToLower()
                                                    && !f.NavigationNode.IsDeleted
                                                    && f.NavigationNode.ParentId == new Guid(System.Web.SiteMap.RootNode.Key))
                {
                    homePage = f;
                    break;
                }
            }

            if (homePage == null)
                return null;

            var homePagePreview = pageManager.GetPreview(homePage.NavigationNode.PageId);

            if (homePagePreview == null)
                return null;

            if (homePagePreview.Controls[0].Properties.FirstOrDefault(r => r.Name == "Settings") == null)
                return null;

            return homePagePreview;
        }
        public void AddList(ListItemInfo list)
        {
            try
            {
                list.Name = list.Name.Trim();

                ObjectPersistence persistence = new ObjectPersistence(DbAccess);
                Criteria cri = new Criteria();
                cri.Add(Expression.Equal("Name", list.Name));
                if (!string.IsNullOrEmpty(list.Id))
                {
                    cri.Add(Expression.NotEqual("Id", list.Id));
                }
                IList<ListItemInfo> tmpList = persistence.GetList<ListItemInfo>(cri);
                if (tmpList.Count > 0)
                {
                    throw new FacadeException("列表名称已经存在,请重新输入!");
                }
                ListItemEntity entity = new ListItemEntity();
                entity.Name = list.Name;
                PageManager manager = new PageManager(DbAccess);
                manager.AddEntity<ListItemEntity>(entity);
                list.Id = entity.Id;
            }
            catch (Exception ex)
            {
                throw HandleException("Page", "AddList - " + list.Name, ex);
            }
        }
Example #8
0
        public GridWindow()
        {
            InitializeComponent();

            _rowPageManager = new PageManager<string>(
                new HeaderProvider(RowCount, true),
                64,
                TimeSpan.FromMinutes(1.0),
                4);

            _columnPageManager = new PageManager<string>(
                new HeaderProvider(ColumnCount, true),
                64,
                TimeSpan.FromMinutes(1.0),
                4);

            _pageManager = new Page2DManager<GridItem>(
                new ItemsProvider(RowCount, ColumnCount),
                64,
                TimeSpan.FromMinutes(1.0),
                4);

            this.VGrid.ItemsSource = _dataSource = new DynamicGridDataSource(_pageManager);

            this.VGrid.RowHeaderSource = new DelegateList<PageItem<string>>(0, (i) => _rowPageManager.GetItem(i), _rowPageManager.Count);
            this.VGrid.ColumnHeaderSource = new DelegateList<PageItem<string>>(0, (i) => _columnPageManager.GetItem(i), _columnPageManager.Count);
        }
 protected void Page_Init(object sender, EventArgs e)
 {
     if ((SiteMapBase.GetCurrentProvider()).CurrentNode != null)
     {
         PageNode currentPage = new PageManager().GetPageNode(new Guid(SiteMapBase.GetCurrentProvider().CurrentNode.Key));
         this.currentURL = SiteMapBase.GetCurrentNode().GetUrl(Thread.CurrentThread.CurrentCulture).Replace("~", "");
     }
 }
Example #10
0
 public PublishingManager(IPageProvider provider, TextContentManager textContentManager,
     LocalPublishingQueueManager localPublishingQueueManager, RemotePublishingQueueManager remotePublishingQueueManager, PageManager pageManager, IPublishingLogProvider publishingLogProvider)
 {
     this._provider = provider;
     this._textContentManager = textContentManager;
     this._localPublishingQueueManager = localPublishingQueueManager;
     this._remotePublishingQueueManager = remotePublishingQueueManager;
     this._pageManager = pageManager;
     this._publishingLogProvider = publishingLogProvider;
 }
Example #11
0
        public ActionResult AllTagsAsJson()
        {
            PageManager manager = new PageManager();
            IEnumerable<TagSummary> tags = manager.AllTags();
            List<string> tagsArray = new List<string>();
            foreach (TagSummary summary in tags)
            {
                tagsArray.Add(summary.Name);
            }

            return Json(tagsArray, JsonRequestBehavior.AllowGet);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TemplateImporter" /> class.
        /// </summary>
        /// <param name="ZipFileName">Name of the zip file.</param>
        /// <param name="applicationPath">The application path.</param>
        public TemplateImporter(string ZipFileName, string applicationPath)
        {
            string uniqueExtension = DateTime.Now.ToFileTime().ToString();

            this.applicationPath = applicationPath;
            this.zipFileName = ZipFileName;

            this.templateExtractionFolder = string.Concat(applicationPath, "App_Data\\temp_", uniqueExtension, "\\");
            this.sitefinityTemplatesInstallationFolder = string.Concat(applicationPath, "App_Data\\Sitefinity\\WebsiteTemplates\\");

            pageManager = PageManager.GetManager();
            pageTemplate = pageManager.CreateTemplate();
            pageTemplate.Category = new Guid();
        }
Example #13
0
        /// <summary>
        /// Displays all pages for a particular user.
        /// </summary>
        /// <param name="id">The username</param>
        /// <param name="encoded">Whether the username paramter is Base64 encoded.</param>
        /// <returns>An <see cref="IEnumerable`PageSummary"/> as the model.</returns>
        public ActionResult ByUser(string id,bool? encoded)
        {
            // Usernames are base64 encoded by roadkill (to cater for usernames like domain\john).
            // However the URL also supports humanly-readable format, e.g. /ByUser/chris
            if (encoded == true)
            {
                id = id.FromBase64();
            }

            ViewData["Username"] = id;

            PageManager manager = new PageManager();
            return View(manager.AllPagesCreatedBy(id));
        }
Example #14
0
        public AppManager(ICapabilities capabilities, string baseUrl, string hubUrl)
        {
            Pages = new PageManager(capabilities, baseUrl, hubUrl);

            userHelper = new UserHelper(this);
            employeeHelper = new EmployeeHelper(this);
            timeoffHelper = new TimeOffHelper(this);
            imageHelper = new ImageHelper(this);
            screenHelper = new ScreenHelper(this);
            assetHelper = new AssetHelper(this);
            filterHelper = new FilterHelper(this);
            hiringHelper = new HiringHelper(this);
            emailHeper = new EmailHelper(this);
            kpiHelper = new KPIHelper(this);
            hintHelper = new HintHelper(this);
            commentHelper = new CommentHelper(this);
        }
Example #15
0
 private static PageDataViewModel GetPage()
 {
     var siteMapProvider = SiteMapBase.GetCurrentProvider();
     if (siteMapProvider != null && siteMapProvider.CurrentNode != null)
     {
         var pm = new PageManager();
         var pageNode = pm.GetPageNode(new Guid(siteMapProvider.CurrentNode.Key));
         var result = new PageDataViewModel()
         {
             Title = pageNode.Page.Title,
             Keywords = pageNode.Page.Keywords
         };
         return result;
     }
     else
     {
         return new PageDataViewModel();
     }
 }
Example #16
0
        public void AddHtml(HtmlItemFullInfo item)
        {
            try
            {
                HtmlItemEntity entity = new HtmlItemEntity();
                entity.Content = item.Content;
                entity.ItsListId = item.ItsListId;
                entity.Name = item.Name;
                entity.Title = item.Title;

                PageManager manager = new PageManager(DbAccess);
                manager.AddEntity<HtmlItemEntity>(entity);
                item.Id = entity.Id;
            }
            catch (Exception ex)
            {
                throw HandleException("Page", "AddHtml - " + item.Name, ex);
            }
        }
Example #17
0
        /// <summary>
        /// Creates a new Storage.
        /// </summary>
        /// <param name="path">A string containing information about storage location</param>
        public void CreateNew(string path)
        {
            CheckDisposed();

            if (PageManager == null)
            {
                throw new InvalidOperationException("Page manager is not set");
            }

            if (_isOpen)
            {
                throw new InvalidOperationException("Unable to create starage because this instance is using to operate with the other storage");
            }

            _path = path;
            FillInfo();
            WriteInfo();

            PageManager.CreateNewPageSpace();
            _isOpen = true;

            PageManager.Lock();
            try
            {
                PageManager.EnterAtomicOperation();

                Init();

                PageManager.ExitAtomicOperation();
                PageManager.EnterAtomicOperation();
            }
            finally
            {
                PageManager.Unlock();
            }
        }
Example #18
0
        private static int GetRealDropIndex(IPage draggedPage, Guid newParentPageId, int dropIndex)
        {
            if (dropIndex == 0)
            {
                return(0);
            }

            List <Guid> childPageIDs = PageManager.GetChildrenIDs(newParentPageId).ToList();

            // Removing pages that does not belong to the same locale
            using (new DataScope(draggedPage.DataSourceId.PublicationScope, draggedPage.DataSourceId.LocaleScope))
            {
                childPageIDs.RemoveAll(pageId => PageManager.GetPageById(pageId) == null);
            }

            if (childPageIDs.Count == 0)
            {
                return(0);
            }

            childPageIDs = childPageIDs.OrderBy(PageManager.GetLocalOrdering).ToList();

            return(PageManager.GetLocalOrdering(childPageIDs[Math.Min(childPageIDs.Count - 1, dropIndex - 1)]) + 1);
        }
Example #19
0
        public DocumentBuilder_Tests()
        {
            _jsonApiContextMock = new Mock <IJsonApiContext>();

            _options = new JsonApiOptions();

            _options.BuildContextGraph(builder =>
            {
                builder.AddResource <Model>("models");
            });

            _jsonApiContextMock
            .Setup(m => m.Options)
            .Returns(_options);

            _jsonApiContextMock
            .Setup(m => m.ContextGraph)
            .Returns(_options.ContextGraph);

            _jsonApiContextMock
            .Setup(m => m.MetaBuilder)
            .Returns(new MetaBuilder());

            _pageManager = new PageManager();
            _jsonApiContextMock
            .Setup(m => m.PageManager)
            .Returns(_pageManager);

            _jsonApiContextMock
            .Setup(m => m.BasePath)
            .Returns("localhost");

            _jsonApiContextMock
            .Setup(m => m.RequestEntity)
            .Returns(_options.ContextGraph.GetContextEntity(typeof(Model)));
        }
 public void OnClickNext()
 {
     yCount++;
     if (yCount == yokai.Length)
     {
         yCount = 0;
         UserData.IsShowedYokaiTutorial = true;
         PageManager.Show(PageType.YokaiGetPage);
         objYokai.SetActive(false);
         Invoke("ActiveYokaiGetPage", 1);
         return;
     }
     for (int i = 0; i < yokai.Length; i++)
     {
         if (i == yCount)
         {
             yokai [i].SetActive(true);
         }
         else
         {
             yokai [i].SetActive(false);
         }
     }
 }
Example #21
0
        private void treeSettingCategory_AfterSelect(object sender, TreeViewEventArgs e)
        {
            string select = treeSettingCategory.SelectedNode.Name;

            #region Program
            if (select.Equals("programDefault"))
            {
                settings.programs._default _default = new settings.programs._default();
                PageManager.SetPage(myPanel, _default);
            }
            else if (select.Equals("programFont"))
            {
                settings.programs.font _font = new settings.programs.font();
                _font.Parent = this;
                PageManager.SetPage(myPanel, _font);
            }
            #endregion

            #region Editer
            if (select.Equals("editDefault"))
            {
                settings.editers._default _default = new settings.editers._default();
                PageManager.SetPage(myPanel, _default);
            }
            else if (select.Equals("editImageTab"))
            {
                settings.editers.image _image = new settings.editers.image();
                PageManager.SetPage(myPanel, _image);
            }
            else if (select.Equals("editSoundTab"))
            {
                settings.editers.sound _sound = new settings.editers.sound();
                PageManager.SetPage(myPanel, _sound);
            }
            #endregion
        }
Example #22
0
        /// <summary>
        /// Gets the package from node identifier.
        /// </summary>
        /// <param name="nodeId">The node identifier.</param>
        /// <returns></returns>
        private string GetPackageFromNodeId(string nodeId)
        {
            Guid id;

            if (!Guid.TryParse(nodeId, out id))
            {
                return(null);
            }

            var pageManager = PageManager.GetManager();

            PageNode pageNode;

            using (new ElevatedModeRegion(pageManager))
            {
                pageNode = pageManager.GetPageNode(id);
            }

            var pageData = pageNode.GetPageData();

            if (pageData == null)
            {
                return(null);
            }

            if (SystemManager.IsDesignMode)
            {
                var draft = pageManager.GetPageDraft(pageData.Id);
                if (draft != null)
                {
                    return(draft.TemplateId != Guid.Empty ? this.GetPackageFromTemplateId(draft.TemplateId.ToString()) : null);
                }
            }

            return(this.GetPackageFromTemplate(pageData.Template));
        }
Example #23
0
        public void ModifyMenu(MenuItemInfo menu)
        {
            try
            {
                MenuItemEntity entity = new MenuItemEntity();
                entity.Id              = menu.Id;
                entity.Index           = menu.Index;
                entity.InnerId         = menu.InnerId;
                entity.IsInner         = menu.IsInner;
                entity.IsListType      = menu.IsListType;
                entity.IsOpenNewWindow = menu.IsOpenNewWindow;
                entity.Level           = menu.Level;
                entity.Name            = menu.Name;
                entity.OuterUrl        = menu.OuterUrl;
                entity.ParentId        = menu.ParentId;

                PageManager manager = new PageManager(DbAccess);
                manager.ModifyEntity <MenuItemEntity>(entity);
            }
            catch (Exception ex)
            {
                throw HandleException("Page", "AddMenu - " + menu.Name, ex);
            }
        }
        public void ContentBlockWidget_UnshareFunctionality()
        {
            string pageNamePrefix  = "ContentBlockPage";
            string pageTitlePrefix = "Content Block";
            string urlNamePrefix   = "content-block";
            int    pageIndex       = 1;
            var    contentManager  = ContentManager.GetManager();
            var    contentItem     = contentManager.GetContent()
                                     .Single(c => c.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && c.Title == ContentBlockTitle);

            var mvcProxy = new MvcControllerProxy();

            mvcProxy.ControllerName = typeof(ContentBlockController).FullName;
            var contentBlockController = new ContentBlockController();

            contentBlockController.Content         = ContentBlockContent;
            contentBlockController.SharedContentID = contentItem.Id;
            mvcProxy.Settings = new ControllerSettings(contentBlockController);

            var pageId = this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, pageIndex);

            PageContentGenerator.ModifyPageControl(
                pageId,
                c => c.ObjectType == mvcProxy.GetType().FullName,
                (c) =>
            {
                var manager            = PageManager.GetManager();
                mvcProxy               = manager.LoadControl(c) as MvcControllerProxy;
                contentBlockController = (ContentBlockController)mvcProxy.Controller;
                contentBlockController.SharedContentID = Guid.Empty;
                mvcProxy.Settings = new ControllerSettings(contentBlockController);
                manager.ReadProperties(mvcProxy, c);
            });

            Assert.AreEqual(0, contentManager.GetCountOfPagesThatUseContent(contentItem.Id));
        }
Example #25
0
        public static string GetPageUrl(string pageId)
        {
            string pageUrl = String.Empty;

            PageManager pageManager = PageManager.GetManager();

            if (pageManager != null)
            {
                if (!pageId.IsNullOrEmpty())
                {
                    Guid     pageNodeId = new Guid(pageId);
                    PageNode pageNode   = pageManager.GetPageNodes().Where(n => n.Id == pageNodeId).FirstOrDefault();
                    // We will get the url as ~/homepage
                    // So removing the first character
                    if (pageNode != null)
                    {
                        pageUrl = pageNode.GetUrl().Substring(1);
                    }

                    SiteSettingsHelper siteSettingsHelper = new SiteSettingsHelper();
                    var cultureIsEnabled = siteSettingsHelper.GetCurrentSiteCultureIsEnabled();

                    if (bool.TryParse(cultureIsEnabled, out bool output))
                    {
                        if (bool.Parse(cultureIsEnabled))
                        {
                            var targetCulture = Thread.CurrentThread.CurrentUICulture;
                            var culture       = CultureInfo.GetCultureInfo(targetCulture.Name);
                            pageUrl = "/" + culture.Name + pageUrl;
                        }
                    }
                }
            }

            return(pageUrl);
        }
Example #26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         PageManager PM   = new PageManager();
         PageTBx     page = new PageTBx();
         int         id   = Convert.ToInt32(Request["id"]);
         page        = PM.GetByID(id);
         page.status = -1;
         PM.Save();
         Response.Write(JsonConvert.SerializeObject(new
         {
             success = 1
         }));
     }
     catch (Exception ex)
     {
         Response.Write(JsonConvert.SerializeObject(new
         {
             success = -1,
             error   = ex
         }));
     }
 }
Example #27
0
        public ActionResult AddPage(string name, string controller, object model, int propertyCount = 0, List <int> propertySizes = null, bool standAlone = false)
        {
            var page = new Page(name, controller, model, propertyCount, propertySizes);

            if (standAlone)
            {
                PageManager.Reset();
                PageManager.Pages = new List <Page>
                {
                    page
                };
            }
            else
            {
                var index = Helper.RemoveIfExists(new Page(name, controller, null));
                if (index != null)
                {
                    if (index < PageManager.Pages.Count)
                    {
                        PageManager.Pages.Insert((int)index, page);
                    }
                    else
                    {
                        PageManager.Pages.Add(page);
                    }
                }
                else
                {
                    PageManager.Pages.Add(page);
                }
            }

            Helper.SetStructureId();

            return(View("PageView"));
        }
Example #28
0
        private void FormAppMain_Load(object sender, EventArgs e)
        {
            // 获取当前显示器分辨率
            System.Drawing.Rectangle rec = Screen.GetWorkingArea(this);

            if ((rec.Height >= _maxHeight) && (rec.Width >= _maxWidth))
            {
                // 主界面最大设置为1600*900
                this.Size = new Size(_maxWidth, _maxHeight);
                // 启动在屏幕正中
                this.StartPosition = FormStartPosition.WindowsDefaultLocation;
            }
            else
            {
                // 主界面布满显示器屏幕的工作区
                this.Size = SystemInformation.WorkingArea.Size;
                this.Top  = 0;
                this.Left = 0;
            }

            // 状态栏信息
            this.toolStatusLabelWelcome.Text  = "当前用户:" + PropertyHelper.CurrentUser;
            this.toolStatusLabelUnit.Text     = System.Configuration.ConfigurationManager.AppSettings["UserUnit"].ToString(); // 从配置文件读取使用单位信息
            this.toolStatusLabelDatetime.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

            // 根据用户权限设置导航栏
            AuthorizeModules();

            // 显示封面
            peCover.BringToFront();
            peCover.Visible = true;
            // Tab的Page管理器
            xtraTabbedMdiMgr.Pages.Clear();
            pageManager = new PageManager(this, xtraTabbedMdiMgr);
            xtraTabbedMdiMgr.PageRemoved += xtraTabbedMdiMgr_PageRemoved;
        }
Example #29
0
        protected virtual void Init()
        {
            // add header page
            IPage headingPage = PageManager.CreatePage();

            Debug.Assert(headingPage.Index == 0, "The header page should have zero index");

            var hph = new HeadingPageHeader
            {
                FsmPageIndex          = 1,
                AccessMethodPageIndex = 2,
                PageSize = PageManager.PageSize,
                OnDiskStructureVersion = OnDiskStructureVersion,
                AccessMethod           = (short)AccessMethod
            };

            PageFormatter.InitPage(headingPage, hph);
            PageManager.UpdatePage(headingPage);

            // add the first free-space-map page
            IPage fsmPage = PageManager.CreatePage();

            Debug.Assert(fsmPage.Index == 1, "The first free-space-map page should have index 1");

            var fsmh = new FreeSpaceMapPageHeader
            {
                StartPageIndex    = fsmPage.Index,
                PreviousPageIndex = -1,
                NextPageIndex     = -1,
                BasePageIndex     = 0
            };

            PageFormatter.InitPage(fsmPage, fsmh);
            PageFormatter.SetAllFsmValues(fsmPage, FsmValue.Full);
            PageManager.UpdatePage(fsmPage);
        }
        private PageTemplate CreatePureMvcPageTemplate(string templateTitle, string parentTemplateTitle)
        {
            var pageManager    = PageManager.GetManager();
            var parentTemplate = pageManager.GetTemplates().SingleOrDefault(t => t.Title == parentTemplateTitle);

            var template = pageManager.CreateTemplate();

            template.Title            = templateTitle;
            template.Name             = new Lstring(Regex.Replace(templateTitle, ArrangementConstants.UrlNameCharsToReplace, string.Empty).ToLower());
            template.Description      = templateTitle + " descr";
            template.ParentTemplate   = parentTemplate;
            template.ShowInNavigation = true;
            template.Framework        = PageTemplateFramework.Mvc;
            template.Category         = SiteInitializer.CustomTemplatesCategoryId;
            template.Visible          = true;

            pageManager.SaveChanges();
            var draft = pageManager.TemplatesLifecycle.Edit(template);

            pageManager.TemplatesLifecycle.Publish(draft);
            pageManager.SaveChanges();

            return(template);
        }
Example #31
0
        public void DeleteList(string listId)
        {
            ObjectPersistence persistence = new ObjectPersistence(DbAccess);
            Criteria          cri         = new Criteria();

            cri.Add(Expression.Equal("ItsListId", listId));
            IList <HtmlItemInfo> list = persistence.GetList <HtmlItemInfo>(cri);

            if (list.Count > 0)
            {
                throw new FacadeException("此列表包含有子页面,请先删除列表下的全部子页面。");
            }
            try
            {
                ListItemEntity entity = new ListItemEntity();
                entity.Id = listId;
                PageManager manager = new PageManager(DbAccess);
                manager.DeleteEntity <ListItemEntity>(entity);
            }
            catch (Exception ex)
            {
                throw HandleException("Page", "DeleteList - " + listId, ex);
            }
        }
 void Awake()
 {
     if (isPersistent)
     {
         if (Instance != null)
         {
             Destroy(gameObject);
         }
         else
         {
             Instance = this;
             pageHash = new Hashtable();
             offQueue = new List <PageType>();
             onQueue  = new List <PageType>();
             DontDestroyOnLoad(gameObject);
         }
     }
     else
     {
         pageHash = new Hashtable();
         offQueue = new List <PageType>();
         onQueue  = new List <PageType>();
     }
 }
        public void FormsWidget_AddWidgetToFormDescription_FormIsUpdated()
        {
            var gridVirtualPath = "~/Frontend-Assembly/Telerik.Sitefinity.Frontend/GridSystem/Templates/grid-3+9.html";
            var control         = new GridControl();

            control.Layout = gridVirtualPath;
            var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control);

            var pageManager = PageManager.GetManager();

            try
            {
                var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default");
                Assert.IsNotNull(template, "Template was not found");

                var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "FormsPageCacheTest", "forms-page-cache-test");
                ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);

                string pageContent = ServerOperationsFeather.Pages().GetPageContent(pageId);

                Assert.IsTrue(pageContent.Contains("class=\"sf_colsIn four wide column\""), "SemanticUI grid content not found.");

                ServerOperationsFeather.Forms().AddFormWidget(formId, new GridControl()
                {
                    Layout = "<div class=\"sf_colsIn\">Funny widget.</div>"
                });
                pageContent = ServerOperationsFeather.Pages().GetPageContent(pageId);

                Assert.IsTrue(pageContent.Contains("Funny widget."), "Form did not render the new control.");
            }
            finally
            {
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
                FormsModuleCodeSnippets.DeleteForm(formId);
            }
        }
Example #34
0
        private void UpdateContentBlockTitle()
        {
            var configManager = ConfigManager.GetManager();

            using (new ElevatedConfigModeRegion())
            {
                var toolboxConfig   = configManager.GetSection <ToolboxesConfig>();
                var controlsToolbox = toolboxConfig.Toolboxes["PageControls"];
                if (controlsToolbox != null)
                {
                    var mvcWidgetsSection = controlsToolbox.Sections.FirstOrDefault <ToolboxSection>(s => s.Name == "MvcWidgets");
                    if (mvcWidgetsSection != null)
                    {
                        var contentBlockTool = mvcWidgetsSection.Tools.FirstOrDefault <ToolboxItem>(t => t.Name == "ContentBlock");
                        if (contentBlockTool != null)
                        {
                            contentBlockTool.Title = "Content Block";
                            configManager.SaveSection(toolboxConfig);
                        }
                    }
                }
            }

            var pageManager = PageManager.GetManager();

            using (new ElevatedModeRegion(pageManager))
            {
                var contentBlocks = pageManager.GetControls <ControlData>().Where(c => c.ObjectType == "Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy" && c.Caption == "ContentBlock").ToArray();
                foreach (var contentBlock in contentBlocks)
                {
                    contentBlock.Caption = "Content Block";
                }

                pageManager.SaveChanges();
            }
        }
Example #35
0
        public void AddMenu(MenuItemInfo menu)
        {
            try
            {
                MenuItemEntity entity = new MenuItemEntity();
                entity.Index = menu.Index;
                entity.InnerId = menu.InnerId;
                entity.IsInner = menu.IsInner;
                entity.IsListType = menu.IsListType;
                entity.IsOpenNewWindow = menu.IsOpenNewWindow;
                entity.Level = menu.Level;
                entity.Name = menu.Name;
                entity.OuterUrl = menu.OuterUrl;
                entity.ParentId = menu.ParentId;

                PageManager manager = new PageManager(DbAccess);
                manager.AddEntity<MenuItemEntity>(entity);
                menu.Id = entity.Id;
            }
            catch (Exception ex)
            {
                throw HandleException("Page", "AddMenu - " + menu.Name, ex);
            }
        }
        protected override async Task ListPageNavigatedToAsync(CancellationToken cancelToken, NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            if (e.Parameter is int)
            {
                var feedGroupId = (int)e.Parameter;

                FeedGroup = HohoemaApp.FeedManager.GetFeedGroup(feedGroupId);
            }
            else if (e.Parameter is string)
            {
                if (int.TryParse(e.Parameter as string, out var feedGroupId))
                {
                    FeedGroup = HohoemaApp.FeedManager.GetFeedGroup(feedGroupId);
                }
            }

            if (FeedGroup == null)
            {
                // 削除済み?
                PageManager.OpenPage(HohoemaPageType.FeedGroupManage);
            }

            await Task.CompletedTask;
        }
Example #37
0
 public PageDraftController(PageManager pageManager)
 {
     this._pageManager = pageManager;
 }
Example #38
0
        internal static void ProcessLines(string[] lines, string path)
        {
            Logger.Log("Processing spawn file '" + path + "'.");
            string scene     = null;
            string loottable = null;
            string tag       = "none";

            foreach (string eachLine in lines)
            {
                var trimmedLine = GetTrimmedLine(eachLine);
                if (trimmedLine.Length == 0 || trimmedLine.StartsWith("#"))
                {
                    continue;
                }

                var match = SCENE_REGEX.Match(trimmedLine);
                if (match.Success)
                {
                    scene     = match.Groups[1].Value;
                    loottable = null;
                    continue;
                }

                match = TAG_REGEX.Match(trimmedLine);
                if (match.Success)
                {
                    tag = match.Groups[1].Value;
                    Logger.Log("Tag found while reading spawn file. '{0}'", tag);
                    continue;
                }

                match = SPAWN_REGEX.Match(trimmedLine);
                if (match.Success)
                {
                    if (string.IsNullOrEmpty(scene))
                    {
                        PageManager.SetItemPackNotWorking(path, $"No scene name defined before line '{eachLine}' from '{path}'. Did you forget a 'scene = <SceneName>'?");
                        return;
                    }

                    GearSpawnInfo info = new GearSpawnInfo();
                    info.PrefabName = match.Groups[1].Value;

                    info.SpawnChance = ParseFloat(match.Groups[4].Value, 100, eachLine, path);

                    info.Position = ParseVector(match.Groups[2].Value, eachLine, path);
                    info.Rotation = Quaternion.Euler(ParseVector(match.Groups[3].Value, eachLine, path));

                    info.tag = tag + "";

                    GearSpawner.AddGearSpawnInfo(scene, info);
                    continue;
                }

                match = LOOTTABLE_REGEX.Match(trimmedLine);
                if (match.Success)
                {
                    loottable = match.Groups[1].Value;
                    scene     = null;
                    continue;
                }

                match = LOOTTABLE_ENTRY_REGEX.Match(trimmedLine);
                if (match.Success)
                {
                    if (string.IsNullOrEmpty(loottable))
                    {
                        PageManager.SetItemPackNotWorking(path, $"No loottable name defined before line '{eachLine}' from '{path}'. Did you forget a 'loottable = <LootTableName>'?");
                        return;
                    }

                    LootTableEntry entry = new LootTableEntry();
                    entry.PrefabName = match.Groups[1].Value;
                    entry.Weight     = ParseInt(match.Groups[2].Value, 0, eachLine, path);
                    GearSpawner.AddLootTableEntry(loottable, entry);
                    continue;
                }

                //Only runs if nothing matches
                PageManager.SetItemPackNotWorking(path, $"Unrecognized line '{eachLine}' in '{path}'.");
                return;
            }
        }
 public ApplicationManager(ICapabilities capabilities, string baseUrl)
 {
     Pages = new PageManager(capabilities, baseUrl);
     LoginHelper = new LoginHelper(this);
     UserProfileHelper = new UserProfileHelper(this);
 }
Example #40
0
        public MenuNavigatePageBaseViewModel(
            HohoemaApp hohoemaApp,
            PageManager pageManager
            )
        {
            PageManager = pageManager;
            HohoemaApp  = hohoemaApp;

            // TV Mode
            if (Util.DeviceTypeHelper.IsXbox)
            {
                IsTVModeEnable = new ReactiveProperty <bool>(true);
            }
            else
            {
                IsTVModeEnable = HohoemaApp.UserSettings
                                 .AppearanceSettings.ObserveProperty(x => x.IsForceTVModeEnable)
                                 .ToReactiveProperty();
            }

            ServiceLevel = HohoemaApp.ObserveProperty(x => x.ServiceStatus)
                           .ToReadOnlyReactiveProperty();

            IsNeedFullScreenToggleHelp
                = ApplicationView.PreferredLaunchWindowingMode == ApplicationViewWindowingMode.FullScreen;

            IsOpenPane = new ReactiveProperty <bool>(false);

            MenuItems = new List <PageTypeSelectableItem>()
            {
                new PageTypeSelectableItem(HohoemaPageType.Search, OnMenuItemSelected, "検索", Symbol.Find),
                new PageTypeSelectableItem(HohoemaPageType.RankingCategoryList, OnMenuItemSelected, "ランキング", Symbol.Flag),
                new PageTypeSelectableItem(HohoemaPageType.UserMylist, OnMenuItemSelected, "マイリスト", Symbol.Bookmarks),
                new PageTypeSelectableItem(HohoemaPageType.FollowManage, OnMenuItemSelected, "フォロー", Symbol.OutlineStar),
                new PageTypeSelectableItem(HohoemaPageType.FeedGroupManage, OnMenuItemSelected, "フィード", Symbol.List),
            };

            SubMenuItems = new List <PageTypeSelectableItem>()
            {
                new PageTypeSelectableItem(HohoemaPageType.History, OnMenuItemSelected, "視聴履歴", Symbol.Clock),
                new PageTypeSelectableItem(HohoemaPageType.CacheManagement, OnMenuItemSelected, "キャッシュ管理", Symbol.Download),
                new PageTypeSelectableItem(HohoemaPageType.Settings, OnMenuItemSelected, "設定", Symbol.Setting),
                new PageTypeSelectableItem(HohoemaPageType.UserInfo, OnAccountMenuItemSelected, "アカウント", Symbol.Account),
            };

            AllMenuItems = MenuItems.Concat(SubMenuItems).ToList();

            MainSelectedItem = new ReactiveProperty <PageTypeSelectableItem>(MenuItems[0], ReactivePropertyMode.DistinctUntilChanged);
            SubSelectedItem  = new ReactiveProperty <PageTypeSelectableItem>(null, ReactivePropertyMode.DistinctUntilChanged);

            Observable.Merge(
                MainSelectedItem,
                SubSelectedItem
                )
            .Where(x => x != null)
            .Subscribe(x => x.SelectedAction(x.Source));

            PageManager.ObserveProperty(x => x.CurrentPageType)
            .Subscribe(pageType =>
            {
//                    IsOpenPane.Value = false;

                bool isMenuItemOpened = false;
                foreach (var item in MenuItems)
                {
                    if (item.Source == pageType)
                    {
                        MainSelectedItem.Value = item;
                        SubSelectedItem.Value  = null;
                        isMenuItemOpened       = true;
                        break;
                    }
                }

                foreach (var item in SubMenuItems)
                {
                    if (item.Source == pageType)
                    {
                        SubSelectedItem.Value  = item;
                        MainSelectedItem.Value = null;
                        isMenuItemOpened       = true;
                        break;
                    }
                }

                if (!isMenuItemOpened)
                {
                    MainSelectedItem.Value = null;
                    SubSelectedItem.Value  = null;
                }
            });

            IsSubMenuItemPage = PageManager.ObserveProperty(x => x.CurrentPageType)
                                .Select(x => SubMenuItems.Any(y => y.Source == x))
                                .ToReactiveProperty();



            PageManager.ObserveProperty(x => x.PageTitle)
            .Subscribe(x =>
            {
                TitleText = x;
            });


            IsVisibleMenu = PageManager.ObserveProperty(x => x.CurrentPageType)
                            .Select(x =>
            {
                return(PageManager.DontNeedMenuPageTypes.All(dontNeedMenuPageType => x != dontNeedMenuPageType));
            })
                            .ToReactiveProperty();

            NowNavigating = PageManager.ObserveProperty(x => x.PageNavigating)
                            .ToReactiveProperty();


            PageManager.StartWork    += PageManager_StartWork;
            PageManager.ProgressWork += PageManager_ProgressWork;
            PageManager.CompleteWork += PageManager_CompleteWork;
            PageManager.CancelWork   += PageManager_CancelWork;



            var updater = HohoemaApp.BackgroundUpdater;

            var bgUpdateStartedObserver = Observable.FromEventPattern <BackgroundUpdateScheduleHandler>(
                handler => updater.BackgroundUpdateStartedEvent += handler,
                handler => updater.BackgroundUpdateStartedEvent -= handler
                );

            var bgUpdateCompletedObserver = Observable.FromEventPattern <BackgroundUpdateScheduleHandler>(
                handler => updater.BackgroundUpdateCompletedEvent += handler,
                handler => updater.BackgroundUpdateCompletedEvent -= handler
                );


            var bgUpdateCanceledObserver = Observable.FromEventPattern <BackgroundUpdateScheduleHandler>(
                handler => updater.BackgroundUpdateCanceledEvent += handler,
                handler => updater.BackgroundUpdateCanceledEvent -= handler
                );

            BGUpdateText    = new ReactiveProperty <string>();
            HasBGUpdateText = BGUpdateText.Select(x => !string.IsNullOrEmpty(x))
                              .ToReactiveProperty();
            bgUpdateStartedObserver.Subscribe(x =>
            {
                if (!string.IsNullOrEmpty(x.EventArgs.Label))
                {
                    BGUpdateText.Value = $"{x.EventArgs.Label} を処理中...";
                }
                else
                {
                    BGUpdateText.Value = $"{x.EventArgs.Id} を処理中...";
                }
            });


            Observable.Merge(
                bgUpdateCompletedObserver,
                bgUpdateCanceledObserver
                )
            .Throttle(TimeSpan.FromSeconds(2))
            .Subscribe(x =>
            {
                BGUpdateText.Value = null;
            });

            HohoemaApp.ObserveProperty(x => x.IsLoggedIn)
            .Subscribe(x => IsLoggedIn = x);

            HohoemaApp.ObserveProperty(x => x.LoginUserName)
            .Subscribe(x =>
            {
                UserName = x;
                UserMail = AccountManager.GetPrimaryAccountId();
            });

            HohoemaApp.ObserveProperty(x => x.UserIconUrl)
            .Subscribe(x => UserIconUrl = x);



            // 検索
            SearchKeyword = new ReactiveProperty <string>("");
            SearchTarget  = new ReactiveProperty <Models.SearchTarget>(Models.SearchTarget.Keyword);

            SearchCommand = SearchKeyword
                            .Select(x => !string.IsNullOrWhiteSpace(x))
                            .ToReactiveCommand();
            SearchCommand.Subscribe(_ =>
            {
                ISearchPagePayloadContent searchContent =
                    SearchPagePayloadContentHelper.CreateDefault(SearchTarget.Value, SearchKeyword.Value);
                PageManager.Search(searchContent);

                IsMobileNowSearching = false;
            });
        }
Example #41
0
 public IncomeDataManager(TextContentManager textContentManager, PageManager pageManager)
 {
     _textContentManager = textContentManager;
     _pageManager = pageManager;
 }
Example #42
0
        public MylistPageViewModel(
            HohoemaApp hohoemaApp
            , PageManager pageManager
            , Views.Service.MylistRegistrationDialogService mylistDialogService
            , Views.Service.ContentSelectDialogService contentSelectDialogService
            )
            : base(hohoemaApp, pageManager, mylistDialogService, isRequireSignIn: true)
        {
            _ContentSelectDialogService = contentSelectDialogService;

            PlayableList = new ReactiveProperty <IPlayableList>();
            MylistOrigin = new ReactiveProperty <Models.PlaylistOrigin>();

            IsFavoriteMylist = new ReactiveProperty <bool>(mode: ReactivePropertyMode.DistinctUntilChanged)
                               .AddTo(_CompositeDisposable);
            CanChangeFavoriteMylistState = new ReactiveProperty <bool>()
                                           .AddTo(_CompositeDisposable);


            IsFavoriteMylist
            .Where(x => PlayableList.Value.Id != null)
            .Subscribe(async x =>
            {
                if (PlayableList.Value.Origin != PlaylistOrigin.OtherUser)
                {
                    return;
                }

                if (_NowProcessFavorite)
                {
                    return;
                }

                _NowProcessFavorite = true;

                CanChangeFavoriteMylistState.Value = false;
                if (x)
                {
                    if (await FavoriteMylist())
                    {
                        Debug.WriteLine(_MylistTitle + "のマイリストをお気に入り登録しました.");
                    }
                    else
                    {
                        // お気に入り登録に失敗した場合は状態を差し戻し
                        Debug.WriteLine(_MylistTitle + "のマイリストをお気に入り登録に失敗");
                        IsFavoriteMylist.Value = false;
                    }
                }
                else
                {
                    if (await UnfavoriteMylist())
                    {
                        Debug.WriteLine(_MylistTitle + "のマイリストをお気に入り解除しました.");
                    }
                    else
                    {
                        // お気に入り解除に失敗した場合は状態を差し戻し
                        Debug.WriteLine(_MylistTitle + "のマイリストをお気に入り解除に失敗");
                        IsFavoriteMylist.Value = true;
                    }
                }

                CanChangeFavoriteMylistState.Value =
                    IsFavoriteMylist.Value == true ||
                    HohoemaApp.FollowManager.CanMoreAddFollow(FollowItemType.Mylist);


                _NowProcessFavorite = false;
            })
            .AddTo(_CompositeDisposable);


            UnregistrationMylistCommand = SelectedItems.ObserveProperty(x => x.Count)
                                          .Where(_ => this.CanEditMylist)
                                          .Select(x => x > 0)
                                          .ToReactiveCommand(false);

            UnregistrationMylistCommand.Subscribe(async _ =>
            {
                var mylistGroup = HohoemaApp.UserMylistManager.GetMylistGroup(PlayableList.Value.Id);

                var items = SelectedItems.ToArray();


                var action = AsyncInfo.Run <uint>(async(cancelToken, progress) =>
                {
                    uint progressCount = 0;
                    int successCount   = 0;
                    int failedCount    = 0;

                    Debug.WriteLine($"マイリストに追加解除を開始...");
                    foreach (var video in items)
                    {
                        var unregistrationResult = await mylistGroup.Unregistration(
                            video.RawVideoId
                            , withRefresh: false /* あとでまとめてリフレッシュするのでここでは OFF */);

                        if (unregistrationResult == ContentManageResult.Success)
                        {
                            successCount++;
                        }
                        else
                        {
                            failedCount++;
                        }

                        progressCount++;
                        progress.Report(progressCount);

                        Debug.WriteLine($"{video.Title}[{video.RawVideoId}]:{unregistrationResult.ToString()}");
                    }

                    // 登録解除結果を得るためリフレッシュ
                    await mylistGroup.Refresh();


                    // ユーザーに結果を通知
                    var titleText    = $"「{mylistGroup.Name}」から {successCount}件 の動画が登録解除されました";
                    var toastService = App.Current.Container.Resolve <ToastNotificationService>();
                    var resultText   = $"";
                    if (failedCount > 0)
                    {
                        resultText += $"\n登録解除に失敗した {failedCount}件 は選択されたままです";
                    }
                    toastService.ShowText(titleText, resultText);

                    // 登録解除に失敗したアイテムだけを残すように
                    // マイリストから除外された動画を選択アイテムリストから削除
                    foreach (var item in SelectedItems.ToArray())
                    {
                        if (false == mylistGroup.CheckRegistratedVideoId(item.RawVideoId))
                        {
                            SelectedItems.Remove(item);
                            IncrementalLoadingItems.Remove(item);
                        }
                    }

                    Debug.WriteLine($"マイリストに追加解除完了---------------");
                });

                await PageManager.StartNoUIWork("マイリストに追加解除", items.Length, () => action);
            });

            CopyMylistCommand = SelectedItems.ObserveProperty(x => x.Count)
                                .Where(_ => this.CanEditMylist)
                                .Select(x => x > 0)
                                .ToReactiveCommand(false);

            CopyMylistCommand.Subscribe(async _ =>
            {
                var mylistGroup = HohoemaApp.UserMylistManager.GetMylistGroup(PlayableList.Value.Id);
                // ターゲットのマイリストを選択する
                var targetMylist = await MylistDialogService
                                   .ShowSelectSingleMylistDialog(
                    SelectedItems.Count
                    , hideMylistGroupId: mylistGroup.GroupId
                    );

                if (targetMylist == null)
                {
                    return;
                }



                // すでにターゲットのマイリストに登録されている動画を除外してコピーする
                var items = SelectedItems
                            .Where(x => !targetMylist.CheckRegistratedVideoId(x.RawVideoId))
                            .ToList();

                var action = AsyncInfo.Run <uint>(async(cancelToken, progress) =>
                {
                    Debug.WriteLine($"マイリストのコピーを開始...");

                    var result = await mylistGroup.CopyMylistTo(
                        targetMylist
                        , items.Select(video => video.RawVideoId).ToArray()
                        );


                    Debug.WriteLine($"copy mylist {items.Count} item from {mylistGroup.Name} to {targetMylist.Name} : {result.ToString()}");

                    // ユーザーに結果を通知
                    var toastService = App.Current.Container.Resolve <ToastNotificationService>();

                    string titleText;
                    string contentText;
                    if (result == ContentManageResult.Success)
                    {
                        titleText   = $"「{targetMylist.Name}」に {SelectedItems.Count}件 コピーしました";
                        contentText = $" {SelectedItems.Count}件 の動画をコピーしました";

                        progress.Report((uint)items.Count);
                    }
                    else
                    {
                        titleText   = $"マイリストコピーに失敗";
                        contentText = $"時間を置いてからやり直してみてください";
                    }

                    toastService.ShowText(titleText, contentText);



                    // 成功した場合は選択状態を解除
                    if (result == ContentManageResult.Success)
                    {
                        ClearSelection();
                    }

                    Debug.WriteLine($"マイリストのコピー完了...");
                });

                await PageManager.StartNoUIWork("マイリストのコピー", items.Count, () => action);
            });


            MoveMylistCommand = SelectedItems.ObserveProperty(x => x.Count)
                                .Where(_ => this.CanEditMylist)
                                .Select(x => x > 0)
                                .ToReactiveCommand(false);

            MoveMylistCommand.Subscribe(async _ =>
            {
                var mylistGroup = HohoemaApp.UserMylistManager.GetMylistGroup(PlayableList.Value.Id);

                // ターゲットのマイリストを選択する
                var targetMylist = await MylistDialogService
                                   .ShowSelectSingleMylistDialog(
                    SelectedItems.Count
                    , hideMylistGroupId: mylistGroup.GroupId
                    );

                if (targetMylist == null)
                {
                    return;
                }



                // すでにターゲットのマイリストに登録されている動画を除外してコピーする
                var items = SelectedItems
                            .Where(x => !targetMylist.CheckRegistratedVideoId(x.RawVideoId))
                            .ToList();

                Debug.WriteLine($"マイリストの移動を開始...");

                var result = await mylistGroup.MoveMylistTo(
                    targetMylist
                    , items.Select(video => video.RawVideoId).ToArray()
                    );

                Debug.WriteLine($"move mylist {items.Count} item from {mylistGroup.Name} to {targetMylist.Name} : {result.ToString()}");

                // ユーザーに結果を通知
                var toastService = App.Current.Container.Resolve <ToastNotificationService>();

                string titleText;
                string contentText;
                if (result == ContentManageResult.Success)
                {
                    titleText   = $"「{targetMylist.Name}」に {SelectedItems.Count}件 移動しました";
                    contentText = $" {SelectedItems.Count}件 の動画を移動しました";
                }
                else
                {
                    titleText   = $"マイリスト移動に失敗";
                    contentText = $"時間を置いてからやり直してみてください";
                }

                toastService.ShowText(titleText, contentText);



                // 成功した場合は選択状態を解除
                if (result == ContentManageResult.Success)
                {
                    // 移動元のマイリストからは削除されているはず
                    foreach (var item in SelectedItems)
                    {
                        if (!mylistGroup.CheckRegistratedVideoId(item.RawVideoId))
                        {
                            IncrementalLoadingItems.Remove(item);
                        }
                        else
                        {
                            throw new Exception();
                        }
                    }

                    ClearSelection();
                }

                Debug.WriteLine($"マイリストの移動完了...");
            });
        }
Example #43
0
 public LocalMylistIncrementalSource(LocalMylist localMylist, HohoemaApp hohoemaApp, PageManager pageManager)
     : base(hohoemaApp, "LocalMylist:" + localMylist.Name)
 {
     LocalMylist  = localMylist;
     _PageManager = pageManager;
 }
Example #44
0
 public UserHelper(AppManager app)
 {
     this.app = app;
     this.pages = app.Pages;
 }
Example #45
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="WidgetLambdaEvents"/> class.
 /// </summary>
 /// <param name="context">Application Context</param>
 /// <param name="manager">PageManager owning this instance</param>
 public WidgetLambdaEvents(ApplicationContext context, PageManager manager)
     : base(context, manager)
 {
 }
        private IEnumerable<CultureInfo> GetLanguagesList(PageManager pm, Guid homePageId, PageSiteNode siteMapNode)
        {
            ////Get languages to list
            List<CultureInfo> languages = new List<CultureInfo>();
            var settings = Telerik.Sitefinity.Services.SystemManager.CurrentContext.AppSettings;
            if (this.MissingTranslationAction == NoTranslationAction.HideLink)
            {
                languages.AddRange(this.usedLanguages);
            }
            else
            {
                languages.AddRange(settings.DefinedFrontendLanguages);
                if (homePageId != Guid.Empty)
                {
                    this.homePageNode = pm.GetPageNode(homePageId);
                }
            }

            ////Remove current language, if necessary
            IList<CultureInfo> shownLanguages;
            CultureInfo currentLanguage = Thread.CurrentThread.CurrentUICulture;
            if (this.IncludeCurrentLanguage)
            {
                shownLanguages = languages;

                // In design mode, if the page is not yet published, we want to display the current language if the user has selected the option.
                if (SystemManager.IsDesignMode &&
                    siteMapNode != null &&
                    !siteMapNode.IsPublished(currentLanguage))
                {
                    shownLanguages.Add(currentLanguage);
                }
            }
            else
            {
                shownLanguages = languages.Where(ci => !ci.Equals(currentLanguage)).ToList();
            }

            return shownLanguages;
        }
 public DeleteMessagePage(PageManager pageManager)
     : base(pageManager)
 {
     pagename = "deletemessage";
 }
 public UserProfilePage(PageManager pageManager)
     : base(pageManager)
 {
 }
Example #49
0
 public SiteTextFolderManager(ITextFolderProvider provider, ViewManager viewManager, PageManager pageManager)
     : base(provider)
 {
     this._viewManager = viewManager;
     this._pageManager = pageManager;
 }
Example #50
0
 public LoginPage(PageManager pageManager)
     : base(pageManager)
 {
 }
Example #51
0
 // Start is called before the first frame update
 void Start()
 {
     pgm = GameObject.Find("PageManager").GetComponent <PageManager>();
 }
Example #52
0
        public void NavigationWidget_ValidatePagesCacheDependenciesOnGroupPagePublishUnpublish()
        {
            const string GroupPageTitle = "GroupPage";
            const string ChildPageTitle = "ChildPage";

            string url = UrlPath.ResolveAbsoluteUrl("~/" + UrlNamePrefix + Index);

            var mvcProxy = new MvcControllerProxy()
            {
                ControllerName = typeof(NavigationController).FullName, Settings = new ControllerSettings(new NavigationController()
                {
                    LevelsToInclude = 2
                })
            };
            var paretnPageId = this.pageOperations.CreatePageWithControl(mvcProxy, PageNamePrefix, PageTitlePrefix, UrlNamePrefix, Index);

            this.createdPageIDs.Add(paretnPageId);

            var pageGenerator = new Telerik.Sitefinity.TestIntegration.Data.Content.PageContentGenerator();
            var pageManager   = PageManager.GetManager();

            var parentPageId = pageGenerator.CreatePage(GroupPageTitle, GroupPageTitle, GroupPageTitle, action: (n, d) => n.NodeType = NodeType.Group);

            this.createdPageIDs.Add(parentPageId);

            var childPageId = pageGenerator.CreatePage(ChildPageTitle, ChildPageTitle, ChildPageTitle);

            this.createdPageIDs.Add(childPageId);

            var parent = pageManager.GetPageNode(parentPageId);
            var child  = pageManager.GetPageNode(childPageId);

            child.Parent = parent;
            pageManager.SaveChanges();

            var cookies = new CookieContainer();

            using (new AuthenticateUserRegion(null))
            {
                var responseContent = this.GetResponse(url, cookies);
                Assert.IsTrue(responseContent.Contains(GroupPageTitle + "<"), "The group page was not found");
                Assert.IsTrue(responseContent.Contains(ChildPageTitle + "<"), "The child page was not found");
            }

            pageManager.UnpublishPage(child.GetPageData());
            pageManager.SaveChanges();

            using (new AuthenticateUserRegion(null))
            {
                var responseContent = this.GetResponse(url, cookies);
                Assert.IsFalse(responseContent.Contains(GroupPageTitle + "<"), "The group page was found");
                Assert.IsFalse(responseContent.Contains(ChildPageTitle + "<"), "The child page was found");
            }

            var bag = new Dictionary <string, string>();

            bag.Add("ContentType", child.GetType().FullName);
            WorkflowManager.MessageWorkflow(childPageId, child.GetType(), null, "Publish", false, bag);

            using (new AuthenticateUserRegion(null))
            {
                var responseContent = this.GetResponse(url, cookies);
                Assert.IsTrue(responseContent.Contains(GroupPageTitle + "<"), "The group page was not found");
                Assert.IsTrue(responseContent.Contains(ChildPageTitle + "<"), "The child page was not found");
            }
        }
        public static List <IUIData> GetData(string Identifier, Dictionary <string, string> parameters, UserInfo userInfo)
        {
            Dictionary <string, IUIData> Settings = new Dictionary <string, IUIData>
            {
                { "AppPath", new UIData {
                      Name = "AppPath", Value = HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/DesktopModules/Vanjaro/UXManager/Extensions/Menu/Pages"
                  } }
            };

            PagesController pc = new PagesController();

            switch (Identifier.ToLower())
            {
            case "setting_pages":
            {
                dynamic DeletedPages = Managers.PagesManager.GetDeletedPageList();
                Settings.Add("PagesTree", new UIData {
                        Name = "PagesTree", Options = Managers.PagesManager.GetPagesTreeView()
                    });
                Settings.Add("DeletedPages", new UIData {
                        Name = "DeletedPages", Options = DeletedPages.Data
                    });
                Settings.Add("DeletedPagesCount", new UIData {
                        Name = "DeletedPagesCount", Options = DeletedPages.totalRecords
                    });
                Settings.Add("PageItem", new UIData {
                        Name = "PageItem", Options = new PageItem()
                    });
                Settings.Add("List_PageItem", new UIData {
                        Name = "List_PageItem", Options = new List <PageItem>()
                    });
                Settings.Add("PageSetting", new UIData {
                        Name = "PageSetting", Options = pc.GetDefaultPagesSettings(PortalSettings.Current.PortalId, PortalSettings.Current.CultureCode).Data
                    });
                Settings.Add("DefaultPagesSettingsRequest", new UIData {
                        Name = "DefaultPagesSettingsRequest", Options = new UpdateDefaultPagesSettingsRequest()
                    });
                Settings.Add("PageMoveRequest", new UIData {
                        Name = "PageMoveRequest", Options = new PageMoveRequest()
                    });

                Settings.Add("HasTabPermission", new UIData {
                        Name = "HasTabPermission", Value = Factories.AppFactory.GetAccessRoles(userInfo).Contains("admin").ToString().ToLower()
                    });
                return(Settings.Values.ToList());
            }

            case "setting_detail":
            {
                int    pid = 0;
                bool   copy = false;
                string ParentPageValue = "-1", SitemapPriorityValue = "-1";
                if (parameters.Count > 0)
                {
                    pid = int.Parse(parameters["pid"]);
                    if (parameters.ContainsKey("copy"))
                    {
                        copy = bool.Parse(parameters["copy"]);
                    }
                }
                bool HasTabPermission = pid > 0 ? TabPermissionController.HasTabPermission(TabController.Instance.GetTab(pid, PortalSettings.Current.PortalId).TabPermissions, "EDIT") : true;
                Settings.Add("HasTabPermission", new UIData {
                        Name = "HasTabPermission", Value = HasTabPermission.ToString()
                    });
                if (copy)
                {
                    Settings.Add("IsCopy", new UIData {
                            Name = "IsCopy", Value = copy.ToString()
                        });
                }

                if (HasTabPermission)
                {
                    PageSettings pageSettings = new PageSettings();
                    pageSettings = pid > 0 ? Managers.PagesManager.GetPageDetails(pid).Data : Managers.PagesManager.GetDefaultSettings();
                    if (copy)
                    {
                        pageSettings.Name       += "_Copy";
                        pageSettings.AbsoluteUrl = null;
                    }
                    ParentPageValue      = pid > 0 && pageSettings.ParentId.HasValue ? pageSettings.ParentId.ToString() : ParentPageValue;
                    SitemapPriorityValue = pid > 0 && pageSettings.SiteMapPriority != Null.NullInteger ? pageSettings.SiteMapPriority.ToString() : SitemapPriorityValue;
                    if (pageSettings.TabId > 0)
                    {
                        Settings.Add("PageUrls", new UIData {
                                Name = "PageUrls", Options = GetCustomUrls(pageSettings.TabId)
                            });
                    }
                    else
                    {
                        Settings.Add("PageUrls", new UIData {
                                Name = "PageUrls", Options = ""
                            });
                    }

                    if (pageSettings.SiteAliases != null)
                    {
                        Settings.Add("SiteAlias", new UIData {
                                Name = "SiteAlias", Options = pageSettings.SiteAliases.Where(x => x.Key == PortalSettings.Current.PortalAlias.PortalAliasID), OptionsText = "Value", OptionsValue = "Key", Value = PortalSettings.Current.PortalAlias.PortalAliasID.ToString()
                            });
                    }

                    Settings.Add("DeletedModules", new UIData {
                            Name = "DeletedModules", Options = Managers.PagesManager.GetAllDeletedModules(pid, PortalSettings.Current.CultureCode)
                        });

                    //disableLink Yes and Display In Menu Yes mean Folder Page
                    if (string.IsNullOrEmpty(pageSettings.PageType))
                    {
                        pageSettings.PageType = "Standard";
                    }

                    pageSettings.PageType   = pageSettings.PageType.ToLower() == "url" ? "URL" : (pageSettings.DisableLink && pageSettings.IncludeInMenu) ? "Folder" : "Standard";
                    pageSettings.AllowIndex = pid > 0 ? pageSettings.AllowIndex : true;

                    string        SiteUrl     = PortalSettings.Current.PortalAlias != null ? PortalSettings.Current.PortalAlias.HTTPAlias : ServiceProvider.NavigationManager.NavigateURL();
                    List <Layout> pageLayouts = Managers.PagesManager.GetLayouts();
                    Settings.Add("PagesTemplate", new UIData {
                            Name = "PagesTemplate", Options = pageSettings
                        });
                    Settings.Add("PageLayouts", new UIData {
                            Name = "PageLayouts", Options = pageLayouts
                        });
                    Settings.Add("Permissions", new UIData {
                            Name = "Permissions", Options = Managers.PagesManager.GetPagePermission(pageSettings, PortalSettings.Current.PortalId)
                        });
                    Settings.Add("ParentPage", new UIData {
                            Name = "ParentPage", Options = Library.Managers.PageManager.GetParentPages(PortalSettings.Current).Select(a => new { a.TabID, a.TabName }), OptionsText = "TabName", OptionsValue = "TabID", Value = ParentPageValue
                        });
                    Settings.Add("SitemapPriority", new UIData {
                            Name = "SitemapPriority", Options = "", OptionsText = "label", OptionsValue = "value", Value = SitemapPriorityValue
                        });
                    Settings.Add("URLType", new UIData {
                            Name = "URLType", Options = Managers.UrlManager.StatusCodes, OptionsText = "Value", OptionsValue = "Key", Value = "200"
                        });
                    Settings.Add("WorkingPageUrls", new UIData {
                            Name = "WorkingPageUrls", Options = new SeoUrl()
                            {
                                SaveUrl = new DotNetNuke.Entities.Urls.SaveUrlDto()
                            }
                        });

                    Settings.Add("ModuleItem", new UIData {
                            Name = "ModuleItem", Options = new Recyclebin.ModuleItem()
                        });
                    Settings.Add("List_ModuleItem", new UIData {
                            Name = "List_ModuleItem", Options = new List <Recyclebin.ModuleItem>()
                        });
                    Settings.Add("DefaultPageTitle", new UIData {
                            Name = "DefaultPageTitle", Value = GetPageTitle(pid, PortalSettings.Current.PortalId)
                        });
                    Settings.Add("SiteUrl", new UIData {
                            Name = "SiteUrl", Value = SiteUrl.EndsWith("/") ? SiteUrl : SiteUrl + "/"
                        });

                    int defaultWorkflow = Core.Managers.WorkflowManager.GetDefaultWorkflow(pageSettings.TabId);
                    Settings.Add("ddlWorkFlows", new UIData {
                            Name = "ddlWorkFlows", Options = Core.Managers.WorkflowManager.GetDDLWorkflow(PortalSettings.Current.PortalId, false), OptionsText = "Text", OptionsValue = "Value", Value = defaultWorkflow.ToString()
                        });
                    Settings.Add("MaxRevisions", new UIData {
                            Name = "MaxRevisions", Value = Core.Managers.WorkflowManager.GetMaxRevisions(pageSettings.TabId).ToString()
                        });
                    Settings.Add("ReplaceTokens", new UIData {
                            Name = "ReplaceTokens", Value = Core.Managers.SettingManager.GetValue(PortalSettings.Current.PortalId, pageSettings.TabId, Identifier, "ReplaceTokens", AppFactory.GetViews()) ?? bool.FalseString
                        });
                    Settings.Add("WorkflowStateInfo", new UIData {
                            Name = "WorkflowStateInfo", Value = Core.Managers.WorkflowManager.GetWorkflowStatesInfo(defaultWorkflow)
                        });

                    DotNetNuke.Services.Localization.Locale DefaultLocale = DotNetNuke.Services.Localization.LocaleController.Instance.GetDefaultLocale(PortalSettings.Current.PortalId);
                    Settings.Add("IsDefaultLocale", new UIData {
                            Name = "IsDefaultLocale", Options = pid > 0 ? DefaultLocale.Code == PortalSettings.Current.CultureCode : true, Value = DefaultLocale.Code
                        });
                    Settings.Add("LocalizedPage", new UIData {
                            Name = "LocalizedPage", Options = Managers.PagesManager.AddDefaultLocalization(pid, pageSettings)
                        });
                    Settings.Add("Languages", new UIData {
                            Name = "Languages", Value = PortalSettings.Current.CultureCode, Options = LocalizationManager.GetActiveLocale(PortalSettings.Current.PortalId).Where(a => a.Value.ToLower() == PortalSettings.Current.CultureCode.ToLower()), OptionsText = "Text", OptionsValue = "Value"
                        });
                }

                return(Settings.Values.ToList());
            }

            case "setting_savetemplateas":
            {
                int pid = 0;
                if (parameters.Count > 0)
                {
                    pid = int.Parse(parameters["pid"]);
                }

                PageSettings pageSettings = new PageSettings();
                pageSettings = pid > 0 ? Managers.PagesManager.GetPageDetails(pid).Data : Managers.PagesManager.GetDefaultSettings();
                Settings.Add("Name", new UIData {
                        Name = "Name", Value = pageSettings.Name
                    });
                Settings.Add("PID", new UIData {
                        Name = "PID", Value = pid.ToString()
                    });
                Settings.Add("Icon", new UIData {
                        Name = "Icon", Value = ""
                    });
                return(Settings.Values.ToList());
            }

            case "setting_recyclebin":
            {
                Settings.Add("DeletedPages", new UIData {
                        Name = "DeletedPages", Options = Managers.PagesManager.GetDeletedPageList().Data
                    });
                return(Settings.Values.ToList());
            }

            case "setting_choosetemplate":
            {
                int          pid = PortalSettings.Current.ActiveTab.TabID;
                bool         HasTabPermission = pid > 0 ? TabPermissionController.HasTabPermission(TabController.Instance.GetTab(pid, PortalSettings.Current.PortalId).TabPermissions, "EDIT") : true;
                PageSettings pageSettings     = new PageSettings();
                pageSettings = pid > 0 ? Managers.PagesManager.GetPageDetails(pid).Data : Managers.PagesManager.GetDefaultSettings();
                List <Layout> pageLayouts = Managers.PagesManager.GetLayouts();
                Settings.Add("HasTabPermission", new UIData {
                        Name = "HasTabPermission", Value = HasTabPermission.ToString()
                    });
                Settings.Add("PagesTemplate", new UIData {
                        Name = "PagesTemplate", Options = pageSettings
                    });
                Settings.Add("PageLayouts", new UIData {
                        Name = "PageLayouts", Options = pageLayouts
                    });
                Settings.Add("DisplayChooseTemplate", new UIData {
                        Name = "DisplayChooseTemplate", Options = (PageManager.GetPages(PortalSettings.Current.ActiveTab.TabID).Count == 0)
                    });
                return(Settings.Values.ToList());
            }

            default:
                return(null);
            }
        }
 public EditAddressPage(PageManager pageManager)
     : base(pageManager)
 {
 }
Example #55
0
 public DeflistMylistIncrementalSource(HohoemaApp hohoemaApp, PageManager pageManager)
     : base(hohoemaApp, "DeflistMylist")
 {
     _PageManager     = pageManager;
     _MylistGroupInfo = HohoemaApp.UserMylistManager.GetMylistGroup("0");
 }
Example #56
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageManager PM = new PageManager();

        listPage = PM.GetList();
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     PageManager.SetShowCaption(false);
     PageManager.SetAlbumID(38);
 }
 public AnyPage(PageManager pageManager)
 {
     this.pageManager = pageManager;
 }
 public TimeOffHelper(AppManager app)
 {
     this.app = app;
     this.pages = app.Pages;
 }
 public GeneralSettingsPage(PageManager pageManager)
     : base(pageManager)
 {
     pagename = "generalsettings";
 }