本文整理汇总了C#中umbraco.cms.businesslogic.web.Document.Move方法的典型用法代码示例。如果您正苦于以下问题:C# Document.Move方法的具体用法?C# Document.Move怎么用?C# Document.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umbraco.cms.businesslogic.web.Document
的用法示例。
在下文中一共展示了Document.Move方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BtnMoveClick
protected void BtnMoveClick(object sender, EventArgs e)
{
if (Category.Id != ddlCategories.SelectedValue.ToInt32())
{
// Get the document you will move by its ID
var doc = new Document(Topic.Id);
// Create a user we can use for both
var user = new User(0);
// The new parent ID
var newParentId = ddlCategories.SelectedValue.ToInt32();
// Now update the topic parent category ID
doc.getProperty("forumTopicParentCategoryID").Value = newParentId;
// publish application node
doc.Publish(user);
// Move the document the new parent
doc.Move(newParentId);
// update the document cache so its available in the XML
umbraco.library.UpdateDocumentCache(doc.Id);
// Redirect and show message
Response.Redirect(string.Concat(CurrentPageAbsoluteUrl, "?m=", library.GetDictionaryItem("TopicHasBeenMovedText")));
}
else
{
// Can't move as they have selected the category that the topic is already in
Response.Redirect(string.Concat(CurrentPageAbsoluteUrl, "?m=", library.GetDictionaryItem("TopicAlreadyInThisCategory")));
}
}
示例2: Page_Load
protected void Page_Load(object s, EventArgs e)
{
var user = global::umbraco.BusinessLogic.User.GetUser(0);
using (CmsContext.Editing)
{
var result = new StringBuilder();
foreach (var newspage in CmsService.Instance.SelectItems<NewsPage>("/Content//*{NewsPage}"))
{
var sender = new Document(newspage.Id.IntValue);
if (newspage.Date.HasValue)
{
var newsArchivePart = CmsService.Instance.GetSystemPath("NewsArchivePage");
var yearPart = newspage.Date.Value.Year.ToString();
var monthPart = Urls.MonthArray.Split('|')[newspage.Date.Value.Month - 1];
var truePath = Paths.Combine(newsArchivePart, yearPart, monthPart, sender.Text);
if (truePath != newspage.Path)
{
var yearPage = CmsService.Instance.GetItem<NewsListPage>(Paths.Combine(newsArchivePart, yearPart));
if (yearPage == null)
{
var archivePage = CmsService.Instance.GetItem<NewsListPage>(newsArchivePart);
yearPage = CmsService.Instance.CreateEntity<NewsListPage>(yearPart, archivePage);
}
var monthPage = CmsService.Instance.GetItem<NewsListPage>(Paths.Combine(newsArchivePart, yearPart, monthPart));
if (monthPage == null)
monthPage = CmsService.Instance.CreateEntity<NewsListPage>(monthPart, yearPage);
sender.Move(monthPage.Id.IntValue);
}
}
}
library.RefreshContent();
litOutput.Text = result.ToString();
}
}
示例3: HandleOk
public override DialogResponse HandleOk()
{
var response = new DialogResponse("ShareModule", true);
var folderId = Convert.ToInt32(treeview.SelectedValue);
var document = new Document(Convert.ToInt32(Request.QueryString["mid"]));
document.Move(folderId);
global::umbraco.library.UpdateDocumentCache(document.Id);
response.AddValue("parentId", folderId);
response.AddValue("moduleId", document.Id.ToString());
return response;
}
示例4: BeforeDocumentPublish
public void BeforeDocumentPublish(Document document)
{
if (!ItemDocumentTypes.Contains(document.ContentType.Alias) || document.Parent == null)
return;
if (document.getProperty(ItemDateProperty) == null || document.getProperty(ItemDateProperty).Value == null)
return;
Log.Add(LogTypes.Debug, document.User, document.Id, string.Format("Start Auto Documents Before Publish Event for Document {0}", document.Id));
try
{
if (!HasDateChanged(document))
return;
DateTime itemDate = Convert.ToDateTime(document.getProperty(ItemDateProperty).Value);
Node parent = GetParentDocument(new Node(document.Parent.Id));
if (parent == null)
return;
var yearNode = GetOrCreateNode(document.User, parent, itemDate.Year.ToString(CultureInfo.InvariantCulture));
var monthNode = GetOrCreateNode(document.User, yearNode, itemDate.ToString("MM"));
var parentNode = monthNode;
if (CreateDayDocuments)
{
var dayNode = GetOrCreateNode(document.User, monthNode, itemDate.ToString("dd"));
parentNode = dayNode;
}
if (parentNode != null && document.Parent.Id != parentNode.Id)
{
document.Move(parentNode.Id);
Log.Add(LogTypes.Debug, document.User, document.Id, string.Format("Item {0} moved uder node {1}", document.Id, parentNode.Id));
}
}
catch (Exception ex)
{
Log.Add(LogTypes.Error, document.User, document.Id, string.Format("Error in Auto Documents Before Publish: {0}", ex.Message));
}
library.RefreshContent();
}
示例5: Document_BeforePublish
//.........这里部分代码省略.........
Guid previousVersion = postVersions[postVersions.Length - 2].Version;
Document doc = new Document(sender.Id, previousVersion);
DateTime previousPostDate = System.Convert.ToDateTime(doc.getProperty("PostDate").Value);
_versionCheck = (postDate != previousPostDate);
}
if (_versionCheck) //Only do the date folder movement if the PostDate is changed or is new Post.
{
string[] strArray = { postDate.Year.ToString(), postDate.Month.ToString(), postDate.Day.ToString() };
if (strArray.Length == 3)
{
Node topBlogLevel = new Node(sender.Parent.Id);
//Traverse up the tree to Find the Blog Node since we are likely in a Date Folder path
while (topBlogLevel != null && topBlogLevel.NodeTypeAlias != "Blog")
{
if (topBlogLevel.Parent != null)
{
topBlogLevel = new Node(topBlogLevel.Parent.Id);
}
else
{
topBlogLevel = null;
}
}
if (topBlogLevel != null)
{
Document document = null;
Node folderNode = null;
foreach (Node ni in topBlogLevel.Children)
{
if (ni.Name == strArray[0])
{
folderNode = new Node(ni.Id);
document = new Document(ni.Id);
break;
}
}
if (folderNode == null)
{
document = Document.MakeNew(strArray[0], DocumentType.GetByAlias("DateFolder"), sender.User, topBlogLevel.Id);
document.Publish(sender.User);
library.UpdateDocumentCache(document.Id);
folderNode = new Node(document.Id);
}
Node folderNode2 = null;
foreach (Node ni in folderNode.Children)
{
if (ni.Name == strArray[1])
{
folderNode2 = new Node(ni.Id);
break;
}
}
if (folderNode2 == null)
{
Document document2 = Document.MakeNew(strArray[1], DocumentType.GetByAlias("DateFolder"), sender.User, folderNode.Id);
document2.Publish(sender.User);
library.UpdateDocumentCache(document2.Id);
folderNode2 = new Node(document2.Id);
}
Document document3 = null; //As this is the last check, a document object is fine
foreach (Node ni in folderNode2.Children)
{
if (ni.Name == strArray[2])
{
document3 = new Document(ni.Id);
break;
}
}
if (document3 == null)
{
document3 = Document.MakeNew(strArray[2], DocumentType.GetByAlias("DateFolder"), sender.User, folderNode2.Id);
document3.Publish(sender.User);
library.UpdateDocumentCache(document3.Id);
}
if (sender.Parent.Id != document3.Id)
{
sender.Move(document3.Id);
Log.Add(LogTypes.Debug, sender.User, sender.Id, string.Format("Move Required for BlogPost {0} for PostDate {1}. Moved Under Node {2}", sender.Id, postDate.ToShortDateString(), document3.Id));
}
}
else
{
Log.Add(LogTypes.Debug, sender.User, sender.Id, string.Format("Unable to determine top of Blog for BlogPost {0} while attempting to move to new Post Date", sender.Id));
}
}
}
}
catch (Exception Exp)
{
Log.Add(LogTypes.Debug, sender.User, sender.Id, string.Format("Error while Finding Blog Folders for BlogPost {0} while trying to move to new Post Date. Error: {1}", sender.Id, Exp.Message));
}
umbraco.library.RefreshContent();
}
}
}
}
示例6: saveProject
protected void saveProject(object sender, CommandEventArgs e)
{
Member m = Member.GetCurrentMember();
Document d;
var memberHasEnoughReputation = MemberHasEnoughReputation(m);
if (memberHasEnoughReputation == false)
{
holder.Visible = false;
notallowed.Visible = true;
}
else
{
if (e.CommandName == "save")
{
int pId = int.Parse(e.CommandArgument.ToString());
d = new Document(pId);
if ((int)d.getProperty("owner").Value == m.Id || Utils.IsProjectContributor(m.Id, d.Id))
{
d.Text = tb_name.Text;
d.getProperty("version").Value = tb_version.Text;
d.getProperty("description").Value = tb_desc.Text;
d.getProperty("stable").Value = cb_stable.Checked;
d.getProperty("status").Value = tb_status.Text;
d.getProperty("demoUrl").Value = tb_demoUrl.Text;
d.getProperty("sourceUrl").Value = tb_sourceUrl.Text;
d.getProperty("websiteUrl").Value = tb_websiteUrl.Text;
d.getProperty("vendorUrl").Value = tb_purchaseUrl.Text;
d.getProperty("licenseUrl").Value = tb_licenseUrl.Text;
d.getProperty("licenseName").Value = tb_license.Text;
d.getProperty("file").Value = dd_package.SelectedValue;
d.getProperty("defaultScreenshot").Value = dd_screenshot.SelectedValue;
if (dd_screenshot.SelectedIndex > -1)
{
d.getProperty("defaultScreenshotPath").Value =
new uWiki.Businesslogic.WikiFile(int.Parse(dd_screenshot.SelectedValue)).Path;
}
else
{
d.getProperty("defaultScreenshotPath").Value = "";
}
if (Request["projecttags[]"] != null)
{
Api.CommunityController.SetTags(d.Id.ToString(), "project",
Request["projecttags[]"].ToString());
}
Node category = new Node(int.Parse(dd_category.SelectedValue));
//if we have a proper category, move the package
if (category != null && category.NodeTypeAlias == "ProductGroup") ;
{
if (d.Parent.Id != category.Id)
{
d.Move(category.Id);
}
}
if (d.getProperty("packageGuid") == null ||
string.IsNullOrEmpty(d.getProperty("packageGuid").Value.ToString()))
d.getProperty("packageGuid").Value = Guid.NewGuid().ToString();
d.Save();
d.Publish(new umbraco.BusinessLogic.User(0));
umbraco.library.UpdateDocumentCache(d.Id);
umbraco.library.RefreshContent();
}
}
else
{
d = Document.MakeNew(tb_name.Text, new DocumentType(TypeId), new umbraco.BusinessLogic.User(0),
RootId);
d.getProperty("version").Value = tb_version.Text;
d.getProperty("description").Value = tb_desc.Text;
d.getProperty("stable").Value = cb_stable.Checked;
d.getProperty("demoUrl").Value = tb_demoUrl.Text;
d.getProperty("sourceUrl").Value = tb_sourceUrl.Text;
d.getProperty("websiteUrl").Value = tb_websiteUrl.Text;
d.getProperty("licenseUrl").Value = tb_licenseUrl.Text;
d.getProperty("licenseName").Value = tb_license.Text;
d.getProperty("vendorUrl").Value = tb_purchaseUrl.Text;
//.........这里部分代码省略.........
示例7: Move
public string Move(int wikiId, int target)
{
var currentMemberId = Members.GetCurrentMember().Id;
if (Xslt.IsMemberInGroup("admin", currentMemberId) || Xslt.IsMemberInGroup("wiki editor", currentMemberId))
{
Document document = new Document(wikiId);
Document documentTarget = new Document(target);
if (documentTarget.ContentType.Alias == "WikiPage")
{
Document o = new Document(document.Parent.Id);
document.Move(documentTarget.Id);
document.Save();
document.Publish(new umbraco.BusinessLogic.User(0));
documentTarget.Publish(new umbraco.BusinessLogic.User(0));
o.Publish(new umbraco.BusinessLogic.User(0));
umbraco.library.UpdateDocumentCache(document.Id);
umbraco.library.UpdateDocumentCache(documentTarget.Id);
umbraco.library.UpdateDocumentCache(o.Id);
umbraco.library.RefreshContent();
return umbraco.library.NiceUrl(document.Id);
}
}
return "";
}
示例8: OnDocumentSaved
private static void OnDocumentSaved(Document sender, SaveEventArgs e)
{
if (sender.ContentType.Alias == "NewsPage")
{
using (CmsContext.Editing)
{
var newspage = CmsService.Instance.GetItem<UmbracoPublic.Logic.Entities.NewsPage>(new Id(sender.Id));
if (newspage.Date.HasValue)
{
var newsArchivePart = CmsService.Instance.GetSystemPath("NewsArchivePage", newspage.Path);
if (string.IsNullOrEmpty(newsArchivePart))
return;
var yearPart = newspage.Date.Value.Year.ToString();
var monthPart = Urls.MonthArray.Split('|')[newspage.Date.Value.Month - 1];
var truePath = Paths.Combine(newsArchivePart, yearPart, monthPart, sender.Text);
if (truePath != newspage.Path)
{
var yearPage = CmsService.Instance.GetItem<NewsListPage>(Paths.Combine(newsArchivePart, yearPart));
if (yearPage == null)
{
var archivePage = CmsService.Instance.GetItem<NewsListPage>(newsArchivePart);
yearPage = CmsService.Instance.CreateEntity<NewsListPage>(yearPart, archivePage);
}
var monthPage = CmsService.Instance.GetItem<NewsListPage>(Paths.Combine(newsArchivePart, yearPart, monthPart));
if (monthPage == null)
monthPage = CmsService.Instance.CreateEntity<NewsListPage>(monthPart, yearPage);
sender.Move(monthPage.Id.IntValue);
var page = umbraco.BasePages.BasePage.Current;
page.ClientScript.RegisterStartupScript(page.GetType(), "refreshItem", "top.window.location.href = '/umbraco/umbraco.aspx?app=content&rightAction=editContent&id=" + sender.Id + "#content';", true);
}
}
}
}
else if (sender.ContentType.Alias == "FormsModule")
{
var folderCreated = false;
using (CmsContext.Editing)
{
var module = CmsService.Instance.GetItem<FormsModule>(new Id(sender.Id));
var actionsFolder =
module.GetChildren<FormsActionFolder>().FirstOrDefault(f => f.EntityName == "Actions");
if (actionsFolder == null)
{
CmsService.Instance.CreateEntity<FormsActionFolder>("Actions", module);
folderCreated = true;
}
var fieldsFolder =
module.GetChildren<FormsFieldFolder>().FirstOrDefault(f => f.EntityName == "Fields");
if (fieldsFolder == null)
{
CmsService.Instance.CreateEntity<FormsFieldFolder>("Fields", module);
folderCreated = true;
}
}
if (folderCreated)
{
var page = umbraco.BasePages.BasePage.Current;
page.ClientScript.RegisterStartupScript(page.GetType(), "refreshItem", "top.window.location.href = '/umbraco/umbraco.aspx?app=content&rightAction=editContent&id=" + sender.Id + "#content';", true);
}
}
}
示例9: DocumentAfterMove
static void DocumentAfterMove(object sender, MoveEventArgs e)
{
#region Forum Topic Move Events
var sid = (CMSNode)sender;
var s = new Document(sid.Id);
if (s.ContentType.Alias == "ForumTopic" && s.ParentId != -20)
{
if (s.Parent != null) //If top of tree, something is wrong. Skip.
{
try
{
var postDate = DateTime.Now;
string[] strArray = { postDate.Year.ToString(), postDate.Month.ToString(), postDate.Day.ToString() };
if (strArray.Length == 3)
{
var topPostLevel = new Node(s.Parent.Id);
//Traverse up the tree to find a forum category since we are likely in a Date Folder path
while (topPostLevel != null && topPostLevel.NodeTypeAlias != "ForumCategory")
{
topPostLevel = topPostLevel.Parent != null ? new Node(topPostLevel.Parent.Id) : null;
}
if (topPostLevel != null)
{
Document document;
Node folderNode = null;
foreach (Node ni in topPostLevel.Children)
{
if (ni.Name == strArray[0])
{
folderNode = new Node(ni.Id);
document = new Document(ni.Id);
break;
}
}
if (folderNode == null)
{
document = Document.MakeNew(strArray[0], DocumentType.GetByAlias("ForumDateFolder"), s.User, topPostLevel.Id);
document.Publish(s.User);
library.UpdateDocumentCache(document.Id);
folderNode = new Node(document.Id);
}
Node folderNode2 = null;
foreach (Node ni in folderNode.Children)
{
if (ni.Name == strArray[1])
{
folderNode2 = new Node(ni.Id);
break;
}
}
if (folderNode2 == null)
{
var document2 = Document.MakeNew(strArray[1], DocumentType.GetByAlias("ForumDateFolder"), s.User, folderNode.Id);
document2.Publish(s.User);
library.UpdateDocumentCache(document2.Id);
folderNode2 = new Node(document2.Id);
}
if (s.Parent.Id != folderNode2.Id)
{
s.Move(folderNode2.Id);
}
}
else
{
Log.Add(LogTypes.Debug, s.User, s.Id, string.Format("Unable to determine top category for forum topic {0} while attempting to move to new Topic", s.Id));
}
}
}
catch (Exception exp)
{
Log.Add(LogTypes.Debug, s.User, s.Id, string.Format("Error while Finding Forum Folders for Forum Topic {0} while trying to move to new Topic. Error: {1}", s.Id, exp.Message));
}
library.RefreshContent();
}
}
#endregion
#region Category
if (s.ContentType.Alias == "ForumCategory" && s.ParentId != -20)
{
s.getProperty("forumCategoryParentID").Value = s.ParentId;
}
#endregion
}
示例10: HandleDocumentMoveOrCopy
private void HandleDocumentMoveOrCopy()
{
if (Request.GetItemAsString("copyTo") != "" && Request.GetItemAsString("id") != "")
{
// Check if the current node is allowed at new position
var nodeAllowed = false;
IContentBase currContent;
IContentBase parentContent = null;
IContentTypeBase parentContentType = null;
if (CurrentApp == "content")
{
currContent = Services.ContentService.GetById(Request.GetItemAs<int>("id"));
if (Request.GetItemAs<int>("copyTo") != -1)
{
parentContent = Services.ContentService.GetById(Request.GetItemAs<int>("copyTo"));
if (parentContent != null)
{
parentContentType = Services.ContentTypeService.GetContentType(parentContent.ContentTypeId);
}
}
}
else
{
currContent = Services.MediaService.GetById(Request.GetItemAs<int>("id"));
if (Request.GetItemAs<int>("copyTo") != -1)
{
parentContent = Services.MediaService.GetById(Request.GetItemAs<int>("copyTo"));
if (parentContent != null)
{
parentContentType = Services.ContentTypeService.GetMediaType(parentContent.ContentTypeId);
}
}
}
// Check on contenttypes
if (parentContentType == null)
{
//check if this is allowed at root
IContentTypeBase currContentType;
if (CurrentApp == "content")
{
currContentType = Services.ContentTypeService.GetContentType(currContent.ContentTypeId);
}
else
{
currContentType = Services.ContentTypeService.GetMediaType(currContent.ContentTypeId);
}
nodeAllowed = currContentType.AllowedAsRoot;
if (!nodeAllowed)
{
feedback.Text = ui.Text("moveOrCopy", "notAllowedAtRoot", UmbracoUser);
feedback.type = uicontrols.Feedback.feedbacktype.error;
}
}
else
{
var allowedChildContentTypeIds = parentContentType.AllowedContentTypes.Select(x => x.Id).ToArray();
if (allowedChildContentTypeIds.Any(x => x.Value == currContent.ContentTypeId))
{
nodeAllowed = true;
}
if (nodeAllowed == false)
{
feedback.Text = ui.Text("moveOrCopy", "notAllowedByContentType", UmbracoUser);
feedback.type = uicontrols.Feedback.feedbacktype.error;
}
else
{
// Check on paths
if ((string.Format(",{0},", parentContent.Path)).IndexOf(string.Format(",{0},", currContent.Id)) > -1)
{
nodeAllowed = false;
feedback.Text = ui.Text("moveOrCopy", "notAllowedByPath", UmbracoUser);
feedback.type = uicontrols.Feedback.feedbacktype.error;
}
}
}
if (nodeAllowed)
{
pane_form.Visible = false;
pane_form_notice.Visible = false;
panel_buttons.Visible = false;
var newNodeCaption = parentContent == null
? ui.Text(CurrentApp)
: parentContent.Name;
string[] nodes = { currContent.Name, newNodeCaption };
if (Request["mode"] == "cut")
{
if (CurrentApp == Constants.Applications.Content)
{
//Backwards comp. change, so old events are fired #U4-2731
var doc = new Document(currContent as IContent);
doc.Move(Request.GetItemAs<int>("copyTo"));
}
//.........这里部分代码省略.........
示例11: HandleDocumentMoveOrCopy
private void HandleDocumentMoveOrCopy()
{
if (helper.Request("copyTo") != "" && helper.Request("id") != "")
{
// Check if the current node is allowed at new position
var nodeAllowed = false;
var currentNode = new cms.businesslogic.Content(int.Parse(helper.Request("id")));
var newNode = new cms.businesslogic.Content(int.Parse(helper.Request("copyTo")));
// Check on contenttypes
if (int.Parse(helper.Request("copyTo")) == -1)
{
nodeAllowed = true;
}
else
{
if (newNode.ContentType.AllowedChildContentTypeIDs.Where(c => c == currentNode.ContentType.Id).Any())
{
nodeAllowed = true;
}
if (nodeAllowed == false)
{
feedback.Text = ui.Text("moveOrCopy", "notAllowedByContentType", base.getUser());
feedback.type = uicontrols.Feedback.feedbacktype.error;
}
else
{
// Check on paths
if ((string.Format(",{0},", newNode.Path)).IndexOf(string.Format(",{0},", currentNode.Id)) > -1)
{
nodeAllowed = false;
feedback.Text = ui.Text("moveOrCopy", "notAllowedByPath", base.getUser());
feedback.type = uicontrols.Feedback.feedbacktype.error;
}
}
}
if (nodeAllowed)
{
pane_form.Visible = false;
pane_form_notice.Visible = false;
panel_buttons.Visible = false;
var newNodeCaption = newNode.Id == -1 ? ui.Text(CurrentApp) : newNode.Text;
string[] nodes = { currentNode.Text, newNodeCaption };
if (Request["mode"] == "cut")
{
if (CurrentApp == "content")
{
//PPH changed this to document instead of cmsNode to handle republishing.
var documentId = int.Parse(helper.Request("id"));
var document = new Document(documentId);
document.Move(int.Parse(helper.Request("copyTo")));
library.RefreshContent();
}
else
{
var media = new Media(int.Parse(UmbracoContext.Current.Request["id"]));
media.Move(int.Parse(UmbracoContext.Current.Request["copyTo"]));
media = new Media(int.Parse(UmbracoContext.Current.Request["id"]));
media.XmlGenerate(new XmlDocument());
library.ClearLibraryCacheForMedia(media.Id);
}
feedback.Text = ui.Text("moveOrCopy", "moveDone", nodes, getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
feedback.type = uicontrols.Feedback.feedbacktype.success;
// refresh tree
ClientTools.MoveNode(currentNode.Id.ToString(), newNode.Path);
}
else
{
var document = new Document(int.Parse(helper.Request("id")));
document.Copy(int.Parse(helper.Request("copyTo")), this.getUser(), RelateDocuments.Checked);
feedback.Text = ui.Text("moveOrCopy", "copyDone", nodes, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
feedback.type = uicontrols.Feedback.feedbacktype.success;
ClientTools.CopyNode(currentNode.Id.ToString(), newNode.Path);
}
}
}
}
示例12: update
public void update(documentCarrier carrier, string username, string password)
{
Authenticate(username, password);
if (carrier.Id == 0) throw new Exception("ID must be specifed when updating");
if (carrier == null) throw new Exception("No carrier specified");
umbraco.BusinessLogic.User user = GetUser(username, password);
Document doc = null;
try
{
doc = new Document(carrier.Id);
}
catch { }
if (doc == null)
// We assign the new values:
doc.ReleaseDate = carrier.ReleaseDate;
doc.ExpireDate = carrier.ExpireDate;
if (carrier.ParentID != 0)
{
doc.Move(carrier.ParentID);
}
if (carrier.Name.Length != 0)
{
doc.Text = carrier.Name;
}
// We iterate the properties in the carrier
if (carrier.DocumentProperties != null)
{
foreach (documentProperty updatedproperty in carrier.DocumentProperties)
{
umbraco.cms.businesslogic.property.Property property = doc.getProperty(updatedproperty.Key);
if (property == null)
{
}
else
{
property.Value = updatedproperty.PropertyValue;
}
}
}
handlePublishing(doc, carrier, user);
}
示例13: Move
public static string Move(int ID, int target)
{
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
if (Xslt.IsMemberInGroup("admin", _currentMember) || Xslt.IsMemberInGroup("wiki editor", _currentMember))
{
Document d = new Document(ID);
Document t = new Document(target);
if(t.ContentType.Alias == "WikiPage"){
Document o = new Document(d.Parent.Id);
d.Move(t.Id);
d.Save();
d.Publish(new umbraco.BusinessLogic.User(0));
t.Publish(new umbraco.BusinessLogic.User(0));
o.Publish(new umbraco.BusinessLogic.User(0));
umbraco.library.UpdateDocumentCache(d.Id);
umbraco.library.UpdateDocumentCache(t.Id);
umbraco.library.UpdateDocumentCache(o.Id);
umbraco.library.RefreshContent();
return umbraco.library.NiceUrl(d.Id);
}
}
return "";
}