Fullstack Portal Created by the HCMR for the Marine Strategy Framework Directive Program in order to cover demands and aspects considering extendability and maintainability
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

259 lines
8.2 KiB

2 years ago
/************loader.js**********************/
/**** loads all the necessary files and ****/
/**** configuration of the application *****/
/**** (var) init_onload_fn:stores all the function names to be executed on load of the application ****/
var init_onload_fn=new Array();
var admin=false;
/**** (var) global_date_format:date time format for all the date time variables****/
var global_date_format = "dd/mm/yyyy";
var global_time_format = "hh:MM:ss";
var installing=false;
const BASE_URL = 'https://msfd-test.hcmr.gr';
const REPO_URL = 'https://msfd-repo.ath.hcmr.gr';
/**** (function) fn_execOnloadFn:executes all the functions that are stored to the init_onload_fn variable****/
/**** 100 ms after loading the application *************************************************************/
function fn_execOnloadFn()
{
setTimeout(function()
{
Ext.each(init_onload_fn,function(item)
{
if(item) {
item();
}
});
},100);
}
/**** (function) fn_getParameterByName(arg name(String)):get url variables values****/
function fn_getParameterByName(name)
{
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
/**** (function) fn_setUrlParameter(arg url(String), key(String), value(String)):set url variables values****/
function fn_setUrlParameter(url, key, value) {
var key = encodeURIComponent(key),
value = encodeURIComponent(value);
var baseUrl = url.split('?')[0],
newParam = key + '=' + value,
params = '?' + newParam;
if (url.split('?')[1] === undefined){ // if there are no query strings, make urlQueryString empty
urlQueryString = '';
} else {
urlQueryString = '?' + url.split('?')[1];
}
// If the "search" string exists, then build params from it
if (urlQueryString) {
var updateRegex = new RegExp('([\?&])' + key + '[^&]*');
var removeRegex = new RegExp('([\?&])' + key + '=[^&;]+[&;]?');
if (typeof value === 'undefined' || value === null || value === '') { // Remove param if value is empty
params = urlQueryString.replace(removeRegex, "$1");
params = params.replace(/[&;]$/, "");
} else if (urlQueryString.match(updateRegex) !== null) { // If param exists already, update it
params = urlQueryString.replace(updateRegex, "$1" + newParam);
} else { // Otherwise, add it to end of query string
params = urlQueryString + '&' + newParam;
}
}
// no parameter was set so we don't need the question mark
params = params === '?' ? '' : params;
var newurl = baseUrl + params;
window.history.pushState({path:newurl},'',newurl);
return baseUrl + params;
}
/**** (function) fn_host:get host name of the application****/
function fn_host()
{
var _scheme=window.location.protocol;
var _host=window.location.host;
var _path=window.location.pathname;
var host=_scheme+"//"+_host+_path;
host=host.replace(/[^\/]*$/, '');
return host;
}
var host=fn_host();
var languageBtn;
var topBanner = host + "img/logos/logo.png";
var topRightBanner = "";
var configFile = "config_en.js";
var aboutFile = "About_GET_SDI_Portalv4_GR.pdf";
var manualFile = "GETSDIPortalv4_Help_GR_v1.0.pdf";
var languageFile = "el_en.js";
fn_getLanguageFile();
/**** (function) fn_getLanguageFile:get the necessary files ****/
/**** (configuration, translations,banners) according to the ***/
/***************** language selected **************************/
function fn_getLanguageFile()
{
var lang=fn_getParameterByName("lang");
lang=lang.toLowerCase();
switch(lang)
{
default:
languageFile = "en_us.js";
topBanner = host + "img/logos/logo.png";
configFile = "config_en.js";
aboutFile = "About_GET_SDI_Portalv4_GR.pdf";
manualFile = "GETSDIPortalv4_Help_GR_v1.0.pdf";
languageBtn = {
xtype:"button",
id: "languageBtn",
iconCls:"en_us",
handler:function() {
window.location=host+"?lang=EN";
}
};
break;
}
}
/***(var) loader_script_urls: stores all the external js script urls to be included*****/
var loader_script_urls=[
"https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js",
// "https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.js",
"https://code.highcharts.com/stock/highstock.js",
"https://code.highcharts.com/stock/modules/data.js",
"https://code.highcharts.com/stock/modules/exporting.js",
"https://code.highcharts.com/stock/modules/export-data.js",
"https://unpkg.com/dexie/dist/dexie.js",
// "https://unpkg.com/gridjs/dist/gridjs.umd.js"
];
/***(var) loader_script_files: stores all the internal js script urls to be included*****/
var loader_script_files=[
"js/tools/gridjs/gridjs.umd.js",
"js/tools/leaflet/leaflet.js",
"js/tools/leaflet/leaflet-geoman.min.js",
"js/tools/leaflet/L.TileLayer.BetterWMS.js",
"js/tools/leaflet/leaflet.legend.js",
"js/tools/leaflet/L.Control.Window.js",
"js/tools/leaflet/leaflet.markerpies.js",
"js/tools/leaflet/leaflet.slider.js",
"js/tools/pickletree/pickletree.js",
"js/tools/extjs/ext-all.js",
"js/tools/proj4js/lib/proj4js-combined.js",
"js/tools/shapefileToGeoJson/stream.js",
"js/tools/shapefileToGeoJson/shapefile.js",
"js/tools/shapefileToGeoJson/dbf.js",
"js/tools/OpenLayers/OpenLayers.2.13.2.full.js",
"js/tools/OpenLayers/OpenLayers_fix_error.js",
"js/tools/OpenLayers/lib/OpenLayers/Control/ScaleBar.js",
"js/tools/OpenLayers/lib/OpenLayers/Handler/Path.js",
"js/tools/OpenLayers/lib/OpenLayers/Layer/EsriGeoJSON.js",
"js/tools/utils/date.format.js",
"js/tools/bulma/bulma-calendar.min.js",
"js/tools/utils/moment-with-locales.js",
"js/language/"+languageFile,
"js/functions.js",
"js/layers.js",
"js/extras.js",
"js/modal.js",
"js/maptab/lib/servicesFunctions.js",
"js/maptab/lib/layersFunctions.js",
"js/maptab/lib/attributesFunctions.js",
"js/maptab/lib/featureFunctions.js",
"js/constants.js",
"js/"+configFile,
"js/main.js",
"js/sidebar.js",
"js/maptab/maptab_toolbar_general.js",
"js/maptab/maptab_toolbar_search.js",
"js/treeview.js",
"js/annual_fisheries.js",
"js/maptab/maptab_services_manager/wms.js",
"js/maptab/maptab_services_manager/csw.js",
"js/maptab/maptab_services_manager.js",
"js/maptab/maptab_toolbar_general/map_controls_featureInfo.js",
"js/modules/charts/charts.js",
"js/metadatatab/metadatatab_west_form_panel.js",
"js/metadatatab/metadatatab_toolbar_general.js",
"js/metadatatab.js",
"js/metadatatab/metadatatab_map.js",
"js/config_functions.js",
"js/modules/layersmetadata/layersmetadata.js",
"js/modules/poseidon/poseidon.js",
"js/modules/configuration/configuration.js",
"js/mru-info.js",
"js/more-info.js"
2 years ago
];
/***(var) loader_css_files: stores all the internal css (styles) urls to be included*****/
var loader_css_files=[
"js/tools/extjs/resources/css/ext-all.css",
"css/mermaid.min.css",
"css/style.css",
"css/leaflet.css",
"css/L.Control.Window.css",
"css/bulma-calendar.min.css"
];
/***(function) init_loader_files: appends all the script and css files to the header****/
/*** of the application: loader_script_urls, loader_script_files, loader_css_files *****/
function init_loader_files()
{
var URLscriptTags = new Array(loader_script_urls.length);
for (var i=0, len=loader_script_urls.length; i<len; i++) {
URLscriptTags[i] = "<script src='"+loader_script_urls[i]+"'></script>";
}
if (URLscriptTags.length > 0) {
document.write(URLscriptTags.join(""));
}
var cssTags = new Array(loader_css_files.length);
for (var i=0, len=loader_css_files.length; i<len; i++) {
cssTags[i] = "<link rel='stylesheet' type='text/css' href='" + host + loader_css_files[i] +"' />";
}
if (cssTags.length > 0) {
document.write(cssTags.join(""));
}
var scriptTags = new Array(loader_script_files.length);
for (var i=0, len=loader_script_files.length; i<len; i++) {
scriptTags[i] = "<script type='text/javascript' src='" + host + loader_script_files[i] +"'></script>";
}
if (scriptTags.length > 0) {
document.write(scriptTags.join(""));
}
}
/**executes the init_loader_files function**/
init_loader_files();
const BBOX = [5059029.5,1282860.0,6172886.0,2126159.0];
alert('Because the web application is still under development, before using, please refresh your browser in order to use the latest interface by pressing: <Ctrl> + <F5> OR <Ctrl> + <Shift> + R');