[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 var COMMENTMENUNAME = "Commentmenu", 2 COMMENTMENU; 3 4 /** 5 * Provides an in browser PDF editor. 6 * 7 * @module moodle-assignfeedback_editpdf-editor 8 */ 9 10 /** 11 * COMMENTMENU 12 * This is a drop down list of comment context functions. 13 * 14 * @namespace M.assignfeedback_editpdf 15 * @class commentmenu 16 * @constructor 17 * @extends M.assignfeedback_editpdf.dropdown 18 */ 19 COMMENTMENU = function(config) { 20 COMMENTMENU.superclass.constructor.apply(this, [config]); 21 }; 22 23 Y.extend(COMMENTMENU, M.assignfeedback_editpdf.dropdown, { 24 25 /** 26 * Initialise the menu. 27 * 28 * @method initializer 29 * @return void 30 */ 31 initializer : function(config) { 32 var commentlinks, 33 link, 34 body, 35 comment; 36 37 comment = this.get('comment'); 38 // Build the list of menu items. 39 commentlinks = Y.Node.create('<ul role="menu" class="assignfeedback_editpdf_menu"/>'); 40 41 link = Y.Node.create('<li><a tabindex="-1" href="#">' + M.util.get_string('addtoquicklist', 'assignfeedback_editpdf') + '</a></li>'); 42 link.on('click', comment.add_to_quicklist, comment); 43 link.on('key', comment.add_to_quicklist, 'enter,space', comment); 44 45 commentlinks.append(link); 46 47 link = Y.Node.create('<li><a tabindex="-1" href="#">' + M.util.get_string('deletecomment', 'assignfeedback_editpdf') + '</a></li>'); 48 link.on('click', function(e) { e.preventDefault(); this.menu.hide(); this.remove(); }, comment); 49 link.on('key', function() { comment.menu.hide(); comment.remove(); }, 'enter,space', comment); 50 51 commentlinks.append(link); 52 53 link = Y.Node.create('<li><hr/></li>'); 54 commentlinks.append(link); 55 56 // Set the accessible header text. 57 this.set('headerText', M.util.get_string('commentcontextmenu', 'assignfeedback_editpdf')); 58 59 body = Y.Node.create('<div/>'); 60 61 // Set the body content. 62 body.append(commentlinks); 63 this.set('bodyContent', body); 64 65 COMMENTMENU.superclass.initializer.call(this, config); 66 }, 67 68 /** 69 * Show the menu. 70 * 71 * @method show 72 * @return void 73 */ 74 show : function() { 75 var commentlinks = this.get('boundingBox').one('ul'); 76 commentlinks.all('.quicklist_comment').remove(true), 77 comment = this.get('comment'); 78 79 comment.deleteme = false; // Cancel the deleting of blank comments. 80 81 // Now build the list of quicklist comments. 82 Y.each(comment.editor.quicklist.comments, function(quickcomment) { 83 var listitem = Y.Node.create('<li class="quicklist_comment"></li>'), 84 linkitem = Y.Node.create('<a href="#" tabindex="-1">' + quickcomment.rawtext + '</a>'), 85 deletelinkitem = Y.Node.create('<a href="#" tabindex="-1" class="delete_quicklist_comment">' + 86 '<img src="' + M.util.image_url('t/delete', 'core') + '" ' + 87 'alt="' + M.util.get_string('deletecomment', 'assignfeedback_editpdf') + '"/>' + 88 '</a>'); 89 listitem.append(linkitem); 90 listitem.append(deletelinkitem); 91 92 commentlinks.append(listitem); 93 94 linkitem.on('click', comment.set_from_quick_comment, comment, quickcomment); 95 linkitem.on('key', comment.set_from_quick_comment, 'space,enter', comment, quickcomment); 96 97 deletelinkitem.on('click', comment.remove_from_quicklist, comment, quickcomment); 98 deletelinkitem.on('key', comment.remove_from_quicklist, 'space,enter', comment, quickcomment); 99 }, this); 100 101 COMMENTMENU.superclass.show.call(this); 102 } 103 }, { 104 NAME : COMMENTMENUNAME, 105 ATTRS : { 106 /** 107 * The comment this menu is attached to. 108 * 109 * @attribute comment 110 * @type M.assignfeedback_editpdf.comment 111 * @default null 112 */ 113 comment : { 114 value : null 115 } 116 117 } 118 }); 119 120 M.assignfeedback_editpdf = M.assignfeedback_editpdf || {}; 121 M.assignfeedback_editpdf.commentmenu = COMMENTMENU;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |