Skip to content

Commit

Permalink
Merge branch 'master' into MOODLE_29_STABLE: v1.6 release
Browse files Browse the repository at this point in the history
Conflicts:
	version.php
  • Loading branch information
Julen Pardo committed May 26, 2016
2 parents 35b945a + 7a90a4c commit 31c5452
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 163 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Atto multilanguage plugin
=========================

![Release](https://img.shields.io/badge/release-v1.5-brightgreen.svg) ![Supported](https://img.shields.io/badge/supported-Moodle%202.9,%20Moodle%203.0-green.svg)
![Release](https://img.shields.io/badge/release-v1.6-blue.svg) ![Supported](https://img.shields.io/badge/supported-2.9%2C%203.0%2C%203.1-green.svg)

This plugin will make the creation of multilingual contents on Moodle much more easier with Atto editor.

The plugin is developed to work with [Iñaki Arenaza's multilang2 filter](https://github.com/iarenaza/moodle-filter_multilang2), and the idea is based on [his plugin for TinyMCE editor](https://github.com/iarenaza/moodle-tinymce_moodlelang2).

## Current version
The latest release is the v1.5 (build 2016042800) for Moodle 2.9 and 3.0. Checkout [v2.9.1.5](https://github.com/julenpardo/moodle-atto_multilang2/releases/tag/v2.9.1.5) and [v3.0.1.5](https://github.com/julenpardo/moodle-atto_multilang2/releases/tag/v3.0.1.5) releases, respectively.
The latest release is the v1.6 (build 2016042800) for Moodle 2.9, 3.0 and 3.1. Checkout [v2.9.1.6](https://github.com/julenpardo/moodle-atto_multilang2/releases/tag/v2.9.1.6), [v3.0.1.6](https://github.com/julenpardo/moodle-atto_multilang2/releases/tag/v3.0.1.6), and [v3.1.1.6](https://github.com/julenpardo/moodle-atto_multilang2/releases/tag/v3.1.1.6) releases, respectively.

## Changes from v1.4
- Fix issue "Quiz cannot be evaluated" (see [issue 15](https://github.com/julenpardo/moodle-atto_multilang2/issues/15)).
## Changes from v1.5
- Fix issue "Filepicker not loading when grading assignment" (see [issue 17](https://github.com/julenpardo/moodle-atto_multilang2/issues/17)).

## Requirements
As mentioned before, [filter_multilang2](https://github.com/iarenaza/moodle-filter_multilang2) is required.
Expand Down
8 changes: 5 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,17 @@
<copy file="${config.path}" tofile="${behat.wwwroot}/config.php"/>
</target>

<target name="selenium_kill">
<!-- This kills both Selenium and xvfb are killed. The "killall" command is a dirty workaround to issue #11, but no other way has been found to make the tests work properly. -->
<target name="selenium_kill" depends="behat_init">
<exec command="killall -v xvfb-run"/>
<exec command="curl -s http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer"/>
</target>

<target name="selenium_start" depends="selenium_kill">
<exec command="java -jar /var/lib/jenkins/selenium/selenium-server-standalone-2.48.2.jar &gt; /dev/null &amp;" outputProperty="selenium.output"/>
<exec command="xvfb-run -a java -jar ${selenium.path} &gt; /dev/null &amp;" outputProperty="selenium.output"/>
</target>

<target name="behat_test" depends="behat_init, selenium_start">
<target name="behat_test" depends="selenium_start">
<exec command="vendor/bin/behat --config ${behat.yml} --tags @atto_multilang2" dir="${version.dir}" returnProperty="behat.status" outputProperty="behat.output"/>
<if>
<equals arg1="${behat.status}" arg2="${error.code}"/>
Expand Down
18 changes: 2 additions & 16 deletions tests/behat/multilang2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,11 @@ Feature: Atto multilanguage list
And I select the text in the "Description" Atto editor
When I click on "Multi-Language Content (v2)" "button"
When I click on "English" "link"
Then I should see "{mlang en}Multilingual content{mlang}"
@javascript
Scenario: Tag some text with multilang labels again, now checking their style
Given I log in as "admin"
And the following config values are set as admin:
| toolbar | multilang2 = multilang2, table | editor_atto | # Needed table button, otherwise multilang list doesn't spread out...
And I am on homepage
And I follow "Profile" in the user menu
And I follow "Edit profile"
And I set the field "Description" to "Multilingual content, again"
And I select the text in the "Description" Atto editor
When I click on "Multi-Language Content (v2)" "button"
When I click on "English" "link"
And I press "Update profile"
And I follow "Preferences" in the user menu
And I follow "Editor preferences"
And I set the field "Text editor" to "Plain text area"
And I press "Save changes"
And I follow "Edit profile"
Then I should see "{mlang en}Multilingual content, again{mlang}"
Then I should see "{mlang en}Multilingual content{mlang}"
And I should not see "<span class=\"multilang_tag\">{mlang en}</span>"
6 changes: 4 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Atto Multilingual content plugin version details.
*
* @package atto_multilang2
* @copyright 2015 onwards Julen Pardo & Mondragon Unibertsitatea
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2016042800; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 'v2.9.1.5 (version 1.5 for Moodle 2.9) (Build 2016042800)';
$plugin->version = 2016052600; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 'v2.9.1.6 (version 1.6 for Moodle 2.9) (Build 2016052600)';
$plugin->requires = 2015051100; // Required Moodle version.
$plugin->component = 'atto_multilang2'; // Full name of the plugin (used for diagnostics).
$plugin->maturity = MATURITY_STABLE;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ Y.namespace('M.atto_multilang2').Button = Y.Base.create('button', Y.M.editor_att
* it's impossible to place the cursor inside the {mlang} tags.
*
* @method _addTags
* @param {EventFacade} e
* @param {EventFacade} event
* @param {string} langCode the language code
* @private
*/
_addTags: function(e, langCode) {
_addTags: function(event, langCode) {
var selection,
host = this.get('host'),
taggedContent,
Expand Down Expand Up @@ -235,79 +235,70 @@ Y.namespace('M.atto_multilang2').Button = Y.Base.create('button', Y.M.editor_att
},

/**
* Sets the submit listener to the function that finds the spaned {mlang} tags.
* Retrieves the inputs of type submit, and, for each element, calls the function
* that sets the submit listener. Is not made in this function because there is
* not any (apparent) way to access class scope from YUI closure.
*
* In some forms, there may be two different submit buttons, so we add the listener
* to the second, if this exists.
*
* These submit listeners are set only if the "highlight" plugin setting is checked.
*
* @method _setSubmitListener
* @method _setSubmitListeners
* @private
*/
_setSubmitListeners: function() {
var submitbutton = Y.one('#id_submitbutton'),
submitbutton2 = Y.one('#id_submitbutton2');

submitbutton.on('click', this._cleanTagsOnSubmit, this);
var submitButtons = Y.all('input[type=submit]');

if (submitbutton2 !== null) {
submitbutton2.on('click', this._cleanTagsOnSubmitSecondButton, this);
}
submitButtons.each(this._addListenerToSubmitButtons, this);
},

/**
* When submit button clicked, this function is invoked. It has to stop the submission,
* in order to process the textarea to clean the tags.
* Adds the clean tags submit listener of each input[type="submit"], but only if
* it's not 'cancel' type, and if its parent form is of 'mform' class, because there
* may be any other submit type (such us administrator's search button).
*
* Once the textarea is cleaned, detaches this submit listener, i.e., it sets as default,
* an then simulates the click, to submit the form.
*
* @method _cleanTagsOnSubmit
* @param {EventFacade} e
* @method _addListenerToSubmitButtons
* @param {Node} buttonNode
* @private
*/
_cleanTagsOnSubmit: function(e) {
var submitbutton;
_addListenerToSubmitButtons: function(buttonNode) {
var buttonObject,
className,
parentFormClassName,
notCancelButton,
notSearchButton;

e.preventDefault();
buttonObject = document.getElementById(buttonNode.get('id'));

submitbutton = Y.one('#id_submitbutton');

this._cleanTagsWithNoYuiId();
this._cleanTagsWithYuiId();
if (buttonObject !== null) {
className = buttonObject.className;
parentFormClassName = buttonObject.form.className;

notCancelButton = className.match(/btn-cancel/g) === null;
notSearchButton = parentFormClassName.match(/mform/g).length > 0;

submitbutton.detach('click', this._cleanTagsOnSubmit);
submitbutton.simulate('click');
if (notCancelButton && notSearchButton) {
buttonNode.on('click', this._cleanTagsOnSubmit, this, buttonNode);
}
}
},

/**
/**
* When submit button clicked, this function is invoked. It has to stop the submission,
* in order to process the textarea to clean the tags.
*
* Once the textarea is cleaned, detaches this submit listener, i.e., it sets as default,
* an then simulates the click, to submit the form.
*
* The cleanup with "id" attribute and without it is made separately, to avoid an evil
* regular expression.
*
* @method _cleanTagsOnSubmit
* @param {EventFacade} e
* @param {EventFacade} event
* @param {Node} submitButton
* @private
*/
_cleanTagsOnSubmitSecondButton: function(e) {
var submitbutton;

e.preventDefault();

submitbutton = Y.one('#id_submitbutton2');
_cleanTagsOnSubmit: function(event, submitButton) {
event.preventDefault();

this._cleanTagsWithNoYuiId();
this._cleanTagsWithYuiId();

submitbutton.detach('click', this._cleanTagsOnSubmitSecondButton);
submitbutton.simulate('click');
submitButton.detach('click', this._cleanTagsOnSubmit);
submitButton.simulate('click');
},

/**
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 31c5452

Please sign in to comment.