mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-48933 core_message: Clean up for a better coding style
This commit is contained in:
parent
06569b71ac
commit
0061876d57
@ -15,7 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Message ajax.
|
||||
* Ajax point of entry for messaging API.
|
||||
*
|
||||
* @package core_message
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
|
@ -24,8 +24,22 @@ YUI.add('moodle-core_message-messenger', function (Y, NAME) {
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
var CSS = {},
|
||||
SELECTORS = {};
|
||||
|
||||
/**
|
||||
* Cascading Style Sheet References.
|
||||
*
|
||||
* Using the name "CSS" would redefine the existing JS object CSS.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var CSSR = {};
|
||||
|
||||
/**
|
||||
* Object containing a reference to the selectors.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var SELECTORS = {};
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -173,7 +187,7 @@ Y.namespace('M.core_message.messenger').init = function(config) {
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
CSS.SENDMSGDIALOG = {
|
||||
CSSR.SENDMSGDIALOG = {
|
||||
ACCESSHIDE: 'accesshide',
|
||||
ACTIONS: 'message-actions',
|
||||
FOOTER: 'message-footer',
|
||||
@ -218,28 +232,31 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer: function() {
|
||||
var tpl,
|
||||
content;
|
||||
|
||||
this._bb = this.get('boundingBox');
|
||||
|
||||
// Prepare the content area.
|
||||
tpl = Y.Handlebars.compile(
|
||||
'<form action="#">' +
|
||||
'<div class="{{CSS.INPUTAREA}}">' +
|
||||
'<label class="{{CSS.ACCESSHIDE}}" for="{{id}}">{{labelStr}}</label>' +
|
||||
'<textarea class="{{CSS.INPUT}}" id="{{id}}"></textarea>' +
|
||||
'<div class="{{CSS.NOTICEAREA}}" style="display: none;" aria-live="assertive">' +
|
||||
'<div class="{{CSS.NOTICE}}"><div></div></div>' +
|
||||
'<div class="{{CSSR.INPUTAREA}}">' +
|
||||
'<label class="{{CSSR.ACCESSHIDE}}" for="{{id}}">{{labelStr}}</label>' +
|
||||
'<textarea class="{{CSSR.INPUT}}" id="{{id}}"></textarea>' +
|
||||
'<div class="{{CSSR.NOTICEAREA}}" style="display: none;" aria-live="assertive">' +
|
||||
'<div class="{{CSSR.NOTICE}}"><div></div></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="{{CSS.ACTIONS}}">' +
|
||||
'<input type="submit" value="{{sendStr}}" class="{{CSS.SENDBTN}}">' +
|
||||
'<a href="#" class="{{CSS.HISTORYLINK}}">{{viewHistoryStr}}</a>' +
|
||||
'<div class="{{CSSR.ACTIONS}}">' +
|
||||
'<input type="submit" value="{{sendStr}}" class="{{CSSR.SENDBTN}}">' +
|
||||
'<a href="#" class="{{CSSR.HISTORYLINK}}">{{viewHistoryStr}}</a>' +
|
||||
'<div style="clear: both;"></div>' +
|
||||
'</div>' +
|
||||
'</form>'
|
||||
);
|
||||
content = Y.Node.create(
|
||||
tpl({
|
||||
CSS: CSS.SENDMSGDIALOG,
|
||||
CSSR: CSSR.SENDMSGDIALOG,
|
||||
id: Y.guid(),
|
||||
labelStr: M.util.get_string('messagetosend', 'core_message'),
|
||||
loadingIcon: M.util.image_url('i/loading', 'moodle'),
|
||||
@ -301,12 +318,12 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
// Actually send the message.
|
||||
this._ioSend = Y.io(this.get('url'), {
|
||||
method: 'POST',
|
||||
data: build_querystring({
|
||||
data: {
|
||||
sesskey: M.cfg.sesskey,
|
||||
action: 'sendmessage',
|
||||
userid: this.get('userid'),
|
||||
message: message
|
||||
}),
|
||||
},
|
||||
on: {
|
||||
start: function() {
|
||||
var img = '<img alt="" role="presentation" src="' + M.util.image_url('i/loading_small', 'moodle') + '">';
|
||||
@ -427,7 +444,7 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
|
||||
}, {
|
||||
NAME: 'core_message-messenger-sendmessage',
|
||||
CSS_PREFIX: CSS.SENDMSGDIALOG.PREFIX,
|
||||
CSS_PREFIX: CSSR.SENDMSGDIALOG.PREFIX,
|
||||
ATTRS: {
|
||||
|
||||
/**
|
||||
|
File diff suppressed because one or more lines are too long
@ -24,8 +24,22 @@ YUI.add('moodle-core_message-messenger', function (Y, NAME) {
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
var CSS = {},
|
||||
SELECTORS = {};
|
||||
|
||||
/**
|
||||
* Cascading Style Sheet References.
|
||||
*
|
||||
* Using the name "CSS" would redefine the existing JS object CSS.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var CSSR = {};
|
||||
|
||||
/**
|
||||
* Object containing a reference to the selectors.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var SELECTORS = {};
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@ -173,7 +187,7 @@ Y.namespace('M.core_message.messenger').init = function(config) {
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
CSS.SENDMSGDIALOG = {
|
||||
CSSR.SENDMSGDIALOG = {
|
||||
ACCESSHIDE: 'accesshide',
|
||||
ACTIONS: 'message-actions',
|
||||
FOOTER: 'message-footer',
|
||||
@ -218,28 +232,31 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer: function() {
|
||||
var tpl,
|
||||
content;
|
||||
|
||||
this._bb = this.get('boundingBox');
|
||||
|
||||
// Prepare the content area.
|
||||
tpl = Y.Handlebars.compile(
|
||||
'<form action="#">' +
|
||||
'<div class="{{CSS.INPUTAREA}}">' +
|
||||
'<label class="{{CSS.ACCESSHIDE}}" for="{{id}}">{{labelStr}}</label>' +
|
||||
'<textarea class="{{CSS.INPUT}}" id="{{id}}"></textarea>' +
|
||||
'<div class="{{CSS.NOTICEAREA}}" style="display: none;" aria-live="assertive">' +
|
||||
'<div class="{{CSS.NOTICE}}"><div></div></div>' +
|
||||
'<div class="{{CSSR.INPUTAREA}}">' +
|
||||
'<label class="{{CSSR.ACCESSHIDE}}" for="{{id}}">{{labelStr}}</label>' +
|
||||
'<textarea class="{{CSSR.INPUT}}" id="{{id}}"></textarea>' +
|
||||
'<div class="{{CSSR.NOTICEAREA}}" style="display: none;" aria-live="assertive">' +
|
||||
'<div class="{{CSSR.NOTICE}}"><div></div></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="{{CSS.ACTIONS}}">' +
|
||||
'<input type="submit" value="{{sendStr}}" class="{{CSS.SENDBTN}}">' +
|
||||
'<a href="#" class="{{CSS.HISTORYLINK}}">{{viewHistoryStr}}</a>' +
|
||||
'<div class="{{CSSR.ACTIONS}}">' +
|
||||
'<input type="submit" value="{{sendStr}}" class="{{CSSR.SENDBTN}}">' +
|
||||
'<a href="#" class="{{CSSR.HISTORYLINK}}">{{viewHistoryStr}}</a>' +
|
||||
'<div style="clear: both;"></div>' +
|
||||
'</div>' +
|
||||
'</form>'
|
||||
);
|
||||
content = Y.Node.create(
|
||||
tpl({
|
||||
CSS: CSS.SENDMSGDIALOG,
|
||||
CSSR: CSSR.SENDMSGDIALOG,
|
||||
id: Y.guid(),
|
||||
labelStr: M.util.get_string('messagetosend', 'core_message'),
|
||||
loadingIcon: M.util.image_url('i/loading', 'moodle'),
|
||||
@ -301,12 +318,12 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
// Actually send the message.
|
||||
this._ioSend = Y.io(this.get('url'), {
|
||||
method: 'POST',
|
||||
data: build_querystring({
|
||||
data: {
|
||||
sesskey: M.cfg.sesskey,
|
||||
action: 'sendmessage',
|
||||
userid: this.get('userid'),
|
||||
message: message
|
||||
}),
|
||||
},
|
||||
on: {
|
||||
start: function() {
|
||||
var img = '<img alt="" role="presentation" src="' + M.util.image_url('i/loading_small', 'moodle') + '">';
|
||||
@ -427,7 +444,7 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
|
||||
}, {
|
||||
NAME: 'core_message-messenger-sendmessage',
|
||||
CSS_PREFIX: CSS.SENDMSGDIALOG.PREFIX,
|
||||
CSS_PREFIX: CSSR.SENDMSGDIALOG.PREFIX,
|
||||
ATTRS: {
|
||||
|
||||
/**
|
||||
|
18
message/yui/src/messenger/js/constants.js
vendored
18
message/yui/src/messenger/js/constants.js
vendored
@ -22,5 +22,19 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
var CSS = {},
|
||||
SELECTORS = {};
|
||||
|
||||
/**
|
||||
* Cascading Style Sheet References.
|
||||
*
|
||||
* Using the name "CSS" would redefine the existing JS object CSS.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var CSSR = {};
|
||||
|
||||
/**
|
||||
* Object containing a reference to the selectors.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var SELECTORS = {};
|
||||
|
29
message/yui/src/messenger/js/sendmessage.js
vendored
29
message/yui/src/messenger/js/sendmessage.js
vendored
@ -22,7 +22,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
CSS.SENDMSGDIALOG = {
|
||||
CSSR.SENDMSGDIALOG = {
|
||||
ACCESSHIDE: 'accesshide',
|
||||
ACTIONS: 'message-actions',
|
||||
FOOTER: 'message-footer',
|
||||
@ -67,28 +67,31 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
* @method initializer
|
||||
*/
|
||||
initializer: function() {
|
||||
var tpl,
|
||||
content;
|
||||
|
||||
this._bb = this.get('boundingBox');
|
||||
|
||||
// Prepare the content area.
|
||||
tpl = Y.Handlebars.compile(
|
||||
'<form action="#">' +
|
||||
'<div class="{{CSS.INPUTAREA}}">' +
|
||||
'<label class="{{CSS.ACCESSHIDE}}" for="{{id}}">{{labelStr}}</label>' +
|
||||
'<textarea class="{{CSS.INPUT}}" id="{{id}}"></textarea>' +
|
||||
'<div class="{{CSS.NOTICEAREA}}" style="display: none;" aria-live="assertive">' +
|
||||
'<div class="{{CSS.NOTICE}}"><div></div></div>' +
|
||||
'<div class="{{CSSR.INPUTAREA}}">' +
|
||||
'<label class="{{CSSR.ACCESSHIDE}}" for="{{id}}">{{labelStr}}</label>' +
|
||||
'<textarea class="{{CSSR.INPUT}}" id="{{id}}"></textarea>' +
|
||||
'<div class="{{CSSR.NOTICEAREA}}" style="display: none;" aria-live="assertive">' +
|
||||
'<div class="{{CSSR.NOTICE}}"><div></div></div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="{{CSS.ACTIONS}}">' +
|
||||
'<input type="submit" value="{{sendStr}}" class="{{CSS.SENDBTN}}">' +
|
||||
'<a href="#" class="{{CSS.HISTORYLINK}}">{{viewHistoryStr}}</a>' +
|
||||
'<div class="{{CSSR.ACTIONS}}">' +
|
||||
'<input type="submit" value="{{sendStr}}" class="{{CSSR.SENDBTN}}">' +
|
||||
'<a href="#" class="{{CSSR.HISTORYLINK}}">{{viewHistoryStr}}</a>' +
|
||||
'<div style="clear: both;"></div>' +
|
||||
'</div>' +
|
||||
'</form>'
|
||||
);
|
||||
content = Y.Node.create(
|
||||
tpl({
|
||||
CSS: CSS.SENDMSGDIALOG,
|
||||
CSSR: CSSR.SENDMSGDIALOG,
|
||||
id: Y.guid(),
|
||||
labelStr: M.util.get_string('messagetosend', 'core_message'),
|
||||
loadingIcon: M.util.image_url('i/loading', 'moodle'),
|
||||
@ -150,12 +153,12 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
// Actually send the message.
|
||||
this._ioSend = Y.io(this.get('url'), {
|
||||
method: 'POST',
|
||||
data: build_querystring({
|
||||
data: {
|
||||
sesskey: M.cfg.sesskey,
|
||||
action: 'sendmessage',
|
||||
userid: this.get('userid'),
|
||||
message: message
|
||||
}),
|
||||
},
|
||||
on: {
|
||||
start: function() {
|
||||
var img = '<img alt="" role="presentation" src="' + M.util.image_url('i/loading_small', 'moodle') + '">';
|
||||
@ -276,7 +279,7 @@ Y.namespace('M.core_message.messenger').sendMessage = Y.extend(SENDMSGDIALOG, M.
|
||||
|
||||
}, {
|
||||
NAME: 'core_message-messenger-sendmessage',
|
||||
CSS_PREFIX: CSS.SENDMSGDIALOG.PREFIX,
|
||||
CSS_PREFIX: CSSR.SENDMSGDIALOG.PREFIX,
|
||||
ATTRS: {
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user