force reload of states now possible
This commit is contained in:
parent
c4bab4a85b
commit
e3849f9a2e
@ -19,7 +19,7 @@ function SYSTEM(endpoint, group,start_state){
|
||||
system.go_state();});
|
||||
}
|
||||
//internal function to handle pagestate results
|
||||
SYSTEM.prototype.handle_call_pages = function (data,id) {
|
||||
SYSTEM.prototype.handle_call_pages = function (data,id,forced) {
|
||||
if(data['status']){
|
||||
system.log_info('load pages: endpoint '+system.endpoint+' group:'+system.group+' state:'+id+' - success');
|
||||
//state not found?
|
||||
@ -31,7 +31,7 @@ SYSTEM.prototype.handle_call_pages = function (data,id) {
|
||||
window.history.pushState(null, "", '#!'+id);}
|
||||
data['result'].forEach(function(entry) {
|
||||
//check loaded state of div - reload only if required
|
||||
if(system.state[entry['div']] !== entry['url']+'&'+window.location.search.substr(1)){
|
||||
if(forced || system.state[entry['div']] !== entry['url']+'&'+window.location.search.substr(1)){
|
||||
//load pages
|
||||
$.ajax({
|
||||
async: false,
|
||||
@ -40,8 +40,6 @@ SYSTEM.prototype.handle_call_pages = function (data,id) {
|
||||
url: entry['url']+'&'+window.location.search.substr(1),
|
||||
success: function(data){
|
||||
if($(entry['div']).length){
|
||||
//console.log(entry['div']);
|
||||
//console.log(data);
|
||||
$(entry['div']).html(data);
|
||||
system.log_info('load page: '+id+entry['div']+' '+entry['url']+'&'+window.location.search.substr(1)+' - success');
|
||||
} else {
|
||||
@ -122,9 +120,9 @@ SYSTEM.prototype.load_page = function(){
|
||||
return result;
|
||||
};
|
||||
//load a pagestatewith given id
|
||||
SYSTEM.prototype.load = function(id){
|
||||
SYSTEM.prototype.load = function(id,forced){
|
||||
system.log(system.LOG_START,'load page '+id);
|
||||
this.call('call=pages&group='+this.group+'&state='+id,function(data){system.handle_call_pages(data,id);},{},"json",false);};
|
||||
this.call('call=pages&group='+this.group+'&state='+id,function(data){system.handle_call_pages(data,id,forced);},{},"json",false);};
|
||||
|
||||
SYSTEM.prototype.load_css = function loadCSS(csssrc) {
|
||||
var snode = document.createElement('link');
|
||||
@ -143,20 +141,22 @@ SYSTEM.prototype.cur_state = function() {
|
||||
return '';
|
||||
};
|
||||
|
||||
SYSTEM.prototype.go_state = function(default_state){
|
||||
SYSTEM.prototype.go_state = function(default_state,forced){
|
||||
var pageName = this.cur_state();
|
||||
this.load(pageName ? pageName : default_state);
|
||||
this.load(pageName ? pageName : default_state,forced);
|
||||
};
|
||||
|
||||
SYSTEM.prototype.back = function(){
|
||||
window.history.back();};
|
||||
SYSTEM.prototype.forwad = function(){
|
||||
window.history.forward();};
|
||||
SYSTEM.prototype.reload = function(){
|
||||
//window.location.reload();
|
||||
this.go_state(this.cur_state(),true);
|
||||
};
|
||||
|
||||
SYSTEM.prototype.language = function(lang){
|
||||
this.log_info('change language to '+lang);
|
||||
//preserve the old parameters
|
||||
//var search = location.search ? location.search.substring(1).split("&") : [];
|
||||
var search = '_lang='+lang;
|
||||
window.location.href = '/?' + search + location.hash;
|
||||
window.location.href = window.location.pathname +'?' + search + location.hash;
|
||||
};
|
||||
@ -316,7 +316,7 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_LOG_FILTERS::QQ();
|
||||
$result = '';
|
||||
while($row = $res->next()){
|
||||
$result .= '<li><a href="#" filter="'.$row['class'].'">'.$row['class'].'</a></li>';}
|
||||
$result .= '<li><a href="#!log" filter="'.$row['class'].'">'.$row['class'].'</a></li>';}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<ul class="nav nav-pills" id="error_filter">
|
||||
<li class="active"><a href="#" filter="%">All</a></li>
|
||||
<li class="active"><a href="#!log" filter="%">All</a></li>
|
||||
${error_filter}
|
||||
</ul>
|
||||
<div id="table_log">${table}</div>
|
||||
@ -5,6 +5,7 @@ $(document).ready(function() {
|
||||
$('#sai_navbar li, #project_navbar li').each(function(){
|
||||
$(this).removeClass('active');});
|
||||
$(this).parent().addClass('active');
|
||||
system.reload();
|
||||
});
|
||||
|
||||
$('#sai_navbar li, #project_navbar li').each(function(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user