cleaned saimod text
This commit is contained in:
parent
64a8b1e971
commit
7b113f3f00
@ -40,8 +40,8 @@ INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`,
|
||||
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (110, 42, 'text', 'text', -1, 0, 0, '#content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text', 'init_saimod_sys_text', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (111, 42, 'tag', 'text', 110, 0, 0, '#tab_content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=tag&tag=${tag}', 'init_saimod_sys_text_tag', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (115, 42, 'edittext', 'text', 110, 0, 1, '#tab_content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=edittext&id=${id}&lang=${lang}', 'init_saimod_sys_text_edittext', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (116, 42, 'editor', 'text', 115, 0, 0, '#tab_editor', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=editor&id=${id}&lang=${lang}', 'init_saimod_sys_text_editor', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (115, 42, 'edittext', 'text', 110, 0, 1, '#tab_content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=edittext&id=${id}&lang=${lang}', '', '');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (116, 42, 'editor', 'text', 115, 0, 1, '#tab_editor', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_text&action=editor&id=${id}&lang=${lang}', 'init_saimod_sys_text_editor', '\\SYSTEM\\SAI\\saimod_sys_text');
|
||||
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (120, 42, 'todo', 'todo', -1, 0, 0, '#content', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo', 'init_saimod_sys_todo', '\\SYSTEM\\SAI\\saimod_sys_todo');
|
||||
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (121, 42, 'todolist', 'todo', 120, 0, 0, '#tab_todo', './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=todolist', 'init_saimod_sys_todo_todo', '\\SYSTEM\\SAI\\saimod_sys_todo');
|
||||
|
||||
@ -1,83 +1,30 @@
|
||||
<?php
|
||||
namespace SYSTEM\SAI;
|
||||
|
||||
class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
public static function getLanguages(){
|
||||
return \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS);}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text(){
|
||||
$vars = array();
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_LOCALE_TAGS::QQ();
|
||||
$vars = array();
|
||||
$vars['tabopts'] = '';
|
||||
$res = \SYSTEM\DBD\SYS_SAIMOD_LOCALE_TAGS::QQ();
|
||||
while($r = $res->next()){
|
||||
$vars2 = array('tag' => $r['tag']);
|
||||
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/tabopt.tpl'), $vars2);
|
||||
}
|
||||
$langtab_ = '';
|
||||
foreach (self::getLanguages() as $lang){
|
||||
$details['langs'] = $lang;
|
||||
$langtab_ .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/langtabopt.tpl'), $details);
|
||||
$languages[] = $lang;
|
||||
}
|
||||
$langtab['langs'] = $langtab_;
|
||||
$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/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_loadAll(){
|
||||
$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;';
|
||||
} else {
|
||||
$query = 'SELECT * FROM system_text;';
|
||||
}
|
||||
$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 \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/table.tpl'), array('entries' => $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;
|
||||
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/tabopt.tpl'), $r);}
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text.tpl'), $vars);
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_tag($tag = null){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
if ($tag) {
|
||||
$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."'";
|
||||
|
||||
$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 \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/table.tpl'), array('entries' => $entries));
|
||||
$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."'";
|
||||
} else {
|
||||
return self::sai_mod__SYSTEM_SAI_saimod_sys_text_action_loadAll();
|
||||
$query = 'SELECT * FROM system_text;';}
|
||||
|
||||
$res = $con->query($query);
|
||||
$entries = '';
|
||||
while($r = $res->next()){
|
||||
$entries .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_list_entry.tpl'), $r);
|
||||
}
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_list.tpl'), array('entries' => $entries));
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_edittext($id, $lang){
|
||||
@ -85,25 +32,30 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
$vars = array();
|
||||
$vars['tabopts'] = '';
|
||||
foreach($langs as $l){
|
||||
$vars2 = array( 'id' => $id,
|
||||
'lang' => $l,
|
||||
'default' => $l == $lang ? 'menu_lang_default' : '');
|
||||
$vars2 = array();
|
||||
$vars2['id'] = $id;
|
||||
$vars2['lang'] = $l;
|
||||
$vars2['default'] = ($l == $lang ? 'menu_lang_default' : '');
|
||||
$vars['tabopts'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/tabopt2.tpl'), $vars2);
|
||||
}
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/edit.tpl'), $vars);
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_edit_langs.tpl'), $vars);
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_editor($id, $lang){
|
||||
$vars = array();
|
||||
$vars['id'] = $id;
|
||||
$vars['lang'] = $lang;
|
||||
$vars['content'] = \SYSTEM\DBD\SYS_SAIMOD_TEXT_GETTEXT_LANG::Q1(array($id, $lang))['text'];
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/editor.tpl'), $vars);
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tpl/saimod_sys_text_edit_editor.tpl'), $vars);
|
||||
}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_save($id, $lang, $tags){
|
||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_ADD::QI(array($id, $category)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added"));}
|
||||
/*public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_rename($id, $newid, $tags){}*/
|
||||
|
||||
/*public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_save($id, $lang, $tags){
|
||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_ADD::QI(array($id, $category)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added"));}*/
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_delete($id){
|
||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_DEL::QI(array($id)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("could not delete the permitted data"));}
|
||||
/*public static function sai_mod__SYSTEM_SAI_saimod_sys_text_action_delete($id){
|
||||
return \SYSTEM\DBD\SYS_SAIMOD_LOCALE_DEL::QI(array($id)) ? \SYSTEM\LOG\JsonResult::ok() : \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("could not delete the permitted data"));}*/
|
||||
|
||||
public static function html_li_menu(){return '<li><a id="menu_text" href="#!text">Text</a></li>';}
|
||||
public static function right_public(){return false;}
|
||||
@ -112,6 +64,5 @@ class saimod_sys_text extends \SYSTEM\SAI\SaiModule {
|
||||
public static function css(){
|
||||
return array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/css/saimod_sys_text.css'));}
|
||||
public static function js(){
|
||||
return array( // \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tinymce/tinymce.min.js'),
|
||||
\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/js/saimod_sys_text.js'));}
|
||||
return array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/js/saimod_sys_text.js'));}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
<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>
|
||||
</div>
|
||||
@ -1 +0,0 @@
|
||||
<li id="${langs}" class="langli"><a href="#">${langs}</a></li>
|
||||
@ -1,7 +0,0 @@
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs" id="tagtabs">
|
||||
${langs}
|
||||
</ul>
|
||||
<div class="tab-content" >
|
||||
<table class="table sai_table entries" id="tab-content"></table>
|
||||
</div>
|
||||
@ -1,6 +1,8 @@
|
||||
<textarea id="texteditor" name="texteditor" style="width:100%">${content}</textarea>
|
||||
<br><br>
|
||||
<input type="text" placeholder="Tags..." />
|
||||
<b>Text ID:</b> <input type="text" value="${id}"/><button id="btn_add" class="btn-danger" style="margin-left: 15px; height: 32px; font-size: 13px;">Edit</button>
|
||||
<textarea id="texteditor" name="texteditor">${content}</textarea>
|
||||
<br>
|
||||
<input type="text" placeholder="Tags..." style="width: 98%;"/>
|
||||
<br>
|
||||
<button id="btn_back" class="btn" onClick="system.load('text');" style="margin-right: 15px; height: 32px; font-size: 13px; float: left;">Back</button>
|
||||
<button id="btn_add" class="btn-danger" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;">Delete</button>
|
||||
<button id="btn_add" class="btn-success" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;">Save</button>
|
||||
@ -1,8 +0,0 @@
|
||||
<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>Text</th><th>Tag</th>
|
||||
</tr>
|
||||
${content}
|
||||
</table>
|
||||
</div>
|
||||
Loading…
x
Reference in New Issue
Block a user