本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController.GetModuleTabs方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleController.GetModuleTabs方法的具体用法?C# ModuleController.GetModuleTabs怎么用?C# ModuleController.GetModuleTabs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Entities.Modules.ModuleController
的用法示例。
在下文中一共展示了ModuleController.GetModuleTabs方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: SynchronizeModule
/// <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);
}
}
示例3: LoadActions
//.........这里部分代码省略.........
{
AddSyndicateAction();
}
}
//help module actions available to content editors and administrators
const string permisisonList = "CONTENT,DELETE,EDIT,EXPORT,IMPORT,MANAGE";
if (ModulePermissionController.HasModulePermission(Configuration.ModulePermissions, permisisonList) && request.QueryString["ctl"] != "Help")
{
AddHelpActions();
}
//Add Print Action
if (Configuration.DisplayPrint)
{
//print module action available to everyone
AddPrintAction();
}
if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Host, "MANAGE", Configuration))
{
_moduleGenericActions.Actions.Add(GetNextActionID(),
Localization.GetString(ModuleActionType.ViewSource, Localization.GlobalResourceFile),
ModuleActionType.ViewSource,
"",
"action_source.gif",
NavigateUrl(TabId, "ViewSource", false, "ModuleId=" + ModuleId, "ctlid=" + Configuration.ModuleControlId, "ReturnURL=" + FilterUrl(request)),
false,
SecurityAccessLevel.Host,
true,
false);
}
if (!Globals.IsAdminControl() && ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE,MANAGE", Configuration))
{
if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "DELETE", Configuration))
{
//Check if this is the owner instance of a shared module.
string confirmText = "confirm('" + ClientAPI.GetSafeJSString(Localization.GetString("DeleteModule.Confirm")) + "')";
if (!Configuration.IsShared)
{
var moduleController = new ModuleController();
if (moduleController.GetModuleTabs(Configuration.ModuleID).Cast<ModuleInfo>().Any(instance => instance.IsShared))
{
confirmText = "confirm('" + ClientAPI.GetSafeJSString(Localization.GetString("DeleteSharedModule.Confirm")) + "')";
}
}
_moduleGenericActions.Actions.Add(GetNextActionID(),
Localization.GetString(ModuleActionType.DeleteModule, Localization.GlobalResourceFile),
ModuleActionType.DeleteModule,
Configuration.ModuleID.ToString(),
"action_delete.gif",
"",
confirmText,
false,
SecurityAccessLevel.View,
true,
false);
}
if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", Configuration))
{
_moduleGenericActions.Actions.Add(GetNextActionID(),
Localization.GetString(ModuleActionType.ClearCache, Localization.GlobalResourceFile),
ModuleActionType.ClearCache,
Configuration.ModuleID.ToString(),
"action_refresh.gif",
"",
false,
SecurityAccessLevel.View,
true,
false);
}
if (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Admin, "MANAGE", Configuration))
{
//module movement
AddMenuMoveActions();
}
}
if (_moduleGenericActions.Actions.Count > 0)
{
_actions.Add(_moduleGenericActions);
}
if (_moduleMoveActions != null && _moduleMoveActions.Actions.Count > 0)
{
_actions.Add(_moduleMoveActions);
}
foreach (ModuleAction action in _moduleGenericActions.Actions)
{
if (!UIUtilities.IsLegacyUI(ModuleId, action.ControlKey, PortalId) && action.Url.Contains("ctl"))
{
action.ClientScript = UrlUtils.PopUpUrl(action.Url, _moduleControl as Control, PortalSettings, true, false);
}
}
}
示例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);
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// validate module
// load module
ModuleInfo _mod = null;
PortalSettings portalSettings = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings();
try {
ModuleController modCtrl = new ModuleController();
int mid = Convert.ToInt32(Request.Params["mid"]);
ArrayList mods = modCtrl.GetModuleTabs(mid);
if (mods == null || mods.Count == 0) {
throw new Exception();
}
_mod = (ModuleInfo)mods[0];
if (_mod == null || _mod.ModuleID <= 0) {
throw new Exception();
}
} catch (Exception ex) {
_mod = null;
}
if (_mod == null) {
Response.Write("Invalid Module!");
} else {
if (Request.Files != null && Request.Files.Count > 0) {
try {
string parentFolder = uploadPath.Value;
if (parentFolder.Length > 0 && parentFolder[parentFolder.Length - 1] != '\\')
parentFolder += '\\';
string path = portalSettings.HomeDirectoryMapPath + parentFolder + Path.GetFileName(Request.Files[0].FileName);
if (File.Exists(path)) {
if (cbUploadOverwrite.Checked) {
File.Delete(path);
} else {
throw new Exception("A file with the same name already exists. ");
}
}
Request.Files[0].SaveAs(path);
Response.Write(uploadPath.Value);
} catch (Exception ex) {
Response.Write("Error uploading file (Server response: " + ex.Message + ")");
}
Response.End();
}
if (!Page.IsPostBack) {
try {
// load module settings
ModuleController modCtrl = new ModuleController();
int mid = Convert.ToInt32(Request.Params["mid"]);
ArrayList mods = modCtrl.GetModuleTabs(mid);
if (mods == null || mods.Count == 0) {
throw new Exception();
}
ModuleInfo mod = (ModuleInfo)mods[0];
if (mod == null || mod.ModuleID <= 0) {
throw new Exception();
}
FastShotSettings fsSettings = new FastShotSettings();
fsSettings.Load(mod.ModuleID);
// load templates
List<string> templates = new List<string>();
foreach (string dir in System.IO.Directory.GetDirectories(Server.MapPath(TemplateSourceDirectory + "/templates/"))) {
if (System.IO.Path.GetFileName(dir)[0] == '.') {
continue;
}
foreach (string subDir in System.IO.Directory.GetDirectories(dir)) {
if (System.IO.Path.GetFileName(subDir)[0] == '.') {
continue;
}
templates.Add(JsonEncode(System.IO.Path.GetFileName(dir) + "/" + System.IO.Path.GetFileName(subDir)));
}
}
Page.ClientScript.RegisterStartupScript(GetType(), "initSettings", "avt.fs.settings = {mid: " + fsSettings.ModuleId.ToString() + ", title: '" + JsonEncode(mod.ModuleTitle) + "', template: '" + JsonEncode(fsSettings.Template) + "', thumb_w: " + fsSettings.ThumbWidth + ", thumb_h: " + fsSettings.ThumbHeight + "};", true);
Page.ClientScript.RegisterStartupScript(GetType(), "initTemplates", "avt.fs.templates = [\"" + string.Join("\",\"", templates.ToArray()) + "\"];", true);
Page.ClientScript.RegisterStartupScript(GetType(), "initReturnUrl", "avt.fs.returnUrl = \"" + DotNetNuke.Common.Globals.NavigateURL(mod.TabID) + "\";", true);
} catch {
Page.ClientScript.RegisterStartupScript(GetType(), "initSettings", "avt.fs.settings = {mid: -1, title = 'Invalid Module'};", true);
}
FastShotController fsCtrl = new FastShotController();
if (fsCtrl.IsActivated()) {
btnActivate.Visible = false;
//.........这里部分代码省略.........
示例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);
}
}
}
示例7: MessagingPage
public static TabInfo MessagingPage(string ModuleFriendlyName)
{
if (((_MessagingPage != null)))
{
return _MessagingPage;
}
var mc = new ModuleController();
ModuleInfo md = mc.GetModuleByDefinition(PortalSettings.Current.PortalId, ModuleFriendlyName);
if ((md != null))
{
ArrayList a = mc.GetModuleTabs(md.ModuleID);
if ((a != null))
{
var mi = a[0] as ModuleInfo;
if ((mi != null))
{
var tc = new TabController();
_MessagingPage = tc.GetTab(mi.TabID, PortalSettings.Current.PortalId, false);
}
}
}
return _MessagingPage;
}
示例8: Delete
private void Delete(ModuleAction Command)
{
var moduleController = new ModuleController();
var module = moduleController.GetModule(int.Parse(Command.CommandArgument), ModuleContext.TabId, true);
//Check if this is the owner instance of a shared module.
var user = UserController.GetCurrentUserInfo();
var eventLogController = new EventLogController();
if (!module.IsShared)
{
foreach(ModuleInfo instance in moduleController.GetModuleTabs(module.ModuleID))
{
if(instance.IsShared)
{
//HARD Delete Shared Instance
moduleController.DeleteTabModule(instance.TabID, instance.ModuleID, false);
eventLogController.AddLog(instance, PortalSettings, user.UserID, "", EventLogController.EventLogType.MODULE_DELETED);
}
}
}
moduleController.DeleteTabModule(ModuleContext.TabId, int.Parse(Command.CommandArgument), true);
eventLogController.AddLog(module, PortalSettings, user.UserID, "", EventLogController.EventLogType.MODULE_SENT_TO_RECYCLE_BIN);
//Redirect to the same page to pick up changes
Response.Redirect(Request.RawUrl, true);
}