Ejemplo n.º 1
0
 public static T ConvertToPageItem <T>(TabInfo tab, IEnumerable <TabInfo> portalTabs) where T : PageItem, new()
 {
     return(new T
     {
         Id = tab.TabID,
         Name = tab.LocalizedTabName,
         Url = tab.FullUrl,
         ChildrenCount = portalTabs?.Count(ct => ct.ParentId == tab.TabID) ?? 0,
         Status = GetTabStatus(tab),
         ParentId = tab.ParentId,
         Level = tab.Level,
         IsSpecial = TabController.IsSpecialTab(tab.TabID, PortalSettings.Current),
         TabPath = tab.TabPath.Replace("//", "/"),
         PageType = GetPageType(tab.Url),
         CanViewPage = TabPermissionController.CanViewPage(tab),
         CanManagePage = TabPermissionController.CanManagePage(tab),
         CanAddPage = TabPermissionController.CanAddPage(tab),
         CanAdminPage = TabPermissionController.CanAdminPage(tab),
         CanCopyPage = TabPermissionController.CanCopyPage(tab),
         CanDeletePage = TabPermissionController.CanDeletePage(tab),
         CanAddContentToPage = TabPermissionController.CanAddContentToPage(tab),
         CanNavigateToPage = TabPermissionController.CanNavigateToPage(tab),
         LastModifiedOnDate = tab.LastModifiedOnDate.ToString("MM/dd/yyyy h:mm:ss tt", CultureInfo.CreateSpecificCulture(tab.CultureCode ?? "en-US")),
         FriendlyLastModifiedOnDate = tab.LastModifiedOnDate.ToString("MM/dd/yyyy h:mm:ss tt"),
         PublishDate = tab.HasBeenPublished ? WorkflowHelper.GetTabLastPublishedOn(tab).ToString("MM/dd/yyyy h:mm:ss tt", CultureInfo.CreateSpecificCulture(tab.CultureCode ?? "en-US")) : "",
         PublishStatus = GetTabPublishStatus(tab),
         Tags = tab.Terms.Select(t => t.Name).ToArray(),
         TabOrder = tab.TabOrder
     });
 }
 public static bool CanShowTab(TabInfo tab, bool isAdminMode, bool showDisabled, bool showHidden)
 {
     //if tab is visible, not deleted, not expired (or admin), and user has permission to see it...
     return((tab.IsVisible || showHidden) && tab.HasAVisibleVersion && !tab.IsDeleted &&
            (!tab.DisableLink || showDisabled) &&
            (((tab.StartDate < DateTime.Now || tab.StartDate == Null.NullDate) &&
              (tab.EndDate > DateTime.Now || tab.EndDate == Null.NullDate)) || isAdminMode) &&
            TabPermissionController.CanNavigateToPage(tab));
 }
Ejemplo n.º 3
0
 public static bool CanShowTab(TabInfo objTab, bool isAdminMode, bool showDisabled, bool showHidden)
 {
     //if tab is visible, not deleted, not expired (or admin), and user has permission to see it...
     if ((objTab.IsVisible || showHidden) && !objTab.IsDeleted && (!objTab.DisableLink || showDisabled) &&
         (((objTab.StartDate < DateTime.Now || objTab.StartDate == Null.NullDate) && (objTab.EndDate > DateTime.Now || objTab.EndDate == Null.NullDate)) || isAdminMode) &&
         TabPermissionController.CanNavigateToPage(objTab))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 public static bool CanShowTab(TabInfo objTab, bool isAdminMode, bool showDisabled)
 {
     if (objTab.IsVisible && !objTab.IsDeleted && (!objTab.DisableLink || showDisabled) && (((objTab.StartDate < DateTime.Now || objTab.StartDate == Null.NullDate) && (objTab.EndDate > DateTime.Now || objTab.EndDate == Null.NullDate)) || isAdminMode) && TabPermissionController.CanNavigateToPage(objTab))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }