Merge branch 'master' of mojotrollz.eu:system
This commit is contained in:
commit
6f92278199
@ -1,15 +0,0 @@
|
||||
<h4>Add new text</h4>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td><b>ID: </b></td>
|
||||
<td><input type="text" id="content_new_id" value=""/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Category: </b></td>
|
||||
<td><input type="text" id="content_new_cat" value=""/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<input type="submit" class="btn localeMain" value="back">
|
||||
<input type="submit" class="btn add" value="save">
|
||||
@ -1,20 +0,0 @@
|
||||
<h4>${entry}</h4>
|
||||
<table class="table table-hover table-condensed" style="overflow: auto;">
|
||||
<tr>${langhead}</tr>
|
||||
<tr>${content}</tr>
|
||||
</table>
|
||||
<br>
|
||||
<input type="submit" class="btn localeMain" value="back">
|
||||
<script>tinymce.init({ selector: "textarea",
|
||||
force_p_newlines : false,
|
||||
forced_root_block : false,
|
||||
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
||||
plugins: [
|
||||
"advlist autolink lists link image charmap print preview anchor",
|
||||
"searchreplace visualblocks code fullscreen",
|
||||
"insertdatetime media table contextmenu paste moxiemanager",
|
||||
"textcolor"
|
||||
],
|
||||
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
|
||||
});
|
||||
</script>
|
||||
@ -1,7 +0,0 @@
|
||||
<td>
|
||||
<div class="dialog" style="padding-bottom: 5px;">
|
||||
<textarea name="content" class="tinymce" style="width: 100%" id="edit_field_${id}_${lang}">${value}</textarea>
|
||||
</div>
|
||||
<input type="submit" class="btn edit_content" value="edit" lang="${lang}" name="${id}">
|
||||
<br>
|
||||
</td>
|
||||
@ -1,18 +0,0 @@
|
||||
<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 -->
|
||||
@ -1 +1 @@
|
||||
<li id="${langs}" class="langli"><a href="#tab_content">${langs}</a></li>
|
||||
<li id="${langs}" class="langli"><a href="#">${langs}</a></li>
|
||||
@ -1,11 +0,0 @@
|
||||
<tr>
|
||||
<td style="padding-bottom: 5px;">
|
||||
${id}
|
||||
<div style="float:right;">
|
||||
<input type="submit" class="btn-danger content_delete" value="delete" name="${id}">
|
||||
<input type="submit" class="btn content_edit" value="edit" style="margin-left: 3px;" name="${id}">
|
||||
</div>
|
||||
</td>
|
||||
<td>${category}</td>
|
||||
${content}
|
||||
</tr>
|
||||
@ -10,7 +10,14 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
|
||||
$('#'+cData.group).addClass('active');
|
||||
$('#'+cData.lang).addClass('active');
|
||||
saimod_sys_locale_loadcontent(cData.lang, cData.group);
|
||||
}
|
||||
}
|
||||
|
||||
$('.content_add').click(function(){
|
||||
saimod_sys_locale_newtext();});
|
||||
|
||||
$('#newtext').click(function(){
|
||||
saimod_sys_locale_savenewcontent();});
|
||||
|
||||
$('.groups').click(function(){
|
||||
if (cData.group){
|
||||
$('#'+cData.group).removeClass('active');}
|
||||
@ -18,25 +25,47 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
|
||||
cData.group = $(this).attr('id');
|
||||
saimod_sys_locale_loadcontent(cData.lang, cData.group);}
|
||||
cData.group = $(this).attr('id');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
$(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);
|
||||
});
|
||||
saimod_sys_locale_loadcontent(cData.lang, cData.group);});
|
||||
|
||||
$('#changetext').click(function(){
|
||||
saimod_sys_locale_savecontent(cData.id, cData.lang);});
|
||||
|
||||
$('#del_text').click(function(){
|
||||
saimod_sys_locale_delete($('#modaltitle').html());});
|
||||
|
||||
}
|
||||
|
||||
function saimod_sys_locale_newtext(){
|
||||
$('#modaltitle').hide();
|
||||
$('#modaltextarea').hide();
|
||||
$('#del_text').hide();
|
||||
$.ajax({
|
||||
url: SAI_ENDPOINT,
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||
action: 'newtext'},
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
$('#contenttextarea').text('');
|
||||
$('#new_text_id').val('new title here');
|
||||
$('#new_text_id').show();
|
||||
$('#newtext').show();
|
||||
$('#changetext').hide();
|
||||
$('#newcontenttextarea').hide();
|
||||
$('#modal').modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saimod_sys_locale_savecontent(id, lang){
|
||||
tinyMCE.triggerSave();
|
||||
newtext = $('#contenttextarea').val();
|
||||
|
||||
$.ajax({
|
||||
url: SAI_ENDPOINT,
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||
@ -60,7 +89,32 @@ function saimod_sys_locale_savecontent(id, lang){
|
||||
});
|
||||
}
|
||||
|
||||
function saimod_sys_locale_savenewcontent(){
|
||||
tinyMCE.triggerSave();
|
||||
newtext = $('#contenttextarea').val();
|
||||
id = $('#new_text_id').val();
|
||||
console.log("id "+id);
|
||||
category = cData.group;
|
||||
$.ajax({
|
||||
url: SAI_ENDPOINT,
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||
action: 'add',
|
||||
id: id,
|
||||
category: cData.group},
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
saimod_sys_locale_loadcontent(cData.lang,cData.group);
|
||||
saimod_sys_locale_loadsinglecontent(id, cData.lang);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saimod_sys_locale_loadsinglecontent(id, lang){
|
||||
$('#new_text_id').hide();
|
||||
$('#newtext').hide();
|
||||
$('#modaltextarea').show();
|
||||
$('#changetext').show();
|
||||
$('#del_text').show();
|
||||
tinymce.init({selector:'textarea'});
|
||||
|
||||
$.ajax({
|
||||
@ -75,6 +129,7 @@ function saimod_sys_locale_loadsinglecontent(id, lang){
|
||||
$('#modal_success').hide();
|
||||
$('#modal_fail').hide();
|
||||
$('#modaltitle').html(id);
|
||||
$('#modaltitle').show();
|
||||
cData.id = id;
|
||||
$('#modal').modal('show');
|
||||
}
|
||||
@ -88,55 +143,13 @@ function saimod_sys_locale_loadcontent(id, group){
|
||||
});
|
||||
});
|
||||
}
|
||||
function saimod_sys_locale_add(){
|
||||
$('div#content-wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=addmode',function(){
|
||||
$('.localeMain').click(function(){
|
||||
loadModuleContent('.SYSTEM.SAI.saimod_sys_locale');
|
||||
});
|
||||
$('.add').click(function(){
|
||||
$.ajax({ url: SAI_ENDPOINT,
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||
action: 'add',
|
||||
id: $('#content_new_id').val(),
|
||||
category: $('#content_new_cat').val()},
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
if (data.status == false){
|
||||
alert("Addition could not be applied.");
|
||||
} else {
|
||||
alert("Addition has been saved.");}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function saimod_sys_locale_delete(buttonID){
|
||||
$.getJSON(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=delete&id='+buttonID,
|
||||
function(data){if (data.status == false){ alert("false"); } else { alert("true");}});
|
||||
}
|
||||
|
||||
function saimod_sys_locale_edit(buttonID){
|
||||
$('div#content-wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=editmode&entry='+buttonID, function(){
|
||||
$('.localeMain').click(function(){
|
||||
loadModuleContent('.SYSTEM.SAI.saimod_sys_locale');
|
||||
});
|
||||
$('.edit_content').click(function(){
|
||||
tinyMCE.triggerSave();
|
||||
$.ajax({ url: SAI_ENDPOINT,
|
||||
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
|
||||
action: 'edit',
|
||||
id: $(this).attr('name'),
|
||||
lang: $(this).attr('lang'),
|
||||
newtext: $('#edit_field_'+$(this).attr('name')+'_'+$(this).attr('lang')).val()},
|
||||
type: 'POST',
|
||||
success: function(data) {
|
||||
if (data.status == false){
|
||||
alert("Changes could not be applied.");
|
||||
} else {
|
||||
alert("Changes has been saved.");}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
function(data){if (data.status == false){ alert("Failed to delete text!"); } else {
|
||||
alert("Text deleted!");
|
||||
saimod_sys_locale_loadcontent(cData.lang,cData.group);}});
|
||||
|
||||
saimod_sys_locale_loadcontent(cData.lang,cData.group);
|
||||
$('#modal').modal('hide');
|
||||
}
|
||||
|
||||
@ -73,36 +73,10 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_add($id, $category){
|
||||
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_locale_action_addmode(){
|
||||
$vars = array();
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/add.tpl'), $vars);}
|
||||
|
||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_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_locale_action_editmode($entry){
|
||||
$r = \SYSTEM\DBD\SYS_SAIMOD_LOCALE_ID::Q1(array($entry));
|
||||
if(!$r){
|
||||
throw new \SYSTEM\LOG\ERROR("No such Entry found!");}
|
||||
|
||||
$vars = array();
|
||||
$vars['entry'] = $entry;
|
||||
$vars['langhead'] = '';
|
||||
|
||||
foreach (self::getLanguages() as $lang){
|
||||
$vars['langhead'] .= '<th>'.$lang.'</th>';
|
||||
$languages[] = $lang;
|
||||
}
|
||||
$vars['content'] = '';
|
||||
foreach ($languages as $lang){
|
||||
$r['lang'] = $lang;
|
||||
$r['value'] = $r[$lang];
|
||||
$vars['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/edit_entry.tpl'), $r);}
|
||||
|
||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/edit.tpl'), $vars);
|
||||
}
|
||||
|
||||
|
||||
public static function html_li_menu(){return '<li><a href="#" saimenu=".SYSTEM.SAI.saimod_sys_locale">Text</a></li>';}
|
||||
public static function right_public(){return false;}
|
||||
public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI) && \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_LOCALE);}
|
||||
|
||||
@ -3,27 +3,32 @@
|
||||
<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;">
|
||||
<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" 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>
|
||||
<input type="text" value="Text ID" id="new_text_id" style="display: none;">
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-body" id="modaltextarea" style="display: none;">
|
||||
<textarea id="contenttextarea" name="content" style="width:100%"></textarea>
|
||||
</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" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<Button type="button" id="del_text" class="btn-small btn-danger" style="float: left;">Delete</button>
|
||||
<button type="button" class="btn" data-dismiss="modal">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><!-- /.modal -->
|
||||
</div>
|
||||
Loading…
x
Reference in New Issue
Block a user