From 64a8b1e97190d18a5a0fe5fb2320b5002aa73e75 Mon Sep 17 00:00:00 2001 From: rylon Date: Wed, 15 Apr 2015 13:52:46 +0200 Subject: [PATCH] updated system statesystem to support dynamic subsubstates ;-) --- files/sys/system.js | 6 +++--- page/State.php | 12 ++++++------ sai/modules/saimod_sys_text/tpl/entry.tpl | 2 +- sai/modules/saimod_sys_text/tpl/tabopt2.tpl | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/files/sys/system.js b/files/sys/system.js index 44018f9..997be48 100644 --- a/files/sys/system.js +++ b/files/sys/system.js @@ -110,10 +110,10 @@ SYSTEM.prototype.handle_call_pages_entry = function (entry,id,forced,cached) { //internal function to handle pagestate results SYSTEM.prototype.handle_call_pages = function (data,id,forced,cached) { if(data['status']){ - this.log_info('load pages: endpoint '+this.endpoint+' group:'+this.group+' state:'+id+' - '+(cached ? 'cached ' : (forced ? 'forced' : 'success'))); + this.log_info('load pages: '+this.endpoint+'?call=pages&group='+this.group+'&state='+id+' - '+(cached ? 'cached ' : (forced ? 'forced' : 'success'))); //state not found? if(data['result'].length === 0){ - this.log_error('load pages: endpoint '+this.endpoint+' group:'+this.group+' state:'+id+' - state not found - redirecting to start state: '+this.start_state); + this.log_error('load pages: '+this.endpoint+'?call=pages&group='+this.group+'&state='+id+' - state not found - redirecting to start state: '+this.start_state); this.load(this.start_state); return;} //cache state info data @@ -139,7 +139,7 @@ SYSTEM.prototype.call_url = function(url,success,data,data_type,async){ dataType: data_type, url: url, success: success, - error: function(XMLHttpRequest, textStatus, errorThrown){system.log_error(call+' '+XMLHttpRequest+' '+textStatus+' '+errorThrown);} + error: function(XMLHttpRequest, textStatus, errorThrown){system.log_error(url+' '+XMLHttpRequest+' '+textStatus+' '+errorThrown);} }); }; SYSTEM.prototype.log = function(type,msg){ diff --git a/page/State.php b/page/State.php index 4fd80c1..0504715 100644 --- a/page/State.php +++ b/page/State.php @@ -17,7 +17,7 @@ class State { $result = array(); $res = \SYSTEM\DBD\SYS_PAGE_GROUP::QQ(array($group,$state_name)); while($row = $res->next()){ - if(!self::is_loaded($row,$substate,$state_name) && $row['type'] == 1){ + if(!self::is_loaded($row,$substate,$state_name,$row['parent_id'])){ continue;} if( ($row['login'] == 1 && !\SYSTEM\SECURITY\Security::isLoggedIn()) || ($row['login'] == 2 && \SYSTEM\SECURITY\Security::isLoggedIn())){ @@ -30,9 +30,9 @@ class State { $row['url'] = preg_replace('/&&$/', '', $row['url']); $row['css'] = $row['js'] = array(); if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'css') && \is_callable($row['php_class'].'::css')){ - $row['css'] = array_merge($row['css'], call_user_func($row['php_class'].'::css'));} + $row['css'] = array_merge($row['css'], \call_user_func($row['php_class'].'::css'));} if(\class_exists($row['php_class']) && \method_exists($row['php_class'], 'js') && \is_callable($row['php_class'].'::js')){ - $row['js'] = array_merge($row['js'], call_user_func($row['php_class'].'::js'));} + $row['js'] = array_merge($row['js'], \call_user_func($row['php_class'].'::js'));} $row['php_class'] = ''; $skip = false; @@ -56,16 +56,16 @@ class State { for($i=0;$i + ${id} ${text} ${author} diff --git a/sai/modules/saimod_sys_text/tpl/tabopt2.tpl b/sai/modules/saimod_sys_text/tpl/tabopt2.tpl index a63404a..52d67c4 100644 --- a/sai/modules/saimod_sys_text/tpl/tabopt2.tpl +++ b/sai/modules/saimod_sys_text/tpl/tabopt2.tpl @@ -1 +1 @@ -
  • ${lang}
  • \ No newline at end of file +
  • ${lang}
  • \ No newline at end of file