Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle_mod-hvp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle_mod-hvp
Commits
df4bb9c0
Commit
df4bb9c0
authored
6 years ago
by
Paal Joergensen
Browse files
Options
Downloads
Patches
Plain Diff
Rename metadata to metadata_settings
parent
81ac9857
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
classes/editor_framework.php
+11
-15
11 additions, 15 deletions
classes/editor_framework.php
classes/framework.php
+1
-1
1 addition, 1 deletion
classes/framework.php
db/install.xml
+2
-2
2 additions, 2 deletions
db/install.xml
db/upgrade.php
+3
-3
3 additions, 3 deletions
db/upgrade.php
with
17 additions
and
21 deletions
classes/editor_framework.php
+
11
−
15
View file @
df4bb9c0
...
...
@@ -120,7 +120,7 @@ class editor_framework implements \H5peditorStorage {
runnable,
restricted,
tutorial_url,
metadata
metadata
_settings
FROM
{
hvp_libraries
}
WHERE machine_name = ?
AND major_version = ?
...
...
@@ -138,7 +138,7 @@ class editor_framework implements \H5peditorStorage {
$library
->
title
=
$details
->
title
;
$library
->
runnable
=
$details
->
runnable
;
$library
->
restricted
=
$superuser
?
false
:
(
$details
->
restricted
===
'1'
?
true
:
false
);
$library
->
metadata
=
$details
->
metadata
;
$library
->
metadata
Settings
=
json_decode
(
$details
->
metadata
_settings
)
;
$librarieswithdetails
[]
=
$library
;
}
}
...
...
@@ -153,11 +153,11 @@ class editor_framework implements \H5peditorStorage {
"SELECT id,
machine_name AS name,
title,
major_version,
minor_version,
tutorial_url,
major_version
AS majorVersion
,
minor_version
AS minorVersion
,
tutorial_url
AS tutorialUrl
,
restricted,
metadata
metadata
_settings AS metadataSettings
FROM
{
hvp_libraries
}
WHERE runnable = 1
AND semantics IS NOT NULL
...
...
@@ -167,15 +167,11 @@ class editor_framework implements \H5peditorStorage {
// Remove unique index.
unset
(
$library
->
id
);
// Convert snakes to camels.
$library
->
majorVersion
=
(
int
)
$library
->
major_version
;
unset
(
$library
->
major_version
);
$library
->
minorVersion
=
(
int
)
$library
->
minor_version
;
unset
(
$library
->
minor_version
);
if
(
!
empty
(
$library
->
tutorial_url
))
{
$library
->
tutorialUrl
=
$library
->
tutorial_url
;
}
unset
(
$library
->
tutorial_url
);
$library
->
metadataSettings
=
json_decode
(
$library
->
metadataSettings
);
// Convert to int.
$library
->
majorVersion
=
(
int
)
$library
->
majorVersion
;
$library
->
minorVersion
=
(
int
)
$library
->
minorVersion
;
// Make sure we only display the newest version of a library.
foreach
(
$libraries
as
$key
=>
$existinglibrary
)
{
...
...
This diff is collapsed.
Click to expand it.
classes/framework.php
+
1
−
1
View file @
df4bb9c0
...
...
@@ -784,7 +784,7 @@ class framework implements \H5PFrameworkInterface {
'drop_library_css'
=>
$droplibrarycss
,
'semantics'
=>
$librarydata
[
'semantics'
],
'has_icon'
=>
$librarydata
[
'hasIcon'
],
'metadata'
=>
$librarydata
[
'metadata
'
]
?
1
:
0
,
'metadata
_settings
'
=>
$librarydata
[
'metadata
Settings'
]
,
'add_to'
=>
isset
(
$librarydata
[
'addTo'
])
?
json_encode
(
$librarydata
[
'addTo'
])
:
null
,
);
...
...
This diff is collapsed.
Click to expand it.
db/install.xml
+
2
−
2
View file @
df4bb9c0
...
...
@@ -89,7 +89,7 @@
<FIELD
NAME=
"tutorial_url"
TYPE=
"char"
LENGTH=
"1000"
NOTNULL=
"false"
SEQUENCE=
"false"
COMMENT=
"URL to a tutorial for this library"
/>
<FIELD
NAME=
"has_icon"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
COMMENT=
"Whether or not this library contains an icon.svg"
/>
<FIELD
NAME=
"add_to"
TYPE=
"text"
NOTNULL=
"false"
SEQUENCE=
"false"
COMMENT=
"Plugin configuration data"
/>
<FIELD
NAME=
"metadata
"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"1"
SEQUENCE=
"false"
COMMENT=
"Whether or not as sublibrary gets metadata button
"
/>
<FIELD
NAME=
"metadata
_settings"
TYPE=
"text"
NOTNULL=
"false"
SEQUENCE=
"false"
COMMENT=
"Metadata settings
"
/>
</FIELDS>
<KEYS>
<KEY
NAME=
"primary"
TYPE=
"primary"
FIELDS=
"id"
/>
...
...
This diff is collapsed.
Click to expand it.
db/upgrade.php
+
3
−
3
View file @
df4bb9c0
...
...
@@ -422,13 +422,13 @@ function hvp_upgrade_2018090300() {
$table
=
new
xmldb_table
(
'hvp_libraries'
);
if
(
!
$dbman
->
field_exists
(
$table
,
'add_to'
))
{
$dbman
->
add_field
(
$table
,
new
xmldb_field
(
'add_to'
,
XMLDB_TYPE_TEXT
,
null
,
null
,
null
,
null
,
null
,
'has_icon'
)
new
xmldb_field
(
'add_to'
,
XMLDB_TYPE_TEXT
,
null
,
null
,
null
,
null
,
null
)
);
}
if
(
!
$dbman
->
field_exists
(
$table
,
'metadata'
))
{
if
(
!
$dbman
->
field_exists
(
$table
,
'metadata
_settings
'
))
{
$dbman
->
add_field
(
$table
,
new
xmldb_field
(
'metadata'
,
XMLDB_TYPE_
INTEGER
,
'1'
,
null
,
XMLDB_NOTNULL
,
null
,
'1'
,
'add_to'
)
new
xmldb_field
(
'metadata
_settings
'
,
XMLDB_TYPE_
TEXT
,
null
,
null
,
null
,
null
,
null
)
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment