本文整理汇总了C#中Kooboo.CMS.Content.Models.TextFolder.GetSchema方法的典型用法代码示例。如果您正苦于以下问题:C# TextFolder.GetSchema方法的具体用法?C# TextFolder.GetSchema怎么用?C# TextFolder.GetSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kooboo.CMS.Content.Models.TextFolder
的用法示例。
在下文中一共展示了TextFolder.GetSchema方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: BatchPublish
public virtual ActionResult BatchPublish(string folderName, string parentFolder, string[] docArr)
{
JsonResultEntry entry = new JsonResultEntry();
try
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
if (docArr != null)
{
foreach (var doc in docArr)
{
if (string.IsNullOrEmpty(doc)) continue;
ServiceFactory.TextContentManager.Update(Repository, schema, doc, new string[] { "Published" },
new object[] { true }, User.Identity.Name);
}
}
entry.SetSuccess();
}
catch (Exception e)
{
entry.AddException(e);
}
return Json(entry);
}
示例3: AddTextContent
public string AddTextContent(Site site, TextFolder textFolder, 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();
foreach (string key in values)
{
textContent[key] = values[key];
}
textContent.Repository = textFolder.Repository.Name;
textContent.SchemaName = textFolder.SchemaName;
textContent.FolderName = textFolder.FullName;
if (!string.IsNullOrEmpty(values["UUID"]))
{
textContent.UUID = values["UUID"];
}
textContent = _textContentBinder.Bind(schema, textContent, values, true, false);
IncomingQueue incomeQueue = new IncomingQueue(site, Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10))
{
Message = null,
Object = new Dictionary<string, object>(textContent),
ObjectUUID = textContent.IntegrateId,
ObjectTitle = textContent.GetSummary(),
Vendor = vendor,
PublishingObject = PublishingObject.TextContent,
Action = PublishingAction.Publish,
Status = QueueStatus.Pending,
UtcCreationDate = DateTime.UtcNow,
UtcProcessedTime = null
};
_incomeQueueProvider.Add(incomeQueue);
return textContent.IntegrateId;
}
示例4: Delete
public virtual ActionResult Delete(string folderName, string parentFolder, string[] docArr, string[] folderArr)
{
JsonResultEntry entry = new JsonResultEntry();
try
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
if (docArr != null)
{
foreach (var doc in docArr)
{
if (string.IsNullOrEmpty(doc)) continue;
ServiceFactory.TextContentManager.Delete(Repository, textFolder, doc);
}
}
if (folderArr != null)
{
foreach (var f in folderArr)
{
if (string.IsNullOrEmpty(f)) continue;
var folderPathArr = FolderHelper.SplitFullName(f);
ServiceFactory.TextFolderManager.Remove(Repository, new TextFolder(Repository, folderPathArr));
}
}
entry.SetSuccess();
}
catch (Exception e)
{
entry.AddException(e);
}
return Json(entry);
}
示例5: Diff
public virtual ActionResult Diff(string folderName, string parentFolder, string uuid, int v1, int v2)
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
var textContent = schema.CreateQuery().WhereEquals("UUID", uuid).FirstOrDefault();
var version1 = VersionManager.GetVersion(textContent, v1);
var version1Content = new TextContent(version1.TextContent);
var version2 = VersionManager.GetVersion(textContent, v2);
var version2Content = new TextContent(version2.TextContent);
var sideBySideDiffBuilder = new SideBySideDiffBuilder(new Differ());
var model = new TextContentDiffModel() { UUID = uuid, Version1Name = v1, Version2Name = v2 };
foreach (var k in textContent.Keys)
{
var version1Text = version1Content[k] != null ? version1Content[k].ToString() : "";
var version2Text = version2Content[k] != null ? version2Content[k].ToString() : "";
var diffModel = sideBySideDiffBuilder.BuildDiffModel(version1Text, version2Text);
model.Version1.Add(k, diffModel.OldText);
model.Version2.Add(k, diffModel.NewText);
}
return View(model);
}
示例6: 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);
}
示例7: ReconfigContent
public virtual ActionResult ReconfigContent(IEnumerable<ContentSorter> list, string folderName, string uuid, string parentUUID)
{
JsonResultEntry entry = new JsonResultEntry();
try
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
if (!string.IsNullOrEmpty(uuid) && string.Compare(uuid, parentUUID, true) != 0)
{
ServiceFactory.TextContentManager.Update(textFolder, uuid, new[] { "ParentUUID", "ParentFolder" },
new[] { parentUUID, folderName }, User.Identity.Name);
}
var schema = textFolder.GetSchema().AsActual();
foreach (var c in list)
{
ServiceFactory.TextContentManager.Update(Repository, schema, c.UUID, new string[] { "Sequence" }, new object[] { c.Sequence }, User.Identity.Name);
}
}
catch (Exception e)
{
entry.AddException(e);
}
return Json(entry);
}
示例8: Localize
public virtual void Localize(TextFolder textFolder, string uuid)
{
Update(textFolder.Repository, textFolder.GetSchema(), uuid, new string[] { "IsLocalized" }, new object[] { true });
}
示例9: Publish
public virtual ActionResult Publish(string folderName, string uuid)
{
var data = new JsonResultData(ModelState);
data.RunWithTry((resultData) =>
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
TextContent textContent = schema.CreateQuery().WhereEquals("UUID", uuid).FirstOrDefault();
var published = (bool?)textContent["Published"];
if (published.HasValue && published.Value == true)
{
TextContentManager.Update(Repository, schema, uuid, new string[] { "Published" }, new object[] { false }, User.Identity.Name);
}
else
{
TextContentManager.Update(Repository, schema, uuid, new string[] { "Published" }, new object[] { true }, User.Identity.Name);
}
});
return Json(data);
}
示例10: 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);
//.........这里部分代码省略.........
示例11: Delete
public virtual ActionResult Delete(string folderName, string parentFolder, string[] folders, string[] docs)
{
var data = new JsonResultData(ModelState);
data.RunWithTry((resultData) =>
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
if (docs != null)
{
foreach (var doc in docs)
{
if (string.IsNullOrEmpty(doc)) continue;
TextContentManager.Delete(Repository, textFolder, doc);
}
}
if (folders != null)
{
foreach (var f in folders)
{
if (string.IsNullOrEmpty(f)) continue;
var folderPathArr = FolderHelper.SplitFullName(f);
TextFolderManager.Remove(Repository, new TextFolder(Repository, folderPathArr));
}
}
resultData.ReloadPage = true;
});
return Json(data);
}
示例12: Edit
public virtual ActionResult Edit(string folderName, string uuid, FormCollection form, string @return, bool localize = false)
{
var data = new JsonResultData();
try
{
if (ModelState.IsValid)
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
SchemaPath schemaPath = new SchemaPath(schema);
IEnumerable<TextContent> addedCategories;
IEnumerable<TextContent> removedCategories;
ParseCategories(form, out addedCategories, out removedCategories);
ContentBase content;
content = TextContentManager.Update(Repository, textFolder, uuid, form,
Request.Files, DateTime.UtcNow, addedCategories, removedCategories, User.Identity.Name);
if (localize == true)
{
TextContentManager.Localize(textFolder, uuid);
}
data.RedirectToOpener = true;
data.RedirectUrl = @return;
}
}
catch (RuleViolationException violationException)
{
foreach (var item in violationException.Issues)
{
ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
}
data.Success = false;
}
catch (Exception e)
{
data.AddException(e);
}
data.AddModelState(ModelState);
return Json(data);
}
示例13: Create
public virtual ActionResult Create(string folderName, string parentFolder, string parentUUID, FormCollection form, string @return)
{
var data = new JsonResultData();
try
{
if (ModelState.IsValid)
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
SchemaPath schemaPath = new SchemaPath(schema);
IEnumerable<TextContent> addedCategories;
IEnumerable<TextContent> removedCategories;
ParseCategories(form, out addedCategories, out removedCategories);
ContentBase content;
content = TextContentManager.Add(Repository, textFolder, parentFolder, parentUUID, form, Request.Files, addedCategories, User.Identity.Name);
data.RedirectUrl = @return;
}
}
catch (RuleViolationException ruleEx)
{
foreach (var item in ruleEx.Issues)
{
data.AddFieldError(item.PropertyName, item.ErrorMessage);
}
}
catch (Exception e)
{
data.AddException(e);
}
data.AddModelState(ModelState);
return Json(data);
}
示例14: Copy
public virtual ActionResult Copy(string folderName, string parentFolder, string[] docs)
{
var data = new JsonResultData(ModelState);
data.RunWithTry((resultData) =>
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
if (docs != null)
{
foreach (var doc in docs)
{
if (string.IsNullOrEmpty(doc)) continue;
TextContentManager.Copy(textFolder.GetSchema(), doc);
}
}
data.ReloadPage = true;
});
return Json(data);
}
示例15: BatchUnpublish
public virtual ActionResult BatchUnpublish(string folderName, string[] docs)
{
var data = new JsonResultData(ModelState);
data.RunWithTry((resultData) =>
{
TextFolder textFolder = new TextFolder(Repository, folderName).AsActual();
var schema = textFolder.GetSchema().AsActual();
if (docs != null)
{
foreach (var doc in docs)
{
if (string.IsNullOrEmpty(doc)) continue;
TextContentManager.Update(Repository, schema, doc, new string[] { "Published" },
new object[] { false }, User.Identity.Name);
}
}
resultData.ReloadPage = true;
});
return Json(data);
}