-
Notifications
You must be signed in to change notification settings - Fork 0
/
View.ascx.cs
96 lines (86 loc) · 3.42 KB
/
View.ascx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
' Copyright (c) 2014 Jason Brunken
' All rights reserved.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
'
*/
using System;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;
using System.Runtime.Serialization;
using DotNetNuke.Framework;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Services.Localization;
using DotNetNuke.UI.Utilities;
namespace GitHubRepoStats
{
/// -----------------------------------------------------------------------------
/// <summary>
/// The View class displays the content
///
/// Typically your view control would be used to display content or functionality in your module.
///
/// View may be the only control you have in your project depending on the complexity of your module
///
/// Because the control inherits from GitHubRepoStatsModuleBase you have access to any custom properties
/// defined there, as well as properties from DNN such as PortalId, ModuleId, TabId, UserId and many more.
///
/// </summary>
/// -----------------------------------------------------------------------------
public partial class View : PortalModuleBase
{
public string ConfigJson
{
get
{
var settings = Components.Settings.Load(Settings);
var localizedText = new
{
loading = LocalizeString("Loading.Text"),
watchers = LocalizeString("Watchers.Text"),
forks = LocalizeString("Forks.Text"),
stargazers = LocalizeString("Stargazers.Text"),
lastUpdated = LocalizeString("LastUpdated.Text"),
preRelease = LocalizeString("PreRelease.Text"),
released = LocalizeString("Released.Text"),
downloads = LocalizeString("Downloads.Text"),
viewWiki = LocalizeString("ViewWiki.Text"),
viewIssues = LocalizeString("ViewIssues.Text")
};
var config = new
{
txt = localizedText,
releaseType = settings.ReleaseType,
preReleaseType = settings.PreReleaseType,
repoName = settings.RepoName,
repoOwner = settings.RepoOwner,
enableDownloadCounts = settings.EnableDownloadCounts
};
return new JavaScriptSerializer().Serialize(config);
}
}
/*
protected void Page_Load(object sender, EventArgs e)
{
// Nothing to do if it's a callback
if(Page.IsCallback)
return;
try
{
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
*/
}
}