+++ /dev/null
-<?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/>.
-
-/**
- * Language customization report upgrades
- *
- * @package report
- * @subpackage customlang
- * @copyright 2010 David Mudrak <david.mudrak@gmail.com>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-function xmldb_report_customlang_upgrade($oldversion) {
- global $CFG, $DB, $OUTPUT;
-
- $dbman = $DB->get_manager();
- $result = true;
-
- /**
- * Use proper plugin prefix for tables
- */
- if ($oldversion < 2010111200) {
- if ($dbman->table_exists('customlang')) {
- $dbman->rename_table(new xmldb_table('customlang'), 'report_customlang');
- }
- if ($dbman->table_exists('customlang_components')) {
- $dbman->rename_table(new xmldb_table('customlang_components'), 'report_customlang_components');
- }
- upgrade_plugin_savepoint(true, 2010111200, 'report', 'customlang');
- }
-
- /**
- * Regenerate the foreign key after the tables rename
- */
- if ($oldversion < 2010111500) {
- $table = new xmldb_table('report_customlang');
- $oldkey = new xmldb_key('fk_component', XMLDB_KEY_FOREIGN, array('componentid'), 'customlang_components', array('id'));
- $newkey = new xmldb_key('fk_component', XMLDB_KEY_FOREIGN, array('componentid'), 'report_customlang_components', array('id'));
-
- $dbman->drop_key($table, $oldkey);
- $dbman->add_key($table, $newkey);
-
- upgrade_plugin_savepoint(true, 2010111500, 'report', 'customlang');
- }
-
- /**
- * Change the version field from integer to varchar
- */
- if ($oldversion < 2011041900) {
- $table = new xmldb_table('report_customlang_components');
- $field = new xmldb_field('version', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'name');
-
- $dbman->change_field_type($table, $field);
-
- upgrade_plugin_savepoint(true, 2011041900, 'report', 'customlang');
- }
-
-
- return $result;
-}
+++ /dev/null
-.path-admin-report-customlang .langselectorbox,
-.path-admin-report-customlang fieldset.buttonsbar,
-.path-admin-report-customlang .menu {
- margin: 5px auto;
- text-align: center;
-}
-
-.path-admin-report-customlang .menu .singlebutton,
-.path-admin-report-customlang .menu .singlebutton form,
-.path-admin-report-customlang .menu .singlebutton form div {
- display: inline;
-}
-
-
-.path-admin-report-customlang .mform.filterform {
- width: 70%;
- margin-left: auto;
- margin-right: auto;
-}
-
-.path-admin-report-customlang .mform.filterform .fitem .fitemtitle {
- width: 30%;
-}
-
-.path-admin-report-customlang .mform.filterform .fitem .felement {
- width: 60%;
- margin-left: 31%;
-}
-
-.path-admin-report-customlang #translator {
- width: 100%;
-}
-
-.path-admin-report-customlang #translator .standard,
-.path-admin-report-customlang #translator .local {
- min-width: 35%;
-}
-
-.path-admin-report-customlang #translator .customized {
- background-color: #e7f1c3;
-}
-
-.path-admin-report-customlang #translator .customized.outdated {
- background-color: #f3f2aa;
-}
-
-.path-admin-report-customlang #translator .modified {
- background-color: #ffd3d9;
-}
-
-.path-admin-report-customlang #translator .customized.modified {
- background-color: #d2ebff;
-}
-
-.path-admin-report-customlang #translator textarea {
- width: 100%;
- min-height: 4em;
-}
-
-.path-admin-report-customlang #translator .placeholderinfo {
- text-align: center;
- border: 1px dotted #ddd;
- background-color: #f6f6f6;
- margin-top: 0.5em;
-}
-
-#page-admin-report-customlang-index .continuebutton {
- margin-top: 1em;
-}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Defines the capabilities used by the Language customization admin report
+ * Defines the capabilities used by the Language customization admin tool
*
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
$capabilities = array(
/* allows the user to view the current language customization */
- 'report/customlang:view' => array(
+ 'tool/customlang:view' => array(
'riskbitmask' => RISK_CONFIG,
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
),
/* allows the user to edit the current language customization */
- 'report/customlang:edit' => array(
+ 'tool/customlang:edit' => array(
'riskbitmask' => RISK_CONFIG | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
--- /dev/null
+<?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/>.
+
+/**
+ * Post installation and migration code.
+ *
+ * @package tool
+ * @subpackage customlang
+ * @copyright 2011 Petr Skoda {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+function xmldb_tool_customlang_install() {
+ global $CFG, $OUTPUT, $DB;
+
+ // this is a hack - this plugin used to live in admin/report/customlang,
+ // we want to remove the orphaned version info and capability
+ // unless there is a new report type with the same name
+ // the original tables can be dropped because they are used for caching only
+
+ if (!file_exists("$CFG->dirroot/report/customlang")) {
+ unset_all_config_for_plugin('report_customlang');
+ capabilities_cleanup('report_customlang');
+ $dbman = $DB->get_manager();
+ $table = new xmldb_table('report_customlang');
+ if ($dbman->table_exists($table)) {
+ $dbman->drop_table($table);
+ }
+ $table = new xmldb_table('report_customlang_components');
+ if ($dbman->table_exists($table)) {
+ $dbman->drop_table($table);
+ }
+ }
+}
+
+
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="admin/report/customlang/db" VERSION="20110419" COMMENT="XMLDB file for Moodle admin/report/customlang"
+<XMLDB PATH="admin/tool/customlang/db" VERSION="20110925" COMMENT="XMLDB file for Moodle admin/tool/customlang"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
- <TABLE NAME="report_customlang" COMMENT="Contains the working checkout of all strings and their customization" NEXT="report_customlang_components">
+ <TABLE NAME="tool_customlang" COMMENT="Contains the working checkout of all strings and their customization" NEXT="tool_customlang_components">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="lang"/>
<FIELD NAME="lang" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="The code of the language this string belongs to. Like en, cs or es" PREVIOUS="id" NEXT="componentid"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="fk_component"/>
- <KEY NAME="fk_component" TYPE="foreign" FIELDS="componentid" REFTABLE="report_customlang_components" REFFIELDS="id" PREVIOUS="primary"/>
+ <KEY NAME="fk_component" TYPE="foreign" FIELDS="componentid" REFTABLE="tool_customlang_components" REFFIELDS="id" PREVIOUS="primary"/>
</KEYS>
<INDEXES>
<INDEX NAME="uq_lang_component_string" UNIQUE="true" FIELDS="lang, componentid, stringid" COMMENT="For a given language and component, string identifiers must be unique"/>
</INDEXES>
</TABLE>
- <TABLE NAME="report_customlang_components" COMMENT="Contains the list of all installed plugins that provide their own language pack" PREVIOUS="report_customlang">
+ <TABLE NAME="tool_customlang_components" COMMENT="Contains the list of all installed plugins that provide their own language pack" PREVIOUS="tool_customlang">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The normalized name of the plugin" PREVIOUS="id" NEXT="version"/>
--- /dev/null
+<?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/>.
+
+/**
+ * Language customization report upgrades
+ *
+ * @package tool
+ * @subpackage customlang
+ * @copyright 2010 David Mudrak <david.mudrak@gmail.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+function xmldb_report_customlang_upgrade($oldversion) {
+ global $CFG, $DB, $OUTPUT;
+
+ $dbman = $DB->get_manager();
+
+
+
+ return true;
+}
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
-require_once($CFG->dirroot.'/'.$CFG->admin.'/report/customlang/locallib.php');
-require_once($CFG->dirroot.'/'.$CFG->admin.'/report/customlang/filter_form.php');
+require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
+require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
+require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/filter_form.php');
require_login(SITEID, false);
-require_capability('report/customlang:edit', get_system_context());
+require_capability('tool/customlang:edit', get_system_context());
$lng = required_param('lng', PARAM_LANG);
$currentpage = optional_param('p', 0, PARAM_INT);
$translatorsubmitted = optional_param('translatorsubmitted', 0, PARAM_BOOL);
$PAGE->set_pagelayout('standard');
-$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_editor', array(), true);
+$PAGE->set_url('/admin/tool/customlang/edit.php', array('lng' => $lng));
+navigation_node::override_active_url(new moodle_url('/admin/tool/customlang/index.php'));
+$PAGE->set_title(get_string('pluginname', 'tool_customlang'));
+$PAGE->set_heading(get_string('pluginname', 'tool_customlang'));
+$PAGE->requires->js_init_call('M.tool_customlang.init_editor', array(), true);
if (empty($lng)) {
// PARAM_LANG validation failed
}
// pre-output processing
-$filter = new report_customlang_filter_form($PAGE->url, null, 'post', '', array('class'=>'filterform'));
-$filterdata = report_customlang_utils::load_filter($USER);
+$filter = new tool_customlang_filter_form($PAGE->url, null, 'post', '', array('class'=>'filterform'));
+$filterdata = tool_customlang_utils::load_filter($USER);
$filter->set_data($filterdata);
if ($filter->is_cancelled()) {
redirect($PAGE->url);
} elseif ($submitted = $filter->get_data()) {
- report_customlang_utils::save_filter($submitted, $USER);
+ tool_customlang_utils::save_filter($submitted, $USER);
redirect(new moodle_url($PAGE->url, array('p'=>0)));
}
if ($checkin === false) {
$nexturl = $PAGE->url;
} else {
- $nexturl = new moodle_url('/admin/report/customlang/index.php', array('action'=>'checkin', 'lng' => $lng, 'sesskey'=>sesskey()));
+ $nexturl = new moodle_url('/admin/tool/customlang/index.php', array('action'=>'checkin', 'lng' => $lng, 'sesskey'=>sesskey()));
}
if (!is_array($strings)) {
$strings = array();
}
- $current = $DB->get_records_list('report_customlang', 'id', array_keys($strings));
+ $current = $DB->get_records_list('tool_customlang', 'id', array_keys($strings));
$now = time();
foreach ($strings as $recordid => $customization) {
$current[$recordid]->modified = 1;
$current[$recordid]->outdated = 0;
$current[$recordid]->timecustomized = null;
- $DB->update_record('report_customlang', $current[$recordid]);
+ $DB->update_record('tool_customlang', $current[$recordid]);
continue;
}
$current[$recordid]->modified = 1;
$current[$recordid]->outdated = 0;
$current[$recordid]->timecustomized = $now;
- $DB->update_record('report_customlang', $current[$recordid]);
+ $DB->update_record('tool_customlang', $current[$recordid]);
continue;
}
}
}
if (!empty($updates)) {
list($sql, $params) = $DB->get_in_or_equal($updates);
- $DB->set_field_select('report_customlang', 'outdated', 0, "local IS NOT NULL AND id $sql", $params);
+ $DB->set_field_select('tool_customlang', 'outdated', 0, "local IS NOT NULL AND id $sql", $params);
}
redirect($nexturl);
}
-$translator = new report_customlang_translator($PAGE->url, $lng, $filterdata, $currentpage);
+$translator = new tool_customlang_translator($PAGE->url, $lng, $filterdata, $currentpage);
// output starts here
-$output = $PAGE->get_renderer('report_customlang');
-$paginator = $output->paging_bar($translator->numofrows, $currentpage, report_customlang_translator::PERPAGE, $PAGE->url, 'p');
+$output = $PAGE->get_renderer('tool_customlang');
+$paginator = $output->paging_bar($translator->numofrows, $currentpage, tool_customlang_translator::PERPAGE, $PAGE->url, 'p');
echo $output->header();
$filter->display();
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
/**
* Form for filtering the strings to customize
*/
-class report_customlang_filter_form extends moodleform {
+class tool_customlang_filter_form extends moodleform {
function definition() {
$mform = $this->_form;
$current = $this->_customdata['current'];
- $mform->addElement('header', 'filtersettings', get_string('filter', 'report_customlang'));
+ $mform->addElement('header', 'filtersettings', get_string('filter', 'tool_customlang'));
// Component
$options = array();
- foreach (report_customlang_utils::list_components() as $component => $normalized) {
+ foreach (tool_customlang_utils::list_components() as $component => $normalized) {
list($type, $plugin) = normalize_component($normalized);
if ($type == 'core' and is_null($plugin)) {
$plugin = 'moodle';
}
$options[$type][$normalized] = $component.'.php';
}
- $mform->addElement('selectgroups', 'component', get_string('filtercomponent', 'report_customlang'), $options,
+ $mform->addElement('selectgroups', 'component', get_string('filtercomponent', 'tool_customlang'), $options,
array('multiple'=>'multiple', 'size'=>7));
// Customized only
- $mform->addElement('advcheckbox', 'customized', get_string('filtercustomized', 'report_customlang'));
+ $mform->addElement('advcheckbox', 'customized', get_string('filtercustomized', 'tool_customlang'));
$mform->setType('customized', PARAM_BOOL);
$mform->setDefault('customized', 0);
// Only helps
- $mform->addElement('advcheckbox', 'helps', get_string('filteronlyhelps', 'report_customlang'));
+ $mform->addElement('advcheckbox', 'helps', get_string('filteronlyhelps', 'tool_customlang'));
$mform->setType('helps', PARAM_BOOL);
$mform->setDefault('helps', 0);
// Modified only
- $mform->addElement('advcheckbox', 'modified', get_string('filtermodified', 'report_customlang'));
+ $mform->addElement('advcheckbox', 'modified', get_string('filtermodified', 'tool_customlang'));
$mform->setType('filtermodified', PARAM_BOOL);
$mform->setDefault('filtermodified', 0);
// Substring
- $mform->addElement('text', 'substring', get_string('filtersubstring', 'report_customlang'));
+ $mform->addElement('text', 'substring', get_string('filtersubstring', 'tool_customlang'));
$mform->setType('substring', PARAM_RAW);
// String identifier
- $mform->addElement('text', 'stringid', get_string('filterstringid', 'report_customlang'));
+ $mform->addElement('text', 'stringid', get_string('filterstringid', 'tool_customlang'));
$mform->setType('stringid', PARAM_STRINGID);
// Show strings - submit button
- $mform->addElement('submit', 'submit', get_string('filtershowstrings', 'report_customlang'));
+ $mform->addElement('submit', 'submit', get_string('filtershowstrings', 'tool_customlang'));
}
}
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
/**
* Performs checkout of the strings into the translation table
*
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
define('NO_OUTPUT_BUFFERING', true); // progress bar is used here
-require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
-require_once($CFG->dirroot.'/'.$CFG->admin.'/report/customlang/locallib.php');
+require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
+require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
require_once($CFG->libdir.'/adminlib.php');
require_login(SITEID, false);
-require_capability('report/customlang:view', get_system_context());
+require_capability('tool/customlang:view', get_system_context());
$action = optional_param('action', '', PARAM_ALPHA);
$confirm = optional_param('confirm', false, PARAM_BOOL);
$lng = optional_param('lng', '', PARAM_LANG);
-admin_externalpage_setup('reportcustomlang');
+admin_externalpage_setup('toolcustomlang');
$langs = get_string_manager()->get_list_of_translations();
// pre-output actions
if ($action === 'checkout') {
require_sesskey();
- require_capability('report/customlang:edit', get_system_context());
+ require_capability('tool/customlang:edit', get_system_context());
if (empty($lng)) {
print_error('missingparameter');
}
$PAGE->set_cacheable(false); // progress bar is used here
- $output = $PAGE->get_renderer('report_customlang');
+ $output = $PAGE->get_renderer('tool_customlang');
echo $output->header();
- echo $output->heading(get_string('pluginname', 'report_customlang'));
+ echo $output->heading(get_string('pluginname', 'tool_customlang'));
$progressbar = new progress_bar();
$progressbar->create(); // prints the HTML code of the progress bar
// we may need a bit of extra execution time and memory here
@set_time_limit(HOURSECS);
raise_memory_limit(MEMORY_EXTRA);
- report_customlang_utils::checkout($lng, $progressbar);
+ tool_customlang_utils::checkout($lng, $progressbar);
- echo $output->continue_button(new moodle_url('/admin/report/customlang/edit.php', array('lng' => $lng)), 'get');
+ echo $output->continue_button(new moodle_url('/admin/tool/customlang/edit.php', array('lng' => $lng)), 'get');
echo $output->footer();
exit;
}
if ($action === 'checkin') {
require_sesskey();
- require_capability('report/customlang:edit', get_system_context());
+ require_capability('tool/customlang:edit', get_system_context());
if (empty($lng)) {
print_error('missingparameter');
}
if (!$confirm) {
- $output = $PAGE->get_renderer('report_customlang');
+ $output = $PAGE->get_renderer('tool_customlang');
echo $output->header();
- echo $output->heading(get_string('pluginname', 'report_customlang'));
+ echo $output->heading(get_string('pluginname', 'tool_customlang'));
echo $output->heading($langs[$lng], 3);
- $numofmodified = report_customlang_utils::get_count_of_modified($lng);
+ $numofmodified = tool_customlang_utils::get_count_of_modified($lng);
if ($numofmodified != 0) {
- echo $output->heading(get_string('modifiednum', 'report_customlang', $numofmodified), 3);
- echo $output->confirm(get_string('confirmcheckin', 'report_customlang'),
+ echo $output->heading(get_string('modifiednum', 'tool_customlang', $numofmodified), 3);
+ echo $output->confirm(get_string('confirmcheckin', 'tool_customlang'),
new moodle_url($PAGE->url, array('action'=>'checkin', 'lng'=>$lng, 'confirm'=>1)),
new moodle_url($PAGE->url, array('lng'=>$lng)));
} else {
- echo $output->heading(get_string('modifiedno', 'report_customlang', $numofmodified), 3);
+ echo $output->heading(get_string('modifiedno', 'tool_customlang', $numofmodified), 3);
echo $output->continue_button(new moodle_url($PAGE->url, array('lng' => $lng)));
}
echo $output->footer();
die();
} else {
- report_customlang_utils::checkin($lng);
+ tool_customlang_utils::checkin($lng);
redirect($PAGE->url);
}
}
-$output = $PAGE->get_renderer('report_customlang');
+$output = $PAGE->get_renderer('tool_customlang');
// output starts here
echo $output->header();
-echo $output->heading(get_string('pluginname', 'report_customlang'));
+echo $output->heading(get_string('pluginname', 'tool_customlang'));
if (empty($lng)) {
$s = new single_select($PAGE->url, 'lng', $langs);
echo $output->heading($langs[$lng], 3);
-$numofmodified = report_customlang_utils::get_count_of_modified($lng);
+$numofmodified = tool_customlang_utils::get_count_of_modified($lng);
if ($numofmodified != 0) {
- echo $output->heading(get_string('modifiednum', 'report_customlang', $numofmodified), 3);
+ echo $output->heading(get_string('modifiednum', 'tool_customlang', $numofmodified), 3);
}
$menu = array();
-if (has_capability('report/customlang:edit', get_system_context())) {
+if (has_capability('tool/customlang:edit', get_system_context())) {
$menu['checkout'] = array(
- 'title' => get_string('checkout', 'report_customlang'),
+ 'title' => get_string('checkout', 'tool_customlang'),
'url' => new moodle_url($PAGE->url, array('action' => 'checkout', 'lng' => $lng)),
'method' => 'post',
);
if ($numofmodified != 0) {
$menu['checkin'] = array(
- 'title' => get_string('checkin', 'report_customlang'),
+ 'title' => get_string('checkin', 'tool_customlang'),
'url' => new moodle_url($PAGE->url, array('action' => 'checkin', 'lng' => $lng)),
'method' => 'post',
);
}
}
-echo $output->render(new report_customlang_menu($menu));
+echo $output->render(new tool_customlang_menu($menu));
echo $output->footer();
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Strings for Language customization admin report
+ * Strings for Language customization admin tool
*
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Definition of classes used by language customization admin report
+ * Definition of classes used by language customization admin tool
*
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
* All the public methods here are static ones, this class can not be instantiated
*/
-class report_customlang_utils {
+class tool_customlang_utils {
/**
* Rough number of strings that are being processed during a full checkout.
global $DB;
// make sure that all components are registered
- $current = $DB->get_records('report_customlang_components', null, 'name', 'name,version,id');
+ $current = $DB->get_records('tool_customlang_components', null, 'name', 'name,version,id');
foreach (self::list_components() as $component) {
if (empty($current[$component])) {
$record = new stdclass();
} else {
$record->version = $version;
}
- $DB->insert_record('report_customlang_components', $record);
+ $DB->insert_record('tool_customlang_components', $record);
} elseif ($version = get_component_version($component)) {
if (is_null($current[$component]->version) or ($version > $current[$component]->version)) {
- $DB->set_field('report_customlang_components', 'version', $version, array('id' => $current[$component]->id));
+ $DB->set_field('tool_customlang_components', 'version', $version, array('id' => $current[$component]->id));
}
}
}
// initialize the progress counter - stores the number of processed strings
$done = 0;
- $strinprogress = get_string('checkoutinprogress', 'report_customlang');
+ $strinprogress = get_string('checkoutinprogress', 'tool_customlang');
// reload components and fetch their strings
$stringman = get_string_manager();
- $components = $DB->get_records('report_customlang_components');
+ $components = $DB->get_records('tool_customlang_components');
foreach ($components as $component) {
$sql = "SELECT stringid, id, lang, componentid, original, master, local, timemodified, timecustomized, outdated, modified
- FROM {report_customlang} s
+ FROM {tool_customlang} s
WHERE lang = ? AND componentid = ?
ORDER BY stringid";
$current = $DB->get_records_sql($sql, array($lang, $component->id));
}
if ($needsupdate) {
- $DB->update_record('report_customlang', $current[$stringid]);
+ $DB->update_record('tool_customlang', $current[$stringid]);
continue;
}
$record->timecustomized = null;
}
- $DB->insert_record('report_customlang', $record);
+ $DB->insert_record('tool_customlang', $record);
}
}
}
if (!is_null($progressbar)) {
- $progressbar->update_full(100, get_string('checkoutdone', 'report_customlang'));
+ $progressbar->update_full(100, get_string('checkoutdone', 'tool_customlang'));
}
}
// get all customized strings from updated components
$sql = "SELECT s.*, c.name AS component
- FROM {report_customlang} s
- JOIN {report_customlang_components} c ON s.componentid = c.id
+ FROM {tool_customlang} s
+ JOIN {tool_customlang_components} c ON s.componentid = c.id
WHERE s.lang = ?
AND (s.local IS NOT NULL OR s.modified = 1)
ORDER BY componentid, stringid";
self::dump_strings($lang, $component, $strings);
}
- $DB->set_field_select('report_customlang', 'modified', 0, 'lang = ?', array($lang));
+ $DB->set_field_select('tool_customlang', 'modified', 0, 'lang = ?', array($lang));
$sm = get_string_manager();
$sm->reset_caches();
}
public static function get_count_of_modified($lang) {
global $DB;
- return $DB->count_records('report_customlang', array('lang'=>$lang, 'modified'=>1));
+ return $DB->count_records('tool_customlang', array('lang'=>$lang, 'modified'=>1));
}
/**
* @param stdclass $persistant storage object
*/
public static function save_filter(stdclass $data, stdclass $persistant) {
- if (!isset($persistant->report_customlang_filter)) {
- $persistant->report_customlang_filter = array();
+ if (!isset($persistant->tool_customlang_filter)) {
+ $persistant->tool_customlang_filter = array();
}
foreach ($data as $key => $value) {
if ($key !== 'submit') {
- $persistant->report_customlang_filter[$key] = serialize($value);
+ $persistant->tool_customlang_filter[$key] = serialize($value);
}
}
}
*/
public static function load_filter(stdclass $persistant) {
$data = new stdclass();
- if (isset($persistant->report_customlang_filter)) {
- foreach ($persistant->report_customlang_filter as $key => $value) {
+ if (isset($persistant->tool_customlang_filter)) {
+ foreach ($persistant->tool_customlang_filter as $key => $value) {
$data->{$key} = unserialize($value);
}
}
}
/**
- * Represents the action menu of the report
+ * Represents the action menu of the tool
*/
-class report_customlang_menu implements renderable {
+class tool_customlang_menu implements renderable {
/** @var menu items */
protected $items = array();
/**
* Represents the translation tool
*/
-class report_customlang_translator implements renderable {
+class tool_customlang_translator implements renderable {
/** @const int number of rows per page */
const PERPAGE = 100;
$csql = "SELECT COUNT(*)";
$fsql = "SELECT s.id, s.*, c.name AS component";
- $sql = " FROM {report_customlang_components} c
- JOIN {report_customlang} s ON s.componentid = c.id
+ $sql = " FROM {tool_customlang_components} c
+ JOIN {tool_customlang} s ON s.componentid = c.id
WHERE s.lang = :lang
AND c.name $insql";
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
/**
* @namespace
*/
-M.report_customlang = M.report_customlang || {};
+M.tool_customlang = M.tool_customlang || {};
/**
* YUI instance holder
*/
-M.report_customlang.Y = {};
+M.tool_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;
+M.tool_customlang.init_editor = function(Y) {
+ M.tool_customlang.Y = Y;
Y.all('#translator .local textarea').each(function (textarea) {
var cell = textarea.get('parentNode');
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Output rendering of Language customization admin report
+ * Output rendering of Language customization admin tool
*
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
defined('MOODLE_INTERNAL') || die();
/**
- * Rendering methods for the report widgets
+ * Rendering methods for the tool widgets
*/
-class report_customlang_renderer extends plugin_renderer_base {
+class tool_customlang_renderer extends plugin_renderer_base {
/**
- * Renders customlang report menu
+ * Renders customlang tool menu
*
* @return string HTML
*/
- protected function render_report_customlang_menu(report_customlang_menu $menu) {
+ protected function render_tool_customlang_menu(tool_customlang_menu $menu) {
$output = '';
foreach ($menu->get_items() as $item) {
$output .= $this->single_button($item->url, $item->title, $item->method);
/**
* Renders customlang translation table
*
- * @param report_customlang_translator $translator
+ * @param tool_customlang_translator $translator
* @return string HTML
*/
- protected function render_report_customlang_translator(report_customlang_translator $translator) {
+ protected function render_tool_customlang_translator(tool_customlang_translator $translator) {
$output = '';
if (empty($translator->strings)) {
- return $this->heading(get_string('nostringsfound', 'report_customlang'), 3);
+ return $this->heading(get_string('nostringsfound', 'tool_customlang'), 3);
}
$table = new html_table();
$table->id = 'translator';
$table->head = array(
- get_string('headingcomponent', 'report_customlang'),
- get_string('headingstringid', 'report_customlang'),
- get_string('headingstandard', 'report_customlang'),
- get_string('headinglocal', 'report_customlang'),
+ get_string('headingcomponent', 'tool_customlang'),
+ get_string('headingstringid', 'tool_customlang'),
+ get_string('headingstandard', 'tool_customlang'),
+ get_string('headinglocal', 'tool_customlang'),
);
foreach ($translator->strings as $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'));
+ $master .= html_writer::tag('div', $this->help_icon('placeholder', 'tool_customlang',
+ get_string('placeholderwarning', 'tool_customlang')), array('class' => 'placeholderinfo'));
}
$cells[2] = new html_table_cell($master);
$cells[2]->attributes['class'] = 'standard master';
if (!is_null($string->local) and $string->outdated) {
$mark = html_writer::empty_tag('input', array('type' => 'checkbox', 'id' => 'update_' . $string->id,
'name' => 'updates[]', 'value' => $string->id));
- $help = $this->help_icon('markinguptodate', 'report_customlang');
- $mark .= html_writer::tag('label', get_string('markuptodate', 'report_customlang') . $help,
+ $help = $this->help_icon('markinguptodate', 'tool_customlang');
+ $mark .= html_writer::tag('label', get_string('markuptodate', 'tool_customlang') . $help,
array('for' => 'update_' . $string->id));
$mark = html_writer::tag('div', $mark, array('class' => 'uptodatewrapper'));
} else {
$output .= html_writer::start_tag('div');
$output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'translatorsubmitted', 'value'=>1));
$output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey()));
- $save1 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecontinue', 'value'=>get_string('savecontinue', 'report_customlang')));
- $save2 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecheckin', 'value'=>get_string('savecheckin', 'report_customlang')));
+ $save1 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecontinue', 'value'=>get_string('savecontinue', 'tool_customlang')));
+ $save2 = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savecheckin', 'value'=>get_string('savecheckin', 'tool_customlang')));
$output .= html_writer::tag('fieldset', $save1.$save2, array('class'=>'buttonsbar'));
$output .= html_writer::table($table);
$output .= html_writer::tag('fieldset', $save1.$save2, array('class'=>'buttonsbar'));
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * @package report
+ * @package tool
* @subpackage customlang
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
defined('MOODLE_INTERNAL') || die();
-$ADMIN->add('language', new admin_externalpage('reportcustomlang', get_string('pluginname', 'report_customlang'), "$CFG->wwwroot/$CFG->admin/report/customlang/index.php", 'report/customlang:view'));
+$ADMIN->add('language', new admin_externalpage('toolcustomlang', get_string('pluginname', 'tool_customlang'), "$CFG->wwwroot/$CFG->admin/tool/customlang/index.php", 'tool/customlang:view'));
--- /dev/null
+.path-admin-tool-customlang .langselectorbox,
+.path-admin-tool-customlang fieldset.buttonsbar,
+.path-admin-tool-customlang .menu {
+ margin: 5px auto;
+ text-align: center;
+}
+
+.path-admin-tool-customlang .menu .singlebutton,
+.path-admin-tool-customlang .menu .singlebutton form,
+.path-admin-tool-customlang .menu .singlebutton form div {
+ display: inline;
+}
+
+
+.path-admin-tool-customlang .mform.filterform {
+ width: 70%;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.path-admin-tool-customlang .mform.filterform .fitem .fitemtitle {
+ width: 30%;
+}
+
+.path-admin-tool-customlang .mform.filterform .fitem .felement {
+ width: 60%;
+ margin-left: 31%;
+}
+
+.path-admin-tool-customlang #translator {
+ width: 100%;
+}
+
+.path-admin-tool-customlang #translator .standard,
+.path-admin-tool-customlang #translator .local {
+ min-width: 35%;
+}
+
+.path-admin-tool-customlang #translator .customized {
+ background-color: #e7f1c3;
+}
+
+.path-admin-tool-customlang #translator .customized.outdated {
+ background-color: #f3f2aa;
+}
+
+.path-admin-tool-customlang #translator .modified {
+ background-color: #ffd3d9;
+}
+
+.path-admin-tool-customlang #translator .customized.modified {
+ background-color: #d2ebff;
+}
+
+.path-admin-tool-customlang #translator textarea {
+ width: 100%;
+ min-height: 4em;
+}
+
+.path-admin-tool-customlang #translator .placeholderinfo {
+ text-align: center;
+ border: 1px dotted #ddd;
+ background-color: #f6f6f6;
+ margin-top: 0.5em;
+}
+
+#page-admin-tool-customlang-index .continuebutton {
+ margin-top: 1em;
+}
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2011041900;
-$plugin->requires = 2010120700;
+$plugin->version = 2011092500;
+$plugin->requires = 2011092100;
+$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
'report' => array(
'backups', 'configlog', 'courseoverview',
- 'customlang', 'log', 'questioninstances',
+ 'log', 'questioninstances',
'security', 'spamcleaner', 'stats'
),
),
'tool' => array(
- 'bloglevelupgrade', 'capability', 'dbtransfer', 'generator',
+ 'bloglevelupgrade', 'capability', 'customlang', 'dbtransfer', 'generator',
'health', 'innodb', 'langimport', 'multilangupgrade',
'profiling', 'unittest', 'uploaduser', 'unsuproles', 'xmldb'
),