-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nice formatting for document URL in EditAchievements
- just like in EditDocuments
- Loading branch information
1 parent
2e10928
commit e70ebea
Showing
8 changed files
with
68 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
// Author: | ||
// Roman M. Yagodin <[email protected]> | ||
// | ||
// Copyright (c) 2015-2019 Roman M. Yagodin | ||
// Copyright (c) 2015-2020 Roman M. Yagodin | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as published by | ||
|
@@ -21,10 +21,6 @@ | |
|
||
using System; | ||
using System.Web; | ||
using DotNetNuke.Common; | ||
using DotNetNuke.Common.Utilities; | ||
using DotNetNuke.Entities.Tabs; | ||
using DotNetNuke.Services.FileSystem; | ||
using Newtonsoft.Json; | ||
using R7.Dnn.Extensions.Models; | ||
using R7.Dnn.Extensions.ViewModels; | ||
|
@@ -81,7 +77,7 @@ public override void SetTargetItemId (int targetItemId, string targetItemKey) | |
public int DocumentTypeID { get; set; } | ||
|
||
[JsonIgnore] | ||
[Obsolete ("Use DocumentTypeViewModel property instead", true)] | ||
[Obsolete ("Use DocumentTypeViewModel property instead", true)] | ||
public IDocumentType DocumentType { get; set; } | ||
|
||
public DocumentTypeViewModel DocumentTypeViewModel { get; set; } | ||
|
@@ -116,7 +112,7 @@ public override void SetTargetItemId (int targetItemId, string targetItemKey) | |
|
||
[JsonIgnore] | ||
public string LocalizedType | ||
{ | ||
{ | ||
get { | ||
return LocalizationHelper.GetStringWithFallback ( | ||
"SystemDocumentType_" + DocumentTypeViewModel.Type + ".Text", Context.LocalResourceFile, DocumentTypeViewModel.Type | ||
|
@@ -125,41 +121,9 @@ public string LocalizedType | |
} | ||
|
||
[JsonIgnore] | ||
public string FormattedUrl | ||
{ | ||
get { | ||
var label = string.Empty; | ||
var title = string.Empty; | ||
|
||
if (Globals.GetURLType (Url) == TabType.File) { | ||
var file = FileManager.Instance.GetFile (int.Parse (Url.ToUpperInvariant ().Replace ("FILEID=", ""))); | ||
if (file != null) { | ||
label = file.FileName; | ||
title = file.RelativePath; | ||
} | ||
else { | ||
label = Context.LocalizeString ("FileNotFound.Text"); | ||
} | ||
} | ||
else if (Globals.GetURLType (Url) == TabType.Tab) { | ||
var tab = TabController.Instance.GetTab (int.Parse (Url), Context.Module.PortalId); | ||
if (tab != null) { | ||
label = Context.LocalizeString ("Page.Text") + " " + tab.LocalizedTabName; | ||
title = tab.TabPath.Replace ("//", "/"); | ||
} | ||
else { | ||
label = Context.LocalizeString ("PageNotFound.Text"); | ||
} | ||
} | ||
else { | ||
label = HttpUtility.HtmlEncode (HtmlUtils.Shorten (Url, 25, "…")); | ||
title = HttpUtility.HtmlAttributeEncode (Url); | ||
} | ||
|
||
var url = UniversityUrlHelper.LinkClickIdnHack (Url, Context.Module.TabId, Context.Module.ModuleId); | ||
return $"<a href={url} target=\"_blank\" title=\"{title}\">{label}</a>"; | ||
} | ||
} | ||
public string FormattedUrl => | ||
UniversityUrlHelper.FormatNiceDocumentUrl (Url, Context.Module.ModuleId, Context.Module.TabId, | ||
Context.Module.PortalId, Context.LocalResourceFile); | ||
|
||
#endregion | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
// Author: | ||
// Roman M. Yagodin <[email protected]> | ||
// | ||
// Copyright (c) 2015-2019 Roman M. Yagodin | ||
// Copyright (c) 2015-2020 Roman M. Yagodin | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as published by | ||
|
@@ -144,20 +144,11 @@ public string Title_String | |
{ | ||
get { return Title + " " + TitleSuffix; } | ||
} | ||
|
||
[JsonIgnore] | ||
public string DocumentUrl_Link | ||
{ | ||
get { | ||
if (!string.IsNullOrWhiteSpace (DocumentURL)) { | ||
return string.Format ("<a href=\"{0}\" target=\"_blank\">{1}</a>", | ||
UniversityUrlHelper.LinkClickIdnHack (DocumentURL, Context.Module.TabId, Context.Module.ModuleId), | ||
Localization.GetString ("DocumentUrl.Text", Context.LocalResourceFile)); | ||
} | ||
|
||
return string.Empty; | ||
} | ||
} | ||
|
||
[JsonIgnore] | ||
public string FormattedUrl => | ||
UniversityUrlHelper.FormatNiceDocumentUrl (DocumentURL, Context.Module.ModuleId, Context.Module.TabId, | ||
Context.Module.PortalId, Context.LocalResourceFile); | ||
|
||
#endregion | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters