ListItemEditor(EditAction editAction, ListItem listItem, ObservableList <ListContentType> contentTypes, ListContentType contentType) { this.editAction = editAction; ContentTypes = contentTypes; ContentType = contentType; switch (editAction.EditMode) { case EditMode.Edit: Title = string.Format("Edit item {0}", listItem.ID); break; case EditMode.Copy: Title = string.Format("Copy item {0}", listItem.ID); break; case EditMode.AddItem: Title = "Add new item"; break; case EditMode.AddFolder: Title = "Add new folder"; break; } ListItem = listItem; window.Value.Data = this; window.Value.Show(); disposable = ListItem.Advise(Notify); }
internal void EditContentType(ListContentType contentType) { if (contentType != null) { ContentTypeEditor.Show(contentType); } }
internal static void Show(ListContentType contentType) { LazyWindow.ShowWaiting(); contentType.Detail.Get(delegate(ContentTypeDetail detail) { LazyWindow.HideWaiting(); new ContentTypeEditor(contentType).Show(); }, LazyWindow.ShowError); }
internal List <SiteNav> GetSiteUpdates(ListContentType contentType, int takeTop, List <Guid> lstCategories, List <string> lstCategorySlugs) { List <SiteNav> _siteUpdates = new List <SiteNav>(); if (lstCategories == null) { lstCategories = new List <Guid>(); } if (lstCategorySlugs == null) { lstCategorySlugs = new List <string>(); } if (lstCategories.Any() || lstCategorySlugs.Any()) { contentType = ListContentType.SpecifiedCategories; } using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { switch (contentType) { case ListContentType.Blog: _siteUpdates = navHelper.GetLatestPosts(this.TheSite.SiteID, takeTop, !SecurityData.IsAuthEditor); break; case ListContentType.ContentPage: _siteUpdates = navHelper.GetLatest(this.TheSite.SiteID, takeTop, !SecurityData.IsAuthEditor); break; case ListContentType.SpecifiedCategories: if (takeTop > 0) { _siteUpdates = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, lstCategories, lstCategorySlugs, !SecurityData.IsAuthEditor, takeTop, 0, "GoLiveDate", "DESC"); } else { _siteUpdates = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, lstCategories, lstCategorySlugs, !SecurityData.IsAuthEditor, 250000, 0, "NavMenuText", "ASC"); } break; } } if (_siteUpdates == null) { _siteUpdates = new List <SiteNav>(); } _siteUpdates = TweakData(_siteUpdates); return(_siteUpdates); }
internal void Navigate(DeepLink deepLink) { if (!string.IsNullOrEmpty(deepLink.ContentTypeId)) { ParentFolder.ParentList.ContentTypes.Get( delegate(ObservableList <ListContentType> contentTypes){ ListContentType contentType = contentTypes.FirstOrDefault(delegate(ListContentType ct) { return(ct.ID == deepLink.ContentTypeId); }); if (contentType != null) { ContentType = contentType; } }, Dummies.Action); } }
internal List<SiteNav> GetSiteUpdates(ListContentType contentType, int takeTop, List<Guid> lstCategories, List<string> lstCategorySlugs) { List<SiteNav> _siteUpdates = new List<SiteNav>(); if (lstCategories == null) { lstCategories = new List<Guid>(); } if (lstCategorySlugs == null) { lstCategorySlugs = new List<string>(); } if (lstCategories.Any() || lstCategorySlugs.Any()) { contentType = ListContentType.SpecifiedCategories; } using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) { switch (contentType) { case ListContentType.Blog: _siteUpdates = navHelper.GetLatestPosts(this.TheSite.SiteID, takeTop, !SecurityData.IsAuthEditor); break; case ListContentType.ContentPage: _siteUpdates = navHelper.GetLatest(this.TheSite.SiteID, takeTop, !SecurityData.IsAuthEditor); break; case ListContentType.SpecifiedCategories: if (takeTop > 0) { _siteUpdates = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, lstCategories, lstCategorySlugs, !SecurityData.IsAuthEditor, takeTop, 0, "GoLiveDate", "DESC"); } else { _siteUpdates = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, lstCategories, lstCategorySlugs, !SecurityData.IsAuthEditor, 250000, 0, "NavMenuText", "ASC"); } break; } } if (_siteUpdates == null) { _siteUpdates = new List<SiteNav>(); } _siteUpdates = TweakData(_siteUpdates); return _siteUpdates; }
public List<SiteNav> GetSiteUpdates(ListContentType contentType, int takeTop) { return GetSiteUpdates(contentType, takeTop, null, null); }
public List<SiteNav> GetSiteUpdates(ListContentType contentType, int takeTop, List<Guid> lstCategories) { return GetSiteUpdates(contentType, takeTop, lstCategories, null); }
public List<SiteNav> GetSiteUpdates(ListContentType contentType, int takeTop, List<string> lstCategorySlugs) { return GetSiteUpdates(contentType, takeTop, null, lstCategorySlugs); }
public List <SiteNav> GetSiteUpdates(ListContentType contentType, int takeTop) { return(GetSiteUpdates(contentType, takeTop, null, null)); }
public List <SiteNav> GetSiteUpdates(ListContentType contentType, int takeTop, List <Guid> lstCategories) { return(GetSiteUpdates(contentType, takeTop, lstCategories, null)); }
public List <SiteNav> GetSiteUpdates(ListContentType contentType, int takeTop, List <string> lstCategorySlugs) { return(GetSiteUpdates(contentType, takeTop, null, lstCategorySlugs)); }
internal static async void Show(EditAction editAction) { ListItem listItem = null; ObservableList <ListContentType> affectedContentTypes = null; ListContentType contentType = null; if (await LazyWindow.ShowWaiting( async delegate(CancellationToken cancellationToken) { switch (editAction.EditMode) { case EditMode.Edit: listItem = await editAction.ListItem.ParentList.GetItemById(editAction.ListItem.ID, cancellationToken); break; case EditMode.Copy: listItem = await editAction.ListItem.ParentList.GetItemById(editAction.ListItem.ID, cancellationToken); break; case EditMode.AddItem: listItem = editAction.TargetList.Add(FileSystemObjectType.File); listItem.MoveTo(editAction.TargetFolder); break; case EditMode.AddFolder: listItem = editAction.TargetList.Add(FileSystemObjectType.Folder); listItem.MoveTo(editAction.TargetFolder); break; default: throw new ApplicationException("Unexpected"); } ObservableList <ListContentType> contentTypes = await editAction.TargetList.ContentTypes.GetAsync(cancellationToken); affectedContentTypes = new ObservableList <ListContentType>(); foreach (ListContentType hit in contentTypes) { if (hit.ID.StartsWith(BuiltInContentTypeIds.Folder) == (listItem.FileSystemObjectType == FileSystemObjectType.Folder)) { affectedContentTypes.Add(hit); if (hit.ID == listItem.ContentTypeId) { contentType = hit; } } } if (contentType == null && affectedContentTypes.Count != 0) { contentType = affectedContentTypes[0]; listItem.ContentTypeId = contentType.ID; } contentType.NotNull("Unknown content type"); if (editAction.EditMode == EditMode.Copy) { ContentTypeDetail contentTypeDetail = await contentType.Detail.GetAsync(cancellationToken); ListItem newListItem = listItem.ParentList.Add(listItem.FileSystemObjectType); newListItem.ContentTypeId = listItem.ContentTypeId; for (int i = 0; i < contentTypeDetail.Fields.Count; i++) { Field field = contentTypeDetail.Fields[i]; if (field.ShowInEditForm && !field.ReadOnly) { newListItem[field] = listItem[field]; } } newListItem.MoveTo(editAction.TargetFolder); listItem.Dispose(); listItem = newListItem; } })) { new ListItemEditor(editAction, listItem, affectedContentTypes, contentType); } else { listItem?.Dispose(); } }
/// <summary> /// ���ݼ������� /// </summary> /// <param name="values">����</param> /// <param name="index">FieldItem������</param> /// <returns>����</returns> private List<List<PdfDesc>> GetFieldList(object[] values, int datasourceIndex, ListContentType contentType) { List<List<PdfDesc>> list = new List<List<PdfDesc>>(); List<PdfDesc> row = new List<PdfDesc>(); DataSourceItem fieldItem = Report.FieldItems[datasourceIndex]; bool allowAdd = false; multiRow = 1; for (int i = 0; i < fieldItem.Fields.Count; i++) { FieldItem field = fieldItem.Fields[i]; if (i > 0 && field.NewLine) { multiRow++; #region Add row to list if (contentType == ListContentType.GroupTotal || contentType == ListContentType.Total) { foreach (PdfDesc item in row) { allowAdd = item.Value != String.Empty; if (allowAdd) { break; } } } else { allowAdd = true; } if (allowAdd) { list.Add(row); } #endregion row = new List<PdfDesc>(); for (int j = 0; j < field.NewLinePostion - 1; j++) { PdfDesc pdfDesc = new PdfDesc(); pdfDesc.Value = String.Empty; pdfDesc.LeftLine = false; pdfDesc.RightLine = Report.Format.ColumnInsideGridLine; pdfDesc.TopLine = false; pdfDesc.BottomLine = false; pdfDesc.Width = field.Width; pdfDesc.FieldNum = datasourceIndex; pdfDesc.IsCaption = contentType == ListContentType.Caption; row.Add(pdfDesc); } } PdfDesc pdfValue = new PdfDesc(); pdfValue.Value = values[i].ToString(); pdfValue.Cells = field.Cells; pdfValue.FieldNum = datasourceIndex; pdfValue.IsCaption = contentType == ListContentType.Caption; if (contentType == ListContentType.Caption) { pdfValue.HAlign = field.CaptionAlignment; } else { pdfValue.HAlign = field.ColumnAlignment; } pdfValue.LeftLine = false; switch (contentType) { case ListContentType.GroupTotal: case ListContentType.Total: pdfValue.RightLine = false; break; case ListContentType.Field: case ListContentType.Caption: pdfValue.RightLine = Report.Format.ColumnInsideGridLine; break; } if (i == 0 || multiRow == 1 || contentType == ListContentType.GroupTotal || contentType == ListContentType.Total) { pdfValue.TopLine = Report.Format.RowGridLine; } pdfValue.BottomLine = false; pdfValue.Width = field.Width; row.Add(pdfValue); } allowAdd = false; if (contentType == ListContentType.GroupTotal || contentType == ListContentType.Total) { foreach (PdfDesc item in row) { allowAdd = item.Value != String.Empty; if (allowAdd) { break; } } } else { allowAdd = true; } if (allowAdd) { list.Add(row); } if (contentType == ListContentType.Field || contentType == ListContentType.Caption) { if (multiRow > 1) { int maxColumnCount = 0; int tempCount = 0; List<int> allLength = new List<int>(); foreach (List<PdfDesc> crow in list) { foreach (PdfDesc pdfDesc in crow) { tempCount += pdfDesc.Cells; } if (tempCount > maxColumnCount) { maxColumnCount = tempCount; } allLength.Add(tempCount); tempCount = 0; } foreach (List<PdfDesc> crow in list) { int restCount = maxColumnCount - allLength[list.IndexOf(crow)]; for (int i = 0; i < restCount; i++) { if (row[0].GroupGap == DataSourceItem.GroupGapType.None) { PdfDesc pdfDesc = new PdfDesc(); pdfDesc.Value = String.Empty; pdfDesc.LeftLine = false; pdfDesc.RightLine = report.Format.ColumnInsideGridLine; pdfDesc.TopLine = report.Format.RowGridLine && list.IndexOf(crow) == 0; pdfDesc.BottomLine = false; pdfDesc.FieldNum = datasourceIndex; pdfDesc.IsCaption = contentType == ListContentType.Caption; crow.Add(pdfDesc); } } } } } return list; }
ContentTypeEditor(ListContentType contentType) : base(contentType.Detail.Value.SchemaXml, "View content type") { this.contentType = contentType; }