how to add my own h5p interactive video in h5p in moodle - moodle

I tried to find the solution to my question everywhere without a result.
Let me explain the problem. I have a moodle docker. We can install H5P there by following these steps in: https://github.com/h5p/moodle-mod_hvp
Now we can manually install the H5P libraries like Interactive Video, Quiz, etc. from the moodle running. We just have to Create a new course>H5p Interactive Content>Get and Install any library.
There are separate GitHub repos for these libraries. Now, for my own work, I have made some forked and made some changes to some of these repos of these libraries. Now I want to install my H5P libraries in my moodle without making to Pull request to the original H5P interactive video GitHub page.
I found that we can make some changes in the renderer.php as stated in: https://github.com/h5p/h5pmods-moodle-plugin
I have git cloned H5P along with my x.js file in moodle/mod. So the folder structure is moodle/mod/hvp/{all the files from H5P Interactive Video + my x.js}
Following the steps from https://github.com/h5p/h5pmods-moodle-plugin, I am doing:
/**
* Add scripts when an H5P is displayed.
*
* #param object $scripts Scripts that will be applied.
* #param array $libraries Libraries that will be displayed.
* #param string $embedType How the H5P is displayed.
*/
public function hvp_alter_scripts(&$scripts, $libraries, $embedType) {
console.log(process.cwd());
global $CFG;
$scripts[] = (object) array(
'path' => 'x.js',
'version' => '?ver=0.0.1',
);
}
However, it is not working. I have already checked (without docker exec) that all the files are in the moodle/mod/hvp. I wonder if this strategy at all will work for something other than some styling css.
Can someone help me out here?

Related

Where are the libraries for H5P getting stored in Moodle container

I am running a Moodle Docker container. It is running at localhost:8080. There I installed H5P Interactive Contents from https://moodle.org/plugins/mod_hvp in Site Administration>Plugins>Install plugin. Inside the moodle container (one can go there by docker exec /bin/bash), I can find the hop_mod in the /mod directory.
Now I am installing (with Edit Mode enabled in Moodle) different libraries of H5P Content (e.g., Interactive Video, Multiple Choice, Quiz, etc.) in Moodle like this:
Now I just wanna check where these libraries are getting saved. First, I thought they would be somewhere in /mod/hvp/ inside my moodle container. However, I could not find them. In some sources I found that files in Moodle get saved in /moodledata/filedir inside moodle container. I wanted to make sure if the libraries also get saved there. As the files are saved with their named hashed in /moodledata/filedir and there are literally thousands of folders here, it is impossible to check for the libraries or any file I want to check here.

How to import remote python files using pyscript

Pyscript allows one to run python inside a web browser. I have two python scripts I wrote that I’d like to use. One way to do this is to copy and paste the python code held in these files directly into the index.html file where the index file is part of a GitHub.io page. If possible however, I would rather load/Import them from a remote location. Currently, they reside in the gh-page branch on GitHub alongside the index.html file.
My question is whether this is possible? Most tutorials show how to load and import a local python file which I don’t want to do.
Update: This is my current attempt which I add to the index.html file:
<py-config>
[[fetch]]
from = "https://github.com/etc/blob/gh-pages/"
files = ["myadd.py"]
</py-config>
When I try this I get the error message:
(PY0001): PyScript: Access to local files (using "Paths:" in ) is not available when directly opening a HTML file; you must use a webserver to serve the additional files. See this reference on starting a simple webserver with Python.
I want to avoid starting a server because this is meant to be client-side only approach with only a dumb file repo at the other end.
There is a solution, and it's very simple, just use the syntax:
<py-script src="mypythonscript.py"> </py-script>
And it will pick up the file from the GitHub directory.

VS Code command "workbench.extensions.installExtension" Not installing extensions

So I'm developing an extension for saving settings and extension profiles in VS Code, but have hit another bit of weirdness. When I'm loading a profile I pass a list of extension ID's from the profile to be loaded to a function to install:
/**
* Attempts to install the extensions by the ID's provided in the passed
* extension ID list.
*
* #param extensionIds - List of extension ID's for extensions to install
*/
public async installExtensions(extensionIds: Array<string>) {
// Iterate over extension ID's
for (const extensionId of extensionIds) {
// Call vscode built-in command to install the extension
await commands.executeCommand("workbench.extensions.installExtension", extensionId);
}
}
It doesn't come up with a prompt asking me whether to install or not (like it should), just starts installing
Even shows in the logs it installed successfully
But just goes back to not being installed after
For reference, I'm debugging this extension in remotes on a local docker container. Am I doing something wrong? or does the command not work on remotes? However if I try to install an extension that installs companion extension like formulahendry.auto-close-tag, which installs another extension formulahendry.auto-rename-tag with it, it comes up with the prompt
and actually installs.
Link to repo - https://github.com/SLGShark6/vscode-profile-manager/tree/development
Link to function that loads the profile - loadProfile()
Link to function that installs extensions - installExtensions()
N.B. you probably won't be able to use the dockerfile in the repo ATM, I need to fix that.

How to create a page extension in Directus 7

I have a working Directus CMS environment and would like to include some custom pages in there as well. According to the documentation!, I "can build page modules for custom dashboards, reporting, point-of-sale systems, or anything else".
The CMS is downloaded from directus, installed in localhost and then moved with FTP to the server as my client doesn't have terminal access allowed.
I already tried the boilerplate from https://github.com/directus/extension-toolkit, created a vue page with it, ran npm to transpile it, but now I don't know where to put it. If I put it to public > extensions > custom > pages (I put here the whole created folder), it's not shown anywhere and I can't really find any tutorial or help on how to do it. Not even in the docs.
You have to copy only the dist subdirectory of the extension to your server.
Example:
directus-extensions create page orders
directus-extensions build
rsync ./dist/ root#example.com:/var/www/directus/public/extensions/custom/pages/orders/
You should now see your page extension listed in the sidebar when you log in to your Directus app (provided your user role is configured to display extensions in the sidebar).

Install NuGet package programmatically

I'm trying to install a simple nuget-package programatically. I have created a package with a Site.css file in it. So it resides in the content folder of the package.
Using this code
public void TestInstall(string packageID, string physicalPath)
{
var rep = PackageRepositoryFactory.Default.CreateRepository(new PackageSource("http://nuget.testserver.lan/nuget", "Default"));
var packagemgr = new PackageManager(
rep,
new DefaultPackagePathResolver("http://nuget.testserver.lan/nuget"),
new PhysicalFileSystem(physicalPath)
);
var package = rep.FindPackagesById(packageID).First();
packagemgr.InstallPackage(package, false);
}
Lets say I provide packageID = 'Testpackage' and physicalPath = 'c:\inetpub\test' it creates:
c:\Inetpub\test\Testpackage
and that folder contains:
the content folder with the Site.css AND the Testpackage.0.1.nupkg
Not quite what I'm trying to do but sort of :)
Is it possible to change it so:
I can specify where it should place the package for its cache-functionality
Make it place whatever resides in the content folder to the specified path?
If the package contains dll's in the lib-folder have them go in the bin-directory (create if not exist)
A lot of the functionality of NuGet currently relies on Visual Studio automation, so outside of VS it's difficult to get all of the same behaviour.
Lot of people have asked for functionality that would require changes from using VS automation, so I suspect it's probably on the roadmap, as it's significant work, I don't think it will be soon.
Don't forget you can install packages in the Visual Package Manager console, so it's only a single command (Install-Package MarkdownHelper) and doesn't require clicking through the UI.