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
|
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;
|
|
|
|
this.$('model').setDefault ('user_id', 'news',
|
2016-10-04 15:27:49 +00:00
|
|
|
new Sql.Function ({schema: 'account', name: 'userGetId'}));
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-03-27 19:10:49 +00:00
|
|
|
this.$('html-editor').id = 'html-editor';
|
2015-01-23 13:09:30 +00:00
|
|
|
tinymce.init ({
|
|
|
|
mode : 'exact'
|
|
|
|
,elements : 'html-editor'
|
2015-02-08 15:38:38 +00:00
|
|
|
,plugins: [
|
2015-01-23 13:09:30 +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"
|
|
|
|
]
|
|
|
|
,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';
|
|
|
|
});
|
|
|
|
}
|
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 ()
|
|
|
|
{
|
2015-03-19 19:36:11 +00:00
|
|
|
var newHtml = this.$('iter').get ('text');
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
if (!newHtml)
|
|
|
|
newHtml = '';
|
|
|
|
|
|
|
|
tinyMCE.get ('html-editor').setContent (newHtml);
|
|
|
|
}
|
|
|
|
|
|
|
|
,onAcceptClick: function ()
|
|
|
|
{
|
|
|
|
var newHtml = tinyMCE.get ('html-editor').getContent ();
|
2015-03-19 19:36:11 +00:00
|
|
|
this.$('iter').set ('text', newHtml);
|
|
|
|
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
|
|
|
});
|