2015-01-23 13:09:30 +00:00
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
Vn.include ('node_modules/tinymce/tinymce.min');
|
2015-12-10 13:48:43 +00:00
|
|
|
Vn.define (function () {
|
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
Hedera.New = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Hedera.Form
|
2016-10-11 07:26:10 +00:00
|
|
|
|
|
|
|
,editor: null
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
,activate: function ()
|
|
|
|
{
|
2015-03-19 19:36:11 +00:00
|
|
|
this.$('model').mode = Db.Model.Mode.ON_DEMAND;
|
2017-12-20 11:34:04 +00:00
|
|
|
this.$('model').setDefault ('userFk', 'news',
|
2018-05-11 09:25:10 +00:00
|
|
|
new Sql.Function ({schema: 'account', name: 'myUserGetId'}));
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
tinymce.init ({
|
2016-10-11 07:26:10 +00:00
|
|
|
mode : 'exact'
|
|
|
|
,target: this.$('html-editor')
|
2015-02-08 15:38:38 +00:00
|
|
|
,plugins: [
|
2016-10-11 07:26:10 +00:00
|
|
|
"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"
|
2015-01-23 13:09:30 +00:00
|
|
|
]
|
2016-10-11 07:26:10 +00:00
|
|
|
,toolbar1:
|
2018-05-16 10:01:31 +00:00
|
|
|
" print preview | link image media emoticons blockquote"
|
|
|
|
+" | insertfile undo redo | bold italic"
|
|
|
|
+" | alignleft aligncenter alignright alignjustify"
|
|
|
|
+" | bullist numlist outdent indent"
|
|
|
|
+" | styleselect | fontselect fontsizeselect"
|
|
|
|
+" | forecolor backcolor"
|
2015-01-23 13:09:30 +00:00
|
|
|
,image_advtab: true
|
2016-10-11 07:26:10 +00:00
|
|
|
,init_instance_callback : this._onEditorInit.bind (this)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
,deactivate: function ()
|
|
|
|
{
|
|
|
|
this.editor.destroy ();
|
|
|
|
}
|
|
|
|
|
|
|
|
,_onEditorInit: function (editor)
|
|
|
|
{
|
|
|
|
this.editor = editor;
|
|
|
|
editor.getDoc ().body.style.fontSize = '1em';
|
|
|
|
this.setEditorText ();
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2016-10-11 07:26:10 +00:00
|
|
|
,setEditorText: function ()
|
|
|
|
{
|
|
|
|
if (!this.editor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var newHtml = this.$('iter').get ('text');
|
|
|
|
|
|
|
|
if (!newHtml)
|
|
|
|
newHtml = '';
|
|
|
|
|
|
|
|
this.editor.setContent (newHtml);
|
|
|
|
}
|
|
|
|
|
2015-01-23 13:09:30 +00:00
|
|
|
,onStatusChange: function (form)
|
|
|
|
{
|
2015-03-19 19:36:11 +00:00
|
|
|
if (this.$('new-id').value == 0)
|
2015-01-23 13:09:30 +00:00
|
|
|
form.insertRow ();
|
|
|
|
}
|
2015-03-19 19:36:11 +00:00
|
|
|
|
|
|
|
,onOperationsDone: function ()
|
|
|
|
{
|
2015-08-17 18:02:14 +00:00
|
|
|
Htk.Toast.showMessage (_('NewChangedSuccessfully'));
|
2015-03-19 19:36:11 +00:00
|
|
|
this.onReturnClick ();
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
,onBodyChange: function ()
|
|
|
|
{
|
2016-10-11 07:26:10 +00:00
|
|
|
this.setEditorText ();
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,onAcceptClick: function ()
|
|
|
|
{
|
2016-10-11 07:26:10 +00:00
|
|
|
this.$('iter').set ('text', this.editor.getContent ());
|
2015-03-19 19:36:11 +00:00
|
|
|
this.$('iter').performOperations ();
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
2015-03-19 19:36:11 +00:00
|
|
|
|
|
|
|
,onReturnClick: function ()
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2015-03-19 19:36:11 +00:00
|
|
|
this.hash.set ({'form': 'news/news'});
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-12-10 13:48:43 +00:00
|
|
|
});
|