forked from verdnatura/hedera-web
76 lines
1.8 KiB
JavaScript
Executable File
76 lines
1.8 KiB
JavaScript
Executable File
|
|
Vn.include ('js/misc/tinymce/tinymce.min');
|
|
Vn.define (function () {
|
|
|
|
Vn.New = new Class
|
|
({
|
|
Extends: Vn.Form
|
|
|
|
,activate: function ()
|
|
{
|
|
this.$('model').mode = Db.Model.Mode.ON_DEMAND;
|
|
this.$('model').setDefault ('user_id', 'news',
|
|
new Sql.Func ({schema: 'account', name: 'user_get_id'}));
|
|
|
|
this.$('html-editor').id = 'html-editor';
|
|
tinymce.init ({
|
|
mode : 'exact'
|
|
,elements : 'html-editor'
|
|
,plugins: [
|
|
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
|
|
"searchreplace wordcount visualblocks visualchars code fullscreen",
|
|
"insertdatetime media nonbreaking save table contextmenu directionality",
|
|
"emoticons template paste textcolor"
|
|
]
|
|
,toolbar1: "print preview | link image media emoticons blockquote | insertfile undo redo "
|
|
,toolbar2: "bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"
|
|
,toolbar3: "styleselect | fontselect fontsizeselect | forecolor backcolor "
|
|
,image_advtab: true
|
|
,setup : function (editor)
|
|
{
|
|
editor.on ('init', function ()
|
|
{
|
|
this.getDoc().body.style.fontSize = '1em';
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
,onStatusChange: function (form)
|
|
{
|
|
if (this.$('new-id').value == 0)
|
|
form.insertRow ();
|
|
}
|
|
|
|
,onOperationsDone: function ()
|
|
{
|
|
Htk.Toast.showMessage (_('NewChangedSuccessfully'));
|
|
this.onReturnClick ();
|
|
}
|
|
|
|
,onBodyChange: function ()
|
|
{
|
|
var newHtml = this.$('iter').get ('text');
|
|
|
|
if (!newHtml)
|
|
newHtml = '';
|
|
|
|
tinyMCE.get ('html-editor').setContent (newHtml);
|
|
}
|
|
|
|
,onAcceptClick: function ()
|
|
{
|
|
var newHtml = tinyMCE.get ('html-editor').getContent ();
|
|
this.$('iter').set ('text', newHtml);
|
|
this.$('iter').performOperations ();
|
|
}
|
|
|
|
,onReturnClick: function ()
|
|
{
|
|
this.hash.set ({'form': 'news/news'});
|
|
}
|
|
});
|
|
|
|
});
|
|
|