当前位置: 首页>>代码示例>>C#>>正文


C# ModuleController.CopyModule方法代码示例

本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController.CopyModule方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleController.CopyModule方法的具体用法?C# ModuleController.CopyModule怎么用?C# ModuleController.CopyModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Entities.Modules.ModuleController的用法示例。


在下文中一共展示了ModuleController.CopyModule方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btGo_Click

        public void btGo_Click(object sender, EventArgs e)
        {
            //Setup Child Page - Main View/Activity
            TabInfo tab = CreatePage(PortalSettings.ActiveTab, PortalId, TabId, "Group Activity", false);
            //Add Module to Child Page
            int groupViewModuleId = AddModule(tab, PortalId, "Social Groups", "ContentPaneProfile");
            int journalModuleId = AddModule(tab, PortalId, "Journal", "ContentPaneProfile");
            int consoleId = AddModule(tab, PortalId, "Console", "RightPaneProfile");

            var mc = new ModuleController();

            ModuleInfo groupConsoleModule = mc.GetModule(consoleId, tab.TabID);
            TabInfo memberTab = CreatePage(PortalSettings.ActiveTab, PortalId, tab.TabID, "Members", false);
            mc.CopyModule(groupConsoleModule, memberTab, "RightPaneProfile", true);

            ModuleInfo groupViewModule = mc.GetModule(groupViewModuleId, tab.TabID);
            mc.CopyModule(groupViewModule, memberTab, "ContentPaneProfile", true);
            AddModule(memberTab, PortalId, "DotNetNuke.Modules.MemberDirectory", "ContentPaneProfile");


            //List Settings
            var modules = new ModuleController();
            modules.UpdateTabModuleSetting(TabModuleId, Constants.GroupLoadView, GroupMode.List.ToString());
            modules.UpdateTabModuleSetting(TabModuleId, Constants.GroupViewPage, tab.TabID.ToString(CultureInfo.InvariantCulture));

            Response.Redirect(Request.RawUrl);
        }
开发者ID:biganth,项目名称:Curt,代码行数:27,代码来源:Setup.ascx.cs

示例2: btGo_Click

        public void btGo_Click(object sender, EventArgs e)
        {
            //Setup Child Page - Main View/Activity
            TabInfo tab = CreatePage(PortalSettings.ActiveTab, PortalId, TabId, "Group Activity", false);

            //Add Module to Child Page
            int groupViewModuleId = AddModule(tab, PortalId, "Social Groups", "ContentPane");
            int journalModuleId = AddModule(tab, PortalId, "Journal", "ContentPane");
            int consoleId = AddModule(tab, PortalId, "Console", "RightPane");

            var mc = new ModuleController();

            ModuleInfo groupConsoleModule = mc.GetModule(consoleId, tab.TabID);
            TabInfo memberTab = CreatePage(PortalSettings.ActiveTab, PortalId, tab.TabID, "Members", false);
            mc.CopyModule(groupConsoleModule, memberTab, "RightPane", true);

            ModuleInfo groupViewModule = mc.GetModule(groupViewModuleId, tab.TabID);
            mc.CopyModule(groupViewModule, memberTab, "ContentPane", true);
            AddModule(memberTab, PortalId, "DotNetNuke.Modules.MemberDirectory", "ContentPane");


            //List Settings
            var modules = new ModuleController();
            modules.UpdateTabModuleSetting(TabModuleId, Constants.GroupLoadView, GroupMode.List.ToString());
            modules.UpdateTabModuleSetting(TabModuleId, Constants.GroupViewPage, tab.TabID.ToString(CultureInfo.InvariantCulture));

			//Default Social Groups
	        var defaultGroup = RoleController.GetRoleGroupByName(PortalId, Constants.DefaultGroupName);
	        var groupId = -2;
			if (defaultGroup != null)
			{
				groupId = defaultGroup.RoleGroupID;
			}
			else
			{
				var groupInfo = new RoleGroupInfo();
                    groupInfo.PortalID = PortalId;
                    groupInfo.RoleGroupName = Constants.DefaultGroupName;
                    groupInfo.Description = Constants.DefaultGroupName;
				groupId = RoleController.AddRoleGroup(groupInfo);

			}
			modules.UpdateTabModuleSetting(TabModuleId, Constants.DefaultRoleGroupSetting, groupId.ToString());

            Response.Redirect(Request.RawUrl);
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:46,代码来源:Setup.ascx.cs

示例3: submitTranslation_Click

        protected void submitTranslation_Click(object sender, EventArgs e)
        {
            var modCtrl = new ModuleController();
            var tabCtrl = new TabController();

            foreach (TabInfo localizedTab in Tab.LocalizedTabs.Values)
            {
                //Make Deep copies of all modules
                var moduleCtrl = new ModuleController();
                foreach (KeyValuePair<int, ModuleInfo> kvp in moduleCtrl.GetTabModules(Tab.TabID))
                {
                    ModuleInfo sourceModule = kvp.Value;
                    ModuleInfo localizedModule = null;

                    //Make sure module has the correct culture code
                    if (string.IsNullOrEmpty(sourceModule.CultureCode))
                    {
                        sourceModule.CultureCode = Tab.CultureCode;
                        moduleCtrl.UpdateModule(sourceModule);
                    }

                    if (!sourceModule.LocalizedModules.TryGetValue(localizedTab.CultureCode, out localizedModule))
                    {
                        if (!sourceModule.IsDeleted)
                        {
                            //Shallow (Reference Copy)

                            {
                                if (sourceModule.AllTabs)
                                {
                                    foreach (ModuleInfo m in moduleCtrl.GetModuleTabs(sourceModule.ModuleID))
                                    {
                                        //Get the tab
                                        TabInfo allTabsTab = tabCtrl.GetTab(m.TabID, m.PortalID, false);
                                        TabInfo localizedAllTabsTab = null;
                                        if (allTabsTab.LocalizedTabs.TryGetValue(localizedTab.CultureCode, out localizedAllTabsTab))
                                        {
                                            moduleCtrl.CopyModule(m, localizedAllTabsTab, Null.NullString, true);
                                        }
                                    }
                                }
                                else
                                {
                                    moduleCtrl.CopyModule(sourceModule, localizedTab, Null.NullString, true);
                                }
                            }

                            //Fetch new module
                            localizedModule = moduleCtrl.GetModule(sourceModule.ModuleID, localizedTab.TabID);

                            //Convert to deep copy
                            moduleCtrl.LocalizeModule(localizedModule, LocaleController.Instance.GetLocale(localizedTab.CultureCode));
                        }
                    }
                }

                var users = new Dictionary<int, UserInfo>();

                //Give default translators for this language and administrators permissions
                tabCtrl.GiveTranslatorRoleEditRights(localizedTab, users);

                //Send Messages to all the translators of new content
                foreach (var translator in users.Values.Where(user => user.UserID != PortalSettings.AdministratorId))
                {
                    AddTranslationSubmittedNotification(localizedTab, translator);
                }
            }

            //Redirect to refresh page (and skinobjects)
            Response.Redirect(Request.RawUrl, true);
        }
开发者ID:smkkstudios,项目名称:BlackandWhiteReporting,代码行数:71,代码来源:ManageTabs.ascx.cs

示例4: readyForTranslationButton_Click

        protected void readyForTranslationButton_Click(object sender, EventArgs e)
        {
            var modCtrl = new ModuleController();
            var tabCtrl = new TabController();

            foreach (TabInfo localizedTab in Tab.LocalizedTabs.Values)
            {
                //Make Deep copies of all modules
                var moduleCtrl = new ModuleController();
                foreach (KeyValuePair<int, ModuleInfo> kvp in moduleCtrl.GetTabModules(Tab.TabID))
                {
                    ModuleInfo sourceModule = kvp.Value;
                    ModuleInfo localizedModule = null;

                    //Make sure module has the correct culture code
                    if (string.IsNullOrEmpty(sourceModule.CultureCode))
                    {
                        sourceModule.CultureCode = Tab.CultureCode;
                        moduleCtrl.UpdateModule(sourceModule);
                    }

                    if (!sourceModule.LocalizedModules.TryGetValue(localizedTab.CultureCode, out localizedModule))
                    {
                        if (!sourceModule.IsDeleted)
                        {
                            //Shallow (Reference Copy)

                            {
                                if (sourceModule.AllTabs)
                                {
                                    foreach (ModuleInfo m in moduleCtrl.GetModuleTabs(sourceModule.ModuleID))
                                    {
                                        //Get the tab
                                        TabInfo allTabsTab = tabCtrl.GetTab(m.TabID, m.PortalID, false);
                                        TabInfo localizedAllTabsTab = null;
                                        if (allTabsTab.LocalizedTabs.TryGetValue(localizedTab.CultureCode, out localizedAllTabsTab))
                                        {
                                            moduleCtrl.CopyModule(m, localizedAllTabsTab, Null.NullString, true);
                                        }
                                    }
                                }
                                else
                                {
                                    moduleCtrl.CopyModule(sourceModule, localizedTab, Null.NullString, true);
                                }
                            }

                            //Fetch new module
                            localizedModule = moduleCtrl.GetModule(sourceModule.ModuleID, localizedTab.TabID);

                            //Convert to deep copy
                            moduleCtrl.LocalizeModule(localizedModule, LocaleController.Instance.GetLocale(localizedTab.CultureCode));
                        }
                    }
                }

                var users = new Dictionary<int, UserInfo>();

                //Give default translators for this language and administrators permissions
                tabCtrl.GiveTranslatorRoleEditRights(localizedTab, users);

                //Send Messages to all the translators of new content
                foreach (UserInfo translator in users.Values)
                {
                    if (translator.UserID != PortalSettings.AdministratorId)
                    {
                        var message = new Message();
                        message.FromUserID = PortalSettings.AdministratorId;
                        message.ToUserID = translator.UserID;
                        message.Subject = Localization.GetString("NewContentMessage.Subject", LocalResourceFile);
                        message.Status = MessageStatusType.Unread;
                        message.Body = string.Format(Localization.GetString("NewContentMessage.Body", LocalResourceFile),
                                                     localizedTab.TabName,
                                                     Globals.NavigateURL(localizedTab.TabID, false, PortalSettings, Null.NullString, localizedTab.CultureCode, new string[] { }));

                        var messageCtrl = new MessagingController();
                        messageCtrl.SaveMessage(message);
                    }
                }
            }

            //Redirect to refresh page (and skinobjects)
            Response.Redirect(Request.RawUrl, true);
        }
开发者ID:patonomatic,项目名称:VUWTC,代码行数:84,代码来源:ManageTabs.ascx.cs

示例5: AddTab

        public int AddTab( TabInfo objTab, bool AddAllTabsModules )
        {
            int intTabId;

            objTab.TabPath = Globals.GenerateTabPath( objTab.ParentId, objTab.TabName );
            intTabId = DataProvider.Instance().AddTab( objTab.PortalID, objTab.TabName, objTab.IsVisible, objTab.DisableLink, objTab.ParentId, objTab.IconFile, objTab.Title, objTab.Description, objTab.KeyWords, objTab.Url, objTab.SkinSrc, objTab.ContainerSrc, objTab.TabPath, objTab.StartDate, objTab.EndDate, objTab.RefreshInterval, objTab.PageHeadText );

            TabPermissionController objTabPermissionController = new TabPermissionController();

            if( objTab.TabPermissions != null )
            {
                TabPermissionCollection objTabPermissions = objTab.TabPermissions;

                foreach( TabPermissionInfo objTabPermission in objTabPermissions )
                {
                    objTabPermission.TabID = intTabId;
                    if( objTabPermission.AllowAccess )
                    {
                        objTabPermissionController.AddTabPermission( objTabPermission );
                    }
                }
            }
            if( !( Null.IsNull( objTab.PortalID ) ) )
            {
                UpdatePortalTabOrder( objTab.PortalID, intTabId, objTab.ParentId, 0, 0, objTab.IsVisible, true );
            }
            else // host tab
            {
                ArrayList arrTabs = GetTabsByParentId( objTab.ParentId, objTab.PortalID );
                UpdateTabOrder( objTab.PortalID, intTabId, ( arrTabs.Count*2 ) - 1, 1, objTab.ParentId );
            }

            if( AddAllTabsModules )
            {
                ModuleController objmodules = new ModuleController();
                ArrayList arrMods = objmodules.GetAllTabsModules( objTab.PortalID, true );

                foreach( ModuleInfo objModule in arrMods )
                {
                    objmodules.CopyModule( objModule.ModuleID, objModule.TabID, intTabId, "", true );
                }
            }

            ClearCache( objTab.PortalID );

            return intTabId;
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:47,代码来源:TabController.cs

示例6: AddAllTabsModules

 private static void AddAllTabsModules(TabInfo tab)
 {
     var objmodules = new ModuleController();
     var portalSettings = new PortalSettings(tab.TabID, tab.PortalID);
     foreach (ModuleInfo allTabsModule in objmodules.GetAllTabsModules(tab.PortalID, true))
     {
         //[DNN-6276]We need to check that the Module is not implicitly deleted.  ie If all instances are on Pages
         //that are all "deleted" then even if the Module itself is not deleted, we would not expect the 
         //Module to be added
         var canAdd =
         (from ModuleInfo allTabsInstance in objmodules.GetModuleTabs(allTabsModule.ModuleID) select new TabController().GetTab(allTabsInstance.TabID, tab.PortalID, false)).Any(
             t => !t.IsDeleted) && (!portalSettings.ContentLocalizationEnabled || allTabsModule.CultureCode == tab.CultureCode);
         if (canAdd)
         {
             objmodules.CopyModule(allTabsModule, tab, Null.NullString, true);
         }
     }
 }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:18,代码来源:TabController.cs

示例7: RestoreTab

        /// <summary>
        /// Restores the tab.
        /// </summary>
        /// <param name="tab">The obj tab.</param>
        /// <param name="portalSettings">The portal settings.</param>
        public void RestoreTab(TabInfo tab, PortalSettings portalSettings)
        {
            if (tab.DefaultLanguageTab != null)
            {
                //We are trying to restore the child, so recall this function with the master language's tab id
                RestoreTab(tab.DefaultLanguageTab, portalSettings);
                return;
            }

            tab.IsDeleted = false;
            UpdateTab(tab);

            //Restore any localized children
            foreach (TabInfo localizedtab in tab.LocalizedTabs.Values)
            {
                localizedtab.IsDeleted = false;
                UpdateTab(localizedtab);
            }

            var eventLogController = new EventLogController();
            eventLogController.AddLog(tab, portalSettings, portalSettings.UserId, "",
                                      EventLogController.EventLogType.TAB_RESTORED);

            var moduleController = new ModuleController();
            ArrayList allTabsModules = moduleController.GetAllTabsModules(tab.PortalID, true);
            foreach (ModuleInfo objModule in allTabsModules)
            {
                moduleController.CopyModule(objModule, tab, Null.NullString, true);
            }

            ClearCache(tab.PortalID);
        }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:37,代码来源:TabController.cs

示例8: cmdUpdate_Click


//.........这里部分代码省略.........
                    {
                        objModule.CacheTime = int.Parse( txtCacheTime.Text );
                    }
                    else
                    {
                        objModule.CacheTime = 0;
                    }
                    objModule.TabID = TabId;
                    if( objModule.AllTabs != chkAllTabs.Checked )
                    {
                        AllTabsChanged = true;
                    }
                    objModule.AllTabs = chkAllTabs.Checked;
                    switch( int.Parse( cboVisibility.SelectedItem.Value ) )
                    {
                        case 0:

                            objModule.Visibility = VisibilityState.Maximized;
                            break;
                        case 1:

                            objModule.Visibility = VisibilityState.Minimized;
                            break;
                        case 2:

                            objModule.Visibility = VisibilityState.None;
                            break;
                    }
                    objModule.IsDeleted = false;
                    objModule.Header = txtHeader.Text;
                    objModule.Footer = txtFooter.Text;
                    if( !String.IsNullOrEmpty( txtStartDate.Text ) )
                    {
                        objModule.StartDate = Convert.ToDateTime( txtStartDate.Text );
                    }
                    else
                    {
                        objModule.StartDate = Null.NullDate;
                    }
                    if( !String.IsNullOrEmpty( txtEndDate.Text ) )
                    {
                        objModule.EndDate = Convert.ToDateTime( txtEndDate.Text );
                    }
                    else
                    {
                        objModule.EndDate = Null.NullDate;
                    }
                    objModule.ContainerSrc = ctlModuleContainer.SkinSrc;
                    objModule.ModulePermissions = dgPermissions.Permissions;
                    objModule.InheritViewPermissions = chkInheritPermissions.Checked;
                    objModule.DisplayTitle = chkDisplayTitle.Checked;
                    objModule.DisplayPrint = chkDisplayPrint.Checked;
                    objModule.DisplaySyndicate = chkDisplaySyndicate.Checked;
                    objModule.IsDefaultModule = chkDefault.Checked;
                    objModule.AllModules = chkAllModules.Checked;
                    objModules.UpdateModule( objModule );

                    //Update Custom Settings
                    if( ctlSpecific != null )
                    {
                        ctlSpecific.UpdateSettings();
                    }

                    //These Module Copy/Move statements must be
                    //at the end of the Update as the Controller code assumes all the
                    //Updates to the Module have been carried out.

                    //Check if the Module is to be Moved to a new Tab
                    if( ! chkAllTabs.Checked )
                    {
                        int newTabId = int.Parse( cboTab.SelectedItem.Value );
                        if( TabId != newTabId )
                        {
                            objModules.MoveModule( moduleId, TabId, newTabId, "" );
                        }
                    }

                    //'Check if Module is to be Added/Removed from all Tabs
                    if( AllTabsChanged )
                    {
                        ArrayList arrTabs = Globals.GetPortalTabs( PortalSettings.DesktopTabs, false, true );
                        if( chkAllTabs.Checked )
                        {
                            objModules.CopyModule( moduleId, TabId, arrTabs, true );
                        }
                        else
                        {
                            objModules.DeleteAllModules( moduleId, TabId, arrTabs, false, false );
                        }
                    }

                    // Navigate back to admin page
                    Response.Redirect( Globals.NavigateURL(), true );
                }
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:101,代码来源:ModuleSettings.ascx.cs

示例9: cmdRestoreTab_Click

        /// <summary>
        /// Restores selected tabs in the listbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// Adds a log entry for each restored tab to the EventLog
        /// Redirects to same page after restoring so the menu can be refreshed with restored tabs.
        /// This will not restore deleted modules for selected tabs, only the tabs are restored.
        /// </remarks>
        /// <history>
        /// 	[VMasanas]	18/08/2004	Added support for multiselect listbox
        ///                 30/09/2004  Child tabs cannot be restored until their parent is restored first.
        ///                             Change logic so log is only added when tab is actually restored
        /// </history>
        protected void cmdRestoreTab_Click( Object sender, ImageClickEventArgs e )
        {
            ListItem item;
            bool errors = false;

            foreach( ListItem tempLoopVar_item in lstTabs.Items )
            {
                item = tempLoopVar_item;
                if( item.Selected )
                {
                    EventLogController objEventLog = new EventLogController();
                    TabController objTabs = new TabController();

                    TabInfo objTab = objTabs.GetTab( int.Parse( item.Value ) );
                    if( objTab != null )
                    {
                        if( Null.IsNull( objTab.ParentId ) && lstTabs.Items.FindByValue( objTab.ParentId.ToString() ) != null )
                        {
                            UI.Skins.Skin.AddModuleMessage( this, string.Format( Localization.GetString( "ChildTab.ErrorMessage", this.LocalResourceFile ), objTab.TabName ), ModuleMessageType.YellowWarning );
                            errors = true;
                        }
                        else
                        {
                            objTab.IsDeleted = false;
                            objTabs.UpdateTab( objTab );
                            objEventLog.AddLog( objTab, PortalSettings, UserId, "", EventLogController.EventLogType.TAB_RESTORED );

                            ModuleController objmodules = new ModuleController();
                            ArrayList arrMods = objmodules.GetAllTabsModules( objTab.PortalID, true );

                            foreach( ModuleInfo objModule in arrMods )
                            {
                                objmodules.CopyModule( objModule.ModuleID, objModule.TabID, objTab.TabID, "", true );
                            }
                        }
                    }
                }
            }
            if( ! errors )
            {
                Response.Redirect( Globals.NavigateURL() );
            }
            else
            {
                BindData();
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:62,代码来源:RecycleBin.ascx.cs


注:本文中的DotNetNuke.Entities.Modules.ModuleController.CopyModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。