Beispiel #1
0
        private static void LoadActionAttributes(ConfigurationDataSet.ActionRow row, ActionElement action, Guid?parentActionId)
        {
            row.BuiltIn = action.BuiltIn;
            if (action.ActionType != ActionType.NotSet)
            {
                row.ActionTypeId = (int)action.ActionType;
            }
            row.ParentActionId = (parentActionId.HasValue
                ? parentActionId.Value
                : ((action.ActionType == ActionType.Page) ? PagesAndControlsActionId : GlobalNavigationLinksActionId));
            row.Handle = action.Handle;

            switch ((ActionType)row.ActionTypeId)
            {
            case ActionType.Page:
                LoadPageAttributes(row, action);
                break;

            case ActionType.Control:
                LoadControlAttributes(row, action);
                break;

            case ActionType.GlobalNavigationLink:
                LoadGlobalNavigationLinkAttributes(row, action);
                break;
            }
        }
Beispiel #2
0
        internal static void Fill(ConfigurationDataSet dataSet)
        {
            if (dataSet == null)
            {
                return;
            }

            ConfigurationDataSet.ActionRow row = dataSet.Action.NewActionRow();
            row.ActionTypeId = (int)ActionType.GlobalNavigationLink;
            row.Name         = "Global Navigation Links";
            row.ActionId     = GlobalNavigationLinksActionId;
            row.BuiltIn      = true;
            dataSet.Action.AddActionRow(row);

            row = dataSet.Action.NewActionRow();
            row.ActionTypeId = (int)ActionType.Page;
            row.Name         = "Pages & Controls";
            row.ActionId     = PagesAndControlsActionId;
            row.BuiltIn      = true;
            dataSet.Action.AddActionRow(row);

            Fill(dataSet, FrameworkConfiguration.Current.Actions, null);

            dataSet.Action.AcceptChanges();
            dataSet.ActionsParentActions.AcceptChanges();
            dataSet.RolesActions.AcceptChanges();
        }
Beispiel #3
0
 private static void LoadSubmenuAttributes(ConfigurationDataSet.ActionRow row, ActionSubmenuElement submenu)
 {
     row.SubmenuItemImageUrl          = submenu.ImageUrl;
     row.SubmenuItemTypeId            = (int)submenu.ItemType;
     row.SubmenuItemWidth             = submenu.Width;
     row.SubmenuItemHorizontalAlignId = (int)submenu.HorizontalAlign;
     row.HighlightInSubmenu           = submenu.Highlight;
 }
Beispiel #4
0
        private static void LoadPageAttributes(ConfigurationDataSet.ActionRow row, ActionElement action)
        {
            row.LearnMoreUrl = action.LearnMoreUrl;
            row.VideoUrl     = action.VideoUrl;

            LoadGlobalNavigationLinkAttributes(row, action);
            LoadSubmenuAttributes(row, action.Submenu);
        }
Beispiel #5
0
        internal static Action CreateAction(ConfigurationDataSet.ActionRow row, Action parentAction)
        {
            Action action = CreateAction(row);

            if (action != null)
            {
                action.ParentAction = parentAction;
            }
            return(action);
        }
Beispiel #6
0
        private static void LoadGlobalNavigationLinkAttributes(ConfigurationDataSet.ActionRow row, ActionElement action)
        {
            row.NavigateUrl            = action.NavigateUrl;
            row.OrderNumber            = action.OrderNumber;
            row.AuthenticationRequired = action.AuthenticationRequired;
            row.OrganizationRequired   = action.OrganizationRequired;
            row.InstanceRequired       = action.InstanceRequired;
            row.Visible = action.Visible;

            LoadControlAttributes(row, action);
            LoadDetailMenuAttributes(row, action.DetailMenu);
        }
Beispiel #7
0
 /// <summary>
 /// Gets a value indicating that the specified action is setup page.
 /// </summary>
 /// <param name="action">The action to check.</param>
 /// <returns>true, if the specified action is setup page; otherwise, false.</returns>
 internal static bool IsSetupPage(ConfigurationDataSet.ActionRow action)
 {
     if ((ActionType)action.ActionTypeId == ActionType.Page)
     {
         if ((action.ActionId == SetupPageActionId) || (action.ActionId == SetupGlobalNavigationLinkActionId))
         {
             return(true);
         }
         else if (!action.IsNavigateUrlNull())
         {
             return(ResourceProvider.IsSetupPageUrl(action.NavigateUrl));
         }
     }
     return(false);
 }
Beispiel #8
0
        private static void Fill(ConfigurationDataSet dataSet, ActionElementCollection actions, Guid?parentActionId)
        {
            foreach (ActionElement action in actions)
            {
                ConfigurationDataSet.ActionRow actionRow = dataSet.Action.FindByActionId(action.Id);
                if (actionRow != null)
                {
                    if (!actionRow.BuiltIn)
                    {
                        actionRow = null;
                    }
                }

                if (actionRow == null)
                {
                    actionRow = dataSet.Action.NewActionRow();
                    LoadActionAttributes(actionRow, action, parentActionId);
                    dataSet.Action.AddActionRow(actionRow);
                }

                FillAlternativeParents(dataSet.ActionsParentActions, action);
                RoleProvider.FillRolesActions(dataSet, action);

                int visibleChildSettingsCount = 0;
                foreach (SettingElement s in action.Settings)
                {
                    if (s.Visible)
                    {
                        visibleChildSettingsCount++;
                    }
                }

                if (visibleChildSettingsCount > 0)
                {
                    if (string.IsNullOrEmpty(action.NavigateUrl))
                    {
                        actionRow.NavigateUrl = ResourceProvider.SettingsPageVirtualPath + "?actionid=" + actionRow.ActionId.ToString("N");
                    }

                    SettingProvider.Fill(dataSet.Setting, dataSet.SettingListsValues, action.Settings, null, actionRow.ActionId, GetActionSettingLevels(actionRow.AuthenticationRequired, actionRow.InstanceRequired));

                    dataSet.Setting.AcceptChanges();
                    dataSet.SettingListsValues.AcceptChanges();
                }

                Fill(dataSet, action.Actions, actionRow.ActionId);
            }
        }
Beispiel #9
0
 private static void FillActionIdList(ConfigurationDataSet.ActionRow row, ref ArrayList list)
 {
     if ((row == null) || (list == null))
     {
         return;
     }
     if ((row.ActionTypeId == (int)ActionType.Page) && (!list.Contains(row.ActionId)) &&
         ((!row.BuiltIn) || (row.ActionId == PagesAndControlsActionId)))
     {
         list.Add(row.ActionId);
     }
     foreach (ConfigurationDataSet.ActionRow actionRow in row.GetActionRows())
     {
         FillActionIdList(actionRow, ref list);
     }
 }
Beispiel #10
0
 private static void LoadDetailMenuAttributes(ConfigurationDataSet.ActionRow row, ActionDetailMenuElement detailMenu)
 {
     row.ShowInDetailMenu            = detailMenu.Show;
     row.ShowChildrenInDetailMenu    = detailMenu.ShowChildren;
     row.ShowDescriptionInDetailMenu = detailMenu.ShowDescription;
     row.GroupInDetailMenu           = detailMenu.Group;
     row.HighlightInDetailMenu       = detailMenu.Highlight;
     row.IconUrl = detailMenu.IconUrl;
     if (detailMenu.Theme.HasValue)
     {
         row.DetailMenuTheme = (int)detailMenu.Theme.Value;
     }
     if (detailMenu.IconSize.HasValue)
     {
         row.DetailMenuIconSize = (int)detailMenu.IconSize.Value;
     }
 }
Beispiel #11
0
        /// <summary>
        /// Returns the actions table.
        /// </summary>
        /// <returns>The actions table.</returns>
        internal static DataTable GetActionsTree()
        {
            ConfigurationDataSet.ActionDataTable table = ConfigurationDataSet.Current.Action.Copy() as ConfigurationDataSet.ActionDataTable;

            foreach (ConfigurationDataSet.ActionRow row in table.Select(string.Concat(table.ParentActionIdColumn.ColumnName, " = '", ConfigurationPageActionId.ToString(), "'")))
            {
                row.ParentActionId = ConfigurationGlobalNavigationLinkActionId;
            }

            foreach (ConfigurationDataSet.ActionRow row in table.Select(string.Concat(table.ParentActionIdColumn.ColumnName, " = '", MyAccountPageActionId.ToString(), "'")))
            {
                row.ParentActionId = MyAccountGlobalNavigationLinkActionId;
            }

            ConfigurationDataSet.ActionRow actionRow = table.FindByActionId(ConfigurationPageActionId);
            if (actionRow != null)
            {
                actionRow.Delete();
            }

            actionRow = table.FindByActionId(MyAccountPageActionId);
            if (actionRow != null)
            {
                actionRow.Delete();
            }

            actionRow = table.FindByActionId(LoginGlobalNavigationLinkActionId);
            if (actionRow != null)
            {
                actionRow.Delete();
            }

            actionRow = table.FindByActionId(LoginAsUserGlobalNavigationLinkActionId);
            if (actionRow != null)
            {
                actionRow.Delete();
            }

            table.AcceptChanges();

            ArrayList setupActionIdList = new ArrayList();

            foreach (ConfigurationDataSet.ActionRow row in table)
            {
                if (IsSetupPage(row))
                {
                    setupActionIdList.Add(row.ActionId);
                }
            }

            foreach (Guid actionId in setupActionIdList)
            {
                actionRow = table.FindByActionId(actionId);
                if (actionRow != null)
                {
                    actionRow.Delete();
                }
            }

            table.AcceptChanges();

            return(table);
        }
Beispiel #12
0
        internal static Action CreateAction(ConfigurationDataSet.ActionRow row)
        {
            if (row != null)
            {
                Action action = new Action();
                action.ActionId                    = row.ActionId;
                action.ParentActionId              = (row.IsParentActionIdNull() ? null : new Guid?(row.ParentActionId));
                action.ActionType                  = (ActionType)row.ActionTypeId;
                action.Name                        = row.Name;
                action.Description                 = row.Description;
                action.IconUrl                     = row.IconUrl;
                action.SubmenuItemImageUrl         = row.SubmenuItemImageUrl;
                action.SubmenuItemType             = (SubmenuItemType)row.SubmenuItemTypeId;
                action.SubmenuItemHorizontalAlign  = (HorizontalAlign)row.SubmenuItemHorizontalAlignId;
                action.SubmenuItemWidth            = row.SubmenuItemWidth;
                action.HighlightInSubmenu          = row.HighlightInSubmenu;
                action.NavigateUrl                 = (row.IsNavigateUrlNull() ? null : row.NavigateUrl);
                action.LearnMoreUrl                = row.LearnMoreUrl;
                action.VideoUrl                    = row.VideoUrl;
                action.OrderNumber                 = row.OrderNumber;
                action.AuthenticationRequired      = row.AuthenticationRequired;
                action.OrganizationRequired        = row.OrganizationRequired;
                action.InstanceRequired            = row.InstanceRequired;
                action.Visible                     = row.Visible;
                action.ShowInDetailMenu            = row.ShowInDetailMenu;
                action.ShowChildrenInDetailMenu    = row.ShowChildrenInDetailMenu;
                action.ShowDescriptionInDetailMenu = row.ShowDescriptionInDetailMenu;
                action.GroupInDetailMenu           = row.GroupInDetailMenu;
                action.HighlightInDetailMenu       = row.HighlightInDetailMenu;
                if (!row.IsDetailMenuThemeNull())
                {
                    action.DetailMenuTheme = (DetailMenuTheme)row.DetailMenuTheme;
                }
                if (!row.IsDetailMenuIconSizeNull())
                {
                    action.IconSize = (IconSize)row.DetailMenuIconSize;
                }
                action.BuiltIn = row.BuiltIn;
                action.Handle  = row.Handle;

                if (action.ActionId == LoginGlobalNavigationLinkActionId)
                {
                    action.NavigateUrl = LoginProvider.Current.GetLoginUrl(false);
                }
                else if (action.ActionId == MyAccountGlobalNavigationLinkActionId)
                {
                    if (FrameworkConfiguration.Current.WebApplication.MasterPage.Theme != Micajah.Common.Pages.MasterPageTheme.Modern)
                    {
                        action.OrderNumber = -action.OrderNumber;
                    }
                }

                foreach (ConfigurationDataSet.ActionsParentActionsRow alternativeParentActionRow in row.GetActionsParentActionsRowsByFK_Mc_ActionsParentActions_Mc_Action_2())
                {
                    action.AlternativeParentActions.Add(alternativeParentActionRow.ParentActionId);
                }

                return(action);
            }
            return(null);
        }
Beispiel #13
0
 private static void LoadControlAttributes(ConfigurationDataSet.ActionRow row, ActionElement action)
 {
     row.ActionId    = action.Id;
     row.Name        = action.Name;
     row.Description = action.Description;
 }