public void Start(PortalInfo portalInfo) { var cache = DataCache.GetCache("InspectorIT.FileMonitor." + portalInfo.PortalID); if (cache == null) { FileSystemWatcher fileWatcher = new FileSystemWatcher(); fileWatcher.Path = portalInfo.HomeDirectoryMapPath; fileWatcher.IncludeSubdirectories = true; fileWatcher.EnableRaisingEvents = true; fileWatcher.NotifyFilter = NotifyFilters.FileName; fileWatcher.Created += (s, e) => onFileChanged(s, e, portalInfo); fileWatcher.Deleted += (s, e) => onFileDeleted(s, e, portalInfo); fileWatcher.Renamed += (s, e) => onFileRenamed(s, e, portalInfo); FileSystemWatcher folderWatcher = new FileSystemWatcher(); folderWatcher.Path = portalInfo.HomeDirectoryMapPath; folderWatcher.IncludeSubdirectories = true; folderWatcher.EnableRaisingEvents = true; folderWatcher.NotifyFilter = NotifyFilters.DirectoryName; folderWatcher.Created += (s, e) => onFolderChanged(s, e, portalInfo); folderWatcher.Deleted += (s, e) => onFolderDeleted(s, e, portalInfo); folderWatcher.Renamed += (s, e) => onFolderRenamed(s, e, portalInfo); DataCache.SetCache("InspectorIT.FileMonitor." + portalInfo.PortalID, true); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Serializes all Files /// </summary> /// <param name="objportal">Portal to serialize</param> /// <param name="folderPath">The folder containing the files</param> /// <remarks> /// The serialization uses the xml attributes defined in FileInfo class. /// </remarks> /// <history> /// [cnurse] 11/08/2004 Created /// [cnurse] 05/20/2004 Extracted adding of file to zip to new FileSystemUtils method /// </history> /// ----------------------------------------------------------------------------- private void SerializeFiles(XmlWriter writer, PortalInfo objportal, string folderPath, ref ZipOutputStream zipFile) { var folderManager = FolderManager.Instance; var objFolder = folderManager.GetFolder(objportal.PortalID, folderPath); writer.WriteStartElement("files"); foreach (FileInfo objFile in folderManager.GetFiles(objFolder)) { //verify that the file exists on the file system var filePath = objportal.HomeDirectoryMapPath + folderPath + objFile.FileName; if (File.Exists(filePath)) { writer.WriteStartElement("file"); writer.WriteElementString("contenttype", objFile.ContentType); writer.WriteElementString("extension", objFile.Extension); writer.WriteElementString("filename", objFile.FileName); writer.WriteElementString("height", objFile.Height.ToString()); writer.WriteElementString("size", objFile.Size.ToString()); writer.WriteElementString("width", objFile.Width.ToString()); writer.WriteEndElement(); FileSystemUtils.AddToZip(ref zipFile, filePath, objFile.FileName, folderPath); } } writer.WriteEndElement(); }
private static PortalInfo FillPortalInfo( IDataReader dr, bool CheckForOpenDataReader ) { PortalInfo objPortalInfo = null; // read datareader bool canContinue = true; if( CheckForOpenDataReader ) { canContinue = false; if( dr.Read() ) { canContinue = true; } } if( canContinue ) { objPortalInfo = new PortalInfo(); objPortalInfo.PortalID = Convert.ToInt32( Null.SetNull( dr["PortalID"], objPortalInfo.PortalID ) ); objPortalInfo.PortalName = Convert.ToString( Null.SetNull( dr["PortalName"], objPortalInfo.PortalName ) ); objPortalInfo.LogoFile = Convert.ToString( Null.SetNull( dr["LogoFile"], objPortalInfo.LogoFile ) ); objPortalInfo.FooterText = Convert.ToString( Null.SetNull( dr["FooterText"], objPortalInfo.FooterText ) ); objPortalInfo.ExpiryDate = Convert.ToDateTime( Null.SetNull( dr["ExpiryDate"], objPortalInfo.ExpiryDate ) ); objPortalInfo.UserRegistration = Convert.ToInt32( Null.SetNull( dr["UserRegistration"], objPortalInfo.UserRegistration ) ); objPortalInfo.BannerAdvertising = Convert.ToInt32( Null.SetNull( dr["BannerAdvertising"], objPortalInfo.BannerAdvertising ) ); objPortalInfo.AdministratorId = Convert.ToInt32( Null.SetNull( dr["AdministratorID"], objPortalInfo.AdministratorId ) ); objPortalInfo.Email = Convert.ToString( Null.SetNull( dr["Email"], objPortalInfo.Email ) ); objPortalInfo.Currency = Convert.ToString( Null.SetNull( dr["Currency"], objPortalInfo.Currency ) ); objPortalInfo.HostFee = Convert.ToInt32( Null.SetNull( dr["HostFee"], objPortalInfo.HostFee ) ); objPortalInfo.HostSpace = Convert.ToInt32( Null.SetNull( dr["HostSpace"], objPortalInfo.HostSpace ) ); objPortalInfo.PageQuota = Convert.ToInt32( Null.SetNull( dr["PageQuota"], objPortalInfo.PageQuota ) ); objPortalInfo.UserQuota = Convert.ToInt32( Null.SetNull( dr["UserQuota"], objPortalInfo.UserQuota ) ); objPortalInfo.AdministratorRoleId = Convert.ToInt32( Null.SetNull( dr["AdministratorRoleID"], objPortalInfo.AdministratorRoleId ) ); objPortalInfo.RegisteredRoleId = Convert.ToInt32( Null.SetNull( dr["RegisteredRoleID"], objPortalInfo.RegisteredRoleId ) ); objPortalInfo.Description = Convert.ToString( Null.SetNull( dr["Description"], objPortalInfo.Description ) ); objPortalInfo.KeyWords = Convert.ToString( Null.SetNull( dr["KeyWords"], objPortalInfo.KeyWords ) ); objPortalInfo.BackgroundFile = Convert.ToString( Null.SetNull( dr["BackGroundFile"], objPortalInfo.BackgroundFile ) ); objPortalInfo.GUID = new Guid( Convert.ToString( Null.SetNull( dr["GUID"], objPortalInfo.GUID ) ) ); objPortalInfo.PaymentProcessor = Convert.ToString( Null.SetNull( dr["PaymentProcessor"], objPortalInfo.PaymentProcessor ) ); objPortalInfo.ProcessorUserId = Convert.ToString( Null.SetNull( dr["ProcessorUserId"], objPortalInfo.ProcessorUserId ) ); objPortalInfo.ProcessorPassword = Convert.ToString( Null.SetNull( dr["ProcessorPassword"], objPortalInfo.ProcessorPassword ) ); objPortalInfo.SiteLogHistory = Convert.ToInt32( Null.SetNull( dr["SiteLogHistory"], objPortalInfo.SiteLogHistory ) ); objPortalInfo.SplashTabId = Convert.ToInt32( Null.SetNull( dr["SplashTabID"], objPortalInfo.SplashTabId ) ); objPortalInfo.HomeTabId = Convert.ToInt32( Null.SetNull( dr["HomeTabID"], objPortalInfo.HomeTabId ) ); objPortalInfo.LoginTabId = Convert.ToInt32( Null.SetNull( dr["LoginTabID"], objPortalInfo.LoginTabId ) ); objPortalInfo.UserTabId = Convert.ToInt32( Null.SetNull( dr["UserTabID"], objPortalInfo.UserTabId ) ); objPortalInfo.DefaultLanguage = Convert.ToString( Null.SetNull( dr["DefaultLanguage"], objPortalInfo.DefaultLanguage ) ); objPortalInfo.TimeZoneOffset = Convert.ToInt32( Null.SetNull( dr["TimeZoneOffset"], objPortalInfo.TimeZoneOffset ) ); objPortalInfo.AdminTabId = Convert.ToInt32( Null.SetNull( dr["AdminTabID"], objPortalInfo.AdminTabId ) ); objPortalInfo.HomeDirectory = Convert.ToString( Null.SetNull( dr["HomeDirectory"], objPortalInfo.HomeDirectory ) ); objPortalInfo.SuperTabId = Convert.ToInt32( Null.SetNull( dr["SuperTabId"], objPortalInfo.SuperTabId ) ); objPortalInfo.AdministratorRoleName = Convert.ToString( Null.SetNull( dr["AdministratorRoleName"], objPortalInfo.AdministratorRoleName ) ); objPortalInfo.RegisteredRoleName = Convert.ToString( Null.SetNull( dr["RegisteredRoleName"], objPortalInfo.RegisteredRoleName ) ); objPortalInfo.Users = Null.NullInteger; objPortalInfo.Pages = Null.NullInteger; } return objPortalInfo; }
/// <summary> /// AddAdminPage adds an Admin Tab Page /// </summary> /// <param name="Portal">The Portal</param> /// <param name="TabName">The Name to give this new Tab</param> /// <param name="TabIconFile">The Icon for this new Tab</param> /// <param name="IsVisible">A flag indicating whether the tab is visible</param> private static TabInfo AddAdminPage(PortalInfo Portal, string TabName, string TabIconFile, bool IsVisible) { TabController objTabController = new TabController(); TabInfo AdminPage = objTabController.GetTab(Portal.AdminTabId, Portal.PortalID, false); TabPermissionCollection objTabPermissions = new TabPermissionCollection(); AddPagePermission(ref objTabPermissions, "View", Convert.ToInt32(Portal.AdministratorRoleId)); //Call AddPage with parentTab = AdminPage & RoleId = AdministratorRoleId return AddPage(AdminPage, TabName, TabIconFile, IsVisible, objTabPermissions, true); }
public static void CopyUserToPortal(UserInfo user, PortalInfo portal, bool mergeUser, bool deleteUser) { if (deleteUser) { MoveUserToPortal(user, portal, mergeUser); } else { CopyUserToPortal(user, portal, mergeUser); } }
protected void Page_Load(object sender, EventArgs e) { Response.ContentType = "application/json"; object json = new { Status = "Login Failed" }; if (!string.IsNullOrWhiteSpace(Request.Form["u"])) { aqufitEntities entities = new aqufitEntities(); string uname = Request.Form["u"]; string password = Request.Form["p"]; if (uname.Contains("@")) { // this is an email login User user = entities.UserSettings.OfType <User>().FirstOrDefault(u => u.UserEmail == uname); if (user == null) { json = new { Status = "Email ERROR" }; Response.Write(json); Response.Flush(); Response.End(); return; } uname = user.UserName; } uname = uname.ToLower(); DotNetNuke.Security.Membership.UserLoginStatus status = DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_FAILURE; DotNetNuke.Entities.Portals.PortalController pc = new DotNetNuke.Entities.Portals.PortalController(); DotNetNuke.Entities.Portals.PortalInfo pi = pc.GetPortal(0); UserInfo uinfo = UserController.UserLogin(0, uname, password, null, pi.PortalName, DotNetNuke.Services.Authentication.AuthenticationLoginBase.GetIPAddress(), ref status, true); if (status == DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_SUCCESS || status == DotNetNuke.Security.Membership.UserLoginStatus.LOGIN_SUPERUSER) { UserSettings usersettings = entities.UserSettings.OfType <User>().FirstOrDefault(u => u.UserKey == uinfo.UserID && u.PortalKey == 0); if (!usersettings.Guid.HasValue) { // we only add a UUID if there was none before.. this is so the "remember me" on the desktop site will still work. usersettings.Guid = Guid.NewGuid(); entities.SaveChanges(); } json = new { Status = "SUCCESS", Token = usersettings.Guid.ToString(), UserId = usersettings.Id, Username = usersettings.UserName }; } } Response.Write(serializer.Serialize(json)); Response.Flush(); Response.End(); }
protected IEnumerable<PortalInfo> GetManageablePortals () { if (UserInfo.IsSuperUser) { // host can manage all portals plus host "portal" var portals = PortalController.Instance.GetPortals (); portals.Insert (0, new PortalInfo { PortalID = Const.HOST_PORTAL_ID, PortalName = LocalizeString ("Host.Text") }); return portals.Cast<PortalInfo> (); } if (UserInfo.IsInRole ("Administrators")) { // admin can manage its portal only var portals = new PortalInfo [] { new PortalInfo { PortalID = PortalId, PortalName = PortalSettings.Current.PortalName } }; return portals; } return Enumerable.Empty<PortalInfo> (); }
private void onFileChanged(object sender, FileSystemEventArgs e, PortalInfo portalInfo) { try { var relativeFilePath = Utils.GetRelativePath(portalInfo.HomeDirectoryMapPath, e.FullPath); string fileName = Path.GetFileName(e.Name); var fileInfo = FileManager.Instance.GetFile(0, relativeFilePath); if (fileInfo == null) { //Get Folder string folderPath = relativeFilePath.Replace(fileName, ""); var folderInfo = FolderManager.Instance.GetFolder(portalInfo.PortalID, folderPath); if (folderInfo == null) { folderInfo = FolderManager.Instance.AddFolder(portalInfo.PortalID, folderPath); } FileManager.Instance.AddFile(folderInfo, fileName, null, false); } } catch (Exception ex) { DotNetNuke.Services.Exceptions.Exceptions.LogException(ex); } }
public PortalSettings(int tabId, PortalInfo portal) { PortalId = portal != null ? portal.PortalID : Null.NullInteger; BuildPortalSettings(tabId, portal); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); cboFolders.SelectedIndexChanged += cboFolders_SelectedIndexChanged; optType.SelectedIndexChanged += optType_SelectedIndexChanged; cmdAdd.Click += cmdAdd_Click; cmdCancel.Click += cmdCancel_Click; cmdDelete.Click += cmdDelete_Click; cmdSave.Click += cmdSave_Click; cmdSelect.Click += cmdSelect_Click; cmdUpload.Click += cmdUpload_Click; try { var objPortals = new PortalController(); if ((Request.QueryString["pid"] != null) && (Globals.IsHostTab(PortalSettings.ActiveTab.TabID) || UserController.GetCurrentUserInfo().IsSuperUser)) { _objPortal = objPortals.GetPortal(Int32.Parse(Request.QueryString["pid"])); } else { _objPortal = objPortals.GetPortal(PortalSettings.PortalId); } if (ViewState["IsUrlControlLoaded"] == null) { //If Not Page.IsPostBack Then //let's make at least an initialization //The type radio button must be initialized //The url must be initialized no matter its value _doRenderTypes = true; _doChangeURL = true; ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem")); //The following line was mover to the pre-render event to ensure render for the first time //ViewState("IsUrlControlLoaded") = "Loaded" } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Serializes all Roles /// </summary> /// <param name="xmlTemplate">Reference to XmlDocument context</param> /// <param name="nodeRoles">Node to add the serialized objects</param> /// <param name="objportal">Portal to serialize</param> /// <returns>A hastable with all serialized roles. Will be used later to translate RoleId to RoleName</returns> /// <remarks> /// The serialization uses the xml attributes defined in RoleInfo class. /// </remarks> /// <history> /// [VMasanas] 23/09/2004 Created /// </history> public Hashtable SerializeRoles( XmlDocument xmlTemplate, XmlNode nodeRoles, PortalInfo objportal ) { RoleController objroles = new RoleController(); Hashtable hRoles = new Hashtable(); XmlSerializer xser = new XmlSerializer( typeof( RoleInfo ) ); foreach( RoleInfo objrole in objroles.GetPortalRoles( objportal.PortalID ) ) { StringWriter sw = new StringWriter(); xser.Serialize( sw, objrole ); XmlDocument xmlRole = new XmlDocument(); xmlRole.LoadXml( sw.GetStringBuilder().ToString() ); XmlNode nodeRole = xmlRole.SelectSingleNode( "role" ); nodeRole.Attributes.Remove( nodeRole.Attributes["xmlns:xsd"] ); nodeRole.Attributes.Remove( nodeRole.Attributes["xmlns:xsi"] ); XmlNode newnode; if( objrole.RoleID == objportal.AdministratorRoleId ) { newnode = xmlRole.CreateElement( "roletype" ); newnode.InnerXml = "adminrole"; nodeRole.AppendChild( newnode ); } if( objrole.RoleID == objportal.RegisteredRoleId ) { newnode = xmlRole.CreateElement( "roletype" ); newnode.InnerXml = "registeredrole"; nodeRole.AppendChild( newnode ); } if( objrole.RoleName == "Subscribers" ) { newnode = xmlRole.CreateElement( "roletype" ); newnode.InnerXml = "subscriberrole"; nodeRole.AppendChild( newnode ); } nodeRoles.AppendChild( xmlTemplate.ImportNode( nodeRole, true ) ); // save role, we'll need them later hRoles.Add( objrole.RoleID.ToString(), objrole.RoleName ); } // Add default DNN roles hRoles.Add( Globals.glbRoleAllUsers, "All" ); hRoles.Add( Globals.glbRoleUnauthUser, "Unauthenticated" ); hRoles.Add( Globals.glbRoleSuperUser, "Super" ); return hRoles; }
/// <summary> /// Serializes all Folder Permissions /// </summary> /// <param name="xmlTemplate">Reference to XmlDocument context</param> /// <param name="nodePermissions"></param> /// <param name="objportal">Portal to serialize</param> /// <param name="folderPath">The folder containing the files</param> /// <remarks> /// The serialization uses the xml attributes defined in FolderInfo class. /// </remarks> /// <history> /// [cnurse] 11/08/2004 Created /// </history> public void SerializeFolderPermissions( XmlDocument xmlTemplate, XmlNode nodePermissions, PortalInfo objportal, string folderPath ) { FolderPermissionController objPermissions = new FolderPermissionController(); ArrayList arrPermissions = objPermissions.GetFolderPermissionsByFolder( objportal.PortalID, folderPath ); foreach( FolderPermissionInfo objPermission in arrPermissions ) { XmlElement nodePermission = xmlTemplate.CreateElement( "permission" ); nodePermission.AppendChild( XmlUtils.CreateElement( xmlTemplate, "permissioncode", objPermission.PermissionCode ) ); nodePermission.AppendChild( XmlUtils.CreateElement( xmlTemplate, "permissionkey", objPermission.PermissionKey ) ); nodePermission.AppendChild( XmlUtils.CreateElement( xmlTemplate, "rolename", objPermission.RoleName ) ); nodePermission.AppendChild( XmlUtils.CreateElement( xmlTemplate, "allowaccess", objPermission.AllowAccess.ToString().ToLower() ) ); nodePermissions.AppendChild( nodePermission ); } }
/// <summary> /// Serializes all Files /// </summary> /// <param name="xmlTemplate">Reference to XmlDocument context</param> /// <param name="nodeFiles">Node to add the serialized objects</param> /// <param name="objportal">Portal to serialize</param> /// <param name="folderPath">The folder containing the files</param> /// <param name="zipFile"></param> /// <remarks> /// The serialization uses the xml attributes defined in FileInfo class. /// </remarks> /// <history> /// [cnurse] 11/08/2004 Created /// [cnurse] 05/20/2004 Extracted adding of file to zip to new FileSystemUtils method /// </history> public void SerializeFiles(XmlDocument xmlTemplate, XmlNode nodeFiles, PortalInfo objportal, string folderPath, ref ZipOutputStream zipFile) { FolderController objFolders = new FolderController(); FolderInfo objFolder = objFolders.GetFolder( objportal.PortalID, folderPath ); ArrayList arrFiles = FileSystemUtils.GetFilesByFolder(objportal.PortalID, objFolder.FolderID); XmlSerializer xser = new XmlSerializer(typeof(FileInfo)); foreach (FileInfo objFile in arrFiles) { // verify that the file exists on the file system string filePath = objportal.HomeDirectoryMapPath + folderPath + objFile.FileName; if (File.Exists(filePath)) { StringWriter sw = new StringWriter(); xser.Serialize(sw, objFile); //Add node to template XmlDocument xmlFile = new XmlDocument(); xmlFile.LoadXml(sw.GetStringBuilder().ToString()); XmlNode nodeFile = xmlFile.SelectSingleNode("file"); nodeFile.Attributes.Remove(nodeFile.Attributes["xmlns:xsd"]); nodeFile.Attributes.Remove(nodeFile.Attributes["xmlns:xsi"]); nodeFiles.AppendChild(xmlTemplate.ImportNode(nodeFile, true)); FileSystemUtils.AddToZip(ref zipFile, filePath, objFile.FileName, folderPath); } } }
private static int AddTabToTabDict(SharedDictionary<string, string> tabIndex, Dictionary<string, DupKeyCheck> dupCheck, string httpAlias, string aliasCulture, string customHttpAlias, PortalInfo thisPortal, string tabPath, ref List<string> customAliasesUsed, TabInfo tab, FriendlyUrlSettings settings, FriendlyUrlOptions options, int homeTabId, ref Hashtable homePageSkins, Guid parentTraceId) { string rewritePath = ""; int tabPathDepth = 0; bool customAliasUsedAndNotCurrent = !String.IsNullOrEmpty(customHttpAlias) && customHttpAlias != httpAlias; //592 : check the permanent redirect value //736 : 5.5 changes : track tab culture code string cultureCode = tab.CultureCode; if (String.IsNullOrEmpty(cultureCode)) { cultureCode = aliasCulture; } bool permanentRedirect = tab.PermanentRedirect; //determine the rewrite parameter //for deleted, expired or pages not enabled yet, direct to the home page if the setting is enabled //534 : tab is disabled, mark as deleted (don't want to cause duplicate tab warnings) bool isDeleted = (tab.IsDeleted || tab.DisableLink || (tab.EndDate < DateTime.Now && tab.EndDate > DateTime.MinValue) || (tab.StartDate > DateTime.Now && tab.StartDate > DateTime.MinValue)); if (isDeleted) // don't care what setting is, redirect code will decide whether to redirect or 404 - just mark as page deleted && // settings.DeletedTabHandlingValue == DeletedTabHandlingTypes.Do301RedirectToPortalHome) { //777: force 404 result for all deleted pages instead of relying on 'not found' //838 : separate handling for disabled pages ActionType action = settings.DeletedTabHandlingType == DeletedTabHandlingType.Do404Error ? ActionType.Output404 : ActionType.Redirect301; rewritePath = tab.DisableLink ? CreateRewritePath(homeTabId, cultureCode, action, RedirectReason.Disabled_Page) : CreateRewritePath(homeTabId, cultureCode, action, RedirectReason.Deleted_Page); } else { //for all other pages, rewrite to the correct tabId for that page //592 : new permanentRedirect value if (permanentRedirect) { rewritePath = CreateRewritePath(tab.TabID, cultureCode, ActionType.Redirect301, RedirectReason.Tab_Permanent_Redirect); } else { //852 : skin per alias at tab level - if specified if (tab.AliasSkins != null && tab.AliasSkins.ContainsAlias(httpAlias)) { TabAliasSkinInfo tas = tab.AliasSkins.FindByHttpAlias(httpAlias); if (tas != null) { string skinSrc = tas.SkinSrc; if (!string.IsNullOrEmpty(skinSrc)) { //add skin src into rewrite path rewritePath = CreateRewritePath(tab.TabID, cultureCode, "skinSrc=" + skinSrc); } //now add to the home page skin hashtable if it's the home page. if (homeTabId == tab.TabID) { string key = httpAlias + "::" + cultureCode; string key2 = httpAlias; if (homePageSkins.ContainsKey(key) == false) { homePageSkins.Add(key, skinSrc); } if (homePageSkins.ContainsKey(key2) == false) { homePageSkins.Add(key2, skinSrc); } } } } else { rewritePath = CreateRewritePath(tab.TabID, cultureCode); } } if (thisPortal != null && (thisPortal.UserTabId == tab.TabID || thisPortal.UserTabId == tab.ParentId || thisPortal.UserTabId == -1)) { //user profile action specified. If tabid match for this tab, add a do301 check because we want to make //sure that the trimmed Url is used when appropriate rewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath, ActionType.CheckFor301, RedirectReason.User_Profile_Url); } } if (tabPath.Replace("//", "/") != tab.TabPath.Replace("//", "/")) { //when the generated tab path is different to the standard tab path, character substituion has happened //this entry is going to have space substitution in it, so it is added into the dictionary with a delete notification and a 301 replaced //this entry is the 'original' (spaces removed) version ie mypage string substituteRewritePath = rewritePath; if (!isDeleted) //if it is deleted, we don't care if the spaces were replaced, or anything else, just take care in deleted handling { string replaceSpaceWith = String.Empty; if (settings.ReplaceSpaceWith != FriendlyUrlSettings.ReplaceSpaceWithNothing) { replaceSpaceWith = settings.ReplaceSpaceWith; } substituteRewritePath = RedirectTokens.AddRedirectReasonToRewritePath(substituteRewritePath, ActionType.Redirect301, tabPath.Contains(replaceSpaceWith) ? RedirectReason.Spaces_Replaced : RedirectReason.Custom_Redirect); } //the preference variable determines what to do if a duplicate tab is found already in the dictionary var preference = UrlEnums.TabKeyPreference.TabRedirected; if (isDeleted) { // if the tab is actually deleted, downgrade the preference to 'deleted'. Any other tabs with the same path that // are redirected but not deleted should take preference preference = UrlEnums.TabKeyPreference.TabDeleted; } //Note ; if anything else is wrong with this url, (ie, wrong alias) then that will be corrected in a redirect AddToTabDict(tabIndex, dupCheck, httpAlias, tab.TabPath, substituteRewritePath, tab.TabID, preference, ref tabPathDepth, settings.CheckForDuplicateUrls, isDeleted); } //check for permanent redirects as specified in the core dnn permanent redirect property if (permanentRedirect) { AddPermanentRedirectToDictionary(tabIndex, dupCheck, httpAlias, tab, tabPath, ref rewritePath, ref tabPathDepth, settings.CheckForDuplicateUrls, isDeleted); } // disabled / not active by date / external url pages cannot navigate to settings page if (tab.DisableLink || !string.IsNullOrEmpty(tab.Url) || (tab.EndDate < DateTime.Now && tab.EndDate > DateTime.MinValue) || (tab.StartDate > DateTime.Now && tab.StartDate > DateTime.MinValue)) { string settingsUrl = tabPath.Replace("//", "/") + "/ctl/Tab"; string settingsRewritePath = CreateRewritePath(tab.TabID, "", "ctl=tab"); AddToTabDict(tabIndex, dupCheck, httpAlias, settingsUrl, settingsRewritePath, tab.TabID, UrlEnums.TabKeyPreference.TabRedirected, ref tabPathDepth, settings.CheckForDuplicateUrls, isDeleted); } //777: every tab is added to the dictionary, including those that are deleted //inspect the optional tab redirects and add them as well, keeping track if any are '200' status, meaning the standard Url will be 301, if replaced unfriendly is switched on //589 : tab with custom 200 redirects not changing base url to 301 statusa AddCustomRedirectsToDictionary(tabIndex, dupCheck, httpAlias, tab, settings, options, ref rewritePath, out tabPathDepth, ref customAliasesUsed, isDeleted, parentTraceId); //if auto ascii conversion is on, do that as well if (settings.AutoAsciiConvert) { bool replacedDiacritic; string asciiTabPath = TabPathHelper.ReplaceDiacritics(tabPath, out replacedDiacritic); if (replacedDiacritic) { ActionType existingAction; RedirectTokens.GetActionFromRewritePath(rewritePath, out existingAction); if (settings.RedirectUnfriendly && existingAction != ActionType.Redirect301) { //add in a tab path, with 301, for the version with the diacritics in string diacriticRewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath, ActionType.Redirect301, RedirectReason.Diacritic_Characters); AddToTabDict(tabIndex, dupCheck, httpAlias, tabPath, diacriticRewritePath, tab.TabID, UrlEnums.TabKeyPreference.TabOK, ref tabPathDepth, settings.CheckForDuplicateUrls, isDeleted); } else { //add in the standard version so that the page responds to both the diacritic version AddToTabDict(tabIndex, dupCheck, httpAlias, tabPath, rewritePath, tab.TabID, UrlEnums.TabKeyPreference.TabOK, ref tabPathDepth, settings.CheckForDuplicateUrls, isDeleted); } } tabPath = asciiTabPath; //switch tabpath to new, ascii-converted version for rest of processing } //add the 'standard' Url in if (tab.TabID == homeTabId && settings.RedirectUnfriendly) { //home page shoudl be redirected back to the site root //899: check for redirect on home page rewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath, ActionType.CheckFor301, RedirectReason.Site_Root_Home); AddToTabDict(tabIndex, dupCheck, httpAlias, tabPath, rewritePath, tab.TabID, UrlEnums.TabKeyPreference.TabOK, ref tabPathDepth, settings.CheckForDuplicateUrls, isDeleted); } else { if (customAliasUsedAndNotCurrent && settings.RedirectUnfriendly) { //add in the standard page, but it's a redirect to the customAlias rewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath, ActionType.Redirect301, RedirectReason.Custom_Tab_Alias); AddToTabDict(tabIndex, dupCheck, httpAlias, tabPath, rewritePath, tab.TabID, UrlEnums.TabKeyPreference.TabRedirected, ref tabPathDepth, settings.CheckForDuplicateUrls, isDeleted); } else { if (customAliasUsedAndNotCurrent && settings.RedirectUnfriendly) { //add in the standard page, but it's a redirect to the customAlias rewritePath = RedirectTokens.AddRedirectReasonToRewritePath(rewritePath, ActionType.Redirect301, RedirectReason.Custom_Tab_Alias); AddToTabDict(tabIndex, dupCheck, httpAlias, tabPath, rewritePath, tab.TabID, UrlEnums.TabKeyPreference.TabRedirected, ref tabPathDepth, settings.CheckForDuplicateUrls, isDeleted); } else { //add in the standard page to the dictionary //931 : don't replace existing custom url if this is a redirect or a check for redirect ActionType action; var dupCheckPreference = UrlEnums.TabKeyPreference.TabOK; RedirectTokens.GetActionFromRewritePath(rewritePath, out action); if (action == ActionType.CheckFor301 || action == ActionType.Redirect301 || action == ActionType.Redirect302) { dupCheckPreference = UrlEnums.TabKeyPreference.TabRedirected; } AddToTabDict(tabIndex, dupCheck, httpAlias, tabPath, rewritePath, tab.TabID, dupCheckPreference, ref tabPathDepth, settings.CheckForDuplicateUrls, isDeleted); } } } return tabPathDepth; }
public void LoadPortal_Loads_Portal_Property_Values() { //Arrange var controller = new PortalSettingsController(); var portal = new PortalInfo() { Users = 2, Pages = 5, DefaultLanguage = Localization.SystemLocale, HomeDirectory = "Portals/0" }; var settings = new PortalSettings() { PortalId = ValidPortalId }; //Act controller.LoadPortal(portal,settings); //Assert Assert.AreEqual(portal.AdminTabId, settings.AdminTabId); Assert.AreEqual(portal.AdministratorId, settings.AdministratorId); Assert.AreEqual(portal.AdministratorRoleId, settings.AdministratorRoleId); Assert.AreEqual(portal.AdministratorRoleName, settings.AdministratorRoleName); Assert.AreEqual(portal.BackgroundFile, settings.BackgroundFile); Assert.AreEqual(portal.BannerAdvertising, settings.BannerAdvertising); Assert.AreEqual(portal.CultureCode, settings.CultureCode); Assert.AreEqual(portal.Currency, settings.Currency); Assert.AreEqual(portal.Custom404TabId, settings.ErrorPage404); Assert.AreEqual(portal.Custom500TabId, settings.ErrorPage500); Assert.AreEqual(portal.DefaultLanguage, settings.DefaultLanguage); Assert.AreEqual(portal.Description, settings.Description); Assert.AreEqual(portal.Email, settings.Email); Assert.AreEqual(portal.ExpiryDate, settings.ExpiryDate); Assert.AreEqual(portal.FooterText, settings.FooterText); Assert.AreEqual(portal.GUID, settings.GUID); Assert.AreEqual(Globals.ApplicationPath + "/" + portal.HomeDirectory + "/", settings.HomeDirectory); Assert.AreEqual(portal.HomeDirectoryMapPath, settings.HomeDirectoryMapPath); Assert.AreEqual(Globals.ApplicationPath + "/" + portal.HomeSystemDirectory + "/", settings.HomeSystemDirectory); Assert.AreEqual(portal.HomeSystemDirectoryMapPath, settings.HomeSystemDirectoryMapPath); Assert.AreEqual(portal.HomeTabId, settings.HomeTabId); Assert.AreEqual(portal.HostFee, settings.HostFee); Assert.AreEqual(portal.HostSpace, settings.HostSpace); Assert.AreEqual(portal.KeyWords, settings.KeyWords); Assert.AreEqual(portal.LoginTabId, settings.LoginTabId); Assert.AreEqual(portal.LogoFile, settings.LogoFile); Assert.AreEqual(portal.PageQuota, settings.PageQuota); Assert.AreEqual(portal.Pages, settings.Pages); Assert.AreEqual(portal.PortalName, settings.PortalName); Assert.AreEqual(portal.RegisterTabId, settings.RegisterTabId); Assert.AreEqual(portal.RegisteredRoleId, settings.RegisteredRoleId); Assert.AreEqual(portal.RegisteredRoleName, settings.RegisteredRoleName); Assert.AreEqual(portal.SearchTabId, settings.SearchTabId); Assert.AreEqual(portal.SiteLogHistory, settings.SiteLogHistory); Assert.AreEqual(portal.SplashTabId, settings.SplashTabId); Assert.AreEqual(portal.SuperTabId, settings.SuperTabId); Assert.AreEqual(portal.UserQuota, settings.UserQuota); Assert.AreEqual(portal.UserRegistration, settings.UserRegistration); Assert.AreEqual(portal.UserTabId, settings.UserTabId); Assert.AreEqual(portal.Users, settings.Users); }
/// ----------------------------------------------------------------------------- /// <summary> /// Serializes all portal Tabs /// </summary> /// <param name="writer"></param> /// <param name="portal">Portal to serialize</param> /// <remarks> /// Only portal tabs will be exported to the template, Admin tabs are not exported. /// On each tab, all modules will also be exported. /// </remarks> /// <history> /// [VMasanas] 23/09/2004 Created /// </history> /// ----------------------------------------------------------------------------- private void SerializeTabs(XmlWriter writer, PortalInfo portal) { //supporting object to build the tab hierarchy var tabs = new Hashtable(); writer.WriteStartElement("tabs"); if (chkMultilanguage.Checked) { //Process Default Language first SerializeTabs(writer, portal, tabs, TabController.Instance.GetTabsByPortal(portal.PortalID).WithCulture(portal.DefaultLanguage, true)); //Process other locales foreach (ListItem language in chkLanguages.Items) { if (language.Selected && language.Value != portal.DefaultLanguage) SerializeTabs(writer, portal, tabs, TabController.Instance.GetTabsByPortal(portal.PortalID).WithCulture(language.Value, false)); } } else { if (chkMultilanguage.Enabled) { // only export 1 language string language = languageComboBox.SelectedValue; SerializeTabs(writer, portal, tabs, TabController.Instance.GetTabsByPortal(portal.PortalID).WithCulture(language, true)); } else { SerializeTabs(writer, portal, tabs, TabController.Instance.GetTabsByPortal(portal.PortalID)); } } writer.WriteEndElement(); }
private void SerializeTabs(XmlWriter writer, PortalInfo portal, Hashtable tabs, TabCollection tabCollection) { foreach (TabInfo tab in tabCollection.Values) { //if not deleted if (!tab.IsDeleted) { XmlNode tabNode = null; if (string.IsNullOrEmpty(tab.CultureCode) || tab.CultureCode == portal.DefaultLanguage) { // page in default culture and checked if (ctlPages.CheckedNodes.Any(p => p.Value == tab.TabID.ToString(CultureInfo.InvariantCulture))) tabNode = TabController.SerializeTab(new XmlDocument(), tabs, tab, portal, chkContent.Checked); } else { // check if default culture page is selected TabInfo defaultTab = tab.DefaultLanguageTab; if (defaultTab == null || ctlPages.CheckedNodes.Count(p => p.Value == defaultTab.TabID.ToString(CultureInfo.InvariantCulture)) > 0) tabNode = TabController.SerializeTab(new XmlDocument(), tabs, tab, portal, chkContent.Checked); } if (tabNode != null) tabNode.WriteTo(writer); } } }
/// <summary> /// The GetPortalSettings method builds the site Settings /// </summary> /// <remarks> /// </remarks> /// <param name="TabId">The current tabs id</param> /// <param name="objPortalAliasInfo">The Portal Alias object</param> private void GetPortalSettings(int TabId, PortalAliasInfo objPortalAliasInfo) { PortalController objPortals = new PortalController(); PortalInfo objPortal = null; TabController objTabs = new TabController(); ModuleController objModules = new ModuleController(); ModuleInfo objModule = null; SkinInfo objSkin = null; PortalId = objPortalAliasInfo.PortalID; // get portal settings objPortal = objPortals.GetPortal(PortalId); if (objPortal != null) { this.PortalAlias = objPortalAliasInfo; this.PortalId = objPortal.PortalID; this.PortalName = objPortal.PortalName; this.LogoFile = objPortal.LogoFile; this.FooterText = objPortal.FooterText; this.ExpiryDate = objPortal.ExpiryDate; this.UserRegistration = objPortal.UserRegistration; this.BannerAdvertising = objPortal.BannerAdvertising; this.Currency = objPortal.Currency; this.AdministratorId = objPortal.AdministratorId; this.Email = objPortal.Email; this.HostFee = objPortal.HostFee; this.HostSpace = objPortal.HostSpace; this.PageQuota = objPortal.PageQuota; this.UserQuota = objPortal.UserQuota; this.AdministratorRoleId = objPortal.AdministratorRoleId; this.AdministratorRoleName = objPortal.AdministratorRoleName; this.RegisteredRoleId = objPortal.RegisteredRoleId; this.RegisteredRoleName = objPortal.RegisteredRoleName; this.Description = objPortal.Description; this.KeyWords = objPortal.KeyWords; this.BackgroundFile = objPortal.BackgroundFile; this.GUID = objPortal.GUID; this.SiteLogHistory = objPortal.SiteLogHistory; this.AdminTabId = objPortal.AdminTabId; this.SuperTabId = objPortal.SuperTabId; this.SplashTabId = objPortal.SplashTabId; this.HomeTabId = objPortal.HomeTabId; this.LoginTabId = objPortal.LoginTabId; this.UserTabId = objPortal.UserTabId; this.DefaultLanguage = objPortal.DefaultLanguage; this.TimeZoneOffset = objPortal.TimeZoneOffset; this.HomeDirectory = objPortal.HomeDirectory; this.Version = objPortal.Version; this.AdminSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalId, SkinType.Admin); this.PortalSkin = SkinController.GetSkin(SkinInfo.RootSkin, PortalId, SkinType.Portal); this.AdminContainer = SkinController.GetSkin(SkinInfo.RootContainer, PortalId, SkinType.Admin); this.PortalContainer = SkinController.GetSkin(SkinInfo.RootContainer, PortalId, SkinType.Portal); this.Pages = objPortal.Pages; this.Users = objPortal.Users; // set custom properties if (Null.IsNull(this.HostSpace)) { this.HostSpace = 0; } if (Null.IsNull(this.DefaultLanguage)) { this.DefaultLanguage = Localization.SystemLocale; } if (Null.IsNull(this.TimeZoneOffset)) { this.TimeZoneOffset = Localization.SystemTimeZoneOffset; } this.HomeDirectory = Globals.ApplicationPath + "/" + objPortal.HomeDirectory + "/"; // get application version Array arrVersion = Globals.glbAppVersion.Split(Convert.ToChar(".")); int intMajor = Convert.ToInt32(arrVersion.GetValue((0))); int intMinor = Convert.ToInt32(arrVersion.GetValue((1))); int intBuild = Convert.ToInt32(arrVersion.GetValue((2))); this.Version = string.Format("{0}.{1}.{2}", intMajor, intMinor, intBuild); } //Add each portal Tab to DekstopTabs TabInfo objPortalTab = null; foreach (KeyValuePair <int, TabInfo> tabPair in objTabs.GetTabsByPortal(this.PortalId)) { // clone the tab object ( to avoid creating an object reference to the data cache ) objPortalTab = tabPair.Value.Clone(); // set custom properties if (objPortalTab.TabOrder == 0) { objPortalTab.TabOrder = 999; } if (Null.IsNull(objPortalTab.StartDate)) { objPortalTab.StartDate = DateTime.MinValue; } if (Null.IsNull(objPortalTab.EndDate)) { objPortalTab.EndDate = DateTime.MaxValue; } objPortalTab.IsSuperTab = false; this.DesktopTabs.Add(objPortalTab); } //Add each host Tab to DesktopTabs TabInfo objHostTab = null; foreach (KeyValuePair <int, TabInfo> tabPair in objTabs.GetTabsByPortal(Null.NullInteger)) { // clone the tab object ( to avoid creating an object reference to the data cache ) objHostTab = tabPair.Value.Clone(); objHostTab.PortalID = this.PortalId; objHostTab.StartDate = DateTime.MinValue; objHostTab.EndDate = DateTime.MaxValue; objHostTab.IsSuperTab = true; this.DesktopTabs.Add(objHostTab); } //At this point the DesktopTabs Collection contains all the Tabs for the current portal //verify tab for portal. This assigns the Active Tab based on the Tab Id/PortalId if (VerifyPortalTab(PortalId, TabId)) { if (this.ActiveTab != null) { // skin if (this.ActiveTab.SkinSrc == "") { if (Globals.IsAdminSkin(this.ActiveTab.IsAdminTab)) { objSkin = this.AdminSkin; } else { objSkin = this.PortalSkin; } if (objSkin != null) { this.ActiveTab.SkinSrc = objSkin.SkinSrc; } } if (this.ActiveTab.SkinSrc == "") { if (Globals.IsAdminSkin(this.ActiveTab.IsAdminTab)) { this.ActiveTab.SkinSrc = "[G]" + SkinInfo.RootSkin + Globals.glbDefaultSkinFolder + Globals.glbDefaultAdminSkin; } else { this.ActiveTab.SkinSrc = "[G]" + SkinInfo.RootSkin + Globals.glbDefaultSkinFolder + Globals.glbDefaultSkin; } } this.ActiveTab.SkinSrc = SkinController.FormatSkinSrc(this.ActiveTab.SkinSrc, this); this.ActiveTab.SkinPath = SkinController.FormatSkinPath(this.ActiveTab.SkinSrc); // container if (this.ActiveTab.ContainerSrc == "") { if (Globals.IsAdminSkin(this.ActiveTab.IsAdminTab)) { objSkin = this.AdminContainer; } else { objSkin = this.PortalContainer; } if (objSkin != null) { this.ActiveTab.ContainerSrc = objSkin.SkinSrc; } } if (this.ActiveTab.ContainerSrc == "") { if (Globals.IsAdminSkin(this.ActiveTab.IsAdminTab)) { this.ActiveTab.ContainerSrc = "[G]" + SkinInfo.RootContainer + Globals.glbDefaultContainerFolder + Globals.glbDefaultAdminContainer; } else { this.ActiveTab.ContainerSrc = "[G]" + SkinInfo.RootContainer + Globals.glbDefaultContainerFolder + Globals.glbDefaultContainer; } } this.ActiveTab.ContainerSrc = SkinController.FormatSkinSrc(this.ActiveTab.ContainerSrc, this); this.ActiveTab.ContainerPath = SkinController.FormatSkinPath(this.ActiveTab.ContainerSrc); // initialize collections this.ActiveTab.BreadCrumbs = new ArrayList(); this.ActiveTab.Panes = new ArrayList(); this.ActiveTab.Modules = new ArrayList(); // get breadcrumbs for current tab GetBreadCrumbsRecursively(this.ActiveTab.BreadCrumbs, this.ActiveTab.TabID); } } Hashtable objPaneModules = new Hashtable(); // get current tab modules foreach (KeyValuePair <int, ModuleInfo> kvp in objModules.GetTabModules(this.ActiveTab.TabID)) { objModule = kvp.Value; // clone the module object ( to avoid creating an object reference to the data cache ) ModuleInfo cloneModule = objModule.Clone(); // set custom properties if (Null.IsNull(cloneModule.StartDate)) { cloneModule.StartDate = DateTime.MinValue; } if (Null.IsNull(cloneModule.EndDate)) { cloneModule.EndDate = DateTime.MaxValue; } // container if (cloneModule.ContainerSrc == "") { cloneModule.ContainerSrc = this.ActiveTab.ContainerSrc; } cloneModule.ContainerSrc = SkinController.FormatSkinSrc(cloneModule.ContainerSrc, this); cloneModule.ContainerPath = SkinController.FormatSkinPath(cloneModule.ContainerSrc); // process tab panes if (objPaneModules.ContainsKey(cloneModule.PaneName) == false) { objPaneModules.Add(cloneModule.PaneName, 0); } cloneModule.PaneModuleCount = 0; if (!cloneModule.IsDeleted) { objPaneModules[cloneModule.PaneName] = Convert.ToInt32(objPaneModules[cloneModule.PaneName]) + 1; cloneModule.PaneModuleIndex = Convert.ToInt32(objPaneModules[cloneModule.PaneName]) - 1; } this.ActiveTab.Modules.Add(cloneModule); } // set pane module count foreach (ModuleInfo objModuleWithinLoop in this.ActiveTab.Modules) { objModule = objModuleWithinLoop; objModuleWithinLoop.PaneModuleCount = Convert.ToInt32(objPaneModules[objModuleWithinLoop.PaneName]); } }
private String DoProductIdx(DotNetNuke.Entities.Portals.PortalInfo portal, DateTime lastrun, Boolean debug) { if (debug) { InternalSearchController.Instance.DeleteAllDocuments(portal.PortalID, SearchHelper.Instance.GetSearchTypeByName("tab").SearchTypeId); } var searchDocs = new List <SearchDocument>(); var culturecodeList = DnnUtils.GetCultureCodeList(portal.PortalID); var storeSettings = new StoreSettings(portal.PortalID); foreach (var lang in culturecodeList) { var strContent = ""; // select all products var objCtrl = new NBrightBuyController(); var strFilter = " and NB1.ModifiedDate > convert(datetime,'" + lastrun.ToString("s") + "') "; if (debug) { strFilter = ""; } var l = objCtrl.GetList(portal.PortalID, -1, "PRD", strFilter); foreach (var p in l) { var prodData = new ProductData(p.ItemID, lang); strContent = prodData.Info.GetXmlProperty("genxml/textbox/txtproductref") + " : " + prodData.SEODescription + " " + prodData.SEOName + " " + prodData.SEOTagwords + " " + prodData.SEOTitle; if (strContent != "") { var tags = new List <String>(); tags.Add("nbsproduct"); //Get the description string string strDescription = HtmlUtils.Shorten(HtmlUtils.Clean(strContent, false), 100, "..."); var searchDoc = new SearchDocument(); // Assigns as a Search key the SearchItems' searchDoc.UniqueKey = prodData.Info.ItemID.ToString(""); searchDoc.QueryString = "ref=" + prodData.Info.GetXmlProperty("genxml/textbox/txtproductref"); searchDoc.Title = prodData.ProductName; searchDoc.Body = strContent; searchDoc.Description = strDescription; if (debug) { searchDoc.ModifiedTimeUtc = DateTime.Now.Date; } else { searchDoc.ModifiedTimeUtc = prodData.Info.ModifiedDate; } searchDoc.AuthorUserId = 1; searchDoc.TabId = storeSettings.ProductDetailTabId; searchDoc.PortalId = portal.PortalID; searchDoc.SearchTypeId = SearchHelper.Instance.GetSearchTypeByName("tab").SearchTypeId; searchDoc.CultureCode = lang; searchDoc.Tags = tags; //Add Module MetaData searchDoc.ModuleDefId = 0; searchDoc.ModuleId = 0; searchDocs.Add(searchDoc); } } } //Index InternalSearchController.Instance.AddSearchDocuments(searchDocs); InternalSearchController.Instance.Commit(); return(" - NBS-DNNIDX scheduler ACTIVATED "); }
private void LogEvent(EventLogController.EventLogType eventType, PortalGroupInfo portalGroup, PortalInfo portal) { try { var log = new LogInfo { BypassBuffering = true, LogTypeKey = eventType.ToString(), }; log.LogProperties.Add(new LogDetailInfo("PortalGroup:", portalGroup.PortalGroupName)); log.LogProperties.Add(new LogDetailInfo("PortalGroupID:", portalGroup.PortalGroupId.ToString())); if (portal != null) { log.LogProperties.Add(new LogDetailInfo("Portal:", portal.PortalName)); log.LogProperties.Add(new LogDetailInfo("PortalID:", portal.PortalID.ToString())); } LogController.Instance.AddLog(log); } catch (Exception exc) { Logger.Error(exc); } }
private static List<KeyValuePair<string, string>> GetPortalSkins(PortalInfo portalInfo, string skinRoot) { var skins = new List<KeyValuePair<string, string>>(); if (portalInfo != null) { string rootFolder = portalInfo.HomeDirectoryMapPath + skinRoot; if (Directory.Exists(rootFolder)) { foreach (string skinFolder in Directory.GetDirectories(rootFolder)) { AddSkinFiles(skins, skinRoot, skinFolder, true); } } } return skins; }
public void RemovePortalFromGroup(PortalInfo portal, PortalGroupInfo portalGroup, bool copyUsers, UserCopiedCallback callback) { // Argument Contract Requires.NotNull("portal", portal); Requires.PropertyNotNegative("portal", "PortalId", portal.PortalID); Requires.NotNull("portalGroup", portalGroup); Requires.PropertyNotNegative("portalGroup", "PortalGroupId", portalGroup.PortalGroupId); Requires.PropertyNotNegative("portalGroup", "MasterPortalId", portalGroup.MasterPortalId); // Callback to update progress bar var args = new UserCopiedEventArgs { TotalUsers = 0, UserNo = 0, UserName = string.Empty, PortalName = portal.PortalName, Stage = "startingremove", }; callback(args); // Remove portal from group this.DeleteSharedModules(portal); portal.PortalGroupID = -1; PortalController.Instance.UpdatePortalInfo(portal); this.LogEvent(EventLogController.EventLogType.PORTAL_REMOVEDFROMPORTALGROUP, portalGroup, portal); this.CopyPropertyDefinitions(portal.PortalID, portalGroup.MasterPortalId); var userNo = 0; if (copyUsers) { var users = UserController.GetUsers(portalGroup.MasterPortalId); foreach (UserInfo masterUser in users) { userNo += 1; UserController.CopyUserToPortal(masterUser, portal, false); // Callback to update progress bar args = new UserCopiedEventArgs { TotalUsers = users.Count, UserNo = userNo, UserName = masterUser.Username, PortalName = portal.PortalName, }; callback(args); } } else { // Get admin users var adminUsers = RoleController.Instance.GetUsersByRole(Null.NullInteger, portal.AdministratorRoleName) .Where(u => RoleController.Instance.GetUserRole(portal.PortalID, u.UserID, portal.AdministratorRoleId) != null); foreach (var user in adminUsers) { UserController.CopyUserToPortal(user, portal, false); // Callback to update progress bar args = new UserCopiedEventArgs { TotalUsers = 1, UserNo = ++userNo, UserName = user.Username, PortalName = portal.PortalName, }; callback(args); } } // Callback to update progress bar args = new UserCopiedEventArgs { TotalUsers = 1, UserNo = userNo, UserName = string.Empty, PortalName = portal.PortalName, Stage = "finishedremove", PortalGroupId = portalGroup.PortalGroupId, }; callback(args); }
private void SerializePortalSettings(XmlWriter writer, PortalInfo portal) { writer.WriteStartElement("settings"); writer.WriteElementString("logofile", portal.LogoFile); writer.WriteElementString("footertext", portal.FooterText); writer.WriteElementString("userregistration", portal.UserRegistration.ToString()); writer.WriteElementString("banneradvertising", portal.BannerAdvertising.ToString()); writer.WriteElementString("defaultlanguage", portal.DefaultLanguage); Dictionary<string, string> settingsDictionary = PortalController.GetPortalSettingsDictionary(portal.PortalID); string setting; settingsDictionary.TryGetValue("DefaultPortalSkin", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("skinsrc", setting); } settingsDictionary.TryGetValue("DefaultAdminSkin", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("skinsrcadmin", setting); } settingsDictionary.TryGetValue("DefaultPortalContainer", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("containersrc", setting); } settingsDictionary.TryGetValue("DefaultAdminContainer", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("containersrcadmin", setting); } settingsDictionary.TryGetValue("EnableSkinWidgets", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("enableskinwidgets", setting); } settingsDictionary.TryGetValue("portalaliasmapping", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("portalaliasmapping", setting); } writer.WriteElementString("contentlocalizationenabled", this.chkMultilanguage.Checked.ToString()); settingsDictionary.TryGetValue("TimeZone", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("timezone", setting); } settingsDictionary.TryGetValue("EnablePopups", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("enablepopups", setting); } settingsDictionary.TryGetValue("InlineEditorEnabled", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("inlineeditorenabled", setting); } settingsDictionary.TryGetValue("HideFoldersEnabled", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("hidefoldersenabled", setting); } settingsDictionary.TryGetValue("ControlPanelMode", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("controlpanelmode", setting); } settingsDictionary.TryGetValue("ControlPanelSecurity", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("controlpanelsecurity", setting); } settingsDictionary.TryGetValue("ControlPanelVisibility", out setting); if (!string.IsNullOrEmpty(setting)) { writer.WriteElementString("controlpanelvisibility", setting); } writer.WriteElementString("hostspace", portal.HostSpace.ToString()); writer.WriteElementString("userquota", portal.UserQuota.ToString()); writer.WriteElementString("pagequota", portal.PageQuota.ToString()); //End Portal Settings writer.WriteEndElement(); }
private static string ManageCustomAliases(string tabCulture, PortalInfo thisPortal, TabInfo tab, List<string> httpAliases, List<string> customHttpAliasesUsed, out bool customAliasUsed) { string customHttpAlias = ""; string currentCulture = tabCulture; if (string.IsNullOrEmpty(tabCulture)) { currentCulture = thisPortal.DefaultLanguage; } if (tab.CustomAliases.ContainsKey(currentCulture)) { customHttpAlias = tab.CustomAliases[currentCulture].ToLower(); } customAliasUsed = httpAliases.Contains(customHttpAlias); //if there is a custom alias for this tab, and it's not one of the ones in the alias list, put it in //so that this tab will be put into the dictionary with not only the standard alias(es) but also //the custom alias. Other logic will decide if to redirect the 'wrong' alias if requested with this tab. if (customAliasUsed == false && customHttpAlias != "") { httpAliases.Add(customHttpAlias); if (customHttpAliasesUsed.Contains(customHttpAlias) == false) { customHttpAliasesUsed.Add(customHttpAlias); } } return customHttpAlias; }
private void SerializeEnabledLocales(XmlWriter writer, PortalInfo portal) { var enabledLocales = LocaleController.Instance.GetLocales(portal.PortalID); if (enabledLocales.Count > 1) { writer.WriteStartElement("locales"); if (this.chkMultilanguage.Checked) { foreach (ListItem item in this.chkLanguages.Items) { if (item.Selected) { writer.WriteElementString("locale", item.Value); } } } else { foreach (var enabledLocale in enabledLocales) { writer.WriteElementString("locale", enabledLocale.Value.Code); } } writer.WriteEndElement(); } }
/// <summary> /// Serializes a PortalInfo object /// </summary> /// <param name="xmlTemplate">Reference to XmlDocument context</param> /// <param name="nodePortal">Node to add the serialized objects</param> /// <param name="objportal">Portal to serialize</param> /// <remarks> /// The serialization uses the xml attributes defined in PortalInfo class. /// </remarks> /// <history> /// [VMasanas] 23/09/2004 Created /// </history> public void SerializeSettings( XmlDocument xmlTemplate, XmlNode nodePortal, PortalInfo objportal ) { XmlSerializer xser; StringWriter sw; XmlNode nodeSettings; XmlDocument xmlSettings; xser = new XmlSerializer( typeof( PortalInfo ) ); sw = new StringWriter(); xser.Serialize( sw, objportal ); xmlSettings = new XmlDocument(); xmlSettings.LoadXml( sw.GetStringBuilder().ToString() ); nodeSettings = xmlSettings.SelectSingleNode( "settings" ); nodeSettings.Attributes.Remove( nodeSettings.Attributes["xmlns:xsd"] ); nodeSettings.Attributes.Remove( nodeSettings.Attributes["xmlns:xsi"] ); //remove unwanted elements nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "portalid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "portalname" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "administratorid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "administratorroleid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "administratorrolename" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "registeredroleid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "registeredrolename" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "description" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "keywords" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "processorpassword" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "processoruserid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "admintabid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "supertabid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "users" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "pages" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "splashtabid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "hometabid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "logintabid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "usertabid" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "homedirectory" ) ); nodeSettings.RemoveChild(nodeSettings.SelectSingleNode("expirydate")); nodeSettings.RemoveChild(nodeSettings.SelectSingleNode("currency")); nodeSettings.RemoveChild(nodeSettings.SelectSingleNode("hostfee")); nodeSettings.RemoveChild(nodeSettings.SelectSingleNode("hostspace")); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "pagequota" ) ); nodeSettings.RemoveChild( nodeSettings.SelectSingleNode( "userquota" ) ); nodeSettings.RemoveChild(nodeSettings.SelectSingleNode("backgroundfile")); nodeSettings.RemoveChild(nodeSettings.SelectSingleNode("paymentprocessor")); nodeSettings.RemoveChild(nodeSettings.SelectSingleNode("siteloghistory")); AddSkinXml( xmlSettings, nodeSettings, SkinInfo.RootSkin, "portal", objportal.PortalID ); AddSkinXml( xmlSettings, nodeSettings, SkinInfo.RootContainer, "portal", objportal.PortalID ); nodePortal.AppendChild( xmlTemplate.ImportNode( nodeSettings, true ) ); }
private void BindLocales(PortalInfo portalInfo) { var locales = LocaleController.Instance.GetLocales(portalInfo.PortalID).Values; MultiselectLanguages.Visible = false; SingleSelectLanguages.Visible = false; if (chkMultilanguage.Checked) { MultiselectLanguages.Visible = true; chkLanguages.DataTextField = "EnglishName"; chkLanguages.DataValueField = "Code"; chkLanguages.DataSource = locales; chkLanguages.DataBind(); foreach (ListItem item in chkLanguages.Items) { if (item.Value == portalInfo.DefaultLanguage) { item.Enabled = false; item.Attributes.Add("title", string.Format(LocalizeString("DefaultLanguage"), item.Text)); lblNote.Text = string.Format(LocalizeString("lblNote"), item.Text); } item.Selected = true; } } else { languageComboBox.BindData(true); languageComboBox.SetLanguage(portalInfo.DefaultLanguage); SingleSelectLanguages.Visible = true; lblNoteSingleLanguage.Text = string.Format(LocalizeString("lblNoteSingleLanguage"), new CultureInfo(portalInfo.DefaultLanguage).EnglishName); } }
/// <summary> /// Serializes all Folders including Permissions /// </summary> /// <param name="xmlTemplate">Reference to XmlDocument context</param> /// <param name="nodeFolders"></param> /// <param name="objportal">Portal to serialize</param> /// <param name="zipFile"></param> /// <remarks> /// The serialization uses the xml attributes defined in FolderInfo class. /// </remarks> /// <history> /// [cnurse] 11/08/2004 Created /// </history> public void SerializeFolders( XmlDocument xmlTemplate, XmlNode nodeFolders, PortalInfo objportal, ref ZipOutputStream zipFile ) { // Sync db and filesystem before exporting so all required files are found FileSystemUtils.Synchronize(objportal.PortalID, objportal.AdministratorRoleId, objportal.HomeDirectoryMapPath); FolderController objFolders = new FolderController(); ArrayList arrFolders = objFolders.GetFoldersByPortal( objportal.PortalID ); XmlSerializer xser = new XmlSerializer( typeof( FolderInfo ) ); foreach( FolderInfo objFolder in arrFolders ) { StringWriter sw = new StringWriter(); xser.Serialize( sw, objFolder ); XmlDocument xmlFolder = new XmlDocument(); xmlFolder.LoadXml( sw.GetStringBuilder().ToString() ); XmlNode nodeFolder = xmlFolder.SelectSingleNode( "folder" ); nodeFolder.Attributes.Remove( nodeFolder.Attributes["xmlns:xsd"] ); nodeFolder.Attributes.Remove( nodeFolder.Attributes["xmlns:xsi"] ); //Serialize Folder Permissions XmlNode nodePermissions = xmlTemplate.CreateElement( "folderpermissions" ); SerializeFolderPermissions( xmlTemplate, nodePermissions, objportal, objFolder.FolderPath ); nodeFolder.AppendChild( xmlFolder.ImportNode( nodePermissions, true ) ); // Serialize files XmlNode nodeFiles = xmlTemplate.CreateElement( "files" ); SerializeFiles( xmlTemplate, nodeFiles, objportal, objFolder.FolderPath, ref zipFile ); nodeFolder.AppendChild( xmlFolder.ImportNode( nodeFiles, true ) ); nodeFolders.AppendChild( xmlTemplate.ImportNode( nodeFolder, true ) ); } }
private void BindTree(PortalInfo portal) { ctlPages.Nodes.Clear(); var rootNode = new RadTreeNode { Text = PortalSettings.PortalName, ImageUrl = IconPortal, Value = Null.NullInteger.ToString(CultureInfo.InvariantCulture), Expanded = true, AllowEdit = false, EnableContextMenu = true, Checked = true }; rootNode.Attributes.Add("isPortalRoot", "True"); //var tabs = new TabCollection(); List<TabInfo> tabs; if (chkMultilanguage.Checked) { tabs = TabController.GetPortalTabs(TabController.GetTabsBySortOrder(portal.PortalID, portal.DefaultLanguage, true), Null.NullInteger, false, "<" + Localization.GetString("None_Specified") + ">", true, false, true, false, false); //Tabs = tabController.GetTabsByPortal(portal.PortalID).WithCulture(portal.DefaultLanguage, true); } else { tabs = TabController.GetPortalTabs(TabController.GetTabsBySortOrder(portal.PortalID, languageComboBox.SelectedValue, true), Null.NullInteger, false, "<" + Localization.GetString("None_Specified") + ">", true, false, true, false, false); //tabs = tabController.GetTabsByPortal(portal.PortalID); } foreach (var tab in tabs) //.Values) { if (tab.Level == 0) { string tooltip; var nodeIcon = GetNodeIcon(tab, out tooltip); var node = new RadTreeNode { Text = string.Format("{0} {1}", tab.TabName, GetNodeStatusIcon(tab)), Value = tab.TabID.ToString(CultureInfo.InvariantCulture), AllowEdit = true, ImageUrl = nodeIcon, ToolTip = tooltip, Checked = true }; AddChildNodes(node, portal); rootNode.Nodes.Add(node); } } ctlPages.Nodes.Add(rootNode); }
/// <summary> /// Serializes all Profile Definitions /// </summary> /// <param name="xmlTemplate">Reference to XmlDocument context</param> /// <param name="nodeProfileDefinitions">Node to add the serialized objects</param> /// <param name="objportal">Portal to serialize</param> /// <remarks> /// The serialization uses the xml attributes defined in ProfilePropertyDefinition class. /// </remarks> /// <history> /// </history> public void SerializeProfileDefinitions(XmlDocument xmlTemplate, XmlNode nodeProfileDefinitions, PortalInfo objportal) { ListController objListController = new ListController(); XmlSerializer xser = new XmlSerializer(typeof(ProfilePropertyDefinition)); foreach (ProfilePropertyDefinition objProfileProperty in ProfileController.GetPropertyDefinitionsByPortal(objportal.PortalID)) { StringWriter sw = new StringWriter(); xser.Serialize(sw, objProfileProperty); XmlDocument xmlPropertyDefinition = new XmlDocument(); xmlPropertyDefinition.LoadXml(sw.GetStringBuilder().ToString()); XmlNode nodeProfileDefinition = xmlPropertyDefinition.SelectSingleNode("profiledefinition"); nodeProfileDefinition.Attributes.Remove(nodeProfileDefinition.Attributes["xmlns:xsd"]); nodeProfileDefinition.Attributes.Remove(nodeProfileDefinition.Attributes["xmlns:xsi"]); ListEntryInfo objList = objListController.GetListEntryInfo(objProfileProperty.DataType); XmlNode newnode = xmlPropertyDefinition.CreateElement("datatype"); if (objList == null) { newnode.InnerXml = "Unknown"; } else { newnode.InnerXml = objList.Value; } nodeProfileDefinition.AppendChild(newnode); nodeProfileDefinitions.AppendChild(xmlTemplate.ImportNode(nodeProfileDefinition, true)); } }
private void AddChildNodes(RadTreeNode parentNode, PortalInfo portal) { parentNode.Nodes.Clear(); var parentId = int.Parse(parentNode.Value); var Tabs = TabController.Instance.GetTabsByPortal(portal.PortalID).WithCulture(languageComboBox.SelectedValue, true).WithParentId(parentId); foreach (var tab in Tabs) { if (tab.ParentId == parentId) { string tooltip; var nodeIcon = GetNodeIcon(tab, out tooltip); var node = new RadTreeNode { Text = string.Format("{0} {1}", tab.TabName, GetNodeStatusIcon(tab)), Value = tab.TabID.ToString(CultureInfo.InvariantCulture), AllowEdit = true, ImageUrl = nodeIcon, ToolTip = tooltip, Checked = true }; AddChildNodes(node, portal); parentNode.Nodes.Add(node); } } }
/// <summary> /// Serializes all portal Tabs /// </summary> /// <param name="xmlTemplate">Reference to XmlDocument context</param> /// <param name="nodeTabs">Node to add the serialized objects</param> /// <param name="objportal">Portal to serialize</param> /// <param name="hRoles">A hastable with all serialized roles</param> /// <remarks> /// Only portal tabs will be exported to the template, Admin tabs are not exported. /// On each tab, all modules will also be exported. /// </remarks> /// <history> /// [VMasanas] 23/09/2004 Created /// </history> public void SerializeTabs( XmlDocument xmlTemplate, XmlNode nodeTabs, PortalInfo objportal, Hashtable hRoles ) { TabController objtabs = new TabController(); //supporting object to build the tab hierarchy Hashtable hTabs = new Hashtable(); XmlSerializer xserTabs = new XmlSerializer( typeof( TabInfo ) ); foreach( TabInfo objtab in objtabs.GetTabs( objportal.PortalID ) ) { //if not an admin tab & not deleted if( objtab.TabOrder < 10000 && ! objtab.IsDeleted ) { StringWriter sw = new StringWriter(); xserTabs.Serialize( sw, objtab ); XmlDocument xmlTab = new XmlDocument(); xmlTab.LoadXml( sw.GetStringBuilder().ToString() ); XmlNode nodeTab = xmlTab.SelectSingleNode( "tab" ); nodeTab.Attributes.Remove( nodeTab.Attributes["xmlns:xsd"] ); nodeTab.Attributes.Remove( nodeTab.Attributes["xmlns:xsi"] ); XmlNode newnode; if( objtab.TabID == objportal.SplashTabId ) { newnode = xmlTab.CreateElement( "tabtype" ); newnode.InnerXml = "splashtab"; nodeTab.AppendChild( newnode ); } else if( objtab.TabID == objportal.HomeTabId ) { newnode = xmlTab.CreateElement( "tabtype" ); newnode.InnerXml = "hometab"; nodeTab.AppendChild( newnode ); } else if( objtab.TabID == objportal.UserTabId ) { newnode = xmlTab.CreateElement( "tabtype" ); newnode.InnerXml = "usertab"; nodeTab.AppendChild( newnode ); } else if( objtab.TabID == objportal.LoginTabId ) { newnode = xmlTab.CreateElement( "tabtype" ); newnode.InnerXml = "logintab"; nodeTab.AppendChild( newnode ); } if( ! Null.IsNull( objtab.ParentId ) ) { newnode = xmlTab.CreateElement( "parent" ); newnode.InnerXml = Server.HtmlEncode( hTabs[objtab.ParentId].ToString() ); nodeTab.AppendChild( newnode ); // save tab as: ParentTabName/CurrentTabName hTabs.Add( objtab.TabID, hTabs[objtab.ParentId] + "/" + objtab.TabName ); } else { // save tab as: CurrentTabName hTabs.Add( objtab.TabID, objtab.TabName ); } // Serialize modules XmlNode nodePanes; nodePanes = nodeTab.AppendChild( xmlTab.CreateElement( "panes" ) ); ModuleController objmodules = new ModuleController(); DesktopModuleController objDesktopModules = new DesktopModuleController(); ModuleDefinitionController objModuleDefController = new ModuleDefinitionController(); XmlSerializer xserModules = new XmlSerializer( typeof( ModuleInfo ) ); Dictionary<int, ModuleInfo> dict = objmodules.GetTabModules(objtab.TabID); foreach( KeyValuePair<int, ModuleInfo> pair in dict ) { ModuleInfo objmodule = pair.Value; if (!objmodule.IsDeleted) { sw = new StringWriter(); xserModules.Serialize(sw, objmodule); XmlDocument xmlModule = new XmlDocument(); xmlModule.LoadXml(sw.GetStringBuilder().ToString()); XmlNode nodeModule = xmlModule.SelectSingleNode("module"); nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsd"]); nodeModule.Attributes.Remove(nodeModule.Attributes["xmlns:xsi"]); if (nodePanes.SelectSingleNode("descendant::pane[name='" + objmodule.PaneName + "']") == null) { // new pane found XmlNode nodePane = xmlModule.CreateElement("pane"); XmlNode nodeName = nodePane.AppendChild(xmlModule.CreateElement("name")); nodeName.InnerText = objmodule.PaneName; nodePane.AppendChild(xmlModule.CreateElement("modules")); nodePanes.AppendChild(xmlTab.ImportNode(nodePane, true)); } XmlNode nodeModules = nodePanes.SelectSingleNode("descendant::pane[name='" + objmodule.PaneName + "']/modules"); newnode = xmlModule.CreateElement("definition"); ModuleDefinitionInfo objModuleDef = objModuleDefController.GetModuleDefinition(objmodule.ModuleDefID); newnode.InnerText = objDesktopModules.GetDesktopModule(objModuleDef.DesktopModuleID).ModuleName; nodeModule.AppendChild(newnode); //Add Module Definition Info XmlNode nodeDefinition = xmlModule.CreateElement("moduledefinition"); nodeDefinition.InnerText = objModuleDef.FriendlyName; nodeModule.AppendChild(nodeDefinition); if (chkContent.Checked) { AddContent(nodeModule, objmodule); } nodeModules.AppendChild(xmlTab.ImportNode(nodeModule, true)); } } nodeTabs.AppendChild( xmlTemplate.ImportNode( nodeTab, true ) ); } } }
/// <summary> /// Renders the <paramref name="portal" /> node. /// </summary> /// <param name="portal">The <paramref name="portal" />.</param> /// <param name="moduleController">The module controller.</param> /// <param name="editorHostSettings">The editor host settings.</param> private void RenderPortalNode(PortalInfo portal, ModuleController moduleController, List<EditorHostSetting> editorHostSettings) { var portalKey = string.Format("DNNCKP#{0}#", portal.PortalID); var portalSettingsExists = SettingsUtil.CheckExistsPortalOrPageSettings(editorHostSettings, portalKey); // Portals var portalNode = new TreeNode { Text = portal.PortalName, Value = string.Format("p{0}", portal.PortalID), ImageUrl = portalSettingsExists ? "../images/PortalHasSetting.png" : "../images/PortalNoSetting.png", Expanded = this.PortalOnly.Checked }; foreach (var tabInfo in TabController.GetTabsByParent(-1, portal.PortalID)) { this.RenderTabNode(portalNode, tabInfo, moduleController, editorHostSettings); } this.PortalTabsAndModulesTree.Nodes.Add(portalNode); }
public PortalSettings(PortalInfo portal) : this(Null.NullInteger, portal) { }
public void RemovePortalFromGroup(PortalInfo portal, PortalGroupInfo portalGroup, bool copyUsers, UserCopiedCallback callback) { //Argument Contract Requires.NotNull("portal", portal); Requires.PropertyNotNegative("portal", "PortalId", portal.PortalID); Requires.NotNull("portalGroup", portalGroup); Requires.PropertyNotNegative("portalGroup", "PortalGroupId", portalGroup.PortalGroupId); Requires.PropertyNotNegative("portalGroup", "MasterPortalId", portalGroup.MasterPortalId); //Callback to update progress bar var args = new UserCopiedEventArgs { TotalUsers = 0, UserNo = 0, UserName = "", PortalName = portal.PortalName, Stage = "startingremove" }; callback(args); //Remove portal from group DeleteSharedModules(portal); portal.PortalGroupID = -1; _portalController.UpdatePortalInfo(portal); var userNo = 0; if (copyUsers) { var users = UserController.GetUsers(portalGroup.MasterPortalId); foreach (UserInfo masterUser in users) { userNo += 1; //Copy user to portal UserController.CopyUserToPortal(masterUser, portal, false, false); //Callback to update progress bar args = new UserCopiedEventArgs { TotalUsers = users.Count, UserNo = userNo, UserName = masterUser.Username, PortalName = portal.PortalName }; callback(args); } } else { //Get admin users var roleController = new RoleController(); var adminUsers = roleController.GetUsersByRoleName(Null.NullInteger, portal.AdministratorRoleName) .Cast <UserInfo>() .Where(u => roleController.GetUserRole(portal.PortalID, u.UserID, portal.AdministratorRoleId) != null); foreach (var user in adminUsers) { //Copy Administrator to portal UserController.CopyUserToPortal(user, portal, false, false); //Callback to update progress bar args = new UserCopiedEventArgs { TotalUsers = 1, UserNo = ++userNo, UserName = user.Username, PortalName = portal.PortalName }; callback(args); } } //Callback to update progress bar args = new UserCopiedEventArgs { TotalUsers = 1, UserNo = userNo, UserName = "", PortalName = portal.PortalName, Stage = "finishedremove", PortalGroupId = portalGroup.PortalGroupId }; callback(args); }
public void SetMappedDirectory(PortalInfo portalInfo, HttpContext context) { try { string virtualDirectory = Common.Globals.ApplicationPath + "/" + portalInfo.HomeDirectory + "/"; SetMappedDirectory(virtualDirectory, context); } catch (Exception exc) { Exceptions.Exceptions.LogException(exc); } }
public void UpdatePortalInfo(PortalInfo portal, bool clearCache) { UpdatePortalInternal(portal, clearCache); }
public static List<KeyValuePair<string, string>> GetSkins(PortalInfo portalInfo, string skinRoot, SkinScope scope) { var skins = new List<KeyValuePair<string, string>>(); switch (scope) { case SkinScope.Host: //load host skins skins = GetHostSkins(skinRoot); break; case SkinScope.Site: //load portal skins skins = GetPortalSkins(portalInfo, skinRoot); break; case SkinScope.All: skins = GetHostSkins(skinRoot); skins.AddRange(GetPortalSkins(portalInfo, skinRoot)); break; } return skins; }
public void AddPortalToGroup(PortalInfo portal, PortalGroupInfo portalGroup, UserCopiedCallback callback) { //Argument Contract Requires.NotNull("portal", portal); Requires.PropertyNotNegative("portal", "PortalId", portal.PortalID); Requires.NotNull("portalGroup", portalGroup); Requires.PropertyNotNegative("portalGroup", "PortalGroupId", portalGroup.PortalGroupId); Requires.PropertyNotNegative("portalGroup", "MasterPortalId", portalGroup.MasterPortalId); var masterPortal = _portalController.GetPortal(portalGroup.MasterPortalId); var users = UserController.GetUsers(portal.PortalID); var masterUsers = UserController.GetUsers(masterPortal.PortalID); var userNo = 0; foreach (UserInfo user in users) { userNo += 1; //move user to master portal UserController.CopyUserToPortal(user, masterPortal, true, true); //Callback to update progress bar var args = new UserCopiedEventArgs { TotalUsers = users.Count + masterUsers.Count, UserNo = userNo, UserName = user.Username, PortalName = portal.PortalName }; callback(args); } var roleController = new RoleController(); //Assign the new portal's roles to master portal users foreach (UserInfo user in masterUsers) { userNo += 1; foreach (var role in TestableRoleController.Instance.GetRoles(portal.PortalID, role => role.AutoAssignment && role.Status == RoleStatus.Approved)) { roleController.AddUserRole(masterPortal.PortalID, user.UserID, role.RoleID, Null.NullDate, Null.NullDate); } //Callback to update progress bar var args = new UserCopiedEventArgs { TotalUsers = users.Count + masterUsers.Count, UserNo = userNo, UserName = user.Username, PortalName = portal.PortalName }; callback(args); } //Remove Profile Definitions foreach (ProfilePropertyDefinition definition in ProfileController.GetPropertyDefinitionsByPortal(portal.PortalID)) { ProfileController.DeletePropertyDefinition(definition); } //Add portal to group portal.PortalGroupID = portalGroup.PortalGroupId; _portalController.UpdatePortalInfo(portal); }
///----------------------------------------------------------------------------- ///<summary> /// AddAdminPage adds an Admin Tab Page ///</summary> ///<param name = "portal">The Portal</param> ///<param name = "tabName">The Name to give this new Tab</param> ///<param name="description"></param> ///<param name = "tabIconFile">The Icon for this new Tab</param> ///<param name="tabIconFileLarge"></param> ///<param name = "isVisible">A flag indicating whether the tab is visible</param> ///<history> /// [cnurse] 11/11/2004 created ///</history> ///----------------------------------------------------------------------------- public static TabInfo AddAdminPage(PortalInfo portal, string tabName, string description, string tabIconFile, string tabIconFileLarge, bool isVisible) { DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddAdminPage:" + tabName); TabInfo adminPage = TabController.Instance.GetTab(portal.AdminTabId, portal.PortalID, false); if ((adminPage != null)) { var tabPermissionCollection = new TabPermissionCollection(); AddPagePermission(tabPermissionCollection, "View", Convert.ToInt32(portal.AdministratorRoleId)); AddPagePermission(tabPermissionCollection, "Edit", Convert.ToInt32(portal.AdministratorRoleId)); return AddPage(adminPage, tabName, description, tabIconFile, tabIconFileLarge, isVisible, tabPermissionCollection, true); } return null; }
private IEnumerable <ModuleInfo> GetSharedModulesByPortal(PortalInfo portal) { return(CBO.FillCollection <ModuleInfo>(_dataService.GetSharedModulesByPortal(portal))); }