From 7fcde3b9b8fd8d14be094aed02d40845df602a95 Mon Sep 17 00:00:00 2001 From: Mickael Desgranges Date: Fri, 3 Jul 2015 16:13:40 +0200 Subject: [PATCH 01/13] add a path for overriding templates add the possibility to override all templates by adding a new one with the same relative paths and name in /main/template/overrides/ directory This is useful when you want customize a view and keep all change at the next upgrade (without putting your shoes in the bathtub) --- main/inc/lib/template.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 1ae2028182..7726a33b05 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -66,7 +66,7 @@ class Template $this->load_plugins = $load_plugins; $template_paths = array( - api_get_path(SYS_PATH) . 'custompages', // custom pages folder + api_get_path(SYS_PATH) . 'overrides', // user defined templates api_get_path(SYS_CODE_PATH).'template', //template folder api_get_path(SYS_PLUGIN_PATH) //plugin folder ); From d70a0c286e63cae3cca19ed871d3d014ff01d025 Mon Sep 17 00:00:00 2001 From: Mickael Desgranges Date: Fri, 3 Jul 2015 16:19:52 +0200 Subject: [PATCH 02/13] Create README.md --- main/template/overrides/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 main/template/overrides/README.md diff --git a/main/template/overrides/README.md b/main/template/overrides/README.md new file mode 100644 index 0000000000..4ac456a23d --- /dev/null +++ b/main/template/overrides/README.md @@ -0,0 +1,9 @@ +This directory is the right place for override an existing template. + +Just copy the orginal template with the same relative path. +ex: +``` +default/layout/head.tpl + +the_plugin_dirnae_name/path/of/template/in/plugins.tpl +``` From 36b8de9bcd018a612303a88b0d2183ef2dbb7a31 Mon Sep 17 00:00:00 2001 From: Mickael Desgranges Date: Fri, 3 Jul 2015 16:20:29 +0200 Subject: [PATCH 03/13] Update README.md --- main/template/overrides/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/template/overrides/README.md b/main/template/overrides/README.md index 4ac456a23d..a19e93edeb 100644 --- a/main/template/overrides/README.md +++ b/main/template/overrides/README.md @@ -1,6 +1,6 @@ This directory is the right place for override an existing template. -Just copy the orginal template with the same relative path. +Just copy the orignal template with the same relative path. ex: ``` default/layout/head.tpl From aa115cc7ccaea9924c8cc083180b7d4c20ecdffc Mon Sep 17 00:00:00 2001 From: Mickael Desgranges Date: Fri, 3 Jul 2015 16:33:11 +0200 Subject: [PATCH 04/13] Update template.lib.php --- main/inc/lib/template.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 7726a33b05..f3f93be5ab 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -66,7 +66,7 @@ class Template $this->load_plugins = $load_plugins; $template_paths = array( - api_get_path(SYS_PATH) . 'overrides', // user defined templates + api_get_path(SYS_CODE_PATH) . 'overrides', // user defined templates api_get_path(SYS_CODE_PATH).'template', //template folder api_get_path(SYS_PLUGIN_PATH) //plugin folder ); From 1923857b7473cdb231ebf8f37034edbb653e0ca3 Mon Sep 17 00:00:00 2001 From: Mickael Desgranges Date: Fri, 3 Jul 2015 16:51:40 +0200 Subject: [PATCH 05/13] Update template.lib.php --- main/inc/lib/template.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index f3f93be5ab..395cc95186 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -66,7 +66,7 @@ class Template $this->load_plugins = $load_plugins; $template_paths = array( - api_get_path(SYS_CODE_PATH) . 'overrides', // user defined templates + api_get_path(SYS_CODE_PATH) . 'template/overrides', // user defined templates api_get_path(SYS_CODE_PATH).'template', //template folder api_get_path(SYS_PLUGIN_PATH) //plugin folder ); From 226e5874c8af6165ada4d4c2f297cfd9d3ad62ff Mon Sep 17 00:00:00 2001 From: Nicolas Ducoulombier Date: Fri, 3 Jul 2015 12:19:24 -0500 Subject: [PATCH 06/13] Fixing getShortSessionListAndExtraByCategory to return all the extrafields needed - refs BT9907 --- main/inc/lib/sessionmanager.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php index f23b9fbf60..3d44c2e5b2 100755 --- a/main/inc/lib/sessionmanager.lib.php +++ b/main/inc/lib/sessionmanager.lib.php @@ -5750,12 +5750,13 @@ class SessionManager } // Get session field values $extra = new ExtraFieldValue('session'); - $sessionFieldValueList = $extra->get_all(array('field_id IN ( ' . $questionMarks . ' )' => array_keys($fields))); + $questionMarksFields = substr(str_repeat('?, ', count($fields)), 0, -2); + $sessionFieldValueList = $extra->get_all(array ('where' => array('field_id IN ( ' . $questionMarksFields . ' )' => array_keys($fields)))); // Add session fields values to session list foreach ($sessionList as $id => &$session) { foreach ($sessionFieldValueList as $sessionFieldValue) { // Match session field values to session - if ($sessionFieldValue['session_id'] == $id) { + if ($sessionFieldValue['item_id'] == $id) { // Check if session field value is set in session field list if (isset($fields[$sessionFieldValue['field_id']])) { // Avoid overwriting the session's ID field From ffcb70eb77a6cb84e8061e432b6b0df51a2088d0 Mon Sep 17 00:00:00 2001 From: aragonc Date: Fri, 3 Jul 2015 14:13:11 -0500 Subject: [PATCH 07/13] fix label user inscription course catalog BT#9901 #TMI --- app/Resources/public/css/base.css | 4 ++++ main/auth/courses_controller.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index 7628204d76..1bd6211c4c 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -6110,6 +6110,10 @@ div#chat-remote-video video { #session-list .information-item{ padding: 10px; } +#session-list .information-item .options .info-catalog{ + font-size: 14px; + color: #666; +} #session-list .author-session, #session-list .date-session{ font-size: 12px; diff --git a/main/auth/courses_controller.php b/main/auth/courses_controller.php index d469aa09dd..a705034758 100755 --- a/main/auth/courses_controller.php +++ b/main/auth/courses_controller.php @@ -526,9 +526,9 @@ class CoursesController */ public function getAlreadyRegisteredInSessionLabel() { - $icon = Display::return_icon('students.gif', get_lang('Student')); + $icon = ''; - return Display::label($icon . ' ' . get_lang("AlreadyRegisteredToSession"), "info"); + return Display::div($icon . ' ' . get_lang("AlreadyRegisteredToSession"),array('class'=>'info-catalog')); } /** From 12f3f40b09d7ea1fa7c99a34a7199d554060dea5 Mon Sep 17 00:00:00 2001 From: aragonc Date: Fri, 3 Jul 2015 16:47:50 -0500 Subject: [PATCH 08/13] fix catalog session label BT#9901 #TMI --- app/Resources/public/css/base.css | 17 +++++++++++++++-- main/lang/spanish/trad4all.inc.php | 2 ++ main/template/default/auth/session_catalog.tpl | 6 ++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index 1bd6211c4c..65d30ba14d 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -6107,12 +6107,25 @@ div#chat-remote-video video { margin-left: auto; margin-right: auto; } + #session-list .information-item{ padding: 10px; } +#session-list .information-item .requirements .fa-book{ + margin-right: 10px; + color: #00829C; +} +#session-list .information-item .requirements{ + color: #666666; + font-size: 12px; +} #session-list .information-item .options .info-catalog{ - font-size: 14px; - color: #666; + background-color: #35A8C9; + color: #ffffff; + padding: 5px; + text-align: center; + border-radius: 5px; + font-size: 12px; } #session-list .author-session, #session-list .date-session{ diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index e021677585..f477a2b130 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -7419,4 +7419,6 @@ $GraphDependencyTree = "Árbol de dependencias"; $CustomizeIcons = "Personalizar iconos"; $AddCustomCourseIntro = "Puede añadir una introducción a su curso en esta sección, dando clic en el icono de edición"; $SocialGroup = "Grupo de red social"; +$RequiredCourse = "Curso requerido"; +$DependentCourse = 'Curso dependiente'; ?> \ No newline at end of file diff --git a/main/template/default/auth/session_catalog.tpl b/main/template/default/auth/session_catalog.tpl index f802767b62..47f4b4a196 100644 --- a/main/template/default/auth/session_catalog.tpl +++ b/main/template/default/auth/session_catalog.tpl @@ -105,8 +105,7 @@
{% if session.requirements %} -

{{ 'Requirements'|get_lang }}

-

+

{{ 'RequiredCourse'|get_lang }} : {% for requirement in session.requirements %} {{ requirement.name }} {% endfor %} @@ -114,8 +113,7 @@ {% endif %} {% if session.dependencies %} -

{{ 'Dependencies'|get_lang }}

-

+

{{ 'DependentCourse'|get_lang }} : {% for dependency in session.dependencies %} {{ dependency.name }} {% endfor %} From b165d1534a48f87318b3699bc1dfbb232b9ddf00 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 3 Jul 2015 18:21:09 -0500 Subject: [PATCH 09/13] Minor - English language and example fix for README.md --- main/template/overrides/README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/main/template/overrides/README.md b/main/template/overrides/README.md index a19e93edeb..c46c3fa216 100644 --- a/main/template/overrides/README.md +++ b/main/template/overrides/README.md @@ -1,9 +1,11 @@ -This directory is the right place for override an existing template. +Place template files in this directory to override any existing template. -Just copy the orignal template with the same relative path. -ex: +Just copy the orignal template file with the same relative path. +e.g.: ``` -default/layout/head.tpl - -the_plugin_dirnae_name/path/of/template/in/plugins.tpl +layout/head.tpl +``` +or +``` +the_plugin_dirname/path/of/template/in/plugins.tpl ``` From 02c966062bb2eac411c4fd3f1570d4bd2898dc7d Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 3 Jul 2015 22:07:59 -0500 Subject: [PATCH 10/13] Minor language fixes - refs BT#9901 #TMI --- main/lang/english/trad4all.inc.php | 5 +++++ main/lang/spanish/trad4all.inc.php | 10 ++++++++-- main/template/default/auth/session_catalog.tpl | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index 32fcf364b2..0f451609fd 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -2979,6 +2979,7 @@ $Description = "Description"; $Links = "Links"; $Works = "Assignments"; $Forums = "Forums"; +$GradebookListOfStudentsReports = "Students list report"; $CreateDir = "Create folder"; $Name = "Name"; $Comment = "Comment"; @@ -7389,8 +7390,12 @@ $UntilDateX = "Until %s"; $GraphDependencyTree = "Dependency tree"; $CustomizeIcons = "Customize icons"; $ExportAllToPDF = "Export all to PDF"; +$GradeGeneratedOnX = "Grade generated on %s"; $ExerciseAvailableSinceX = "Exercise available since %s"; +$ExerciseIsActivatedFromXToY = "The test is enabled from %s to %s"; $SelectSomeOptions = "Select some options"; $AddCustomCourseIntro = "You may add an introduction to this course here by clicking the edition icon"; $SocialGroup = "Social group"; +$RequiredSessions = "Required sessions"; +$DependentSessions = "Dependent sessions"; ?> \ No newline at end of file diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index f477a2b130..bba52d4fa6 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -2979,6 +2979,7 @@ $Description = "Descripción"; $Links = "Enlaces"; $Works = "Tareas"; $Forums = "Foros"; +$GradebookListOfStudentsReports = "Reporte de lista de alumnos"; $CreateDir = "Crear una carpeta"; $Name = "Nombre"; $Comment = "Comentarios"; @@ -7417,8 +7418,13 @@ $FromDateX = "Del %s"; $UntilDateX = "Al %s"; $GraphDependencyTree = "Árbol de dependencias"; $CustomizeIcons = "Personalizar iconos"; +$ExportAllToPDF = "Exportar todo a PDF"; +$GradeGeneratedOnX = "Nota generada el %s"; +$ExerciseAvailableSinceX = "Ejercicio disponible desde el %s"; +$ExerciseIsActivatedFromXToY = "El ejercicio está habilitado del %s al %s"; +$SelectSomeOptions = "Seleccione alguna opción"; $AddCustomCourseIntro = "Puede añadir una introducción a su curso en esta sección, dando clic en el icono de edición"; $SocialGroup = "Grupo de red social"; -$RequiredCourse = "Curso requerido"; -$DependentCourse = 'Curso dependiente'; +$RequiredSessions = "Sesiones requeridas"; +$DependentSessions = "Sesiones dependientes"; ?> \ No newline at end of file diff --git a/main/template/default/auth/session_catalog.tpl b/main/template/default/auth/session_catalog.tpl index 47f4b4a196..e1127497c9 100644 --- a/main/template/default/auth/session_catalog.tpl +++ b/main/template/default/auth/session_catalog.tpl @@ -105,7 +105,7 @@

{% if session.requirements %} -

{{ 'RequiredCourse'|get_lang }} : +

{{ 'RequiredSessions'|get_lang }} : {% for requirement in session.requirements %} {{ requirement.name }} {% endfor %} @@ -113,7 +113,7 @@ {% endif %} {% if session.dependencies %} -

{{ 'DependentCourse'|get_lang }} : +

{{ 'DependentSessions'|get_lang }} : {% for dependency in session.dependencies %} {{ dependency.name }} {% endfor %} From fe8646d7ef7910dc50a7a39ff3754afdd5d92a0b Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Sun, 5 Jul 2015 22:38:21 -0500 Subject: [PATCH 11/13] Fix valid user for web service - refs #7338 --- main/inc/lib/webservices/WebService.class.php | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/main/inc/lib/webservices/WebService.class.php b/main/inc/lib/webservices/WebService.class.php index 114b2e69df..c3f8122512 100644 --- a/main/inc/lib/webservices/WebService.class.php +++ b/main/inc/lib/webservices/WebService.class.php @@ -45,28 +45,11 @@ abstract class WebService return false; } - $userTable = Database::get_main_table(TABLE_MAIN_USER); + $user = UserManager::getRepository()->findOneBy([ + 'username' => $username + ]); - $whereConditions = array( - "username = '?' " => $username, - "AND password = '?'" => sha1($password) - ); - - $conditions = array( - 'where' => $whereConditions - ); - - $table = Database::select('count(1) as qty', $userTable, $conditions); - - if ($table != false) { - $row = current($table); - - if ($row['qty'] > 0) { - return true; - } - } - - return false; + return UserManager::isPasswordValid($password, $user); } } From 8220115c70968e779d4a9fe5f4f52b3743320a17 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Sun, 5 Jul 2015 23:58:27 -0500 Subject: [PATCH 12/13] Fix valid user password when username doesn't exists - refs #7338 --- main/inc/lib/webservices/WebService.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/inc/lib/webservices/WebService.class.php b/main/inc/lib/webservices/WebService.class.php index c3f8122512..fc6efb2d10 100644 --- a/main/inc/lib/webservices/WebService.class.php +++ b/main/inc/lib/webservices/WebService.class.php @@ -49,6 +49,10 @@ abstract class WebService 'username' => $username ]); + if (empty($user)) { + return false; + } + return UserManager::isPasswordValid($password, $user); } From bbb4bf4844272fd3d2fcbbac8005001cccfefc49 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Mon, 6 Jul 2015 00:39:38 -0500 Subject: [PATCH 13/13] Update languages --- main/lang/english/trad4all.inc.php | 2 ++ main/lang/french/trad4all.inc.php | 10 ++++++++++ main/lang/spanish/trad4all.inc.php | 2 ++ 3 files changed, 14 insertions(+) diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index 0f451609fd..876b1149a8 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -7398,4 +7398,6 @@ $AddCustomCourseIntro = "You may add an introduction to this course here by clic $SocialGroup = "Social group"; $RequiredSessions = "Required sessions"; $DependentSessions = "Dependent sessions"; +$ByDuration = "By duration"; +$ByDates = "By dates"; ?> \ No newline at end of file diff --git a/main/lang/french/trad4all.inc.php b/main/lang/french/trad4all.inc.php index 7963638536..d033beafe1 100755 --- a/main/lang/french/trad4all.inc.php +++ b/main/lang/french/trad4all.inc.php @@ -2970,6 +2970,7 @@ $Description = "Description"; $Links = "Liens"; $Works = "Travaux"; $Forums = "Forums"; +$GradebookListOfStudentsReports = "Rapport de liste d'étudiants"; $CreateDir = "Créer un répertoire"; $Name = "Nom"; $Comment = "Commentaire"; @@ -7382,6 +7383,15 @@ $FromDateX = "Du %s"; $UntilDateX = "Au %s"; $GraphDependencyTree = "Arbre de dépendances"; $CustomizeIcons = "Changer les icônes"; +$ExportAllToPDF = "Tout exporter à PDF"; +$GradeGeneratedOnX = "Score généré le %s"; $ExerciseAvailableSinceX = "Exercice disponible depuis le %s"; $ExerciseIsActivatedFromXToY = "L'exercice est disponible du %s au %s"; +$SelectSomeOptions = "Sélectionnez une option"; +$AddCustomCourseIntro = "Vous pouvez ajouter une introduction à votre cours dans cette section en cliquant sur l'icône d'édition"; +$SocialGroup = "Groupe social"; +$RequiredSessions = "Sessions requises"; +$DependentSessions = "Sessions dépendantes"; +$ByDuration = "Par durée"; +$ByDates = "Par dates"; ?> \ No newline at end of file diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index bba52d4fa6..6539e66163 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -7427,4 +7427,6 @@ $AddCustomCourseIntro = "Puede añadir una introducción a su curso en esta secc $SocialGroup = "Grupo de red social"; $RequiredSessions = "Sesiones requeridas"; $DependentSessions = "Sesiones dependientes"; +$ByDuration = "Por duración"; +$ByDates = "Por fechas"; ?> \ No newline at end of file