Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
moodle-mod_vpl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caseine
moodle-mod_vpl
Commits
bf862be3
Commit
bf862be3
authored
4 years ago
by
Astor Bizard
Browse files
Options
Downloads
Patches
Plain Diff
Changed ace theme listing method. Now effectively lists installed themes.
parent
54eb89f0
No related branches found
No related tags found
1 merge request
!1
Dev: Submissions list rework, webservices and bugfixes
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
editor/editor_utility.php
+38
-34
38 additions, 34 deletions
editor/editor_utility.php
git
+0
-0
0 additions, 0 deletions
git
settings.php
+3
-42
3 additions, 42 deletions
settings.php
with
41 additions
and
76 deletions
editor/editor_utility.php
+
38
−
34
View file @
bf862be3
...
...
@@ -119,40 +119,11 @@ class vpl_editor_util {
</div>
<div
id=
"vpl_ide_dialog_acetheme"
class=
"vpl_ide_dialog"
style=
"display: none;"
>
<select>
<option
value=
"chrome"
>
Chrome
</option>
<option
value=
"clouds"
>
Clouds
</option>
<option
value=
"crimson_editor"
>
Crimson Editor
</option>
<option
value=
"dawn"
>
Dawn
</option>
<option
value=
"dreamweaver"
>
Dreamweaver
</option>
<option
value=
"eclipse"
>
Eclipse
</option>
<option
value=
"github"
>
GitHub
</option>
<option
value=
"iplastic"
>
IPlastic
</option>
<option
value=
"solarized_light"
>
Solarized Light
</option>
<option
value=
"textmate"
>
TextMate
</option>
<option
value=
"tomorrow"
>
Tomorrow
</option>
<option
value=
"xcode"
>
XCode
</option>
<option
value=
"kuroir"
>
Kuroir
</option>
<option
value=
"katzenmilch"
>
KatzenMilch
</option>
<option
value=
"sqlserver"
>
SQL Server
</option>
<option
value=
"ambiance"
>
Ambiance
</option>
<option
value=
"chaos"
>
Chaos
</option>
<option
value=
"clouds_midnight"
>
Clouds Midnight
</option>
<option
value=
"cobalt"
>
Cobalt
</option>
<option
value=
"idle_fingers"
>
idle Fingers
</option>
<option
value=
"kr_theme"
>
krTheme
</option>
<option
value=
"merbivore"
>
Merbivore
</option>
<option
value=
"merbivore_soft"
>
Merbivore Soft
</option>
<option
value=
"mono_industrial"
>
Mono Industrial
</option>
<option
value=
"monokai"
>
Monokai
</option>
<option
value=
"pastel_on_dark"
>
Pastel on dark
</option>
<option
value=
"solarized_dark"
>
Solarized Dark
</option>
<option
value=
"terminal"
>
Terminal
</option>
<option
value=
"tomorrow_night"
>
Tomorrow Night
</option>
<option
value=
"tomorrow_night_blue"
>
Tomorrow Night Blue
</option>
<option
value=
"tomorrow_night_bright"
>
Tomorrow Night Bright
</option>
<option
value=
"tomorrow_night_eighties"
>
Tomorrow Night 80s
</option>
<option
value=
"twilight"
>
Twilight
</option>
<option
value=
"vibrant_ink"
>
Vibrant Ink
</option>
<?php
foreach
(
self
::
get_installed_themes
()
as
$theme
=>
$name
)
{
echo
'<option value="'
.
$theme
.
'">'
.
$name
.
'</option>'
;
}
?>
</select>
</div>
<div
id=
"vpl_ide_dialog_comments"
class=
"vpl_ide_dialog"
...
...
@@ -354,4 +325,37 @@ class vpl_editor_util {
$options
[
'nexturl'
]
=
$nexturl
;
$PAGE
->
requires
->
js_call_amd
(
'mod_vpl/evaluationmonitor'
,
'init'
,
array
(
$options
)
);
}
public
static
function
get_installed_themes
()
{
// Search for theme files.
global
$CFG
;
$acefiles
=
array_diff
(
scandir
(
$CFG
->
dirroot
.
'/mod/vpl/editor/ace9/'
),
array
(
'.'
,
'..'
));
$themefiles
=
array_filter
(
$acefiles
,
function
(
$name
)
{
return
substr
(
$name
,
0
,
6
)
==
'theme-'
;
});
// Process theme files names to get displayable name,
// by replacing underscores by spaces and
// by putting upper case letters at the beginning of words.
$themes
=
array
();
foreach
(
$themefiles
as
$themefile
)
{
$theme
=
substr
(
$themefile
,
6
,
strlen
(
$themefile
)
-
9
);
$themename
=
preg_replace_callback
(
'/(^|_)([a-z])/'
,
function
(
$matches
)
{
return
' '
.
strtoupper
(
$matches
[
2
]);
},
$theme
);
$themes
[
$theme
]
=
trim
(
$themename
);
}
// Some exceptions.
$themes
[
'github'
]
=
'GitHub'
;
$themes
[
'idle_fingers'
]
=
'idle Fingers'
;
$themes
[
'iplastic'
]
=
'IPlastic'
;
$themes
[
'katzenmilch'
]
=
'KatzenMilch'
;
$themes
[
'kr_theme'
]
=
'krTheme'
;
$themes
[
'kr'
]
=
'kr'
;
$themes
[
'pastel_on_dark'
]
=
'Pastel on dark'
;
$themes
[
'sqlserver'
]
=
'SQL Server'
;
$themes
[
'textmate'
]
=
'TextMate'
;
$themes
[
'tomorrow_night_eighties'
]
=
'Tomorrow Night 80s'
;
$themes
[
'xcode'
]
=
'XCode'
;
return
$themes
;
}
}
This diff is collapsed.
Click to expand it.
git
deleted
100644 → 0
+
0
−
0
View file @
54eb89f0
This diff is collapsed.
Click to expand it.
settings.php
+
3
−
42
View file @
bf862be3
...
...
@@ -26,6 +26,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
;
require_once
(
$CFG
->
dirroot
.
'/mod/vpl/lib.php'
);
require_once
(
$CFG
->
dirroot
.
'/mod/vpl/editor/editor_utility.php'
);
$kbyte
=
1024
;
$megabyte
=
1024
*
$kbyte
;
...
...
@@ -116,47 +117,7 @@ $default = vpl_get_array_key( $list, 60 );
$settings
->
add
(
new
admin_setting_configselect
(
$prefix
.
'discard_submission_period'
,
get_string
(
'discard_submission_period'
,
VPL
),
get_string
(
'discard_submission_period_description'
,
VPL
),
$default
,
$list
)
);
$list
=
array
(
'ambiance'
,
'chaos'
,
'chrome'
,
'clouds_midnight'
,
'clouds'
,
'cobalt'
,
'crmson_editor'
,
'dawn'
,
'dreamweaver'
,
'eclipse'
,
'github'
,
'idle_fingers'
,
'iplastic'
,
'katzenmilch'
,
'kr_theme'
,
'kr'
,
'kuroir'
,
'merbivore_soft'
,
'merbivore'
,
'mono_industrial'
,
'monokai'
,
'pastel_on_dark'
,
'solarized_dark'
,
'solarized_light'
,
'sqlserver'
,
'terminal'
,
'texmate'
,
'tomorrow_night_blue'
,
'tomorrow_night_bright'
,
'tomorrow_night_eighties'
,
'tomorrow_night'
,
'tomorrow'
,
'twilight'
,
'vibrant_ink'
,
'xcode'
);
$themelist
=
array
();
foreach
(
$list
as
$theme
)
{
$themelist
[
$theme
]
=
$theme
;
}
$settings
->
add
(
new
admin_setting_configselect
(
$prefix
.
'editor_theme'
,
get_string
(
'editortheme'
,
VPL
),
get_string
(
'editortheme'
,
VPL
),
'chrome'
,
$
theme
list
)
);
get_string
(
'editortheme'
,
VPL
),
'chrome'
,
vpl_editor_util
::
get_installed_
theme
s
()
)
);
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