updated system statesystem to support dynamic subsubstates ;-)
This commit is contained in:
parent
6757d4b099
commit
64a8b1e971
@ -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){
|
||||
|
||||
@ -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<count($substate);$i++){
|
||||
if($row['name'] == $state_name){
|
||||
$substate[$i]['parent_id'] = $row['id'];}
|
||||
if($substate[$i]['name'] == $row['name'] && $substate[$i]['parent_id'] == $row['parent_id']){
|
||||
if($substate[$i]['name'] == $row['name']){
|
||||
$substate[$i]['parent_id'] = $parent_id;
|
||||
return true;
|
||||
}
|
||||
if(array_key_exists('parent_id', $substate[$i])){
|
||||
if(self::is_loaded($row,$substate[$i]['sub'],$state_name,$substate[$i]['parent_id'])){
|
||||
if(self::is_loaded($row,$substate[$i]['sub'],$substate[$i]['name'],$substate[$i]['parent_id'])){
|
||||
return true;}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return $row['type'] == 0 ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<tr class="tableentry" text_id="${id}" onClick="system.load('text(edittext);id.${id};lang.${language}');">
|
||||
<tr class="tableentry" text_id="${id}" onClick="system.load('text(edittext(editor));id.${id};lang.${language}');">
|
||||
<td>${id}</td>
|
||||
<td class="contenttext">${text}</td>
|
||||
<td class="contenttext">${author}</td>
|
||||
|
||||
@ -1 +1 @@
|
||||
<li><a href="#!text(edittext);id.${id};lang.${lang}" class="${default}" id="menu_lang_${lang}">${lang}</a></li>
|
||||
<li><a href="#!text(edittext(editor));id.${id};lang.${lang}" class="${default}" id="menu_lang_${lang}">${lang}</a></li>
|
||||
Loading…
x
Reference in New Issue
Block a user