forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'collaboratiny' of github.com:univietw/moodle into colla…
…boratiny
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
]; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
lib/editor/tiny/plugins/collaborative/lang/en/tiny_collaborative.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |