PageSourceSearch

https://pct-agcloud.com/apps/Dashboard/javascript/Application.js

js pct-agcloud.com collected 2026-10-05 01:00:44 UTC 7,116 bytes, 201 lines download raw bytes

1//----------------------------------------------------------------------------------------------------
2// Application
3//
4// This is the main application.
5//----------------------------------------------------------------------------------------------------
6
7function Application() {
8    this.GatewayApiPath = AGC.gatewayApiPath;
9    this.CommonLocation = "Common/";
10
11    this.utilities = new Utilities(this);
12    this.logIn = new LogInGateway(this);
13
14    this.browserGateway = new BrowserGateway(this);
15    this.userProfile = new UserProfile(this);
16
17    this.modules = new Modules();
18    this.licensing = new Licensing();
19
20    this.SessionId = null;
21}
22
23//----------------------------------------------------------------------------------------------------
24// create - create the application
25//----------------------------------------------------------------------------------------------------
26Application.prototype.create = function () {
27    this.content = $("#content");
28}
29
30//----------------------------------------------------------------------------------------------------
31// Create the application and run it
32//----------------------------------------------------------------------------------------------------
33var application = new Application();
34
35$(document).ready(function () {
36    application.create();
37    $("#logo").attr('src', 'Common/styles/img/pctLogoMedium.png');
38
39    $.when(application.logIn.getSignInStatus()).then(function(response) 
40    {
41        if (response == true)
42        {
43            application.content.removeClass("hidden");
44
45            $("#UserName").html(application.logIn.userName);
46
47            application.utilities.applyBrandCSS();
48            application.setMyModules();
49            application.setAvailableModules();
50            application.setHeader();
51
52            application.setUploadDataForm();
53        }
54        else
55        {
56            application.content.addClass("hidden");
57        }
58    });
59});
60
61/**
62*  Set Brand Header
63*/
64Application.prototype.setHeader = function () {   
65    var prefix = '//' + window.location.host;
66
67    if (application.utilities.getBranding().brand != "PCT") {
68        $("#logoUrl").attr('href', "#");
69        $("#paymentButton").css('display', 'none');
70    } else {
71        $("#paymentButton").css('display', 'block');
72    }
73
74    $("#logoFile").attr('src', prefix + application.utilities.getBranding().logoPath);
75    $("#logoFile").attr('alt', application.utilities.getBranding().brand);
76    console.log(application.utilities.getBranding().headerTitle);
77    $("#agCloudTitle").html(application.utilities.getBranding().headerTitle);
78}
79
80/**
81*  Check licenses.
82*/
83
84/**
85*  My Modules.
86*/
87Application.prototype.setMyModules = function () {
88    var count = 0;
89    var html = '';
90    var body = '';
91
92    $.each(application.modules.moduleList, $.proxy(function (key, item) {
93        if (item.isLicensed()) {
94            //body += '<td class="moduleCell" onclick="application.modules.openURL(\'' + item.url + '\');">';
95            //body += '<div class="moduleDiv"><div id="my' + item.moduleName + '" /></div>';
96            //body += '<br><div id="my' + item.moduleName + 'Name" class="moduleDivName">' + item.displayName + '</div></td>';
97            body += '<div class="moduleCell pull-left" onclick="application.modules.openURL(\'' + item.url + '\');">';
98            body += '<div class="moduleDiv"><div id="my' + item.moduleName + '" /></div>';
99            body += '<br><div id="my' + item.moduleName + 'Name" class="moduleDivName">' + item.displayName + '</div></div>';
100
101            count += 1;
102        }
103    }, this));
104
105    if (count == 0) {
106        //body += '<td><div class="moduleCellName">No Modules</div></td>';
107        body += '<div class="moduleCellName">No Modules</div>';
108
109        count += 1;
110    }
111
112    //html += '<table style="width:' + 150 * count + 'px;height:120px;border-spacing:5px;border-collapse:separate;"><tr>';
113    html += body;
114    //html += '</tr></table>';
115
116    $("#myModulesBody").html(html);
117}
118
119/**
120*  Available Modules.
121*/
122Application.prototype.setAvailableModules = function () {
123    var count = 0;
124    var html = '';
125    var body = '';
126
127    $.each(application.modules.moduleList, $.proxy(function (key, item) {
128        if (!item.isLicensed()) {
129            body += '<td class="moduleCell" style="cursor:default">';
130            if (item.productName == "Soon") {
131                body += '<div style="position:absolute;"><img src="dashboard/styles/img/Star.png" title="Application coming soon ..."/></div>';
132            }
133            body += '<div class="moduleDiv" style=""><div id="' + item.moduleName + '" /></div>';
134            body += '<br><div id="' + item.moduleName + 'Name" class="moduleDivName">' + item.displayName + '</div></td>';
135
136            count += 1;
137        }
138    }, this));
139
140    if (count == 0) {
141        body += '<td><div class="moduleCellName" style="padding-left:10px;"><span style="color:#58585A">No Modules</span></div></td>';
142
143        count += 1;
144    }
145
146    html += '<table style="width:' + 150 * count + ';height:120px;border-spacing:5px;border-collapse:separate;"><tr>';
147    html += body;
148    html += '<td width="*"></td></tr></table>';
149
150    $("#availableModulesBody").html(html);
151
152    this.setModuleIcons();
153}
154
155/**
156*  Set Module Icons
157*/
158Application.prototype.setModuleIcons = function () {
159    var imgPrefix = '';
160    var cssClass = '';
161
162    if (application.utilities.getBranding().brand == "PCT") {
163        var imgPrefix = 'dashboard/styles/img/icons/default/';
164    } else if (application.utilities.getBranding().brand == "Agworld") {
165        cssClass = 'agworldButton';
166    } else {
167        var imgPrefix = 'dashboard/styles/img/icons/default/';
168    }
169
170    //    imgPrefix = '';
171    //    cssClass = 'agworldButton';
172
173    if (imgPrefix != '') {
174        $.each(application.modules.moduleList, $.proxy(function (key, item) {
175            $("#my" + item.moduleName).css('background-image', 'url("' + imgPrefix + item.moduleName + '.png")');
176            $("#" + item.moduleName).css('background-image', 'url("' + imgPrefix + item.moduleName + '.png")');
177        }, this));
178    } else if (cssClass != '') {
179        $.each(application.modules.moduleList, $.proxy(function (key, item) {
180            $("#my" + item.moduleName).css('background-image', '');
181            $("#" + item.moduleName).css('background-image', '');
182
183            $("#my" + item.moduleName).addClass(cssClass);
184            $("#" + item.moduleName).addClass(cssClass);
185
186            $("#my" + item.moduleName).html(item.displayName);
187            $("#" + item.moduleName).html(item.displayName);
188
189            $("#my" + item.moduleName + "Name").remove();
190            $("#" + item.moduleName + "Name").remove();
191        }, this));
192    }
193
194    Application.prototype.setUploadDataForm = function () 
195    {
196        var src = application.utilities.getUploadDataForm();
197
198        $('#upload-data-form').attr('src', src);
199    }
200 
201}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.