From 36a070d98f98d17155609c36b0cad139fe6b0a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 11 Dec 2019 13:26:57 +0100 Subject: [PATCH 1/8] MOBILE-3213 tabs: Add border on side placement --- src/components/ion-tabs/ion-tabs.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/ion-tabs/ion-tabs.scss b/src/components/ion-tabs/ion-tabs.scss index ec2e85b66..5088c5969 100644 --- a/src/components/ion-tabs/ion-tabs.scss +++ b/src/components/ion-tabs/ion-tabs.scss @@ -35,6 +35,7 @@ ion-app.app-root core-ion-tabs { width: $core-sidetab-size; height: 100%; flex-direction: column; + @include border-end(0.55px, solid, rgba(0, 0, 0, 0.3)); .tab-button { width: 100%; .tab-badge.badge { From 07b32226bdfde46c886b682368cd845180b10c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 11 Dec 2019 15:46:05 +0100 Subject: [PATCH 2/8] MOBILE-3213 resource: Fix resource icon set --- src/addon/mod/resource/providers/module-handler.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/addon/mod/resource/providers/module-handler.ts b/src/addon/mod/resource/providers/module-handler.ts index 5b0d8686e..735bcae53 100644 --- a/src/addon/mod/resource/providers/module-handler.ts +++ b/src/addon/mod/resource/providers/module-handler.ts @@ -222,12 +222,11 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler { } } - if (resourceData.icon == '') { - resourceData.icon = this.courseProvider.getModuleIconSrc(this.modName, module.modicon); - } resourceData.extra += extra.join(' '); - } else { - // No files, just set the icon. + } + + // No previously set, just set the icon. + if (resourceData.icon == '') { resourceData.icon = this.courseProvider.getModuleIconSrc(this.modName, module.modicon); } From 4727194f5446a2f3749ffbcd493131b33e8b77ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 12 Dec 2019 13:19:47 +0100 Subject: [PATCH 3/8] MOBILE-3213 scripts: Detect wrong 2.4 version on langs --- scripts/lang_functions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/lang_functions.php b/scripts/lang_functions.php index af1e2ab3b..0fa57b1f4 100644 --- a/scripts/lang_functions.php +++ b/scripts/lang_functions.php @@ -232,6 +232,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++; } From 9e9b4bcbbe9b5cdea8e25ffdb056f5563a0e4d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 12 Dec 2019 13:20:03 +0100 Subject: [PATCH 4/8] MOBILE-3213 strings: Have a better CLI interface --- scripts/lang_functions.php | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/scripts/lang_functions.php b/scripts/lang_functions.php index 0fa57b1f4..7765841ca 100644 --- a/scripts/lang_functions.php +++ b/scripts/lang_functions.php @@ -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; } @@ -248,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); @@ -258,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) { @@ -275,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) { @@ -304,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; From b74381c62687ea9ee19d8e116fcd32b8334becda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 12 Dec 2019 16:40:47 +0100 Subject: [PATCH 5/8] MOBILE-3213 folder: Fix opening subfolders --- src/addon/mod/folder/components/index/index.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/addon/mod/folder/components/index/index.ts b/src/addon/mod/folder/components/index/index.ts index ae0bcfae0..573b4dfb6 100644 --- a/src/addon/mod/folder/components/index/index.ts +++ b/src/addon/mod/folder/components/index/index.ts @@ -34,7 +34,6 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo component = AddonModFolderProvider.COMPONENT; canGetFolder: boolean; contents: any; - moduleContents: any; constructor(injector: Injector, private folderProvider: AddonModFolderProvider, private courseProvider: CoreCourseProvider, private appProvider: CoreAppProvider, private folderHelper: AddonModFolderHelperProvider) { @@ -51,7 +50,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo if (this.path) { // Subfolder. Use module param. - this.showModuleData(this.module); + this.showModuleData(this.module, this.module.contents); this.loaded = true; this.refreshIcon = 'refresh'; } else { @@ -81,16 +80,16 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo * Convenience function to set scope data using module. * @param module Module to show. */ - protected showModuleData(module: any): void { + protected showModuleData(module: any, folderContents: any): void { this.description = module.intro || module.description; this.dataRetrieved.emit(module); if (this.path) { // Subfolder. - this.contents = this.moduleContents; + this.contents = folderContents; } else { - this.contents = this.folderHelper.formatContents(this.moduleContents); + this.contents = this.folderHelper.formatContents(folderContents); } } @@ -101,12 +100,13 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { - let promise; + let promise, + folderContents = this.module.contents; if (this.canGetFolder) { promise = this.folderProvider.getFolder(this.courseId, this.module.id).then((folder) => { return this.courseProvider.loadModuleContents(this.module, this.courseId).then(() => { - this.moduleContents = this.module.contents; + folderContents = this.module.contents; return folder; }); @@ -118,14 +118,14 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo folder.contents = this.module.contents; } this.module = folder; - this.moduleContents = folder.contents; + folderContents = folder.contents; return folder; }); } return promise.then((folder) => { - this.showModuleData(folder); + this.showModuleData(folder, folderContents); }).finally(() => { this.fillContextMenu(refresh); }); From 34b6ab1fe1dbe1ceb88333e3309d83dfa8018cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 12 Dec 2019 17:06:37 +0100 Subject: [PATCH 6/8] MOBILE-3213 workshop: Dimme submit task when not possible --- .../components/index/addon-mod-workshop-index.html | 6 +++--- src/addon/mod/workshop/components/index/index.ts | 8 +++++++- src/addon/mod/workshop/pages/phase/phase.html | 2 +- src/addon/mod/workshop/pages/phase/phase.ts | 2 ++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/addon/mod/workshop/components/index/addon-mod-workshop-index.html b/src/addon/mod/workshop/components/index/addon-mod-workshop-index.html index 7d398d32c..3ce7e2c32 100644 --- a/src/addon/mod/workshop/components/index/addon-mod-workshop-index.html +++ b/src/addon/mod/workshop/components/index/addon-mod-workshop-index.html @@ -18,14 +18,14 @@

{{ phases[workshop.phase].title }}

- +

{{task.title}}

-

{{ task.details }}

+

@@ -94,7 +94,7 @@ - +