further text update, module should work now without any bugs. greater editor implemented

This commit is contained in:
messerbill 2014-06-03 14:53:22 +02:00
parent 4cf63acb6c
commit f09dce3e23
2 changed files with 35 additions and 3 deletions

View File

@ -18,9 +18,11 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
saimod_sys_locale_newtext();});
$('#edit_close').click(function(){
$('#addtext').show();
cData.editmode = false;});
$('#newtext').click(function(){
$('#addtext').show();
saimod_sys_locale_savenewcontent();
cData.editmode = false;});
@ -55,13 +57,16 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
$('#del_text').click(function(){
saimod_sys_locale_delete($('#modaltitle').html());});
$(document).keyup(function(e) {
if (e.keyCode === 27) { $('#addtext').show(); } // esc
});
}
function saimod_sys_locale_newtext(){
$('#modaltitle').hide();
$('#modaltextarea').hide();
$('#del_text').hide();
$('#addtext').hide();
$.ajax({
url: SAI_ENDPOINT,
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
@ -130,7 +135,7 @@ function saimod_sys_locale_loadsinglecontent(id, lang){
$('#modaltextarea').show();
$('#changetext').show();
$('#del_text').show();
tinymce.init({selector:'textarea'});
init_tinymce();
$.ajax({
url: SAI_ENDPOINT,
@ -169,3 +174,27 @@ function saimod_sys_locale_delete(buttonID){
saimod_sys_locale_loadcontent(cData.lang,cData.group);
$('#modal').modal('hide');
}
function init_tinymce(){
tinymce.init({ // General options
mode : "textareas",
theme : "modern",
plugins : "anchor,bbcode,charmap,code,contextmenu,directionality,link,textcolor,table,hr,fullscreen,autolink,lists,spellchecker,pagebreak,layer,table,save,emoticons,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template",
// Theme options
theme_modern_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_modern_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",
theme_modern_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_modern_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_modern_toolbar_location : "top",
theme_modern_toolbar_align : "left",
theme_modern_statusbar_location : "bottom",
theme_modern_resizing : true,
width: "100%",
height: "250px",
// Example content CSS (should be your site CSS)
content_css : "../../page/index.css"
});
}

View File

@ -10,13 +10,14 @@
</div>
</div>
<div id="editfield">
<div class="modal fade" id="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal fade" id="modal" 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>
<input type="text" id="new_text_id" placeholder="new title here..." style="display: none;" />
</div>
<div id="addtext" style="display: none;">
<div class="tabbable">
<ul class="nav nav-tabs" id="langtabs_">
${langs}
@ -25,6 +26,7 @@
<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>
@ -33,6 +35,7 @@
<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 -->