コード例 #1
0
        public void DeleteSection(Section section, ModuleBase module)
        {
            // Delete module content if the connected module allows this
            module.DeleteModuleContent();

            // Remove connections
            this._commonDao.DeleteObject(section);
            // Invalidate cache
            this._commonDao.RemoveCollectionFromCache("Cuyahoga.Core.Domain.Node.Sections");
        }
コード例 #2
0
ファイル: PageEngine.cs プロジェクト: xwyangjshb/cuyahoga
 private BaseModuleControl LoadModuleControl(ModuleBase module)
 {
     BaseModuleControl ctrl = (BaseModuleControl)this.LoadControl(UrlHelper.GetApplicationPath() + module.CurrentViewControlPath);
     ctrl.Module = module;
     return ctrl;
 }
コード例 #3
0
 public void UpdateContentFromModule(ModuleBase module)
 {
     ISearchable searchableModule = module as ISearchable;
     if (searchableModule != null)
     {
         SearchContent[] searchContentList = searchableModule.GetAllSearchableContent();
         foreach (SearchContent searchContent in searchContentList)
         {
             UpdateContent(searchContent);
         }
     }
 }
コード例 #4
0
        /// <summary>
        /// In the OnInit method the Node and Section of every ModuleAdminPage is set. 
        /// An exception is thrown when one of them cannot be set.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            try
            {
                int nodeId = Int32.Parse(Context.Request.QueryString["NodeId"]);
                this._node = (Node)base.CoreRepository.GetObjectById(typeof(Node), nodeId);
                int sectionId = Int32.Parse(Context.Request.QueryString["SectionId"]);
                this._section = (Section)base.CoreRepository.GetObjectById(typeof(Section), sectionId);
                this._module = this._moduleLoader.GetModuleFromSection(this._section);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to initialize the Module Admin page because a Node or a Section could not be created.", ex);
            }
            // Check permissions
            if (!Context.User.Identity.IsAuthenticated)
            {
                throw new AccessForbiddenException("You are not logged in.");
            }
            else
            {
                User user = (User) Context.User.Identity;
                if (!user.CanEdit(this._section))
                {
                    throw new ActionForbiddenException("You are not allowed to edit the section.");
                }
            }

            // Optional indexing event handlers
            if (this._module is ISearchable
                && Boolean.Parse(Config.GetConfiguration()["InstantIndexing"]))
            {
                ISearchable searchableModule = (ISearchable)this._module;
                searchableModule.ContentCreated += new IndexEventHandler(searchableModule_ContentCreated);
                searchableModule.ContentUpdated += new IndexEventHandler(searchableModule_ContentUpdated);
                searchableModule.ContentDeleted += new IndexEventHandler(searchableModule_ContentDeleted);
            }

            // Set FCKEditor context (used by some module admin pages)
            // It would be nicer if we could do this in the Global.asax, but there the
            // ultra-convenient ~/Path (ResolveUrl) isn't available :).
            string userFilesPath = Config.GetConfiguration()["FCKeditor:UserFilesPath"];
            if (userFilesPath != null && HttpContext.Current.Application["FCKeditor:UserFilesPath"] == null)
            {
                HttpContext.Current.Application.Lock();
                HttpContext.Current.Application["FCKeditor:UserFilesPath"] = ResolveUrl(userFilesPath);
                HttpContext.Current.Application.UnLock();
            }

            base.OnInit(e);
        }
コード例 #5
0
        /// <summary>
        /// In the OnInit method the Node and Section of every ModuleAdminPage is set. 
        /// An exception is thrown when one of them cannot be set.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            try
            {
                int nodeId = Int32.Parse(Context.Request.QueryString["NodeId"]);
                this._node = _nodeService.GetNodeById(nodeId);

                int sectionId = Int32.Parse(Context.Request.QueryString["SectionId"]);
                this._section = _sectionService.GetSectionById(sectionId);

                this._module = this._moduleLoader.GetModuleFromSection(this._section);

                //Put SiteId in a session so the FCKEditor pop up can get it (Custom hack)
                //Session["SiteId"] = this._node.Site.Id;

                //Init Folders
                //ClientFoldersInit((Cuyahoga.Web.Util.UrlHelper.GetApplicationPath() + "SiteData/"), this._node.Site.Id);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to initialize the Module Admin page because a Node or a Section could not be created.", ex);
            }
            // Check permissions
            if (!Context.User.Identity.IsAuthenticated)
            {
                throw new AccessForbiddenException("You are not logged in.");
            }
            else
            {
                User user = (User) Context.User.Identity;
                if (!user.CanEdit(this._section))
                {
                    throw new ActionForbiddenException("You are not allowed to edit the section.");
                }
            }

            // Optional indexing event handlers
            if (this._module is ISearchable && Boolean.Parse(Config.GetConfiguration()["InstantIndexing"]))
            {
                ISearchable searchableModule = (ISearchable)this._module;
                searchableModule.ContentCreated += new IndexEventHandler(searchableModule_ContentCreated);
                searchableModule.ContentUpdated += new IndexEventHandler(searchableModule_ContentUpdated);
                searchableModule.ContentDeleted += new IndexEventHandler(searchableModule_ContentDeleted);
            }

            // Set FCKEditor context (used by some module admin pages)
            // It would be nicer if we could do this in the Global.asax, but there the
            // ultra-convenient ~/Path (ResolveUrl) isn't available :).

            //For multi-site
            string userFilesPath = Cuyahoga.Web.Util.UrlHelper.GetApplicationPath() + "SiteData/" + this._node.Site.Id.ToString();
            string userFilesAbsolutePath = Server.MapPath("~/SiteData/") + this._node.Site.Id.ToString();

            if (userFilesPath != null && HttpContext.Current.Application["FCKeditor:UserFilesPath"] == null)
            {
                HttpContext.Current.Application.Lock();
                HttpContext.Current.Application["FCKeditor:UserFilesPath"] = ResolveUrl(userFilesPath);
                HttpContext.Current.Application.UnLock();
            }

            if (userFilesAbsolutePath != null && HttpContext.Current.Application["FCKeditor:UserFilesAbsolutePath"] == null)
            {
                HttpContext.Current.Application.Lock();
                HttpContext.Current.Application["FCKeditor:UserFilesAbsolutePath"] = userFilesAbsolutePath;
                HttpContext.Current.Application.UnLock();
            }

            base.OnInit(e);
        }
コード例 #6
0
 public void DeleteSection(Section section, int nodeId, ModuleBase module)
 {
     Node node = (Node) this._commonDao.GetObjectById(typeof(Node), nodeId);
     node.RemoveSection(section);
     DeleteSection(section, module);
 }