mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
Merge branch 'MDL-44241-master' of git://github.com/andrewnicols/moodle
This commit is contained in:
commit
052d51b15f
@ -936,7 +936,7 @@ class core_plugin_manager {
|
||||
'equation', 'fontcolor', 'html', 'image', 'indent', 'italic',
|
||||
'link', 'managefiles', 'media', 'noautolink', 'orderedlist',
|
||||
'rtl', 'strike', 'subscript', 'superscript', 'table', 'title',
|
||||
'underline', 'undo', 'unlink', 'unorderedlist'
|
||||
'underline', 'undo', 'unorderedlist'
|
||||
),
|
||||
|
||||
'assignment' => array(
|
||||
|
@ -27,3 +27,4 @@ $string['createlink'] = 'Create link';
|
||||
$string['enterurl'] = 'Enter a URL';
|
||||
$string['openinnewwindow'] = 'Open in new window';
|
||||
$string['pluginname'] = 'Link';
|
||||
$string['unlink'] = 'Unlink';
|
||||
|
@ -32,6 +32,7 @@ function atto_link_strings_for_js() {
|
||||
global $PAGE;
|
||||
|
||||
$PAGE->requires->strings_for_js(array('createlink',
|
||||
'unlink',
|
||||
'enterurl',
|
||||
'browserepositories',
|
||||
'openinnewwindow'),
|
||||
|
@ -77,11 +77,22 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
|
||||
_content: null,
|
||||
|
||||
initializer: function() {
|
||||
// Add the link button first.
|
||||
this.addButton({
|
||||
icon: 'e/insert_edit_link',
|
||||
callback: this._displayDialogue,
|
||||
tags: 'a'
|
||||
});
|
||||
|
||||
// And then the unlink button.
|
||||
this.addBasicButton({
|
||||
exec: 'unlink',
|
||||
icon: 'e/remove_link',
|
||||
title: 'unlink',
|
||||
|
||||
// Watch the following tags and add/remove highlighting as appropriate:
|
||||
tags: 'a'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-atto_link-button",function(e,t){var n="atto_link",r={NEWWINDOW:"atto_link_openinnewwindow"},i='<form class="atto_form"><label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth url" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>{{#if showFilepicker}}<button class="openlinkbrowser">{{get_string "browserepositories" component}}</button><br/>{{/if}}<input type="checkbox" class="newwindow" id="{{elementid}}_{{CSS.NEWWINDOW}}"/><label class="sameline" for="{{elementid}}_{{CSS.NEWWINDOW}}">{{get_string "openinnewwindow" component}}</label><br/><div class="mdl-align"><br/><button type="submit" class="submit">{{get_string "createlink" component}}</button></div></form>';e.namespace("M.atto_link").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.addButton({icon:"e/insert_edit_link",callback:this._displayDialogue,tags:"a"})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1||this._currentSelection.collapsed)return;var e=this.getDialogue({headerContent:M.util.get_string("createlink",n),focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()),this._resolveAnchors(),e.show()},_resolveAnchors:function(){var t=this.get("host").getSelectionParentNode(),n,r,i,s;if(!t)return;n=this._findSelectedAnchors(e.one(t)),n.length>0&&(r=n[0],this._currentSelection=this.get("host").getSelectionFromNode(r),i=r.getAttribute("href"),s=r.getAttribute("target"),i!==""&&this._content.one(".url").setAttribute("value",i),s==="_blank"?this._content.one(".newwindow").setAttribute("checked","checked"):this._content.one(".newwindow").removeAttribute("checked"))},_filepickerCallback:function(e){this.getDialogue().set("focusAfterHide",null).hide(),e.url!==""&&(this.get("host").setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},_setLink:function(t){var n,r,i,s,o,u=this.get("host");t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=this._content.one(".url"),o=n.get("value");if(o!==""){this.editor.focus(),u.setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,o),i=u.getSelectionParentNode();if(!i)return;s=this._findSelectedAnchors(e.one(i)),e.Array.each(s,function(e){r=this._content.one(".newwindow"),r.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")},this),this.markUpdated()}},_findSelectedAnchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&this.get("host").selectionContainsNode(e)&&r.push(e)}),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},_getDialogueContent:function(){var t=this.get("host").canShowFilepicker("link"),s=e.Handlebars.compile(i);return this._content=e.Node.create(s({showFilepicker:t,component:n,CSS:r})),this._content.one(".submit").on("click",this._setLink,this),t&&this._content.one(".openlinkbrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("link",this._filepickerCallback,this)},this),this._content}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||
YUI.add("moodle-atto_link-button",function(e,t){var n="atto_link",r={NEWWINDOW:"atto_link_openinnewwindow"},i='<form class="atto_form"><label for="{{elementid}}_atto_link_urlentry">{{get_string "enterurl" component}}</label><input class="fullwidth url" type="url" id="{{elementid}}_atto_link_urlentry" size="32"/><br/>{{#if showFilepicker}}<button class="openlinkbrowser">{{get_string "browserepositories" component}}</button><br/>{{/if}}<input type="checkbox" class="newwindow" id="{{elementid}}_{{CSS.NEWWINDOW}}"/><label class="sameline" for="{{elementid}}_{{CSS.NEWWINDOW}}">{{get_string "openinnewwindow" component}}</label><br/><div class="mdl-align"><br/><button type="submit" class="submit">{{get_string "createlink" component}}</button></div></form>';e.namespace("M.atto_link").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.addButton({icon:"e/insert_edit_link",callback:this._displayDialogue,tags:"a"}),this.addBasicButton({exec:"unlink",icon:"e/remove_link",title:"unlink",tags:"a"})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1||this._currentSelection.collapsed)return;var e=this.getDialogue({headerContent:M.util.get_string("createlink",n),focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()),this._resolveAnchors(),e.show()},_resolveAnchors:function(){var t=this.get("host").getSelectionParentNode(),n,r,i,s;if(!t)return;n=this._findSelectedAnchors(e.one(t)),n.length>0&&(r=n[0],this._currentSelection=this.get("host").getSelectionFromNode(r),i=r.getAttribute("href"),s=r.getAttribute("target"),i!==""&&this._content.one(".url").setAttribute("value",i),s==="_blank"?this._content.one(".newwindow").setAttribute("checked","checked"):this._content.one(".newwindow").removeAttribute("checked"))},_filepickerCallback:function(e){this.getDialogue().set("focusAfterHide",null).hide(),e.url!==""&&(this.get("host").setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},_setLink:function(t){var n,r,i,s,o,u=this.get("host");t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=this._content.one(".url"),o=n.get("value");if(o!==""){this.editor.focus(),u.setSelection(this._currentSelection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,o),i=u.getSelectionParentNode();if(!i)return;s=this._findSelectedAnchors(e.one(i)),e.Array.each(s,function(e){r=this._content.one(".newwindow"),r.get("checked")?e.setAttribute("target","_blank"):e.removeAttribute("target")},this),this.markUpdated()}},_findSelectedAnchors:function(e){var t=e.get("tagName"),n,r;return t&&t.toLowerCase()==="a"?[e]:(r=[],e.all("a").each(function(e){!n&&this.get("host").selectionContainsNode(e)&&r.push(e)}),r.length>0?r:(n=e.ancestor("a"),n?[n]:[]))},_getDialogueContent:function(){var t=this.get("host").canShowFilepicker("link"),s=e.Handlebars.compile(i);return this._content=e.Node.create(s({showFilepicker:t,component:n,CSS:r})),this._content.one(".submit").on("click",this._setLink,this),t&&this._content.one(".openlinkbrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("link",this._filepickerCallback,this)},this),this._content}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||
|
@ -77,11 +77,22 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
|
||||
_content: null,
|
||||
|
||||
initializer: function() {
|
||||
// Add the link button first.
|
||||
this.addButton({
|
||||
icon: 'e/insert_edit_link',
|
||||
callback: this._displayDialogue,
|
||||
tags: 'a'
|
||||
});
|
||||
|
||||
// And then the unlink button.
|
||||
this.addBasicButton({
|
||||
exec: 'unlink',
|
||||
icon: 'e/remove_link',
|
||||
title: 'unlink',
|
||||
|
||||
// Watch the following tags and add/remove highlighting as appropriate:
|
||||
tags: 'a'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -75,11 +75,22 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
|
||||
_content: null,
|
||||
|
||||
initializer: function() {
|
||||
// Add the link button first.
|
||||
this.addButton({
|
||||
icon: 'e/insert_edit_link',
|
||||
callback: this._displayDialogue,
|
||||
tags: 'a'
|
||||
});
|
||||
|
||||
// And then the unlink button.
|
||||
this.addBasicButton({
|
||||
exec: 'unlink',
|
||||
icon: 'e/remove_link',
|
||||
title: 'unlink',
|
||||
|
||||
// Watch the following tags and add/remove highlighting as appropriate:
|
||||
tags: 'a'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'atto_unlink', language 'en'.
|
||||
*
|
||||
* @package atto_unlink
|
||||
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Unlink';
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* Atto text editor integration version file.
|
||||
*
|
||||
* @package atto_unlink
|
||||
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014012800; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013110500; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_unlink'; // Full name of the plugin (used for diagnostics).
|
@ -1,49 +0,0 @@
|
||||
YUI.add('moodle-atto_unlink-button', function (Y, NAME) {
|
||||
|
||||
// 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/>.
|
||||
|
||||
/*
|
||||
* @package atto_unlink
|
||||
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* @module moodle-atto_unlink-button
|
||||
*/
|
||||
|
||||
/**
|
||||
* Atto text editor unlink plugin.
|
||||
*
|
||||
* @namespace M.atto_unlink
|
||||
* @class button
|
||||
* @extends M.editor_atto.EditorPlugin
|
||||
*/
|
||||
|
||||
Y.namespace('M.atto_unlink').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
initializer: function() {
|
||||
this.addBasicButton({
|
||||
exec: 'unlink',
|
||||
icon: 'e/remove_link',
|
||||
|
||||
// Watch the following tags and add/remove highlighting as appropriate:
|
||||
tags: 'a'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]});
|
@ -1 +0,0 @@
|
||||
YUI.add("moodle-atto_unlink-button",function(e,t){e.namespace("M.atto_unlink").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addBasicButton({exec:"unlink",icon:"e/remove_link",tags:"a"})}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
@ -1,49 +0,0 @@
|
||||
YUI.add('moodle-atto_unlink-button', function (Y, NAME) {
|
||||
|
||||
// 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/>.
|
||||
|
||||
/*
|
||||
* @package atto_unlink
|
||||
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* @module moodle-atto_unlink-button
|
||||
*/
|
||||
|
||||
/**
|
||||
* Atto text editor unlink plugin.
|
||||
*
|
||||
* @namespace M.atto_unlink
|
||||
* @class button
|
||||
* @extends M.editor_atto.EditorPlugin
|
||||
*/
|
||||
|
||||
Y.namespace('M.atto_unlink').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
initializer: function() {
|
||||
this.addBasicButton({
|
||||
exec: 'unlink',
|
||||
icon: 'e/remove_link',
|
||||
|
||||
// Watch the following tags and add/remove highlighting as appropriate:
|
||||
tags: 'a'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]});
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "moodle-atto_unlink-button",
|
||||
"builds": {
|
||||
"moodle-atto_unlink-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,44 +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/>.
|
||||
|
||||
/*
|
||||
* @package atto_unlink
|
||||
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* @module moodle-atto_unlink-button
|
||||
*/
|
||||
|
||||
/**
|
||||
* Atto text editor unlink plugin.
|
||||
*
|
||||
* @namespace M.atto_unlink
|
||||
* @class button
|
||||
* @extends M.editor_atto.EditorPlugin
|
||||
*/
|
||||
|
||||
Y.namespace('M.atto_unlink').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
initializer: function() {
|
||||
this.addBasicButton({
|
||||
exec: 'unlink',
|
||||
icon: 'e/remove_link',
|
||||
|
||||
// Watch the following tags and add/remove highlighting as appropriate:
|
||||
tags: 'a'
|
||||
});
|
||||
}
|
||||
});
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"moodle-atto_unlink-button": {
|
||||
"requires": [
|
||||
"moodle-editor_atto-plugin"
|
||||
]
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ if ($ADMIN->fulltree) {
|
||||
$default = 'collapse = collapse
|
||||
style1 = title, bold, italic
|
||||
list = unorderedlist, orderedlist
|
||||
links = link, unlink, noautolink
|
||||
links = link, noautolink
|
||||
files = image, media, managefiles
|
||||
style2 = underline, strike, subscript, superscript
|
||||
align = align
|
||||
|
Loading…
x
Reference in New Issue
Block a user