josepfs / moodle-filter_tabs Goto Github PK
View Code? Open in Web Editor NEWMoodle filter which creates tabs in textfields
License: GNU General Public License v3.0
Moodle filter which creates tabs in textfields
License: GNU General Public License v3.0
The init
function of the AMD module is executed for each piece of text that is being passed through filters. This leads to a large number of redundant JavaScript calls, like this:
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
M.util.js_pending('filter_tabs/tabs'); require(['filter_tabs/tabs'], function(amd) {amd.init(); M.util.js_complete('filter_tabs/tabs');});;
As documentated in the base filter class, the function setup
of the filter must handle repeated calls:
/**
* Setup page with filter requirements and other prepare stuff.
*
* [...]
*
* Note this method is invoked from {@see setup_page_for_filters()}
* for each piece of text being filtered, so it is responsible
* for controlling its own execution cardinality.
*
* [...]
*/
public function setup($page, $context) {}
However, filter_tabs does not:
public function setup($page, $context) {
$this->page = $page;
$page->requires->js_call_amd('filter_tabs/tabs', 'init');
}
It appears the solution is as simple as the following (copied from the Glossary filter):
public function setup($page, $context) {
if ($page->requires->should_create_one_time_item_now('filter_glossary_autolinker')) {
// Code here.
}
}
HI -
I've got a book page in Moodle with 3 sets of tabs, 2 tabs each. When I view the page all 6 tabs are combined into one set.
It was happening on the version downloaded from Moodle.org and also with the version pulled from GitHub just now. I did clear all caches between just in case that was an issue.
Any suggestions / thoughts?
In moodle 3.8 the new 4.0 version breaks the embedding of an iframe.
Going back to the old plugin version was the work-around.
But getting the new version correct would be nice
Hi!
Bootstrap filter tabs do interfere the functionality of custom menus in Moodle 2.8 using the core "more" theme (no other themes installed). After enabling the boostrap tabs setting the submenu of a custom menu does not show up properly, e.g., submenu 1 is shown when clicking custom menu 2, submenu 2 is shown when clicking any other toplevel menu etc.
With standard filter YUI tabs (bootstrap tabs disabled) everything is fine albeit the nice bootstrap look is lacking.
Kind regards,
George
Hi ,
I've made an anchor on a tabbed page but linking to the anchor refers to the tabs front page and not to the part of the page related to the specified tab.
Is there a way to link directly to the page section under a specific Tab?
Thanks
Willem
Hi, We love the tab option to organise our content.
We use it a lot in the bookmodule.
We encounter a problem with the printing options of the bookmodule. When printing a page/chapter only the content of the tab shown is printed.
That's not a big problem, one just has to give a print order for every tab content which has to be printed. But with the "print whole bookmodule" option it is it is a real problem that only the tabs shown are printed
Could this be solved or is there a workaround?
Thanks very much for your help,
Willem
The current random ID assignment uses an old, slow random function "rand". Also, the range is huge.
This caused the page to load without displaying the tabs.
I replaced line 76 in filter.php with:
$id = mt_rand(1000,9999);
Chances are that this will be random enough not to collide, but it is very fast and does not cause the page to fail when loading.
Thanks,
Roman
Hello, when I open the course sometimes appears the window with all the tabs, while other times it remains white, without content.
Can you help me please?
Thank you, Paolo.
Hi
I get a "Known vulnerability found" notification on Github regarding this filter. Is there a way to fix this?
Thank you
hi, i noticed when i updated to latest commit that markup in the tab content started appearing. atto tends to add
etc to the content and previously this was filtered out.
on mdl 3.9.13
cheers
Hi, thanks for this plugin, just reporting this in case you weren't aware. cheers
mdl 3.9.x
10:11:16.409 3) provider_testcase::test_all_providers_compliant with data set "filter_tabs" ('filter_tabs', 'filter_tabs\privacy\provider')
10:11:16.409 Failed asserting that false is true.
10:11:16.409
10:11:16.409 /opt/data/go-agent/pipelines/Moodle/moodle/privacy/tests/provider_test.php:178
10:11:16.409 /opt/data/go-agent/pipelines/Moodle/moodle/lib/phpunit/classes/advanced_testcase.php:80
10:11:16.409
It came to my attention that we're experiencing an issue with the tabs plugin.
When using the familiar {%:XXX}...{%} construct to show tabs and text, the text is no longer formatted but it is displayed in raw html.
We are using Tabs version 2022050300 on Moodle 3.11.4+ 20211123
Can you advise a solution?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.