[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 YUI.add('moodle-atto_managefiles-button', function (Y, NAME) { 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * @package atto_managefiles 20 * @copyright 2014 Frédéric Massart 21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 */ 23 24 /** 25 * @module moodle-atto-managefiles-button 26 */ 27 28 /** 29 * Atto text editor managefiles plugin. 30 * 31 * @namespace M.atto_link 32 * @class button 33 * @extends M.editor_atto.EditorPlugin 34 */ 35 36 var LOGNAME = 'atto_managefiles'; 37 38 Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { 39 40 /** 41 * A reference to the current selection at the time that the dialogue 42 * was opened. 43 * 44 * @property _currentSelection 45 * @type Range 46 * @private 47 */ 48 _currentSelection: null, 49 50 initializer: function() { 51 if (this.get('disabled')) { 52 return; 53 } 54 55 var host = this.get('host'), 56 area = this.get('area'), 57 options = host.get('filepickeroptions'); 58 59 if (options.image && options.image.itemid) { 60 area.itemid = options.image.itemid; 61 this.set('area', area); 62 } else { 63 return; 64 } 65 66 this.addButton({ 67 icon: 'e/manage_files', 68 callback: this._displayDialogue 69 }); 70 }, 71 72 /** 73 * Display the manage files. 74 * 75 * @method _displayDialogue 76 * @private 77 */ 78 _displayDialogue: function(e) { 79 e.preventDefault(); 80 81 var dialogue = this.getDialogue({ 82 headerContent: M.util.get_string('managefiles', LOGNAME), 83 width: '800px', 84 focusAfterHide: true 85 }); 86 87 var iframe = Y.Node.create('<iframe></iframe>'); 88 // We set the height here because otherwise it is really small. That might not look 89 // very nice on mobile devices, but we considered that enough for now. 90 iframe.setStyles({ 91 height: '700px', 92 border: 'none', 93 width: '100%' 94 }); 95 iframe.setAttribute('src', this._getIframeURL()); 96 97 dialogue.set('bodyContent', iframe) 98 .show(); 99 100 this.markUpdated(); 101 }, 102 103 /** 104 * Returns the URL to the file manager. 105 * 106 * @param _getIframeURL 107 * @return {String} URL 108 * @private 109 */ 110 _getIframeURL: function() { 111 var args = Y.mix({ 112 elementid: this.get('host').get('elementid') 113 }, 114 this.get('area')); 115 return M.cfg.wwwroot + '/lib/editor/atto/plugins/managefiles/manage.php?' + 116 Y.QueryString.stringify(args); 117 } 118 }, { 119 ATTRS: { 120 disabled: { 121 value: true 122 }, 123 area: { 124 value: {} 125 } 126 } 127 }); 128 129 130 }, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]});
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 |