0
1
Fork 0
hedera-web-mindshore/forms/news/new/new.js

76 lines
1.8 KiB
JavaScript
Raw Normal View History

2015-12-10 13:48:43 +00:00
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'
2015-02-08 15:38:38 +00:00
,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
2015-02-01 03:21:54 +00:00
,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 ()
{
2015-08-17 18:02:14 +00:00
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'});
}
});
2015-12-10 13:48:43 +00:00
});