public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound) { PortalSettings portalSettings = PortalController.Instance.GetCurrentPortalSettings(); string outputFormat = strFormat == string.Empty ? "D" : strFormat; switch (strPropertyName.ToLowerInvariant()) { case "edit": if (IsEditable) { string editUrl = Globals.NavigateURL("Edit", $"mid={ModuleID.ToString(CultureInfo.InvariantCulture)}", $"itemid={ItemID.ToString(CultureInfo.InvariantCulture)}"); if (portalSettings.EnablePopUps) { editUrl = UrlUtils.PopUpUrl(editUrl, null, portalSettings, false, false); } return("<a href=\"" + editUrl + "\"><img border=\"0\" src=\"" + Globals.ApplicationPath + "/icons/sigma/Edit_16X16_Standard_2.png\" alt=\"" + Localization.GetString("EditAnnouncement.Text", _localResourceFile) + "\" /></a>"); } return(string.Empty); case "itemid": return(ItemID.ToString(outputFormat, formatProvider)); case "moduleid": return(ModuleID.ToString(outputFormat, formatProvider)); case "title": return(PropertyAccess.FormatString(Title, strFormat)); case "url": return(PropertyAccess.FormatString(string.IsNullOrEmpty(URL) ? URL : Utilities.FormatUrl(URL, portalSettings.ActiveTab.TabID, ModuleID, TrackClicks), strFormat)); case "description": return(HttpUtility.HtmlDecode(Description)); case "imagesource": case "rawimage": string strValue = ImageSource; if (strPropertyName.ToLowerInvariant() == "imagesource" && string.IsNullOrEmpty(strFormat)) { strFormat = "<img src=\"{0}\" alt=\"" + Title + "\" />"; } //Retrieve the path to the imagefile if (!string.IsNullOrEmpty(strValue)) { //Get path from filesystem only when the image comes from within DNN. // this is now legacy, from version 7.0.0, a real filename is saved in the DB if (ImageSource != null && ImageSource.StartsWith("FileID=")) { var objFile = FileManager.Instance.GetFile(Convert.ToInt32(strValue.Substring(7))); if (objFile != null) { strValue = portalSettings.HomeDirectory + objFile.Folder + objFile.FileName; } else { strValue = ""; } } else { if (ImageSource != null && !ImageSource.ToLowerInvariant().StartsWith("http")) { strValue = portalSettings.HomeDirectory + ImageSource; } } if (strValue != null) { strValue = PropertyAccess.FormatString(strValue, strFormat); } } if (strValue == null) { return(""); } else { return(strValue); } case "vieworder": return(ViewOrder.ToString(outputFormat, formatProvider)); case "createdbyuserid": return(CreatedByUserID.ToString(outputFormat, formatProvider)); case "createdbyuser": UserInfo tmpUser = CreatedByUser(portalSettings.PortalId); return(tmpUser != null ? tmpUser.DisplayName : Localization.GetString("userUnknown.Text", _localResourceFile)); case "lastmodifiedbyuserid": return(LastModifiedByUserID.ToString(outputFormat, formatProvider)); case "lastmodifiedbyuser": UserInfo tmpUser2 = LastModifiedByUser(portalSettings.PortalId); return(tmpUser2 != null ? tmpUser2.DisplayName : Localization.GetString("userUnknown.Text", _localResourceFile)); case "trackclicks": return(PropertyAccess.Boolean2LocalizedYesNo(TrackClicks, formatProvider)); case "newwindow": return(NewWindow ? "_blank" : "_self"); case "createddate": case "createdondate": return(CreatedOnDate.ToString(outputFormat, formatProvider)); case "lastmodifiedondate": return(LastModifiedOnDate.ToString(outputFormat, formatProvider)); case "publishdate": return(PublishDate.HasValue ? (PublishDate.Value.ToString(outputFormat, formatProvider)) : ""); case "expiredate": return(ExpireDate.HasValue ? (ExpireDate.Value.ToString(outputFormat, formatProvider)) : ""); case "more": return(Localization.GetString("More.Text", _localResourceFile)); case "readmore": string strTarget = NewWindow ? "_new" : "_self"; return(!(string.IsNullOrEmpty(URL)) ? "<a href=\"" + Utilities.FormatUrl(URL, portalSettings.ActiveTab.TabID, ModuleID, TrackClicks) + "\" target=\"" + strTarget + "\">" + Localization.GetString("More.Text", _localResourceFile) + "</a>" : ""); case "permalink": return(Permalink()); case "subscribe": default: PropertyNotFound = true; break; } return(Null.NullString); }
public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, UserInfo AccessingUser, Scope CurrentScope, ref bool PropertyNotFound) { string OutputFormat = string.Empty; if (strFormat == string.Empty) { OutputFormat = "g"; } string lowerPropertyName = strPropertyName.ToLower(); if (CurrentScope == Scope.NoSettings) { PropertyNotFound = true; return(PropertyAccess.ContentLocked); } PropertyNotFound = true; string result = string.Empty; bool PublicProperty = true; switch (lowerPropertyName) { case "tabid": PublicProperty = true; PropertyNotFound = false; result = (this.TabID.ToString(OutputFormat, formatProvider)); break; case "taborder": PublicProperty = false; PropertyNotFound = false; result = (this.TabOrder.ToString(OutputFormat, formatProvider)); break; case "portalid": PublicProperty = true; PropertyNotFound = false; result = (this.PortalID.ToString(OutputFormat, formatProvider)); break; case "tabname": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.LocalizedTabName, strFormat); break; case "isvisible": PublicProperty = false; PropertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(this.IsVisible, formatProvider)); break; case "parentid": PublicProperty = false; PropertyNotFound = false; result = (this.ParentId.ToString(OutputFormat, formatProvider)); break; case "level": PublicProperty = false; PropertyNotFound = false; result = (this.Level.ToString(OutputFormat, formatProvider)); break; case "iconfile": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.IconFile, strFormat); break; case "iconfilelarge": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.IconFileLarge, strFormat); break; case "disablelink": PublicProperty = false; PropertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(this.DisableLink, formatProvider)); break; case "title": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.Title, strFormat); break; case "description": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.Description, strFormat); break; case "keywords": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.KeyWords, strFormat); break; case "isdeleted": PublicProperty = false; PropertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(this.IsDeleted, formatProvider)); break; case "url": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.Url, strFormat); break; case "skinsrc": PublicProperty = false; PropertyNotFound = false; result = PropertyAccess.FormatString(this.SkinSrc, strFormat); break; case "containersrc": PublicProperty = false; PropertyNotFound = false; result = PropertyAccess.FormatString(this.ContainerSrc, strFormat); break; case "tabpath": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.TabPath, strFormat); break; case "startdate": PublicProperty = false; PropertyNotFound = false; result = (this.StartDate.ToString(OutputFormat, formatProvider)); break; case "enddate": PublicProperty = false; PropertyNotFound = false; result = (this.EndDate.ToString(OutputFormat, formatProvider)); break; case "haschildren": PublicProperty = false; PropertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(this.HasChildren, formatProvider)); break; case "refreshinterval": PublicProperty = false; PropertyNotFound = false; result = (this.RefreshInterval.ToString(OutputFormat, formatProvider)); break; case "pageheadtext": PublicProperty = false; PropertyNotFound = false; result = PropertyAccess.FormatString(this.PageHeadText, strFormat); break; case "skinpath": PublicProperty = false; PropertyNotFound = false; result = PropertyAccess.FormatString(this.SkinPath, strFormat); break; case "skindoctype": PublicProperty = false; PropertyNotFound = false; result = PropertyAccess.FormatString(this.SkinDoctype, strFormat); break; case "containerpath": PublicProperty = false; PropertyNotFound = false; result = PropertyAccess.FormatString(this.ContainerPath, strFormat); break; case "issupertab": PublicProperty = false; PropertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(this.IsSuperTab, formatProvider)); break; case "fullurl": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.FullUrl, strFormat); break; case "sitemappriority": PublicProperty = true; PropertyNotFound = false; result = PropertyAccess.FormatString(this.SiteMapPriority.ToString(), strFormat); break; } if (!PublicProperty && CurrentScope != Scope.Debug) { PropertyNotFound = true; result = PropertyAccess.ContentLocked; } return(result); }
public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope currentScope, ref bool propertyNotFound) { string outputFormat = string.Empty; if (format == string.Empty) { outputFormat = "g"; } if (currentScope == Scope.NoSettings) { propertyNotFound = true; return(PropertyAccess.ContentLocked); } propertyNotFound = true; string result = string.Empty; bool isPublic = true; switch (propertyName.ToLowerInvariant()) { case "portalid": propertyNotFound = false; result = (PortalID.ToString(outputFormat, formatProvider)); break; case "displayportalid": propertyNotFound = false; result = (OwnerPortalID.ToString(outputFormat, formatProvider)); break; case "tabid": propertyNotFound = false; result = (TabID.ToString(outputFormat, formatProvider)); break; case "tabmoduleid": propertyNotFound = false; result = (TabModuleID.ToString(outputFormat, formatProvider)); break; case "moduleid": propertyNotFound = false; result = (ModuleID.ToString(outputFormat, formatProvider)); break; case "moduledefid": isPublic = false; propertyNotFound = false; result = (ModuleDefID.ToString(outputFormat, formatProvider)); break; case "moduleorder": isPublic = false; propertyNotFound = false; result = (ModuleOrder.ToString(outputFormat, formatProvider)); break; case "panename": propertyNotFound = false; result = PropertyAccess.FormatString(PaneName, format); break; case "moduletitle": propertyNotFound = false; result = PropertyAccess.FormatString(ModuleTitle, format); break; case "cachetime": isPublic = false; propertyNotFound = false; result = (CacheTime.ToString(outputFormat, formatProvider)); break; case "cachemethod": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(CacheMethod, format); break; case "alignment": propertyNotFound = false; result = PropertyAccess.FormatString(Alignment, format); break; case "color": propertyNotFound = false; result = PropertyAccess.FormatString(Color, format); break; case "border": propertyNotFound = false; result = PropertyAccess.FormatString(Border, format); break; case "iconfile": propertyNotFound = false; result = PropertyAccess.FormatString(IconFile, format); break; case "alltabs": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(AllTabs, formatProvider)); break; case "isdeleted": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsDeleted, formatProvider)); break; case "header": propertyNotFound = false; result = PropertyAccess.FormatString(Header, format); break; case "footer": propertyNotFound = false; result = PropertyAccess.FormatString(Footer, format); break; case "startdate": isPublic = false; propertyNotFound = false; result = (StartDate.ToString(outputFormat, formatProvider)); break; case "enddate": isPublic = false; propertyNotFound = false; result = (EndDate.ToString(outputFormat, formatProvider)); break; case "containersrc": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(ContainerSrc, format); break; case "displaytitle": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DisplayTitle, formatProvider)); break; case "displayprint": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DisplayPrint, formatProvider)); break; case "displaysyndicate": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DisplaySyndicate, formatProvider)); break; case "iswebslice": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsWebSlice, formatProvider)); break; case "webslicetitle": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(WebSliceTitle, format); break; case "websliceexpirydate": isPublic = false; propertyNotFound = false; result = (WebSliceExpiryDate.ToString(outputFormat, formatProvider)); break; case "webslicettl": isPublic = false; propertyNotFound = false; result = (WebSliceTTL.ToString(outputFormat, formatProvider)); break; case "inheritviewpermissions": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(InheritViewPermissions, formatProvider)); break; case "isshareable": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsShareable, formatProvider)); break; case "isshareableviewonly": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsShareableViewOnly, formatProvider)); break; case "desktopmoduleid": isPublic = false; propertyNotFound = false; result = (DesktopModuleID.ToString(outputFormat, formatProvider)); break; case "friendlyname": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.FriendlyName, format); break; case "foldername": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.FolderName, format); break; case "description": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.Description, format); break; case "version": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.Version, format); break; case "ispremium": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsPremium, formatProvider)); break; case "isadmin": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsAdmin, formatProvider)); break; case "businesscontrollerclass": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.BusinessControllerClass, format); break; case "modulename": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.ModuleName, format); break; case "supportedfeatures": isPublic = false; propertyNotFound = false; result = (DesktopModule.SupportedFeatures.ToString(outputFormat, formatProvider)); break; case "compatibleversions": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.CompatibleVersions, format); break; case "dependencies": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.Dependencies, format); break; case "permissions": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.Permissions, format); break; case "defaultcachetime": isPublic = false; propertyNotFound = false; result = (ModuleDefinition.DefaultCacheTime.ToString(outputFormat, formatProvider)); break; case "modulecontrolid": isPublic = false; propertyNotFound = false; result = (ModuleControlId.ToString(outputFormat, formatProvider)); break; case "controlsrc": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(ModuleControl.ControlSrc, format); break; case "controltitle": propertyNotFound = false; result = PropertyAccess.FormatString(ModuleControl.ControlTitle, format); break; case "helpurl": propertyNotFound = false; result = PropertyAccess.FormatString(ModuleControl.HelpURL, format); break; case "supportspartialrendering": propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(ModuleControl.SupportsPartialRendering, formatProvider)); break; case "containerpath": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(ContainerPath, format); break; case "panemoduleindex": isPublic = false; propertyNotFound = false; result = (PaneModuleIndex.ToString(outputFormat, formatProvider)); break; case "panemodulecount": isPublic = false; propertyNotFound = false; result = (PaneModuleCount.ToString(outputFormat, formatProvider)); break; case "isdefaultmodule": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsDefaultModule, formatProvider)); break; case "allmodules": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(AllModules, formatProvider)); break; case "isportable": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsPortable, formatProvider)); break; case "issearchable": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsSearchable, formatProvider)); break; case "isupgradeable": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsUpgradeable, formatProvider)); break; case "adminpage": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.AdminPage, format); break; case "hostpage": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.HostPage, format); break; } if (!isPublic && currentScope != Scope.Debug) { propertyNotFound = true; result = PropertyAccess.ContentLocked; } return(result); }
public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound) { var outputFormat = string.Empty; if (format == string.Empty) { outputFormat = "g"; } var lowerPropertyName = propertyName.ToLower(); if (accessLevel == Scope.NoSettings) { propertyNotFound = true; return(PropertyAccess.ContentLocked); } propertyNotFound = true; var result = string.Empty; var isPublic = true; switch (lowerPropertyName) { case "url": propertyNotFound = false; result = PropertyAccess.FormatString(PortalAlias.HTTPAlias, format); break; case "portalid": propertyNotFound = false; result = (PortalId.ToString(outputFormat, formatProvider)); break; case "portalname": propertyNotFound = false; result = PropertyAccess.FormatString(PortalName, format); break; case "homedirectory": propertyNotFound = false; result = PropertyAccess.FormatString(HomeDirectory, format); break; case "homedirectorymappath": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(HomeDirectoryMapPath, format); break; case "logofile": propertyNotFound = false; result = PropertyAccess.FormatString(LogoFile, format); break; case "footertext": propertyNotFound = false; var footerText = FooterText.Replace("[year]", DateTime.Now.Year.ToString()); result = PropertyAccess.FormatString(footerText, format); break; case "expirydate": isPublic = false; propertyNotFound = false; result = (ExpiryDate.ToString(outputFormat, formatProvider)); break; case "userregistration": isPublic = false; propertyNotFound = false; result = (UserRegistration.ToString(outputFormat, formatProvider)); break; case "banneradvertising": isPublic = false; propertyNotFound = false; result = (BannerAdvertising.ToString(outputFormat, formatProvider)); break; case "currency": propertyNotFound = false; result = PropertyAccess.FormatString(Currency, format); break; case "administratorid": isPublic = false; propertyNotFound = false; result = (AdministratorId.ToString(outputFormat, formatProvider)); break; case "email": propertyNotFound = false; result = PropertyAccess.FormatString(Email, format); break; case "hostfee": isPublic = false; propertyNotFound = false; result = (HostFee.ToString(outputFormat, formatProvider)); break; case "hostspace": isPublic = false; propertyNotFound = false; result = (HostSpace.ToString(outputFormat, formatProvider)); break; case "pagequota": isPublic = false; propertyNotFound = false; result = (PageQuota.ToString(outputFormat, formatProvider)); break; case "userquota": isPublic = false; propertyNotFound = false; result = (UserQuota.ToString(outputFormat, formatProvider)); break; case "administratorroleid": isPublic = false; propertyNotFound = false; result = (AdministratorRoleId.ToString(outputFormat, formatProvider)); break; case "administratorrolename": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(AdministratorRoleName, format); break; case "registeredroleid": isPublic = false; propertyNotFound = false; result = (RegisteredRoleId.ToString(outputFormat, formatProvider)); break; case "registeredrolename": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(RegisteredRoleName, format); break; case "description": propertyNotFound = false; result = PropertyAccess.FormatString(Description, format); break; case "keywords": propertyNotFound = false; result = PropertyAccess.FormatString(KeyWords, format); break; case "backgroundfile": propertyNotFound = false; result = PropertyAccess.FormatString(BackgroundFile, format); break; case "siteloghistory": isPublic = false; propertyNotFound = false; result = SiteLogHistory.ToString(outputFormat, formatProvider); break; case "admintabid": isPublic = false; propertyNotFound = false; result = AdminTabId.ToString(outputFormat, formatProvider); break; case "supertabid": isPublic = false; propertyNotFound = false; result = SuperTabId.ToString(outputFormat, formatProvider); break; case "splashtabid": isPublic = false; propertyNotFound = false; result = SplashTabId.ToString(outputFormat, formatProvider); break; case "hometabid": isPublic = false; propertyNotFound = false; result = HomeTabId.ToString(outputFormat, formatProvider); break; case "logintabid": isPublic = false; propertyNotFound = false; result = LoginTabId.ToString(outputFormat, formatProvider); break; case "registertabid": isPublic = false; propertyNotFound = false; result = RegisterTabId.ToString(outputFormat, formatProvider); break; case "usertabid": isPublic = false; propertyNotFound = false; result = UserTabId.ToString(outputFormat, formatProvider); break; case "defaultlanguage": propertyNotFound = false; result = PropertyAccess.FormatString(DefaultLanguage, format); break; case "users": isPublic = false; propertyNotFound = false; result = Users.ToString(outputFormat, formatProvider); break; case "pages": isPublic = false; propertyNotFound = false; result = Pages.ToString(outputFormat, formatProvider); break; case "contentvisible": isPublic = false; break; case "controlpanelvisible": isPublic = false; propertyNotFound = false; result = PropertyAccess.Boolean2LocalizedYesNo(ControlPanelVisible, formatProvider); break; } if (!isPublic && accessLevel != Scope.Debug) { propertyNotFound = true; result = PropertyAccess.ContentLocked; } return(result); }