I tried to modify the behaviour of the Save button in my DokuWiki (see my post on their forum without answer yet).
I want to call a specific file.php when the user hits the Save Button, i.e. every time there is an edit in the wiki. The PHP file recalculates all the connections in the Wiki and creates a new network diagram of the links in-between pages using Rscript.
I think the best way to do that is to use Ajax when the button is clicked (see this answer about how to do that). This is the original jQuery code of the button in DokuWiki:
// reset change memory var on submit
jQuery('#edbtn__save').on('click',
function() {
window.onbeforeunload = '';
textChanged = false;
}
);
I would like to add something like:
jQuery('#edbtn__save').on('click',
function() {
window.onbeforeunload = '';
textChanged = false;
$.ajax({
url: "./data/forms/file.php",
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
}
);
But this is not working yet (I tried different URLs too, but it is not clear what to use as I run DokuWiki on my localhost for the moment). I never studied jQuery nor Ajax, so this is new to me. I don't really understand how it works, but it might just need a simple fix.
This is what the file.php looks like:
<?php
include("./data/forms/myFunctions.php");
matrixer();
?>
PS: the documentation I found about the function on() and the DokuWiki source code.