Beispiel #1
0
        private void BindControls()
        {
            if (moduleID == -1)
            {
                //log.Error("moduleId was -1 in BindControls");
                return;
            }

            currentModule = new Module(this.moduleID);
            if (currentModule.SiteId != siteSettings.SiteId)
            {
                //log.Error("currentModule.SiteId != siteSettings.SiteId in BindControls");
                return;
            }

            lblModuleTitle.Text = this.currentModule.ModuleTitle;

            ModuleDefinition feature = new ModuleDefinition(currentModule.ModuleDefId);

            pnlWarning.Visible = !feature.SupportsPageReuse;

            ArrayList sitePages = new ArrayList();

            PopulatePageArray(sitePages);
            List <ModuleDecoratedSiteMapNode> pageList
                = ModuleDecoratedSiteMapNode.GetDecoratedNodes(sitePages, moduleID);

            this.grdPages.DataSource = pageList;
            this.grdPages.DataBind();

            //log.Info("EditIndex was " + grdPages.EditIndex);
            //log.Info("bound grid " + pageList.Count);
        }
Beispiel #2
0
        private void BindControls()
        {
            //lblModuleTitle.Text = string.Format(CultureInfo.InvariantCulture, Resource.PublishingForFormat, currentModule.ModuleTitle);
            heading.Text     = string.Format(CultureInfo.InvariantCulture, Resource.PublishingForFormat, currentModule.ModuleTitle);
            publishLinkTitle = heading.Text;

            ModuleDefinition feature = new ModuleDefinition(currentModule.ModuleDefId);

            pnlWarning.Visible = !feature.SupportsPageReuse;

            ArrayList sitePages = new ArrayList();

            PopulatePageArray(sitePages);
            List <ModuleDecoratedSiteMapNode> pageList
                = ModuleDecoratedSiteMapNode.GetDecoratedNodes(sitePages, moduleID);

            if (pageList.Count > WebConfigSettings.TooManyPagesForGridEvents)
            {
                useDialogForEditing      = true;
                grdPages.EnableViewState = false;
            }

            grdPages.DataSource = pageList;
            grdPages.DataBind();

            //log.Info("EditIndex was " + grdPages.EditIndex);
            //log.Info("bound grid " + pageList.Count);
        }
Beispiel #3
0
        void btnDelete_Click(object sender, EventArgs e)
        {
            if (moduleID > -1)
            {
                ArrayList pageIDs   = new ArrayList();
                ArrayList sitePages = new ArrayList();
                PopulatePageArray(sitePages);
                List <ModuleDecoratedSiteMapNode> pageList
                    = ModuleDecoratedSiteMapNode.GetDecoratedNodes(sitePages, moduleID);

                foreach (ModuleDecoratedSiteMapNode decoratedPage in pageList)
                {
                    if (decoratedPage.IsPublished)
                    {
                        pageIDs.Add(decoratedPage.PageId);
                    }
                }

                foreach (int p in pageIDs)
                {
                    Module.DeleteModuleInstance(this.moduleID, p);
                    IndexHelper.RebuildPageIndexAsync(new PageSettings(siteSettings.SiteId, p));
                }

                Module           m       = new Module(moduleID);
                ModuleDefinition feature = new ModuleDefinition(m.ModuleDefId);

                if (feature.DeleteProvider.Length > 0)
                {
                    try
                    {
                        ContentDeleteHandlerProvider contentDeleter = ContentDeleteHandlerProviderManager.Providers[feature.DeleteProvider];
                        if (contentDeleter != null)
                        {
                            contentDeleter.DeleteContent(m.ModuleId, m.ModuleGuid);
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("Failed to invoke content delete handler " + feature.DeleteProvider, ex);
                    }
                }

                Module.DeleteModule(this.moduleID);
            }

            if (hdnReturnUrl.Value.Length > 0)
            {
                WebUtils.SetupRedirect(this, hdnReturnUrl.Value);
                return;
            }

            WebUtils.SetupRedirect(this, SiteUtils.GetNavigationSiteRoot());
        }
Beispiel #4
0
        void btnDelete_Click(object sender, EventArgs e)
        {
            ArrayList pageIDs   = new ArrayList();
            ArrayList sitePages = new ArrayList();

            PopulatePageArray(sitePages);
            List <ModuleDecoratedSiteMapNode> pageList
                = ModuleDecoratedSiteMapNode.GetDecoratedNodes(sitePages, moduleID);

            foreach (ModuleDecoratedSiteMapNode decoratedPage in pageList)
            {
                if (decoratedPage.IsPublished)
                {
                    pageIDs.Add(decoratedPage.PageId);
                }
            }

            foreach (int p in pageIDs)
            {
                Module.DeleteModuleInstance(this.moduleID, p);
                mojoPortal.SearchIndex.IndexHelper.RebuildPageIndexAsync(new PageSettings(siteSettings.SiteId, p));
            }

            Module           m       = new Module(moduleID);
            ModuleDefinition feature = new ModuleDefinition(m.ModuleDefId);

            if (feature.DeleteProvider.Length > 0)
            {
                try
                {
                    ContentDeleteHandlerProvider contentDeleter = ContentDeleteHandlerProviderManager.Providers[feature.DeleteProvider];
                    if (contentDeleter != null)
                    {
                        contentDeleter.DeleteContent(m.ModuleId, m.ModuleGuid);
                    }
                }
                catch (Exception ex)
                {
                    log.Error("Failed to invoke content delete handler " + feature.DeleteProvider, ex);
                }
            }

            if (WebConfigSettings.LogIpAddressForContentDeletions)
            {
                string   userName    = string.Empty;
                SiteUser currentUser = SiteUtils.GetCurrentSiteUser();
                if (currentUser != null)
                {
                    userName = currentUser.Name;
                }

                log.Info("user " + userName + " deleted module " + m.ModuleTitle + " from ip address " + SiteUtils.GetIP4Address());
            }

            Module.DeleteModule(this.moduleID);

            if (hdnReturnUrl.Value.Length > 0)
            {
                if (hdnReturnUrl.Value.Contains("ModuleSettings.aspx"))
                {
                    // redirecting back to module settings for a deleted module cuases an error
                    WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
                    return;
                }

                WebUtils.SetupRedirect(this, hdnReturnUrl.Value);
                return;
            }

            WebUtils.SetupRedirect(this, SiteUtils.GetNavigationSiteRoot());
        }