コード例 #1
0
        public override List <IUIData> GetData(string Identifier, Dictionary <string, string> Parameters)
        {
            switch ((AppFactory.Identifier)Enum.Parse(typeof(AppFactory.Identifier), Identifier))
            {
            case Factories.AppFactory.Identifier.setting_pages:
                return(PagesController.GetData(Identifier, Parameters, UserInfo));

            case Factories.AppFactory.Identifier.setting_detail:
                return(PagesController.GetData(Identifier, Parameters, UserInfo));

            case Factories.AppFactory.Identifier.setting_permissions:
                return(PagesController.GetData(Identifier, Parameters, UserInfo));

            case Factories.AppFactory.Identifier.setting_recyclebin:
                return(PagesController.GetData(Identifier, Parameters, UserInfo));

            case Factories.AppFactory.Identifier.setting_savetemplateas:
                return(PagesController.GetData(Identifier, Parameters, UserInfo));

            case Factories.AppFactory.Identifier.setting_choosetemplate:
                return(PagesController.GetData(Identifier, Parameters, UserInfo));

            default:
                break;
            }
            return(base.GetData(Identifier, Parameters));
        }
コード例 #2
0
        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);
            }
        }