diff --git a/admin/report/customlang/edit.php b/admin/report/customlang/edit.php index b68b56549e3..6e9a7f26a4d 100644 --- a/admin/report/customlang/edit.php +++ b/admin/report/customlang/edit.php @@ -38,7 +38,7 @@ $PAGE->set_url('/admin/report/customlang/edit.php', array('lng' => $lng)); navigation_node::override_active_url(new moodle_url('/admin/report/customlang/index.php')); $PAGE->set_title(get_string('pluginname', 'report_customlang')); $PAGE->set_heading(get_string('pluginname', 'report_customlang')); -//$PAGE->requires->js_init_call('M.report_customlang.init_translator', array(), true); +$PAGE->requires->js_init_call('M.report_customlang.init_editor', array(), true); if (empty($lng)) { // PARAM_LANG validation failed diff --git a/admin/report/customlang/module.js b/admin/report/customlang/module.js new file mode 100644 index 00000000000..ec38cacadc2 --- /dev/null +++ b/admin/report/customlang/module.js @@ -0,0 +1,45 @@ +// 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 . + +/** + * @package report + * @subpackage customlang + * @copyright 2010 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * @namespace + */ +M.report_customlang = M.report_customlang || {}; + +/** + * YUI instance holder + */ +M.report_customlang.Y = {}; + +/** + * Initialize JS support for the edit.php + * + * @param {Object} Y YUI instance + */ +M.report_customlang.init_editor = function(Y) { + M.report_customlang.Y = Y; + + Y.all('#translator .local textarea').each(function (textarea) { + var cell = textarea.get('parentNode'); + textarea.setStyle('height', cell.getComputedStyle('height')); + }); +} diff --git a/admin/report/customlang/renderer.php b/admin/report/customlang/renderer.php index 2f8b3a1abf2..330b5aea553 100644 --- a/admin/report/customlang/renderer.php +++ b/admin/report/customlang/renderer.php @@ -76,6 +76,7 @@ class report_customlang_renderer extends plugin_renderer_base { $cells[1]->attributes['class'] = 'stringid'; // master translation of the string $master = html_writer::tag('div', s($string->master), array('class' => 'preformatted')); + $minheight = strlen($string->master) / 200; if (preg_match('/\{\$a(->.+)?\}/', $string->master)) { $master .= html_writer::tag('div', $this->help_icon('placeholder', 'report_customlang', get_string('placeholderwarning', 'report_customlang')), array('class' => 'placeholderinfo')); @@ -83,7 +84,11 @@ class report_customlang_renderer extends plugin_renderer_base { $cells[2] = new html_table_cell($master); $cells[2]->attributes['class'] = 'standard master'; // local customization of the string - $textarea = html_writer::tag('textarea', s($string->local), array('name'=>'cust['.$string->id.']')); + $textareaattributes = array('name'=>'cust['.$string->id.']', 'cols'=>40, 'rows'=>3); + if ($minheight>1) { + $textareaattributes['style'] = 'min-height:' . (int) 4*$minheight . 'em;'; + } + $textarea = html_writer::tag('textarea', s($string->local), $textareaattributes); $cells[3] = new html_table_cell($textarea); if (!is_null($string->local) and $string->outdated) { $mark = html_writer::empty_tag('input', array('type' => 'checkbox', 'id' => 'update_' . $string->id, diff --git a/admin/report/customlang/version.php b/admin/report/customlang/version.php index f55d8289ec8..78fa1921a6d 100644 --- a/admin/report/customlang/version.php +++ b/admin/report/customlang/version.php @@ -24,5 +24,5 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2010111500; -$plugin->requires = 2010111002; +$plugin->version = 2010120900; +$plugin->requires = 2010120700;