Skip to content

Commit

Permalink
Merge branch 'collaboratiny' of github.com:univietw/moodle into colla…
Browse files Browse the repository at this point in the history
…boratiny
  • Loading branch information
univietw committed Sep 3, 2024
2 parents acbdf78 + fc1c32f commit 9997346
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
52 changes: 52 additions & 0 deletions lib/editor/tiny/plugins/collaborative/classes/plugininfo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?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/>.

namespace tiny_collaborative;

use context;
use editor_tiny\plugin;
use editor_tiny\plugin_with_configuration;

/**
* Tiny autosave plugin for Moodle.
*
* @package tiny_collaborative
* @copyright 2021 Andrew Lyons <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plugininfo extends plugin implements plugin_with_configuration {

public static function get_plugin_configuration_for_context(
context $context,
array $options,
array $fpoptions,
?\editor_tiny\editor $editor = null
): array {
global $PAGE;

if (empty($editor) || empty($options['autosave'])) {
return [
'autosave' => null,
];
}

return [
'pagehash' => sha1($PAGE->url . '<>' . s($editor->get_text())),
'pageinstance' => bin2hex(random_bytes(16)),
'backoffTime' => (defined('BEHAT_SITE_RUNNING') && BEHAT_SITE_RUNNING) ? 0 : 500,
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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 'tiny_autosave', language 'en'.
*
* @package tiny_collaborative
* @copyright 2024 Thomas Wedekind
* @copyright 2024 Jan Britz
* @copyright 2024 Simeon Naydenov
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['pluginname'] = 'Collaborative';

0 comments on commit 9997346

Please sign in to comment.