本文整理汇总了C#中N2.Web.Site类的典型用法代码示例。如果您正苦于以下问题:C# Site类的具体用法?C# Site怎么用?C# Site使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Site类属于N2.Web命名空间,在下文中一共展示了Site类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileSystemRoot
public FileSystemRoot(string path, Site site)
{
Path = path;
Readers = new PermissionMap(Permission.Read, new[] { "Administrators", "Editors", "Writers" }, new[] { "admin" });
Writers = new PermissionMap(Permission.Write, new[] { "Administrators", "Editors", "Writers" }, new[] { "admin" });
Site = site;
}
示例2: GetUploadFolders
public virtual IEnumerable<string> GetUploadFolders(Site site)
{
foreach (var folder in globalFolders)
yield return folder;
foreach (var folder in site.UploadFolders)
yield return folder;
}
示例3: SiteFilteringLanguageGateway
public SiteFilteringLanguageGateway(ILanguageGateway languages, Site site, IPersister persister, StructureBoundDictionaryCache<int, LanguageInfo[]> languagesCache, DescendantItemFinder descendantFinder)
{
this.languages = languages;
this.site = site;
this.persister = persister;
this.languagesCache = languagesCache;
this.descendantFinder = descendantFinder;
}
示例4: TranslateSpecification
public TranslateSpecification(string editUrl, ILanguage language, ContentItem existingItem, ItemDefinition definition, Site site)
{
EditUrl = editUrl;
Language = language;
ExistingItem = existingItem;
Definition = definition;
Site = site;
IsTranslatable = true;
}
示例5: FileSystemRoot
public FileSystemRoot(FolderElement folder, Site site)
{
Path = FixPath(folder.Path);
if (!string.IsNullOrEmpty(folder.Title))
Title = folder.Title;
Readers = folder.Readers.ToPermissionMap(Permission.Read, new[] { "Administrators", "Editors", "Writers" }, new[] { "admin" });
Writers = folder.Writers.ToPermissionMap(Permission.Write, new[] { "Administrators", "Editors" }, new[] { "admin" });
Site = site;
}
示例6: GetSites
public IEnumerable<Site> GetSites()
{
if (string.IsNullOrEmpty(HostName))
return new Site[0];
Site s = new Site((Parent ?? this).ID, ID, HostName);
s.Wildcards = true;
return new Site[] { s };
}
示例7: GetLanguageGateway
/// <summary>Gets the language gateway manaing translations on the given site.</summary>
/// <param name="managingTranslationsOnSite">the site whose language gateway to get.</param>
/// <returns>A language gateway filtering languages.</returns>
public virtual ILanguageGateway GetLanguageGateway(Site managingTranslationsOnSite)
{
var gateway = languages;
if (Enabled && LanguagesPerSite)
gateway = new SiteFilteringLanguageGateway(languages, managingTranslationsOnSite, persister, languagesCache, descendantFinder);
return Cache
? new CachingLanguageGatewayDecorator(gateway, cacheWrapper, persister, LanguagesPerSite ? managingTranslationsOnSite.StartPageID.ToString() : "global")
: gateway;
}
示例8: GetSites
public IEnumerable<Site> GetSites()
{
if (string.IsNullOrEmpty(HostName))
return new Site[0];
Site s = new Site((Parent ?? this).ID, ID, HostName);
s.Wildcards = true;
if (SiteUpload)
s.UploadFolders.Add(new FileSystemRoot("~/Upload/" + HostName, s) { Title = "Upload (" + HostName + ")" });
return new Site[] {s};
}
示例9: GetChildren_OfSite_ReturnsSiteUploadFolders
public void GetChildren_OfSite_ReturnsSiteUploadFolders()
{
fs.CreateDirectory("/siteupload/");
var start2 = CreateOneItem<RootNode>(2, "start", root);
var site = new Site(1, 2);
site.UploadFolders.Add("/siteupload/");
host.AddSites(new[] { site });
initializer.Start();
var defaultresult = vnf.GetChildren("/");
var siteresult = vnf.GetChildren("/start/");
Assert.That(defaultresult.Any(c => c.Name == "siteupload"), Is.False);
Assert.That(siteresult.Any(c => c.Name == "siteupload"), Is.True);
}
示例10: ExtractSites
public static IList<Site> ExtractSites(HostSection config)
{
List<Site> sites = new List<Site>();
foreach (SiteElement configElement in config.Sites)
{
Site s = new Site(configElement.RootID ?? config.RootID, configElement.ID, configElement.Name);
s.Wildcards = configElement.Wildcards || config.Wildcards;
foreach (FolderElement folder in configElement.UploadFolders)
s.UploadFolders.Add(folder.Path);
foreach (string key in configElement.Settings.AllKeys)
s.Settings[key] = configElement.Settings[key].Value;
sites.Add(s);
}
return sites;
}
示例11: ExtractSites
public static IList<Site> ExtractSites(HostSection config)
{
List<Site> sites = new List<Site>();
foreach (SiteElement configElement in config.Sites)
{
Site s = new Site(configElement.RootID ?? config.RootID, configElement.ID, configElement.Name);
s.Wildcards = configElement.Wildcards || config.Wildcards;
foreach (FolderElement folder in configElement.UploadFolders.AllElements)
{
if (string.IsNullOrEmpty(folder.Path))
throw new ConfigurationErrorsException("Upload path configured for site '" + configElement.Name + "' cannot be empty.");
s.UploadFolders.Add(FixPath(folder.Path));
}
foreach (string key in configElement.Settings.AllKeys)
s.Settings[key] = configElement.Settings[key].Value;
sites.Add(s);
}
return sites;
}
示例12: LocateStartPage
private ContentItem LocateStartPage(ContentItem startPageConfigured)
{
ContentItem startPage = startPageConfigured;
lock (_syncLock)
{
if (host.CurrentSite.StartPageID != host.CurrentSite.RootItemID) // only when start <> root
{
if (startPage != null)
{
if (!(startPage is IStartPage))
{
logger.WarnFormat("Configured start page is no IStartPage #{0} -> {1}",
host.CurrentSite.StartPageID,
startPage.GetType().FullName);
startPage = null;
}
if (startPage != null && !startPage.IsPublished())
{
logger.ErrorFormat("Configured start page is not published #{0} -> {1}", startPage.ID,
startPage.GetType().FullName);
startPage = null;
}
}
if (startPage == null)
{
// try to locate start page below root
var root = persister.Repository.Get(host.CurrentSite.RootItemID);
if (root == null)
{
// no content?
return null;
}
ItemList children = root.GetChildren(new TypeFilter(typeof (IStartPage)), new PublishedFilter());
if (children.Count == 1)
{
startPage = children[0];
logger.InfoFormat("Auto updated start page to #{0} -> {1}", startPage.ID,
startPage.GetType().FullName);
var newSite = new Site(root.ID, startPage.ID);
host.ReplaceSites(newSite, new List<Site>());
}
}
if (startPage == null)
return startPageConfigured; // keep configured
}
}
return startPage;
}
示例13: AddSiteFilesNodes
private void AddSiteFilesNodes(HierarchyNode<ContentItem> parent, Site site, List<ContentItem> selectionTrail)
{
var startPage = Engine.Persister.Get(site.StartPageID);
var sizes = Engine.Resolve<ImageSizeCache>();
HierarchyNode<ContentItem> node = null;
foreach(var dir in Engine.GetContentAdapter<NodeAdapter>(startPage).GetChildren(startPage, Interfaces.Managing).OfType<Directory>())
{
if (node == null)
node = new HierarchyNode<ContentItem>(startPage);
var directoryNode = CreateDirectoryNode(FS, dir, node, selectionTrail);
node.Children.Add(directoryNode);
}
if (node != null)
parent.Children.Add(node);
}
示例14: GetUploadDirectories
public virtual IEnumerable<DirectoryData> GetUploadDirectories(Site site)
{
foreach (var uploadFolder in site.UploadFolders.Where(uf => uf.Readers.Authorizes(WebContext.User, null, Permission.Read)))
{
yield return FileSystem.GetDirectoryOrVirtual(uploadFolder.Path);
}
}
示例15: ReplaceSites
/// <summary>Replaces the site list with new sites.</summary>
/// <param name="newDefaultSite">The default site to use.</param>
/// <param name="newSites">The new site list.</param>
public void ReplaceSites(Site newDefaultSite, IEnumerable<Site> newSites)
{
if(newSites == null) throw new ArgumentNullException("newSites");
var previous = sites;
sites = new SiteTable(newDefaultSite, newSites);
var args = new SitesChangedEventArgs();
args.PreviousDefault = previous.DefaultSite;
args.PreviousSites = previous.Sites;
args.CurrentDefault = sites.DefaultSite;
args.CurrentSites = sites.Sites;
if (SitesChanged != null)
{
SitesChanged.Invoke(this, args);
}
}