[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 var STAMPPICKER_NAME = "Colourpicker", 2 STAMPPICKER; 3 4 /** 5 * Provides an in browser PDF editor. 6 * 7 * @module moodle-assignfeedback_editpdf-editor 8 */ 9 10 /** 11 * This is a drop down list of stamps. 12 * 13 * @namespace M.assignfeedback_editpdf 14 * @class stamppicker 15 * @constructor 16 * @extends M.assignfeedback_editpdf.dropdown 17 */ 18 STAMPPICKER = function(config) { 19 STAMPPICKER.superclass.constructor.apply(this, [config]); 20 }; 21 22 Y.extend(STAMPPICKER, M.assignfeedback_editpdf.dropdown, { 23 24 /** 25 * Initialise the menu. 26 * 27 * @method initializer 28 * @return void 29 */ 30 initializer: function(config) { 31 var stamplist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdf_menu"/>'); 32 33 // Build a list of stamped buttons. 34 Y.each(this.get('stamps'), function(stamp) { 35 var button, listitem, title; 36 37 title = M.util.get_string('stamp', 'assignfeedback_editpdf'); 38 button = Y.Node.create('<button><img height="16" width="16" alt="' + title + '" src="' + stamp + '"/></button>'); 39 button.setAttribute('data-stamp', stamp); 40 button.setStyle('backgroundImage', 'none'); 41 listitem = Y.Node.create('<li/>'); 42 listitem.append(button); 43 stamplist.append(listitem); 44 }, this); 45 46 47 // Set the call back. 48 stamplist.delegate('click', this.callback_handler, 'button', this); 49 stamplist.delegate('key', this.callback_handler, 'down:13', 'button', this); 50 51 // Set the accessible header text. 52 this.set('headerText', M.util.get_string('stamppicker', 'assignfeedback_editpdf')); 53 54 // Set the body content. 55 this.set('bodyContent', stamplist); 56 57 STAMPPICKER.superclass.initializer.call(this, config); 58 }, 59 callback_handler: function(e) { 60 e.preventDefault(); 61 var callback = this.get('callback'), 62 callbackcontext = this.get('context'), 63 bind; 64 65 this.hide(); 66 67 // Call the callback with the specified context. 68 bind = Y.bind(callback, callbackcontext, e); 69 70 bind(); 71 } 72 }, { 73 NAME: STAMPPICKER_NAME, 74 ATTRS: { 75 /** 76 * The list of stamps this stamp picker supports. 77 * 78 * @attribute stamps 79 * @type String[] - the stamp filenames. 80 * @default {} 81 */ 82 stamps: { 83 value: [] 84 }, 85 86 /** 87 * The function called when a new stamp is chosen. 88 * 89 * @attribute callback 90 * @type function 91 * @default null 92 */ 93 callback: { 94 value: null 95 }, 96 97 /** 98 * The context passed to the callback when a stamp is chosen. 99 * 100 * @attribute context 101 * @type Y.Node 102 * @default null 103 */ 104 context: { 105 value: null 106 } 107 } 108 }); 109 110 M.assignfeedback_editpdf = M.assignfeedback_editpdf || {}; 111 M.assignfeedback_editpdf.stamppicker = STAMPPICKER;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |