本文整理汇总了C#中DotNetNuke.Entities.Portals.PortalSettings类的典型用法代码示例。如果您正苦于以下问题:C# PortalSettings类的具体用法?C# PortalSettings怎么用?C# PortalSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PortalSettings类属于DotNetNuke.Entities.Portals命名空间,在下文中一共展示了PortalSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUrls
/// <summary>
/// Includes page urls on the sitemap
/// </summary>
/// <remarks>
/// Pages that are included:
/// - are not deleted
/// - are not disabled
/// - are normal pages (not links,...)
/// - are visible (based on date and permissions)
/// </remarks>
public override List<SitemapUrl> GetUrls(int portalId, PortalSettings ps, string version)
{
SitemapUrl pageUrl = null;
var urls = new List<SitemapUrl>();
useLevelBasedPagePriority = bool.Parse(PortalController.GetPortalSetting("SitemapLevelMode", portalId, "False"));
minPagePriority = float.Parse(PortalController.GetPortalSetting("SitemapMinPriority", portalId, "0.1"), CultureInfo.InvariantCulture);
includeHiddenPages = bool.Parse(PortalController.GetPortalSetting("SitemapIncludeHidden", portalId, "True"));
this.ps = ps;
foreach (TabInfo tab in TabController.Instance.GetTabsByPortal(portalId).Values.Where(t => !t.IsSystem))
{
if (!tab.IsDeleted && !tab.DisableLink && tab.TabType == TabType.Normal && (Null.IsNull(tab.StartDate) || tab.StartDate < DateTime.Now) &&
(Null.IsNull(tab.EndDate) || tab.EndDate > DateTime.Now) && IsTabPublic(tab.TabPermissions))
{
if ((includeHiddenPages || tab.IsVisible) && tab.HasBeenPublished)
{
pageUrl = GetPageUrl(tab, (ps.ContentLocalizationEnabled) ? tab.CultureCode : null);
urls.Add(pageUrl);
}
}
}
return urls;
}
示例2: SetFilePathHack
public static void SetFilePathHack (this DnnFilePickerUploader picker, PortalSettings portalSettings)
{
if (picker.FileID > 0)
picker.FilePath = FileManager.Instance.GetUrl (
FileManager.Instance.GetFile (picker.FileID))
.Remove (0, portalSettings.HomeDirectory.Length);
}
示例3: AddCoursePage
public TabInfo AddCoursePage(string tabName, string tabTitle)
{
PortalSettings portalSettings = new PortalSettings();
int portalId = portalSettings.PortalId;
TabController tabController = new TabController();
TabInfo getTab = tabController.GetTabByName(tabName, portalId);
if (getTab != null)
throw new Exception("Cannot create Page. Page with this PageName already exists");
TabInfo newTab = new TabInfo();
newTab.PortalID = portalId;
newTab.TabName = tabName;
newTab.Title = tabTitle;
newTab.SkinSrc = "[G]Skins/20047-UnlimitedColorPack-033/CoursePage.ascx";
newTab.ContainerSrc = portalSettings.DefaultPortalContainer;
CommonTabSettings(newTab);
AddViewPermissions(newTab);
int tabId = tabController.AddTab(newTab, true);
DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(tabId);
AddTabURL(newTab); //Makes the URL of Page /4 or /C4
// add modules to new page
AddModuleToPage(newTab, ModuleType.DisplayCourse);
AddModuleToPage(newTab, ModuleType.Rating);
AddModuleToPage(newTab, ModuleType.Comments);
return newTab;
}
示例4: GetZoneID
/// <summary>
/// Returns the ZoneID from PortalSettings
/// </summary>
/// <param name="portalId"></param>
/// <returns></returns>
public static int? GetZoneID(int portalId)
{
// additional protection agains invalid portalid which may come from bad dnn configs and execute in search-index mode
// see https://github.com/2sic/2sxc/issues/1054
if (portalId < 0)
throw new Exception("Can't get zone for invalid portal ID: " + portalId);
var zoneSettingKey = Settings.PortalSettingsPrefix + "ZoneID";
var c = PortalController.GetPortalSettingsDictionary(portalId);
var portalSettings = new PortalSettings(portalId);
int zoneId;
// Create new zone automatically
if (!c.ContainsKey(zoneSettingKey))
{
var newZone = AddZone(portalSettings.PortalName + " (Portal " + portalId + ")");
SetZoneID(newZone.ZoneID, portalId);
zoneId = newZone.ZoneID;
}
else
{
zoneId = Int32.Parse(c[zoneSettingKey]);
}
return zoneId;
}
示例5: App
public App(int appId, int zoneId, PortalSettings ownerPS, IDataSource parentSource = null)
{
AppId = appId;
ZoneId = zoneId;
//InitialSource = parentSource;
OwnerPS = ownerPS;
}
示例6: GetInstance
public static UniversityPortalConfig GetInstance (int portalId)
{
var lazyPortalConfig = portalConfigs.GetOrAdd (portalId, newKey =>
new Lazy<UniversityPortalConfig> (() => {
var portalSettings = new PortalSettings (portalId);
var portalConfigFile = Path.Combine (portalSettings.HomeDirectoryMapPath, "R7.University.yml");
// ensure portal config file exists
if (!File.Exists (portalConfigFile)) {
File.Copy (Path.Combine (
Globals.ApplicationMapPath,
"DesktopModules\\R7.University\\R7.University\\R7.University.yml"),
portalConfigFile);
}
using (var configReader = new StringReader (File.ReadAllText (portalConfigFile))) {
var deserializer = new Deserializer (namingConvention: new HyphenatedNamingConvention ());
return deserializer.Deserialize<UniversityPortalConfig> (configReader);
}
}
));
return lazyPortalConfig.Value;
}
示例7: SyndicationFeedFormatter
public SyndicationFeedFormatter(PortalSettings portalSettings, HttpRequest request)
{
this.portalSettings = portalSettings;
this.request = request;
SupportedMediaTypes.Add(new MediaTypeHeaderValue(atom));
SupportedMediaTypes.Add(new MediaTypeHeaderValue(rss));
}
示例8: App
//public App(int zoneId, int appId, PortalSettings ownerPortalSettings): this(...)
// todo: I should change the order of the parameters app/zone because this is the only
// system which reverses it with app-first
// better to create two overloads, but when I have two parameters, assume that zone is first
// 2016-04-04 2dm: wait with refactoring/correcting this till 2tk checks in his code
public App(int zoneId, int appId, PortalSettings ownerPortalSettings, bool allowSideEffects = true)
{
// require valid ownerPS - note: not sure what this is actually used for
if (ownerPortalSettings == null)
throw new Exception("no portal settings received");
// if zone is missing, try to find it; if still missing, throw error
if (zoneId == -1) zoneId = ZoneHelpers.GetZoneID(ownerPortalSettings.PortalId) ?? -1;
if (zoneId == -1) throw new Exception("Cannot find zone-id for portal specified");
// Save basic values
AppId = appId;
ZoneId = zoneId;
OwnerPortalSettings = ownerPortalSettings;
// 2016-03-27 2dm: move a bunch of stuff to here from AppManagement.GetApp
// the code there was a slight bit different, could still cause errors
// Look up name
// Get appName from cache
AppGuid = ((BaseCache)DataSource.GetCache(zoneId, null)).ZoneApps[zoneId].Apps[appId];
if (AppGuid == Constants.DefaultAppName)
Name = Folder = ContentAppName;
else
InitializeResourcesSettingsAndMetadata(allowSideEffects);
}
示例9: GetDnnHttpHandler
public IHttpHandler GetDnnHttpHandler(RequestContext requestContext, int portal, int tab, string[] passThrough)
{
PortalController pcontroller = new PortalController();
PortalInfo pinfo = pcontroller.GetPortal(portal);
PortalAliasController pacontroller = new PortalAliasController();
PortalAliasCollection pacollection = pacontroller.GetPortalAliasByPortalID(portal);
//pacollection.
//PortalSettings psettings = new PortalSettings(pinfo);
PortalSettings psettings = new PortalSettings(tab, portal); // 64 is the stats tab. TODO: get by page name and not hardcoded id
foreach (string key in pacollection.Keys)
{
psettings.PortalAlias = pacollection[key];
}
TabController tcontroller = new TabController();
// psettings.ActiveTab = tcontroller.GetTab(57, 0, true); // 57 is the profile tab.
requestContext.HttpContext.Items["PortalSettings"] = psettings;
requestContext.HttpContext.Items["UrlRewrite:OriginalUrl"] = requestContext.HttpContext.Request.RawUrl;
//UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetUserByName(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);
UserInfo uinfo = requestContext.HttpContext.User == null ? new UserInfo() : UserController.GetCachedUser(psettings.PortalId, requestContext.HttpContext.User.Identity.Name);
requestContext.HttpContext.Items["UserInfo"] = uinfo;
foreach (string s in passThrough)
{
requestContext.HttpContext.Items[s] = requestContext.RouteData.Values[s];
}
IHttpHandler page = BuildManager.CreateInstanceFromVirtualPath(VirtualPath, typeof(DotNetNuke.Framework.PageBase)) as IHttpHandler;
return page;
}
示例10: AdamNavigator
public AdamNavigator(SxcInstance sexy, App app, PortalSettings ps, Guid entityGuid, string fieldName)
{
EntityBase = new EntityBase(sexy, app, ps, entityGuid, fieldName);
Manager = new AdamManager(ps.PortalId, app);
if (!Exists)
return;
var f = Manager.Get(Root) as FolderInfo;
if (f == null)
return;
PortalID = f.PortalID;
FolderPath = f.FolderPath;
MappedPath = f.MappedPath;
StorageLocation = f.StorageLocation;
IsProtected = f.IsProtected;
IsCached = f.IsCached;
FolderMappingID = f.FolderMappingID;
LastUpdated = f.LastUpdated;
FolderID = f.FolderID;
DisplayName = f.DisplayName;
DisplayPath = f.DisplayPath;
IsVersioned = f.IsVersioned;
KeyID = f.KeyID;
ParentID = f.ParentID;
UniqueId = f.UniqueId;
VersionGuid = f.VersionGuid;
WorkflowID = f.WorkflowID;
// IAdamItem interface properties
Name = DisplayName;
}
示例11: BecomeUser
public string BecomeUser(int userToBecomeId, int currentlyLoggedInUser, HttpContext context, PortalSettings portalSettings, HttpSessionState sessionState)
{
string url = string.Empty;
string sessionStateName = string.Empty;
if (Settings[ModuleSettingsNames.SessionObject] != null)
sessionStateName = Settings[ModuleSettingsNames.SessionObject].ToString();
if (userToBecomeId > 0)
{
DataCache.ClearUserCache(portalSettings.PortalId, context.User.Identity.Name);
PortalSecurity portalSecurity = new PortalSecurity();
portalSecurity.SignOut();
UserInfo newUserInfo = UserController.GetUserById(portalSettings.PortalId, userToBecomeId);
if (newUserInfo != null)
{
sessionState.Contents[sessionStateName] = null;
UserController.UserLogin(portalSettings.PortalId, newUserInfo, portalSettings.PortalName, HttpContext.Current.Request.UserHostAddress, false);
if (currentlyLoggedInUser != 0)
{
sessionState[sessionStateName] = currentlyLoggedInUser;
}
else
{
sessionState[sessionStateName] = null;
}
url = (context.Request.UrlReferrer.AbsoluteUri);
}
}
return url;
}
示例12: GetTemplates
public static List<ListItem> GetTemplates(PortalSettings portalSettings, int ModuleId, string SelectedTemplate, string moduleSubDir)
{
string basePath = HostingEnvironment.MapPath(GetSiteTemplateFolder(portalSettings, moduleSubDir));
if (!Directory.Exists(basePath))
{
Directory.CreateDirectory(basePath);
}
List<ListItem> lst = new List<ListItem>();
foreach (var dir in Directory.GetDirectories(basePath))
{
string TemplateCat = "Site";
string DirName = Path.GetFileNameWithoutExtension(dir);
int ModId = -1;
if (int.TryParse(DirName, out ModId))
{
if (ModId == ModuleId)
{
TemplateCat = "Module";
}
else
{
continue;
}
}
string scriptName = dir;
if (TemplateCat == "Module")
scriptName = TemplateCat;
else
scriptName = TemplateCat + ":" + scriptName.Substring(scriptName.LastIndexOf("\\") + 1);
string scriptPath = ReverseMapPath(dir);
var item = new ListItem(scriptName, scriptPath);
if (!(string.IsNullOrEmpty(SelectedTemplate)) && scriptPath.ToLowerInvariant() == SelectedTemplate.ToLowerInvariant())
{
item.Selected = true;
}
lst.Add(item);
}
// skin
basePath = HostingEnvironment.MapPath(GetSkinTemplateFolder(portalSettings, moduleSubDir));
if (Directory.Exists(basePath))
{
foreach (var dir in Directory.GetDirectories(basePath))
{
string TemplateCat = "Skin";
string DirName = Path.GetFileNameWithoutExtension(dir);
string scriptName = dir;
scriptName = TemplateCat + ":" + scriptName.Substring(scriptName.LastIndexOf("\\") + 1);
string scriptPath = ReverseMapPath(dir);
var item = new ListItem(scriptName, scriptPath);
if (!(string.IsNullOrEmpty(SelectedTemplate)) && scriptPath.ToLowerInvariant() == SelectedTemplate.ToLowerInvariant())
{
item.Selected = true;
}
lst.Add(item);
}
}
return lst;
}
示例13: GetResourceFile
public static Dictionary<string, string> GetResourceFile(PortalSettings portalSettings, string resourceFile, string locale)
{
return
(Dictionary<string, string>) GetCompiledResourceFileCallBack(
new CacheItemArgs("Compiled-" + resourceFile + "-" + locale + "-" + portalSettings.PortalId,
DataCache.ResourceFilesCacheTimeOut, DataCache.ResourceFilesCachePriority, resourceFile, locale,
portalSettings));
}
示例14: AssetEditor
public AssetEditor(App app, string path, UserInfo userInfo, PortalSettings portalSettings, bool global = false)
{
_app = app;
_userInfo = userInfo;
_portalSettings = portalSettings;
EditInfo = new AssetEditInfo(_app.AppId, _app.Name, path, global);
}
示例15: FriendlyUrl
internal override string FriendlyUrl(TabInfo tab, string path, string pageName, PortalSettings portalSettings)
{
if (portalSettings == null)
{
throw new ArgumentNullException("portalSettings");
}
return FriendlyUrlInternal(tab, path, pageName, String.Empty, portalSettings);
}