Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream merge #3

Merged
merged 10 commits into from
Feb 1, 2021
6 changes: 4 additions & 2 deletions classes/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,8 @@ public function loadContent($id) {
hc.year_to,
hc.changes,
hc.author_comments,
hc.default_language
hc.default_language,
hc.a11y_title
FROM {hvp} hc
JOIN {hvp_libraries} hl ON hl.id = hc.main_library_id
WHERE hc.id = ?", array($id)
Expand Down Expand Up @@ -1154,7 +1155,8 @@ public function loadContent($id) {
'year_to',
'changes',
'author_comments',
'default_language'
'default_language',
'a11y_title'
];

$content['metadata'] = \H5PCore::snakeToCamel(
Expand Down
18 changes: 16 additions & 2 deletions classes/view_assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,15 @@ private function getembedcode($embedenabled) {

$root = self::getsiteroot();
$embedurl = new \moodle_url("{$root}/mod/hvp/embed.php?id={$this->cm->id}");
$title = isset($this->content['metadata']['a11yTitle'])
? $this->content['metadata']['a11yTitle']
: (isset($this->content['metadata']['title'])
? $this->content['metadata']['title']
: ''
);

return "<iframe src=\"{$embedurl->out()}\" width=\":w\" height=\":h\" frameborder=\"0\" " .
"allowfullscreen=\"allowfullscreen\"></iframe>";
"allowfullscreen=\"allowfullscreen\" title=\"{$title}\"></iframe>";
}

/**
Expand Down Expand Up @@ -310,14 +316,22 @@ public function outputview() {
if ($this->embedtype === 'div') {
echo "<div class=\"h5p-content\" data-content-id=\"{$this->content['id']}\"></div>";
} else {
$title = isset($this->content['metadata']['a11yTitle'])
? $this->content['metadata']['a11yTitle']
: (isset($this->content['metadata']['title'])
? $this->content['metadata']['title']
: ''
);

echo "<div class=\"h5p-iframe-wrapper\">" .
"<iframe id=\"h5p-iframe-{$this->content['id']}\"" .
" class=\"h5p-iframe\"" .
" data-content-id=\"{$this->content['id']}\"" .
" style=\"height:1px\"" .
" src=\"about:blank\"" .
" frameBorder=\"0\"" .
" scrolling=\"no\">" .
" scrolling=\"no\"" .
" title=\"{$title}\">" .
"</iframe>" .
"</div>";
}
Expand Down
1 change: 1 addition & 0 deletions db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="completionpass" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="a11y_title" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
14 changes: 14 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,19 @@ function hvp_upgrade_2020080401() {
$dbman->change_field_notnull($table, $field);
}

function hvp_upgrade_2020082800() {
global $DB;
$dbman = $DB->get_manager();

$table = new xmldb_table('hvp');

if (!$dbman->field_exists($table, 'a11y_title')) {
$dbman->add_field($table,
new xmldb_field('a11y_title', XMLDB_TYPE_CHAR, '255', null, null, null, null)
);
}
}

/**
* Hvp module upgrade function.
*
Expand All @@ -530,6 +543,7 @@ function xmldb_hvp_upgrade($oldversion) {
2019030700,
2020080400,
2020080401,
2020082800,
];

foreach ($upgrades as $version) {
Expand Down
2 changes: 1 addition & 1 deletion editor
Submodule editor updated 360 files
3 changes: 2 additions & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ function hvp_content_upgrade_progress($libraryid) {
// Find the 40 first contents using this library version and add to params.
$results = $DB->get_records_sql(
"SELECT id, json_content as params, name as title, authors, source, year_from, year_to,
license, license_version, changes, license_extras, author_comments, default_language
license, license_version, changes, license_extras, author_comments, default_language,
a11y_title
FROM {hvp}
WHERE main_library_id = ?
{$skipquery}
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2020080401;
$plugin->version = 2020082800;
$plugin->requires = 2013051403;
$plugin->cron = 0;
$plugin->component = 'mod_hvp';
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '1.21.0';
$plugin->release = '1.21.1';