本文整理汇总了C#中Kooboo.CMS.Sites.Models.Site类的典型用法代码示例。如果您正苦于以下问题:C# Site类的具体用法?C# Site怎么用?C# Site使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Site类属于Kooboo.CMS.Sites.Models命名空间,在下文中一共展示了Site类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetSelectListItems
public IEnumerable<SelectListItem> GetSelectListItems(System.Web.Routing.RequestContext requestContext, string filter = null)
{
var siteName = requestContext.GetRequestValue("siteName");
var site = new Site(siteName).AsActual();
IEnumerable<Page> pageList = new List<Page>();
var rootPages = Kooboo.CMS.Sites.Services.ServiceFactory.PageManager.All(site, null);
pageList = rootPages.ToList();
foreach (var r in rootPages)
{
this.GenerateList(site, r, ref pageList);
}
if (filter == null)
{
return null;
}
var result = pageList.Where(o => o.VirtualPath.StartsWith(filter, StringComparison.OrdinalIgnoreCase)).Select(o => new SelectListItem { Text = o.VirtualPath, Value = o.VirtualPath });
return result;
}
开发者ID:Epitomy,项目名称:CMS,代码行数:26,代码来源:CustomError_Metadata.cs
示例2: ExecuteResult
public override void ExecuteResult(ControllerContext context)
{
string siteName = context.HttpContext.Request.QueryString["cms_siteName"];
string pageName = context.HttpContext.Request.QueryString["cms_pageName"];
if (string.IsNullOrEmpty(siteName) || string.IsNullOrEmpty(pageName))
{
context.HttpContext.Response.StatusCode = 404;
return;
}
var site = new Site(siteName).AsActual();
if (site == null)
{
context.HttpContext.Response.StatusCode = 404;
return;
}
var page = new Page(site, pageName).AsActual();
if (page == null || page.PagePositions == null)
{
context.HttpContext.Response.StatusCode = 404;
return;
}
var proxyPosition = page.PagePositions.OfType<ProxyPosition>().FirstOrDefault();
if (proxyPosition == null)
{
context.HttpContext.Response.StatusCode = 404;
return;
}
var remoteUrl = context.HttpContext.Request.RawUrl;
var content = _proxyRender.Render(new ProxyRenderContext(context, null, proxyPosition, remoteUrl));
if (content != null && !string.IsNullOrEmpty(content.ToString()))
{
context.HttpContext.Response.Write(content.ToString());
}
}
开发者ID:Godoy,项目名称:CMS,代码行数:35,代码来源:RemoteRequestActionResult.cs
示例3: UpdateTextContent
public string UpdateTextContent(Site site, TextFolder textFolder, string uuid, System.Collections.Specialized.NameValueCollection values, [System.Runtime.InteropServices.OptionalAttribute][System.Runtime.InteropServices.DefaultParameterValueAttribute("")]string userid, string vendor)
{
var schema = textFolder.GetSchema();
var textContent = new TextContent(textFolder.Repository.Name, textFolder.SchemaName, textFolder.FullName);
textContent = _textContentBinder.Bind(schema, textContent, values);
IncomingQueue incomeQueue = new IncomingQueue()
{
Message = null,
Object = new Dictionary<string, object>(textContent),
ObjectUUID = textContent.IntegrateId,
ObjectTitle = textContent.GetSummary(),
Vendor = vendor,
PublishingObject = PublishingObject.TextContent,
Action = PublishingAction.Publish,
SiteName = site.FullName,
Status = QueueStatus.Pending,
UtcCreationDate = DateTime.UtcNow,
UtcProcessedTime = null,
UUID = Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10)
};
_incomeQueueProvider.Add(incomeQueue);
return textContent.IntegrateId;
}
开发者ID:XitasoChris,项目名称:CMS,代码行数:26,代码来源:CmisIncomeDataManager.cs
示例4: ScriptFileUrl
/// <summary>
/// The script file url o fsite
/// </summary>
/// <param name="frontUrlHelper">The front url helper</param>
/// <param name="site">The site</param>
/// <param name="baseUri">Base uri</param>
/// <param name="relativeScriptFilePath">The relative script file path of site</param>
/// <returns></returns>
public static IHtmlString ScriptFileUrl(this FrontUrlHelper frontUrlHelper, Site site, string baseUri, string relativeScriptFilePath, bool forceSSL = false)
{
string resourceDomain = site.ResourceDomain.FormatUrlWithProtocol(forceSSL);
bool scriptFileExists = false;
string scriptFileUrl = String.Empty;
string scriptFilePhysicalPath = String.Empty;
do
{
site = site.AsActual();
ScriptFile scriptFile = new ScriptFile(site, String.Empty);
if (scriptFile != null)
{
scriptFileUrl = UrlUtility.Combine(scriptFile.VirtualPath, relativeScriptFilePath);
scriptFilePhysicalPath = HttpContext.Current.Server.MapPath(scriptFileUrl);
scriptFileExists = File.Exists(scriptFilePhysicalPath);
}
site = site.Parent;
} while (site != null && !scriptFileExists);
if (!String.IsNullOrEmpty(resourceDomain))
{
baseUri = resourceDomain; // CDN have high priority
}
return new HtmlString(UrlUtility.ToHttpAbsolute(baseUri, scriptFileUrl));
}
开发者ID:Qupy,项目名称:Extensions,代码行数:38,代码来源:FrontUrlHelperExtensions.cs
示例5: Initialize
public virtual void Initialize(Site site)
{
var bucketName = site.GetBucketName();
if (!DatabaseHelper.ExistBucket(bucketName))
{
DatabaseHelper.CreateBucket(bucketName);
//此处需暂停几秒钟,否则,通过选择模板创建站点的方式,在导入数据时,会出现数据未导入的情况
//大致原因在于,Couchbae在数据库创建之后,需要几秒钟的初始化过程,在这个过程中插入任何数据都将失败
}
// string viewsTemplate = @"{{
// ""views"": {{
// {0}
// }}
// }}";
// string viewTemplate = @"""{0}"":{{""map"":""function(doc,meta){{if(doc._datatype_==='{1}'){{emit(meta.id,doc);}}}}""}}";
// List<string> views = new List<string>();
// views.Add(string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.PageDataType), ModelExtensions.PageDataType));
// views.Add(string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.PageDraftDataType), ModelExtensions.PageDraftDataType));
// views.Add(string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.HtmlBlockDataType), ModelExtensions.HtmlBlockDataType));
// views.Add(string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.LabelDataType), ModelExtensions.LabelDataType));
// views.Add(string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.LabelCategoryDataType), ModelExtensions.LabelCategoryDataType));
// views.Add(string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.UserDataType), ModelExtensions.UserDataType));
//string document = string.Format(viewsTemplate, string.Join(",", views.ToArray()));
//DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.DesignName, document);
string viewTemplate = @"{{""views"":{{""{0}"":{{""map"":""function(doc,meta){{if(doc._datatype_==='{1}'){{emit(meta.id,null);}}}}""}}}}}}";
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.PageDataType), string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.PageDataType), ModelExtensions.PageDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.PageDraftDataType), string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.PageDraftDataType), ModelExtensions.PageDraftDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.HtmlBlockDataType), string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.HtmlBlockDataType), ModelExtensions.HtmlBlockDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.LabelDataType), string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.LabelDataType), ModelExtensions.LabelDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.LabelCategoryDataType), string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.LabelCategoryDataType), ModelExtensions.LabelCategoryDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.UserDataType), string.Format(viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.UserDataType), ModelExtensions.UserDataType));
System.Threading.Thread.Sleep(3000);
}
开发者ID:2m0nd,项目名称:CMS,代码行数:35,代码来源:SiteInitializer.cs
示例6: EnsureAssembliesExistsInBin
public void EnsureAssembliesExistsInBin(Site site, bool copyParent = true, bool copyChildren = false)
{
var files = GetFiles(site);
foreach (var file in files)
{
if (!_assemblyReferences.IsSystemAssembly(file.PhysicalPath))
{
var fileInBin = GetAssemblyBinFilePath(file.FileName);
File.Copy(file.PhysicalPath, fileInBin, true);
_assemblyReferences.AddReference(file.PhysicalPath, GetReferenceName(site));
}
}
//foreach (var file in files)
//{
// var assembly = GetAssembly(site, file.FileName);
// if (assembly == null)
// {
// var fileInBin = GetAssemblyBinFilePath(file.FileName);
// Assembly.LoadFrom(fileInBin);
// }
//}
if (copyParent && site.Parent != null)
{
EnsureAssembliesExistsInBin(site.Parent, copyParent, copyChildren);
}
if (copyChildren)
{
foreach (var child in ServiceFactory.SiteManager.ChildSites(site))
{
EnsureAssembliesExistsInBin(child, copyParent, copyChildren);
}
}
}
开发者ID:rongzhi-Kooboo,项目名称:CMS,代码行数:35,代码来源:AssemblyManager.cs
示例7: GetAbsolutePageUrl
public static string GetAbsolutePageUrl(Site site, string pageUrl)
{
FrontRequestChannel requestChannel = site.FrontRequestChannel();
string wrapperPageUrl = FrontUrlHelper.WrapperUrl(pageUrl, site, requestChannel).ToString();
string host = GetHost(site);
return HttpContext.Current.Request.ToAbsoluteUrl(host, wrapperPageUrl);
}
开发者ID:Qupy,项目名称:Extensions,代码行数:7,代码来源:PageUtility.cs
示例8: GetAddresses
private ShippingAddressesModel GetAddresses(Site site, ControllerContext controllerContext)
{
var model = new ShippingAddressesModel();
var member = controllerContext.HttpContext.Membership().GetMembershipUser();
var customer = site.Commerce().Customers
.ByAccountId(member.UUID)
.Include(c => c.Addresses)
.FirstOrDefault();
Address defaultAddr = null;
if (customer.ShippingAddressId != null)
{
defaultAddr = customer.Addresses.FirstOrDefault(a => a.Id == customer.ShippingAddressId.Value);
}
if (defaultAddr == null)
{
defaultAddr = customer.Addresses.FirstOrDefault();
}
model.Default = defaultAddr;
model.Alternatives = customer.Addresses.Where(x => x.Id != defaultAddr.Id).ToList();
return model;
}
开发者ID:Wipcore,项目名称:Ecommerce,代码行数:26,代码来源:ShippingPlugin.cs
示例9: EnsureAssembliesExistsInBin
public virtual void EnsureAssembliesExistsInBin(Site site)
{
var files = GetFiles(site);
foreach (var file in files)
{
var fileInBin = GetAssemblyBinFilePath(file.FileName);
if (!File.Exists(fileInBin))
{
File.Copy(file.PhysicalPath, fileInBin);
}
}
foreach (var file in files)
{
var assembly = GetAssembly(site, file.FileName);
if (assembly == null)
{
var fileInBin = GetAssemblyBinFilePath(file.FileName);
Assembly.LoadFrom(fileInBin);
}
}
if (site.Parent != null)
{
EnsureAssembliesExistsInBin(site.Parent);
}
}
开发者ID:Epitomy,项目名称:CMS,代码行数:25,代码来源:AssemblyManager.cs
示例10: OnIncluded
public void OnIncluded(Site site)
{
// Add code here that will be executed when the module was included to the site.
// API access to the local or public file path
// var privatedatafolder = new ModulePathHelper(ModuleAreaRegistration.ModuleName, site).GetModuleLocalFilePath();
}
开发者ID:nikolai80,项目名称:CMS,代码行数:7,代码来源:ModuleEvents.cs
示例11: ModuleContext
protected ModuleContext(Site site, string moduleName, ModuleSettings moduleSettings, ModulePosition position)
{
this.Site = site;
ModuleName = moduleName;
this.ModuleSettings = moduleSettings;
this.ModulePosition = position;
}
开发者ID:jason1234,项目名称:CMS,代码行数:7,代码来源:ModuleContext.cs
示例12: ParseTrackingToken
public static void ParseTrackingToken(Site site, string trackingToken, out string pageVisitRuleName, out string matchedPage)
{
pageVisitRuleName = null;
matchedPage = null;
if (!string.IsNullOrEmpty(trackingToken))
{
try
{
string trackingValue = SecurityHelper.Decrypt(site, trackingToken);
string[] values = trackingValue.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
if (values.Length > 0)
{
pageVisitRuleName = values[0];
matchedPage = values[1];
}
}
catch (Exception e)
{
Kooboo.HealthMonitoring.Log.LogException(e);
}
}
}
开发者ID:ebojangi,项目名称:CMS,代码行数:25,代码来源:ABPageTestTrackingHelper.cs
示例13: GenerateItem
protected virtual MenuItem GenerateItem(Site site, ControllerContext controllerContext, DirectoryResource directoryResource)
{
var menuItem = new MenuItem
{
Text = directoryResource.Name,
Area = "Sites",
Action = "Index",
Controller = "File",
Initializer = new FileFolderItemInitializer(),
Localizable = false
};
menuItem.RouteValues = new System.Web.Routing.RouteValueDictionary();
menuItem.RouteValues["folderPath"] = ((DirectoryEntry)directoryResource).RelativePath;
menuItem.RouteValues["type"] = FileManager.Type;
var subDirs = FileManager.GetDirectories(site, ((DirectoryEntry)directoryResource).RelativePath);
if (subDirs != null && subDirs.Count() > 0)
{
var subList = new List<MenuItem>();
foreach (var sub in subDirs)
{
subList.Add(GenerateItem(site, controllerContext, sub));
}
menuItem.Items = subList;
}
return menuItem;
}
开发者ID:kooboo-jifeng,项目名称:CMS,代码行数:30,代码来源:FileFolderMenuItems.cs
示例14: Initialize
public virtual void Initialize(Site site)
{
var bucketName = site.GetBucketName();
if (!DatabaseHelper.ExistBucket(bucketName))
{
DatabaseHelper.CreateBucket(bucketName);
System.Threading.Thread.Sleep(3000);
//此处需暂停几秒钟,否则,通过选择模板创建站点的方式,在导入数据时,会出现数据未导入的情况
//大致原因在于,Couchbae在数据库创建之后,需要几秒钟的初始化过程,在这个过程中插入任何数据都将失败
}
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.PageDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.PageDataType), ModelExtensions.PageDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.PageDraftDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.PageDraftDataType), ModelExtensions.PageDraftDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.HtmlBlockDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.HtmlBlockDataType), ModelExtensions.HtmlBlockDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.LabelDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.LabelDataType), ModelExtensions.LabelDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.LabelCategoryDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.LabelCategoryDataType), ModelExtensions.LabelCategoryDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.UserDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.UserDataType), ModelExtensions.UserDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.CustomErrorDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.CustomErrorDataType), ModelExtensions.CustomErrorDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.UrlRedirectDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.UrlRedirectDataType), ModelExtensions.UrlRedirectDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.ABPageSettingDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.ABPageSettingDataType), ModelExtensions.ABPageSettingDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.ABPageTestResultDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.ABPageTestResultDataType), ModelExtensions.ABPageTestResultDataType));
DatabaseHelper.CreateDesignDocument(bucketName, ModelExtensions.GetQueryView(ModelExtensions.ABRuleSettingDataType), string.Format(DataHelper.viewTemplate, ModelExtensions.GetQueryView(ModelExtensions.ABRuleSettingDataType), ModelExtensions.ABRuleSettingDataType));
System.Threading.Thread.Sleep(3000);
}
开发者ID:RameshGD,项目名称:CMS,代码行数:25,代码来源:SiteInitializer.cs
示例15: UpdateTextContent
public string UpdateTextContent(Site site, TextFolder textFolder, string integrateId, NameValueCollection values, string userid, string vendor)
{
var integrate = new ContentIntegrateId(integrateId);
var files = values.GetFilesFromValues();
var textContent = _textContentManager.Update(textFolder.Repository, textFolder, integrate.ContentUUID, values, files, DateTime.UtcNow, null, null, userid, true);
return textContent.IntegrateId;
}
开发者ID:Godoy,项目名称:CMS,代码行数:7,代码来源:IIncomeDataManager.cs
示例16: Parse
public static IHtmlString Parse(PagePosition position, Site site)
{
if (position == null) { return null; }
var view = position as ViewPosition;
if (view != null) { return new PageDesignViewContent(view); }
var module = position as ModulePosition;
if (module != null) { return new PageDesignModuleContent(module); }
var html = position as HtmlPosition;
if (html != null) { return new PageDesignHtmlContent(html); }
var folder = position as ContentPosition;
if (folder != null) { return new PageDesignFolderContent(folder); }
var htmlBlock = position as HtmlBlockPosition;
if (htmlBlock != null)
{
var entry = htmlBlock.GetHtmlBlock(site);
if (entry != null)
{
return new PageDesignHtmlBlockContent(htmlBlock, entry.Body);
}
}
return new HtmlString("");
}
开发者ID:Epitomy,项目名称:CMS,代码行数:28,代码来源:PageDesignHolder.cs
示例17: AddTextContent
public string AddTextContent(Site site, TextFolder textFolder, NameValueCollection values, string userid, string vendor)
{
var files = values.GetFilesFromValues();
var categories = values.GetCategories().Select(it => new TextContent(textFolder.Repository.Name, "", it.CategoryFolder) { UUID = it.CategoryUUID }).ToArray();
var textContent = _textContentManager.Add(textFolder.Repository, textFolder, values, files, categories, userid);
return textContent.IntegrateId;
}
开发者ID:Godoy,项目名称:CMS,代码行数:7,代码来源:IIncomeDataManager.cs
示例18: EnsureAssembliesExistsInBin
public void EnsureAssembliesExistsInBin(Site site, bool copyParent = true, bool copyChildren = false)
{
var files = GetFiles(site);
foreach (var file in files)
{
var fileInBin = GetAssemblyBinFilePath(file.FileName);
if (!File.Exists(fileInBin))
{
File.Copy(file.PhysicalPath, fileInBin);
}
}
foreach (var file in files)
{
var assembly = GetAssembly(site, file.FileName);
if (assembly == null)
{
var fileInBin = GetAssemblyBinFilePath(file.FileName);
Assembly.LoadFrom(fileInBin);
}
}
if (copyParent && site.Parent != null)
{
EnsureAssembliesExistsInBin(site.Parent, copyParent, copyChildren);
}
if (copyChildren)
{
foreach (var child in ServiceFactory.SiteManager.ChildSites(site))
{
EnsureAssembliesExistsInBin(child, copyParent, copyChildren);
}
}
}
开发者ID:jason1234,项目名称:CMS,代码行数:32,代码来源:AssemblyManager.cs
示例19: CreateRedirectResult
public static ActionResult CreateRedirectResult(Site site, FrontRequestChannel channel, string url, string rawUrl, int? statusCode, RedirectType redirectType)
{
var redirectUrl = url;
if (!UrlUtility.IsAbsoluteUrl(redirectUrl))
{
redirectUrl = UrlUtility.ResolveUrl(redirectUrl);
//WrapperUrl will cause endless loop if site host by ASP.NET development server when transfer redirect.
if (redirectType != RedirectType.Transfer || Settings.IsHostByIIS)
{
redirectUrl = FrontUrlHelper.WrapperUrl(redirectUrl, site, channel).ToString();
}
}
if (!string.IsNullOrEmpty(rawUrl))
{
redirectUrl = redirectUrl.AddQueryParam("errorpath", rawUrl);
}
if (statusCode != null)
{
redirectUrl = redirectUrl.AddQueryParam("statusCode", statusCode.ToString());
}
switch (redirectType)
{
case RedirectType.Moved_Permanently_301:
return new Redirect301Result(redirectUrl);
case RedirectType.Transfer:
return new TransferResult(redirectUrl, statusCode ?? 200);
case RedirectType.Found_Redirect_302:
default:
return new RedirectResult(redirectUrl);
}
}
开发者ID:jason1234,项目名称:CMS,代码行数:33,代码来源:RedirectHelper.cs
示例20: ModulePath
public ModulePath(string moduleName, Site site)
{
ModuleName = moduleName;
Site = site;
PhysicalPath = PhysicalPathAccessor(moduleName);
VirtualPath = VirtualPathAccessor(moduleName);
}
开发者ID:Godoy,项目名称:CMS,代码行数:7,代码来源:ModulePath.cs
注:本文中的Kooboo.CMS.Sites.Models.Site类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论