|
@ -0,0 +1,56 @@
|
|||
// (C) Copyright 2015 Moodle Pty Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Based on the template node_modules/cordova-android/bin/templates/project/Activity.java
|
||||
|
||||
package com.moodle.moodlemobile;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
public class MainActivity extends CordovaActivity
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// enable Cordova apps to be started in the background
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
|
||||
moveTaskToBack(true);
|
||||
}
|
||||
|
||||
// Set by <content src="index.html" /> in config.xml
|
||||
loadUrl(launchUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
// Forward back key events to the web view.
|
||||
if (this.appView != null && event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
|
||||
View webview = this.appView.getView();
|
||||
|
||||
if (webview != null) {
|
||||
webview.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
}
|
2
NOTICE
|
@ -1,4 +1,4 @@
|
|||
(C) Copyright 2015 Martin Dougiamas
|
||||
(C) Copyright 2015 Moodle Pty Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
79
config.xml
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget id="com.moodle.moodlemobile" version="3.7.2" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<widget id="com.moodle.moodlemobile" version="3.8.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<name>Moodle</name>
|
||||
<description>Moodle official app</description>
|
||||
<author email="mobile@moodle.com" href="http://moodle.com">Moodle Mobile team</author>
|
||||
|
@ -42,25 +42,20 @@
|
|||
<param name="ios-package" onload="true" value="CDVStatusBar" />
|
||||
</feature>
|
||||
<platform name="android">
|
||||
<resource-file src="MainActivity.java" target="app/src/main/java/com/moodle/moodlemobile/MainActivity.java" />
|
||||
<resource-file src="google-services.json" target="app/google-services.json" />
|
||||
<splash qualifier="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
|
||||
<splash qualifier="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
|
||||
<splash qualifier="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
|
||||
<splash qualifier="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
|
||||
<splash qualifier="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
|
||||
<splash qualifier="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
|
||||
<splash qualifier="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
|
||||
<splash qualifier="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
|
||||
<splash qualifier="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
|
||||
<splash qualifier="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
|
||||
<splash qualifier="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
|
||||
<splash qualifier="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
|
||||
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
|
||||
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
|
||||
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
|
||||
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
|
||||
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
|
||||
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
|
||||
<splash density="land-ldpi" qualifier="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
|
||||
<splash density="land-mdpi" qualifier="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
|
||||
<splash density="land-hdpi" qualifier="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
|
||||
<splash density="land-xhdpi" qualifier="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
|
||||
<splash density="land-xxhdpi" qualifier="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
|
||||
<splash density="land-xxxhdpi" qualifier="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
|
||||
<splash density="port-ldpi" qualifier="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
|
||||
<splash density="port-mdpi" qualifier="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
|
||||
<splash density="port-hdpi" qualifier="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
|
||||
<splash density="port-xhdpi" qualifier="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
|
||||
<splash density="port-xxhdpi" qualifier="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
|
||||
<splash density="port-xxxhdpi" qualifier="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
|
||||
<resource-file src="resources/android/icon/drawable-ldpi-smallicon.png" target="app/src/main/res/mipmap-ldpi/smallicon.png" />
|
||||
<resource-file src="resources/android/icon/drawable-mdpi-smallicon.png" target="app/src/main/res/mipmap-mdpi/smallicon.png" />
|
||||
<resource-file src="resources/android/icon/drawable-hdpi-smallicon.png" target="app/src/main/res/mipmap-hdpi/smallicon.png" />
|
||||
|
@ -77,6 +72,18 @@
|
|||
<resource-file src="resources/android/splash/drawable-port-xhdpi-screen.png" target="app/src/main/res/drawable-port-xhdpi/screen.png" />
|
||||
<resource-file src="resources/android/splash/drawable-port-xxhdpi-screen.png" target="app/src/main/res/drawable-port-xxhdpi/screen.png" />
|
||||
<resource-file src="resources/android/splash/drawable-port-xxxhdpi-screen.png" target="app/src/main/res/drawable-port-xxxhdpi/screen.png" />
|
||||
<resource-file src="resources/values/colors.xml" target="/app/src/main/res/values/colors.xml" />
|
||||
<icon background="@color/background" density="ldpi" foreground="resources/android/icon/ldpi-foreground.png" src="resources/android/icon/drawable-ldpi-icon.png" />
|
||||
<icon background="@color/background" density="mdpi" foreground="resources/android/icon/mdpi-foreground.png" src="resources/android/icon/drawable-mdpi-icon.png" />
|
||||
<icon background="@color/background" density="hdpi" foreground="resources/android/icon/hdpi-foreground.png" src="resources/android/icon/drawable-hdpi-icon.png" />
|
||||
<icon background="@color/background" density="xhdpi" foreground="resources/android/icon/xhdpi-foreground.png" src="resources/android/icon/drawable-xhdpi-icon.png" />
|
||||
<icon background="@color/background" density="xxhdpi" foreground="resources/android/icon/xxhdpi-foreground.png" src="resources/android/icon/drawable-xxhdpi-icon.png" />
|
||||
<icon background="@color/background" density="xxxhdpi" foreground="resources/android/icon/xxxhdpi-foreground.png" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
|
||||
<config-file parent="/manifest/application" target="AndroidManifest.xml">
|
||||
<provider android:authorities="${applicationId}.opener.provider" android:exported="false" android:grantUriPermissions="true" android:name="io.github.pwlin.cordova.plugins.fileopener2.FileProvider">
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/opener_paths" />
|
||||
</provider>
|
||||
</config-file>
|
||||
</platform>
|
||||
<platform name="ios">
|
||||
<resource-file src="GoogleService-Info.plist" />
|
||||
|
@ -112,8 +119,29 @@
|
|||
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
|
||||
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
|
||||
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
|
||||
<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
|
||||
<string>We need your location so you can attach it as part of your submissions.</string>
|
||||
</edit-config>
|
||||
<icon height="20" src="resources/ios/icon/icon-20.png" width="20" />
|
||||
<icon height="40" src="resources/ios/icon/icon-20@2x.png" width="40" />
|
||||
<icon height="60" src="resources/ios/icon/icon-20@3x.png" width="60" />
|
||||
<icon height="29" src="resources/ios/icon/icon-29.png" width="29" />
|
||||
<icon height="58" src="resources/ios/icon/icon-29@2x.png" width="58" />
|
||||
<icon height="87" src="resources/ios/icon/icon-29@3x.png" width="87" />
|
||||
<icon height="48" src="resources/ios/icon/icon-24@2x.png" width="48" />
|
||||
<icon height="55" src="resources/ios/icon/icon-27.5@2x.png" width="55" />
|
||||
<icon height="88" src="resources/ios/icon/icon-44@2x.png" width="88" />
|
||||
<icon height="172" src="resources/ios/icon/icon-86@2x.png" width="172" />
|
||||
<icon height="196" src="resources/ios/icon/icon-98@2x.png" width="196" />
|
||||
<icon height="216" src="resources/ios/icon/icon-108@2x.png" width="216" />
|
||||
<splash height="2688" src="resources/ios/splash/Default-2688h~iphone.png" width="1242" />
|
||||
<splash height="1242" src="resources/ios/splash/Default-Landscape-2688h~iphone.png" width="2688" />
|
||||
<splash height="1792" src="resources/ios/splash/Default-1792h~iphone.png" width="828" />
|
||||
<splash height="828" src="resources/ios/splash/Default-Landscape-1792h~iphone.png" width="1792" />
|
||||
<splash height="2436" src="resources/ios/splash/Default-2436h.png" width="1125" />
|
||||
<splash height="1125" src="resources/ios/splash/Default-Landscape-2436h.png" width="2436" />
|
||||
</platform>
|
||||
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="1.1.8" />
|
||||
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="1.3.0" />
|
||||
<plugin name="cordova-android-support-gradle-release" spec="3.0.1">
|
||||
<variable name="ANDROID_SUPPORT_VERSION" value="27.1.0" />
|
||||
</plugin>
|
||||
|
@ -125,8 +153,11 @@
|
|||
</plugin>
|
||||
<plugin name="cordova-plugin-device" spec="2.0.3" />
|
||||
<plugin name="cordova-plugin-file" spec="6.0.2" />
|
||||
<plugin name="cordova-plugin-file-opener2" spec="2.0.19" />
|
||||
<plugin name="cordova-plugin-file-opener2" spec="2.2.1" />
|
||||
<plugin name="cordova-plugin-file-transfer" spec="1.7.1" />
|
||||
<plugin name="cordova-plugin-geolocation" spec="4.0.2">
|
||||
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="We need your location so you can attach it as part of your submissions." />
|
||||
</plugin>
|
||||
<plugin name="cordova-plugin-globalization" spec="1.11.0" />
|
||||
<plugin name="cordova-plugin-inappbrowser" spec="3.1.0" />
|
||||
<plugin name="cordova-plugin-ionic-keyboard" spec="2.1.3" />
|
||||
|
@ -138,7 +169,7 @@
|
|||
<plugin name="cordova-plugin-statusbar" spec="2.4.3" />
|
||||
<plugin name="cordova-plugin-whitelist" spec="1.3.4" />
|
||||
<plugin name="cordova-plugin-zip" spec="3.1.0" />
|
||||
<plugin name="cordova-sqlite-storage" spec="2.6.0" />
|
||||
<plugin name="cordova-sqlite-storage" spec="3.4.0" />
|
||||
<plugin name="nl.kingsquare.cordova.background-audio" spec="1.0.1" />
|
||||
<plugin name="phonegap-plugin-push" spec="https://github.com/moodlemobile/phonegap-plugin-push.git#moodle-v3">
|
||||
<variable name="ANDROID_SUPPORT_V13_VERSION" value="27.+" />
|
||||
|
@ -156,6 +187,6 @@
|
|||
<config-file parent="FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED" target="*-Info.plist">
|
||||
<string>YES</string>
|
||||
</config-file>
|
||||
<engine name="android" spec="7.1.2" />
|
||||
<engine name="ios" spec="4.5.5" />
|
||||
<engine name="android" spec="8.0.0" />
|
||||
<engine name="ios" spec="5.0.1" />
|
||||
</widget>
|
||||
|
|
|
@ -12,5 +12,37 @@ module.exports = {
|
|||
copyConfig: {
|
||||
src: ['{{ROOT}}/src/config.json'],
|
||||
dest: '{{WWW}}/'
|
||||
}
|
||||
},
|
||||
copyMathJaxMain: {
|
||||
src: ['{{ROOT}}/node_modules/mathjax/MathJax.js'],
|
||||
dest: '{{WWW}}/lib/mathjax'
|
||||
},
|
||||
copyMathJaxExtensions: {
|
||||
src: ['{{ROOT}}/node_modules/mathjax/extensions/**/*'],
|
||||
dest: '{{WWW}}/lib/mathjax/extensions'
|
||||
},
|
||||
copyMathJaxElement: {
|
||||
src: ['{{ROOT}}/node_modules/mathjax/jax/element/**/*'],
|
||||
dest: '{{WWW}}/lib/mathjax/jax/element'
|
||||
},
|
||||
copyMathJaxInput: {
|
||||
src: ['{{ROOT}}/node_modules/mathjax/jax/input/**/*'],
|
||||
dest: '{{WWW}}/lib/mathjax/jax/input'
|
||||
},
|
||||
copyMathJaxSVGOutput: {
|
||||
src: ['{{ROOT}}/node_modules/mathjax/jax/output/SVG/**/*'],
|
||||
dest: '{{WWW}}/lib/mathjax/jax/output/SVG'
|
||||
},
|
||||
copyMathJaxPreviewHTMLOutput: {
|
||||
src: ['{{ROOT}}/node_modules/mathjax/jax/output/PreviewHTML/**/*'],
|
||||
dest: '{{WWW}}/lib/mathjax/jax/output/PreviewHTML'
|
||||
},
|
||||
copyMathJaxLocalization: {
|
||||
src: ['{{ROOT}}/node_modules/mathjax/localization/**/*'],
|
||||
dest: '{{WWW}}/lib/mathjax/localization'
|
||||
},
|
||||
copyH5P: {
|
||||
src: ['{{ROOT}}/src/core/h5p/assets/**/*'],
|
||||
dest: '{{WWW}}/h5p/'
|
||||
},
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<Identity Name="3312ADB7.MoodleDesktop"
|
||||
ProcessorArchitecture="x64"
|
||||
Publisher="CN=33CDCDF6-1EB5-4827-9897-ED25C91A32F6"
|
||||
Version="3.7.2.0" />
|
||||
Version="3.8.0.0" />
|
||||
<Properties>
|
||||
<DisplayName>Moodle Desktop</DisplayName>
|
||||
<PublisherDisplayName>Moodle Pty Ltd.</PublisherDisplayName>
|
||||
|
|
|
@ -13,7 +13,7 @@ var gulp = require('gulp'),
|
|||
File = gutil.File,
|
||||
exec = require('child_process').exec,
|
||||
license = '' +
|
||||
'// (C) Copyright 2015 Martin Dougiamas\n' +
|
||||
'// (C) Copyright 2015 Moodle Pty Ltd.\n' +
|
||||
'//\n' +
|
||||
'// Licensed under the Apache License, Version 2.0 (the "License");\n' +
|
||||
'// you may not use this file except in compliance with the License.\n' +
|
||||
|
|
23
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "moodlemobile",
|
||||
"version": "3.7.2",
|
||||
"version": "3.8.0",
|
||||
"description": "The official app for Moodle.",
|
||||
"author": {
|
||||
"name": "Moodle Pty Ltd.",
|
||||
|
@ -57,6 +57,7 @@
|
|||
"@ionic-native/file": "4.17.0",
|
||||
"@ionic-native/file-opener": "4.17.0",
|
||||
"@ionic-native/file-transfer": "4.17.0",
|
||||
"@ionic-native/geolocation": "4.17.0",
|
||||
"@ionic-native/globalization": "4.17.0",
|
||||
"@ionic-native/in-app-browser": "4.17.0",
|
||||
"@ionic-native/keyboard": "4.17.0",
|
||||
|
@ -78,20 +79,22 @@
|
|||
"@types/cordova-plugin-network-information": "0.0.3",
|
||||
"@types/node": "8.10.19",
|
||||
"@types/promise.prototype.finally": "2.0.2",
|
||||
"ajv": "6.10.2",
|
||||
"chart.js": "2.7.2",
|
||||
"com-darryncampbell-cordova-plugin-intent": "1.1.7",
|
||||
"cordova": "8.1.2",
|
||||
"cordova-android": "7.1.2",
|
||||
"com-darryncampbell-cordova-plugin-intent": "1.3.0",
|
||||
"cordova": "9.0.0",
|
||||
"cordova-android": "8.0.0",
|
||||
"cordova-android-support-gradle-release": "3.0.1",
|
||||
"cordova-clipboard": "1.3.0",
|
||||
"cordova-ios": "4.5.5",
|
||||
"cordova-ios": "5.0.1",
|
||||
"cordova-plugin-badge": "0.8.8",
|
||||
"cordova-plugin-camera": "4.1.0",
|
||||
"cordova-plugin-customurlscheme": "4.4.0",
|
||||
"cordova-plugin-device": "2.0.3",
|
||||
"cordova-plugin-file": "6.0.2",
|
||||
"cordova-plugin-file-opener2": "2.0.19",
|
||||
"cordova-plugin-file-opener2": "2.2.1",
|
||||
"cordova-plugin-file-transfer": "1.7.1",
|
||||
"cordova-plugin-geolocation": "4.0.2",
|
||||
"cordova-plugin-globalization": "1.11.0",
|
||||
"cordova-plugin-inappbrowser": "3.1.0",
|
||||
"cordova-plugin-ionic-keyboard": "2.1.3",
|
||||
|
@ -103,13 +106,14 @@
|
|||
"cordova-plugin-statusbar": "2.4.3",
|
||||
"cordova-plugin-whitelist": "1.3.4",
|
||||
"cordova-plugin-zip": "3.1.0",
|
||||
"cordova-sqlite-storage": "2.6.0",
|
||||
"cordova-sqlite-storage": "3.4.0",
|
||||
"cordova-support-google-services": "1.2.1",
|
||||
"es6-promise-plugin": "4.2.2",
|
||||
"font-awesome": "4.7.0",
|
||||
"ionic-angular": "3.9.3",
|
||||
"ionicons": "3.0.0",
|
||||
"jszip": "3.1.5",
|
||||
"mathjax": "2.7.2",
|
||||
"moment": "2.22.2",
|
||||
"nl.kingsquare.cordova.background-audio": "1.0.1",
|
||||
"phonegap-plugin-multidex": "1.0.0",
|
||||
|
@ -176,6 +180,9 @@
|
|||
"phonegap-plugin-push": {
|
||||
"ANDROID_SUPPORT_V13_VERSION": "27.+",
|
||||
"FCM_VERSION": "17.0.+"
|
||||
},
|
||||
"cordova-plugin-geolocation": {
|
||||
"GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -216,7 +223,7 @@
|
|||
"category": "public.app-category.education",
|
||||
"icon": "resources/desktop/icon.icns",
|
||||
"target": "mas",
|
||||
"bundleVersion": "3.7.2",
|
||||
"bundleVersion": "3.8.0",
|
||||
"extendInfo": {
|
||||
"ElectronTeamID": "2NU57U5PAW"
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="Layer_1"
|
||||
data-name="Layer 1"
|
||||
viewBox="0 0 1024 1024"
|
||||
version="1.1"
|
||||
sodipodi:docname="icon-foreground.svg"
|
||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
|
||||
inkscape:export-filename="/Users/pau/git/mm3/resources/android/icon-foreground.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<metadata
|
||||
id="metadata23">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>MoodleApp_Icon_White_RGB</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1306"
|
||||
inkscape:window-height="970"
|
||||
id="namedview21"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.11523438"
|
||||
inkscape:cx="-652.75324"
|
||||
inkscape:cy="-1188.1419"
|
||||
inkscape:window-x="1894"
|
||||
inkscape:window-y="73"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<defs
|
||||
id="defs4">
|
||||
<style
|
||||
id="style2">.cls-1{fill:#fff;}.cls-2,.cls-3,.cls-4{fill:#f48020;}.cls-3,.cls-4{stroke:#4a4a4c;}.cls-3{stroke-width:5.24px;}.cls-4{stroke-width:5.28px;}.cls-5{fill:#333;}</style>
|
||||
</defs>
|
||||
<title
|
||||
id="title6">MoodleApp_Icon_White_RGB</title>
|
||||
<g
|
||||
id="g118"
|
||||
transform="matrix(0.59052793,0,0,0.59052793,211.20967,210.89845)"
|
||||
style="opacity:1">
|
||||
<path
|
||||
transform="translate(-12,-10)"
|
||||
id="path10"
|
||||
d="M 714.85,763.42 V 524.26 q 0,-75 -62,-75 -62,0 -62,75 V 763.42 H 469.18 V 524.26 q 0,-75 -60.9,-75 -62,0 -61.95,75 V 763.42 H 224.56 V 510.14 q 0,-78.27 54.35,-118.48 47.85,-35.88 129.37,-35.9 82.64,0 121.77,42.4 33.69,-42.39 122.85,-42.4 81.54,0 129.35,35.9 54.35,40.2 54.35,118.48 v 253.28 z"
|
||||
class="cls-2"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#f48020" />
|
||||
<path
|
||||
transform="translate(-12,-10)"
|
||||
id="path12"
|
||||
d="M 77.26,402"
|
||||
class="cls-3"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#f48020;stroke:#4a4a4c;stroke-width:5.23999977px" />
|
||||
<path
|
||||
transform="translate(-12,-10)"
|
||||
id="path14"
|
||||
d="M 79.41,401"
|
||||
class="cls-4"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#f48020;stroke:#4a4a4c;stroke-width:5.28000021px" />
|
||||
<path
|
||||
transform="translate(-12,-10)"
|
||||
id="path16"
|
||||
d="m 459.3,338 121.9,-88.72 -1.56,-5.4 c -206.31,21.27 -327.1,49 -505.07,154.49 l 1.61,5.27 46.53,-1.49 c 33.56,1.16 68.26,2.79 101.7,2.93 -1.67,18.28 -0.91,39.85 2.6,65.14 v 0 l -0.81,7.1 c 114.91,38.91 224,3.38 281.36,-97.15 l -3.39,-4.62 C 494.8,365.05 475.76,349.59 459.3,338 Z"
|
||||
class="cls-5"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#333333" />
|
||||
<path
|
||||
transform="translate(-12,-10)"
|
||||
id="path18"
|
||||
d="m 326.35,322.85 c -0.67,-2.38 -4.92,-3.26 -9.48,-2 -3.49,1 -6.17,2.94 -6.95,4.86 -41,11 -108.78,30.36 -156.5,46.43 l -2.94,1 c -36.93,12.42 -54.72,18.79 -55.82,27.76 -5.06,40.82 -1.93,93.35 -1.9,94 l 0.41,14.18 c -21.54,61 0.15,109.76 18.56,154.4 0.12,-55.17 2.36,-100.08 -13.21,-157.18 -0.44,-8.46 -3.31,-67.19 1.33,-104.76 0.76,-6.09 25.79,-14.52 52.3,-23.43 l 2.94,-1 c 48.76,-16.41 118.53,-36.24 159.1,-47.1 a 14.48,14.48 0 0 0 5.08,-0.55 c 4.56,-1.27 7.73,-4.23 7.08,-6.61 z"
|
||||
class="cls-5"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#333333" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 608 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 851 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 851 B |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 41 KiB |
After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 6.1 KiB |
|
@ -0,0 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<color name="background">#FFFFFF</color>
|
||||
</resources>
|
|
@ -51,7 +51,7 @@ if [ ! -z $GIT_ORG ] && [ ! -z $GIT_TOKEN ] ; then
|
|||
|
||||
git checkout $TRAVIS_BRANCH
|
||||
|
||||
rm -Rf assets build index.html templates www destkop
|
||||
rm -Rf assets build index.html templates www destkop lib
|
||||
|
||||
if [ $TRAVIS_BRANCH == 'desktop' ] ; then
|
||||
cp -Rf ../$gitfolder/desktop ./
|
||||
|
|
|
@ -20,22 +20,22 @@ function print_success {
|
|||
}
|
||||
|
||||
function print_error {
|
||||
tput setaf 1; echo " ERROR: $1"
|
||||
tput setaf 1; echo " ERROR: $1"; tput sgr0
|
||||
}
|
||||
|
||||
function print_ok {
|
||||
tput setaf 2; echo " OK: $1"
|
||||
tput setaf 2; echo " OK: $1"; tput sgr0
|
||||
echo
|
||||
}
|
||||
|
||||
function print_message {
|
||||
tput setaf 3; echo "-------- $1"
|
||||
tput setaf 3; echo "-------- $1"; tput sgr0
|
||||
echo
|
||||
}
|
||||
|
||||
function print_title {
|
||||
stepnumber=$(($stepnumber + 1))
|
||||
echo
|
||||
tput setaf 5; echo "$stepnumber $1"
|
||||
tput setaf 5; echo '=================='
|
||||
tput setaf 5; echo "$stepnumber $1"; tput sgr0
|
||||
tput setaf 5; echo '=================='; tput sgr0
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Script for converting a PHP WS structure to a TS type.
|
||||
*
|
||||
* The first parameter (required) is the path to the Moodle installation to use.
|
||||
* The second parameter (required) is the name to the WS to convert.
|
||||
* The third parameter (optional) is a number: 1 to convert the params structure,
|
||||
* 0 to convert the returns structure. Defaults to 0.
|
||||
*/
|
||||
|
||||
if (!isset($argv[1])) {
|
||||
echo "ERROR: Please pass the path to the folder containing the Moodle installations as the first parameter.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
if (!isset($argv[2])) {
|
||||
echo "ERROR: Please pass the WS name as the second parameter.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
require_once('ws_to_ts_functions.php');
|
||||
|
||||
$versions = array('master', '37', '36', '35', '34', '33', '32', '31');
|
||||
|
||||
$moodlespath = $argv[1];
|
||||
$wsname = $argv[2];
|
||||
$useparams = !!(isset($argv[3]) && $argv[3]);
|
||||
$pathseparator = '/';
|
||||
|
||||
// Get the path to the script.
|
||||
$index = strrpos(__FILE__, $pathseparator);
|
||||
if ($index === false) {
|
||||
$pathseparator = '\\';
|
||||
$index = strrpos(__FILE__, $pathseparator);
|
||||
}
|
||||
$scriptfolder = substr(__FILE__, 0, $index);
|
||||
$scriptpath = concatenate_paths($scriptfolder, 'get_ws_structure.php', $pathseparator);
|
||||
|
||||
$previousstructure = null;
|
||||
$previousversion = null;
|
||||
$libsloaded = false;
|
||||
|
||||
foreach ($versions as $version) {
|
||||
$moodlepath = concatenate_paths($moodlespath, 'stable_' . $version, $pathseparator);
|
||||
|
||||
if (!$libsloaded) {
|
||||
$libsloaded = true;
|
||||
|
||||
require($moodlepath . '/config.php');
|
||||
require($CFG->dirroot . '/webservice/lib.php');
|
||||
}
|
||||
|
||||
// Get the structure in this Moodle version.
|
||||
$structure = shell_exec("php $scriptpath $moodlepath $wsname " . ($useparams ? 'true' : ''));
|
||||
|
||||
if (strpos($structure, 'ERROR:') === 0) {
|
||||
echo "WS not found in version $version. Stop.\n";
|
||||
break;
|
||||
}
|
||||
|
||||
$structure = unserialize($structure);
|
||||
|
||||
if ($previousstructure != null) {
|
||||
echo "*** Check changes from version $version to $previousversion ***\n";
|
||||
|
||||
$messages = detect_ws_changes($previousstructure, $structure);
|
||||
|
||||
if (count($messages) > 0) {
|
||||
$haschanged = true;
|
||||
|
||||
foreach($messages as $message) {
|
||||
echo "$message\n";
|
||||
}
|
||||
} else {
|
||||
echo "No changes found.\n";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
$previousstructure = $structure;
|
||||
$previousversion = $version;
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Script for getting the PHP structure of a WS returns or params.
|
||||
*
|
||||
* The first parameter (required) is the path to the Moodle installation to use.
|
||||
* The second parameter (required) is the name to the WS to convert.
|
||||
* The third parameter (optional) is a number: 1 to convert the params structure,
|
||||
* 0 to convert the returns structure. Defaults to 0.
|
||||
*/
|
||||
|
||||
if (!isset($argv[1])) {
|
||||
echo "ERROR: Please pass the Moodle path as the first parameter.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
if (!isset($argv[2])) {
|
||||
echo "ERROR: Please pass the WS name as the second parameter.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
$moodlepath = $argv[1];
|
||||
$wsname = $argv[2];
|
||||
$useparams = !!(isset($argv[3]) && $argv[3]);
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require($moodlepath . '/config.php');
|
||||
require($CFG->dirroot . '/webservice/lib.php');
|
||||
require_once('ws_to_ts_functions.php');
|
||||
|
||||
$structure = get_ws_structure($wsname, $useparams);
|
||||
|
||||
if ($structure === false) {
|
||||
echo "ERROR: The WS wasn't found in this Moodle installation.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
remove_default_closures($structure);
|
||||
echo serialize($structure);
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Script for converting a PHP WS structure to a TS type.
|
||||
*
|
||||
* The first parameter (required) is the path to the Moodle installation to use.
|
||||
* The second parameter (required) is the name to the WS to convert.
|
||||
* The third parameter (optional) is the name to put to the TS type. Defaults to "TypeName".
|
||||
* The fourth parameter (optional) is a number: 1 to convert the params structure,
|
||||
* 0 to convert the returns structure. Defaults to 0.
|
||||
*/
|
||||
|
||||
if (!isset($argv[1])) {
|
||||
echo "ERROR: Please pass the Moodle path as the first parameter.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
if (!isset($argv[2])) {
|
||||
echo "ERROR: Please pass the WS name as the second parameter.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
$moodlepath = $argv[1];
|
||||
$wsname = $argv[2];
|
||||
$typename = isset($argv[3]) ? $argv[3] : 'TypeName';
|
||||
$useparams = !!(isset($argv[4]) && $argv[4]);
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require($moodlepath . '/config.php');
|
||||
require($CFG->dirroot . '/webservice/lib.php');
|
||||
require_once('ws_to_ts_functions.php');
|
||||
|
||||
$structure = get_ws_structure($wsname, $useparams);
|
||||
|
||||
if ($structure === false) {
|
||||
echo "ERROR: The WS wasn't found in this Moodle installation.\n";
|
||||
die();
|
||||
}
|
||||
|
||||
if ($useparams) {
|
||||
$description = "Params of WS $wsname.";
|
||||
} else {
|
||||
$description = "Result of WS $wsname.";
|
||||
}
|
||||
|
||||
echo get_ts_doc(null, $description, '') . "export type $typename = " . convert_to_ts(null, $structure, $useparams) . ";\n";
|
|
@ -58,6 +58,7 @@ function build_languages($languages, $keys, $added_langs = []) {
|
|||
}
|
||||
|
||||
function get_langindex_keys() {
|
||||
$local = 0;
|
||||
// Process the index file, just once.
|
||||
$keys = file_get_contents('langindex.json');
|
||||
$keys = (array) json_decode($keys);
|
||||
|
@ -67,6 +68,7 @@ function get_langindex_keys() {
|
|||
if ($value == 'local_moodlemobileapp') {
|
||||
$map->file = $value;
|
||||
$map->string = $key;
|
||||
$local++;
|
||||
} else {
|
||||
$exp = explode('/', $value, 2);
|
||||
$map->file = $exp[0];
|
||||
|
@ -87,7 +89,7 @@ function get_langindex_keys() {
|
|||
}
|
||||
|
||||
$total = count($keys);
|
||||
echo "Total strings to translate $total\n";
|
||||
echo "Total strings to translate $total ($local local)\n";
|
||||
|
||||
return $keys;
|
||||
}
|
||||
|
@ -232,6 +234,10 @@ function build_lang($lang, $keys) {
|
|||
// Prevent double.
|
||||
$text = str_replace(array('{{{', '}}}'), array('{{', '}}'), $text);
|
||||
} else {
|
||||
// @TODO: Remove that line when core.cannotconnect and core.login.invalidmoodleversion are completelly changed to use $a
|
||||
if (($key == 'core.cannotconnect' || $key == 'core.login.invalidmoodleversion') && strpos($text, '2.4') != false) {
|
||||
$text = str_replace('2.4', '{{$a}}', $text);
|
||||
}
|
||||
$local++;
|
||||
}
|
||||
|
||||
|
@ -244,7 +250,11 @@ function build_lang($lang, $keys) {
|
|||
|
||||
$success = count($translations);
|
||||
$percentage = floor($success/$total * 100);
|
||||
echo "\t\t$success of $total -> $percentage% ($local local)\n";
|
||||
$bar = progressbar($percentage);
|
||||
if (strlen($lang) <= 2 && !$parent) {
|
||||
echo "\t";
|
||||
}
|
||||
echo "\t\t$success of $total -> $percentage% $bar ($local local)\n";
|
||||
|
||||
if ($lang == 'en') {
|
||||
generate_local_moodlemobileapp($keys, $translations);
|
||||
|
@ -254,6 +264,11 @@ function build_lang($lang, $keys) {
|
|||
return true;
|
||||
}
|
||||
|
||||
function progressbar($percentage) {
|
||||
$done = $percentage/10;
|
||||
return "\t".str_repeat('=', $done) . str_repeat('-', 10-$done);
|
||||
}
|
||||
|
||||
function detect_lang($lang, $keys) {
|
||||
$langfoldername = get_langfolder($lang);
|
||||
if (!$langfoldername) {
|
||||
|
@ -271,12 +286,14 @@ function detect_lang($lang, $keys) {
|
|||
return false;
|
||||
}
|
||||
|
||||
echo "Checking $lang";
|
||||
$title = $lang;
|
||||
if ($parent != "" && $parent != $lang) {
|
||||
echo " ($parent)";
|
||||
$title .= " ($parent)";
|
||||
}
|
||||
$langname = $string['thislanguage'];
|
||||
echo " ".$langname." -D";
|
||||
$title .= " ".$langname." -D";
|
||||
|
||||
|
||||
|
||||
// Add the translation to the array.
|
||||
foreach ($keys as $key => $value) {
|
||||
|
@ -300,7 +317,10 @@ function detect_lang($lang, $keys) {
|
|||
}
|
||||
|
||||
$percentage = floor($success/$total * 100);
|
||||
echo "\t\t$success of $total -> $percentage% ($local local)";
|
||||
$bar = progressbar($percentage);
|
||||
|
||||
echo "Checking ".$title.str_repeat("\t", 7 - floor(mb_strlen($title, 'UTF-8')/8));
|
||||
echo "\t$success of $total -> $percentage% $bar ($local local)";
|
||||
if (($percentage > 75 && $local > 50) || ($percentage > 50 && $local > 75)) {
|
||||
echo " \t DETECTED\n";
|
||||
return true;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
"addon.block_glossaryrandom.pluginname": "block_glossary_random",
|
||||
"addon.block_learningplans.pluginname": "block_lp",
|
||||
"addon.block_myoverview.all": "block_myoverview",
|
||||
"addon.block_myoverview.allincludinghidden": "block_myoverview",
|
||||
"addon.block_myoverview.favourites": "block_myoverview",
|
||||
"addon.block_myoverview.future": "block_myoverview",
|
||||
"addon.block_myoverview.hiddencourses": "block_myoverview",
|
||||
|
@ -89,8 +90,10 @@
|
|||
"addon.calendar.calendarevent": "local_moodlemobileapp",
|
||||
"addon.calendar.calendarevents": "local_moodlemobileapp",
|
||||
"addon.calendar.calendarreminders": "local_moodlemobileapp",
|
||||
"addon.calendar.categoryevents": "calendar",
|
||||
"addon.calendar.confirmeventdelete": "calendar",
|
||||
"addon.calendar.confirmeventseriesdelete": "calendar",
|
||||
"addon.calendar.courseevents": "calendar",
|
||||
"addon.calendar.currentmonth": "local_moodlemobileapp",
|
||||
"addon.calendar.daynext": "calendar",
|
||||
"addon.calendar.dayprev": "calendar",
|
||||
|
@ -114,6 +117,7 @@
|
|||
"addon.calendar.fri": "calendar",
|
||||
"addon.calendar.friday": "calendar",
|
||||
"addon.calendar.gotoactivity": "calendar",
|
||||
"addon.calendar.groupevents": "calendar",
|
||||
"addon.calendar.invalidtimedurationminutes": "calendar",
|
||||
"addon.calendar.invalidtimedurationuntil": "calendar",
|
||||
"addon.calendar.mon": "calendar",
|
||||
|
@ -131,6 +135,7 @@
|
|||
"addon.calendar.sat": "calendar",
|
||||
"addon.calendar.saturday": "calendar",
|
||||
"addon.calendar.setnewreminder": "local_moodlemobileapp",
|
||||
"addon.calendar.siteevents": "calendar",
|
||||
"addon.calendar.sun": "calendar",
|
||||
"addon.calendar.sunday": "calendar",
|
||||
"addon.calendar.thu": "calendar",
|
||||
|
@ -149,6 +154,7 @@
|
|||
"addon.calendar.typesite": "calendar",
|
||||
"addon.calendar.typeuser": "calendar",
|
||||
"addon.calendar.upcomingevents": "calendar",
|
||||
"addon.calendar.userevents": "calendar",
|
||||
"addon.calendar.wed": "calendar",
|
||||
"addon.calendar.wednesday": "calendar",
|
||||
"addon.calendar.when": "calendar",
|
||||
|
@ -383,7 +389,6 @@
|
|||
"addon.mod_assign.numwords": "moodle",
|
||||
"addon.mod_assign.outof": "assign",
|
||||
"addon.mod_assign.overdue": "assign",
|
||||
"addon.mod_assign.savechanges": "assign",
|
||||
"addon.mod_assign.submission": "assign",
|
||||
"addon.mod_assign.submissioneditable": "assign",
|
||||
"addon.mod_assign.submissionnoteditable": "assign",
|
||||
|
@ -405,6 +410,7 @@
|
|||
"addon.mod_assign.timemodified": "assign",
|
||||
"addon.mod_assign.timeremaining": "assign",
|
||||
"addon.mod_assign.ungroupedusers": "assign",
|
||||
"addon.mod_assign.ungroupedusersoptional": "assign",
|
||||
"addon.mod_assign.unlimitedattempts": "assign",
|
||||
"addon.mod_assign.userswhoneedtosubmit": "assign",
|
||||
"addon.mod_assign.userwithid": "local_moodlemobileapp",
|
||||
|
@ -433,14 +439,17 @@
|
|||
"addon.mod_chat.errorwhilegettingchatusers": "local_moodlemobileapp",
|
||||
"addon.mod_chat.errorwhileretrievingmessages": "local_moodlemobileapp",
|
||||
"addon.mod_chat.errorwhilesendingmessage": "local_moodlemobileapp",
|
||||
"addon.mod_chat.messagebeepseveryone": "chat",
|
||||
"addon.mod_chat.messagebeepsyou": "chat",
|
||||
"addon.mod_chat.messageenter": "chat",
|
||||
"addon.mod_chat.messageexit": "chat",
|
||||
"addon.mod_chat.messages": "chat",
|
||||
"addon.mod_chat.messageyoubeep": "chat",
|
||||
"addon.mod_chat.modulenameplural": "chat",
|
||||
"addon.mod_chat.mustbeonlinetosendmessages": "local_moodlemobileapp",
|
||||
"addon.mod_chat.nomessages": "chat",
|
||||
"addon.mod_chat.nosessionsfound": "local_moodlemobileapp",
|
||||
"addon.mod_chat.saidto": "chat",
|
||||
"addon.mod_chat.send": "chat",
|
||||
"addon.mod_chat.sessionstart": "chat",
|
||||
"addon.mod_chat.showincompletesessions": "local_moodlemobileapp",
|
||||
|
@ -491,10 +500,13 @@
|
|||
"addon.mod_data.expired": "data",
|
||||
"addon.mod_data.fields": "data",
|
||||
"addon.mod_data.foundrecords": "data",
|
||||
"addon.mod_data.gettinglocation": "local_moodlemobileapp",
|
||||
"addon.mod_data.latlongboth": "data",
|
||||
"addon.mod_data.locationpermissiondenied": "local_moodlemobileapp",
|
||||
"addon.mod_data.menuchoose": "data",
|
||||
"addon.mod_data.modulenameplural": "data",
|
||||
"addon.mod_data.more": "data",
|
||||
"addon.mod_data.mylocation": "local_moodlemobileapp",
|
||||
"addon.mod_data.nomatch": "data",
|
||||
"addon.mod_data.norecords": "data",
|
||||
"addon.mod_data.notapproved": "data",
|
||||
|
@ -560,7 +572,11 @@
|
|||
"addon.mod_forum.cannotadddiscussionall": "forum",
|
||||
"addon.mod_forum.cannotcreatediscussion": "forum",
|
||||
"addon.mod_forum.couldnotadd": "forum",
|
||||
"addon.mod_forum.couldnotupdate": "forum",
|
||||
"addon.mod_forum.cutoffdatereached": "forum",
|
||||
"addon.mod_forum.delete": "forum",
|
||||
"addon.mod_forum.deletedpost": "forum",
|
||||
"addon.mod_forum.deletesure": "forum",
|
||||
"addon.mod_forum.discussion": "forum",
|
||||
"addon.mod_forum.discussionlistsortbycreatedasc": "forum",
|
||||
"addon.mod_forum.discussionlistsortbycreateddesc": "forum",
|
||||
|
@ -580,6 +596,7 @@
|
|||
"addon.mod_forum.favouriteupdated": "forum",
|
||||
"addon.mod_forum.forumnodiscussionsyet": "local_moodlemobileapp",
|
||||
"addon.mod_forum.group": "local_moodlemobileapp",
|
||||
"addon.mod_forum.lastpost": "forum",
|
||||
"addon.mod_forum.lockdiscussion": "forum",
|
||||
"addon.mod_forum.lockupdated": "forum",
|
||||
"addon.mod_forum.message": "forum",
|
||||
|
@ -609,6 +626,7 @@
|
|||
"addon.mod_forum.unpindiscussion": "forum",
|
||||
"addon.mod_forum.unread": "forum",
|
||||
"addon.mod_forum.unreadpostsnumber": "forum",
|
||||
"addon.mod_forum.yourreply": "forum",
|
||||
"addon.mod_glossary.addentry": "glossary",
|
||||
"addon.mod_glossary.aliases": "glossary",
|
||||
"addon.mod_glossary.attachment": "glossary",
|
||||
|
@ -863,6 +881,7 @@
|
|||
"addon.mod_scorm.organizations": "scorm",
|
||||
"addon.mod_scorm.passed": "scorm",
|
||||
"addon.mod_scorm.reviewmode": "scorm",
|
||||
"addon.mod_scorm.score": "scorm",
|
||||
"addon.mod_scorm.scormstatusnotdownloaded": "local_moodlemobileapp",
|
||||
"addon.mod_scorm.scormstatusoutdated": "local_moodlemobileapp",
|
||||
"addon.mod_scorm.suspended": "scorm",
|
||||
|
@ -1374,6 +1393,7 @@
|
|||
"core.course.confirmdeletemodulefiles": "local_moodlemobileapp",
|
||||
"core.course.confirmdownload": "local_moodlemobileapp",
|
||||
"core.course.confirmdownloadunknownsize": "local_moodlemobileapp",
|
||||
"core.course.confirmdownloadzerosize": "local_moodlemobileapp",
|
||||
"core.course.confirmlimiteddownload": "local_moodlemobileapp",
|
||||
"core.course.confirmpartialdownloadsize": "local_moodlemobileapp",
|
||||
"core.course.contents": "local_moodlemobileapp",
|
||||
|
@ -1512,6 +1532,7 @@
|
|||
"core.fileuploader.uploading": "local_moodlemobileapp",
|
||||
"core.fileuploader.uploadingperc": "local_moodlemobileapp",
|
||||
"core.fileuploader.video": "local_moodlemobileapp",
|
||||
"core.filter": "moodle",
|
||||
"core.folder": "moodle",
|
||||
"core.forcepasswordchangenotice": "moodle",
|
||||
"core.fulllistofcourses": "moodle",
|
||||
|
@ -1533,6 +1554,95 @@
|
|||
"core.group": "moodle",
|
||||
"core.groupsseparate": "moodle",
|
||||
"core.groupsvisible": "moodle",
|
||||
"core.h5p.additionallicenseinfo": "h5p",
|
||||
"core.h5p.author": "h5p",
|
||||
"core.h5p.authorcomments": "h5p",
|
||||
"core.h5p.authorcommentsdescription": "h5p",
|
||||
"core.h5p.authorname": "h5p",
|
||||
"core.h5p.authorrole": "h5p",
|
||||
"core.h5p.by": "h5p",
|
||||
"core.h5p.cancellabel": "h5p",
|
||||
"core.h5p.ccattribution": "h5p",
|
||||
"core.h5p.ccattributionnc": "h5p",
|
||||
"core.h5p.ccattributionncnd": "h5p",
|
||||
"core.h5p.ccattributionncsa": "h5p",
|
||||
"core.h5p.ccattributionnd": "h5p",
|
||||
"core.h5p.ccattributionsa": "h5p",
|
||||
"core.h5p.ccpdd": "h5p",
|
||||
"core.h5p.changedby": "h5p",
|
||||
"core.h5p.changedescription": "h5p",
|
||||
"core.h5p.changelog": "h5p",
|
||||
"core.h5p.changeplaceholder": "h5p",
|
||||
"core.h5p.close": "h5p",
|
||||
"core.h5p.confirmdialogbody": "h5p",
|
||||
"core.h5p.confirmdialogheader": "h5p",
|
||||
"core.h5p.confirmlabel": "h5p",
|
||||
"core.h5p.connectionLost": "h5p",
|
||||
"core.h5p.connectionReestablished": "h5p",
|
||||
"core.h5p.contentCopied": "h5p",
|
||||
"core.h5p.contentchanged": "h5p",
|
||||
"core.h5p.contenttype": "h5p",
|
||||
"core.h5p.copyright": "h5p",
|
||||
"core.h5p.copyrightinfo": "h5p",
|
||||
"core.h5p.copyrightstring": "h5p",
|
||||
"core.h5p.copyrighttitle": "h5p",
|
||||
"core.h5p.creativecommons": "h5p",
|
||||
"core.h5p.date": "h5p",
|
||||
"core.h5p.disablefullscreen": "h5p",
|
||||
"core.h5p.download": "h5p",
|
||||
"core.h5p.downloadtitle": "h5p",
|
||||
"core.h5p.editor": "h5p",
|
||||
"core.h5p.embed": "h5p",
|
||||
"core.h5p.embedtitle": "h5p",
|
||||
"core.h5p.fullscreen": "h5p",
|
||||
"core.h5p.gpl": "h5p",
|
||||
"core.h5p.h5ptitle": "h5p",
|
||||
"core.h5p.hideadvanced": "h5p",
|
||||
"core.h5p.license": "h5p",
|
||||
"core.h5p.licenseCC010": "h5p",
|
||||
"core.h5p.licenseCC010U": "h5p",
|
||||
"core.h5p.licenseCC10": "h5p",
|
||||
"core.h5p.licenseCC20": "h5p",
|
||||
"core.h5p.licenseCC25": "h5p",
|
||||
"core.h5p.licenseCC30": "h5p",
|
||||
"core.h5p.licenseCC40": "h5p",
|
||||
"core.h5p.licenseGPL": "h5p",
|
||||
"core.h5p.licenseV1": "h5p",
|
||||
"core.h5p.licenseV2": "h5p",
|
||||
"core.h5p.licenseV3": "h5p",
|
||||
"core.h5p.licensee": "h5p",
|
||||
"core.h5p.licenseextras": "h5p",
|
||||
"core.h5p.licenseversion": "h5p",
|
||||
"core.h5p.nocopyright": "h5p",
|
||||
"core.h5p.offlineDialogBody": "h5p",
|
||||
"core.h5p.offlineDialogHeader": "h5p",
|
||||
"core.h5p.offlineDialogRetryButtonLabel": "h5p",
|
||||
"core.h5p.offlineDialogRetryMessage": "h5p",
|
||||
"core.h5p.offlineSuccessfulSubmit": "h5p",
|
||||
"core.h5p.originator": "h5p",
|
||||
"core.h5p.pd": "h5p",
|
||||
"core.h5p.pddl": "h5p",
|
||||
"core.h5p.pdm": "h5p",
|
||||
"core.h5p.play": "local_moodlemobileapp",
|
||||
"core.h5p.resizescript": "h5p",
|
||||
"core.h5p.resubmitScores": "h5p",
|
||||
"core.h5p.reuse": "h5p",
|
||||
"core.h5p.reuseContent": "h5p",
|
||||
"core.h5p.reuseDescription": "h5p",
|
||||
"core.h5p.showadvanced": "h5p",
|
||||
"core.h5p.showless": "h5p",
|
||||
"core.h5p.showmore": "h5p",
|
||||
"core.h5p.size": "h5p",
|
||||
"core.h5p.source": "h5p",
|
||||
"core.h5p.startingover": "h5p",
|
||||
"core.h5p.sublevel": "h5p",
|
||||
"core.h5p.thumbnail": "h5p",
|
||||
"core.h5p.title": "h5p",
|
||||
"core.h5p.undisclosed": "h5p",
|
||||
"core.h5p.year": "h5p",
|
||||
"core.h5p.years": "h5p",
|
||||
"core.h5p.yearsfrom": "h5p",
|
||||
"core.h5p.yearsto": "h5p",
|
||||
"core.hasdatatosync": "local_moodlemobileapp",
|
||||
"core.help": "moodle",
|
||||
"core.hide": "moodle",
|
||||
|
@ -1558,6 +1668,12 @@
|
|||
"core.login.auth_email": "auth_email/pluginname",
|
||||
"core.login.authenticating": "local_moodlemobileapp",
|
||||
"core.login.cancel": "moodle",
|
||||
"core.login.changepassword": "moodle",
|
||||
"core.login.changepasswordbutton": "local_moodlemobileapp",
|
||||
"core.login.changepasswordhelp": "local_moodlemobileapp",
|
||||
"core.login.changepasswordinstructions": "local_moodlemobileapp",
|
||||
"core.login.changepasswordlogoutinstructions": "local_moodlemobileapp",
|
||||
"core.login.changepasswordreconnectinstructions": "local_moodlemobileapp",
|
||||
"core.login.checksiteversion": "local_moodlemobileapp",
|
||||
"core.login.confirmdeletesite": "local_moodlemobileapp",
|
||||
"core.login.connect": "local_moodlemobileapp",
|
||||
|
@ -1579,6 +1695,7 @@
|
|||
"core.login.errorupdatesite": "local_moodlemobileapp",
|
||||
"core.login.findyoursite": "local_moodlemobileapp",
|
||||
"core.login.firsttime": "moodle",
|
||||
"core.login.forcepasswordchangenotice": "moodle",
|
||||
"core.login.forgotten": "moodle",
|
||||
"core.login.getanothercaptcha": "auth",
|
||||
"core.login.help": "moodle",
|
||||
|
@ -1697,6 +1814,7 @@
|
|||
"core.nocomments": "moodle",
|
||||
"core.nograde": "moodle",
|
||||
"core.none": "moodle",
|
||||
"core.nooptionavailable": "local_moodlemobileapp",
|
||||
"core.nopasswordchangeforced": "local_moodlemobileapp",
|
||||
"core.nopermissionerror": "local_moodlemobileapp",
|
||||
"core.nopermissions": "error",
|
||||
|
@ -1757,6 +1875,7 @@
|
|||
"core.redirectingtosite": "local_moodlemobileapp",
|
||||
"core.refresh": "moodle",
|
||||
"core.remove": "moodle",
|
||||
"core.removefiles": "local_moodlemobileapp",
|
||||
"core.required": "moodle",
|
||||
"core.requireduserdatamissing": "local_moodlemobileapp",
|
||||
"core.resourcedisplayopen": "moodle",
|
||||
|
@ -1765,6 +1884,7 @@
|
|||
"core.restricted": "moodle",
|
||||
"core.retry": "local_moodlemobileapp",
|
||||
"core.save": "moodle",
|
||||
"core.savechanges": "assign",
|
||||
"core.search": "moodle",
|
||||
"core.searching": "local_moodlemobileapp",
|
||||
"core.searchresults": "moodle",
|
||||
|
@ -1781,6 +1901,10 @@
|
|||
"core.settings.appready": "local_moodlemobileapp",
|
||||
"core.settings.cannotsyncoffline": "local_moodlemobileapp",
|
||||
"core.settings.cannotsyncwithoutwifi": "local_moodlemobileapp",
|
||||
"core.settings.colorscheme": "local_moodlemobileapp",
|
||||
"core.settings.colorscheme-auto": "local_moodlemobileapp",
|
||||
"core.settings.colorscheme-dark": "local_moodlemobileapp",
|
||||
"core.settings.colorscheme-light": "local_moodlemobileapp",
|
||||
"core.settings.compilationinfo": "local_moodlemobileapp",
|
||||
"core.settings.cordovadevicemodel": "local_moodlemobileapp",
|
||||
"core.settings.cordovadeviceosversion": "local_moodlemobileapp",
|
||||
|
@ -1908,6 +2032,8 @@
|
|||
"core.unknown": "local_moodlemobileapp",
|
||||
"core.unlimited": "moodle",
|
||||
"core.unzipping": "local_moodlemobileapp",
|
||||
"core.updaterequired": "local_moodlemobileapp",
|
||||
"core.updaterequireddesc": "local_moodlemobileapp",
|
||||
"core.upgraderunning": "error",
|
||||
"core.user": "moodle",
|
||||
"core.user.address": "moodle",
|
||||
|
@ -1954,5 +2080,7 @@
|
|||
"core.wsfunctionnotavailable": "local_moodlemobileapp",
|
||||
"core.year": "moodle",
|
||||
"core.years": "moodle",
|
||||
"core.yes": "moodle"
|
||||
"core.yes": "moodle",
|
||||
"core.youreoffline": "local_moodlemobileapp",
|
||||
"core.youreonline": "local_moodlemobileapp"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const srcPath = path.join(__dirname, '..', 'src')
|
||||
|
||||
function findFiles(dirPath) {
|
||||
const result = []
|
||||
const entries = fs.readdirSync(dirPath, {withFileTypes: true})
|
||||
|
||||
entries.forEach((entry) => {
|
||||
const entryPath = path.join(dirPath, entry.name)
|
||||
if (entry.isFile() && entry.name.endsWith('.ts')) {
|
||||
result.push(entryPath)
|
||||
} else if (entry.isDirectory()) {
|
||||
result.push(...findFiles(entryPath))
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
findFiles(srcPath).forEach((file) => {
|
||||
let src = fs.readFileSync(file, 'utf-8')
|
||||
|
||||
// Fix wrong use of @type instead of @return.
|
||||
src = src.replace(/(\n +\* \@param [^\n]*\n +\* )\@type /g, (match, p1) => p1 + '@return ')
|
||||
|
||||
// Remove square brackets and default values from @param lines.
|
||||
src = src.replace(/(\n +\* @param +\{[^\n]+\} +)\[(\w+)[^\]\n]*\]/g, (match, p1, p2) => p1 + p2)
|
||||
|
||||
// Remove types from @param and @return lines.
|
||||
src = src.replace(/(\n +\* \@(?:param|returns?) *)([a-zA-Z0-9_]+ *)?(\{[^\n]*)/g, (match, p1, p2, p3) => {
|
||||
p2 = p2 || ''
|
||||
let brackets = 1;
|
||||
let end = 0;
|
||||
for (let i = 1; brackets > 0 && i < p3.length; i++) {
|
||||
if (p3[i] == '{') {
|
||||
brackets++
|
||||
} else if (p3[i] == '}') {
|
||||
brackets--
|
||||
end = i + 1
|
||||
}
|
||||
}
|
||||
p1 = p1.trimEnd().replace('@returns', '@return')
|
||||
p2 = p2.trim()
|
||||
p3 = p3.slice(end).trim().replace(/^([a-zA-Z0-9_]+) +/, '$1 ')
|
||||
if (!p2 && !p3) return ''
|
||||
return p1 + ' ' + p2 + (p2 && p3 ? ' ' + p3 : p3)
|
||||
})
|
||||
|
||||
// Remove @type lines.
|
||||
src = src.replace(/\n +\* \@type .*\n/g, '\n')
|
||||
|
||||
// Remove consecutive empty doc lines.
|
||||
src = src.replace(/\n *\* *(\n *\*\/? *\n)/g, (match, p1) => p1)
|
||||
|
||||
// Remove empty docs.
|
||||
src = src.replace(/\n *\/\*\*[ \n\*]+\*\/ *\n/g, '\n')
|
||||
|
||||
// Fix indentation.
|
||||
src = src.replace(/(\n +\* +(?:@param \w+|@return) )([^\n]*)((?:\n +\* +[^@\n][^\n]+)+)/g, (match, p1, p2, p3) => {
|
||||
const indent = p1.length
|
||||
p3 = p3.replace(/(\n +\*)( +)([^\n]+)/g, (match, p1, p2, p3) => {
|
||||
p2 = new Array(Math.max(0, indent - p1.length + 1)).join(' ')
|
||||
return p1 + p2 + p3
|
||||
})
|
||||
return p1 + p2 + p3
|
||||
})
|
||||
|
||||
fs.writeFileSync(file, src)
|
||||
})
|
|
@ -0,0 +1,244 @@
|
|||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Helper functions for converting a Moodle WS structure to a TS type.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the structure of a WS params or returns.
|
||||
*/
|
||||
function get_ws_structure($wsname, $useparams) {
|
||||
global $DB;
|
||||
|
||||
// get all the function descriptions
|
||||
$functions = $DB->get_records('external_functions', array(), 'name');
|
||||
$functiondescs = array();
|
||||
foreach ($functions as $function) {
|
||||
$functiondescs[$function->name] = external_api::external_function_info($function);
|
||||
}
|
||||
|
||||
if (!isset($functiondescs[$wsname])) {
|
||||
return false;
|
||||
} else if ($useparams) {
|
||||
return $functiondescs[$wsname]->parameters_desc;
|
||||
} else {
|
||||
return $functiondescs[$wsname]->returns_desc;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix a comment: make sure first letter is uppercase and add a dot at the end if needed.
|
||||
*/
|
||||
function fix_comment($desc) {
|
||||
$desc = trim($desc);
|
||||
$desc = ucfirst($desc);
|
||||
|
||||
if (substr($desc, -1) !== '.') {
|
||||
$desc .= '.';
|
||||
}
|
||||
|
||||
return $desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an inline comment based on a certain text.
|
||||
*/
|
||||
function get_inline_comment($desc) {
|
||||
if (empty($desc)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return ' // ' . fix_comment($desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the TS documentation of a certain element.
|
||||
*/
|
||||
function get_ts_doc($type, $desc, $indentation) {
|
||||
if (empty($desc)) {
|
||||
// If no key, it's probably in an array. We only document object properties.
|
||||
return '';
|
||||
}
|
||||
|
||||
return $indentation . "/**\n" .
|
||||
$indentation . " * " . fix_comment($desc) . "\n" .
|
||||
(!empty($type) ? ($indentation . " * @type {" . $type . "}\n") : '') .
|
||||
$indentation . " */\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a certain type, with or without a key.
|
||||
*/
|
||||
function convert_key_type($key, $type, $required, $indentation) {
|
||||
if ($key) {
|
||||
// It has a key, it's inside an object.
|
||||
return $indentation . "$key" . ($required == VALUE_OPTIONAL ? '?' : '') . ": $type";
|
||||
} else {
|
||||
// No key, it's probably in an array. Just include the type.
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a certain element into a TS structure.
|
||||
*/
|
||||
function convert_to_ts($key, $value, $boolisnumber = false, $indentation = '', $arraydesc = '') {
|
||||
if ($value instanceof external_value || $value instanceof external_warnings || $value instanceof external_files) {
|
||||
// It's a basic field or a pre-defined type like warnings.
|
||||
$type = 'string';
|
||||
|
||||
if ($value instanceof external_warnings) {
|
||||
$type = 'CoreWSExternalWarning[]';
|
||||
} else if ($value instanceof external_files) {
|
||||
$type = 'CoreWSExternalFile[]';
|
||||
} else if ($value->type == PARAM_BOOL && !$boolisnumber) {
|
||||
$type = 'boolean';
|
||||
} else if (($value->type == PARAM_BOOL && $boolisnumber) || $value->type == PARAM_INT || $value->type == PARAM_FLOAT ||
|
||||
$value->type == PARAM_LOCALISEDFLOAT || $value->type == PARAM_PERMISSION || $value->type == PARAM_INTEGER ||
|
||||
$value->type == PARAM_NUMBER) {
|
||||
$type = 'number';
|
||||
}
|
||||
|
||||
$result = convert_key_type($key, $type, $value->required, $indentation);
|
||||
|
||||
return $result;
|
||||
|
||||
} else if ($value instanceof external_single_structure) {
|
||||
// It's an object.
|
||||
$result = convert_key_type($key, '{', $value->required, $indentation);
|
||||
|
||||
if ($arraydesc) {
|
||||
// It's an array of objects. Print the array description now.
|
||||
$result .= get_inline_comment($arraydesc);
|
||||
}
|
||||
|
||||
$result .= "\n";
|
||||
|
||||
foreach ($value->keys as $key => $value) {
|
||||
$result .= convert_to_ts($key, $value, $boolisnumber, $indentation . ' ') . ';';
|
||||
|
||||
if (!$value instanceof external_multiple_structure || !$value->content instanceof external_single_structure) {
|
||||
// Add inline comments after the field, except for arrays of objects where it's added at the start.
|
||||
$result .= get_inline_comment($value->desc);
|
||||
}
|
||||
|
||||
$result .= "\n";
|
||||
}
|
||||
|
||||
$result .= "$indentation}";
|
||||
|
||||
return $result;
|
||||
|
||||
} else if ($value instanceof external_multiple_structure) {
|
||||
// It's an array.
|
||||
$result = convert_key_type($key, '', $value->required, $indentation);
|
||||
|
||||
$result .= convert_to_ts(null, $value->content, $boolisnumber, $indentation, $value->desc);
|
||||
|
||||
$result .= "[]";
|
||||
|
||||
return $result;
|
||||
} else {
|
||||
echo "WARNING: Unknown structure: $key " . get_class($value) . " \n";
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Concatenate two paths.
|
||||
*/
|
||||
function concatenate_paths($left, $right, $separator = '/') {
|
||||
if (!is_string($left) || $left == '') {
|
||||
return $right;
|
||||
} else if (!is_string($right) || $right == '') {
|
||||
return $left;
|
||||
}
|
||||
|
||||
$lastCharLeft = substr($left, -1);
|
||||
$firstCharRight = $right[0];
|
||||
|
||||
if ($lastCharLeft === $separator && $firstCharRight === $separator) {
|
||||
return $left . substr($right, 1);
|
||||
} else if ($lastCharLeft !== $separator && $firstCharRight !== '/') {
|
||||
return $left . '/' . $right;
|
||||
} else {
|
||||
return $left . $right;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect changes between 2 WS structures. We only detect fields that have been added or modified, not removed fields.
|
||||
*/
|
||||
function detect_ws_changes($new, $old, $key = '', $path = '') {
|
||||
$messages = [];
|
||||
|
||||
if (gettype($new) != gettype($old)) {
|
||||
// The type has changed.
|
||||
$messages[] = "Property '$key' has changed type, from '" . gettype($old) . "' to '" . gettype($new) .
|
||||
($path != '' ? "' inside $path." : "'.");
|
||||
|
||||
} else if ($new instanceof external_value && $new->type != $old->type) {
|
||||
// The type has changed.
|
||||
$messages[] = "Property '$key' has changed type, from '" . $old->type . "' to '" . $new->type .
|
||||
($path != '' ? "' inside $path." : "'.");
|
||||
|
||||
} else if ($new instanceof external_warnings || $new instanceof external_files) {
|
||||
// Ignore these types.
|
||||
|
||||
} else if ($new instanceof external_single_structure) {
|
||||
// Check each subproperty.
|
||||
$newpath = ($path != '' ? "$path." : '') . $key;
|
||||
|
||||
foreach ($new->keys as $subkey => $value) {
|
||||
if (!isset($old->keys[$subkey])) {
|
||||
// New property.
|
||||
$messages[] = "New property '$subkey' found" . ($newpath != '' ? " inside '$newpath'." : '.');
|
||||
} else {
|
||||
$messages = array_merge($messages, detect_ws_changes($value, $old->keys[$subkey], $subkey, $newpath));
|
||||
}
|
||||
}
|
||||
} else if ($new instanceof external_multiple_structure) {
|
||||
// Recursive call with the content.
|
||||
$messages = array_merge($messages, detect_ws_changes($new->content, $old->content, $key, $path));
|
||||
}
|
||||
|
||||
return $messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all closures (anonymous functions) in the default values so the object can be serialized.
|
||||
*/
|
||||
function remove_default_closures($value) {
|
||||
if ($value instanceof external_warnings || $value instanceof external_files) {
|
||||
// Ignore these types.
|
||||
|
||||
} else if ($value instanceof external_value) {
|
||||
if ($value->default instanceof Closure) {
|
||||
$value->default = null;
|
||||
}
|
||||
|
||||
} else if ($value instanceof external_single_structure) {
|
||||
|
||||
foreach ($value->keys as $key => $subvalue) {
|
||||
remove_default_closures($subvalue);
|
||||
}
|
||||
|
||||
} else if ($value instanceof external_multiple_structure) {
|
||||
remove_default_closures($value->content);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// (C) Copyright 2015 Martin Dougiamas
|
||||
// (C) Copyright 2015 Moodle Pty Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<ion-header>
|
||||
<ion-navbar core-back-button>
|
||||
<ion-title>{{badge.name}}</ion-title>
|
||||
<ion-title>{{badge && badge.name}}</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
<ion-content>
|
||||
|
@ -9,7 +9,7 @@
|
|||
</ion-refresher>
|
||||
<core-loading [hideUntil]="badgeLoaded">
|
||||
|
||||
<ion-item-group>
|
||||
<ion-item-group *ngIf="badge">
|
||||
<ion-item text-wrap class="item-avatar-center">
|
||||
<img *ngIf="badge.badgeurl" class="avatar" [src]="badge.badgeurl" core-external-content [alt]="badge.name">
|
||||
<ion-badge color="danger" *ngIf="badge.dateexpire && currentTime >= badge.dateexpire">
|
||||
|
@ -24,31 +24,27 @@
|
|||
</ion-item-divider>
|
||||
<ion-item text-wrap>
|
||||
<h2>{{ 'core.name' | translate}}</h2>
|
||||
<p>
|
||||
<core-format-text clean="true" [text]="user.fullname"></core-format-text>
|
||||
</p>
|
||||
<p>{{ user.fullname }}</p>
|
||||
</ion-item>
|
||||
</ion-item-group>
|
||||
|
||||
<ion-item-group>
|
||||
<ion-item-group *ngIf="badge">
|
||||
<ion-item-divider>
|
||||
<h2>{{ 'addon.badges.issuerdetails' | translate}}</h2>
|
||||
</ion-item-divider>
|
||||
<ion-item text-wrap *ngIf="badge.issuername">
|
||||
<h2>{{ 'addon.badges.issuername' | translate}}</h2>
|
||||
<p>
|
||||
<core-format-text clean="true" [text]="badge.issuername"></core-format-text>
|
||||
</p>
|
||||
<p>{{ badge.issuername }}</p>
|
||||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="badge.issuercontact">
|
||||
<h2>{{ 'addon.badges.contact' | translate}}</h2>
|
||||
<p><a href="mailto:{{badge.issuercontact}}" core-link auto-login="no">
|
||||
<core-format-text [text]="badge.issuercontact"></core-format-text>
|
||||
{{ badge.issuercontact }}
|
||||
</a></p>
|
||||
</ion-item>
|
||||
</ion-item-group>
|
||||
|
||||
<ion-item-group>
|
||||
<ion-item-group *ngIf="badge">
|
||||
<ion-item-divider>
|
||||
<h2>{{ 'addon.badges.badgedetails' | translate}}</h2>
|
||||
</ion-item-divider>
|
||||
|
@ -66,9 +62,7 @@
|
|||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="badge.description">
|
||||
<h2>{{ 'core.description' | translate}}</h2>
|
||||
<p>
|
||||
<core-format-text clean="true" [text]="badge.description"></core-format-text>
|
||||
</p>
|
||||
<p>{{ badge.description }}</p>
|
||||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="badge.imageauthorname">
|
||||
<h2>{{ 'addon.badges.imageauthorname' | translate}}</h2>
|
||||
|
@ -77,29 +71,29 @@
|
|||
<ion-item text-wrap *ngIf="badge.imageauthoremail">
|
||||
<h2>{{ 'addon.badges.imageauthoremail' | translate}}</h2>
|
||||
<p><a href="mailto:{{badge.imageauthoremail}}" core-link auto-login="no">
|
||||
<core-format-text [text]="badge.imageauthoremail"></core-format-text>
|
||||
{{ badge.imageauthoremail }}
|
||||
</a></p>
|
||||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="badge.imageauthorurl">
|
||||
<h2>{{ 'addon.badges.imageauthorurl' | translate}}</h2>
|
||||
<p><a [href]="badge.imageauthorurl" core-link auto-login="no">
|
||||
<core-format-text [text]="badge.imageauthorurl"></core-format-text>
|
||||
{{ badge.imageauthorurl }}
|
||||
</a></p>
|
||||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="badge.imagecaption">
|
||||
<h2>{{ 'addon.badges.imagecaption' | translate}}</h2>
|
||||
<p><core-format-text [text]="badge.imagecaption"></core-format-text></p>
|
||||
<p>{{ badge.imagecaption }}</p>
|
||||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="course.fullname">
|
||||
<h2>{{ 'core.course' | translate}}</h2>
|
||||
<p>
|
||||
<core-format-text [text]="course.fullname"></core-format-text>
|
||||
<core-format-text [text]="course.fullname" contextLevel="course" [contextInstanceId]="courseId"></core-format-text>
|
||||
</p>
|
||||
</ion-item>
|
||||
<!-- Criteria (not yet avalaible) -->
|
||||
</ion-item-group>
|
||||
|
||||
<ion-item-group>
|
||||
<ion-item-group *ngIf="badge">
|
||||
<ion-item-divider>
|
||||
<h2>{{ 'addon.badges.issuancedetails' | translate}}</h2>
|
||||
</ion-item-divider>
|
||||
|
@ -120,7 +114,7 @@
|
|||
</ion-item-group>
|
||||
|
||||
<!-- Endorsement -->
|
||||
<ion-item-group *ngIf="badge.endorsement">
|
||||
<ion-item-group *ngIf="badge && badge.endorsement">
|
||||
<ion-item-divider>
|
||||
<h2>{{ 'addon.badges.bendorsement' | translate}}</h2>
|
||||
</ion-item-divider>
|
||||
|
@ -131,13 +125,13 @@
|
|||
<ion-item text-wrap *ngIf="badge.endorsement.issueremail">
|
||||
<h2>{{ 'addon.badges.issueremail' | translate}}</h2>
|
||||
<p><a href="mailto:{{badge.endorsement.issueremail}}" core-link auto-login="no">
|
||||
<core-format-text [text]="badge.endorsement.issueremail"></core-format-text>
|
||||
{{ badge.endorsement.issueremail }}
|
||||
</a></p>
|
||||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="badge.endorsement.issuerurl">
|
||||
<h2>{{ 'addon.badges.issuerurl' | translate}}</h2>
|
||||
<p><a [href]="badge.endorsement.issuerurl" core-link auto-login="no">
|
||||
<core-format-text [text]="badge.endorsement.issuerurl"></core-format-text>
|
||||
{{ badge.endorsement.issuerurl }}
|
||||
</a></p>
|
||||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="badge.endorsement.dateissued">
|
||||
|
@ -147,24 +141,22 @@
|
|||
<ion-item text-wrap *ngIf="badge.endorsement.claimid">
|
||||
<h2>{{ 'addon.badges.claimid' | translate}}</h2>
|
||||
<p><a [href]="badge.endorsement.claimid" core-link auto-login="no">
|
||||
<core-format-text [text]="badge.endorsement.claimid"></core-format-text>
|
||||
{{ badge.endorsement.claimid }}
|
||||
</a></p>
|
||||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="badge.endorsement.claimcomment">
|
||||
<h2>{{ 'addon.badges.claimcomment' | translate}}</h2>
|
||||
<p>
|
||||
<core-format-text [text]="badge.endorsement.claimcomment"></core-format-text>
|
||||
</p>
|
||||
<p>{{ badge.endorsement.claimcomment }}</p>
|
||||
</ion-item>
|
||||
</ion-item-group>
|
||||
|
||||
<!-- Related badges -->
|
||||
<ion-item-group *ngIf="badge.relatedbadges">
|
||||
<ion-item-group *ngIf="badge && badge.relatedbadges">
|
||||
<ion-item-divider>
|
||||
<h2>{{ 'addon.badges.relatedbages' | translate}}</h2>
|
||||
</ion-item-divider>
|
||||
<ion-item text-wrap *ngFor="let relatedBadge of badge.relatedbadges">
|
||||
<h2><core-format-text [text]="relatedBadge.name"></core-format-text></h2>
|
||||
<h2>{{ relatedBadge.name }}</h2>
|
||||
</ion-item>
|
||||
<ion-item text-wrap *ngIf="badge.relatedbadges.length == 0">
|
||||
<h2>{{ 'addon.badges.norelated' | translate}}</h2>
|
||||
|
@ -172,14 +164,14 @@
|
|||
</ion-item-group>
|
||||
|
||||
<!-- Competencies alignment -->
|
||||
<ion-item-group *ngIf="badge.competencies">
|
||||
<ion-item-group *ngIf="badge && badge.alignment">
|
||||
<ion-item-divider>
|
||||
<h2>{{ 'addon.badges.alignment' | translate}}</h2>
|
||||
</ion-item-divider>
|
||||
<a ion-item text-wrap *ngFor="let competency of badge.competencies" [href]="competency.targeturl" core-link auto-login="no">
|
||||
<h2><core-format-text [text]="competency.targetname"></core-format-text></h2>
|
||||
<a ion-item text-wrap *ngFor="let alignment of badge.alignment" [href]="alignment.targeturl" core-link auto-login="no">
|
||||
<h2>{{ alignment.targetname }}</h2>
|
||||
</a>
|
||||
<ion-item text-wrap *ngIf="badge.competencies.length == 0">
|
||||
<ion-item text-wrap *ngIf="badge.alignment.length == 0">
|
||||
<h2>{{ 'addon.badges.noalignment' | translate}}</h2>
|
||||
</ion-item>
|
||||
</ion-item-group>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// (C) Copyright 2015 Martin Dougiamas
|
||||
// (C) Copyright 2015 Moodle Pty Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// (C) Copyright 2015 Martin Dougiamas
|
||||
// (C) Copyright 2015 Moodle Pty Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -19,7 +19,7 @@ import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
|||
import { CoreSitesProvider } from '@providers/sites';
|
||||
import { CoreUserProvider } from '@core/user/providers/user';
|
||||
import { CoreCoursesProvider } from '@core/courses/providers/courses';
|
||||
import { AddonBadgesProvider } from '../../providers/badges';
|
||||
import { AddonBadgesProvider, AddonBadgesUserBadge } from '../../providers/badges';
|
||||
|
||||
/**
|
||||
* Page that displays the list of calendar events.
|
||||
|
@ -38,7 +38,7 @@ export class AddonBadgesIssuedBadgePage {
|
|||
|
||||
user: any = {};
|
||||
course: any = {};
|
||||
badge: any = {};
|
||||
badge: AddonBadgesUserBadge;
|
||||
|
||||
badgeLoaded = false;
|
||||
currentTime = 0;
|
||||
|
@ -65,7 +65,7 @@ export class AddonBadgesIssuedBadgePage {
|
|||
/**
|
||||
* Fetch the issued badge required for the view.
|
||||
*
|
||||
* @return {Promise<any>} Promise resolved when done.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
fetchIssuedBadge(): Promise<any> {
|
||||
const promises = [];
|
||||
|
@ -101,7 +101,7 @@ export class AddonBadgesIssuedBadgePage {
|
|||
/**
|
||||
* Refresh the badges.
|
||||
*
|
||||
* @param {any} refresher Refresher.
|
||||
* @param refresher Refresher.
|
||||
*/
|
||||
refreshBadges(refresher: any): void {
|
||||
this.badgesProvider.invalidateUserBadges(this.courseId, this.userId).finally(() => {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<ion-avatar item-start>
|
||||
<img [src]="badge.badgeurl" [alt]="badge.name" item-start core-external-content>
|
||||
</ion-avatar>
|
||||
<h2><core-format-text [text]="badge.name"></core-format-text></h2>
|
||||
<h2>{{ badge.name }}</h2>
|
||||
<p>{{ badge.dateissued * 1000 | coreFormatDate :'strftimedatetimeshort' }}</p>
|
||||
<ion-badge item-end color="danger" *ngIf="badge.dateexpire && currentTime >= badge.dateexpire">
|
||||
{{ 'addon.badges.expired' | translate }}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// (C) Copyright 2015 Martin Dougiamas
|
||||
// (C) Copyright 2015 Moodle Pty Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
|