private void BindTabControls(TabInfo tab)
        {
            cboParentTab.DataSource = string.IsNullOrEmpty(_strAction) || _strAction == "copy" || _strAction == "add"
                                        ? GetTabs(true, true, false, true)
                                        : GetTabs(false, true, true, false);
            cboParentTab.DataBind();

            if ((string.IsNullOrEmpty(_strAction) || _strAction == "copy" || _strAction == "add")
                    && !UserInfo.IsSuperUser && !UserInfo.IsInRole(PortalSettings.AdministratorRoleName))
            {
                cboParentTab.Select(PortalSettings.ActiveTab.TabID.ToString(), false, 0);
            }
            else
            {
                cboParentTab.Select(PortalSettings.ActiveTab.ParentId.ToString(), false, 0);
            }

            // tab administrators can only create children of the current tab
            if (string.IsNullOrEmpty(_strAction) || _strAction == "add" || _strAction == "copy")
            {
                BindBeforeAfterTabControls();
                insertPositionRow.Visible = cboPositionTab.Items.Count > 0;
                cboParentTab.AutoPostBack = true;

                cultureTypeList.SelectedValue = "Localized";
            }
            else
            {
                DisablePositionDropDown();
            }

            // if editing a tab, load tab parent so parent link is not lost
            // parent tab might not be loaded in cbotab if user does not have edit rights on it
            if (!TabPermissionController.CanAdminPage() && (tab != null))
            {
                if (cboParentTab.Items.FindByValue(tab.ParentId.ToString()) == null)
                {
                    var objtabs = new TabController();
                    var objparent = objtabs.GetTab(tab.ParentId, tab.PortalID, false);
                    if (objparent != null)
                    {
                        cboParentTab.Items.Add(new ListItem(objparent.LocalizedTabName, objparent.TabID.ToString()));
                    }
                }
            }

            cboCacheProvider.DataSource = OutputCachingProvider.GetProviderList();
            cboCacheProvider.DataBind();
            cboCacheProvider.Items.Insert(0, new ListItem(Localization.GetString("None_Specified"), ""));
            if (tab == null)
            {
                cboCacheProvider.ClearSelection();
                cboCacheProvider.Items[0].Selected = true;
                rblCacheIncludeExclude.ClearSelection();
                rblCacheIncludeExclude.Items[0].Selected = true;
            }

            var tabController = new TabController();
            var tabSettings = tabController.GetTabSettings(TabId);
            SetValue(cboCacheProvider, tabSettings, "CacheProvider");
            SetValue(txtCacheDuration, tabSettings, "CacheDuration");
            SetValue(rblCacheIncludeExclude, tabSettings, "CacheIncludeExclude");
            SetValue(txtIncludeVaryBy, tabSettings, "IncludeVaryBy");
            SetValue(txtExcludeVaryBy, tabSettings, "ExcludeVaryBy");
            SetValue(txtMaxVaryByCount, tabSettings, "MaxVaryByCount");

            ShowCacheRows();
        }
        private void BindTabControls(TabInfo tab)
        {
            // only superusers and administrators can manage parent pages
            if ((string.IsNullOrEmpty(_strAction) || _strAction == "copy" || _strAction == "add")
                    && !UserInfo.IsSuperUser && !UserInfo.IsInRole(PortalSettings.AdministratorRoleName))
            {
                var tabList = GetTabs(true, true, false, true);
                var selectedParentTab = tabList.SingleOrDefault(t => t.TabID == PortalSettings.ActiveTab.TabID);
                cboParentTab.SelectedPage = selectedParentTab;
            }
            else
            {
                var tabList = GetTabs(true, true, true, true);
                var selectedParentTab = tabList.SingleOrDefault(t => t.TabID == PortalSettings.ActiveTab.ParentId);
                cboParentTab.SelectedPage = selectedParentTab;
            }

            if (string.IsNullOrEmpty(_strAction) || _strAction == "add" || _strAction == "copy")
            {
                BindBeforeAfterTabControls();
                insertPositionRow.Visible = cboPositionTab.Items.Count > 0;
                cboParentTab.AutoPostBack = true;
                cultureTypeList.SelectedValue = "Localized";
            }
            else
            {
                DisablePositionDropDown();
            }

            cboCacheProvider.DataSource = OutputCachingProvider.GetProviderList();
            cboCacheProvider.DataBind();
            cboCacheProvider.InsertItem(0, Localization.GetString("None_Specified"), "");
            if (tab == null)
            {
                cboCacheProvider.ClearSelection();
                cboCacheProvider.Items[0].Selected = true;
                rblCacheIncludeExclude.ClearSelection();
                rblCacheIncludeExclude.Items[0].Selected = true;
            }

            var tabController = new TabController();
            var tabSettings = tabController.GetTabSettings(TabId);
            SetValue(cboCacheProvider, tabSettings, "CacheProvider");
            SetValue(txtCacheDuration, tabSettings, "CacheDuration");
            SetValue(rblCacheIncludeExclude, tabSettings, "CacheIncludeExclude");
            SetValue(txtIncludeVaryBy, tabSettings, "IncludeVaryBy");
            SetValue(txtExcludeVaryBy, tabSettings, "ExcludeVaryBy");
            SetValue(txtMaxVaryByCount, tabSettings, "MaxVaryByCount");

            ShowCacheRows();
        }
Esempio n. 3
0
        /// <summary>
        /// Synchronizes the module content between cache and database.
        /// </summary>
        /// <param name="moduleID">The module ID.</param>
        public static void SynchronizeModule(int moduleID)
        {
            var moduleController = new ModuleController();
            ArrayList modules = moduleController.GetModuleTabs(moduleID);
            var tabController = new TabController();
            foreach (ModuleInfo module in modules)
            {
                Hashtable tabSettings = tabController.GetTabSettings(module.TabID);
                if (tabSettings["CacheProvider"] != null && tabSettings["CacheProvider"].ToString().Length > 0)
                {
                    var outputProvider = OutputCachingProvider.Instance(tabSettings["CacheProvider"].ToString());
                    if (outputProvider != null)
                    {
                        outputProvider.Remove(module.TabID);
                    }
                }

                if (module.CacheTime > 0)
                {
                    var moduleProvider = ModuleCachingProvider.Instance(module.GetEffectiveCacheMethod());
                    if (moduleProvider != null)
                    {
                        moduleProvider.Remove(module.TabModuleID);
                    }
                }

                //Synchronize module is called when a module needs to indicate that the content
                //has changed and the cache's should be refreshed.  So we can update the Version
                //and also the LastContentModificationDate
                UpdateTabModuleVersion(module.TabModuleID);
                dataProvider.UpdateModuleLastContentModifiedOnDate(module.ModuleID);

                //We should also indicate that the Transalation Status has changed
                if (PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", module.PortalID, false))
                {
                    moduleController.UpdateTranslationStatus(module, false);
                }
		// and clear the cache
                moduleController.ClearCache(module.TabID);
            }
        }