Merge branch 'MDL-56467_master' of git://github.com/markn86/moodle

This commit is contained in:
Dan Poltawski 2016-11-17 10:15:51 +00:00
commit 486fac73f2
6 changed files with 7 additions and 40 deletions

View file

@ -149,8 +149,6 @@ class message_output_airnotifier extends message_output {
return get_string('notconfigured', 'message_airnotifier');
} else {
$PAGE->requires->css('/message/output/airnotifier/style.css');
$airnotifiermanager = new message_airnotifier_manager();
$devicetokens = $airnotifiermanager->get_user_devices($CFG->airnotifiermobileappname, $USER->id);
@ -169,21 +167,19 @@ class message_output_airnotifier extends message_output {
$hideshowicon = $OUTPUT->pix_icon($hideshowiconname, get_string('showhide', 'message_airnotifier'));
$name = "{$devicetoken->name} {$devicetoken->model} {$devicetoken->platform} {$devicetoken->version}";
$hideurl = new moodle_url('message/output/airnotifier/action.php',
array('hide' => !$devicetoken->enable, 'deviceid' => $devicetoken->id,
'sesskey' => sesskey()));
$output .= html_writer::start_tag('li', array('id' => $devicetoken->id,
'class' => 'airnotifierdevice ' . $dimmed)) . "\n";
$output .= html_writer::label($name, 'deviceid-' . $devicetoken->id, array('class' => 'devicelabel ')) . ' ' .
html_writer::link($hideurl, $hideshowicon, array('class' => 'hidedevice', 'alt' => 'show/hide')) . "\n";
html_writer::link('#', $hideshowicon, array('class' => 'hidedevice', 'alt' => 'show/hide')) . "\n";
$output .= html_writer::end_tag('li') . "\n";
}
// Include the AJAX script to automatically trigger the action.
$airnotifiermanager->include_device_ajax();
$output = html_writer::tag('ul', $output, array('id' => 'airnotifierdevices'));
$output = html_writer::tag('ul', $output, array('class' => 'list-unstyled unstyled',
'id' => 'airnotifierdevices'));
} else {
$output = get_string('nodevices', 'message_airnotifier');
}

View file

@ -1,29 +0,0 @@
/**
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
Airnotifier (message output plugin) CSS
package message_airnotifier
category css
copyright 2012/2014 Jerome Mouneyrac / Juan Leyva
license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
ul#airnotifierdevices {
list-style: none;
margin: 0;
}

View file

@ -8,7 +8,7 @@ YUI.add('moodle-message_airnotifier-toolboxes', function (Y, NAME) {
// The CSS selectors we use.
var CSS = {
AIRNOTIFIERCONTENT: 'fieldset#messageprocessor_airnotifier',
AIRNOTIFIERCONTENT: 'div[data-processor-name="airnotifier"]',
HIDEDEVICE: 'a.hidedevice',
DEVICELI: 'li.airnotifierdevice',
DIMCLASS: 'dimmed',

View file

@ -1 +1 @@
YUI.add("moodle-message_airnotifier-toolboxes",function(e,t){var n={AIRNOTIFIERCONTENT:"fieldset#messageprocessor_airnotifier",HIDEDEVICE:"a.hidedevice",DEVICELI:"li.airnotifierdevice",DIMCLASS:"dimmed",DIMMEDTEXT:"dimmed_text",DEVICEIDPREFIX:"deviceid-"},r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{replace_button:function(t,n,r,i){i||(i="pointer");var s=e.one(t).all(n).setStyle("cursor",i);return s.on("click",r,this),s},toggle_hide_device_ui:function(e){var t=e.ancestor(n.DEVICELI),r=e.one("img"),i=n.DIMMEDTEXT,s="";t.hasClass(i)?s="hide":s="show",t.toggleClass(i);var o=M.util.get_string(s,"moodle");r.setAttrs({alt:o,title:o,src:M.util.image_url("t/"+s)}),e.set("title",o),e.set("className","editing_"+s)},send_request:function(t,n,r){t||(t={});var i=this.get("config").pageparams,s;for(s in i)t[s]=i[s];n&&n.show(),t.sesskey=M.cfg.sesskey;var o=M.cfg.wwwroot+this.get("ajaxurl"),u=[],a={method:"POST",data:t,on:{success:function(t,i){try{u=e.JSON.parse(i.responseText),u.error?e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(u)).show()}):u.success&&r()}catch(s){}n&&n.hide()},failure:function(t,r){n&&n.hide(),e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(r)).show()})}},context:this,sync:!1};return e.io(o,a),u},get_element_id:function(e){return e.get("id").replace(n.DEVICEIDPREFIX,"")}},{NAME:"device-toolbox",ATTRS:{ajaxurl:{value:0},config:{value:0}}});var i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,r,{initializer:function(){this.setup_for_device()},setup_for_device:function(t){t||(t=n.AIRNOTIFIERCONTENT),e.all(t).each(this._setup_for_device,this)},_setup_for_device:function(e){this.replace_button(e,n.HIDEDEVICE,this.toggle_hide_device)},toggle_hide_device:function(t){t.preventDefault();var r=t.target.ancestor(n.DEVICELI),i=t.target.ancestor("a",!0),s;r.hasClass(n.DIMMEDTEXT)?s=1:s=0;var o={field:"enable",enable:s,id:this.get_element_id(r)},u=M.util.add_spinner(e,r),a=this,f=function(){a.toggle_hide_device_ui(i)};this.send_request(o,u,f)}},{NAME:"message-device-toolbox",ATTRS:{}}),M.message=M.message||{},M.message.init_device_toolbox=function(e){return new i(e)}},"@VERSION@",{requires:["base","node","io"]});
YUI.add("moodle-message_airnotifier-toolboxes",function(e,t){var n={AIRNOTIFIERCONTENT:'div[data-processor-name="airnotifier"]',HIDEDEVICE:"a.hidedevice",DEVICELI:"li.airnotifierdevice",DIMCLASS:"dimmed",DIMMEDTEXT:"dimmed_text",DEVICEIDPREFIX:"deviceid-"},r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{replace_button:function(t,n,r,i){i||(i="pointer");var s=e.one(t).all(n).setStyle("cursor",i);return s.on("click",r,this),s},toggle_hide_device_ui:function(e){var t=e.ancestor(n.DEVICELI),r=e.one("img"),i=n.DIMMEDTEXT,s="";t.hasClass(i)?s="hide":s="show",t.toggleClass(i);var o=M.util.get_string(s,"moodle");r.setAttrs({alt:o,title:o,src:M.util.image_url("t/"+s)}),e.set("title",o),e.set("className","editing_"+s)},send_request:function(t,n,r){t||(t={});var i=this.get("config").pageparams,s;for(s in i)t[s]=i[s];n&&n.show(),t.sesskey=M.cfg.sesskey;var o=M.cfg.wwwroot+this.get("ajaxurl"),u=[],a={method:"POST",data:t,on:{success:function(t,i){try{u=e.JSON.parse(i.responseText),u.error?e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(u)).show()}):u.success&&r()}catch(s){}n&&n.hide()},failure:function(t,r){n&&n.hide(),e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(r)).show()})}},context:this,sync:!1};return e.io(o,a),u},get_element_id:function(e){return e.get("id").replace(n.DEVICEIDPREFIX,"")}},{NAME:"device-toolbox",ATTRS:{ajaxurl:{value:0},config:{value:0}}});var i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,r,{initializer:function(){this.setup_for_device()},setup_for_device:function(t){t||(t=n.AIRNOTIFIERCONTENT),e.all(t).each(this._setup_for_device,this)},_setup_for_device:function(e){this.replace_button(e,n.HIDEDEVICE,this.toggle_hide_device)},toggle_hide_device:function(t){t.preventDefault();var r=t.target.ancestor(n.DEVICELI),i=t.target.ancestor("a",!0),s;r.hasClass(n.DIMMEDTEXT)?s=1:s=0;var o={field:"enable",enable:s,id:this.get_element_id(r)},u=M.util.add_spinner(e,r),a=this,f=function(){a.toggle_hide_device_ui(i)};this.send_request(o,u,f)}},{NAME:"message-device-toolbox",ATTRS:{}}),M.message=M.message||{},M.message.init_device_toolbox=function(e){return new i(e)}},"@VERSION@",{requires:["base","node","io"]});

View file

@ -8,7 +8,7 @@ YUI.add('moodle-message_airnotifier-toolboxes', function (Y, NAME) {
// The CSS selectors we use.
var CSS = {
AIRNOTIFIERCONTENT: 'fieldset#messageprocessor_airnotifier',
AIRNOTIFIERCONTENT: 'div[data-processor-name="airnotifier"]',
HIDEDEVICE: 'a.hidedevice',
DEVICELI: 'li.airnotifierdevice',
DIMCLASS: 'dimmed',

View file

@ -6,7 +6,7 @@
// The CSS selectors we use.
var CSS = {
AIRNOTIFIERCONTENT: 'fieldset#messageprocessor_airnotifier',
AIRNOTIFIERCONTENT: 'div[data-processor-name="airnotifier"]',
HIDEDEVICE: 'a.hidedevice',
DEVICELI: 'li.airnotifierdevice',
DIMCLASS: 'dimmed',