updated and improved system modules

This commit is contained in:
Ulf Gebhardt 2013-09-18 04:35:20 +02:00
parent 116fd83ddf
commit 59f157ab12
11 changed files with 140 additions and 59 deletions

View File

@ -3,48 +3,40 @@ namespace SYSTEM\SAI;
class saimod_sys_calls extends \SYSTEM\SAI\SaiModule {
public static function html_content(){
$result = '<h3>Api Calls</h3>'.
'<table class="table table-hover table-condensed" style="overflow: auto;">'.
'<tr>'.'<th>'.'ID'.'</th>'.'<th>'.'flag'.'</th>'.'<th>'.'parentID'.'</th>'.'<th>'.'parentValue'.'</th>'.'<th>'.'name'.'</th>'.'<th>'.'allowedValues'.'</th>'.'</tr>';
$last_group = -1;
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->query('SELECT * FROM system.api_calls ORDER BY "ID" ASC;');
$res = $con->query('SELECT * FROM system.api ORDER BY "group", "ID" ASC;');
} else {
$res = $con->query('SELECT * FROM system_api_calls ORDER BY ID ASC;');
$res = $con->query('SELECT * FROM system_api ORDER BY group, ID ASC;');
}
$result = "";
while($r = $res->next()){
$result .= '<tr class="'.self::tablerow_class($r['flag']).'">'.'<td>'.$r['ID'].'</td>'.'<td>'.$r['flag'].'</td>'.'<td>'.$r['parentID'].'</td>'.'<td>'.$r['parentValue'].'</td>'.'<td>'.$r['name'].'</td>'.'<td>'.$r['allowedValues'].'</td>'.'</tr>';}
$result .= '</table>';
$result .= '<h3>Page Calls</h3>'.
'<table class="table table-hover table-condensed" style="overflow: auto;">'.
'<tr>'.'<th>'.'ID'.'</th>'.'<th>'.'flag'.'</th>'.'<th>'.'parentID'.'</th>'.'<th>'.'parentValue'.'</th>'.'<th>'.'name'.'</th>'.'<th>'.'allowedValues'.'</th>'.'</tr>';
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->query('SELECT * FROM system.page_calls ORDER BY "ID" ASC;');
} else {
$res = $con->query('SELECT * FROM system_page_calls ORDER BY ID ASC;');
if($last_group != $r['group']){
$last_group = $r['group'];
if($last_group != -1){
$result .= '</table>';}
$result .= '<h3>Api Table for Group '.$r["group"].'</h3>'.
'<table class="table table-hover table-condensed" style="overflow: auto;">'.
'<tr>'.'<th>'.'ID'.'</th>'.'<th>'.'Group'.'</th>'.'<th>'.'Type'.'</th>'.'<th>'.'ParentID'.'</th>'.'<th>'.'ParentValue'.'</th>'.'<th>'.'Name'.'</th>'.'<th>'.'Verify'.'</th>'.'</tr>';
}
$result .= '<tr class="'.self::tablerow_class($r['type']).'">'.'<td>'.$r['ID'].'</td>'.'<td>'.$r['group'].'</td>'.'<td>'.$r['type'].'</td>'.'<td>'.$r['parentID'].'</td>'.'<td>'.$r['parentValue'].'</td>'.'<td>'.$r['name'].'</td>'.'<td>'.$r['verify'].'</td>'.'</tr>';
}
while($r = $res->next()){
$result .= '<tr class="'.self::tablerow_class($r['flag']).'">'.'<td>'.$r['ID'].'</td>'.'<td>'.$r['flag'].'</td>'.'<td>'.$r['parentID'].'</td>'.'<td>'.$r['parentValue'].'</td>'.'<td>'.$r['name'].'</td>'.'<td>'.$r['allowedValues'].'</td>'.'</tr>';}
$result .= '</table>';
$result .= '</table>';
return $result;
}
private static function tablerow_class($flag){
if($flag == 1){
return 'info';}
return 'success';
switch($flag){
case 0: return 'info';
case 1: return '';
default: return 'success';
}
}
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_calls">Calls</a></li>';}
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_calls">API Calls</a></li>';}
public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\system::getSystemDBInfo(), \SYSTEM\SECURITY\RIGHTS::SYS_SAI);}

View File

@ -19,6 +19,8 @@ class saimod_sys_config extends \SYSTEM\SAI\SaiModule {
$result .= '<tr>'.'<td>'.\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_DBNAME. '</td>'.'<td>'.'\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_DBNAME'. '</td>'.'<td>'.\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DB_DBNAME). '</td>'.'</tr>';
$result .= '<tr>'.'<td>'.\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_BASEURL. '</td>'.'<td>'.'\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_BASEURL'. '</td>'.'<td>'.\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_BASEURL). '</td>'.'</tr>';
$result .= '<tr>'.'<td>'.\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG. '</td>'.'<td>'.'\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG'. '</td>'.'<td>'.\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG). '</td>'.'</tr>';
$result .= '<tr>'.'<td>'.\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT. '</td>'.'<td>'.'\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT'. '</td>'.'<td>'.\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT). '</td>'.'</tr>';
$result .= '<tr>'.'<td>'.\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE. '</td>'.'<td>'.'\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE'. '</td>'.'<td>'.\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE). '</td>'.'</tr>';
$result .= '<tr>'.'<td>'.\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS. '</td>'.'<td>'.'\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS'. '</td>'.'<td>'.implode(',',\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS)). '</td>'.'</tr>';
$result .= '<tr>'.'<td>'.\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG. '</td>'.'<td>'.'\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG'. '</td>'.'<td>'.\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_LANG). '</td>'.'</tr>';

View File

@ -36,10 +36,10 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
$res = $con->query('SELECT * FROM system_locale_string ORDER BY category ASC;');
}
while($r = $res->next()){
$result .= '<tr>'.'<td>'.$r["id"].'<br><input type="submit" class="btn-danger" value="delete" delete_ID="'.$r["id"].'">'.'</td>'.'<td>'.$r["category"].'</td>';
$result .= '<tr>'.'<td>'.$r["id"].'<br><input type="submit" class="btn-danger" value="delete" delete_ID="'.$r["id"].'">'.'<input type="submit" class="btn" value="edit" name="'.$r["id"].'">'.'</td>'.'<td>'.$r["category"].'</td>';
foreach ($languages as $columns){
//echo "+tututututututut:".$r[$columns]."nochmal tututututututut";
$result .= '<td>'.$r[$columns].'<br><input type="submit" class="btn" value="edit" lang="'.$columns.'" name="'.$r["id"].'" onclick="javascript:init__SYSTEM_SAI_saimod_sys_locale();">'.'</td>';
$result .= '<td>'.$r[$columns].'</td>';
//$_POST[$r["id"]] = $r[$columns];
}
@ -61,10 +61,19 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
$languages[] = $lang;
}
$result .= '</tr>';
$result .= '</tr>';
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
$res = $con->prepare('edit', 'SELECT * FROM system_locale_string WHERE id=? ORDER BY "category" ASC;', array($entry));
$res = null;
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->prepare( 'edit',
'SELECT * FROM system.locale_string WHERE id = $1 ORDER BY "category" ASC;',
array($entry));
} else {
$res = $con->prepare( 'edit',
'SELECT * FROM system_locale_string WHERE id = ? ORDER BY "category" ASC;',
array($entry));
}
while($r = $res->next()){
$result .= "<tr>";
foreach ($languages as $columns){

View File

@ -0,0 +1,10 @@
<div class="tabbable">
<ul class="nav nav-tabs" id="modstab">
<li class="active"><a href="#tab_sys">Sys Mods</a></li>
<li><a href="#tab_project">Project Mods</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_sys">${content_sys}</div>
<div class="tab-pane" id="tab_project">${content_project}</div>
</div>
</div>

View File

@ -0,0 +1,6 @@
function init__SYSTEM_SAI_saimod_sys_mod() {
$('#modstab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
})
};

View File

@ -1,8 +1,8 @@
<?php
namespace SYSTEM\SAI;
class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
public static function html_content(){
class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
public static function html_content_sys(){
$result = '<h3>Sys Mods</h3>'.
'<table class="table table-hover table-condensed" style="overflow: auto;">'.
'<tr>'.'<th>'.'Classname'.'</th>'.'<th>'.'Public'.'</th>'.'<th>'.'You can Access?'.'</th>'.'</tr>';
@ -11,8 +11,12 @@ class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
foreach($sys_mods as $mod){
$result .= '<tr>'.'<td>'.$mod.'</td>'.'<td>'.(\call_user_func(array($mod, 'right_public')) ? 'true' : 'false').'</td>'.'<td>'.(\call_user_func(array($mod, 'right_right')) ? 'true' : 'false').'</td>'.'</tr>';}
$result .= '</table>';
$result .= '<h3>Project Mods</h3>'.
return $result;
}
public static function html_content_project(){
$result = '<h3>Project Mods</h3>'.
'<table class="table table-hover table-condensed" style="overflow: auto;">'.
'<tr>'.'<th>'.'Classname'.'</th>'.'<th>'.'Public'.'</th>'.'<th>'.'You can Access?'.'</th>'.'</tr>';
@ -21,7 +25,14 @@ class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
$result .= '<tr>'.'<td>'.$mod.'</td>'.'<td>'.(\call_user_func(array($mod, 'right_public')) ? 'true' : 'false').'</td>'.'<td>'.(\call_user_func(array($mod, 'right_right')) ? 'true' : 'false').'</td>'.'</tr>';}
$result .= '</table>';
return $result;
return $result;
}
public static function html_content(){
$vars=array();
$vars['content_sys'] = self::html_content_sys();
$vars['content_project'] = self::html_content_project();
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_mod/mods.tpl'), $vars);
}
public static function html_li_menu(){return '<li><a href="#" id=".SYSTEM.SAI.saimod_sys_mod">SAI Mods</a></li>';}
@ -29,5 +40,6 @@ class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\system::getSystemDBInfo(), \SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
public static function src_css(){}
public static function src_js(){}
public static function src_js(){ return \SYSTEM\LOG\JsonResult::toString(
array(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_mod/saimod_sys_mod.js')));}
}

View File

@ -0,0 +1,3 @@
.tab-content {
clear: none;
}

View File

@ -0,0 +1,6 @@
function init__SYSTEM_SAI_saimod_sys_security() {
$('#securitytab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
})
};

View File

@ -1,8 +1,30 @@
<?php
namespace SYSTEM\SAI;
class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
public static function html_content(){
class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
public static function html_content_groups(){
return "No Groups available yet.";
}
public static function html_content_rights(){
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->query('SELECT * FROM system.rights ORDER BY "ID" ASC;');
} else {
$res = $con->query('SELECT * FROM system_rights ORDER BY ID ASC;');
}
$result = '<input type="submit" class="btn" value="New Right" newright="1"></br></br>'.
'<table class="table table-hover table-condensed" style="overflow: auto;">'.
'<tr>'.'<th>'.'ID'.'</th>'.'<th>'.'Name'.'</th>'.'<th>'.'Description'.'</th>'.'<th>'.'Action'.'</th>'.'</tr>';
while($r = $res->next()){
$result .= '<tr>'.'<td>'.$r['ID'].'</td>'.'<td>'.$r['name'].'</td>'.'<td>'.$r['description'].'</td>'.'<td>'.'<input type="submit" class="btn-danger" value="delete" delright="'.$r['ID'].'">'.'<input type="submit" class="btn" value="edit" editright="'.$r['ID'].'">'.'</td>'.'</tr>';
}
$result .= '</table>';
return $result;
}
public static function html_content_users(){
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
if(\SYSTEM\system::isSystemDbInfoPG()){
$res = $con->query('SELECT id,username,email,joindate,locale,last_active,account_flag FROM system.user ORDER BY last_active DESC;');
@ -19,7 +41,15 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
$result .= '<tr class="'.self::tablerow_class($r['last_active']).'">'.'<td>'.$r['id'].'</td>'.'<td>'.$r['username'].' <input type="submit" class="btn-danger" value="delete" user="'.$r['id'].'" action="delete">'.'</td>'.'<td>'.$r['email'].'</td>'.'<td>'.$r['joindate'].'</td>'.'<td>'.$r['locale'].'</td>'.'<td>'.$r['last_active'].'</td>'.'<td>'.$r['account_flag'].'</td>'.'<td>'.'<input type="submit" class="btn" value="edit" user="'.$r['id'].'" action="edit"><input type="submit" class="btn-danger" value="delete" user="'.$r['id'].'" action="delete"></td><td><button type="submit" class="btn" value="reset_password" user="'.$r['id'].'" email="'.$r['email'].'">send EMail</button>'.'</td>'.'</tr>';
}
$result .= '</table>';
return $result;
return $result;
}
public static function html_content(){
$vars = array();
$vars['content_users'] = self::html_content_users();
$vars['content_rights'] = self::html_content_rights();
$vars['content_groups'] = self::html_content_groups();
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_security/security.tpl'), $vars);
}
private static function tablerow_class($last_active){
@ -39,6 +69,8 @@ class saimod_sys_security extends \SYSTEM\SAI\SaiModule {
public static function right_public(){return false;}
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\system::getSystemDBInfo(), \SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
public static function src_css(){}
public static function src_js(){}
public static function src_css(){return \SYSTEM\LOG\JsonResult::toString(
array(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_security/saimod_sys_security.css')));}
public static function src_js(){ return \SYSTEM\LOG\JsonResult::toString(
array(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_security/saimod_sys_security.js')));}
}

View File

@ -0,0 +1,12 @@
<div class="tabbable">
<ul class="nav nav-tabs" id="securitytab">
<li class="active"><a href="#tab_users">Users</a></li>
<li><a href="#tab_rights">Rights</a></li>
<li><a href="#tab_groups">Groups</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_users">${content_users}</div>
<div class="tab-pane" id="tab_rights">${content_rights}</div>
<div class="tab-pane" id="tab_groups">${content_groups}</div>
</div>
</div>

View File

@ -21,21 +21,18 @@
</ul>
</div>
</div>
<div id="project_navbar" style="width:210px;float:left;">
<div class="navbar-inner">
<ul class="nav nav-list">
${menu_proj}
</ul>
</div>
</div>
<div id="content">
<div id="content-wrapper"></div>
<div id="project_navbar" style="width:210px; float:left;">
<div class="navbar-inner">
<ul class="nav nav-list">
${menu_proj}
</ul>
</div>
</div>
<div id="content" style="float: left;">
<div id="content-wrapper" style="clear: both; overflow: auto; width: 100%;"></div>
<hr>
<div class="footer">
<p>${copyright}</p>
</div>
<div class="footer"><p>${copyright}</p></div>
</div>
</body>
</html>