Tabable text table
This commit is contained in:
parent
d8e16ee98d
commit
f68ce6c9e6
@ -1,8 +0,0 @@
|
||||
<h3>Locale String <input type="submit" value="Add" class="btn content_add"></h3>
|
||||
<br>
|
||||
<table class="table table-hover table-condensed" style="overflow: auto;">
|
||||
<tr>
|
||||
<th>ID</th><th>Category</th>${langhead}
|
||||
</tr>
|
||||
${content}
|
||||
</table>
|
||||
@ -2,6 +2,7 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
|
||||
$('.content_edit').click(function () {saimod_sys_locale_edit($(this).attr('name'));});
|
||||
$('.content_delete').click(function(){saimod_sys_locale_delete($(this).attr('name'));});
|
||||
$('.content_add').click(function(){saimod_sys_locale_add();});
|
||||
$('#localetab a').click(function (e) {e.preventDefault(); $(this).tab('show');});
|
||||
}
|
||||
function saimod_sys_locale_add(){
|
||||
$('div#content-wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=addmode',function(){
|
||||
|
||||
@ -10,29 +10,54 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale(){
|
||||
$vars = array();
|
||||
|
||||
$vars['langhead'] = '';
|
||||
foreach (self::getLanguages() as $lang){
|
||||
$vars['langhead'] .= '<th>'.$lang.'</th>';
|
||||
$languages[] = $lang;
|
||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
||||
$res = $con->query('SELECT "category", COUNT(*) as "count" FROM system.locale_string GROUP BY "category" ORDER BY "category" ASC;');
|
||||
} else {
|
||||
$res = $con->query('SELECT "category", COUNT(*) as "count" FROM system.locale_string GROUP BY "category" ORDER BY "category" ASC;');
|
||||
}
|
||||
|
||||
$vars['tabopts'] = '';
|
||||
$first = true;
|
||||
while($r = $res->next()){
|
||||
$vars2 = array( 'active' => ($first ? 'active' : ''),
|
||||
'tab_id' => $r['category']);
|
||||
$first = false;
|
||||
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tabopt.tpl'), $vars2);
|
||||
}
|
||||
|
||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
||||
$res = $con->query('SELECT * FROM system.locale_string ORDER BY "category" ASC;');
|
||||
} else {
|
||||
$res = $con->query('SELECT * FROM system_locale_string ORDER BY category ASC;');
|
||||
}
|
||||
$vars['content'] = '';
|
||||
while($r = $res->next()){
|
||||
$content = '';
|
||||
foreach ($languages as $columns){
|
||||
$content .= '<td>'.$r[$columns].'</td>';
|
||||
}
|
||||
$r['content'] = $content;
|
||||
$vars['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/list_entry.tpl'), $r);
|
||||
|
||||
$langhead = '';
|
||||
foreach (self::getLanguages() as $lang){
|
||||
$langhead .= '<th>'.$lang.'</th>';
|
||||
$languages[] = $lang;
|
||||
}
|
||||
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/list.tpl'), $vars);
|
||||
while($r = $res->next()){
|
||||
$tabs[$r['category']]['tab_id'] = $r['category'];
|
||||
$tabs[$r['category']]['content'] = isset($tabs[$r['category']]['content']) ? $tabs[$r['category']]['content'] : '';
|
||||
$tabs[$r['category']]['langhead'] = $langhead;
|
||||
|
||||
$r['content'] = '';
|
||||
foreach ($languages as $columns){
|
||||
$r['content'] .= '<td>'.$r[$columns].'</td>';
|
||||
}
|
||||
$tabs[$r['category']]['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/list_entry.tpl'), $r);
|
||||
}
|
||||
|
||||
$vars['tabs'] = '';
|
||||
$first = true;
|
||||
foreach($tabs as $tab){
|
||||
$tab['active'] = ($first ? 'active' : '');
|
||||
$first = false;
|
||||
$vars['tabs'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tab.tpl'), $tab);}
|
||||
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tabs.tpl'), $vars);
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_edit($id, $lang, $newtext){
|
||||
@ -51,7 +76,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
|
||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
||||
$res = null;
|
||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
||||
throw new \SYSTEM\LOG\ERROR("action_edit failed");
|
||||
$res = $con->prepare('addText' ,'INSERT INTO system.locale_string (id, category) VALUES ($1, $2);', array($id, $category));
|
||||
} else {
|
||||
$res = $con->prepare('addText' ,'INSERT INTO system_locale_string (id, category) VALUES (?, ?);', array($id, $category));
|
||||
}
|
||||
@ -66,7 +91,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
|
||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
||||
$res = null;
|
||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
||||
throw new \SYSTEM\LOG\ERROR("action_delete failed");
|
||||
$res = $con->prepare('deleteText' ,'DELETE FROM system.locale_string WHERE id=$1;', array($id));
|
||||
} else {
|
||||
$res = $con->prepare('deleteText' ,'DELETE FROM system_locale_string WHERE id=?;', array($id));
|
||||
}
|
||||
|
||||
8
sai/modules/saimod_sys_locale/tab.tpl
Normal file
8
sai/modules/saimod_sys_locale/tab.tpl
Normal file
@ -0,0 +1,8 @@
|
||||
<div class="tab-pane ${active}" id="tab_${tab_id}">
|
||||
<table class="table table-hover table-condensed" style="overflow: auto;">
|
||||
<tr>
|
||||
<th>ID</th><th>Category</th>${langhead}
|
||||
</tr>
|
||||
${content}
|
||||
</table>
|
||||
</div>
|
||||
1
sai/modules/saimod_sys_locale/tabopt.tpl
Normal file
1
sai/modules/saimod_sys_locale/tabopt.tpl
Normal file
@ -0,0 +1 @@
|
||||
<li class="${active}"><a href="#tab_${tab_id}">Group ${tab_id}</a></li>
|
||||
10
sai/modules/saimod_sys_locale/tabs.tpl
Normal file
10
sai/modules/saimod_sys_locale/tabs.tpl
Normal file
@ -0,0 +1,10 @@
|
||||
<h3>Locale String <input type="submit" value="Add" class="btn content_add"></h3>
|
||||
<br>
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="localetab">
|
||||
${tabopts}
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
${tabs}
|
||||
</div>
|
||||
</div>
|
||||
@ -40,6 +40,7 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_login_action_registerform(){
|
||||
$vars = \SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI);
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI_ERROR));
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/register.tpl'), $vars);}
|
||||
|
||||
public static function html_li_menu(){return '<li><a href="#" saimenu=".SYSTEM.SAI.saimod_sys_login">Login</a></li>';}
|
||||
|
||||
@ -6,7 +6,10 @@ define('SAI_MOD_POSTFIELD','sai_mod');
|
||||
class saigui extends \SYSTEM\PAGE\Page {
|
||||
|
||||
public function html(){
|
||||
$pg = array_merge($_POST,$_GET);
|
||||
//Direct JSON Input
|
||||
$pg = json_decode(file_get_contents("php://input"), true);
|
||||
if(!$pg){
|
||||
$pg = array_merge($_POST,$_GET);}
|
||||
if(isset($pg[SAI_MOD_POSTFIELD])){
|
||||
$classname = \str_replace('.', '\\', $pg[SAI_MOD_POSTFIELD]);
|
||||
$pg[SAI_MOD_POSTFIELD] = \str_replace('.', '_', $pg[SAI_MOD_POSTFIELD]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user