mirror of
https://github.com/myvesta/vesta
synced 2025-07-30 03:29:26 -07:00
116 lines
2.3 KiB
Text
116 lines
2.3 KiB
Text
/**
|
|
* App namespace
|
|
*/
|
|
var App = {
|
|
Ajax: {},
|
|
Env: {
|
|
BROWSER: {
|
|
type: 'unknown-type',
|
|
version: 'version', // prefixed with type will be "unknown-version"
|
|
os: 'unknown-os'
|
|
},
|
|
getWorldName: function() {
|
|
return App.Env.world.toLowerCase();
|
|
}
|
|
},
|
|
Core: {},
|
|
Bash: {},
|
|
Console: {},
|
|
Constants: {},
|
|
Actions: {},
|
|
Helpers: {},
|
|
Filters: {},
|
|
i18N: {},
|
|
HTML: {
|
|
Build: {}
|
|
},
|
|
View:{
|
|
|
|
// pages related views
|
|
Pages: {
|
|
USER: {},
|
|
WEBDOMAIN: {},
|
|
MAIL: {},
|
|
DB: {},
|
|
DNS: {},
|
|
IP: {},
|
|
CRON: {}
|
|
}
|
|
},
|
|
Messages: {},
|
|
Model: {
|
|
USER: {},
|
|
WEBDOMAIN: {},
|
|
MAIL: {},
|
|
DB: {},
|
|
DNS: {},
|
|
IP: {},
|
|
CRON: {}
|
|
},
|
|
Cache: {
|
|
clear: function(){} // stub method, will be used later
|
|
},
|
|
Pages: {
|
|
USER: {},
|
|
WEBDOMAIN: {},
|
|
MAIL: {},
|
|
DB: {},
|
|
DNS: {},
|
|
IP: {},
|
|
CRON: {}
|
|
},
|
|
Ref: {},
|
|
Tmp: {},
|
|
Thread: {
|
|
run: function(delay, ref){
|
|
setTimeout(function(){
|
|
ref();
|
|
}, delay*10);
|
|
}
|
|
},
|
|
Settings: {},
|
|
Templates: {
|
|
Templator: null,
|
|
Tpl: {},
|
|
_indexes: {}
|
|
},
|
|
Utils: {},
|
|
Validate: {}
|
|
};
|
|
|
|
//
|
|
// AJAX global method
|
|
//
|
|
App.Ajax.request = function(jedi_method, data, callback){
|
|
App.Helpers.beforeAjax(jedi_method);
|
|
$.ajax({
|
|
url: function() {
|
|
var url_parts = location.href.split('/');
|
|
if (url_parts[url_parts.length -1] == 'index.html') {
|
|
url_parts[url_parts.length -1] = 'dispatch.php';
|
|
}
|
|
else {
|
|
url_parts.push('dispatch.php');
|
|
}
|
|
return url_parts.join('/');
|
|
}(),
|
|
global: false,
|
|
type: data.request_method || "POST",
|
|
data: $.extend(data, {'jedi_method': jedi_method}),
|
|
dataType: "json",
|
|
async:true,
|
|
success: function(reply){
|
|
App.Helpers.afterAjax();
|
|
callback && callback(reply);
|
|
},
|
|
error: function() {
|
|
App.View.popup('error');
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|