public void CreateContentItem(ModuleInfo updatedModule)
 {
     IContentTypeController typeController = new ContentTypeController();
     ContentType contentType = (from t in typeController.GetContentTypes()
                                where t.Type == "Module"
                                select t).SingleOrDefault();
     //This module does not have a valid ContentItem
     //create ContentItem
     IContentController contentController = CommonLibrary.Entities.Content.Common.Util.GetContentController();
     updatedModule.Content = updatedModule.ModuleTitle;
     updatedModule.Indexed = false;
     updatedModule.ContentTypeId = contentType.ContentTypeId;
     updatedModule.ContentItemId = contentController.AddContentItem(updatedModule);
 }
Exemplo n.º 2
0
        public void CreateContentItem(TabInfo updatedTab)
        {
            IContentTypeController typeController = new ContentTypeController();
            ContentType contentType = (from t in typeController.GetContentTypes()
                                       where t.Type == "Tab"
                                       select t).SingleOrDefault();

            //This tab does not have a valid ContentItem
            //create ContentItem
            IContentController contentController = Util.GetContentController();
            if (string.IsNullOrEmpty(updatedTab.Title))
            {
                updatedTab.Content = updatedTab.TabName;
            }
            else
            {
                updatedTab.Content = updatedTab.Title;
            }
            updatedTab.ContentTypeId = contentType.ContentTypeId;
            updatedTab.Indexed = false;
            updatedTab.ContentItemId = contentController.AddContentItem(updatedTab);
        }
        public int AddModule(ModuleInfo objModule)
        {
            Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
            if (Null.IsNull(objModule.ModuleID))
            {
                IContentTypeController typeController = new ContentTypeController();
                ContentType contentType = (from t in typeController.GetContentTypes()
                                           where t.Type == "Module"
                                           select t)
                                                 .SingleOrDefault();

                IContentController contentController = new ContentController();
                objModule.Content = objModule.ModuleTitle;
                objModule.ContentTypeId = contentType.ContentTypeId;
                objModule.Indexed = false;
                int contentItemID = contentController.AddContentItem(objModule);

                objModule.ModuleID = dataProvider.AddModule(contentItemID, objModule.PortalID, objModule.ModuleDefID, objModule.ModuleTitle, objModule.AllTabs, objModule.Header, objModule.Footer, objModule.StartDate, objModule.EndDate, objModule.InheritViewPermissions, objModule.IsDeleted,
                UserController.GetCurrentUserInfo().UserID);
                //Now we have the ModuleID - update the contentItem
                contentController.UpdateContentItem(objModule);
                objEventLog.AddLog(objModule, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", Services.Log.EventLog.EventLogController.EventLogType.MODULE_CREATED);
                ModulePermissionController.SaveModulePermissions(objModule);
            }
            ModuleInfo tmpModule = GetModule(objModule.ModuleID, objModule.TabID);
            if (tmpModule != null)
            {
                if (tmpModule.IsDeleted)
                {
                    RestoreModule(objModule);
                }
            }
            else
            {
                dataProvider.AddTabModule(objModule.TabID, objModule.ModuleID, objModule.ModuleOrder, objModule.PaneName, objModule.CacheTime, objModule.CacheMethod, objModule.Alignment, objModule.Color, objModule.Border, objModule.IconFile,
                (int)objModule.Visibility, objModule.ContainerSrc, objModule.DisplayTitle, objModule.DisplayPrint, objModule.DisplaySyndicate, objModule.IsWebSlice, objModule.WebSliceTitle, objModule.WebSliceExpiryDate, objModule.WebSliceTTL, UserController.GetCurrentUserInfo().UserID);
                Services.Log.EventLog.LogInfo objEventLogInfo = new Services.Log.EventLog.LogInfo();
                objEventLogInfo.LogProperties.Add(new CommonLibrary.Services.Log.EventLog.LogDetailInfo("TabId", objModule.TabID.ToString()));
                objEventLogInfo.LogProperties.Add(new CommonLibrary.Services.Log.EventLog.LogDetailInfo("ModuleID", objModule.ModuleID.ToString()));
                objEventLogInfo.LogTypeKey = CommonLibrary.Services.Log.EventLog.EventLogController.EventLogType.TABMODULE_CREATED.ToString();
                objEventLog.AddLog(objEventLogInfo);
                if (objModule.ModuleOrder == -1)
                {
                    UpdateModuleOrder(objModule.TabID, objModule.ModuleID, objModule.ModuleOrder, objModule.PaneName);
                }
                else
                {
                    UpdateTabModuleOrder(objModule.TabID);
                }
            }
            UpdateModuleSettings(objModule);
            if (objModule.TabModuleID == -1)
            {
                if (tmpModule == null)
                    tmpModule = GetModule(objModule.ModuleID, objModule.TabID);
                objModule.TabModuleID = tmpModule.TabModuleID;
            }
            UpdateTabModuleSettings(objModule);
            ClearCache(objModule.TabID);
            return objModule.ModuleID;
        }
Exemplo n.º 4
0
        private int AddTabInternal(TabInfo objTab, bool includeAllTabsModules)
        {
            bool newTab = true;
            objTab.TabPath = Globals.GenerateTabPath(objTab.ParentId, objTab.TabName);
            int iTabID = GetTabByTabPath(objTab.PortalID, objTab.TabPath);
            if (iTabID > Null.NullInteger)
            {
                throw new TabExistsException(iTabID, "Tab Exists");
            }
            else
            {
                //First create ContentItem as we need the ContentItemID
                IContentTypeController typeController = new ContentTypeController();
                ContentType contentType = (from t in typeController.GetContentTypes()
                                           where t.Type == "Tab"
                                           select t)
                                                 .SingleOrDefault();

                IContentController contentController = Util.GetContentController();
                if (String.IsNullOrEmpty(objTab.Title))
                {
                    objTab.Content = objTab.TabName;
                }
                else
                {
                    objTab.Content = objTab.Title;
                }
                objTab.ContentTypeId = contentType.ContentTypeId;
                objTab.Indexed = false;
                int contentItemID = contentController.AddContentItem(objTab);

                //Add Module
                iTabID = provider.AddTab(contentItemID, objTab.PortalID, objTab.TabName, objTab.IsVisible, objTab.DisableLink, objTab.ParentId, objTab.IconFile, objTab.IconFileLarge, objTab.Title, objTab.Description, objTab.KeyWords,
                objTab.Url, objTab.SkinSrc, objTab.ContainerSrc, objTab.TabPath, objTab.StartDate, objTab.EndDate, objTab.RefreshInterval, objTab.PageHeadText, objTab.IsSecure, objTab.PermanentRedirect,
                objTab.SiteMapPriority, UserController.GetCurrentUserInfo().UserID, PortalController.GetActivePortalLanguage(objTab.PortalID));
                objTab.TabID = iTabID;
                //Now we have the TabID - update the contentItem
                contentController.UpdateContentItem(objTab);

                ITermController termController = Util.GetTermController();
                termController.RemoveTermsFromContent(objTab);
                foreach (Term _Term in objTab.Terms)
                {
                    termController.AddTermToContent(_Term, objTab);
                }
                Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
                objEventLog.AddLog(objTab, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", Services.Log.EventLog.EventLogController.EventLogType.TAB_CREATED);
                TabPermissionController.SaveTabPermissions(objTab);
                try
                {
                    UpdateTabSettings(ref objTab);
                }
                catch (Exception ex)
                {
                    Exceptions.LogException(ex);
                }
                if (includeAllTabsModules)
                {
                    AddAllTabsModules(objTab);
                }
            }
            return objTab.TabID;
        }