using CMS.CMSHelper; using CMS.Community; using CMS.GlobalHelper; using CMS.PortalControls; public partial class CMSWebParts_Community_DocumentLibrary_GroupDocumentLibrary : CMSAbstractWebPart { #region "Properties" /// /// Alias path determining parent document of library. /// public string LibraryPath { get { return ValidationHelper.GetString(GetValue("LibraryPath"), libraryElem.LibraryPath); } set { SetValue("LibraryPath", value); libraryElem.LibraryPath = value; } } /// /// Gets or sets the value that indicates whether documents are combined with default culture version. /// public bool CombineWithDefaultCulture { get { return ValidationHelper.GetBoolean(GetValue("CombineWithDefaultCulture"), libraryElem.CombineWithDefaultCulture); } set { SetValue("CombineWithDefaultCulture", value); libraryElem.CombineWithDefaultCulture = value; } } /// /// Number of displayed documents. /// public int PageSize { get { return ValidationHelper.GetInteger(GetValue("PageSize"), libraryElem.PageSize); } set { SetValue("PageSize", value); libraryElem.PageSize = value; } } /// /// Specifies the form used for editing document properties. /// public string DocumentForm { get { return ValidationHelper.GetString(GetValue("DocumentForm"), libraryElem.DocumentForm); } set { SetValue("DocumentForm", value); libraryElem.DocumentForm = value; } } /// /// Gets or sets group name. /// public string GroupName { get { string groupName = ValidationHelper.GetString(GetValue("GroupName"), null); if ((string.IsNullOrEmpty(groupName) || groupName == GroupInfoProvider.CURRENT_GROUP) && (CommunityContext.CurrentGroup != null)) { return CommunityContext.CurrentGroup.GroupName; } if (string.IsNullOrEmpty(groupName)) { GroupInfo gi = GroupInfoProvider.GetGroupInfo(libraryElem.GroupID); if (gi != null) { groupName = gi.GroupName; } } return groupName; } set { SetValue("GroupName", value); libraryElem.GroupID = GroupID; } } /// /// Gets a group identifier based on group name. /// private int GroupID { get { GroupInfo gi = GroupInfoProvider.GetGroupInfo(GroupName, CMSContext.CurrentSiteName); return (gi != null) ? gi.GroupID : 0; } } /// /// Gets or sets the cache item name. /// public override string CacheItemName { get { return base.CacheItemName; } set { base.CacheItemName = value; libraryElem.CacheItemName = value; } } /// /// Cache dependencies, each cache dependency on a new line. /// public override string CacheDependencies { get { return ValidationHelper.GetString(base.CacheDependencies, libraryElem.CacheDependencies); } set { base.CacheDependencies = value; libraryElem.CacheDependencies = value; } } /// /// Gets or sets the cache minutes. /// public override int CacheMinutes { get { return base.CacheMinutes; } set { base.CacheMinutes = value; libraryElem.CacheMinutes = value; } } /// /// Gets or sets the text which is displayed for zero rows result. /// public string ZeroRowsText { get { return ValidationHelper.GetString(GetValue("ZeroRowsText"), libraryElem.ZeroRowsText); } set { SetValue("ZeroRowsText", value); libraryElem.ZeroRowsText = value; } } /// /// Gets or sets the value that indicates whether permissions should be checked. /// public bool CheckPermissions { get { return ValidationHelper.GetBoolean(GetValue("CheckPermissions"), libraryElem.CheckPermissions); } set { SetValue("CheckPermissions", value); } } #endregion #region "Stop processing" /// /// Returns true if the control processing should be stopped. /// public override bool StopProcessing { get { return base.StopProcessing; } set { base.StopProcessing = value; libraryElem.StopProcessing = value; } } #endregion #region "Page events" public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } public override void ReloadData() { base.ReloadData(); SetupControl(); } #endregion #region "Methods" private void SetupControl() { if (StopProcessing) { // Do nothing and tell inner controls to stop processing libraryElem.StopProcessing = true; } else { // Initialize document library control libraryElem.LibraryPath = LibraryPath; libraryElem.CombineWithDefaultCulture = CombineWithDefaultCulture; libraryElem.PageSize = PageSize; libraryElem.DocumentForm = DocumentForm; libraryElem.GroupID = GroupID; libraryElem.CacheDependencies = CacheDependencies; libraryElem.CacheItemName = CacheItemName; libraryElem.CacheMinutes = CacheMinutes; libraryElem.ZeroRowsText = ZeroRowsText; libraryElem.CheckPermissions = CheckPermissions; libraryElem.ComponentName = WebPartID; } } #endregion }