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); }
public Configuration(int ModuleId) { _ModuleId = ModuleId; _portalSettings = PortalController.GetCurrentPortalSettings(); _TabID = _portalSettings.ActiveTab.TabID; var mc = new DotNetNuke.Entities.Modules.ModuleController(); _ModuleConfiguration = mc.GetModule(_ModuleId, _TabID); _TabModuleID = _ModuleConfiguration.TabModuleID; Hashtable tabModuleSettings = mc.GetTabModuleSettings(_TabModuleID); Hashtable moduleSettings = mc.GetModuleSettings(_ModuleId); //Merge the TabModuleSettings and ModuleSettings _Settings = new Hashtable(); foreach (string strKey in tabModuleSettings.Keys) { _Settings[strKey] = tabModuleSettings[strKey]; } foreach (string strKey in moduleSettings.Keys) { _Settings[strKey] = moduleSettings[strKey]; } LoadSettings(); }
/// <summary> /// Update a setting for all language-versions of a module /// </summary> public static void UpdateModuleSettingForAllLanguages(int moduleId, string key, string value) { var moduleController = new ModuleController(); // Find this module in other languages and update contentGroupGuid var originalModule = moduleController.GetModule(moduleId); var languages = LocaleController.Instance.GetLocales(originalModule.PortalID); if (!originalModule.IsDefaultLanguage && originalModule.DefaultLanguageModule != null) originalModule = originalModule.DefaultLanguageModule; foreach (var language in languages) { // Find module for given Culture var moduleByCulture = moduleController.GetModuleByCulture(originalModule.ModuleID, originalModule.TabID, originalModule.PortalID, language.Value); // Break if no module found if (moduleByCulture == null) continue; if (value == null) moduleController.DeleteModuleSetting(moduleByCulture.ModuleID, key); else moduleController.UpdateModuleSetting(moduleByCulture.ModuleID, key, value); } }
public static ModuleInfo GetModuleinfo(int moduleId) { var objMCtrl = new DotNetNuke.Entities.Modules.ModuleController(); var objMInfo = objMCtrl.GetModule(moduleId); return(objMInfo); }
/// <summary> /// </summary> protected void Page_Load(object sender, EventArgs e) { try { _settings = new SettingsRepository(base.ModuleContext.ModuleId, base.ModuleContext.TabModuleId); DefaultMessage = System.Web.HttpUtility.JavaScriptStringEncode(_settings.DefaultMessage); MaxEmailInputs = _settings.MaxEmailInvitesPerSubmit; MaxDailyInvites = _settings.MaxEmailInvitesPerDay; pnlUserMessage.Visible = _settings.ShowMessageToUser; if (!IsPostBack) { DotNetNuke.Entities.Tabs.TabController tCtrl = new DotNetNuke.Entities.Tabs.TabController(); var activityTab = tCtrl.GetTabByName("Activity Feed", PortalId, -1); if (activityTab != null) { UserProfileTabId = activityTab.TabID; } var mCtrl = new DotNetNuke.Entities.Modules.ModuleController(); ModuleName = mCtrl.GetModule(base.ModuleId).DesktopModule.ModuleName; lnkCloseModal.Visible = IsModal; IInviteRepository inviteRepo = new InviteRepository(); DailyInviteCount = inviteRepo.GetUserInvites(base.UserId, DateTime.Today).Count(); } DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxScriptSupport(); DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); } catch (Exception exc) //Module failed to load { DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc); } }
public static string BuildEditUrl(int itemId, int tabId, int moduleId) { int id = Convert.ToInt32(itemId, CultureInfo.InvariantCulture); int typeId = Item.GetItemTypeId(id); ItemType type = ItemType.GetFromId(typeId, typeof(ItemType)); Item i; var controller = new ModuleController(); int portalId = controller.GetModule(moduleId, tabId).PortalID; if (type.Name == ItemType.Article.Name) { i = Article.GetArticle(id, portalId); } else { i = Category.GetCategory(id); } string returnUrl = string.Empty; if (HttpContext.Current != null) { returnUrl = "returnUrl=" + HttpUtility.UrlEncode(HttpContext.Current.Request.RawUrl); } return Globals.NavigateURL( tabId, string.Empty, "ctl=" + Utility.AdminContainer, "mid=" + moduleId.ToString(CultureInfo.InvariantCulture), "adminType=" + type.Name + "Edit", "versionId=" + i.ItemVersionId.ToString(CultureInfo.InvariantCulture), returnUrl); }
/// <summary> /// </summary> protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { IInviteRepository _repository = new InviteRepository(); _invitations = _repository.GetUserInvites(UserId, DateTime.MinValue).ToList(); DotNetNuke.Entities.Tabs.TabController tCtrl = new DotNetNuke.Entities.Tabs.TabController(); var activityTab = tCtrl.GetTabByName("Activity Feed", PortalId, -1); if (activityTab != null) { UserProfileTabId = activityTab.TabID; } var mCtrl = new DotNetNuke.Entities.Modules.ModuleController(); ModuleName = mCtrl.GetModule(base.ModuleId).DesktopModule.ModuleName; } DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxScriptSupport(); DotNetNuke.Framework.ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); } catch (Exception exc) //Module failed to load { DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Permanently removes all deleted tabs and modules /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// Parent tabs will not be deleted. To delete a parent tab all child tabs need to be deleted before. /// </remarks> /// <history> /// [VMasanas] 18/08/2004 Created /// </history> protected void OnEmptyBinClick(Object sender, EventArgs e) { var objEventLog = new EventLogController(); foreach (ListItem item in lstModules.Items) { var objModules = new ModuleController(); var values = item.Value.Split('-'); var tabId = int.Parse(values[0]); var moduleId = int.Parse(values[1]); //delete module var objModule = objModules.GetModule(moduleId, tabId, false); if (objModule != null) { //hard-delete Tab Module Instance objModules.DeleteTabModule(tabId, moduleId, false); objEventLog.AddLog(objModule, PortalSettings, UserId, "", EventLogController.EventLogType.MODULE_DELETED); } } foreach (ListItem item in lstTabs.Items) { var intTabId = int.Parse(item.Value); var objTabs = new TabController(); var objTab = objTabs.GetTab(intTabId, PortalId, false); if (objTab != null) { DeleteTab(objTab, true); } } BindData(); }
public static ModuleInfo getModuleInfo(int moduleId, int tabId) { var modController = new ModuleController(); var modInfo = modController.GetModule(moduleId, tabId); return modInfo; }
protected void Page_Load( Object sender, EventArgs e ) { try { if( Request.QueryString["moduleid"] != null ) { m_moduleId = int.Parse( Request.QueryString["moduleid"] ); } ModuleController objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModule(ModuleId, TabId, false); if( objModule != null ) { ArrayList arrFiles = Globals.GetFileList( PortalId, "xml", false ); foreach( FileItem objFile in arrFiles ) { if( objFile.Text.IndexOf( "content." + CleanName( objModule.FriendlyName ) ) != - 1 ) { cboFiles.Items.Add( objFile.Text ); } } } } catch( Exception exc ) //Module failed to load { Exceptions.ProcessModuleLoadException( this, exc ); } }
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); }
/// <summary> /// This method /// </summary> /// <param name="channelName"></param> /// <param name="userName"></param> /// <remarks></remarks> protected override void PopulateChannel(string channelName, string userName) { var objModules = new ModuleController(); ModuleInfo objModule; if (Request == null || Settings == null || Settings.ActiveTab == null || ModuleId == Null.NullInteger) { return; } Channel["title"] = Settings.PortalName; Channel["link"] = Globals.AddHTTP(Globals.GetDomainName(Request)); if (!String.IsNullOrEmpty(Settings.Description)) { Channel["description"] = Settings.Description; } else { Channel["description"] = Settings.PortalName; } Channel["language"] = Settings.DefaultLanguage; Channel["copyright"] = !string.IsNullOrEmpty(Settings.FooterText) ? Settings.FooterText.Replace("[year]", DateTime.Now.Year.ToString()) : string.Empty; Channel["webMaster"] = Settings.Email; SearchResultsInfoCollection searchResults = null; try { searchResults = SearchDataStoreProvider.Instance().GetSearchItems(Settings.PortalId, TabId, ModuleId); } catch (Exception ex) { Exceptions.Exceptions.LogException(ex); } if (searchResults != null) { foreach (SearchResultsInfo objResult in searchResults) { if (TabPermissionController.CanViewPage()) { if (Settings.ActiveTab.StartDate < DateTime.Now && Settings.ActiveTab.EndDate > DateTime.Now) { objModule = objModules.GetModule(objResult.ModuleId, objResult.TabId); if (objModule != null && objModule.DisplaySyndicate && objModule.IsDeleted == false) { if (ModulePermissionController.CanViewModule(objModule)) { if (Convert.ToDateTime(objModule.StartDate == Null.NullDate ? DateTime.MinValue : objModule.StartDate) < DateTime.Now && Convert.ToDateTime(objModule.EndDate == Null.NullDate ? DateTime.MaxValue : objModule.EndDate) > DateTime.Now) { Channel.Items.Add(GetRssItem(objResult)); } } } } } } } }
protected void buttonImport_Click (object sender, EventArgs e) { try { var mctrl = new ModuleController (); var module = mctrl.GetModule (int.Parse (comboModule.SelectedValue), TabId); var mdef = module.ModuleDefinition.DefinitionName.ToLowerInvariant (); foreach (ListItem item in listDocuments.Items) { if (item.Selected) { DocumentInfo document = null; if (mdef == "r7.documents") { document = DocumentsDataProvider.Instance.GetDocument ( int.Parse (item.Value), module.ModuleID); } else if (mdef == "documents") { document = DocumentsDataProvider.Instance.GetDNNDocument ( int.Parse (item.Value), module.ModuleID); // publish documents, imported from the DNN Documents module document.IsPublished = true; } if (document != null) { var ctrlUrl = new UrlController (); // get original document tracking data var url = ctrlUrl.GetUrlTracking (PortalId, document.Url, document.ModuleId); document.ItemId = Null.NullInteger; document.ModuleId = ModuleId; // add new document DocumentsDataProvider.Instance.Add (document); // add new url tracking data ctrlUrl.UpdateUrl (PortalId, document.Url, url.UrlType, url.LogActivity, url.TrackClicks, ModuleId, url.NewWindow); // NOTE: using url.Clicks, url.LastClick, url.CreatedDate not working } } } ModuleSynchronizer.Synchronize (ModuleId, TabModuleId); // redirect back to the module page Response.Redirect (Globals.NavigateURL (), true); } catch (Exception ex) { // module failed to load Exceptions.ProcessModuleLoadException (this, ex); } }
public static int GetPortalByModuleID(int moduleId) { var objMCtrl = new DotNetNuke.Entities.Modules.ModuleController(); var objMInfo = objMCtrl.GetModule(moduleId); if (objMInfo == null) { return(-1); } return(objMInfo.PortalID); }
/// <Summary>Page_Load runs when the control is loaded.</Summary> protected void Page_Load(object sender, EventArgs e) { string FriendlyName = ""; ModuleController objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModule( ModuleId, TabId, false ); if( objModule != null ) { FriendlyName = objModule.FriendlyName; } int ModuleControlId = Null.NullInteger; if( !( Request.QueryString["ctlid"] == null ) ) { ModuleControlId = int.Parse( Request.QueryString["ctlid"] ); } ModuleControlController objModuleControls = new ModuleControlController(); ModuleControlInfo objModuleControl = objModuleControls.GetModuleControl( ModuleControlId ); if( objModuleControl != null ) { string FileName = Path.GetFileName( objModuleControl.ControlSrc ); string localResourceFile = objModuleControl.ControlSrc.Replace( FileName, Localization.LocalResourceDirectory + "/" + FileName ); if( Localization.GetString( ModuleActionType.HelpText, localResourceFile ) != "" ) { lblHelp.Text = Localization.GetString( ModuleActionType.HelpText, localResourceFile ); } _key = objModuleControl.ControlKey; string helpUrl = Globals.GetOnLineHelp( objModuleControl.HelpURL, ModuleConfiguration ); if( !Null.IsNull( helpUrl ) ) { cmdHelp.NavigateUrl = Globals.FormatHelpUrl( helpUrl, PortalSettings, FriendlyName ); cmdHelp.Visible = true; } else { cmdHelp.Visible = false; } } if( Page.IsPostBack == false ) { if( Request.UrlReferrer != null ) { ViewState["UrlReferrer"] = Convert.ToString( Request.UrlReferrer ); } else { ViewState["UrlReferrer"] = ""; } } }
public Configuration(int ModuleId, Hashtable Settings) { _ModuleId = ModuleId; _portalSettings = PortalController.GetCurrentPortalSettings(); _TabID = _portalSettings.ActiveTab.TabID; DotNetNuke.Entities.Modules.ModuleController mc = new DotNetNuke.Entities.Modules.ModuleController(); _ModuleConfiguration = mc.GetModule(_ModuleId, _TabID); _TabModuleID = _ModuleConfiguration.TabModuleID; _Settings = Settings; LoadSettings(); }
public static string GetModuleVersion(int moduleId) { var strVersion = ""; var objMCtrl = new DotNetNuke.Entities.Modules.ModuleController(); var objMInfo = objMCtrl.GetModule(moduleId); if (objMInfo != null) { strVersion = objMInfo.DesktopModule.Version; } return(strVersion); }
protected void UpdateModuleTitle (string title) { // replace module title var mctrl = new ModuleController (); var module = mctrl.GetModule (ModuleId); if (module.ModuleTitle != title) { module.ModuleTitle = title; mctrl.UpdateModule (module); } }
protected void cmdUpdate_Click(object sender, EventArgs e) { try { var controller = new ModuleController(); var module = controller.GetModule(ModuleId); module.ModuleTitle = Title.Text; module.DesktopModule.Description = txtDescription.Text; controller.UpdateModule(module); Response.Redirect(Globals.NavigateURL(), true); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }
//public ModuleSecurity(int moduleId, int tabId, Hashtable settings) //{ // var moduleController = new ModuleController(); // var s = settings ?? moduleController.GetModuleSettings(moduleId); // Settings = new Settings(s); // return this.ModuleSecurity(moduleId, tabId, Settings); //} public ModuleSecurity(int moduleId, int tabId, Components.Settings settings) { var moduleController = new ModuleController(); Settings = settings ?? new Settings(moduleController.GetModuleSettings(moduleId)); var moduleInfo = moduleController.GetModule(moduleId, tabId); if (moduleInfo == null) return; var mp = moduleInfo.ModulePermissions; _hasEditRowPermission = ModulePermissionController.HasModulePermission(mp, PermissionName.HasEditRowPermission); _hasDeleteRowPermission = ModulePermissionController.HasModulePermission(mp, PermissionName.HasDeleteRowPermission); _hasAddRowPermission = ModulePermissionController.HasModulePermission(mp,PermissionName.HasAddRowPermission); _hasEditPrivateColumnsPermission = ModulePermissionController.HasModulePermission(mp,PermissionName.EditRestricedFieldsPermission); _hasShowAllUserDefinedColumnsPermission = ModulePermissionController.HasModulePermission(mp,PermissionName.ShowAllUserDefinedColumnsPermission); _canEditModuleContent = ModulePermissionController.CanEditModuleContent(moduleInfo); _canManageModule = ModulePermissionController.CanManageModule(moduleInfo); _hasViewListPermission = ModulePermissionController.HasModulePermission(mp, PermissionName.ShowListPermission); _isOnlyAllowedToManipulateHisOwnData = Settings.EditOnlyOwnItems; }
void cboFolders_SelectedIndexChanged(object sender, EventArgs e) { cboFiles.Items.Clear(); if (cboFolders.SelectedIndex != 0) { var objModules = new ModuleController(); var objModule = objModules.GetModule(_moduleId, TabId, false); if (objModule != null) { var arrFiles = Globals.GetFileList(PortalId, "csv", false, cboFolders.SelectedItem.Value); foreach (FileItem objFile in arrFiles) { cboFiles.Items.Add(new ListItem(objFile.Text, objFile.Text)); } } } }
protected void Page_Load( Object sender, EventArgs e ) { try { if( Request.QueryString["moduleid"] != null ) { moduleId = int.Parse( Request.QueryString["moduleid"] ); } ModuleController objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModule( ModuleId, TabId, false ); if( objModule != null ) { lblFile.Text = "content." + CleanName( objModule.FriendlyName ) + "." + CleanName( objModule.ModuleTitle ) + ".xml"; } } catch( Exception exc ) //Module failed to load { Exceptions.ProcessModuleLoadException( this, exc ); } }
void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["moduleid"] != null) { _moduleId = int.Parse(Request.QueryString["moduleid"]); } if (! Page.IsPostBack) { cboFolders.Items.Insert(0, new ListItem( string.Format("<{0}>", Localization.GetString("None_Specified")), "-")); var folders = FolderManager.Instance.GetFolders(UserInfo, "READ, WRITE"); foreach (FolderInfo folder in folders) { var folderItem = new ListItem { Text = folder.FolderPath == Null.NullString ? Localization.GetString("Root", LocalResourceFile) : folder.FolderPath, Value = folder.FolderPath }; cboFolders.Items.Add(folderItem); } var moduleController = new ModuleController(); var objModule = moduleController.GetModule(_moduleId, TabId, false); if (objModule != null) { txtFile.Text = CleanName(objModule.ModuleTitle); } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
private string getModulePath(int moduleid, int tabid, string controlKey) { string path = String.Empty; try { ModuleController mc = new ModuleController(); ModuleControlController mcc = new ModuleControlController(); ModuleInfo mi = mc.GetModule(moduleid, tabid); if (mi != null) { var mControl = ModuleControlController.GetModuleControlByControlKey(controlKey, mi.ModuleDefID); if (mControl != null) path = "~/" + mControl.ControlSrc; } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } return path; }
public JournalParser(PortalSettings portalSettings, int moduleId, int profileId, int socialGroupId, UserInfo userInfo) { PortalSettings = portalSettings; ModuleId = moduleId; ProfileId = profileId; SocialGroupId = socialGroupId; CurrentUser = userInfo; url = PortalSettings.DefaultPortalAlias; OwnerPortalId = portalSettings.PortalId; var moduleController = new ModuleController(); ModuleInfo moduleInfo = moduleController.GetModule(moduleId); if (moduleInfo.OwnerPortalID != portalSettings.PortalId) { OwnerPortalId = moduleInfo.OwnerPortalID; } if (string.IsNullOrEmpty(url)) { url = HttpContext.Current.Request.Url.Host; } url = string.Format("{0}://{1}{2}", UrlUtils.IsSecureConnectionOrSslOffload(HttpContext.Current.Request) ? "https" : "http", url, !HttpContext.Current.Request.Url.IsDefaultPort && !url.Contains(":") ? ":" + HttpContext.Current.Request.Url.Port : string.Empty); }
public string ModuleEditUrl(int moduleId) { if (IsNumeric(moduleId)) { var moduleController = new ModuleController(); var module = moduleController.GetModule(moduleId); if (module != null) { return ModuleContext.NavigateUrl(module.TabID, "", false, "ctl=Module", "ModuleId=" + moduleId); } } return "#"; }
public string UpgradeModule(string Version) { try { switch (Version) { case "01.00.00": ModuleDefinitionInfo moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Messaging"); if (moduleDefinition != null) { //Add Module to User Profile Page for all Portals var objPortalController = new PortalController(); var objTabController = new TabController(); var objModuleController = new ModuleController(); ArrayList portals = objPortalController.GetPortals(); foreach (PortalInfo portal in portals) { int tabID = TabController.GetTabByTabPath(portal.PortalID, "//UserProfile", Null.NullString); if ((tabID != Null.NullInteger)) { TabInfo tab = objTabController.GetTab(tabID, portal.PortalID, true); if ((tab != null)) { int moduleId = Upgrade.AddModuleToPage(tab, moduleDefinition.ModuleDefID, "My Inbox", "", true); ModuleInfo objModule = objModuleController.GetModule(moduleId, tabID, false); var settings = new PortalSettings(portal); var modulePermission = (from ModulePermissionInfo p in objModule.ModulePermissions where p.ModuleID == moduleId && p.RoleID == settings.RegisteredRoleId && p.UserID == Null.NullInteger && p.PermissionKey == "EDIT" select p).SingleOrDefault(); if (modulePermission == null) { ArrayList permissions = new PermissionController().GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "EDIT"); PermissionInfo permission = null; if (permissions.Count == 1) { permission = permissions[0] as PermissionInfo; } if (permission != null) { modulePermission = new ModulePermissionInfo(permission) { ModuleID = moduleId, RoleID = settings.RegisteredRoleId, UserID = Null.NullInteger, AllowAccess = true }; objModule.ModulePermissions.Add(modulePermission); ModulePermissionController.SaveModulePermissions(objModule); } } } } } } break; } return "Success"; } catch (Exception exc) { Logger.Error(exc); return "Failed"; } }
/// <summary> /// SaveTabData saves the Tab to the Database /// </summary> /// <remarks> /// </remarks> /// <param name = "strAction">The action to perform "edit" or "add"</param> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// [jlucarino] 2/26/2009 Added CreatedByUserID and LastModifiedByUserID /// </history> private int SaveTabData(string strAction) { string strIcon = ctlIcon.Url; string strIconLarge = ctlIconLarge.Url; var objTabs = new TabController(); Tab.TabName = txtTabName.Text; Tab.Title = txtTitle.Text; Tab.Description = txtDescription.Text; Tab.KeyWords = txtKeyWords.Text; Tab.IsVisible = chkMenu.Checked; Tab.DisableLink = chkDisableLink.Checked; TabInfo parentTab = null; if (cboParentTab.SelectedItem != null) { var parentTabId = cboParentTab.SelectedItemValueAsInt; var controller = new TabController(); parentTab = controller.GetTab(parentTabId, -1, false); } if (parentTab != null) { Tab.PortalID = parentTab.PortalID; Tab.ParentId = parentTab.TabID; } else { Tab.ParentId = Null.NullInteger; } Tab.IconFile = strIcon; Tab.IconFileLarge = strIconLarge; Tab.IsDeleted = false; Tab.Url = ctlURL.Url; Tab.TabPermissions.Clear(); if (Tab.PortalID != Null.NullInteger) { Tab.TabPermissions.AddRange(dgPermissions.Permissions); } Tab.Terms.Clear(); Tab.Terms.AddRange(termsSelector.Terms); Tab.SkinSrc = pageSkinCombo.SelectedValue; Tab.ContainerSrc = pageContainerCombo.SelectedValue; Tab.TabPath = Globals.GenerateTabPath(Tab.ParentId, Tab.TabName); //Check for invalid string invalidType; if (!TabController.IsValidTabName(Tab.TabName, out invalidType)) { ShowWarningMessage(string.Format(Localization.GetString(invalidType, LocalResourceFile), Tab.TabName)); return Null.NullInteger; } //Validate Tab Path if (!IsValidTabPath(Tab, Tab.TabPath)) { return Null.NullInteger; } //Set Culture Code var positionTabId = Null.NullInteger; if (cboPositionTab.SelectedItem != null) { positionTabId = Int32.Parse(cboPositionTab.SelectedItem.Value); } if (strAction != "edit") { if (PortalSettings.ContentLocalizationEnabled) { switch (cultureTypeList.SelectedValue) { case "Localized": var defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalId); Tab.CultureCode = defaultLocale.Code; break; case "Culture": Tab.CultureCode = PortalSettings.CultureCode; break; default: Tab.CultureCode = Null.NullString; break; } var tabLocale = LocaleController.Instance.GetLocale(Tab.CultureCode) ?? LocaleController.Instance.GetDefaultLocale(PortalId); //Fix parent if (Tab.ParentId > Null.NullInteger) { parentTab = objTabs.GetTab(Tab.ParentId, PortalId, false); if (parentTab.CultureCode != Tab.CultureCode) { parentTab = objTabs.GetTabByCulture(Tab.ParentId, PortalId, tabLocale); } if (parentTab != null) { Tab.ParentId = parentTab.TabID; } } //Fix position TabId if (positionTabId > Null.NullInteger) { var positionTab = objTabs.GetTab(positionTabId, PortalId, false); if (positionTab.CultureCode != Tab.CultureCode) { positionTab = objTabs.GetTabByCulture(positionTabId, PortalId, tabLocale); } if (positionTab != null) { positionTabId = positionTab.TabID; } } } else { Tab.CultureCode = Null.NullString; } } //Validate Tab Path if (string.IsNullOrEmpty(strAction)) { var tabID = TabController.GetTabByTabPath(Tab.PortalID, Tab.TabPath, Tab.CultureCode); if (tabID != Null.NullInteger) { var existingTab = objTabs.GetTab(tabID, PortalId, false); if (existingTab != null && existingTab.IsDeleted) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabRecycled", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } return Null.NullInteger; } } Tab.StartDate = datepickerStartDate.SelectedDate != null ? datepickerStartDate.SelectedDate.Value : Null.NullDate; Tab.EndDate = datepickerEndDate.SelectedDate != null ? datepickerEndDate.SelectedDate.Value : Null.NullDate; if (Tab.StartDate > Null.NullDate && Tab.EndDate > Null.NullDate && Tab.StartDate.AddDays(1) >= Tab.EndDate) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidTabDates", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return Null.NullInteger; } if (!valRefreshInterval.IsValid) { return Null.NullInteger; } Tab.RefreshInterval = txtRefreshInterval.Text == "" ? Null.NullInteger : Convert.ToInt32(txtRefreshInterval.Text); if (!valPriorityRequired.IsValid || !valPriority.IsValid) { return Null.NullInteger; } Tab.SiteMapPriority = float.Parse(txtPriority.Text); Tab.PageHeadText = txtPageHeadText.Text; Tab.IsSecure = chkSecure.Checked; Tab.PermanentRedirect = chkPermanentRedirect.Checked; UpdateTabSettings(Tab); if (strAction == "edit") { // trap circular tab reference if (cboParentTab.SelectedItem != null && Tab.TabID != cboParentTab.SelectedItemValueAsInt && !IsCircularReference(cboParentTab.SelectedItemValueAsInt, Tab.PortalID)) { objTabs.UpdateTab(Tab); if (IsHostMenu && Tab.PortalID != Null.NullInteger) { //Host Tab moved to Portal so clear Host cache objTabs.ClearCache(Null.NullInteger); } if (!IsHostMenu && Tab.PortalID == Null.NullInteger) { //Portal Tab moved to Host so clear portal cache objTabs.ClearCache(PortalId); } } } else { if (positionTabId == Null.NullInteger) { Tab.TabID = objTabs.AddTab(Tab); } else { if (rbInsertPosition.SelectedValue == "After" && positionTabId > Null.NullInteger) { Tab.TabID = objTabs.AddTabAfter(Tab, positionTabId); } else if (rbInsertPosition.SelectedValue == "Before" && positionTabId > Null.NullInteger) { Tab.TabID = objTabs.AddTabBefore(Tab, positionTabId); } else { Tab.TabID = objTabs.AddTab(Tab); } } //Create Localized versions if (PortalSettings.ContentLocalizationEnabled && cultureTypeList.SelectedValue == "Localized") { objTabs.CreateLocalizedCopies(Tab); //Refresh tab _tab = objTabs.GetTab(Tab.TabID, Tab.PortalID, true); } var copyTabId = cboCopyPage.Visible && cboCopyPage.SelectedItem != null ? cboCopyPage.SelectedItemValueAsInt : Null.NullInteger; if (copyTabId != Null.NullInteger) { var objModules = new ModuleController(); ModuleInfo objModule; CheckBox chkModule; RadioButton optCopy; RadioButton optReference; TextBox txtCopyTitle; foreach (DataGridItem objDataGridItem in grdModules.Items) { chkModule = (CheckBox)objDataGridItem.FindControl("chkModule"); if (chkModule.Checked) { var intModuleID = Convert.ToInt32(grdModules.DataKeys[objDataGridItem.ItemIndex]); optCopy = (RadioButton)objDataGridItem.FindControl("optCopy"); optReference = (RadioButton)objDataGridItem.FindControl("optReference"); txtCopyTitle = (TextBox)objDataGridItem.FindControl("txtCopyTitle"); objModule = objModules.GetModule(intModuleID, copyTabId, false); ModuleInfo newModule = null; if ((objModule != null)) { //Clone module as it exists in the cache and changes we make will update the cached object newModule = objModule.Clone(); newModule.TabID = Tab.TabID; newModule.DefaultLanguageGuid = Null.NullGuid; newModule.CultureCode = Tab.CultureCode; newModule.ModuleTitle = txtCopyTitle.Text; if (!optReference.Checked) { newModule.ModuleID = Null.NullInteger; objModules.InitialModulePermission(newModule, newModule.TabID, 0); } newModule.ModuleID = objModules.AddModule(newModule); if (optCopy.Checked) { if (!string.IsNullOrEmpty(newModule.DesktopModule.BusinessControllerClass)) { var objObject = Reflection.CreateObject(newModule.DesktopModule.BusinessControllerClass, newModule.DesktopModule.BusinessControllerClass); if (objObject is IPortable) { var content = Convert.ToString(((IPortable)objObject).ExportModule(intModuleID)); if (!string.IsNullOrEmpty(content)) { ((IPortable)objObject).ImportModule(newModule.ModuleID, content, newModule.DesktopModule.Version, UserInfo.UserID); } } } } } if (optReference.Checked) { //Make reference copies on secondary language foreach (var m in objModule.LocalizedModules.Values) { var newLocalizedModule = m.Clone(); var localizedTab = Tab.LocalizedTabs[m.CultureCode]; newLocalizedModule.TabID = localizedTab.TabID; newLocalizedModule.CultureCode = localizedTab.CultureCode; newLocalizedModule.ModuleTitle = txtCopyTitle.Text; newLocalizedModule.DefaultLanguageGuid = newModule.UniqueId; newLocalizedModule.ModuleID = objModules.AddModule(newLocalizedModule); } } } } } else { // create the page from a template if (cboTemplate.SelectedItem != null && cboTemplate.SelectedItem.Value != Null.NullInteger.ToString()) { var xmlDoc = new XmlDocument(); try { // open the XML file var folder = FolderManager.Instance.GetFolder(cboFolders.SelectedItemValueAsInt); if (folder != null) xmlDoc.Load(PortalSettings.HomeDirectoryMapPath + folder.FolderPath + cboTemplate.SelectedValue); } catch (Exception ex) { Exceptions.LogException(ex); Skin.AddModuleMessage(this, Localization.GetString("BadTemplate", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return Null.NullInteger; } TabController.DeserializePanes(xmlDoc.SelectSingleNode("//portal/tabs/tab/panes"), Tab.PortalID, Tab.TabID, PortalTemplateModuleAction.Ignore, new Hashtable()); //save tab permissions RibbonBarManager.DeserializeTabPermissions(xmlDoc.SelectNodes("//portal/tabs/tab/tabpermissions/permission"), Tab); var tabIndex = 0; var exceptions = string.Empty; foreach (XmlNode tabNode in xmlDoc.SelectSingleNode("//portal/tabs").ChildNodes) { //Create second tab onward tabs. Note first tab is already created above. if (tabIndex > 0) { try { TabController.DeserializeTab(tabNode, null, PortalId, PortalTemplateModuleAction.Replace); } catch (Exception ex) { Exceptions.LogException(ex); exceptions += string.Format("Template Tab # {0}. Error {1}<br/>", tabIndex + 1, ex.Message); } } else { if (string.IsNullOrEmpty(Tab.SkinSrc) && !String.IsNullOrEmpty(XmlUtils.GetNodeValue(tabNode, "skinsrc", ""))) { Tab.SkinSrc = XmlUtils.GetNodeValue(tabNode, "skinsrc", ""); } if (string.IsNullOrEmpty(Tab.ContainerSrc) && !String.IsNullOrEmpty(XmlUtils.GetNodeValue(tabNode, "containersrc", ""))) { Tab.ContainerSrc = XmlUtils.GetNodeValue(tabNode, "containersrc", ""); } objTabs.UpdateTab(Tab); } tabIndex++; } if (!string.IsNullOrEmpty(exceptions)) { Skin.AddModuleMessage(this, exceptions, ModuleMessage.ModuleMessageType.RedError); return Null.NullInteger; } } } } // url tracking var objUrls = new UrlController(); objUrls.UpdateUrl(PortalId, ctlURL.Url, ctlURL.UrlType, 0, Null.NullDate, Null.NullDate, ctlURL.Log, ctlURL.Track, Null.NullInteger, ctlURL.NewWindow); //Clear the Tab's Cached modules DataCache.ClearModuleCache(TabId); //Update Cached Tabs as TabPath may be needed before cache is cleared TabInfo tempTab; if (new TabController().GetTabsByPortal(PortalId).TryGetValue(Tab.TabID, out tempTab)) { tempTab.TabPath = Tab.TabPath; } //Update Custom Url if (!Tab.IsSuperTab) { var tabUrl = Tab.TabUrls.SingleOrDefault(t => t.IsSystem && t.HttpStatus == "200" && t.SeqNum == 0); var url = urlTextBox.Text; if (!String.IsNullOrEmpty(url)) { if (!url.StartsWith("/")) { url = "/" + url; } string currentUrl = String.Empty; var friendlyUrlSettings = new FriendlyUrlSettings(PortalId); if (Tab.TabID > -1 && !Tab.IsSuperTab) { var baseUrl = Globals.AddHTTP(PortalAlias.HTTPAlias) + "/Default.aspx?TabId=" + Tab.TabID; var path = AdvancedFriendlyUrlProvider.ImprovedFriendlyUrl(Tab, baseUrl, Globals.glbDefaultPage, PortalAlias.HTTPAlias, false, //dnndev-27493 :we want any custom Urls that apply friendlyUrlSettings, Guid.Empty); currentUrl = path.Replace(Globals.AddHTTP(PortalAlias.HTTPAlias), ""); } if (url != currentUrl) { if (tabUrl == null) { tabUrl = new TabUrlInfo() { TabId = Tab.TabID, SeqNum = 0, PortalAliasId = -1, PortalAliasUsage = PortalAliasUsageType.Default, QueryString = String.Empty, Url = url, HttpStatus = "200", IsSystem = true }; } else { tabUrl.Url = url; } //Delete any redirects to the same url foreach (var redirecturl in TestableTabController.Instance.GetTabUrls(Tab.TabID, Tab.PortalID)) { if (redirecturl.Url == url && redirecturl.HttpStatus != "200") { TestableTabController.Instance.DeleteTabUrl(redirecturl, Tab.PortalID, false); } } //Save url TestableTabController.Instance.SaveTabUrl(tabUrl, PortalId, true); } } else { if (tabUrl != null) { TestableTabController.Instance.DeleteTabUrl(tabUrl, PortalId, true); } } } return Tab.TabID; }
/// ----------------------------------------------------------------------------- /// <summary> /// CreateUserNotifications creates HtmlTextUser records and optionally sends email notifications to participants in a Workflow /// </summary> /// <remarks> /// </remarks> /// <param name="objHtmlText">An HtmlTextInfo object</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- private void CreateUserNotifications(HtmlTextInfo objHtmlText) { var _htmlTextUserController = new HtmlTextUserController(); HtmlTextUserInfo _htmlTextUser = null; UserInfo _user = null; // clean up old user notification records _htmlTextUserController.DeleteHtmlTextUsers(); // ensure we have latest htmltext object loaded objHtmlText = GetHtmlText(objHtmlText.ModuleID, objHtmlText.ItemID); // build collection of users to notify var objWorkflow = new WorkflowStateController(); var arrUsers = new ArrayList(); // if not published if (objHtmlText.IsPublished == false) { arrUsers.Add(objHtmlText.CreatedByUserID); // include content owner } // if not draft and not published if (objHtmlText.StateID != objWorkflow.GetFirstWorkflowStateID(objHtmlText.WorkflowID) && objHtmlText.IsPublished == false) { // get users from permissions for state var objRoles = new RoleController(); foreach (WorkflowStatePermissionInfo permission in WorkflowStatePermissionController.GetWorkflowStatePermissions(objHtmlText.StateID)) { if (permission.AllowAccess) { if (Null.IsNull(permission.UserID)) { int roleId = permission.RoleID; RoleInfo objRole = TestableRoleController.Instance.GetRole(objHtmlText.PortalID, r => r.RoleID == roleId); if ((objRole != null)) { foreach (UserRoleInfo objUserRole in objRoles.GetUserRoles(objHtmlText.PortalID, null, objRole.RoleName)) { if (!arrUsers.Contains(objUserRole.UserID)) { arrUsers.Add(objUserRole.UserID); } } } } else { if (!arrUsers.Contains(permission.UserID)) { arrUsers.Add(permission.UserID); } } } } } // process notifications if (arrUsers.Count > 0 || (objHtmlText.IsPublished && objHtmlText.Notify)) { // get tabid from module var objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModule(objHtmlText.ModuleID); PortalSettings objPortalSettings = PortalController.GetCurrentPortalSettings(); if (objPortalSettings != null) { string strResourceFile = string.Format("{0}/DesktopModules/{1}/{2}/{3}", Globals.ApplicationPath, objModule.DesktopModule.FolderName, Localization.LocalResourceDirectory, Localization.LocalSharedResourceFile); string strSubject = Localization.GetString("NotificationSubject", strResourceFile); string strBody = Localization.GetString("NotificationBody", strResourceFile); strBody = strBody.Replace("[URL]", Globals.NavigateURL(objModule.TabID)); strBody = strBody.Replace("[STATE]", objHtmlText.StateName); // process user notification collection foreach (int intUserID in arrUsers) { // create user notification record _htmlTextUser = new HtmlTextUserInfo(); _htmlTextUser.ItemID = objHtmlText.ItemID; _htmlTextUser.StateID = objHtmlText.StateID; _htmlTextUser.ModuleID = objHtmlText.ModuleID; _htmlTextUser.TabID = objModule.TabID; _htmlTextUser.UserID = intUserID; _htmlTextUserController.AddHtmlTextUser(_htmlTextUser); // send an email notification to a user if the state indicates to do so if (objHtmlText.Notify) { _user = UserController.GetUserById(objHtmlText.PortalID, intUserID); if (_user != null) { AddHtmlNotification(strSubject, strBody, _user); } } } // if published and the published state specifies to notify members of the workflow if (objHtmlText.IsPublished && objHtmlText.Notify) { // send email notification to the author _user = UserController.GetUserById(objHtmlText.PortalID, objHtmlText.CreatedByUserID); if (_user != null) { try { Services.Mail.Mail.SendEmail(objPortalSettings.Email, objPortalSettings.Email, strSubject, strBody); } catch (Exception exc) { Exceptions.LogException(exc); } } } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// ImportModule implements the IPortable ImportModule Interface /// </summary> /// <remarks> /// </remarks> /// <param name = "ModuleID">The ID of the Module being imported</param> /// <param name = "Content">The Content being imported</param> /// <param name = "Version">The Version of the Module Content being imported</param> /// <param name = "UserId">The UserID of the User importing the Content</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public void ImportModule(int ModuleID, string Content, string Version, int UserId) { var moduleController = new ModuleController(); ModuleInfo module = moduleController.GetModule(ModuleID); var workflowStateController = new WorkflowStateController(); int workflowID = GetWorkflow(ModuleID, module.TabID, module.PortalID).Value; XmlNode xml = Globals.GetContent(Content, "htmltext"); var htmlContent = new HtmlTextInfo(); htmlContent.ModuleID = ModuleID; // convert Version to System.Version var objVersion = new Version(Version); if (objVersion >= new Version(5, 1, 0)) { // current module content htmlContent.Content = DeTokeniseLinks(xml.SelectSingleNode("content").InnerText, module.PortalID); } else { // legacy module content htmlContent.Content = DeTokeniseLinks(xml.SelectSingleNode("desktophtml").InnerText, module.PortalID); } htmlContent.WorkflowID = workflowID; htmlContent.StateID = workflowStateController.GetFirstWorkflowStateID(workflowID); // import UpdateHtmlText(htmlContent, GetMaximumVersionHistory(module.PortalID)); }
public void MarkTranslatedSelectedItems(bool translated) { var moduleCtrl = new ModuleController(); foreach (GridDataItem row in localizedModulesGrid.SelectedItems) { var localizedModuleId = (int)row.OwnerTableView.DataKeyValues[row.ItemIndex]["ModuleId"]; var localizedTabId = (int)row.OwnerTableView.DataKeyValues[row.ItemIndex]["TabId"]; ModuleInfo sourceModule = moduleCtrl.GetModule(localizedModuleId, localizedTabId, false); if (sourceModule.IsLocalized) { moduleCtrl.UpdateTranslationStatus(sourceModule, translated); } } moduleCtrl.ClearCache(TabId); //Rebind localized Modules DataBind(); //Raise Changed event OnModuleLocalizationChanged(EventArgs.Empty); }
/// ----------------------------------------------------------------------------- /// <summary> /// StoreSearchItems adds the Search Item to the Data Store /// </summary> /// <remarks> /// </remarks> /// <param name="searchItems">A Collection of SearchItems</param> /// <history> /// [cnurse] 11/15/2004 documented /// [vnguyen] 09/07/2010 Modified: Added a date comparison for LastModifiedDate on the Tab /// [vnguyen] 16/04/2013 Modified: Now uses Lucene indexing /// [galatrash] 23/05/2013 Modified: moved indexing methods into the internal namespace. /// </history> /// ----------------------------------------------------------------------------- public override void StoreSearchItems(SearchItemInfoCollection searchItems) { var moduleController = new ModuleController(); var indexer = new ModuleIndexer(); var modulesDic = new Dictionary<int, string>(); foreach (SearchItemInfo item in searchItems) { if (!modulesDic.ContainsKey(item.ModuleId)) { var module = moduleController.GetModule(item.ModuleId); modulesDic.Add(item.ModuleId, module.CultureCode); //Remove all indexed items for this module InternalSearchController.Instance.DeleteSearchDocumentsByModule(module.PortalID, module.ModuleID, module.ModuleDefID); } } //Process the SearchItems by Module to reduce Database hits foreach (var kvp in modulesDic) { //Get the Module's SearchItems var moduleSearchItems = searchItems.ModuleItems(kvp.Key); //Convert SearchItemInfo objects to SearchDocument objects var searchDocuments = (from SearchItemInfo item in moduleSearchItems select indexer.ConvertSearchItemInfoToSearchDocument(item)).ToList(); //Index InternalSearchController.Instance.AddSearchDocuments(searchDocuments); } }
public void Initialize(int PortalId) { _PortalID = PortalId; _TabID = -1; _ModuleID = -1; _ModuleDefID = -1; _ModuleOrder = -1; _PaneName = ""; _ModuleTitle = ""; _AuthorizedEditRoles = ""; _CacheTime = -1; _AuthorizedViewRoles = ""; _Alignment = ""; _Color = ""; _Border = ""; _IconFile = ""; _AllTabs = false; _Visibility = VisibilityState.Maximized; _IsDeleted = false; _Header = ""; _Footer = ""; _StartDate = Null.NullDate; _EndDate = Null.NullDate; _DisplayTitle = true; _DisplayPrint = true; _DisplaySyndicate = false; _InheritViewPermissions = false; _ContainerSrc = ""; _DesktopModuleID = -1; _FriendlyName = ""; _Description = ""; _Version = ""; _IsPremium = false; _IsAdmin = false; _SupportedFeatures = 0; _BusinessControllerClass = ""; _ModuleControlId = -1; _ControlSrc = ""; _ControlType = SecurityAccessLevel.Anonymous; _ControlTitle = ""; _HelpUrl = ""; _ContainerPath = ""; _PaneModuleIndex = 0; _PaneModuleCount = 0; _IsDefaultModule = false; _AllModules = false; // get default module settings Hashtable settings = PortalSettings.GetSiteSettings(PortalId); if (Convert.ToString(settings["defaultmoduleid"]) != "" && Convert.ToString(settings["defaulttabid"]) != "") { ModuleController objModules = new ModuleController(); ModuleInfo objModule = objModules.GetModule(int.Parse(Convert.ToString(settings["defaultmoduleid"])), int.Parse(Convert.ToString(settings["defaulttabid"])), true); if (objModule != null) { _CacheTime = objModule.CacheTime; _Alignment = objModule.Alignment; _Color = objModule.Color; _Border = objModule.Border; _IconFile = objModule.IconFile; _Visibility = objModule.Visibility; _ContainerSrc = objModule.ContainerSrc; _DisplayTitle = objModule.DisplayTitle; _DisplayPrint = objModule.DisplayPrint; _DisplaySyndicate = objModule.DisplaySyndicate; } } }
/// ----------------------------------------------------------------------------- /// <summary> /// Converts a SearchItemInfo into a SearchDocument. /// /// SearchItemInfo object was used in the old version of search. /// </summary> /// <param name="searchItem"></param> /// <returns></returns> /// <history> /// [vnguyen] 05/16/2013 created /// </history> /// ----------------------------------------------------------------------------- #pragma warning disable 0618 public SearchDocument ConvertSearchItemInfoToSearchDocument(SearchItemInfo searchItem) { var moduleController = new ModuleController(); var module = moduleController.GetModule(searchItem.ModuleId); var searchDoc = new SearchDocument { // Assigns as a Search key the SearchItems' GUID, if not it creates a dummy guid. UniqueKey = (searchItem.SearchKey.Trim() != string.Empty) ? searchItem.SearchKey : Guid.NewGuid().ToString(), QueryString = searchItem.GUID, Title = searchItem.Title, Body = searchItem.Content, Description = searchItem.Description, ModifiedTimeUtc = searchItem.PubDate, AuthorUserId = searchItem.Author, TabId = searchItem.TabId, PortalId = module.PortalID, SearchTypeId = ModuleSearchTypeId, CultureCode = module.CultureCode, //Add Module MetaData ModuleDefId = module.ModuleDefID, ModuleId = module.ModuleID }; return searchDoc; }
public void LocalizeSelectedItems(bool localize) { var moduleCtrl = new ModuleController(); foreach (GridDataItem row in localizedModulesGrid.SelectedItems) { var localizedModuleId = (int)row.OwnerTableView.DataKeyValues[row.ItemIndex]["ModuleId"]; var localizedTabId = (int)row.OwnerTableView.DataKeyValues[row.ItemIndex]["TabId"]; ModuleInfo sourceModule = moduleCtrl.GetModule(localizedModuleId, localizedTabId, false); if (sourceModule != null) { if (sourceModule.DefaultLanguageModule != null) { if (localize) { //Localize moduleCtrl.LocalizeModule(sourceModule, LocaleController.Instance.GetLocale(sourceModule.CultureCode)); } else { //Delocalize moduleCtrl.DeLocalizeModule(sourceModule); //Mark module as Not Translated moduleCtrl.UpdateTranslationStatus(sourceModule, false); } } } } moduleCtrl.ClearCache(TabId); //Rebind localized Modules DataBind(); //Raise Changed event OnModuleLocalizationChanged(EventArgs.Empty); }
protected void lblTitle_UpdateLabel( object source, DNNLabelEditEventArgs e ) { if( CanEditModule() ) { ModuleController objModule = new ModuleController(); PortalModuleBase objPortalModule = Container.GetPortalModuleBase( this ); ModuleInfo objModInfo = objModule.GetModule(objPortalModule.ModuleId, objPortalModule.TabId, false); objModInfo.ModuleTitle = e.Text; objModule.UpdateModule( objModInfo ); } }
private List<ModuleInfo> LoadTabModules() { var moduleCtl = new ModuleController(); var moduleList = new List<ModuleInfo>(); //Check if we have module scope if (ModuleId > Null.NullInteger) { ModuleInfo sourceModule = moduleCtl.GetModule(ModuleId, TabId); if (sourceModule.LocalizedModules != null) { foreach (ModuleInfo localizedModule in sourceModule.LocalizedModules.Values) { moduleList.Add(localizedModule); } } } else { foreach (ModuleInfo m in moduleCtl.GetTabModules(TabId).Values) { if (!m.IsDeleted) { moduleList.Add(m); if (m.LocalizedModules != null) { foreach (ModuleInfo localizedModule in m.LocalizedModules.Values) { moduleList.Add(localizedModule); } } } } } return moduleList; }
/// ----------------------------------------------------------------------------- /// <summary> /// ExportModule implements the IPortable ExportModule Interface /// </summary> /// <remarks> /// </remarks> /// <param name = "moduleId">The Id of the module to be exported</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public string ExportModule(int moduleId) { string xml = ""; var moduleController = new ModuleController(); ModuleInfo module = moduleController.GetModule(moduleId); int workflowID = GetWorkflow(moduleId, module.TabID, module.PortalID).Value; HtmlTextInfo content = GetTopHtmlText(moduleId, true, workflowID); if ((content != null)) { xml += "<htmltext>"; xml += "<content>" + XmlUtils.XMLEncode(TokeniseLinks(content.Content, module.PortalID)) + "</content>"; xml += "</htmltext>"; } return xml; }