Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote branch 'origin/master' into rubric

Conflicts:
	lib/db/install.xml
	lib/db/upgrade.php
	version.php
  • Loading branch information...
commit e8004aadc8e426f628a840d1ce396cb4be80b745 2 parents afc766a + 9086337
@mudrd8mz mudrd8mz authored
Showing with 19,564 additions and 1,312 deletions.
  1. +17 −17 admin/tool/xmldb/actions/XMLDBAction.class.php
  2. +29 −29 admin/tool/xmldb/actions/XMLDBCheckAction.class.php
  3. +17 −17 admin/tool/xmldb/actions/check_bigints/check_bigints.class.php
  4. +12 −12 admin/tool/xmldb/actions/check_defaults/check_defaults.class.php
  5. +10 −10 admin/tool/xmldb/actions/check_foreign_keys/check_foreign_keys.class.php
  6. +16 −16 admin/tool/xmldb/actions/check_indexes/check_indexes.class.php
  7. +12 −12 admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php
  8. +15 −15 admin/tool/xmldb/actions/delete_field/delete_field.class.php
  9. +15 −15 admin/tool/xmldb/actions/delete_index/delete_index.class.php
  10. +15 −15 admin/tool/xmldb/actions/delete_key/delete_key.class.php
  11. +11 −11 admin/tool/xmldb/actions/delete_table/delete_table.class.php
  12. +10 −10 admin/tool/xmldb/actions/delete_xml_file/delete_xml_file.class.php
  13. +33 −35 admin/tool/xmldb/actions/edit_field/edit_field.class.php
  14. +46 −49 admin/tool/xmldb/actions/edit_field/edit_field.js
  15. +31 −31 admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php
  16. +22 −24 admin/tool/xmldb/actions/edit_index/edit_index.class.php
  17. +32 −32 admin/tool/xmldb/actions/edit_index_save/edit_index_save.class.php
  18. +28 −30 admin/tool/xmldb/actions/edit_key/edit_key.class.php
  19. +37 −43 admin/tool/xmldb/actions/edit_key/edit_key.js
  20. +41 −41 admin/tool/xmldb/actions/edit_key_save/edit_key_save.class.php
  21. +57 −58 admin/tool/xmldb/actions/edit_table/edit_table.class.php
  22. +24 −24 admin/tool/xmldb/actions/edit_table_save/edit_table_save.class.php
  23. +37 −38 admin/tool/xmldb/actions/edit_xml_file/edit_xml_file.class.php
  24. +13 −13 admin/tool/xmldb/actions/edit_xml_file_save/edit_xml_file_save.class.php
  25. +7 −7 admin/tool/xmldb/actions/generate_all_documentation/generate_all_documentation.class.php
  26. +9 −9 admin/tool/xmldb/actions/generate_documentation/generate_documentation.class.php
  27. +12 −12 admin/tool/xmldb/actions/get_db_directories/get_db_directories.class.php
  28. +15 −15 admin/tool/xmldb/actions/load_xml_file/load_xml_file.class.php
  29. +12 −12 admin/tool/xmldb/actions/load_xml_files/load_xml_files.class.php
  30. +39 −39 admin/tool/xmldb/actions/main_view/main_view.class.php
  31. +20 −20 admin/tool/xmldb/actions/move_updown_field/move_updown_field.class.php
  32. +20 −20 admin/tool/xmldb/actions/move_updown_index/move_updown_index.class.php
  33. +20 −20 admin/tool/xmldb/actions/move_updown_key/move_updown_key.class.php
  34. +20 −20 admin/tool/xmldb/actions/move_updown_table/move_updown_table.class.php
  35. +15 −16 admin/tool/xmldb/actions/new_field/new_field.class.php
  36. +15 −16 admin/tool/xmldb/actions/new_index/new_index.class.php
  37. +15 −16 admin/tool/xmldb/actions/new_key/new_key.class.php
  38. +14 −15 admin/tool/xmldb/actions/new_table/new_table.class.php
  39. +34 −34 admin/tool/xmldb/actions/new_table_from_mysql/new_table_from_mysql.class.php
  40. +11 −11 admin/tool/xmldb/actions/revert_changes/revert_changes.class.php
  41. +15 −15 admin/tool/xmldb/actions/save_xml_file/save_xml_file.class.php
  42. +11 −13 admin/tool/xmldb/actions/template/template.class.php
  43. +11 −12 admin/tool/xmldb/actions/unload_xml_file/unload_xml_file.class.php
  44. +18 −18 admin/tool/xmldb/actions/view_field_xml/view_field_xml.class.php
  45. +18 −18 admin/tool/xmldb/actions/view_index_xml/view_index_xml.class.php
  46. +18 −18 admin/tool/xmldb/actions/view_key_xml/view_key_xml.class.php
  47. +13 −13 admin/tool/xmldb/actions/view_reserved_words/view_reserved_words.class.php
  48. +45 −46 admin/tool/xmldb/actions/view_structure_php/view_structure_php.class.php
  49. +11 −12 admin/tool/xmldb/actions/view_structure_sql/view_structure_sql.class.php
  50. +14 −14 admin/tool/xmldb/actions/view_structure_xml/view_structure_xml.class.php
  51. +128 −129 admin/tool/xmldb/actions/view_table_php/view_table_php.class.php
  52. +25 −29 admin/tool/xmldb/actions/view_table_php/view_table_php.js
  53. +12 −13 admin/tool/xmldb/actions/view_table_sql/view_table_sql.class.php
  54. +16 −16 admin/tool/xmldb/actions/view_table_xml/view_table_xml.class.php
  55. +13 −13 admin/tool/xmldb/actions/view_xml/view_xml.class.php
  56. +15 −15 admin/tool/xmldb/index.php
  57. +1 −1  backup/moodle2/backup_course_task.class.php
  58. +1 −1  backup/moodle2/restore_course_task.class.php
  59. +17 −7 backup/util/helper/backup_cron_helper.class.php
  60. +1 −0  blocks/search/block_search.php
  61. +3 −1 course/lib.php
  62. +1 −1  grade/import/xml/grade_import_form.php
  63. +1 −0  install/lang/bg/admin.php
  64. +1 −0  install/lang/bg/error.php
  65. +1 −0  install/lang/bg/install.php
  66. +2 −1  install/lang/ru/error.php
  67. +1 −0  lang/en/search.php
  68. +7 −3 lib/db/install.xml
  69. +51 −2 lib/db/upgrade.php
  70. +15 −1 lib/dml/mysqli_native_moodle_database.php
  71. +3 −3 lib/dml/pgsql_native_moodle_database.php
  72. +34 −0 lib/dml/simpletest/testdml.php
  73. +51 −8 lib/enrollib.php
  74. +1 −1  lib/form/editor.php
  75. +1 −0  lib/form/filemanager.php
  76. +17 −2 lib/form/filepicker.js
  77. +3 −1 lib/form/filepicker.php
  78. +22 −2 lib/form/form.js
  79. +48 −1 lib/formslib.php
  80. +1 −1  lib/portfoliolib.php
  81. +1 −1  lib/setup.php
  82. +1 −1  lib/thirdpartylibs.xml
  83. +199 −0 lib/yui/3.4.1/build/align-plugin/align-plugin-debug.js
  84. +7 −0 lib/yui/3.4.1/build/align-plugin/align-plugin-min.js
  85. +199 −0 lib/yui/3.4.1/build/align-plugin/align-plugin.js
  86. +676 −0 lib/yui/3.4.1/build/anim-base/anim-base-debug.js
  87. +7 −0 lib/yui/3.4.1/build/anim-base/anim-base-min.js
  88. +675 −0 lib/yui/3.4.1/build/anim-base/anim-base.js
  89. +54 −0 lib/yui/3.4.1/build/anim-color/anim-color-debug.js
  90. +7 −0 lib/yui/3.4.1/build/anim-color/anim-color-min.js
  91. +54 −0 lib/yui/3.4.1/build/anim-color/anim-color.js
  92. +63 −0 lib/yui/3.4.1/build/anim-curve/anim-curve-debug.js
  93. +7 −0 lib/yui/3.4.1/build/anim-curve/anim-curve-min.js
  94. +63 −0 lib/yui/3.4.1/build/anim-curve/anim-curve.js
  95. +356 −0 lib/yui/3.4.1/build/anim-easing/anim-easing-debug.js
  96. +7 −0 lib/yui/3.4.1/build/anim-easing/anim-easing-min.js
  97. +356 −0 lib/yui/3.4.1/build/anim-easing/anim-easing.js
  98. +32 −0 lib/yui/3.4.1/build/anim-node-plugin/anim-node-plugin-debug.js
  99. +7 −0 lib/yui/3.4.1/build/anim-node-plugin/anim-node-plugin-min.js
  100. +32 −0 lib/yui/3.4.1/build/anim-node-plugin/anim-node-plugin.js
  101. +44 −0 lib/yui/3.4.1/build/anim-scroll/anim-scroll-debug.js
  102. +7 −0 lib/yui/3.4.1/build/anim-scroll/anim-scroll-min.js
  103. +44 −0 lib/yui/3.4.1/build/anim-scroll/anim-scroll.js
  104. +32 −0 lib/yui/3.4.1/build/anim-xy/anim-xy-debug.js
  105. +7 −0 lib/yui/3.4.1/build/anim-xy/anim-xy-min.js
  106. +32 −0 lib/yui/3.4.1/build/anim-xy/anim-xy.js
  107. +365 −0 lib/yui/3.4.1/build/array-extras/array-extras-debug.js
  108. +7 −0 lib/yui/3.4.1/build/array-extras/array-extras-min.js
  109. +364 −0 lib/yui/3.4.1/build/array-extras/array-extras.js
  110. +46 −0 lib/yui/3.4.1/build/array-invoke/array-invoke-debug.js
  111. +7 −0 lib/yui/3.4.1/build/array-invoke/array-invoke-min.js
  112. +46 −0 lib/yui/3.4.1/build/array-invoke/array-invoke.js
  113. +90 −0 lib/yui/3.4.1/build/arraylist-add/arraylist-add-debug.js
  114. +7 −0 lib/yui/3.4.1/build/arraylist-add/arraylist-add-min.js
  115. +90 −0 lib/yui/3.4.1/build/arraylist-add/arraylist-add.js
  116. +49 −0 lib/yui/3.4.1/build/arraylist-filter/arraylist-filter-debug.js
  117. +7 −0 lib/yui/3.4.1/build/arraylist-filter/arraylist-filter-min.js
  118. +49 −0 lib/yui/3.4.1/build/arraylist-filter/arraylist-filter.js
  119. +218 −0 lib/yui/3.4.1/build/arraylist/arraylist-debug.js
  120. +7 −0 lib/yui/3.4.1/build/arraylist/arraylist-min.js
  121. +218 −0 lib/yui/3.4.1/build/arraylist/arraylist.js
  122. +69 −0 lib/yui/3.4.1/build/arraysort/arraysort-debug.js
  123. +7 −0 lib/yui/3.4.1/build/arraysort/arraysort-min.js
  124. +69 −0 lib/yui/3.4.1/build/arraysort/arraysort.js
  125. 0  lib/yui/{3.4.1pr1/build/resize-base → 3.4.1/build}/assets/skins/sam/arrows.png
  126. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/autocomplete-list.css
  127. 0  lib/yui/{3.4.1pr1/build/console → 3.4.1/build}/assets/skins/sam/bg.png
  128. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/calendar-base.css
  129. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/calendar.css
  130. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/calendarnavigator.css
  131. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/console-filters.css
  132. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/console.css
  133. +8 −0 lib/yui/3.4.1/build/assets/skins/sam/datatable-base.css
  134. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/dial.css
  135. 0  lib/yui/{3.4.1pr1/build/datatable-base → 3.4.1/build}/assets/skins/sam/dt-arrow-dn.png
  136. 0  lib/yui/{3.4.1pr1/build/datatable-base → 3.4.1/build}/assets/skins/sam/dt-arrow-up.png
  137. 0  ...yui/{3.4.1pr1/build/node-menunav → 3.4.1/build}/assets/skins/sam/horizontal-menu-submenu-indicator.png
  138. 0  lib/yui/{3.4.1pr1/build/node-menunav → 3.4.1/build}/assets/skins/sam/horizontal-menu-submenu-toggle.png
  139. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/node-flick.css
  140. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/node-menunav.css
  141. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/overlay.css
  142. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/panel.css
  143. 0  lib/yui/{3.4.1pr1/build/slider-base → 3.4.1/build}/assets/skins/sam/rail-x-lines.png
  144. 0  lib/yui/{3.4.1pr1/build/slider-base → 3.4.1/build}/assets/skins/sam/rail-x.png
  145. 0  lib/yui/{3.4.1pr1/build/slider-base → 3.4.1/build}/assets/skins/sam/rail-y-lines.png
  146. 0  lib/yui/{3.4.1pr1/build/slider-base → 3.4.1/build}/assets/skins/sam/rail-y.png
  147. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/resize-base.css
  148. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/scrollview-base.css
  149. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/scrollview-list.css
  150. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/scrollview-scrollbars.css
  151. +29 −0 lib/yui/3.4.1/build/assets/skins/sam/skin.css
  152. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/slider-base.css
  153. 0  lib/yui/{3.4.1pr1 → 3.4.1}/build/assets/skins/sam/sprite.png
  154. 0  lib/yui/{3.4.1pr1/build/widget-buttons → 3.4.1/build}/assets/skins/sam/sprite_icons.gif
  155. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/tabview.css
  156. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/test.css
  157. 0  lib/yui/{3.4.1pr1/build/slider-base → 3.4.1/build}/assets/skins/sam/thumb-x.png
  158. 0  lib/yui/{3.4.1pr1/build/slider-base → 3.4.1/build}/assets/skins/sam/thumb-y.png
  159. 0  lib/yui/{3.4.1pr1/build/node-menunav → 3.4.1/build}/assets/skins/sam/vertical-menu-submenu-indicator.png
  160. 0  lib/yui/{3.4.1pr1/build/console/assets → 3.4.1/build/assets/skins/sam}/warn_error.png
  161. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/widget-base.css
  162. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/widget-buttons.css
  163. +7 −0 lib/yui/3.4.1/build/assets/skins/sam/widget-stack.css
  164. +528 −0 lib/yui/3.4.1/build/async-queue/async-queue-debug.js
  165. +7 −0 lib/yui/3.4.1/build/async-queue/async-queue-min.js
  166. +528 −0 lib/yui/3.4.1/build/async-queue/async-queue.js
  167. +1,197 −0 lib/yui/3.4.1/build/attribute-base/attribute-base-debug.js
  168. +8 −0 lib/yui/3.4.1/build/attribute-base/attribute-base-min.js
  169. +1,182 −0 lib/yui/3.4.1/build/attribute-base/attribute-base.js
  170. +129 −0 lib/yui/3.4.1/build/attribute-complex/attribute-complex-debug.js
  171. +7 −0 lib/yui/3.4.1/build/attribute-complex/attribute-complex-min.js
  172. +129 −0 lib/yui/3.4.1/build/attribute-complex/attribute-complex.js
  173. +1,642 −0 lib/yui/3.4.1/build/autocomplete-base/autocomplete-base-debug.js
  174. +8 −0 lib/yui/3.4.1/build/autocomplete-base/autocomplete-base-min.js
  175. +1,635 −0 lib/yui/3.4.1/build/autocomplete-base/autocomplete-base.js
  176. +147 −0 lib/yui/3.4.1/build/autocomplete-filters-accentfold/autocomplete-filters-accentfold-debug.js
  177. +7 −0 lib/yui/3.4.1/build/autocomplete-filters-accentfold/autocomplete-filters-accentfold-min.js
  178. +147 −0 lib/yui/3.4.1/build/autocomplete-filters-accentfold/autocomplete-filters-accentfold.js
  179. +245 −0 lib/yui/3.4.1/build/autocomplete-filters/autocomplete-filters-debug.js
  180. +7 −0 lib/yui/3.4.1/build/autocomplete-filters/autocomplete-filters-min.js
  181. +245 −0 lib/yui/3.4.1/build/autocomplete-filters/autocomplete-filters.js
  182. +117 −0 lib/yui/3.4.1/build/autocomplete-highlighters-accentfold/autocomplete-highlighters-accentfold-debug.js
  183. +7 −0 lib/yui/3.4.1/build/autocomplete-highlighters-accentfold/autocomplete-highlighters-accentfold-min.js
  184. +117 −0 lib/yui/3.4.1/build/autocomplete-highlighters-accentfold/autocomplete-highlighters-accentfold.js
  185. +205 −0 lib/yui/3.4.1/build/autocomplete-highlighters/autocomplete-highlighters-debug.js
  186. +7 −0 lib/yui/3.4.1/build/autocomplete-highlighters/autocomplete-highlighters-min.js
  187. +205 −0 lib/yui/3.4.1/build/autocomplete-highlighters/autocomplete-highlighters.js
  188. +194 −0 lib/yui/3.4.1/build/autocomplete-list-keys/autocomplete-list-keys-debug.js
  189. +7 −0 lib/yui/3.4.1/build/autocomplete-list-keys/autocomplete-list-keys-min.js
  190. +194 −0 lib/yui/3.4.1/build/autocomplete-list-keys/autocomplete-list-keys.js
  191. +33 −0 lib/yui/3.4.1/build/autocomplete-list/assets/autocomplete-list-core.css
  192. +56 −0 lib/yui/3.4.1/build/autocomplete-list/assets/skins/night/autocomplete-list-skin.css
  193. +7 −0 lib/yui/3.4.1/build/autocomplete-list/assets/skins/night/autocomplete-list.css
  194. +23 −0 lib/yui/3.4.1/build/autocomplete-list/assets/skins/sam/autocomplete-list-skin.css
  195. +7 −0 lib/yui/3.4.1/build/autocomplete-list/assets/skins/sam/autocomplete-list.css
  196. +901 −0 lib/yui/3.4.1/build/autocomplete-list/autocomplete-list-debug.js
  197. +8 −0 lib/yui/3.4.1/build/autocomplete-list/autocomplete-list-min.js
  198. +901 −0 lib/yui/3.4.1/build/autocomplete-list/autocomplete-list.js
  199. +7 −0 lib/yui/3.4.1/build/autocomplete-list/lang/autocomplete-list.js
  200. +7 −0 lib/yui/3.4.1/build/autocomplete-list/lang/autocomplete-list_en.js
  201. +60 −0 lib/yui/3.4.1/build/autocomplete-plugin/autocomplete-plugin-debug.js
  202. +7 −0 lib/yui/3.4.1/build/autocomplete-plugin/autocomplete-plugin-min.js
  203. +60 −0 lib/yui/3.4.1/build/autocomplete-plugin/autocomplete-plugin.js
  204. +490 −0 lib/yui/3.4.1/build/autocomplete-sources/autocomplete-sources-debug.js
  205. +7 −0 lib/yui/3.4.1/build/autocomplete-sources/autocomplete-sources-min.js
  206. +490 −0 lib/yui/3.4.1/build/autocomplete-sources/autocomplete-sources.js
  207. +627 −0 lib/yui/3.4.1/build/base-base/base-base-debug.js
  208. +7 −0 lib/yui/3.4.1/build/base-base/base-base-min.js
  209. +622 −0 lib/yui/3.4.1/build/base-base/base-base.js
Sorry, we could not display the entire diff because too many files (2,480) changed.
View
34 admin/tool/xmldb/actions/XMLDBAction.class.php
@@ -126,14 +126,14 @@ function getTitle() {
* array parameter
*/
function loadStrings($strings) {
- /// Load some commonly used strings
+ // Load some commonly used strings
if (get_string_manager()->string_exists($this->title, 'tool_xmldb')) {
$this->str['title'] = get_string($this->title, 'tool_xmldb');
} else {
$this->str['title'] = $this->title;
}
- /// Now process the $strings array loading it in the $str atribute
+ // Now process the $strings array loading it in the $str atribute
if ($strings) {
foreach ($strings as $key => $module) {
$this->str[$key] = get_string($key, $module);
@@ -149,19 +149,19 @@ function invoke() {
global $SESSION;
- /// Sesskey protection
+ // Sesskey protection
if ($this->sesskey_protected) {
require_sesskey();
}
- /// If we are used any dir, save it in the lastused session object
- /// Some actions can use it to perform positioning
+ // If we are used any dir, save it in the lastused session object
+ // Some actions can use it to perform positioning
if ($lastused = optional_param ('dir', NULL, PARAM_PATH)) {
$SESSION->lastused = $lastused;
}
$this->postaction = optional_param ('postaction', NULL, PARAM_ALPHAEXT);
- /// Avoid being recursive
+ // Avoid being recursive
if ($this->title == $this->postaction) {
$this->postaction = NULL;
}
@@ -174,12 +174,12 @@ function launch($action) {
global $CFG;
- /// Get the action path and invoke it
+ // Get the action path and invoke it
$actionsroot = "$CFG->dirroot/$CFG->admin/tool/xmldb/actions";
$actionclass = $action . '.class.php';
$actionpath = "$actionsroot/$action/$actionclass";
- /// Load and invoke the proper action
+ // Load and invoke the proper action
$result = false;
if (file_exists($actionpath) && is_readable($actionpath)) {
require_once($actionpath);
@@ -218,16 +218,16 @@ function upgrade_savepoint_php($structure) {
$path = $structure->getPath();
- /// Trim "db" from path
+ // Trim "db" from path
$path = dirname($path);
- /// Get pluginname, plugindir and plugintype
+ // Get pluginname, plugindir and plugintype
$pluginname = basename($path);
- if ($path == 'lib') { /// exception for lib (not proper plugin)
+ if ($path == 'lib') { // exception for lib (not proper plugin)
$plugindir = 'lib';
$plugintype = 'lib';
- } else { /// rest of plugins
- //TODO: this is not nice and may fail, plugintype should be passed around somehow instead
+ } else { // rest of plugins
+ // TODO: this is not nice and may fail, plugintype should be passed around somehow instead
$plugintypes = get_plugin_types(false);
$plugindir = dirname($path);
$plugindir = str_replace('\\', '/', $plugindir);
@@ -237,22 +237,22 @@ function upgrade_savepoint_php($structure) {
$result = '';
switch ($plugintype ) {
- case 'lib': /// has own savepoint function
+ case 'lib': // has own savepoint function
$result = XMLDB_LINEFEED .
' // Main savepoint reached' . XMLDB_LINEFEED .
' upgrade_main_savepoint(true, XXXXXXXXXX);' . XMLDB_LINEFEED;
break;
- case 'mod': /// has own savepoint function
+ case 'mod': // has own savepoint function
$result = XMLDB_LINEFEED .
' // ' . $pluginname . ' savepoint reached' . XMLDB_LINEFEED .
' upgrade_mod_savepoint(true, XXXXXXXXXX, ' . "'$pluginname'" . ');' . XMLDB_LINEFEED;
break;
- case 'block': /// has own savepoint function
+ case 'block': // has own savepoint function
$result = XMLDB_LINEFEED .
' // ' . $pluginname . ' savepoint reached' . XMLDB_LINEFEED .
' upgrade_block_savepoint(true, XXXXXXXXXX, ' . "'$pluginname'" . ');' . XMLDB_LINEFEED;
break;
- default: /// rest of plugins
+ default: // rest of plugins
$result = XMLDB_LINEFEED .
' // ' . $pluginname . ' savepoint reached' . XMLDB_LINEFEED .
' upgrade_plugin_savepoint(true, XXXXXXXXXX, ' . "'$plugintype'" . ', ' . "'$pluginname'" . ');' . XMLDB_LINEFEED;
View
58 admin/tool/xmldb/actions/XMLDBCheckAction.class.php
@@ -43,11 +43,11 @@
function init() {
parent::init();
- /// Set own core attributes
+ // Set own core attributes
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
$this->introstr => 'tool_xmldb',
'ok' => '',
@@ -73,24 +73,24 @@ function invoke() {
$result = true;
- /// Set own core attributes
+ // Set own core attributes
$this->does_generate = ACTION_GENERATE_HTML;
- /// These are always here
+ // These are always here
global $CFG, $XMLDB, $DB, $OUTPUT;
- /// And we nedd some ddl suff
+ // And we nedd some ddl suff
$dbman = $DB->get_manager();
- /// Here we'll acummulate all the wrong fields found
+ // Here we'll acummulate all the wrong fields found
$problemsfound = array();
- /// Do the job, setting $result as needed
+ // Do the job, setting $result as needed
- /// Get the confirmed to decide what to do
+ // Get the confirmed to decide what to do
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
- /// If not confirmed, show confirmation box
+ // If not confirmed, show confirmation box
if (!$confirmed) {
$o = '<table class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
$o.= ' <tr><td class="generalboxcontent">';
@@ -110,59 +110,59 @@ function invoke() {
$this->output = $o;
} else {
- /// The back to edit table button
+ // The back to edit table button
$b = ' <p class="centerpara buttons">';
$b .= '<a href="index.php">[' . $this->str['back'] . ']</a>';
$b .= '</p>';
- /// Iterate over $XMLDB->dbdirs, loading their XML data to memory
+ // Iterate over $XMLDB->dbdirs, loading their XML data to memory
if ($XMLDB->dbdirs) {
$dbdirs =& $XMLDB->dbdirs;
$o='<ul>';
foreach ($dbdirs as $dbdir) {
- /// Only if the directory exists
+ // Only if the directory exists
if (!$dbdir->path_exists) {
continue;
}
- /// Load the XML file
+ // Load the XML file
$xmldb_file = new xmldb_file($dbdir->path . '/install.xml');
- /// Only if the file exists
+ // Only if the file exists
if (!$xmldb_file->fileExists()) {
continue;
}
- /// Load the XML contents to structure
+ // Load the XML contents to structure
$loaded = $xmldb_file->loadXMLStructure();
if (!$loaded || !$xmldb_file->isLoaded()) {
echo $OUTPUT->notification('Errors found in XMLDB file: '. $dbdir->path . '/install.xml');
continue;
}
- /// Arriving here, everything is ok, get the XMLDB structure
+ // Arriving here, everything is ok, get the XMLDB structure
$structure = $xmldb_file->getStructure();
$o.=' <li>' . str_replace($CFG->dirroot . '/', '', $dbdir->path . '/install.xml');
- /// Getting tables
+ // Getting tables
if ($xmldb_tables = $structure->getTables()) {
$o.=' <ul>';
- /// Foreach table, process its fields
+ // Foreach table, process its fields
foreach ($xmldb_tables as $xmldb_table) {
- /// Skip table if not exists
+ // Skip table if not exists
if (!$dbman->table_exists($xmldb_table)) {
continue;
}
- /// Fetch metadata from physical DB. All the columns info.
+ // Fetch metadata from physical DB. All the columns info.
if (!$metacolumns = $DB->get_columns($xmldb_table->getName())) {
- //// Skip table if no metacolumns is available for it
+ // / Skip table if no metacolumns is available for it
continue;
}
- /// Table processing starts here
+ // Table processing starts here
$o.=' <li>' . $xmldb_table->getName();
- /// Do the specific check.
+ // Do the specific check.
list($output, $newproblems) = $this->check_table($xmldb_table, $metacolumns);
$o.=$output;
$problemsfound = array_merge($problemsfound, $newproblems);
$o.=' </li>';
- /// Give the script some more time (resetting to current if exists)
+ // Give the script some more time (resetting to current if exists)
if ($currenttl = @ini_get('max_execution_time')) {
@ini_set('max_execution_time',$currenttl);
}
@@ -174,19 +174,19 @@ function invoke() {
$o.='</ul>';
}
- /// Create a report of the problems found.
+ // Create a report of the problems found.
$r = $this->display_results($problemsfound);
- /// Combine the various bits of output.
+ // Combine the various bits of output.
$this->output = $b . $r . $o;
}
- /// Launch postaction if exists (leave this here!)
+ // Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
- /// Return ok if arrived here
+ // Return ok if arrived here
return $result;
}
View
34 admin/tool/xmldb/actions/check_bigints/check_bigints.class.php
@@ -44,11 +44,11 @@ function init() {
$this->introstr = 'confirmcheckbigints';
parent::init();
- /// Set own core attributes
+ // Set own core attributes
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'wrongints' => 'tool_xmldb',
'nowrongintsfound' => 'tool_xmldb',
@@ -56,7 +56,7 @@ function init() {
'mysqlextracheckbigints' => 'tool_xmldb',
));
- /// Correct fields must be type bigint for MySQL and int8 for PostgreSQL
+ // Correct fields must be type bigint for MySQL and int8 for PostgreSQL
$this->dbfamily = $DB->get_dbfamily();
switch ($this->dbfamily) {
case 'mysql':
@@ -74,26 +74,26 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
$o = '';
$wrong_fields = array();
- /// Get and process XMLDB fields
+ // Get and process XMLDB fields
if ($xmldb_fields = $xmldb_table->getFields()) {
$o.=' <ul>';
foreach ($xmldb_fields as $xmldb_field) {
- /// If the field isn't integer(10), skip
+ // If the field isn't integer(10), skip
if ($xmldb_field->getType() != XMLDB_TYPE_INTEGER || $xmldb_field->getLength() != 10) {
continue;
}
- /// If the metadata for that column doesn't exist, skip
+ // If the metadata for that column doesn't exist, skip
if (!isset($metacolumns[$xmldb_field->getName()])) {
continue;
}
- /// To variable for better handling
+ // To variable for better handling
$metacolumn = $metacolumns[$xmldb_field->getName()];
- /// Going to check this field in DB
+ // Going to check this field in DB
$o.=' <li>' . $this->str['field'] . ': ' . $xmldb_field->getName() . ' ';
- /// Detect if the physical field is wrong and, under mysql, check for incorrect signed fields too
+ // Detect if the physical field is wrong and, under mysql, check for incorrect signed fields too
if ($metacolumn->type != $this->correct_type || ($this->dbfamily == 'mysql' && $xmldb_field->getUnsigned() && !$metacolumn->unsigned)) {
$o.='<font color="red">' . $this->str['wrong'] . '</font>';
- /// Add the wrong field to the list
+ // Add the wrong field to the list
$obj = new stdClass();
$obj->table = $xmldb_table;
$obj->field = $xmldb_field;
@@ -121,41 +121,41 @@ protected function display_results(array $wrong_fields) {
$r.= ' </td></tr>';
$r.= ' <tr><td class="generalboxcontent">';
- /// If we have found wrong integers inform about them
+ // If we have found wrong integers inform about them
if (count($wrong_fields)) {
$r.= ' <p class="centerpara">' . $this->str['yeswrongintsfound'] . '</p>';
$r.= ' <ul>';
foreach ($wrong_fields as $obj) {
$xmldb_table = $obj->table;
$xmldb_field = $obj->field;
- /// MySQL directly supports this
+ // MySQL directly supports this
// TODO: move this hack to generators!!
if ($this->dbfamily == 'mysql') {
$sqlarr = $dbman->generator->getAlterFieldSQL($xmldb_table, $xmldb_field);
- /// PostgreSQL (XMLDB implementation) is a bit, er... imperfect.
+ // PostgreSQL (XMLDB implementation) is a bit, er... imperfect.
} else if ($this->dbfamily == 'postgres') {
$sqlarr = array('ALTER TABLE ' . $DB->get_prefix() . $xmldb_table->getName() .
' ALTER COLUMN ' . $xmldb_field->getName() . ' TYPE BIGINT;');
}
$r.= ' <li>' . $this->str['table'] . ': ' . $xmldb_table->getName() . '. ' .
$this->str['field'] . ': ' . $xmldb_field->getName() . '</li>';
- /// Add to output if we have sentences
+ // Add to output if we have sentences
if ($sqlarr) {
$sqlarr = $dbman->generator->getEndedStatements($sqlarr);
$s.= '<code>' . str_replace("\n", '<br />', implode('<br />', $sqlarr)). '</code><br />';
}
}
$r.= ' </ul>';
- /// Add the SQL statements (all together)
+ // Add the SQL statements (all together)
$r.= '<hr />' . $s;
} else {
$r.= ' <p class="centerpara">' . $this->str['nowrongintsfound'] . '</p>';
}
$r.= ' </td></tr>';
$r.= ' <tr><td class="generalboxcontent">';
- /// Add the complete log message
+ // Add the complete log message
$r.= ' <p class="centerpara">' . $this->str['completelogbelow'] . '</p>';
$r.= ' </td></tr>';
$r.= '</table>';
View
24 admin/tool/xmldb/actions/check_defaults/check_defaults.class.php
@@ -40,11 +40,11 @@ function init() {
$this->introstr = 'confirmcheckdefaults';
parent::init();
- /// Set own core attributes
+ // Set own core attributes
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'wrongdefaults' => 'tool_xmldb',
'nowrongdefaultsfound' => 'tool_xmldb',
@@ -58,7 +58,7 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
$o = '';
$wrong_fields = array();
- /// Get and process XMLDB fields
+ // Get and process XMLDB fields
if ($xmldb_fields = $xmldb_table->getFields()) {
$o.=' <ul>';
foreach ($xmldb_fields as $xmldb_field) {
@@ -66,15 +66,15 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
// Get the default value for the field
$xmldbdefault = $xmldb_field->getDefault();
- /// If the metadata for that column doesn't exist or 'id' field found, skip
+ // If the metadata for that column doesn't exist or 'id' field found, skip
if (!isset($metacolumns[$xmldb_field->getName()]) or $xmldb_field->getName() == 'id') {
continue;
}
- /// To variable for better handling
+ // To variable for better handling
$metacolumn = $metacolumns[$xmldb_field->getName()];
- /// Going to check this field in DB
+ // Going to check this field in DB
$o.=' <li>' . $this->str['field'] . ': ' . $xmldb_field->getName() . ' ';
// get the value of the physical default (or blank if there isn't one)
@@ -90,7 +90,7 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
$info = '('.$this->str['expected']." '$xmldbdefault', ".$this->str['actual'].
" '$physicaldefault')";
$o.='<font color="red">' . $this->str['wrong'] . " $info</font>";
- /// Add the wrong field to the list
+ // Add the wrong field to the list
$obj = new stdClass();
$obj->table = $xmldb_table;
$obj->field = $xmldb_field;
@@ -120,7 +120,7 @@ protected function display_results(array $wrong_fields) {
$r.= ' </td></tr>';
$r.= ' <tr><td class="generalboxcontent">';
- /// If we have found wrong defaults inform about them
+ // If we have found wrong defaults inform about them
if (count($wrong_fields)) {
$r.= ' <p class="centerpara">' . $this->str['yeswrongdefaultsfound'] . '</p>';
$r.= ' <ul>';
@@ -137,21 +137,21 @@ protected function display_results(array $wrong_fields) {
$this->str['field'] . ': ' . $xmldb_field->getName() . ', ' .
$this->str['expected'] . ' ' . "'$xmldbdefault'" . ' ' .
$this->str['actual'] . ' ' . "'$physicaldefault'" . '</li>';
- /// Add to output if we have sentences
+ // Add to output if we have sentences
if ($sqlarr) {
$sqlarr = $dbman->generator->getEndedStatements($sqlarr);
$s.= '<code>' . str_replace("\n", '<br />', implode('<br />', $sqlarr)) . '</code><br />';
}
}
$r.= ' </ul>';
- /// Add the SQL statements (all together)
+ // Add the SQL statements (all together)
$r.= '<hr />' . $s;
} else {
$r.= ' <p class="centerpara">' . $this->str['nowrongdefaultsfound'] . '</p>';
}
$r.= ' </td></tr>';
$r.= ' <tr><td class="generalboxcontent">';
- /// Add the complete log message
+ // Add the complete log message
$r.= ' <p class="centerpara">' . $this->str['completelogbelow'] . '</p>';
$r.= ' </td></tr>';
$r.= '</table>';
View
20 admin/tool/xmldb/actions/check_foreign_keys/check_foreign_keys.class.php
@@ -44,11 +44,11 @@ function init() {
$this->introstr = 'confirmcheckforeignkeys';
parent::init();
- /// Set own core attributes
+ // Set own core attributes
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'key' => 'tool_xmldb',
'violatedforeignkeys' => 'tool_xmldb',
@@ -67,17 +67,17 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
$o = '';
$violatedkeys = array();
- /// Keys
+ // Keys
if ($xmldb_keys = $xmldb_table->getKeys()) {
$o.=' <ul>';
foreach ($xmldb_keys as $xmldb_key) {
- /// We are only interested in foreign keys.
+ // We are only interested in foreign keys.
if (!in_array($xmldb_key->getType(), array(XMLDB_KEY_FOREIGN, XMLDB_KEY_FOREIGN_UNIQUE))) {
continue;
}
$o.=' <li>' . $this->str['key'] . ': ' . $xmldb_key->readableInfo() . ' ';
- /// Work out the SQL to find key violations.
+ // Work out the SQL to find key violations.
$keyfields = $xmldb_key->getFields();
$reffields = $xmldb_key->getRefFields();
$joinconditions = array();
@@ -103,13 +103,13 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
implode(' AND ', $joinconditions) . ' WHERE ' .
implode(' AND ', $nullnessconditions);
- /// Check there are any problems in the database.
+ // Check there are any problems in the database.
$violations = $DB->count_records_sql($sql, $params);
if ($violations == 0) {
$o.='<font color="green">' . $this->str['ok'] . '</font>';
} else {
$o.='<font color="red">' . $this->str['violations'] . '</font>';
- /// Add the missing index to the list
+ // Add the missing index to the list
$violation = new stdClass;
$violation->table = $xmldb_table;
$violation->key = $xmldb_key;
@@ -139,7 +139,7 @@ protected function display_results(array $violatedkeys) {
$r.= ' </td></tr>';
$r.= ' <tr><td class="generalboxcontent">';
- /// If we have found wrong integers inform about them
+ // If we have found wrong integers inform about them
if (count($violatedkeys)) {
$r.= ' <p class="centerpara">' . $this->str['violatedforeignkeysfound'] . '</p>';
$r.= ' <ul>';
@@ -156,7 +156,7 @@ protected function display_results(array $violatedkeys) {
}
$r.= ' </td></tr>';
$r.= ' <tr><td class="generalboxcontent">';
- /// Add the complete log message
+ // Add the complete log message
$r.= ' <p class="centerpara">' . $this->str['completelogbelow'] . '</p>';
$r.= ' </td></tr>';
$r.= '</table>';
View
32 admin/tool/xmldb/actions/check_indexes/check_indexes.class.php
@@ -40,11 +40,11 @@ function init() {
$this->introstr = 'confirmcheckindexes';
parent::init();
- /// Set own core attributes
+ // Set own core attributes
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'missing' => 'tool_xmldb',
'key' => 'tool_xmldb',
@@ -62,20 +62,20 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
$o = '';
$missing_indexes = array();
- /// Keys
+ // Keys
if ($xmldb_keys = $xmldb_table->getKeys()) {
$o.=' <ul>';
foreach ($xmldb_keys as $xmldb_key) {
$o.=' <li>' . $this->str['key'] . ': ' . $xmldb_key->readableInfo() . ' ';
- /// Primaries are skipped
+ // Primaries are skipped
if ($xmldb_key->getType() == XMLDB_KEY_PRIMARY) {
$o.='<font color="green">' . $this->str['ok'] . '</font></li>';
continue;
}
- /// If we aren't creating the keys or the key is a XMLDB_KEY_FOREIGN (not underlying index generated
- /// automatically by the RDBMS) create the underlying (created by us) index (if doesn't exists)
+ // If we aren't creating the keys or the key is a XMLDB_KEY_FOREIGN (not underlying index generated
+ // automatically by the RDBMS) create the underlying (created by us) index (if doesn't exists)
if (!$dbman->generator->getKeySQL($xmldb_table, $xmldb_key) || $xmldb_key->getType() == XMLDB_KEY_FOREIGN) {
- /// Create the interim index
+ // Create the interim index
$xmldb_index = new xmldb_index('anyname');
$xmldb_index->setFields($xmldb_key->getFields());
switch ($xmldb_key->getType()) {
@@ -87,12 +87,12 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
$xmldb_index->setUnique(false);
break;
}
- /// Check if the index exists in DB
+ // Check if the index exists in DB
if ($dbman->index_exists($xmldb_table, $xmldb_index)) {
$o.='<font color="green">' . $this->str['ok'] . '</font>';
} else {
$o.='<font color="red">' . $this->str['missing'] . '</font>';
- /// Add the missing index to the list
+ // Add the missing index to the list
$obj = new stdClass();
$obj->table = $xmldb_table;
$obj->index = $xmldb_index;
@@ -103,17 +103,17 @@ protected function check_table(xmldb_table $xmldb_table, array $metacolumns) {
}
$o.=' </ul>';
}
- /// Indexes
+ // Indexes
if ($xmldb_indexes = $xmldb_table->getIndexes()) {
$o.=' <ul>';
foreach ($xmldb_indexes as $xmldb_index) {
$o.=' <li>' . $this->str['index'] . ': ' . $xmldb_index->readableInfo() . ' ';
- /// Check if the index exists in DB
+ // Check if the index exists in DB
if ($dbman->index_exists($xmldb_table, $xmldb_index)) {
$o.='<font color="green">' . $this->str['ok'] . '</font>';
} else {
$o.='<font color="red">' . $this->str['missing'] . '</font>';
- /// Add the missing index to the list
+ // Add the missing index to the list
$obj = new stdClass();
$obj->table = $xmldb_table;
$obj->index = $xmldb_index;
@@ -139,7 +139,7 @@ protected function display_results(array $missing_indexes) {
$r.= ' </td></tr>';
$r.= ' <tr><td class="generalboxcontent">';
- /// If we have found missing indexes inform about them
+ // If we have found missing indexes inform about them
if (count($missing_indexes)) {
$r.= ' <p class="centerpara">' . $this->str['yesmissingindexesfound'] . '</p>';
$r.= ' <ul>';
@@ -154,14 +154,14 @@ protected function display_results(array $missing_indexes) {
}
$r.= ' </ul>';
- /// Add the SQL statements (all together)
+ // Add the SQL statements (all together)
$r.= '<hr />' . $s;
} else {
$r.= ' <p class="centerpara">' . $this->str['nomissingindexesfound'] . '</p>';
}
$r.= ' </td></tr>';
$r.= ' <tr><td class="generalboxcontent">';
- /// Add the complete log message
+ // Add the complete log message
$r.= ' <p class="centerpara">' . $this->str['completelogbelow'] . '</p>';
$r.= ' </td></tr>';
$r.= '</table>';
View
24 admin/tool/xmldb/actions/create_xml_file/create_xml_file.class.php
@@ -35,15 +35,15 @@ class create_xml_file extends XMLDBAction {
*/
function init() {
parent::init();
- /// Set own core attributes
+ // Set own core attributes
$this->can_subaction = ACTION_NONE;
//$this->can_subaction = ACTION_HAVE_SUBACTIONS;
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
- /// 'key' => 'module',
+ // 'key' => 'module',
));
}
@@ -57,28 +57,28 @@ function invoke() {
$result = true;
- /// Set own core attributes
+ // Set own core attributes
$this->does_generate = ACTION_NONE;
//$this->does_generate = ACTION_GENERATE_HTML;
- /// These are always here
+ // These are always here
global $CFG, $XMLDB;
- /// Do the job, setting result as needed
+ // Do the job, setting result as needed
- /// Get the dir containing the file
+ // Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . $dirpath;
$file = $dirpath . '/install.xml';
- /// Some variables
+ // Some variables
$xmlpath = dirname(str_replace($CFG->dirroot . '/', '', $file));
$xmlversion = userdate(time(), '%Y%m%d', 99, false);
$xmlcomment = 'XMLDB file for Moodle ' . dirname($xmlpath);
$xmltable = strtolower(basename(dirname($xmlpath)));
- /// Initial contents
+ // Initial contents
$c = '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
$c.= ' <XMLDB PATH="' . $xmlpath . '" VERSION="' . $xmlversion .'" COMMENT="' . $xmlcomment .'">' . "\n";
$c.= ' <TABLES>' . "\n";
@@ -98,12 +98,12 @@ function invoke() {
$result = false;
}
- /// Launch postaction if exists
+ // Launch postaction if exists
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
- /// Return ok if arrived here
+ // Return ok if arrived here
return $result;
}
}
View
30 admin/tool/xmldb/actions/delete_field/delete_field.class.php
@@ -37,9 +37,9 @@ class delete_field extends XMLDBAction {
function init() {
parent::init();
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'confirmdeletefield' => 'tool_xmldb',
'yes' => '',
@@ -57,15 +57,15 @@ function invoke() {
$result = true;
- /// Set own core attributes
+ // Set own core attributes
$this->does_generate = ACTION_GENERATE_HTML;
- /// These are always here
+ // These are always here
global $CFG, $XMLDB;
- /// Do the job, setting result as needed
+ // Do the job, setting result as needed
- /// Get the dir containing the file
+ // Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . $dirpath;
$tableparam = required_param('table', PARAM_CLEAN);
@@ -73,7 +73,7 @@ function invoke() {
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
- /// If not confirmed, show confirmation box
+ // If not confirmed, show confirmation box
if (!$confirmed) {
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
$o.= ' <tr><td class="generalboxcontent">';
@@ -93,14 +93,14 @@ function invoke() {
$this->output = $o;
} else {
- /// Get the edited dir
+ // Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
- /// Move adjacent fields prev and next attributes
+ // Move adjacent fields prev and next attributes
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$fields =& $table->getFields();
@@ -113,14 +113,14 @@ function invoke() {
$next =& $table->getField($field->getNext());
$next->setPrevious($field->getPrevious());
}
- /// Remove the field
+ // Remove the field
$table->deleteField($fieldparam);
- /// Recalculate the hash
+ // Recalculate the hash
$structure->calculateHash(true);
- /// If the hash has changed from the original one, change the version
- /// and mark the structure as changed
+ // If the hash has changed from the original one, change the version
+ // and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
@@ -131,12 +131,12 @@ function invoke() {
}
}
- /// Launch postaction if exists (leave this here!)
+ // Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
- /// Return ok if arrived here
+ // Return ok if arrived here
return $result;
}
}
View
30 admin/tool/xmldb/actions/delete_index/delete_index.class.php
@@ -37,9 +37,9 @@ class delete_index extends XMLDBAction {
function init() {
parent::init();
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'confirmdeleteindex' => 'tool_xmldb',
'yes' => '',
@@ -57,15 +57,15 @@ function invoke() {
$result = true;
- /// Set own core attributes
+ // Set own core attributes
$this->does_generate = ACTION_GENERATE_HTML;
- /// These are always here
+ // These are always here
global $CFG, $XMLDB;
- /// Do the job, setting result as needed
+ // Do the job, setting result as needed
- /// Get the dir containing the file
+ // Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . $dirpath;
$tableparam = required_param('table', PARAM_PATH);
@@ -73,7 +73,7 @@ function invoke() {
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
- /// If not confirmed, show confirmation box
+ // If not confirmed, show confirmation box
if (!$confirmed) {
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
$o.= ' <tr><td class="generalboxcontent">';
@@ -93,14 +93,14 @@ function invoke() {
$this->output = $o;
} else {
- /// Get the edited dir
+ // Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
- /// Move adjacent indexes prev and next attributes
+ // Move adjacent indexes prev and next attributes
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$indexes =& $table->getIndexes();
@@ -113,14 +113,14 @@ function invoke() {
$next =& $table->getIndex($index->getNext());
$next->setPrevious($index->getPrevious());
}
- /// Remove the index
+ // Remove the index
$table->deleteIndex($indexparam);
- /// Recalculate the hash
+ // Recalculate the hash
$structure->calculateHash(true);
- /// If the hash has changed from the original one, change the version
- /// and mark the structure as changed
+ // If the hash has changed from the original one, change the version
+ // and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
@@ -131,12 +131,12 @@ function invoke() {
}
}
- /// Launch postaction if exists (leave this here!)
+ // Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
- /// Return ok if arrived here
+ // Return ok if arrived here
return $result;
}
}
View
30 admin/tool/xmldb/actions/delete_key/delete_key.class.php
@@ -37,9 +37,9 @@ class delete_key extends XMLDBAction {
function init() {
parent::init();
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'confirmdeletekey' => 'tool_xmldb',
'yes' => '',
@@ -57,15 +57,15 @@ function invoke() {
$result = true;
- /// Set own core attributes
+ // Set own core attributes
$this->does_generate = ACTION_GENERATE_HTML;
- /// These are always here
+ // These are always here
global $CFG, $XMLDB;
- /// Do the job, setting result as needed
+ // Do the job, setting result as needed
- /// Get the dir containing the file
+ // Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . $dirpath;
$tableparam = required_param('table', PARAM_PATH);
@@ -73,7 +73,7 @@ function invoke() {
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
- /// If not confirmed, show confirmation box
+ // If not confirmed, show confirmation box
if (!$confirmed) {
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
$o.= ' <tr><td class="generalboxcontent">';
@@ -93,14 +93,14 @@ function invoke() {
$this->output = $o;
} else {
- /// Get the edited dir
+ // Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
- /// Move adjacent keys prev and next attributes
+ // Move adjacent keys prev and next attributes
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$keys =& $table->getKeys();
@@ -113,14 +113,14 @@ function invoke() {
$next =& $table->getKey($key->getNext());
$next->setPrevious($key->getPrevious());
}
- /// Remove the key
+ // Remove the key
$table->deleteKey($keyparam);
- /// Recalculate the hash
+ // Recalculate the hash
$structure->calculateHash(true);
- /// If the hash has changed from the original one, change the version
- /// and mark the structure as changed
+ // If the hash has changed from the original one, change the version
+ // and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
@@ -131,12 +131,12 @@ function invoke() {
}
}
- /// Launch postaction if exists (leave this here!)
+ // Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
- /// Return ok if arrived here
+ // Return ok if arrived here
return $result;
}
}
View
22 admin/tool/xmldb/actions/delete_table/delete_table.class.php
@@ -37,9 +37,9 @@ class delete_table extends XMLDBAction {
function init() {
parent::init();
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'confirmdeletetable' => 'tool_xmldb',
'yes' => '',
@@ -57,22 +57,22 @@ function invoke() {
$result = true;
- /// Set own core attributes
+ // Set own core attributes
$this->does_generate = ACTION_GENERATE_HTML;
- /// These are always here
+ // These are always here
global $CFG, $XMLDB;
- /// Do the job, setting result as needed
+ // Do the job, setting result as needed
- /// Get the dir containing the file
+ // Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . $dirpath;
$tableparam = required_param('table', PARAM_CLEAN);
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
- /// If not confirmed, show confirmation box
+ // If not confirmed, show confirmation box
if (!$confirmed) {
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
$o.= ' <tr><td class="generalboxcontent">';
@@ -92,26 +92,26 @@ function invoke() {
$this->output = $o;
} else {
- /// Get the edited dir
+ // Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
- /// Remove the table
+ // Remove the table
$structure->deleteTable($tableparam);
}
}
}
}
- /// Launch postaction if exists (leave this here!)
+ // Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
- /// Return ok if arrived here
+ // Return ok if arrived here
return $result;
}
}
View
20 admin/tool/xmldb/actions/delete_xml_file/delete_xml_file.class.php
@@ -37,9 +37,9 @@ class delete_xml_file extends XMLDBAction {
function init() {
parent::init();
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'confirmdeletexmlfile' => 'tool_xmldb',
'yes' => '',
@@ -57,21 +57,21 @@ function invoke() {
$result = true;
- /// Set own core attributes
+ // Set own core attributes
$this->does_generate = ACTION_GENERATE_HTML;
- /// These are always here
+ // These are always here
global $CFG, $XMLDB;
- /// Do the job, setting result as needed
+ // Do the job, setting result as needed
- /// Get the dir containing the file
+ // Get the dir containing the file
$dirpath = required_param('dir', PARAM_CLEAN);
$dirpath = $CFG->dirroot . $dirpath;
$confirmed = optional_param('confirmed', false, PARAM_BOOL);
- /// If not confirmed, show confirmation box
+ // If not confirmed, show confirmation box
if (!$confirmed) {
$o = '<table width="60" class="generalbox" border="0" cellpadding="5" cellspacing="0" id="notice">';
$o.= ' <tr><td class="generalboxcontent">';
@@ -91,7 +91,7 @@ function invoke() {
$this->output = $o;
} else {
- /// Get the original dir and delete the xml file
+ // Get the original dir and delete the xml file
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
@@ -102,12 +102,12 @@ function invoke() {
}
}
- /// Launch postaction if exists (leave this here!)
+ // Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
- /// Return ok if arrived here
+ // Return ok if arrived here
return $result;
}
}
View
68 admin/tool/xmldb/actions/edit_field/edit_field.class.php
@@ -37,10 +37,10 @@ class edit_field extends XMLDBAction {
function init() {
parent::init();
- /// Set own custom attributes
+ // Set own custom attributes
$this->sesskey_protected = false; // This action doesn't need sesskey protection
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'change' => 'tool_xmldb',
'float2numbernote' => 'tool_xmldb',
@@ -62,18 +62,18 @@ function invoke() {
$result = true;
- /// Set own core attributes
+ // Set own core attributes
$this->does_generate = ACTION_GENERATE_HTML;
- /// These are always here
+ // These are always here
global $CFG, $XMLDB, $OUTPUT;
- /// Do the job, setting result as needed
- /// Get the dir containing the file
+ // Do the job, setting result as needed
+ // Get the dir containing the file
$dirpath = required_param('dir', PARAM_PATH);
$dirpath = $CFG->dirroot . $dirpath;
- /// Get the correct dirs
+ // Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
} else {
@@ -84,9 +84,7 @@ function invoke() {
$structure =& $editeddir->xml_file->getStructure();
}
- /// ADD YOUR CODE HERE
-
- /// Fetch request data
+ // Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
if (!$table =& $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
@@ -94,7 +92,7 @@ function invoke() {
}
$fieldparam = required_param('field', PARAM_CLEAN);
if (!$field =& $table->getField($fieldparam)) {
- /// Arriving here from a name change, looking for the new field name
+ // Arriving here from a name change, looking for the new field name
$fieldparam = required_param('name', PARAM_CLEAN);
$field =& $table->getField($fieldparam);
}
@@ -102,14 +100,14 @@ function invoke() {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $dbdir->xml_file->getStructure();
- $o = ''; /// Output starts
+ $o = ''; // Output starts
- /// If field is XMLDB_TYPE_FLOAT, comment about to migrate it to XMLDB_TYPE_NUMBER
+ // If field is XMLDB_TYPE_FLOAT, comment about to migrate it to XMLDB_TYPE_NUMBER
if ($field->getType() == XMLDB_TYPE_FLOAT) {
$o .= '<p>' . $this->str['float2numbernote'] . '</p>';
}
- /// Add the main form
+ // Add the main form
$o.= '<form id="form" action="index.php" method="post">';
$o.= ' <div>';
$o.= ' <input type="hidden" name ="dir" value="' . str_replace($CFG->dirroot, '', $dirpath) . '" />';
@@ -119,8 +117,8 @@ function invoke() {
$o.= ' <input type="hidden" name ="action" value="edit_field_save" />';
$o.= ' <input type="hidden" name ="postaction" value="edit_table" />';
$o.= ' <table id="formelements" class="boxaligncenter">';
- /// XMLDB field name
- /// If the field has dependencies, we cannot change its name
+ // XMLDB field name
+ // If the field has dependencies, we cannot change its name
$disabled = '';
if ($structure->getFieldUses($table->getName(), $field->getName())) {
$o.= ' <input type="hidden" name ="name" value="' . s($field->getName()) .'" />';
@@ -128,9 +126,9 @@ function invoke() {
} else {
$o.= ' <tr valign="top"><td><label for="name" accesskey="n">Name:</label></td><td colspan="2"><input name="name" type="text" size="30" maxlength="30" id="name" value="' . s($field->getName()) . '" /></td></tr>';
}
- /// XMLDB field comment
+ // XMLDB field comment
$o.= ' <tr valign="top"><td><label for="comment" accesskey="c">Comment:</label></td><td colspan="2"><textarea name="comment" rows="3" cols="80" id="comment">' . s($field->getComment()) . '</textarea></td></tr>';
- /// xmldb_field Type
+ // xmldb_field Type
$typeoptions = array (XMLDB_TYPE_INTEGER => $field->getXMLDBTypeName(XMLDB_TYPE_INTEGER),
XMLDB_TYPE_NUMBER => $field->getXMLDBTypeName(XMLDB_TYPE_NUMBER),
XMLDB_TYPE_FLOAT => $field->getXMLDBTypeName(XMLDB_TYPE_FLOAT),
@@ -138,74 +136,74 @@ function invoke() {
XMLDB_TYPE_CHAR => $field->getXMLDBTypeName(XMLDB_TYPE_CHAR),
XMLDB_TYPE_TEXT => $field->getXMLDBTypeName(XMLDB_TYPE_TEXT),
XMLDB_TYPE_BINARY => $field->getXMLDBTypeName(XMLDB_TYPE_BINARY));
- /// If current field isnt float, delete such column type to avoid its creation from the interface
- /// Note that float fields are supported completely but it's possible than in a next future
- /// we delete them completely from Moodle DB, using, exlusively, number(x,y) types
+ // If current field isnt float, delete such column type to avoid its creation from the interface
+ // Note that float fields are supported completely but it's possible than in a next future
+ // we delete them completely from Moodle DB, using, exlusively, number(x,y) types
if ($field->getType() != XMLDB_TYPE_FLOAT) {
unset ($typeoptions[XMLDB_TYPE_FLOAT]);
}
- /// Also we hide datetimes. Only edition of them is allowed (and retrofit) but not new creation
+ // Also we hide datetimes. Only edition of them is allowed (and retrofit) but not new creation
if ($field->getType() != XMLDB_TYPE_DATETIME) {
unset ($typeoptions[XMLDB_TYPE_DATETIME]);
}
$select = html_writer::select($typeoptions, 'type', $field->getType(), false);
$o.= ' <tr valign="top"><td><label for="menutype" accesskey="t">Type:</label></td>';
$o.= ' <td colspan="2">' . $select . '</td></tr>';
- /// xmldb_field Length
+ // xmldb_field Length
$o.= ' <tr valign="top"><td><label for="length" accesskey="l">Length:</label></td>';
$o.= ' <td colspan="2"><input name="length" type="text" size="6" maxlength="6" id="length" value="' . s($field->getLength()) . '" /><span id="lengthtip"></span></td></tr>';
- /// xmldb_field Decimals
+ // xmldb_field Decimals
$o.= ' <tr valign="top"><td><label for="decimals" accesskey="d">Decimals:</label></td>';
$o.= ' <td colspan="2"><input name="decimals" type="text" size="6" maxlength="6" id="decimals" value="' . s($field->getDecimals()) . '" /><span id="decimalstip"></span></td></tr>';
- /// xmldb_field Unsigned
+ // xmldb_field Unsigned
$unsignedoptions = array (0 => 'signed', 1 => 'unsigned');
$select = html_writer::select($unsignedoptions, 'unsigned', $field->getUnsigned(), false);
$o.= ' <tr valign="top"><td><label for="menuunsigned" accesskey="u">Unsigned:</label></td>';
$o.= ' <td colspan="2">' . $select . '</td></tr>';
- /// xmldb_field NotNull
+ // xmldb_field NotNull
$notnulloptions = array (0 => 'null', 'not null');
$select = html_writer::select($notnulloptions, 'notnull', $field->getNotNull(), false);
$o.= ' <tr valign="top"><td><label for="menunotnull" accesskey="n">Not Null:</label></td>';
$o.= ' <td colspan="2">' . $select . '</td></tr>';
- /// xmldb_field Sequence
+ // xmldb_field Sequence
$sequenceoptions = array (0 => $this->str['no'], 1 => 'auto-numbered');
$select = html_writer::select($sequenceoptions, 'sequence', $field->getSequence(), false);
$o.= ' <tr valign="top"><td><label for="menusequence" accesskey="s">Sequence:</label></td>';
$o.= ' <td colspan="2">' . $select . '</td></tr>';
- /// xmldb_field Default
+ // xmldb_field Default
$o.= ' <tr valign="top"><td><label for="default" accesskey="d">Default:</label></td>';
$o.= ' <td colspan="2"><input type="text" name="default" size="30" maxlength="80" id="default" value="' . s($field->getDefault()) . '" /></td></tr>';
- /// Change button
+ // Change button
$o.= ' <tr valign="top"><td>&nbsp;</td><td colspan="2"><input type="submit" value="' .$this->str['change'] . '" /></td></tr>';
$o.= ' </table>';
$o.= '</div></form>';
- /// Calculate the buttons
+ // Calculate the buttons
$b = ' <p class="centerpara buttons">';
- /// The view original XML button
+ // The view original XML button
if ($table->getField($fieldparam)) {
$b .= '&nbsp;<a href="index.php?action=view_field_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;select=original&amp;table=' . $tableparam . '&amp;field=' . $fieldparam . '">[' . $this->str['vieworiginal'] . ']</a>';
} else {
$b .= '&nbsp;[' . $this->str['vieworiginal'] . ']';
}
- /// The view edited XML button
+ // The view edited XML button
if ($field->hasChanged()) {
$b .= '&nbsp;<a href="index.php?action=view_field_xml&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&amp;select=edited&amp;table=' . $tableparam . '&amp;field=' . $fieldparam . '">[' . $this->str['viewedited'] . ']</a>';
} else {
$b .= '&nbsp;[' . $this->str['viewedited'] . ']';
}
- /// The back to edit table button
+ // The back to edit table button
$b .= '&nbsp;<a href="index.php?action=edit_table&amp;table=' . $tableparam . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
$b .= '</p>';
$o .= $b;
$this->output = $o;
- /// Launch postaction if exists (leave this here!)
+ // Launch postaction if exists (leave this here!)
if ($this->getPostAction() && $result) {
return $this->launch($this->getPostAction());
}
- /// Return ok if arrived here
+ // Return ok if arrived here
return $result;
}
}
View
95 admin/tool/xmldb/actions/edit_field/edit_field.js
@@ -1,58 +1,52 @@
-/// $Id $
+// 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/>.
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
-// (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-
-/// Register the needed events
+/**
+ * @package tool
+ * @subpackage xmldb
+ * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
- onload=function() {
- /// Adjust the form on load
- transformForm();
+// Register the needed events
+onload=function() {
+ // Adjust the form on load
+ transformForm();
- /// Get the required fields
- var typeField = document.getElementById('menutype');
- var sequenceField = document.getElementById('menusequence');
+ // Get the required fields
+ var typeField = document.getElementById('menutype');
+ var sequenceField = document.getElementById('menusequence');
- /// Register the rest of events
- if (typeField.addEventListener) {
- /// Standard
- typeField.addEventListener('change', transformForm, false);
- sequenceField.addEventListener('change', transformForm, false);
- } else {
- /// IE 5.5
- typeField.attachEvent('onchange', transformForm);
- sequenceField.attachEvent('onchange', transformForm);
- }
+ // Register the rest of events
+ if (typeField.addEventListener) {
+ // Standard
+ typeField.addEventListener('change', transformForm, false);
+ sequenceField.addEventListener('change', transformForm, false);
+ } else {
+ // IE 5.5
+ typeField.attachEvent('onchange', transformForm);
+ sequenceField.attachEvent('onchange', transformForm);
}
+}
/**
* This function controls all modifications to perform when any field changes
*/
function transformForm(event) {
-/// Initialize all the needed variables
+ // Initialize all the needed variables
var typeField = document.getElementById('menutype');
var lengthField = document.getElementById('length');
var decimalsField = document.getElementById('decimals');
@@ -64,14 +58,14 @@ function transformForm(event) {
var lengthTip = document.getElementById('lengthtip');
var decimalsTip = document.getElementById('decimalstip');
-/// Initially, enable everything
+ // Initially, enable everything
decimalsField.disabled = false;
unsignedField.disabled = false;
notnullField.disabled = false;
sequenceField.disabled = false;
defaultField.disabled = false;
-/// Based on sequence, disable some items
+ // Based on sequence, disable some items
if (sequenceField.value == '1') {
unsignedField.disabled = true;
unsignedField.value = '1';
@@ -81,8 +75,7 @@ function transformForm(event) {
defaultField.value = '';
}
-
-/// Based on type, disable some items
+ // Based on type, disable some items
switch (typeField.value) {
case '1': // XMLDB_TYPE_INTEGER
lengthTip.innerHTML = ' 1...20';
@@ -93,13 +86,17 @@ function transformForm(event) {
case '2': // XMLDB_TYPE_NUMBER
lengthTip.innerHTML = ' 1...20';
decimalsTip.innerHTML = ' 0...length or empty';
+ unsignedField.disabled = true;
+ unsignedField.value = '0';
break;
case '3': // XMLDB_TYPE_FLOAT
lengthTip.innerHTML = ' 1...20 or empty';
decimalsTip.innerHTML = ' 0...length or empty';
+ unsignedField.disabled = true;
+ unsignedField.value = '0';
break;
case '4': // XMLDB_TYPE_CHAR
- lengthTip.innerHTML = ' 1...'.xmldb_field::CHAR_MAX_LENGTH;
+ lengthTip.innerHTML = ' 1...1333'; // Hardcoded, yes!
decimalsTip.innerHTML = '';
decimalsField.disabled = true;
decimalsField.value = '';
View
62 admin/tool/xmldb/actions/edit_field_save/edit_field_save.class.php
@@ -38,9 +38,9 @@ class edit_field_save extends XMLDBAction {
function init() {
parent::init();
- /// Set own custom attributes
+ // Set own custom attributes
- /// Get needed strings
+ // Get needed strings
$this->loadStrings(array(
'fieldnameempty' => 'tool_xmldb',
'incorrectfieldname' => 'tool_xmldb',
@@ -69,20 +69,20 @@ function invoke() {
$result = true;
- /// Set own core attributes
+ // Set own core attributes
//$this->does_generate = ACTION_NONE;
$this->does_generate = ACTION_GENERATE_HTML;
- /// These are always here
+ // These are always here
global $CFG, $XMLDB;
- /// Do the job, setting result as needed
+ // Do the job, setting result as needed