saimod text rework, not a working version
This commit is contained in:
parent
1d7c0a4070
commit
3488d84d0b
@ -1,10 +1,19 @@
|
||||
//saving content data
|
||||
var cData = {group: '',
|
||||
lang: '',
|
||||
id: '',
|
||||
editmode: false};
|
||||
|
||||
function init_saimod_sys_text() {
|
||||
//create Modul Object
|
||||
var moduleText = new ModuleText();
|
||||
moduleText.init();
|
||||
|
||||
|
||||
//load all texts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//angularModule();
|
||||
/*
|
||||
init_tinymce();
|
||||
$('#addtext').show();
|
||||
if(!cData.lang && !cData.group) {
|
||||
@ -70,9 +79,44 @@ function init_saimod_sys_text() {
|
||||
if ($(e.target).closest(".mce-window").length) {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
});
|
||||
}); */
|
||||
}
|
||||
|
||||
ModuleText = function(){};
|
||||
|
||||
ModuleText.prototype.init = function(){
|
||||
//this.getTextsByTag("bla", "deDE");
|
||||
this.getTexts("deDE");
|
||||
};
|
||||
ModuleText.prototype.getTexts = function(lang){
|
||||
$.ajax({
|
||||
url: 'sai.php',
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_text',
|
||||
action: 'load',
|
||||
language: lang},
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
$('#tab_content').html(data);
|
||||
//$('#tab'+lang).addClass('active');
|
||||
}});
|
||||
};
|
||||
ModuleText.prototype.getText = function(id){};
|
||||
ModuleText.prototype.getTextsByTag = function(tag, lang){
|
||||
$.ajax({
|
||||
url: 'sai.php',
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_text',
|
||||
action: 'loadByTag',
|
||||
tag: tag,
|
||||
language: lang},
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
$('#tab_content').html(data);
|
||||
}});
|
||||
};
|
||||
ModuleText.prototype.updateText = function(){};
|
||||
ModuleText.prototype.deleteText = function(){};
|
||||
ModuleText.prototype.saveText = function(){};
|
||||
|
||||
function saimod_sys_text_newtext(){
|
||||
cData.editmode = true;
|
||||
$('#modaltitle').hide();
|
||||
|
||||
11
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_LOCALE_TAGS.php
Normal file
11
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_LOCALE_TAGS.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_LOCALE_TAGS extends \SYSTEM\DB\QQ {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'SELECT "tag", COUNT(*) as "count" FROM system_text_tag GROUP BY "tag" ORDER BY "tag" ASC;',
|
||||
//mys
|
||||
'SELECT `tag`, COUNT(*) as `count` FROM system_text_tag GROUP BY `tag` ORDER BY `tag` ASC;'
|
||||
);}}
|
||||
13
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_GETTEXTS.php
Normal file
13
sai/modules/saimod_sys_text/qq/SYS_SAIMOD_TEXT_GETTEXTS.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace SYSTEM\DBD;
|
||||
|
||||
class SYS_SAIMOD_TEXT_GETTEXTS extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
"SELECT system_text_tag.tag, system_text.* FROM system_text_tag
|
||||
LEFT JOIN system_text ON system_text_tag.id = system_text.id
|
||||
WHERE tag = '?' AND language = '?'"
|
||||
);}}
|
||||
@ -8,12 +8,14 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text(){
|
||||
$vars = array();
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_LOCALE_CATEGORY::QQ();
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_LOCALE_TAGS::QQ();
|
||||
$vars['tabopts'] = '';
|
||||
|
||||
$first = true;
|
||||
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/tabopt.tpl'), array( 'active' => ($first ? 'active' : ''), 'tag' => 'All'));
|
||||
while($r = $res->next()){
|
||||
$vars2 = array( 'active' => ($first ? 'active' : ''),
|
||||
'tab_id' => $r['category']);
|
||||
'tag' => $r['tag']);
|
||||
$first = false;
|
||||
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/tabopt.tpl'), $vars2);
|
||||
}
|
||||
@ -27,28 +29,50 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
$langhead = \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/langtabs.tpl'), $langtab);
|
||||
$vars['tabs'] = $langhead;
|
||||
$vars['langs'] = $langtab_;
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/tabs.tpl'), $vars);
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/main.tpl'), $vars);
|
||||
//.\SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/editmode.tpl'), $vars);
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_load($lang, $group){
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_load($lang){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
||||
$query = 'SELECT id, "'.$lang.'" FROM '.\SYSTEM\DBD\system_locale_string::NAME_PG.' WHERE category='.$group.' ORDER BY category ASC;';
|
||||
//$query = 'SELECT id, "'.$lang.'" FROM '.\SYSTEM\DBD\system_locale_string::NAME_PG.' WHERE category='.$group.' ORDER BY category ASC;';
|
||||
} else {
|
||||
$query = 'SELECT id, '.$lang.' FROM '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' WHERE category='.$group.' ORDER BY category ASC;';
|
||||
$query = 'SELECT * FROM system_text WHERE language=\''.$lang.'\';';
|
||||
new \SYSTEM\LOG\WARNING($query);
|
||||
}
|
||||
$res = $con->query($query);
|
||||
$entries = '';
|
||||
$temparr = array();
|
||||
while($r = $res->next()){
|
||||
$temparr['lang'] = $r[$lang];
|
||||
$temparr['language'] = $lang;
|
||||
$temparr['id'] = $r['id'];
|
||||
$temparr['text'] = $r['text'];
|
||||
$temparr['author'] = $r['author'];
|
||||
$entries .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/entry.tpl'), $temparr);
|
||||
}
|
||||
return $entries;
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_loadByTag($tag, $lang){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
$result = "";
|
||||
$query = "
|
||||
SELECT system_text_tag.tag, system_text.* FROM system_text_tag
|
||||
LEFT JOIN system_text ON system_text_tag.id = system_text.id
|
||||
WHERE tag = '".$tag."' AND language = '".$lang."'";
|
||||
|
||||
$res = $con->query($query);
|
||||
$entries = '';
|
||||
while($r = $res->next()){
|
||||
$entries .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/entry.tpl'), $r);
|
||||
}
|
||||
return $entries;
|
||||
//$query = 'SELECT '.$lang.' FROM `'.\SYSTEM\DBD\system_locale_string::NAME_MYS.'` WHERE id=\''.$id.'\' ORDER BY category ASC;';
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_singleload($id, $lang){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
$result = "";
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<tr class="tableentry" text_id="${id}">
|
||||
<td>${id}</td>
|
||||
<td class="contenttext">${lang}</td>
|
||||
<td class="contenttext">${language}</td>
|
||||
<td class="contenttext">${text}</td>
|
||||
<td class="contenttext">${author}</td>
|
||||
</tr>
|
||||
@ -1,5 +1,5 @@
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="langtabs">
|
||||
<ul class="nav nav-tabs" id="tagtabs">
|
||||
${langs}
|
||||
</ul>
|
||||
<div class="tab-content" >
|
||||
|
||||
51
sai/modules/saimod_sys_text/tpl/main.tpl
Normal file
51
sai/modules/saimod_sys_text/tpl/main.tpl
Normal file
@ -0,0 +1,51 @@
|
||||
<div class="saimodule_container">
|
||||
<h4>Texts</h4>
|
||||
<hr>
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="localetab">
|
||||
${tabopts}
|
||||
<input type="submit" value="Add" class="btn-small btn-success content_add" style="margin-left: 15px;">
|
||||
</ul>
|
||||
<div class="tab-content" id="tab_content">
|
||||
${tabs}
|
||||
</div>
|
||||
</div>
|
||||
<div id="editfield">
|
||||
<div class="modal fade" id="modal_main" style="width: 700px;" 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 id="new_category_id" style="display: none;">
|
||||
<h5>Category ID</h5>
|
||||
<input id="new_category_id_input" type="text" placeholder="New category ID here..."/>
|
||||
</div>
|
||||
<div id="new_text_id" style="display: none;">
|
||||
<h5>Text ID</h5>
|
||||
<input id="new_text_id_input" type="text" placeholder="New text ID here..."/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="addtext" style="display: none;">
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="langtabs_">
|
||||
${langs}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-body" id="modaltextarea" style="display: none;">
|
||||
<textarea id="contenttextarea" name="content" style="width:100%"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div id="modal_success" style="display: none;"><font color="green">Changes have been saved!</font></div>
|
||||
<div id="modal_fail" style="display: none;"><font color="red">Changes could not be saved!</font></div>
|
||||
<Button type="button" id="del_text" class="btn-small btn-danger" style="float: left;">Delete</button>
|
||||
<button type="button" class="btn" data-dismiss="modal" id="edit_close">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="changetext">Save changes</button>
|
||||
<button type="button" class="btn btn-primary" id="newtext" style="display: none;">Save new text</button>
|
||||
</div>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
</div>
|
||||
</div>
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="tab-pane" id="tab_${lang}">
|
||||
<div class="tab-pane" id="tab_${tag}">
|
||||
<table class="table table-hover table-condensed sai_table locale_table" style="overflow: auto;">
|
||||
<tr>
|
||||
<th>ID</th><th>Category</th><th>${lang}</th>
|
||||
<th>ID</th><th>Text</th><th>Tag</th>
|
||||
</tr>
|
||||
${content}
|
||||
</table>
|
||||
|
||||
@ -1 +1 @@
|
||||
<li class="${active}_groups groups" id="${tab_id}"><a href="#">Group ${tab_id}</a></li>
|
||||
<li class="saimod_text_tagtab groups" id="saimod_text_tagtab_${tag}"><a href="#">Tag ${tag}</a></li>
|
||||
Loading…
x
Reference in New Issue
Block a user