本文整理汇总了C#中Kooboo.CMS.Content.Models.TextFolder.GetFormTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# TextFolder.GetFormTemplate方法的具体用法?C# TextFolder.GetFormTemplate怎么用?C# TextFolder.GetFormTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kooboo.CMS.Content.Models.TextFolder
的用法示例。
在下文中一共展示了TextFolder.GetFormTemplate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
public virtual ActionResult Index(string folderName, string parentUUID, string parentFolder, string search
, IEnumerable<WhereClause> whereClause, int? page, int? pageSize, string orderField = null, string direction = null)
{
//compatible with the Folder parameter changed to FolderName.
folderName = folderName ?? this.ControllerContext.RequestContext.GetRequestValue("Folder");
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
SchemaPath schemaPath = new SchemaPath(schema);
ViewData["Folder"] = textFolder;
ViewData["Schema"] = schema;
ViewData["Template"] = textFolder.GetFormTemplate(FormType.Grid);
ViewData["WhereClause"] = whereClause;
SetPermissionData(textFolder);
IEnumerable<TextFolder> childFolders = new TextFolder[0];
//Skip the child folders on the embedded folder grid.
if (string.IsNullOrEmpty(parentFolder))
{
if (!page.HasValue || page.Value <= 1)
{
childFolders = ServiceFactory.TextFolderManager.ChildFolders(textFolder, search).Select(it => it.AsActual());
}
}
IContentQuery<TextContent> query = textFolder.CreateQuery();
if (string.IsNullOrEmpty(orderField))
{
query = query.DefaultOrder();
}
else
{
if (!string.IsNullOrEmpty(direction) && direction.ToLower() == "desc")
{
query = query.OrderByDescending(orderField);
}
else
{
query = query.OrderBy(orderField);
}
}
bool showTreeStyle = schema.IsTreeStyle;
//如果有带搜索条件,则不输出树形结构
if (!string.IsNullOrEmpty(search))
{
IWhereExpression exp = new FalseExpression();
foreach (var item in schema.Columns.Where(it => it.ShowInGrid))
{
exp = new OrElseExpression(exp, (new WhereContainsExpression(null, item.Name, search)));
}
if (exp != null)
{
query = query.Where(exp);
}
showTreeStyle = false;
}
if (whereClause != null && whereClause.Count() > 0)
{
var expression = WhereClauseToContentQueryHelper.Parse(whereClause, schema, new MVCValueProviderWrapper(ValueProvider));
query = query.Where(expression);
showTreeStyle = false;
}
if (!string.IsNullOrWhiteSpace(parentUUID))
{
query = query.WhereEquals("ParentUUID", parentUUID);
}
else
{
//有两种情况需要考虑要不要查询所有的数据(ParentUUID=null)
//1.树形结构数据,第一次查询需要过滤ParentUUID==null
//2.自嵌套的目前结构,也需要过滤ParentUUID==null
var selfEmbedded = textFolder.EmbeddedFolders != null && textFolder.EmbeddedFolders.Contains(textFolder.FullName, StringComparer.OrdinalIgnoreCase);
if (showTreeStyle || selfEmbedded)
{
query = query.Where(new OrElseExpression(new WhereEqualsExpression(null, "ParentUUID", null), new WhereEqualsExpression(null, "ParentUUID", "")));
}
}
if (childFolders != null)
{
childFolders = childFolders
.Select(it => it.AsActual())
.Where(it => it.VisibleOnSidebarMenu == null || it.VisibleOnSidebarMenu.Value == true)
.Where(it => Kooboo.CMS.Content.Services.ServiceFactory.WorkflowManager.AvailableViewContent(it, User.Identity.Name));
}
page = page ?? 1;
pageSize = pageSize ?? textFolder.PageSize;
//var pagedList = query.ToPageList(page.Value, pageSize.Value);
//IEnumerable<TextContent> contents = pagedList.ToArray();
//if (Repository.EnableWorkflow == true)
//{
// contents = ServiceFactory.WorkflowManager.GetPendWorkflowItemForContents(Repository, contents.ToArray(), User.Identity.Name);
//}
//var workflowContentPagedList = new PagedList<TextContent>(contents, page.Value, pageSize.Value, pagedList.TotalItemCount);
//.........这里部分代码省略.........
示例2: Create
public virtual ActionResult Create(string folderName, string parentFolder)
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
SchemaPath schemaPath = new SchemaPath(schema);
ViewData["Folder"] = textFolder;
ViewData["Schema"] = schema;
ViewData["Template"] = textFolder.GetFormTemplate(FormType.Create);
SetPermissionData(textFolder);
var content = schema.DefaultContent();
content = Kooboo.CMS.Content.Models.Binder.TextContentBinder.DefaultBinder.Bind(schema, content, Request.QueryString, true, false);
return View(content);
}
示例3: Edit
public virtual ActionResult Edit(string folderName, string parentFolder, string uuid)
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
SchemaPath schemaPath = new SchemaPath(schema);
ViewData["Folder"] = textFolder;
ViewData["Schema"] = schema;
ViewData["Template"] = textFolder.GetFormTemplate(FormType.Update);
SetPermissionData(textFolder);
var content = schema.CreateQuery().WhereEquals("UUID", uuid).FirstOrDefault();
if (content != null)
{
content = ServiceFactory.WorkflowManager.GetPendWorkflowItemForContent(Repository, content, User.Identity.Name);
}
return View(content);
}
示例4: Create
public virtual ActionResult Create(string folderName, string parentFolder, string LikeUUID)
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
SchemaPath schemaPath = new SchemaPath(schema);
ViewData["Folder"] = textFolder;
ViewData["Schema"] = schema;
ViewData["Menu"] = textFolder.GetFormTemplate(FormType.Create_Menu);
ViewData["Template"] = textFolder.GetFormTemplate(FormType.Create);
SetPermissionData(textFolder);
var content = Binder.Default(schema);
content = Binder.Bind(schema, content, Request.QueryString, true, false);
// copy categories and parentUUID - TODO
if (!String.IsNullOrEmpty(LikeUUID))
{
// želimo kategorije iz zadanog itema
var contentLike = schema.CreateQuery().WhereEquals("UUID", LikeUUID).FirstOrDefault();
// sve kategorije za ovaj folder
List<TextContent> addedCategories = new List<TextContent>();
foreach (CategoryFolder cf in textFolder.Categories)
{
addedCategories.AddRange(contentLike.Categories(cf.FolderName));
}
// copy parentUUID
content.ParentUUID = contentLike.ParentUUID;
var cb = TextContentManager.Add(Repository, textFolder, content.ParentFolder, content.ParentUUID, content.ToNameValueCollection(), Request.Files, addedCategories, User.Identity.Name);
content = new TextContent(cb);
}
return View(content);
}