Permalink
Browse files

Merge branch 'master' into backup-convert

Conflicts:
	backup/util/xml/parser/processors/simplified_parser_processor.class.php
	backup/util/xml/parser/simpletest/testparser.php
  • Loading branch information...
2 parents 6cfa5a3 + 16b5541 commit f6f7a7266c641407261d1220eae14b5e71fdbdbe @mudrd8mz mudrd8mz committed May 26, 2011
Showing with 3,511 additions and 930 deletions.
  1. +34 −0 backup/moodle2/backup_coursereport_plugin.class.php
  2. +1 −0 backup/moodle2/backup_plan_builder.class.php
  3. +4 −0 backup/moodle2/backup_stepslib.php
  4. +29 −0 backup/moodle2/restore_coursereport_plugin.class.php
  5. +2 −0 backup/moodle2/restore_plan_builder.class.php
  6. +3 −0 backup/moodle2/restore_stepslib.php
  7. +2 −2 backup/util/xml/parser/processors/simplified_parser_processor.class.php
  8. +16 −14 backup/util/xml/parser/simpletest/testparser.php
  9. +88 −4 blocks/dock.js
  10. +1 −0 blocks/navigation/renderer.php
  11. +108 −8 blocks/navigation/yui/navigation/navigation.js
  12. +1 −0 lang/en/error.php
  13. +7 −5 lib/db/install.xml
  14. +50 −0 lib/db/upgrade.php
  15. +44 −137 lib/outputrenderers.php
  16. +1 −1 lib/rsslib.php
  17. +2 −0 message/lib.php
  18. +2 −0 mod/assignment/lib.php
  19. +2 −1 mod/chat/lib.php
  20. +2 −0 mod/choice/lib.php
  21. +1 −1 mod/choice/renderer.php
  22. +5 −3 mod/data/backup/moodle2/backup_data_stepslib.php
  23. +8 −0 mod/data/backup/moodle2/restore_data_stepslib.php
  24. +23 −0 mod/data/db/upgrade.php
  25. +86 −61 mod/data/lib.php
  26. +2 −2 mod/data/version.php
  27. +3 −2 mod/data/view.php
  28. +1 −0 mod/feedback/lib.php
  29. +2 −0 mod/folder/lib.php
  30. +5 −3 mod/forum/backup/moodle2/backup_forum_stepslib.php
  31. +8 −0 mod/forum/backup/moodle2/restore_forum_stepslib.php
  32. +22 −0 mod/forum/db/upgrade.php
  33. +147 −153 mod/forum/lib.php
  34. +30 −39 mod/forum/user.php
  35. +3 −5 mod/forum/version.php
  36. +0 −4 mod/forum/view.php
  37. +5 −3 mod/glossary/backup/moodle2/backup_glossary_stepslib.php
  38. +9 −0 mod/glossary/backup/moodle2/restore_glossary_stepslib.php
  39. +23 −0 mod/glossary/db/upgrade.php
  40. +3 −1 mod/glossary/deleteentry.php
  41. +91 −62 mod/glossary/lib.php
  42. +2 −2 mod/glossary/version.php
  43. +3 −3 mod/glossary/view.php
  44. +2 −0 mod/imscp/lib.php
  45. +2 −0 mod/label/lib.php
  46. +2 −2 mod/lesson/lib.php
  47. +2 −0 mod/page/lib.php
  48. +2 −2 mod/quiz/lib.php
  49. +2 −0 mod/resource/lib.php
  50. +2 −1 mod/survey/lib.php
  51. +2 −0 mod/url/lib.php
  52. +2 −0 mod/wiki/lib.php
  53. +2 −0 mod/workshop/lib.php
  54. +36 −31 rating/index.php
  55. +696 −301 rating/lib.php
  56. +27 −24 rating/rate.php
  57. +45 −48 rating/rate_ajax.php
  58. +3 −3 repository/webdav/lib.php
  59. +133 −0 theme/afterburner/config.php
  60. +55 −0 theme/afterburner/lang/en/theme_afterburner.php
  61. +128 −0 theme/afterburner/layout/default.php
  62. +23 −0 theme/afterburner/layout/embedded.php
  63. BIN theme/afterburner/pix/core/bg.png
  64. BIN theme/afterburner/pix/core/bground.jpg
  65. BIN theme/afterburner/pix/core/h2grad.jpg
  66. BIN theme/afterburner/pix/favicon.ico
  67. BIN theme/afterburner/pix/footer/moodle-logo.png
  68. BIN theme/afterburner/pix/forum/gradient.png
  69. BIN theme/afterburner/pix/images/light3.png
  70. BIN theme/afterburner/pix/menu/ab-arrowover.png
  71. BIN theme/afterburner/pix/menu/nav-arrow-right.png
  72. BIN theme/afterburner/pix/screenshot.jpg
  73. BIN theme/afterburner/pix/sideblocks/sidegrad.jpg
  74. BIN theme/afterburner/pix/tab/left.gif
  75. BIN theme/afterburner/pix/tab/left_active.gif
  76. BIN theme/afterburner/pix/tab/left_active_hover.gif
  77. BIN theme/afterburner/pix/tab/left_hover.gif
  78. BIN theme/afterburner/pix/tab/right.gif
  79. BIN theme/afterburner/pix/tab/right_active.gif
  80. BIN theme/afterburner/pix/tab/right_active_hover.gif
  81. BIN theme/afterburner/pix/tab/right_end.gif
  82. BIN theme/afterburner/pix/tab/right_hover.gif
  83. BIN theme/afterburner/pix/tab/right_last.gif
  84. BIN theme/afterburner/pix/tab/rtlbg.gif
  85. BIN theme/afterburner/pix/tab/tabrow1.gif
  86. BIN theme/afterburner/pix_core/a/em1_bwgreater.gif
  87. BIN theme/afterburner/pix_core/a/em1_greater.gif
  88. BIN theme/afterburner/pix_core/a/em1_lesser.gif
  89. BIN theme/afterburner/pix_core/a/em1_raquo.gif
  90. BIN theme/afterburner/pix_core/a/help.png
  91. BIN theme/afterburner/pix_core/a/l_breadcrumb.gif
  92. BIN theme/afterburner/pix_core/a/logout.png
  93. BIN theme/afterburner/pix_core/a/r_breadcrumb.gif
  94. BIN theme/afterburner/pix_core/a/r_go.gif
  95. BIN theme/afterburner/pix_core/a/r_next.gif
  96. BIN theme/afterburner/pix_core/a/r_previous.gif
  97. BIN theme/afterburner/pix_core/a/refresh.png
  98. BIN theme/afterburner/pix_core/a/search.png
  99. BIN theme/afterburner/pix_core/a/setting.png
  100. BIN theme/afterburner/pix_core/c/course.png
  101. BIN theme/afterburner/pix_core/c/event.png
  102. BIN theme/afterburner/pix_core/c/groups.png
  103. BIN theme/afterburner/pix_core/c/site.png
  104. BIN theme/afterburner/pix_core/c/user.png
  105. BIN theme/afterburner/pix_core/docs.png
  106. BIN theme/afterburner/pix_core/f/access.png
  107. BIN theme/afterburner/pix_core/f/avi.png
  108. BIN theme/afterburner/pix_core/f/excel.png
  109. BIN theme/afterburner/pix_core/f/flash.png
  110. BIN theme/afterburner/pix_core/f/folder-32.png
  111. BIN theme/afterburner/pix_core/f/folder.png
  112. BIN theme/afterburner/pix_core/f/help.png
  113. BIN theme/afterburner/pix_core/f/html.png
  114. BIN theme/afterburner/pix_core/f/image-32.png
  115. BIN theme/afterburner/pix_core/f/image.png
  116. BIN theme/afterburner/pix_core/f/odb.png
  117. BIN theme/afterburner/pix_core/f/odf.png
  118. BIN theme/afterburner/pix_core/f/odg.png
  119. BIN theme/afterburner/pix_core/f/odm.png
  120. BIN theme/afterburner/pix_core/f/odp.png
  121. BIN theme/afterburner/pix_core/f/ods.png
  122. BIN theme/afterburner/pix_core/f/odt.png
  123. BIN theme/afterburner/pix_core/f/pdf.png
  124. BIN theme/afterburner/pix_core/f/powerpoint.png
  125. BIN theme/afterburner/pix_core/f/text-32.png
  126. BIN theme/afterburner/pix_core/f/text.png
  127. BIN theme/afterburner/pix_core/f/unknown-32.png
  128. BIN theme/afterburner/pix_core/f/unknown.png
  129. BIN theme/afterburner/pix_core/f/video.png
  130. BIN theme/afterburner/pix_core/f/web.png
  131. BIN theme/afterburner/pix_core/f/word.png
  132. BIN theme/afterburner/pix_core/f/xml.png
  133. BIN theme/afterburner/pix_core/f/zip.png
  134. BIN theme/afterburner/pix_core/g/f1.png
  135. BIN theme/afterburner/pix_core/g/f2.png
  136. BIN theme/afterburner/pix_core/g/user100.png
  137. BIN theme/afterburner/pix_core/g/user35.png
  138. BIN theme/afterburner/pix_core/help.png
  139. BIN theme/afterburner/pix_core/i/all.png
  140. BIN theme/afterburner/pix_core/i/backup.png
  141. BIN theme/afterburner/pix_core/i/calc.png
  142. BIN theme/afterburner/pix_core/i/checkpermissions.png
  143. BIN theme/afterburner/pix_core/i/course.png
  144. BIN theme/afterburner/pix_core/i/db.png
  145. BIN theme/afterburner/pix_core/i/edit.gif
  146. BIN theme/afterburner/pix_core/i/email.png
  147. BIN theme/afterburner/pix_core/i/feedback.png
  148. BIN theme/afterburner/pix_core/i/feedback_add.png
  149. BIN theme/afterburner/pix_core/i/files.png
  150. BIN theme/afterburner/pix_core/i/filter.png
  151. BIN theme/afterburner/pix_core/i/flagged.png
  152. BIN theme/afterburner/pix_core/i/grades.png
  153. BIN theme/afterburner/pix_core/i/group.png
  154. BIN theme/afterburner/pix_core/i/hide.png
  155. BIN theme/afterburner/pix_core/i/info.png
  156. BIN theme/afterburner/pix_core/i/lock.png
  157. BIN theme/afterburner/pix_core/i/marker.png
  158. BIN theme/afterburner/pix_core/i/menu.png
  159. BIN theme/afterburner/pix_core/i/new.png
  160. BIN theme/afterburner/pix_core/i/news.png
  161. BIN theme/afterburner/pix_core/i/one.png
  162. BIN theme/afterburner/pix_core/i/payment.png
  163. BIN theme/afterburner/pix_core/i/permissions.png
  164. BIN theme/afterburner/pix_core/i/publish.png
  165. BIN theme/afterburner/pix_core/i/questions.png
  166. BIN theme/afterburner/pix_core/i/report.png
  167. BIN theme/afterburner/pix_core/i/restore.png
  168. BIN theme/afterburner/pix_core/i/return.png
  169. BIN theme/afterburner/pix_core/i/roles.png
  170. BIN theme/afterburner/pix_core/i/scales.png
  171. BIN theme/afterburner/pix_core/i/settings.png
  172. BIN theme/afterburner/pix_core/i/show.png
  173. BIN theme/afterburner/pix_core/i/unflagged.png
  174. BIN theme/afterburner/pix_core/i/user.png
  175. BIN theme/afterburner/pix_core/i/users.png
  176. BIN theme/afterburner/pix_core/icon.png
  177. BIN theme/afterburner/pix_core/m/USD.gif
  178. +1 −0 theme/afterburner/pix_core/s/SMILEYS
  179. BIN theme/afterburner/pix_core/s/angry.png
  180. BIN theme/afterburner/pix_core/s/approve.png
  181. BIN theme/afterburner/pix_core/s/biggrin.png
  182. BIN theme/afterburner/pix_core/s/blackeye.gif
  183. BIN theme/afterburner/pix_core/s/blush.png
  184. BIN theme/afterburner/pix_core/s/clown.gif
  185. BIN theme/afterburner/pix_core/s/cool.png
  186. BIN theme/afterburner/pix_core/s/dead.png
  187. BIN theme/afterburner/pix_core/s/egg.gif
  188. BIN theme/afterburner/pix_core/s/evil.png
  189. BIN theme/afterburner/pix_core/s/heart.png
  190. BIN theme/afterburner/pix_core/s/kiss.png
  191. BIN theme/afterburner/pix_core/s/martin.gif
  192. BIN theme/afterburner/pix_core/s/mixed.png
  193. BIN theme/afterburner/pix_core/s/no.gif
  194. BIN theme/afterburner/pix_core/s/sad.png
  195. BIN theme/afterburner/pix_core/s/shy.png
  196. BIN theme/afterburner/pix_core/s/sleepy.png
  197. BIN theme/afterburner/pix_core/s/smiley.png
  198. BIN theme/afterburner/pix_core/s/surprise.png
  199. BIN theme/afterburner/pix_core/s/thoughtful.png
  200. BIN theme/afterburner/pix_core/s/tongueout.png
  201. BIN theme/afterburner/pix_core/s/wideeyes.png
  202. BIN theme/afterburner/pix_core/s/wink.png
  203. BIN theme/afterburner/pix_core/s/yes.png
  204. BIN theme/afterburner/pix_core/t/adddir.png
  205. BIN theme/afterburner/pix_core/t/addfile.png
  206. BIN theme/afterburner/pix_core/t/addgreen.png
  207. BIN theme/afterburner/pix_core/t/backup.png
  208. BIN theme/afterburner/pix_core/t/block.png
  209. BIN theme/afterburner/pix_core/t/calendar.png
  210. BIN theme/afterburner/pix_core/t/clear.png
  211. BIN theme/afterburner/pix_core/t/copy.png
  212. BIN theme/afterburner/pix_core/t/delete.png
  213. BIN theme/afterburner/pix_core/t/down.png
  214. BIN theme/afterburner/pix_core/t/download.png
  215. BIN theme/afterburner/pix_core/t/edit.png
  216. BIN theme/afterburner/pix_core/t/email.png
  217. BIN theme/afterburner/pix_core/t/emailno.png
  218. BIN theme/afterburner/pix_core/t/feedback.png
  219. BIN theme/afterburner/pix_core/t/feedback_add.png
  220. BIN theme/afterburner/pix_core/t/go.png
  221. BIN theme/afterburner/pix_core/t/groupn.png
  222. BIN theme/afterburner/pix_core/t/groups.png
  223. BIN theme/afterburner/pix_core/t/hide.png
  224. BIN theme/afterburner/pix_core/t/lock.png
  225. BIN theme/afterburner/pix_core/t/move.png
  226. BIN theme/afterburner/pix_core/t/preview.png
  227. BIN theme/afterburner/pix_core/t/restore.png
  228. BIN theme/afterburner/pix_core/t/show.png
  229. BIN theme/afterburner/pix_core/t/stop.png
  230. BIN theme/afterburner/pix_core/t/unlock.png
  231. BIN theme/afterburner/pix_core/t/up.png
  232. BIN theme/afterburner/pix_core/t/user.png
  233. BIN theme/afterburner/pix_core/t/userblue.png
  234. BIN theme/afterburner/pix_core/t/usernot.png
  235. BIN theme/afterburner/pix_core/u/f1.png
  236. BIN theme/afterburner/pix_core/u/f2.png
  237. BIN theme/afterburner/pix_plugins/enrol/self/withoutkey.png
  238. BIN theme/afterburner/pix_plugins/mod/assignment/icon.png
  239. BIN theme/afterburner/pix_plugins/mod/chat/icon.png
  240. BIN theme/afterburner/pix_plugins/mod/choice/icon.png
  241. BIN theme/afterburner/pix_plugins/mod/data/icon.png
  242. BIN theme/afterburner/pix_plugins/mod/folder/icon.png
  243. BIN theme/afterburner/pix_plugins/mod/forum/icon.png
  244. BIN theme/afterburner/pix_plugins/mod/glossary/icon.png
  245. BIN theme/afterburner/pix_plugins/mod/imscp/icon.png
  246. BIN theme/afterburner/pix_plugins/mod/label/icon.png
  247. BIN theme/afterburner/pix_plugins/mod/lesson/icon.png
  248. BIN theme/afterburner/pix_plugins/mod/page/icon.png
  249. BIN theme/afterburner/pix_plugins/mod/quiz/icon.png
  250. BIN theme/afterburner/pix_plugins/mod/resource/icon.png
  251. BIN theme/afterburner/pix_plugins/mod/scorm/icon.png
  252. BIN theme/afterburner/pix_plugins/mod/survey/icon.png
  253. BIN theme/afterburner/pix_plugins/mod/url/icon.png
  254. BIN theme/afterburner/pix_plugins/mod/wiki/icon.png
  255. BIN theme/afterburner/pix_plugins/mod/workshop/icon.png
  256. +139 −0 theme/afterburner/renderers.php
  257. +155 −0 theme/afterburner/style/afterburner_blocks.css
  258. +167 −0 theme/afterburner/style/afterburner_calendar.css
  259. +125 −0 theme/afterburner/style/afterburner_dock.css
  260. +148 −0 theme/afterburner/style/afterburner_layout.css
  261. +193 −0 theme/afterburner/style/afterburner_menu.css
  262. +86 −0 theme/afterburner/style/afterburner_mod.css
  263. +436 −0 theme/afterburner/style/afterburner_styles.css
  264. +7 −0 theme/afterburner/style/rtl.css
  265. +5 −0 theme/base/style/core.css
  266. +2 −2 version.php
@@ -0,0 +1,34 @@
+<?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/>.
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Base class for course report backup plugins.
+ *
+ * NOTE: When you back up a course, it potentially may run backup for all
+ * course reports. In order to control whether a particular report gets
+ * backed up, a course report should make use of the second and third
+ * parameters in get_plugin_element().
+ *
+ * @package moodlecore
+ * @subpackage backup-moodle2
+ * @copyright 2011 onwards The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+abstract class backup_coursereport_plugin extends backup_plugin {
+ // Use default parent behaviour
+}
@@ -36,6 +36,7 @@
require_once($CFG->dirroot . '/backup/moodle2/backup_qtype_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_format_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_theme_plugin.class.php');
+require_once($CFG->dirroot . '/backup/moodle2/backup_coursereport_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plagiarism_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_subplugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_settingslib.php');
@@ -419,6 +419,10 @@ protected function define_structure() {
// save course data (in case of user theme, legacy theme, etc)
$this->add_plugin_structure('theme', $course, true);
+ // attach course report plugin structure to $course element; multiple
+ // course reports can save course data if required
+ $this->add_plugin_structure('coursereport', $course, true);
+
// attach plagiarism plugin structure to $course element, only one allowed
$this->add_plugin_structure('plagiarism', $course, false);
@@ -0,0 +1,29 @@
+<?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/>.
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Restore for course plugin: course report.
+ *
+ * @package moodlecore
+ * @subpackage backup-moodle2
+ * @copyright 2011 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+abstract class restore_coursereport_plugin extends restore_plugin {
+ // Use default parent behaviour
+}
@@ -35,11 +35,13 @@
require_once($CFG->dirroot . '/backup/moodle2/restore_qtype_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_format_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_theme_plugin.class.php');
+require_once($CFG->dirroot . '/backup/moodle2/restore_coursereport_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_plagiarism_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_qtype_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_format_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_theme_plugin.class.php');
+require_once($CFG->dirroot . '/backup/moodle2/backup_coursereport_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plagiarism_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_subplugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_settingslib.php');
@@ -1010,6 +1010,9 @@ protected function define_structure() {
// Apply for 'theme' plugins optional paths at course level
$this->add_plugin_structure('theme', $course);
+ // Apply for 'course report' plugins optional paths at course level
+ $this->add_plugin_structure('coursereport', $course);
+
// Apply for plagiarism plugins optional paths at course level
$this->add_plugin_structure('plagiarism', $course);
@@ -174,12 +174,12 @@ public function before_path($path) {
*/
public function after_path($path) {
$toprocess = false;
- // If the path being closed matches (same or parent) the last path in the stack
+ // If the path being closed matches (same or parent) the first path in the stack
// we process pending startend notifications until one matching end is found
if ($element = reset($this->startendinfo)) {
$elepath = $element['path'];
$eleaction = $element['action'];
- if ($eleaction = 'end' && strpos($elepath, $path) === 0) {
+ if (strpos($elepath, $path) === 0) {
$toprocess = true;
}
@@ -652,43 +652,45 @@ function test_grouped_david_backup19_file_fragment() {
function helper_check_notifications_order_integrity($notifications) {
$numerrors = 0;
$notifpile = array('pilebase' => 'start');
- $lastpile = 'start:pilebase';
+ $lastnotif = 'start:pilebase';
foreach ($notifications as $notif) {
- $lastpilelevel = strlen(preg_replace('/[^\/]/', '', $lastpile));
- $lastpiletype = preg_replace('/:.*/', '', $lastpile);
- $lastpilepath = preg_replace('/.*:/', '', $lastpile);
- $notiflevel = strlen(preg_replace('/[^\/]/', '', $notif));
+ $lastpiletype = end($notifpile);
+ $lastpilepath = key($notifpile);
+ $lastpilelevel = strlen(preg_replace('/[^\/]/', '', $lastpilepath));
+
+ $lastnotiftype = preg_replace('/:.*/', '', $lastnotif);
+ $lastnotifpath = preg_replace('/.*:/', '', $lastnotif);
+ $lastnotiflevel = strlen(preg_replace('/[^\/]/', '', $lastnotifpath));
+
$notiftype = preg_replace('/:.*/', '', $notif);
$notifpath = preg_replace('/.*:/', '', $notif);
+ $notiflevel = strlen(preg_replace('/[^\/]/', '', $notifpath));
switch ($notiftype) {
case 'process':
- if ($lastpilepath != $notifpath or $lastpiletype != 'start') {
- $numerrors++; // Only start for same path is allowed before process
+ if ($lastnotifpath != $notifpath or $lastnotiftype != 'start') {
+ $numerrors++; // Only start for same path from last notification is allowed before process
}
$notifpile[$notifpath] = 'process'; // Update the status in the pile
break;
case 'end':
if ($lastpilepath != $notifpath or ($lastpiletype != 'process' and $lastpiletype != 'start')) {
- $numerrors++; // Only process for same path is allowed before end
+ $numerrors++; // Only process and start for same path from last pile is allowed before end
}
unset($notifpile[$notifpath]); // Delete from the pile
break;
case 'start':
if (array_key_exists($notifpath, $notifpile) or $notiflevel <= $lastpilelevel) {
- $numerrors++; // If same path exists or the level is < than the last one
+ $numerrors++; // Only non existing in pile and with level > last pile is allowed on start
}
$notifpile[$notifpath] = 'start'; // Add to the pile
break;
default:
$numerrors++; // Incorrect type of notification => error
}
- // Update lastpile
- end($notifpile);
- $path = key($notifpile);
- $type = $notifpile[$path];
- $lastpile = $type. ':' . $path;
+ // Update lastnotif
+ $lastnotif = $notif;
}
return $numerrors;
}
View
@@ -66,7 +66,75 @@ M.core_dock.init = function(Y) {
// Give the dock item class the event properties/methods
Y.augment(this.item, Y.EventTarget);
Y.augment(this, Y.EventTarget, true);
+ /**
+ * A 'dock:actionkey' Event.
+ * The event consists of the left arrow, right arrow, enter and space keys.
+ * More keys can be mapped to action meanings.
+ * actions: collapse , expand, toggle, enter.
+ *
+ * This event is subscribed to by dockitems.
+ * The on() method to subscribe allows specifying the desired trigger actions as JSON.
+ *
+ * This event can also be delegated if needed.
+ * Todo: This could be centralised, a similar Event is defined in blocks/navigation/yui/navigation/navigation.js
+ */
+ Y.Event.define("dock:actionkey", {
+ // Webkit and IE repeat keydown when you hold down arrow keys.
+ // Opera links keypress to page scroll; others keydown.
+ // Firefox prevents page scroll via preventDefault() on either
+ // keydown or keypress.
+ _event: (Y.UA.webkit || Y.UA.ie) ? 'keydown' : 'keypress',
+
+ _keys: {
+ //arrows
+ '37': 'collapse',
+ '39': 'expand',
+ //(@todo: lrt/rtl/M.core_dock.cfg.orientation decision to assign arrow to meanings)
+ '32': 'toggle',
+ '13': 'enter'
+ },
+
+ _keyHandler: function (e, notifier, args) {
+ if (!args.actions) {
+ var actObj = {collapse:true, expand:true, toggle:true, enter:true};
+ } else {
+ var actObj = args.actions;
+ }
+ if (this._keys[e.keyCode] && actObj[this._keys[e.keyCode]]) {
+ e.action = this._keys[e.keyCode];
+ notifier.fire(e);
+ }
+ },
+
+ on: function (node, sub, notifier) {
+ // subscribe to _event and ask keyHandler to handle with given args[0] (the desired actions).
+ if (sub.args == null) {
+ //no actions given
+ sub._detacher = node.on(this._event, this._keyHandler,this, notifier, {actions:false});
+ } else {
+ sub._detacher = node.on(this._event, this._keyHandler,this, notifier, sub.args[0]);
+ }
+ },
+ detach: function (node, sub, notifier) {
+ //detach our _detacher handle of the subscription made in on()
+ sub._detacher.detach();
+ },
+
+ delegate: function (node, sub, notifier, filter) {
+ // subscribe to _event and ask keyHandler to handle with given args[0] (the desired actions).
+ if (sub.args == null) {
+ //no actions given
+ sub._delegateDetacher = node.delegate(this._event, this._keyHandler,filter, this, notifier, {actions:false});
+ } else {
+ sub._delegateDetacher = node.delegate(this._event, this._keyHandler,filter, this, notifier, sub.args[0]);
+ }
+ },
+
+ detachDelegate: function (node, sub, notifier) {
+ sub._delegateDetacher.detach();
+ }
+ });
// Publish the events the dock has
this.publish('dock:beforedraw', {prefix:'dock'});
this.publish('dock:beforeshow', {prefix:'dock'});
@@ -125,9 +193,10 @@ M.core_dock.init = function(Y) {
// Add a removeall button
// Must set the image src seperatly of we get an error with XML strict headers
- var removeall = Y.Node.create('<img alt="'+M.str.block.undockall+'" title="'+M.str.block.undockall+'" />');
+ var removeall = Y.Node.create('<img alt="'+M.str.block.undockall+'" title="'+M.str.block.undockall+'" tabindex="0"/>');
removeall.setAttribute('src',this.cfg.removeallicon);
removeall.on('removeall|click', this.remove_all, this);
+ removeall.on('dock:actionkey', this.remove_all, this, {actions:{enter:true}});
this.nodes.buttons.appendChild(Y.Node.create('<div class="'+css.controls+'"></div>').append(removeall));
// Create a manager for the height of the tabs. Once set this can be forgotten about
@@ -590,7 +659,7 @@ M.core_dock.resetFirstItem = function() {
* @function
* @return {boolean}
*/
-M.core_dock.remove_all = function() {
+M.core_dock.remove_all = function(e) {
for (var i in this.items) {
this.remove(i);
}
@@ -840,9 +909,10 @@ M.core_dock.genericblock.prototype = {
}, this);
// Add a close icon
// Must set the image src seperatly of we get an error with XML strict headers
- var closeicon = Y.Node.create('<span class="hidepanelicon"><img alt="" style="width:11px;height:11px;cursor:pointer;" /></span>');
+ var closeicon = Y.Node.create('<span class="hidepanelicon" tabindex="0"><img alt="" style="width:11px;height:11px;cursor:pointer;" /></span>');
closeicon.one('img').setAttribute('src', M.util.image_url('t/dockclose', 'moodle'));
closeicon.on('forceclose|click', this.hide, this);
+ closeicon.on('dock:actionkey',this.hide, this, {actions:{enter:true,toggle:true}});
this.commands.append(closeicon);
}, dockitem);
// Register an event so that when it is removed we can put it back as a block
@@ -955,7 +1025,8 @@ M.core_dock.item.prototype = {
this.nodes.docktitle = Y.Node.create('<div id="dock_item_'+this.id+'_title" class="'+css.dockedtitle+'"></div>');
this.nodes.docktitle.append(this.title);
- this.nodes.dockitem = Y.Node.create('<div id="dock_item_'+this.id+'" class="'+css.dockeditem+'"></div>');
+ this.nodes.dockitem = Y.Node.create('<div id="dock_item_'+this.id+'" class="'+css.dockeditem+'" tabindex="0"></div>');
+ this.nodes.dockitem.on('dock:actionkey', this.toggle, this);
if (M.core_dock.count === 1) {
this.nodes.dockitem.addClass('firstdockitem');
}
@@ -1000,6 +1071,19 @@ M.core_dock.item.prototype = {
this.fire('dockeditem:hidecomplete');
},
/**
+ * A toggle between calling show and hide functions based on css.activeitem
+ * Applies rules to key press events (dock:actionkey)
+ * @param {Event} e
+ */
+ toggle : function(e) {
+ var css = M.core_dock.css;
+ if (this.nodes.docktitle.hasClass(css.activeitem) && !(e.type == 'dock:actionkey' && e.action=='expand')) {
+ this.hide();
+ } else if (!this.nodes.docktitle.hasClass(css.activeitem) && !(e.type == 'dock:actionkey' && e.action=='collapse')) {
+ this.show();
+ }
+ },
+ /**
* This function removes the node and destroys it's bits
* @param {Event} e
*/
@@ -52,6 +52,7 @@ protected function navigation_node($items, $attrs=array(), $expansionlimit=null,
$attributes['class'] = 'dimmed_text';
}
if (is_string($item->action) || empty($item->action) || ($item->type === navigation_node::TYPE_CATEGORY && empty($options['linkcategories']))) {
+ $attributes['tabindex'] = '0'; //add tab support to span but still maintain character stream sequence.
$content = html_writer::tag('span', $content, $attributes);
} else if ($item->action instanceof action_link) {
//TODO: to be replaced with something else
Oops, something went wrong. Retry.

0 comments on commit f6f7a72

Please sign in to comment.