Exemplo n.º 1
0
        protected void OnTabRestoreClick(Object sender, EventArgs e)
        {
            var errors = false;

            foreach (ListItem item in tabsListBox.Items)
            {
                if (item.Selected)
                {
                    var tab = DeletedTabs.SingleOrDefault(t => t.TabID == int.Parse(item.Value));

                    if (!RestoreTab(tab))
                    {
                        errors = true;
                    }
                }
            }
            if (!errors)
            {
                Response.Redirect(Globals.NavigateURL(TabId, "", "mode=" + modeButtonList.SelectedValue.ToLowerInvariant()));
            }
            else
            {
                BindData(true);
            }
        }
Exemplo n.º 2
0
        private bool RestoreTab(TabInfo tab)
        {
            var success = true;

            if (tab != null)
            {
                if (!Null.IsNull(tab.ParentId) && DeletedTabs.Any(t => t.TabID == tab.ParentId))
                {
                    Skin.AddModuleMessage(this,
                                          string.Format(Localization.GetString("ChildTab.ErrorMessage", LocalResourceFile), tab.TabName),
                                          ModuleMessage.ModuleMessageType.YellowWarning);
                    success = false;
                }
                else
                {
                    TabController.Instance.RestoreTab(tab, PortalSettings);
                    DeletedTabs.Remove(tab);

                    //restore modules in this tab
                    modulesListBox.Items.Cast <ListItem>().ToList().ForEach(i =>
                    {
                        var values   = i.Value.Split('-');
                        var tabId    = int.Parse(values[0]);
                        var moduleId = int.Parse(values[1]);
                        if (tabId == tab.TabID)
                        {
                            RestoreModule(moduleId, tabId);
                        }
                    });
                }
            }
            return(success);
        }
Exemplo n.º 3
0
        protected void OnEmptyBinClick(Object sender, EventArgs e)
        {
            foreach (var module in DeletedModules)
            {
                DeleteModule(module);
            }

            //Delete tabs starting with the deepest children
            foreach (var tab in DeletedTabs.OrderByDescending(t => t.Level))
            {
                DeleteTab(tab, true);
            }

            BindData(true);
        }
Exemplo n.º 4
0
        private void RestoreModule(int moduleId, int tabId)
        {
            // restore module
            var module = ModuleController.Instance.GetModule(moduleId, tabId, false);

            if ((module != null))
            {
                if (DeletedTabs.Any(t => t.TabID == module.TabID))
                {
                    var title = !string.IsNullOrEmpty(module.ModuleTitle) ? module.ModuleTitle : module.DesktopModule.FriendlyName;
                    Skin.AddModuleMessage(this, string.Format(Localization.GetString("TabDeleted.ErrorMessage", LocalResourceFile), title),
                                          ModuleMessage.ModuleMessageType.RedError);
                    return;
                }
                ModuleController.Instance.RestoreModule(module);
                EventLogController.Instance.AddLog(module, PortalSettings, UserId, "", EventLogController.EventLogType.MODULE_RESTORED);
            }
        }
Exemplo n.º 5
0
 protected void OnTabDeleteClick(Object sender, EventArgs e)
 {
     foreach (ListItem item in tabsListBox.Items)
     {
         if (item.Selected)
         {
             var tab = DeletedTabs.SingleOrDefault(t => t.TabID == int.Parse(item.Value));
             if (tab != null)
             {
                 if (tab.HasChildren)
                 {
                     Skin.AddModuleMessage(this, String.Format(Localization.GetString("ParentTab.ErrorMessage", LocalResourceFile), tab.TabName), ModuleMessage.ModuleMessageType.YellowWarning);
                 }
                 else
                 {
                     DeleteTab(tab, false);
                 }
             }
         }
     }
     BindData(true);
 }