redesigned locale_string (not finished yet)
This commit is contained in:
parent
a6a8714e4f
commit
ca507450a1
11
dbd/qq/SYS_SAIMOD_LOCALE_SELECT_LANG.php
Normal file
11
dbd/qq/SYS_SAIMOD_LOCALE_SELECT_LANG.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_LOCALE_SELECT_LANG extends \SYSTEM\DB\QQ {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'SELECT id, category, ? FROM '.\SYSTEM\DBD\system_locale_string::NAME_PG.' ORDER BY "category" ASC;',
|
||||
//mys
|
||||
'SELECT id, category, ? FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' ORDER BY category ASC;'
|
||||
);}}
|
||||
@ -39,7 +39,7 @@ function register_controlls(){
|
||||
});
|
||||
|
||||
$('.btn_upload').click(function(){
|
||||
var formData = new FormData($('#form_'+$(this).attr('cat')));
|
||||
var formData = new FormData($('#form_'+$(this).attr('cat'))[0]);
|
||||
$.ajax({
|
||||
url: SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_files&action=upload&cat='+$(this).attr('cat'), //Server script to process data
|
||||
type: 'POST',
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
<h4>User Files</h4>
|
||||
<hr>
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="filestab">
|
||||
${tabopts}
|
||||
|
||||
18
sai/modules/saimod_sys_locale/editmode.tpl
Normal file
18
sai/modules/saimod_sys_locale/editmode.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="modal fade" id="modal_${id}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">${id}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea name="content" style="width:100%">
|
||||
${content}
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
4
sai/modules/saimod_sys_locale/entry.tpl
Normal file
4
sai/modules/saimod_sys_locale/entry.tpl
Normal file
@ -0,0 +1,4 @@
|
||||
<tr class="tableentry">
|
||||
<td>${id}</td>
|
||||
<td class="contenttext">${lang}</td>
|
||||
</tr>
|
||||
1
sai/modules/saimod_sys_locale/langtabopt.tpl
Normal file
1
sai/modules/saimod_sys_locale/langtabopt.tpl
Normal file
@ -0,0 +1 @@
|
||||
<li id="${langs}" class="langli"><a href="#tab_content">${langs}</a></li>
|
||||
7
sai/modules/saimod_sys_locale/langtabs.tpl
Normal file
7
sai/modules/saimod_sys_locale/langtabs.tpl
Normal file
@ -0,0 +1,7 @@
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="langtabs">
|
||||
${langs}
|
||||
</ul>
|
||||
<div class="tab-content" >
|
||||
<table class="table sai_table entries" id="tab-content"></table>
|
||||
</div>
|
||||
@ -1,8 +1,71 @@
|
||||
//saving content data
|
||||
var cData = {group: '',
|
||||
lang: '',
|
||||
id: ''};
|
||||
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');});
|
||||
if(!cData.lang && !cData.group) {
|
||||
cData.group = $('.groups').first().attr('id');
|
||||
cData.lang = $('.langli').first().attr('id');
|
||||
$('#'+cData.group).addClass('active');
|
||||
$('#'+cData.lang).addClass('active');
|
||||
saimod_sys_locale_loadcontent(cData.lang, cData.group);
|
||||
}
|
||||
$('.groups').click(function(){
|
||||
if (cData.group){
|
||||
$('#'+cData.group).removeClass('active');}
|
||||
if (cData.group && cData.lang && (cData.group !== $(this).attr('id'))){
|
||||
cData.group = $(this).attr('id');
|
||||
saimod_sys_locale_loadcontent(cData.lang, cData.group);}
|
||||
cData.group = $(this).attr('id');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
$('.langli').click(function(){
|
||||
if (cData.group && cData.lang){
|
||||
$('#'+cData.lang).removeClass('active');}
|
||||
cData.lang = $(this).attr('id');
|
||||
$(this).addClass('active');
|
||||
saimod_sys_locale_loadcontent(cData.lang, cData.group);
|
||||
});
|
||||
$('#changetext').click(function(){
|
||||
saimod_sys_locale_savecontent(cData.id, cData.lang, $('#contenttextarea').html());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function saimod_sys_locale_savecontent(id, lang, newtext){
|
||||
$.ajax({
|
||||
url: SAI_ENDPOINT,
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||
action: 'edit',
|
||||
id: id,
|
||||
lang: lang,
|
||||
category: cData.group,
|
||||
newtext: newtext},
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
if (data.status == false){
|
||||
alert("Addition could not be applied.");
|
||||
} else {
|
||||
alert("Addition has been saved.");}
|
||||
}
|
||||
});
|
||||
}7
|
||||
|
||||
function saimod_sys_locale_loadsinglecontent(id, lang){
|
||||
$('#contenttextarea').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=singleload&id='+id+'&lang='+lang, function(){
|
||||
$('#modaltitle').html(id);
|
||||
cData.id = id;
|
||||
tinymce.init({selector:'textarea'});
|
||||
$('#modal').modal('show');
|
||||
});
|
||||
}
|
||||
|
||||
function saimod_sys_locale_loadcontent(id, group){
|
||||
$('#tab-content').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=load&id='+id+'&group='+group, function(){
|
||||
$('.tableentry').click(function(){
|
||||
saimod_sys_locale_loadsinglecontent($(this).children().first().html(), cData.lang);
|
||||
});
|
||||
});
|
||||
}
|
||||
function saimod_sys_locale_add(){
|
||||
$('div#content-wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=addmode',function(){
|
||||
|
||||
@ -9,9 +9,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale(){
|
||||
$vars = array();
|
||||
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_LOCALE_CATEGORY::QQ();
|
||||
|
||||
$vars['tabopts'] = '';
|
||||
$first = true;
|
||||
while($r = $res->next()){
|
||||
@ -19,36 +17,46 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
|
||||
'tab_id' => $r['category']);
|
||||
$first = false;
|
||||
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tabopt.tpl'), $vars2);
|
||||
}
|
||||
|
||||
$langhead = '';
|
||||
}
|
||||
$langtab_ = '';
|
||||
foreach (self::getLanguages() as $lang){
|
||||
$langhead .= '<th>'.$lang.'</th>';
|
||||
$details['langs'] = $lang;
|
||||
$langtab_ .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/langtabopt.tpl'), $details);
|
||||
$languages[] = $lang;
|
||||
}
|
||||
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_LOCALE_SELECT::QQ();
|
||||
$tabs = array();
|
||||
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);}
|
||||
|
||||
}
|
||||
$langtab['langs'] = $langtab_;
|
||||
$langhead = \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/langtabs.tpl'), $langtab);
|
||||
$vars['tabs'] = $langhead;
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/tabs.tpl'), $vars);
|
||||
//.\SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/editmode.tpl'), $vars);
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_load($lang, $group){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
$query = 'SELECT id, '.$lang.' FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' WHERE category='.$group.' ORDER BY category ASC;';
|
||||
$res = $con->query($query);
|
||||
$entries = '';
|
||||
$temparr = array();
|
||||
while($r = $res->next()){
|
||||
$temparr['lang'] = $r[$lang];
|
||||
$temparr['id'] = $r['id'];
|
||||
$entries .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/entry.tpl'), $temparr);
|
||||
}
|
||||
return $entries;
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_singleload($lang, $id){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
$result = "";
|
||||
$query = 'SELECT `'.$id.'` FROM `'.\SYSTEM\DBD\system_locale_string::NAME_MYS.'` WHERE id=\''.$lang.'\' ORDER BY category ASC;';
|
||||
new \SYSTEM\LOG\WARNING($query);
|
||||
$res = $con->query($query);
|
||||
$entries = '';
|
||||
$temparr = array();
|
||||
while($r = $res->next()){
|
||||
$entries .= $r[$id];
|
||||
}
|
||||
return $entries;
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_edit($id, $lang, $newtext){
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="tab-pane ${active}" id="tab_${tab_id}">
|
||||
<table class="table table-hover table-condensed" style="overflow: auto;">
|
||||
<div class="tab-pane" id="tab_${lang}">
|
||||
<table class="table table-hover table-condensed sai_table locale_table" style="overflow: auto;">
|
||||
<tr>
|
||||
<th>ID</th><th>Category</th>${langhead}
|
||||
<th>ID</th><th>Category</th><th>${lang}</th>
|
||||
</tr>
|
||||
${content}
|
||||
</table>
|
||||
|
||||
@ -1 +1 @@
|
||||
<li class="${active}"><a href="#tab_${tab_id}">Group ${tab_id}</a></li>
|
||||
<li class="${active}_groups groups" id="${tab_id}"><a href="#">Group ${tab_id}</a></li>
|
||||
@ -1,9 +1,29 @@
|
||||
<h4>Texts</h4>
|
||||
<hr>
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="localetab">
|
||||
${tabopts}
|
||||
<input type="submit" value="Add" class="btn btn-success content_add" style="margin-left: 15px;">
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
${tabs}
|
||||
<div class="tab-content" id="tab_content">
|
||||
${tabs}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="modaltitle">${id}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea id="contenttextarea" name="content" style="width:100%">
|
||||
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="changetext">Save changes</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="project_navbar" style="width:224px; position: fixed; left: 0px; bottom: 0px; top: 38px;">
|
||||
<ul class="nav nav-tabs nav-stacked">
|
||||
<ul class="nav nav-tabs nav-stacked sai_project_modules">
|
||||
${menu_proj}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user