public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound) { switch (strPropertyName.ToLower()) { case "apikey": // VarChar return(PropertyAccess.FormatString(ApiKey, strFormat)); case "conferenceid": // Int return(ConferenceId.ToString(strFormat, formatProvider)); case "expires": // DateTime if (Expires == null) { return(""); } ; return(((DateTime)Expires).ToString(strFormat, formatProvider)); case "createdbyuserid": // Int return(CreatedByUserID.ToString(strFormat, formatProvider)); case "createdondate": // DateTime return(CreatedOnDate.ToString(strFormat, formatProvider)); default: propertyNotFound = true; break; } return(Null.NullString); }
public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound) { PortalSettings portalSettings = PortalController.GetCurrentPortalSettings(); string outputFormat = strFormat == string.Empty ? "D" : strFormat; switch (strPropertyName.ToLowerInvariant()) { case "edit": if (IsEditable) { string editUrl = Globals.NavigateURL(portalSettings.ActiveTab.TabID, false, portalSettings, "Edit", CultureInfo.CurrentCulture.Name, "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 (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.StartsWith("FileID=")) { var fileCnt = new FileController(); FileInfo objFile = fileCnt.GetFileById(Convert.ToInt32(strValue.Substring(7)), portalSettings.PortalId); if (objFile != null) { strValue = portalSettings.HomeDirectory + objFile.Folder + objFile.FileName; } else { strValue = ""; } } else { if (!ImageSource.ToLowerInvariant().StartsWith("http")) { strValue = portalSettings.HomeDirectory + ImageSource; } } strValue = PropertyAccess.FormatString(strValue, strFormat); } 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, DotNetNuke.Entities.Users.UserInfo AccessingUser, Scope CurrentScope, ref bool PropertyNotFound) { string OutputFormat = string.Empty; if (strFormat == string.Empty) { OutputFormat = "g"; } PropertyNotFound = true; //Content locked for NoSettings if (CurrentScope == Scope.NoSettings) { return(PropertyAccess.ContentLocked); } string result = string.Empty; bool PublicProperty = true; switch (strPropertyName.ToLower()) { case "month": case "months": { PublicProperty = true; PropertyNotFound = false; result = Months.ToString(formatProvider); break; } case "day": case "days": { PublicProperty = true; PropertyNotFound = false; result = Days.ToString(formatProvider); break; } case "dayofweek": case "daysofweek": { PublicProperty = true; PropertyNotFound = false; result = DaysofWeek.ToString(formatProvider); break; } case "category": { PublicProperty = true; PropertyNotFound = false; result = Category; break; } case "groupname": { PublicProperty = true; PropertyNotFound = false; result = GroupName; break; } case "startdate": { PublicProperty = true; PropertyNotFound = false; result = StartDate.ToString(OutputFormat, formatProvider); break; } case "enddate": { PublicProperty = true; PropertyNotFound = false; result = EndDate.ToString(OutputFormat, formatProvider); break; } case "starttime": { PublicProperty = true; PropertyNotFound = false; result = string.Format(formatProvider, strFormat, TimeSpan.FromMinutes(Convert.ToDouble(StartTime))); break; } case "endtime": { PublicProperty = true; PropertyNotFound = false; result = string.Format(formatProvider, strFormat, TimeSpan.FromMinutes(Convert.ToDouble(EndTime))); break; } case "title": { PublicProperty = true; PropertyNotFound = false; result = Title; break; } case "createdbyuserid": { PublicProperty = true; PropertyNotFound = false; result = CreatedByUserID.ToString(formatProvider); break; } case "createdbyuser": { PublicProperty = true; PropertyNotFound = false; var mc = new ModuleController(); int PortalId = mc.GetModule(ModuleID, -1).PortalID; DotNetNuke.Entities.Users.UserInfo usr = LastModifiedByUser(PortalId); if (usr != null) { result = usr.DisplayName; } break; } case "createddate": case "createdondate": { PublicProperty = true; PropertyNotFound = false; result = CreatedOnDate.ToString(OutputFormat, formatProvider); break; } case "lastmodifiedbyuserid": { PublicProperty = true; PropertyNotFound = false; result = LastModifiedByUserID.ToString(formatProvider); break; } case "lastmodifiedbyuser": { PublicProperty = true; PropertyNotFound = false; var mc = new ModuleController(); int PortalId = mc.GetModule(ModuleID, -1).PortalID; DotNetNuke.Entities.Users.UserInfo usr = LastModifiedByUser(PortalId); if (usr != null) { result = usr.DisplayName; } break; } case "lastmodifiedondate": { PublicProperty = true; PropertyNotFound = false; result = LastModifiedOnDate.ToString(OutputFormat, formatProvider); break; } case "portaltime": { PublicProperty = true; PropertyNotFound = false; result = PortalTime.ToString(OutputFormat, formatProvider); break; } case "usertime": { PublicProperty = true; PropertyNotFound = false; result = UserTime.ToString(OutputFormat, formatProvider); break; } case "utctime": { PublicProperty = true; PropertyNotFound = false; result = UtcTime.ToString(OutputFormat, formatProvider); break; } } if (!PublicProperty && CurrentScope != Scope.Debug) { PropertyNotFound = true; result = PropertyAccess.ContentLocked; } return(result); }